feat: sign-in page

feature/issue-1/view-store-detail
Frédérik Benoist 2023-11-22 00:38:20 +01:00
parent 9e0aac7ad3
commit b5d7024ab5
4 changed files with 127 additions and 18 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
<!DOCTYPE html>
<!--
Author: Frederik BENOIST
Product Name: HelpDesk POS
Product Name: HelpDesk Web POS
Product Version: 1.0.0
Contact: frederik.benoist@inetum.com
-->
@ -10,17 +10,17 @@ Contact: frederik.benoist@inetum.com
<!--begin::Head-->
<head>
<!--<base href="/webapp/" />-->
<title>HelpDesk POS - The World's #1 Selling Bootstrap Admin Template - Metronic by KeenThemes</title>
<title>HelpDesk Web POS - XSTORE</title>
<meta charset="utf-8" />
<meta name="description" content="The most advanced Bootstrap 5 Admin Theme with 40 unique prebuilt layouts on Themeforest trusted by 100,000 beginners and professionals. Multi-demo, Dark Mode, RTL support and complete React, Angular, Vue, Asp.Net Core, Rails, Spring, Blazor, Django, Express.js, Node.js, Flask, Symfony & Laravel versions. Grab your copy now and get life-time updates for free." />
<meta name="keywords" content="metronic, bootstrap, bootstrap 5, angular, VueJs, React, Asp.Net Core, Rails, Spring, Blazor, Django, Express.js, Node.js, Flask, Symfony & Laravel starter kits, admin themes, web design, figma, web development, free templates, free admin themes, bootstrap theme, bootstrap template, bootstrap dashboard, bootstrap dak mode, bootstrap button, bootstrap datepicker, bootstrap timepicker, fullcalendar, datatables, flaticon" />
<meta name="description" content="HelpDesk Web POS - XSTORE" />
<meta name="keywords" content="HelpDesk, web, POS" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:locale" content="fr_FR" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Metronic - The World's #1 Selling Bootstrap Admin Template - Metronic by KeenThemes" />
<meta property="og:url" content="https://keenthemes.com/metronic" />
<meta property="og:site_name" content="Metronic by Keenthemes" />
<link rel="canonical" href="https://preview.keenthemes.com/metronic8" />
<meta property="og:title" content="HelpDesk Web POS" />
<meta property="og:url" content="https://inetum.com" />
<meta property="og:site_name" content="HelpDesk Web POS by Inetums" />
<link rel="canonical" href="https://inetum.com" />
<link rel="shortcut icon" href="assets/media/logos/favicon.ico" />
<!--begin::Fonts(mandatory for all pages)-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter:300,400,500,600,700" />
@ -54,7 +54,7 @@ Contact: frederik.benoist@inetum.com
</a>
<!--end::Logo-->
<!--begin::Title-->
<h2 class="text-white fw-normal m-0">Consulter l'activité des caisse XSTORE</h2>
<h2 class="text-white fw-normal m-0">Consulter l'activité des caisses XSTORE</h2>
<!--end::Title-->
</div>
<!--begin::Aside-->
@ -74,16 +74,16 @@ Contact: frederik.benoist@inetum.com
<h1 class="text-gray-900 fw-bolder mb-3">Sign In</h1>
<!--end::Title-->
<!--begin::Subtitle-->
<div class="text-gray-500 fw-semibold fs-6">HelpDesk POS</div>
<div class="text-gray-500 fw-semibold fs-6">HelpDesk Web POS</div>
<!--end::Subtitle=-->
</div>
<!--begin::Heading-->
<!--begin::Login options-->
<!--begin::Input group=-->
<div class="fv-row mb-8">
<!--begin::id_structure-->
<input type="text" placeholder="id_structure" name="id_structure" autocomplete="off" class="form-control bg-transparent" />
<!--end::id_structure-->
<!--begin::user_name-->
<input type="text" placeholder="user_name" name="user_name" autocomplete="off" class="form-control bg-transparent" />
<!--end::user_name-->
</div>
<!--end::Input group=-->
<div class="fv-row mb-3">
@ -124,7 +124,8 @@ Contact: frederik.benoist@inetum.com
<script src="assets/js/scripts.bundle.js"></script>
<!--end::Global Javascript Bundle-->
<!--begin::Custom Javascript(used for this page only)-->
<script src="assets/js/custom/authentication/sign-in/general.js"></script>
<script src="assets/plugins/custom/md5/js-md5 min.js"></script>
<script src="sign-in.js"></script>
<!--end::Custom Javascript-->
<!--end::Javascript-->
</body>

