50 lines
1.6 KiB
JavaScript
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); |