Files
P42_UI/app/controllers/common/onboardingController.js
T
2025-08-27 07:03:09 +00:00

50 lines
1.6 KiB
JavaScript

class onboardingController extends EICController {
async index() {
let profile = await this.openDialog(
await this.loadContent(
'common/onboarding/dialogs/onboardingLandingDialog', { title: 'Welcome to the EIC platform!' }, {})
);
if(profile) { this.onboardProfile(profile); }
}
async onboardProfile(profile) {
let options = { view: '', label: '' };
switch(profile) {
case 'Applicant':
options.view = 'common/onboarding/dialogs/onboardingApplicantDialog';
options.label = 'Now tell us about your organisation';
break;
}
app.User.getBusinessPermissions(['/organisations'])
.then(async payload => {
let rc = await this.openDialog(
await this.loadContent(
options.view,
{ title: options.label },
{ models: {'user': new onboardingUserModel(payload['/organisations'].permissions) } }
)
);
if(!rc) this.index();
else {
if(rc.request=='join') {
await this.openDialog(
await this.loadContent(
'common/onboarding/dialogs/onboardingRequestSuccessDialog',
{ title: 'Request successfull' },
{ legalname: rc.legalname }
)
);
}
}
})
}
}
app.registerClass('onboardingController', onboardingController);