97
sign-in.js Normal file
View File

@ -0,0 +1,97 @@
"use strict";
// Class definition
var KTSigninGeneral = function () {
// Elements
var form;
var submitButton;
var validator;
// Handle form
var handleValidation = function (e) {
// Init form validation rules. For more info check the FormValidation plugin's official documentation:https://formvalidation.io/
validator = FormValidation.formValidation(
form,
{
fields: {
'user_name': {
validators: {
notEmpty: {
message: 'user_name is required'
}
}
},
'password': {
validators: {
notEmpty: {
message: 'The password is required'
}
}
}
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
bootstrap: new FormValidation.plugins.Bootstrap5({
rowSelector: '.fv-row',
eleInvalidClass: '', // comment to enable invalid state icons
eleValidClass: '' // comment to enable valid state icons
})
}
}
);
}
var handleSubmit = function (e) {
// Handle form submit
submitButton.addEventListener('click', function (e) {
// Prevent button default action
e.preventDefault();
// Validate form
validator.validate().then(function (status) {
if (status == 'Valid') {
var hashedUsername = md5(form.querySelector('[name="user_name"]').value);
var hashedPassword = md5(form.querySelector('[name="password"]').value);
if (hashedUsername === '21232f297a57a5a743894a0e4a801fc3' && hashedPassword === '21232f297a57a5a743894a0e4a801fc3') {
// Generate session ID
var sessionId = md5(Math.random().toString(36));
// Store session ID in cookie
var date = new Date(Date.now() + 1 * 24 * 60 * 60 * 1000); // +1 day from now
KTCookie.set("session_id", sessionId, { expires: date });
// Redirect to the appropriate page
location.href = form.getAttribute('data-kt-redirect-url');
} else {
// Show error popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
Swal.fire({
text: "Invalid username or password.",
icon: "error",
buttonsStyling: false,
confirmButton: "Ok, got it!",
customClass: { confirmButton: "btn btn-primary" }
});
}
}
});
});
}
// Public functions
return {
// Initialization
init: function () {
form = document.querySelector('#kt_sign_in_form');
submitButton = document.querySelector('#kt_sign_in_submit');
handleValidation();
handleSubmit(); // used for demo purposes only
}
};
}();
// On document ready
KTUtil.onDOMContentLoaded(function () {
KTSigninGeneral.init();
});

View File

@ -27,7 +27,8 @@ var KTStoreView = function () {
// Display backOffice transaction informations
var statusTransaction = document.getElementById("hb_backOfficeTransactionOk");
if (data.replication.backOfficeTransactionOk) {
debugger;
if (data.transaction.backOfficeTransactionOk==true) {
statusTransaction.classList.add("bg-success");
document.getElementById("hb_backOfficeBusinessDate").classList.add("text-gray-800");
} else {
@ -41,11 +42,11 @@ var KTStoreView = function () {
document.getElementById("hb_backOfficeBusinessDate").innerText = data.transaction.backOfficeBusinessDate;
// Display replication informations
var statusTransaction = document.getElementById("hb_pendingReplicationOk");
var statusReplication = document.getElementById("hb_pendingReplicationOk");
if (data.replication.pendingReplicationOk) {
statusTransaction.classList.add("bg-success");
statusReplication.classList.add("bg-success");
} else {
statusTransaction.classList.add("bg-danger");
statusReplication.classList.add("bg-danger");
}
document.getElementById("hb_pendingReplications").innerText = data.replication.pendingReplications;