Feat(SQL, UI): Redesign database with much more detailed command response quality analysis and created successfully loading Dog Command Links page
This commit is contained in:
@@ -56,4 +56,38 @@ export default class API {
|
||||
API.goToUrl(url);
|
||||
}
|
||||
|
||||
// specific api calls
|
||||
/* Example:
|
||||
getUsers: () => request('/users'),
|
||||
getUserById: (id) => request(`/users/${id}`),
|
||||
createUser: (userData) => request('/users', 'POST', userData),
|
||||
updateUser: (id, userData) => request(`/users/${id}`, 'PUT', userData),
|
||||
deleteUser: (id) => request(`/users/${id}`, 'DELETE'),
|
||||
*/
|
||||
static async loginUser() {
|
||||
let callback = {};
|
||||
callback[flagCallback] = DOM.getHashPageCurrent();
|
||||
return await API.request(hashPageUserLogin, 'POST', callback);
|
||||
}
|
||||
|
||||
/*
|
||||
// store
|
||||
// product categories
|
||||
static async saveCategories(categories, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
dataRequest[flagProductCategory] = categories;
|
||||
dataRequest[flagComment] = comment;
|
||||
return await API.request(hashSaveStoreProductCategory, 'POST', dataRequest);
|
||||
}
|
||||
|
||||
// products
|
||||
static async saveProducts(products, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
dataRequest[flagProduct] = products;
|
||||
dataRequest[flagComment] = comment;
|
||||
return await API.request(hashSaveStoreProduct, 'POST', dataRequest);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ export default class BasePage {
|
||||
hookupCommonElements() {
|
||||
// hookupVideos();
|
||||
this.hookupLogos();
|
||||
this.hookupNavigation();
|
||||
this.hookupOverlays();
|
||||
}
|
||||
|
||||
@@ -55,6 +56,78 @@ export default class BasePage {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
hookupNavigation() {
|
||||
this.hookupEventHandler("click", idButtonHamburger, (event, element) => {
|
||||
let overlayHamburger = document.querySelector(idOverlayHamburger);
|
||||
if (overlayHamburger.classList.contains(flagCollapsed)) {
|
||||
overlayHamburger.classList.remove(flagCollapsed);
|
||||
overlayHamburger.classList.add(flagExpanded);
|
||||
} else {
|
||||
overlayHamburger.classList.remove(flagExpanded);
|
||||
overlayHamburger.classList.add(flagCollapsed);
|
||||
}
|
||||
});
|
||||
|
||||
this.hookupButtonsNavHome();
|
||||
this.hookupButtonsNavUserAccount();
|
||||
this.hookupButtonsNavUserLogout();
|
||||
this.hookupButtonsNavUserLogin();
|
||||
|
||||
// this.hookupButtonsNavStoreHome();
|
||||
// this.hookupButtonsNavStoreManufacturingPurchaseOrders();
|
||||
this.hookupButtonsNavAdminHome();
|
||||
}
|
||||
hookupEventHandler(eventType, selector, callback) {
|
||||
Events.initialiseEventHandler(selector, flagInitialised, (element) => {
|
||||
element.addEventListener(eventType, (event) => {
|
||||
event.stopPropagation();
|
||||
callback(event, element);
|
||||
});
|
||||
});
|
||||
}
|
||||
hookupButtonsNavHome() {
|
||||
this.hookupButtonsNav('.' + flagNavHome, hashPageHome);
|
||||
}
|
||||
hookupButtonsNav(buttonSelector, hashPageNav) {
|
||||
this.hookupEventHandler("click", buttonSelector, (event, button) => {
|
||||
this.router.navigateToHash(hashPageNav);
|
||||
});
|
||||
}
|
||||
hookupButtonsNavServices() {
|
||||
this.hookupButtonsNav('.' + flagNavServices, hashPageServices);
|
||||
}
|
||||
hookupButtonsNavUserAccount() {
|
||||
this.hookupButtonsNav('.' + flagNavUserAccount, hashPageUserAccount);
|
||||
}
|
||||
hookupButtonsNavUserLogout() {
|
||||
this.hookupButtonsNav('.' + flagNavUserLogout, hashPageUserLogout);
|
||||
}
|
||||
hookupButtonsNavUserLogin() {
|
||||
this.hookupEventHandler("click", '.' + flagNavUserLogin, (event, navigator) => {
|
||||
event.stopPropagation();
|
||||
this.leave();
|
||||
API.loginUser()
|
||||
.then((response) => {
|
||||
if (response.Success) {
|
||||
window.location.href = response[flagCallback];
|
||||
} else {
|
||||
DOM.alertError("Error", response.Message);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/*
|
||||
hookupButtonsNavDogHome() {
|
||||
this.hookupButtonsNav('.' + flagNavDogHome, hashPageDogHome);
|
||||
}
|
||||
*/
|
||||
hookupButtonsNavDogDogCommandLink() {
|
||||
this.hookupButtonsNav('.' + flagNavDogDogCommandLink, hashPageDogDogCommandLink);
|
||||
}
|
||||
hookupButtonsNavAdminHome() {
|
||||
this.hookupButtonsNav('.' + flagNavAdminHome, hashPageAdminHome);
|
||||
}
|
||||
|
||||
hookupLogos() {
|
||||
this.hookupEventHandler("click", "." + flagImageLogo + "," + "." + flagLogo, (event, element) => {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// internal
|
||||
import BasePage from "../base.js";
|
||||
// vendor
|
||||
import { Altcha } from "../../vendor/altcha.js";
|
||||
|
||||
export default class PageContactSuccess extends BasePage {
|
||||
static hash = hashPageContactSuccess;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// internal
|
||||
import BasePage from "../base.js";
|
||||
// vendor
|
||||
import { Altcha } from "../../vendor/altcha.js";
|
||||
|
||||
export default class PageContact extends BasePage {
|
||||
static hash = hashPageContact;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
this.hookupButtonSubmitFormContactUs();
|
||||
}
|
||||
|
||||
hookupButtonSubmitFormContactUs() {
|
||||
const button = document.querySelector('form input[type="submit"]');
|
||||
button.classList.add(flagButton);
|
||||
button.classList.add(flagButtonPrimary);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export default class PageHome extends BasePage {
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
this.hookupButtonsNavContact();
|
||||
// this.hookupButtonsNav();
|
||||
}
|
||||
|
||||
leave() {
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
// Pages
|
||||
// Core
|
||||
import PageHome from './pages/core/home.js';
|
||||
import PageContact from './pages/core/contact.js';
|
||||
import PageContactSuccess from './pages/core/contact-success.js';
|
||||
// Legal
|
||||
import PageAccessibilityReport from './pages/legal/accessibility_report.js';
|
||||
import PageAccessibilityStatement from './pages/legal/accessibility_statement.js';
|
||||
import PageLicense from './pages/legal/license.js';
|
||||
import PagePrivacyPolicy from './pages/legal/privacy_policy.js';
|
||||
import PageRetentionSchedule from './pages/legal/retention_schedule.js';
|
||||
// User
|
||||
// import PageUserLogin from './pages/user/login.js';
|
||||
// import PageUserLogout from './pages/user/logout.js';
|
||||
// import PageUserAccount from './pages/user/account.js';
|
||||
|
||||
import API from './api.js';
|
||||
import DOM from './dom.js';
|
||||
@@ -22,13 +24,15 @@ export default class Router {
|
||||
this.pages = {};
|
||||
// Core
|
||||
this.pages[hashPageHome] = { name: 'PageHome', module: PageHome };
|
||||
this.pages[hashPageContact] = { name: 'PageContact', module: PageContact };
|
||||
this.pages[hashPageContactSuccess] = { name: 'PageContact', module: PageContactSuccess };
|
||||
// Legal
|
||||
this.pages[hashPageAccessibilityStatement] = { name: 'PageAccessibilityStatement', module: PageAccessibilityStatement };
|
||||
this.pages[hashPageDataRetentionSchedule] = { name: 'PageDataRetentionSchedule', module: PageRetentionSchedule };
|
||||
this.pages[hashPageLicense] = { name: 'PageLicense', module: PageLicense };
|
||||
this.pages[hashPagePrivacyPolicy] = { name: 'PagePrivacyPolicy', module: PagePrivacyPolicy };
|
||||
// User
|
||||
// this.pages[hashPageUserLogin] = { name: 'PageUserLogin', module: PageUserLogin }; // pathModule: './pages/user/login.js' };
|
||||
// this.pages[hashPageUserLogout] = { name: 'PageUserLogout', module: PageUserLogout }; // pathModule: './pages/user/logout.js' };
|
||||
// this.pages[hashPageUserAccount] = { name: 'PageUserAccount', module: PageUserAccount }; // pathModule: './pages/user/account.js' };
|
||||
// Routes
|
||||
this.routes = {};
|
||||
// Core
|
||||
@@ -39,6 +43,10 @@ export default class Router {
|
||||
this.routes[hashPageDataRetentionSchedule] = (isPopState = false) => this.navigateToHash(hashPageDataRetentionSchedule, isPopState);
|
||||
this.routes[hashPageLicense] = (isPopState = false) => this.navigateToHash(hashPageLicense, isPopState);
|
||||
this.routes[hashPagePrivacyPolicy] = (isPopState = false) => this.navigateToHash(hashPagePrivacyPolicy, isPopState);
|
||||
// User
|
||||
// this.routes[hashPageUserLogin] = (isPopState = false) => this.navigateToHash(hashPageUserLogin, isPopState);
|
||||
// this.routes[hashPageUserLogout] = (isPopState = false) => this.navigateToHash(hashPageUserLogout, isPopState);
|
||||
// this.routes[hashPageUserAccount] = (isPopState = false) => this.navigateToHash(hashPageUserAccount, isPopState);
|
||||
this.initialize();
|
||||
}
|
||||
loadPage(hashPage, isPopState = false) {
|
||||
|
||||
Reference in New Issue
Block a user