Feat: Founding Partner login with autocreation of User, User Role Link, Company, User Company Link as necessary and autologin with new user - for approved Founding Partners only, otherwise redirected to login page.
This commit is contained in:
@@ -85,7 +85,7 @@ export default class API {
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
dataRequest[flagCompany] = companies;
|
||||
dataRequest[flagComment] = comment;
|
||||
return await API.request(hashSaveDogCompany, 'POST', dataRequest);
|
||||
return await API.request(hashSaveUserCompany, 'POST', dataRequest);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,108 @@
|
||||
|
||||
import BasePage from "../base.js";
|
||||
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 "../dog/mixin_table.js";
|
||||
|
||||
export default class PageUserCompany extends BasePage {
|
||||
var _rowBlankDistraction;
|
||||
var _rowBlankAssessmentCommandModalityLink;
|
||||
|
||||
export default class PageUserCompany extends TableBasePage {
|
||||
static hash = hashPageUserCompany;
|
||||
static attrIdRowObject = attrIdCompany;
|
||||
callSaveTableContent = API.saveCompanies;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
this.dogMixin = new DogTableMixinPage(this);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
}
|
||||
|
||||
hookupFilters() {
|
||||
}
|
||||
|
||||
loadRowTable(rowJson) {
|
||||
if (rowJson == null) return;
|
||||
if (_verbose) { Utils.consoleLogIfNotProductionEnvironment("applying data row: ", rowJson); }
|
||||
}
|
||||
getTableRecords(dirtyOnly = false) {
|
||||
dirtyOnly = true;
|
||||
let container = document.querySelector('.' + flagContainer + '.' + flagUser);
|
||||
let nameInput = document.getElementById(flagName);
|
||||
let websiteInput = document.getElementById(flagWebsite);
|
||||
let companies = [];
|
||||
if (!dirtyOnly || container.classList.contains(flagDirty)) companies.push({
|
||||
[attrIdCompany]: container.getAttribute(attrIdCompany)
|
||||
, [flagName]: DOM.getElementAttributeValueCurrent(nameInput)
|
||||
, [flagWebsite]: DOM.getElementAttributeValueCurrent(websiteInput)
|
||||
, [flagActive]: true
|
||||
});
|
||||
return companies;
|
||||
}
|
||||
initialiseRowNew(tbody, row) {
|
||||
}
|
||||
postInitialiseRowNewCallback(tbody) {
|
||||
}
|
||||
callFilterTableContent() {
|
||||
super.callFilterTableContent();
|
||||
}
|
||||
|
||||
hookupTableMain() {
|
||||
super.hookupTableMain();
|
||||
this.hookupNameInput();
|
||||
this.hookupWebsiteInput();
|
||||
}
|
||||
hookupNameInput() {
|
||||
let selector = '#' + flagName;
|
||||
Events.initialiseEventHandler(selector, flagInitialised, (nameInput) => {
|
||||
nameInput.addEventListener("change", (event) => {
|
||||
nameInput = event.target;
|
||||
let container = document.querySelector('.' + flagContainer + '.' + flagUser);
|
||||
let wasDirtyContainer = container.classList.contains(flagDirty);
|
||||
let wasDirtyElement = nameInput.classList.contains(flagDirty);
|
||||
let isDirtyElement = DOM.updateAndCheckIsElementDirty(nameInput);
|
||||
if (isDirtyElement == wasDirtyElement) return;
|
||||
let isDirtyContainer = DOM.hasDirtyChildrenContainer(container); // wasDirtyContainer || isDirtyElement;
|
||||
if (isDirtyContainer) {
|
||||
container.classList.add(flagDirty);
|
||||
}
|
||||
else {
|
||||
container.classList.remove(flagDirty);
|
||||
}
|
||||
this.updateAndToggleShowButtonsSaveCancel();
|
||||
});
|
||||
});
|
||||
}
|
||||
hookupWebsiteInput() {
|
||||
let selector = '#' + flagWebsite;
|
||||
Events.initialiseEventHandler(selector, flagInitialised, (websiteInput) => {
|
||||
websiteInput.addEventListener("change", (event) => {
|
||||
websiteInput = event.target;
|
||||
let container = document.querySelector('.' + flagContainer + '.' + flagUser);
|
||||
let wasDirtyContainer = container.classList.contains(flagDirty);
|
||||
let wasDirtyElement = websiteInput.classList.contains(flagDirty);
|
||||
let isDirtyElement = DOM.updateAndCheckIsElementDirty(websiteInput);
|
||||
if (isDirtyElement == wasDirtyElement) return;
|
||||
let isDirtyContainer = DOM.hasDirtyChildrenContainer(container); // wasDirtyContainer || isDirtyElement;
|
||||
if (isDirtyContainer) {
|
||||
container.classList.add(flagDirty);
|
||||
}
|
||||
else {
|
||||
container.classList.remove(flagDirty);
|
||||
}
|
||||
this.updateAndToggleShowButtonsSaveCancel();
|
||||
});
|
||||
});
|
||||
}
|
||||
leave() {
|
||||
super.leave();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user