Feat: Dogs page.
This commit is contained in:
77
static/js/pages/dog/dogs.js
Normal file
77
static/js/pages/dog/dogs.js
Normal file
@@ -0,0 +1,77 @@
|
||||
|
||||
import API from "../../api.js";
|
||||
import BusinessObjects from "../../lib/business_objects/business_objects.js";
|
||||
import DOM from "../../dom.js";
|
||||
import Events from "../../lib/events.js";
|
||||
import TableBasePage from "../base_table.js";
|
||||
import Utils from "../../lib/utils.js";
|
||||
import Validation from "../../lib/validation.js";
|
||||
import DogTableMixinPage from "./mixin_table.js";
|
||||
|
||||
export default class PageDogDogs extends TableBasePage {
|
||||
static hash = hashPageDogDogs;
|
||||
static attrIdRowObject = attrIdDog;
|
||||
callSaveTableContent = API.saveDogs;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
this.dogMixin = new DogTableMixinPage(this);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
}
|
||||
|
||||
hookupFilters() {
|
||||
this.sharedHookupFilters();
|
||||
this.hookupFilterActive();
|
||||
}
|
||||
|
||||
loadRowTable(rowJson) {
|
||||
if (rowJson == null) return;
|
||||
if (_verbose) { Utils.consoleLogIfNotProductionEnvironment("applying data row: ", rowJson); }
|
||||
}
|
||||
getJsonRow(row) {
|
||||
if (row == null) return;
|
||||
let inputName = row.querySelector('td.' + flagName + ' .' + flagName);
|
||||
let inputAppearance = row.querySelector('td.' + flagAppearance + ' .' + flagAppearance);
|
||||
let inputMassKg = row.querySelector('td.' + flagMassKg + ' .' + flagMassKg);
|
||||
let buttonActive = row.querySelector('td.' + flagActive + ' .' + flagActive);
|
||||
|
||||
let jsonRow = {};
|
||||
jsonRow[attrIdDog] = row.getAttribute(attrIdDog);
|
||||
jsonRow[flagName] = DOM.getElementAttributeValueCurrent(inputName);
|
||||
jsonRow[flagAppearance] = DOM.getElementAttributeValueCurrent(inputAppearance);
|
||||
jsonRow[flagMassKg] = DOM.getElementAttributeValueCurrent(inputMassKg);
|
||||
jsonRow[flagActive] = buttonActive.classList.contains(flagDelete);
|
||||
|
||||
console.log("jsonRow");
|
||||
console.log(jsonRow);
|
||||
|
||||
return jsonRow;
|
||||
}
|
||||
initialiseRowNew(tbody, row) {
|
||||
}
|
||||
postInitialiseRowNewCallback(tbody) {
|
||||
}
|
||||
|
||||
hookupTableMain() {
|
||||
super.hookupTableMain();
|
||||
this.hookupFieldsNameTable();
|
||||
this.hookupFieldsAppearance();
|
||||
this.hookupFieldsMassKg();
|
||||
this.hookupFieldsNotesTable();
|
||||
this.hookupFieldsActive();
|
||||
}
|
||||
hookupFieldsAppearance() {
|
||||
this.hookupChangeHandlerTableCells(flagAppearance);
|
||||
}
|
||||
hookupFieldsMassKg() {
|
||||
this.hookupChangeHandlerTableCells(flagMassKg);
|
||||
}
|
||||
|
||||
leave() {
|
||||
super.leave();
|
||||
}
|
||||
}
|
||||
|
||||
18
static/js/pages/user/company.js
Normal file
18
static/js/pages/user/company.js
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
import BasePage from "../base.js";
|
||||
|
||||
export default class PageUserCompany extends BasePage {
|
||||
static hash = hashPageUserCompany;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
}
|
||||
|
||||
leave() {
|
||||
super.leave();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,86 @@
|
||||
|
||||
import BasePage from "../base.js";
|
||||
import API from "../../api.js";
|
||||
import DogTableMixinPage from "../dog/mixin_table.js";
|
||||
import DOM from "../../dom.js";
|
||||
import TableBasePage from "../base_table.js";
|
||||
|
||||
export default class PageUser extends BasePage {
|
||||
export default class PageUser extends TableBasePage {
|
||||
static hash = hashPageUserAccount;
|
||||
static attrIdRowObject = attrIdUser;
|
||||
callSaveTableContent = API.saveUsers;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
this.dogMixin = new DogTableMixinPage(this);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
this.hookupTableMain();
|
||||
}
|
||||
|
||||
|
||||
hookupFilters() {
|
||||
}
|
||||
|
||||
loadRowTable(rowJson) {
|
||||
if (rowJson == null) return;
|
||||
if (_verbose) { Utils.consoleLogIfNotProductionEnvironment("applying data row: ", rowJson); }
|
||||
}
|
||||
getTableRecords(dirtyOnly = false) {
|
||||
dirtyOnly = true;
|
||||
let container = document.querySelector('.' + flagCard + '.' + flagUser);
|
||||
return [this.getJsonRow(container)];
|
||||
}
|
||||
getJsonRow(container) {
|
||||
console.log("getJsonRow: ", container);
|
||||
if (container == null) return;
|
||||
let inputFirstname = container.querySelector(' #' + flagFirstname);
|
||||
let inputSurname = container.querySelector(' #' + flagSurname);
|
||||
let inputEmail = container.querySelector(' #' + flagEmail);
|
||||
let divRole = container.querySelector('.' + flagRole);
|
||||
|
||||
let idUser = container.getAttribute(attrIdUser);
|
||||
|
||||
let jsonRow = {
|
||||
[attrIdUserAuth0]: null
|
||||
, [flagEmail]: null
|
||||
, [flagIsEmailVerified]: null
|
||||
, [attrIdCompany]: company[attrIdCompany]
|
||||
, [flagIsSuperUser]: null
|
||||
, [flagCanAdminDog]: null
|
||||
, [flagCanAdminUser]: null
|
||||
, [flagCompany]: null
|
||||
, [flagRole]: null
|
||||
};
|
||||
|
||||
jsonRow[attrIdUser] = idUser;
|
||||
jsonRow[attrIdRole] = DOM.getElementAttributeValueCurrent(divRole);
|
||||
jsonRow[flagFirstname] = DOM.getElementAttributeValueCurrent(inputFirstname);
|
||||
jsonRow[flagSurname] = DOM.getElementAttributeValueCurrent(inputSurname);
|
||||
jsonRow[flagEmail] = DOM.getElementAttributeValueCurrent(inputEmail);
|
||||
return jsonRow;
|
||||
}
|
||||
|
||||
initialiseRowNew(tbody, row) {
|
||||
}
|
||||
postInitialiseRowNewCallback(tbody) {
|
||||
}
|
||||
|
||||
hookupTableMain() {
|
||||
super.hookupTableMain();
|
||||
this.hookupFieldsFirstname();
|
||||
this.hookupFieldsSurname();
|
||||
this.hookupFieldsEmail();
|
||||
}
|
||||
hookupFieldsFirstname() {
|
||||
this.hookupChangeHandlerTableCells('.' + flagCard + '.' + flagUser + ' #' + flagFirstname);
|
||||
}
|
||||
hookupFieldsSurname() {
|
||||
this.hookupChangeHandlerTableCells('.' + flagCard + '.' + flagUser + ' #' + flagSurname);
|
||||
}
|
||||
hookupFieldsEmail() {
|
||||
this.hookupChangeHandlerTableCells('.' + flagCard + '.' + flagUser + ' #' + flagEmail);
|
||||
}
|
||||
|
||||
leave() {
|
||||
|
||||
Reference in New Issue
Block a user