Fix: Hamburger menu styles.
This commit is contained in:
@@ -64,11 +64,21 @@ export default class API {
|
||||
updateUser: (id, userData) => request(`/users/${id}`, 'PUT', userData),
|
||||
deleteUser: (id) => request(`/users/${id}`, 'DELETE'),
|
||||
*/
|
||||
|
||||
// User
|
||||
static async loginUser() {
|
||||
let callback = {};
|
||||
callback[flagCallback] = DOM.getHashPageCurrent();
|
||||
return await API.request(hashPageUserLogin, 'POST', callback);
|
||||
}
|
||||
static async saveUsers(users, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
dataRequest[flagUser] = users;
|
||||
dataRequest[flagComment] = comment;
|
||||
return await API.request(hashSaveDogUser, 'POST', dataRequest);
|
||||
}
|
||||
|
||||
|
||||
// dog
|
||||
// Command categories
|
||||
|
||||
@@ -39,7 +39,7 @@ export default class BasePage {
|
||||
}
|
||||
|
||||
logInitialisation() {
|
||||
Utils.consoleLogIfNotProductionEnvironment('Initializing ' + this.title + ' page');
|
||||
Utils.consoleLogIfNotProductionEnvironment('Initialising ' + this.title + ' page');
|
||||
}
|
||||
|
||||
hookupCommonElements() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import BasePage from "../base.js";
|
||||
|
||||
export default class PageUser extends BasePage {
|
||||
static hash = hashPageUser;
|
||||
static hash = hashPageUserAccount;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
@@ -10,7 +10,6 @@ export default class PageUser extends BasePage {
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
this.hookupButtonsNavContact();
|
||||
}
|
||||
|
||||
leave() {
|
||||
|
||||
107
static/js/pages/user/users.js
Normal file
107
static/js/pages/user/users.js
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
import API from "../../api";
|
||||
import DogTableMixinPage from "../dog/mixin_table";
|
||||
import DOM from "../../dom";
|
||||
import TableBasePage from "../base_table";
|
||||
import Utils from "../../lib/utils";
|
||||
|
||||
export default class PageUsers extends TableBasePage {
|
||||
static hash = hashPageUserAccounts;
|
||||
static attrIdRowObject = attrIdUser;
|
||||
callSaveTableContent = API.saveUsers;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
this.dogMixin = new DogTableMixinPage(this);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
}
|
||||
|
||||
hookupFilters() {
|
||||
this.sharedHookupFilters();
|
||||
this.hookupFilterCompany();
|
||||
this.hookupFilterActive();
|
||||
}
|
||||
hookupFilterCompany() {
|
||||
this.hookupFilter(attrIdCompany);
|
||||
}
|
||||
|
||||
loadRowTable(rowJson) {
|
||||
if (rowJson == null) return;
|
||||
if (_verbose) { Utils.consoleLogIfNotProductionEnvironment("applying data row: ", rowJson); }
|
||||
}
|
||||
getJsonRow(row) {
|
||||
if (row == null) return;
|
||||
// let tdCompany = row.querySelector('td.' + flagCompany);
|
||||
let inputRole = row.querySelector('td.' + flagRole + ' .' + flagRole);
|
||||
let inputFirstname = row.querySelector('td.' + flagFirstname + ' .' + flagFirstname);
|
||||
let inputSurname = row.querySelector('td.' + flagSurname + ' .' + flagSurname);
|
||||
let inputNotes = row.querySelector('td.' + flagNotes + ' .' + flagNotes);
|
||||
let buttonActive = row.querySelector('td.' + flagActive + ' .' + flagActive);
|
||||
|
||||
let jsonRow = {
|
||||
[attrIdUserAuth0]: null
|
||||
, [flagEmail]: null
|
||||
, [flagIsEmailVerified]: null
|
||||
, [attrIdCompany]: company[attrIdCompany]
|
||||
, [flagIsSuperUser]: null
|
||||
, [flagCanAdminDog]: null
|
||||
, [flagCanAdminUser]: null
|
||||
, [flagCompany]: null
|
||||
, [flagRole]: null
|
||||
};
|
||||
jsonRow[attrIdUser] = row.getAttribute(attrIdUser);
|
||||
// jsonRow[attrIdCompany] = tdCompany.getAttribute(attrIdCompany);
|
||||
jsonRow[attrIdRole] = DOM.getElementAttributeValueCurrent(inputRole);
|
||||
jsonRow[flagFirstname] = DOM.getElementAttributeValueCurrent(inputFirstname);
|
||||
jsonRow[flagSurname] = DOM.getElementAttributeValueCurrent(inputSurname);
|
||||
jsonRow[flagNotes] = DOM.getElementAttributeValueCurrent(inputNotes);
|
||||
jsonRow[flagActive] = buttonActive.classList.contains(flagDelete);
|
||||
|
||||
console.log("jsonRow");
|
||||
console.log(jsonRow);
|
||||
|
||||
return jsonRow;
|
||||
}
|
||||
|
||||
initialiseRowNew(tbody, row) {
|
||||
|
||||
}
|
||||
postInitialiseRowNewCallback(tbody) {
|
||||
let newRows = tbody.querySelectorAll('tr.' + flagRowNew);
|
||||
let newestRow = newRows[0];
|
||||
let clickableElementsSelector = [
|
||||
'td.' + flagRole + ' div.' + flagRole
|
||||
].join('');
|
||||
newestRow.querySelectorAll(clickableElementsSelector).forEach((clickableElement) => {
|
||||
clickableElement.click();
|
||||
});
|
||||
}
|
||||
|
||||
hookupTableMain() {
|
||||
super.hookupTableMain();
|
||||
this.hookupFieldsRole();
|
||||
this.hookupFieldsFirstname();
|
||||
this.hookupFieldsSurname();
|
||||
this.hookupFieldsNotesTable();
|
||||
this.hookupFieldsActive();
|
||||
}
|
||||
hookupFieldsRole() {
|
||||
this.hookupTableCellDdlPreviews(
|
||||
flagRole
|
||||
, Utils.getListFromDict(filterRoles) // .sort((a, b) => a[flagName].localeCompare(b[flagName]))
|
||||
);
|
||||
}
|
||||
hookupFieldsFirstname() {
|
||||
this.hookupChangeHandlerTableCells(flagFirstname);
|
||||
}
|
||||
hookupFieldsSurname() {
|
||||
this.hookupChangeHandlerTableCells(flagSurname);
|
||||
}
|
||||
|
||||
leave() {
|
||||
super.leave();
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,8 @@ 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 PageUser from './pages/user/user.js';
|
||||
import PageUsers from './pages/user/users.js';
|
||||
|
||||
import API from './api.js';
|
||||
import DOM from './dom.js';
|
||||
@@ -64,7 +65,8 @@ export default class Router {
|
||||
// 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' };
|
||||
this.pages[hashPageUserAccount] = { name: 'PageUser', module: PageUser };
|
||||
this.pages[hashPageUserAccounts] = { name: 'PageUsers', module: PageUsers };
|
||||
// Routes
|
||||
this.routes = {};
|
||||
// Core
|
||||
@@ -93,7 +95,8 @@ export default class Router {
|
||||
// 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.routes[hashPageUserAccount] = (isPopState = false) => this.navigateToHash(hashPageUserAccount, isPopState);
|
||||
this.routes[hashPageUserAccounts] = (isPopState = false) => this.navigateToHash(hashPageUserAccounts, isPopState);
|
||||
this.initialize();
|
||||
}
|
||||
loadPage(hashPage, isPopState = false) {
|
||||
|
||||
Reference in New Issue
Block a user