@flusys/ng-auth 9.1.0 → 9.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +2 -0
  2. package/fesm2022/flusys-ng-auth-administration-page.component-DmN4KqiR.mjs +146 -0
  3. package/fesm2022/flusys-ng-auth-administration-page.component-DmN4KqiR.mjs.map +1 -0
  4. package/fesm2022/flusys-ng-auth-branch-form.component-Df_sMC2G.mjs +743 -0
  5. package/fesm2022/flusys-ng-auth-branch-form.component-Df_sMC2G.mjs.map +1 -0
  6. package/fesm2022/flusys-ng-auth-branch-list.component-CWat6QWN.mjs +775 -0
  7. package/fesm2022/flusys-ng-auth-branch-list.component-CWat6QWN.mjs.map +1 -0
  8. package/fesm2022/flusys-ng-auth-company-form.component-BvZ4Pn8j.mjs +198 -0
  9. package/fesm2022/flusys-ng-auth-company-form.component-BvZ4Pn8j.mjs.map +1 -0
  10. package/fesm2022/flusys-ng-auth-company-list.component-Corh9AIh.mjs +241 -0
  11. package/fesm2022/flusys-ng-auth-company-list.component-Corh9AIh.mjs.map +1 -0
  12. package/fesm2022/flusys-ng-auth-extension-order.util-2XWSLqii.mjs +6 -0
  13. package/fesm2022/flusys-ng-auth-extension-order.util-2XWSLqii.mjs.map +1 -0
  14. package/fesm2022/flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs +384 -0
  15. package/fesm2022/flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs.map +1 -0
  16. package/fesm2022/flusys-ng-auth-login-page.component-DQl52Qau.mjs +1074 -0
  17. package/fesm2022/flusys-ng-auth-login-page.component-DQl52Qau.mjs.map +1 -0
  18. package/fesm2022/flusys-ng-auth-profile-page.component-b-8rPEXQ.mjs +1792 -0
  19. package/fesm2022/flusys-ng-auth-profile-page.component-b-8rPEXQ.mjs.map +1 -0
  20. package/fesm2022/flusys-ng-auth-register-page.component-D99y1jiA.mjs +1513 -0
  21. package/fesm2022/flusys-ng-auth-register-page.component-D99y1jiA.mjs.map +1 -0
  22. package/fesm2022/flusys-ng-auth-reset-password-page.component-C0tN_AW1.mjs +538 -0
  23. package/fesm2022/flusys-ng-auth-reset-password-page.component-C0tN_AW1.mjs.map +1 -0
  24. package/fesm2022/flusys-ng-auth-social-callback-page.component-gTD7_LJY.mjs +217 -0
  25. package/fesm2022/flusys-ng-auth-social-callback-page.component-gTD7_LJY.mjs.map +1 -0
  26. package/fesm2022/flusys-ng-auth-social-config-page.component-DpGmcb9n.mjs +541 -0
  27. package/fesm2022/flusys-ng-auth-social-config-page.component-DpGmcb9n.mjs.map +1 -0
  28. package/fesm2022/flusys-ng-auth-user-form.component-CM9UYc0q.mjs +1171 -0
  29. package/fesm2022/flusys-ng-auth-user-form.component-CM9UYc0q.mjs.map +1 -0
  30. package/fesm2022/flusys-ng-auth-user-list.component-Bew7gz-H.mjs +1046 -0
  31. package/fesm2022/flusys-ng-auth-user-list.component-Bew7gz-H.mjs.map +1 -0
  32. package/fesm2022/flusys-ng-auth-verify-email-page.component-DB9iKvt3.mjs +545 -0
  33. package/fesm2022/flusys-ng-auth-verify-email-page.component-DB9iKvt3.mjs.map +1 -0
  34. package/fesm2022/flusys-ng-auth.mjs +3030 -10735
  35. package/fesm2022/flusys-ng-auth.mjs.map +1 -1
  36. package/package.json +5 -5
  37. package/types/flusys-ng-auth.d.ts +978 -1558
@@ -0,0 +1,1513 @@
1
+ import { AUTH_REGISTRATION_EXTENSION, AuthApiService, AuthStateService, EmailPolicyService, PasswordPolicyService, REGISTRATION_FIELD_CONTEXT } from "./flusys-ng-auth.mjs";
2
+ import { t as sortByOrder } from "./flusys-ng-auth-extension-order.util-2XWSLqii.mjs";
3
+ import * as i0 from "@angular/core";
4
+ import { Component, DestroyRef, Injector, computed, effect, inject, input, signal } from "@angular/core";
5
+ import { APP_CONFIG, getDefaultBranchSlug, getDefaultCompanySlug, isCompanyFeatureEnabled } from "@flusys/ng-core";
6
+ import { ActivatedRoute, Router, RouterLink } from "@angular/router";
7
+ import { TranslatePipe, TranslateService } from "@flusys/ng-shared";
8
+ import { NgComponentOutlet, NgTemplateOutlet } from "@angular/common";
9
+ import { CheckboxComponent, FButtonDirective, InputTextDirective, MessageService, PasswordComponent, SelectComponent, TextareaDirective, UiIconComponent } from "@flusys/ng-ui";
10
+ import { AppFloatingConfigurator } from "@flusys/ng-layout";
11
+ import { takeUntilDestroyed, toSignal } from "@angular/core/rxjs-interop";
12
+ import * as i1 from "@angular/forms";
13
+ import { FormsModule } from "@angular/forms";
14
+ import { FormField, form, minLength, required } from "@angular/forms/signals";
15
+ var RegisterPageComponent = class RegisterPageComponent {
16
+ destroyRef = inject(DestroyRef);
17
+ appConfig = inject(APP_CONFIG);
18
+ messageService = inject(MessageService);
19
+ authApi = inject(AuthApiService);
20
+ authState = inject(AuthStateService);
21
+ route = inject(ActivatedRoute);
22
+ router = inject(Router);
23
+ emailPolicy = inject(EmailPolicyService);
24
+ passwordPolicy = inject(PasswordPolicyService);
25
+ registrationExtension = inject(AUTH_REGISTRATION_EXTENSION, { optional: true });
26
+ translateAdapter = inject(TranslateService, { optional: true });
27
+ translate(key, vars) {
28
+ return this.translateAdapter?.translate(key, vars) ?? key;
29
+ }
30
+ queryParamMap = toSignal(this.route.queryParamMap);
31
+ companySlugInitialized = false;
32
+ returnUrl = input("", ...ngDevMode ? [{ debugName: "returnUrl" }] : /* istanbul ignore next */ []);
33
+ isLoading = signal(false, ...ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []);
34
+ companyFeatureEnabled = computed(() => isCompanyFeatureEnabled(this.appConfig), ...ngDevMode ? [{ debugName: "companyFeatureEnabled" }] : /* istanbul ignore next */ []);
35
+ defaultCompanySlug = computed(() => getDefaultCompanySlug(this.appConfig), ...ngDevMode ? [{ debugName: "defaultCompanySlug" }] : /* istanbul ignore next */ []);
36
+ defaultBranchSlug = computed(() => getDefaultBranchSlug(this.appConfig), ...ngDevMode ? [{ debugName: "defaultBranchSlug" }] : /* istanbul ignore next */ []);
37
+ hasDefaultCompany = computed(() => !!this.defaultCompanySlug(), ...ngDevMode ? [{ debugName: "hasDefaultCompany" }] : /* istanbul ignore next */ []);
38
+ hasDefaultBranch = computed(() => !!this.defaultBranchSlug(), ...ngDevMode ? [{ debugName: "hasDefaultBranch" }] : /* istanbul ignore next */ []);
39
+ extraFields = computed(() => {
40
+ if (!this.registrationExtension) return [];
41
+ return sortByOrder(this.registrationExtension.getExtraFields());
42
+ }, ...ngDevMode ? [{ debugName: "extraFields" }] : /* istanbul ignore next */ []);
43
+ extraFieldsModel = signal(this.extraFields().reduce((acc, field) => {
44
+ if (field.defaultValue !== void 0) acc[field.key] = field.defaultValue;
45
+ return acc;
46
+ }, {}), ...ngDevMode ? [{ debugName: "extraFieldsModel" }] : /* istanbul ignore next */ []);
47
+ userFormModel = signal({
48
+ name: "",
49
+ email: "",
50
+ password: "",
51
+ confirmPassword: "",
52
+ phone: ""
53
+ }, ...ngDevMode ? [{ debugName: "userFormModel" }] : /* istanbul ignore next */ []);
54
+ userForm = form(this.userFormModel, (f) => {
55
+ required(f.name, { message: this.translate("shared.name.required") });
56
+ minLength(f.name, 2, { message: this.translate("auth.validation.name.min.length", { min: 2 }) });
57
+ required(f.email, { message: this.translate("auth.validation.email.required") });
58
+ required(f.password, { message: this.translate("auth.validation.password.required") });
59
+ required(f.confirmPassword, { message: this.translate("auth.validation.confirm.password.required") });
60
+ });
61
+ companyFormModel = signal({
62
+ createNewCompany: false,
63
+ companySlug: "",
64
+ branchSlug: "",
65
+ newCompanyName: "",
66
+ newCompanyPhone: "",
67
+ newCompanyAddress: ""
68
+ }, ...ngDevMode ? [{ debugName: "companyFormModel" }] : /* istanbul ignore next */ []);
69
+ companyForm = form(this.companyFormModel);
70
+ emailValidationError = computed(() => this.emailPolicy.validate(this.userFormModel().email), ...ngDevMode ? [{ debugName: "emailValidationError" }] : /* istanbul ignore next */ []);
71
+ passwordValidationError = computed(() => this.passwordPolicy.validate(this.userFormModel().password), ...ngDevMode ? [{ debugName: "passwordValidationError" }] : /* istanbul ignore next */ []);
72
+ extraFieldsValidationError = computed(() => {
73
+ if (!this.registrationExtension?.validateExtraFields) return null;
74
+ return this.registrationExtension.validateExtraFields(this.extraFieldsModel());
75
+ }, ...ngDevMode ? [{ debugName: "extraFieldsValidationError" }] : /* istanbul ignore next */ []);
76
+ passwordsMatch = computed(() => {
77
+ const model = this.userFormModel();
78
+ return model.password === model.confirmPassword;
79
+ }, ...ngDevMode ? [{ debugName: "passwordsMatch" }] : /* istanbul ignore next */ []);
80
+ isFormValid = computed(() => {
81
+ const userModel = this.userFormModel();
82
+ const emailError = this.emailValidationError();
83
+ const passwordError = this.passwordValidationError();
84
+ const extraFieldsError = this.extraFieldsValidationError();
85
+ const userValid = userModel.name.trim().length >= 2 && userModel.email.includes("@") && !emailError && userModel.password.length > 0 && !passwordError && userModel.confirmPassword.length > 0 && this.passwordsMatch() && !extraFieldsError;
86
+ const extraFieldsValid = this.validateRequiredExtraFields();
87
+ if (!isCompanyFeatureEnabled(this.appConfig)) return userValid && extraFieldsValid;
88
+ const companyModel = this.companyFormModel();
89
+ if (companyModel.createNewCompany) return userValid && extraFieldsValid && companyModel.newCompanyName.trim().length > 0;
90
+ return userValid && extraFieldsValid;
91
+ }, ...ngDevMode ? [{ debugName: "isFormValid" }] : /* istanbul ignore next */ []);
92
+ validateRequiredExtraFields() {
93
+ const fields = this.extraFields();
94
+ const values = this.extraFieldsModel();
95
+ for (const field of fields) if (field.required) {
96
+ const value = values[field.key];
97
+ if (value === void 0 || value === null || value === "") return false;
98
+ }
99
+ return true;
100
+ }
101
+ updateExtraField(key, value) {
102
+ this.extraFieldsModel.update((model) => ({
103
+ ...model,
104
+ [key]: value
105
+ }));
106
+ }
107
+ getFieldTemplateContext(field) {
108
+ return {
109
+ field,
110
+ value: this.extraFieldsModel()[field.key] ?? field.defaultValue,
111
+ updateValue: (value) => this.updateExtraField(field.key, value)
112
+ };
113
+ }
114
+ parentInjector = inject(Injector);
115
+ fieldInjectors = /* @__PURE__ */ new Map();
116
+ getFieldInjector(field) {
117
+ const cached = this.fieldInjectors.get(field.key);
118
+ if (cached) {
119
+ cached.setField(field);
120
+ return cached.injector;
121
+ }
122
+ let currentField = field;
123
+ const extraFieldsModel = this.extraFieldsModel;
124
+ const injector = Injector.create({
125
+ providers: [{
126
+ provide: REGISTRATION_FIELD_CONTEXT,
127
+ useValue: {
128
+ get field() {
129
+ return currentField;
130
+ },
131
+ get value() {
132
+ return extraFieldsModel()[currentField.key] ?? currentField.defaultValue;
133
+ },
134
+ updateValue: (value) => this.updateExtraField(currentField.key, value)
135
+ }
136
+ }],
137
+ parent: field.injector ?? this.parentInjector
138
+ });
139
+ this.fieldInjectors.set(field.key, {
140
+ injector,
141
+ setField: (next) => currentField = next
142
+ });
143
+ return injector;
144
+ }
145
+ constructor() {
146
+ effect(() => {
147
+ const params = this.queryParamMap();
148
+ if (!params || this.companySlugInitialized) return;
149
+ this.companySlugInitialized = true;
150
+ const configCompanySlug = this.defaultCompanySlug();
151
+ const configBranchSlug = this.defaultBranchSlug();
152
+ const queryCompanySlug = params.get("companySlug");
153
+ const companySlug = configCompanySlug || queryCompanySlug || "";
154
+ const branchSlug = configBranchSlug || "";
155
+ if (companySlug || branchSlug) this.companyFormModel.update((model) => ({
156
+ ...model,
157
+ companySlug,
158
+ branchSlug
159
+ }));
160
+ });
161
+ }
162
+ onCreateCompanyToggle(createNew) {
163
+ if (createNew) this.companyFormModel.update((model) => ({
164
+ ...model,
165
+ createNewCompany: true,
166
+ companySlug: "",
167
+ branchSlug: ""
168
+ }));
169
+ else this.companyFormModel.update((model) => ({
170
+ ...model,
171
+ createNewCompany: false,
172
+ newCompanyName: "",
173
+ newCompanyPhone: "",
174
+ newCompanyAddress: ""
175
+ }));
176
+ }
177
+ onSubmit() {
178
+ if (!this.isFormValid()) {
179
+ this.messageService.add({
180
+ severity: "error",
181
+ summary: this.translate("shared.validation.error"),
182
+ detail: this.translate("shared.fill.required.fields")
183
+ });
184
+ return;
185
+ }
186
+ this.isLoading.set(true);
187
+ const userModel = this.userFormModel();
188
+ const companyModel = this.companyFormModel();
189
+ let registrationData = {
190
+ name: userModel.name,
191
+ email: userModel.email,
192
+ password: userModel.password,
193
+ phone: userModel.phone || void 0
194
+ };
195
+ const extraFieldsData = this.extraFieldsModel();
196
+ if (Object.keys(extraFieldsData).length > 0) registrationData["additionalFields"] = extraFieldsData;
197
+ if (this.registrationExtension?.transformRegistrationData) registrationData = this.registrationExtension.transformRegistrationData(registrationData);
198
+ if (isCompanyFeatureEnabled(this.appConfig)) {
199
+ if (companyModel.createNewCompany) {
200
+ registrationData["newCompanyName"] = companyModel.newCompanyName || void 0;
201
+ registrationData["newCompanyPhone"] = companyModel.newCompanyPhone || void 0;
202
+ registrationData["newCompanyAddress"] = companyModel.newCompanyAddress || void 0;
203
+ } else {
204
+ registrationData["companySlug"] = companyModel.companySlug || void 0;
205
+ registrationData["branchSlug"] = companyModel.branchSlug || void 0;
206
+ }
207
+ }
208
+ this.authApi.register(registrationData).pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
209
+ next: (response) => {
210
+ this.isLoading.set(false);
211
+ const data = response.data;
212
+ if (!data) return;
213
+ if (data.requiresEmailVerification) {
214
+ this.messageService.add({
215
+ severity: "success",
216
+ summary: this.translate("shared.success"),
217
+ detail: response.messageKey ? this.translate(response.messageKey, response.messageVariables) : response.message,
218
+ life: 5e3
219
+ });
220
+ this.router.navigate(["/auth/login"]);
221
+ return;
222
+ }
223
+ if (data.accessToken) {
224
+ this.authState.setLoginState({
225
+ accessToken: data.accessToken,
226
+ user: data.user,
227
+ company: data.company,
228
+ branch: data.branch
229
+ });
230
+ this.messageService.add({
231
+ severity: "success",
232
+ summary: this.translate("shared.success"),
233
+ detail: response.messageKey ? this.translate(response.messageKey, response.messageVariables) : response.message
234
+ });
235
+ this.authState.navigateAfterLogin(this.returnUrl());
236
+ }
237
+ },
238
+ error: () => {
239
+ this.isLoading.set(false);
240
+ }
241
+ });
242
+ }
243
+ static ɵfac = i0.ɵɵngDeclareFactory({
244
+ minVersion: "12.0.0",
245
+ version: "22.2.1",
246
+ ngImport: i0,
247
+ type: RegisterPageComponent,
248
+ deps: [],
249
+ target: i0.ɵɵFactoryTarget.Component
250
+ });
251
+ static ɵcmp = i0.ɵɵngDeclareComponent({
252
+ minVersion: "17.0.0",
253
+ version: "22.2.1",
254
+ type: RegisterPageComponent,
255
+ isStandalone: true,
256
+ selector: "lib-register-page",
257
+ inputs: { returnUrl: {
258
+ classPropertyName: "returnUrl",
259
+ publicName: "returnUrl",
260
+ isSignal: true,
261
+ isRequired: false,
262
+ transformFunction: null
263
+ } },
264
+ ngImport: i0,
265
+ template: `
266
+ <app-floating-configurator />
267
+ <div
268
+ class="bg-surface-ground flex items-center justify-center min-h-screen py-8"
269
+ >
270
+ <div class="flex flex-col items-center justify-center">
271
+ <div
272
+ style="border-radius: var(--f-content-border-radius); padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)"
273
+ >
274
+ <div
275
+ class="py-8 px-4 sm:py-10 sm:px-8 md:py-12 md:px-12 w-full sm:w-[650px] max-w-[95vw] sm:max-w-[90vw]"
276
+ style="border-radius: var(--f-content-border-radius); background: var(--f-content-background)"
277
+ >
278
+ <div class="text-center mb-6">
279
+ <div class="text-3xl font-medium mb-4 text-color">
280
+ {{ 'auth.register.create.account' | translate }}
281
+ </div>
282
+ <span class="text-muted-color font-medium">{{
283
+ 'auth.register.subtitle' | translate
284
+ }}</span>
285
+ </div>
286
+
287
+ <form (ngSubmit)="onSubmit()">
288
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
289
+ <div>
290
+ <label for="name" class="block font-medium mb-2"
291
+ >{{ 'auth.register.full.name' | translate }} *</label
292
+ >
293
+ <input
294
+ fInputText
295
+ id="name"
296
+ [formField]="userForm.name"
297
+ [placeholder]="'auth.register.name.placeholder' | translate"
298
+ class="w-full"
299
+ autocomplete="name"
300
+ />
301
+ </div>
302
+
303
+ <div>
304
+ <label for="phone" class="block font-medium mb-2">{{
305
+ 'auth.phone.label' | translate
306
+ }}</label>
307
+ <input
308
+ fInputText
309
+ id="phone"
310
+ [formField]="userForm.phone"
311
+ [placeholder]="'auth.phone.placeholder' | translate"
312
+ class="w-full"
313
+ autocomplete="tel"
314
+ />
315
+ </div>
316
+ </div>
317
+
318
+ <div class="mb-4">
319
+ <label for="email" class="block font-medium mb-2"
320
+ >{{ 'auth.email.label' | translate }} *</label
321
+ >
322
+ <input
323
+ fInputText
324
+ id="email"
325
+ type="email"
326
+ [formField]="userForm.email"
327
+ [placeholder]="'auth.email.placeholder' | translate"
328
+ class="w-full"
329
+ autocomplete="email"
330
+ />
331
+ @if (emailValidationError()) {
332
+ <small class="text-danger block mt-1">{{
333
+ emailValidationError()
334
+ }}</small>
335
+ }
336
+ </div>
337
+
338
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
339
+ <div>
340
+ <label for="password" class="block font-medium mb-2"
341
+ >{{ 'auth.password.label' | translate }} *</label
342
+ >
343
+ <f-password
344
+ [inputId]="'password'"
345
+ [formField]="userForm.password"
346
+ [placeholder]="
347
+ 'shared.min.characters'
348
+ | translate: { count: passwordPolicy.minLength }
349
+ "
350
+ class="w-full"
351
+ autocomplete="new-password"
352
+ />
353
+ @if (passwordValidationError()) {
354
+ <small class="text-danger block mt-1">{{
355
+ passwordValidationError()
356
+ }}</small>
357
+ }
358
+ </div>
359
+
360
+ <div>
361
+ <label for="confirmPassword" class="block font-medium mb-2"
362
+ >{{ 'auth.register.confirm.password' | translate }} *</label
363
+ >
364
+ <f-password
365
+ [inputId]="'confirmPassword'"
366
+ [formField]="userForm.confirmPassword"
367
+ [placeholder]="
368
+ 'auth.register.confirm.password.placeholder' | translate
369
+ "
370
+ class="w-full"
371
+ autocomplete="new-password"
372
+ />
373
+ @if (!passwordsMatch() && userFormModel().confirmPassword) {
374
+ <small class="text-danger block mt-2">{{
375
+ 'auth.register.passwords.do.not.match' | translate
376
+ }}</small>
377
+ }
378
+ </div>
379
+ </div>
380
+
381
+ @if (extraFields().length > 0) {
382
+ <div class="border-t border-surface pt-4 mt-4 mb-4">
383
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
384
+ @for (field of extraFields(); track field.key) {
385
+ <div [class]="field.containerClass ?? ''">
386
+ <label [for]="field.key" class="block font-medium mb-2">
387
+ {{ field.labelKey | translate: null : field.label
388
+ }}{{ field.required ? ' *' : '' }}
389
+ </label>
390
+ @if (field.component) {
391
+ <ng-container
392
+ [ngComponentOutlet]="field.component"
393
+ [ngComponentOutletInjector]="getFieldInjector(field)"
394
+ ></ng-container>
395
+ } @else if (field.template) {
396
+ <ng-container
397
+ [ngTemplateOutlet]="field.template"
398
+ [ngTemplateOutletContext]="
399
+ getFieldTemplateContext(field)
400
+ "
401
+ ></ng-container>
402
+ } @else {
403
+ @switch (field.type) {
404
+ @case ('text') {
405
+ <input
406
+ fInputText
407
+ [id]="field.key"
408
+ [placeholder]="
409
+ field.placeholderKey
410
+ | translate: null : field.placeholder ?? ''
411
+ "
412
+ [value]="
413
+ extraFieldsModel()[field.key] ??
414
+ field.defaultValue ??
415
+ ''
416
+ "
417
+ (input)="
418
+ updateExtraField(
419
+ field.key,
420
+ $any($event.target).value
421
+ )
422
+ "
423
+ class="w-full"
424
+ />
425
+ }
426
+ @case ('number') {
427
+ <input
428
+ fInputText
429
+ type="number"
430
+ [id]="field.key"
431
+ [placeholder]="
432
+ field.placeholderKey
433
+ | translate: null : field.placeholder ?? ''
434
+ "
435
+ [value]="
436
+ extraFieldsModel()[field.key] ??
437
+ field.defaultValue ??
438
+ ''
439
+ "
440
+ (input)="
441
+ updateExtraField(
442
+ field.key,
443
+ $any($event.target).valueAsNumber
444
+ )
445
+ "
446
+ class="w-full"
447
+ />
448
+ }
449
+ @case ('textarea') {
450
+ <textarea
451
+ fTextarea
452
+ [id]="field.key"
453
+ [placeholder]="
454
+ field.placeholderKey
455
+ | translate: null : field.placeholder ?? ''
456
+ "
457
+ [value]="
458
+ extraFieldsModel()[field.key] ??
459
+ field.defaultValue ??
460
+ ''
461
+ "
462
+ (input)="
463
+ updateExtraField(
464
+ field.key,
465
+ $any($event.target).value
466
+ )
467
+ "
468
+ class="w-full"
469
+ rows="3"
470
+ ></textarea>
471
+ }
472
+ @case ('select') {
473
+ <f-select
474
+ [id]="field.key"
475
+ class="w-full"
476
+ [options]="field.options ?? []"
477
+ optionValue="value"
478
+ [ngModel]="
479
+ extraFieldsModel()[field.key] ??
480
+ field.defaultValue ??
481
+ ''
482
+ "
483
+ [ngModelOptions]="{ standalone: true }"
484
+ (ngModelChange)="
485
+ updateExtraField(field.key, $event)
486
+ "
487
+ [placeholder]="
488
+ field.placeholderKey
489
+ | translate
490
+ : null
491
+ : field.placeholder ??
492
+ ('shared.select' | translate)
493
+ "
494
+ >
495
+ <ng-template #item let-opt>{{
496
+ opt.labelKey | translate: null : opt.label
497
+ }}</ng-template>
498
+ <ng-template #selectedItem let-opt>{{
499
+ opt.labelKey | translate: null : opt.label
500
+ }}</ng-template>
501
+ </f-select>
502
+ }
503
+ @case ('checkbox') {
504
+ <f-checkbox
505
+ [inputId]="field.key"
506
+ [checked]="
507
+ $any(
508
+ extraFieldsModel()[field.key] ??
509
+ field.defaultValue ??
510
+ false
511
+ )
512
+ "
513
+ (onChange)="
514
+ updateExtraField(field.key, $event.checked)
515
+ "
516
+ [label]="
517
+ field.placeholderKey
518
+ | translate
519
+ : null
520
+ : field.placeholder ??
521
+ (field.labelKey
522
+ | translate: null : field.label)
523
+ "
524
+ />
525
+ }
526
+ @case ('date') {
527
+ <input
528
+ fInputText
529
+ type="date"
530
+ [id]="field.key"
531
+ [value]="
532
+ extraFieldsModel()[field.key] ??
533
+ field.defaultValue ??
534
+ ''
535
+ "
536
+ (input)="
537
+ updateExtraField(
538
+ field.key,
539
+ $any($event.target).value
540
+ )
541
+ "
542
+ class="w-full"
543
+ />
544
+ }
545
+ }
546
+ }
547
+ </div>
548
+ }
549
+ </div>
550
+ @if (extraFieldsValidationError()) {
551
+ <small class="text-danger block mt-2">{{
552
+ extraFieldsValidationError()
553
+ }}</small>
554
+ }
555
+ </div>
556
+ }
557
+
558
+ @if (companyFeatureEnabled()) {
559
+ <div class="border-t border-surface pt-6 mt-6">
560
+ <div class="text-center mb-6">
561
+ <div class="text-2xl font-medium mb-2 text-color">
562
+ {{ 'auth.register.company.details' | translate }}
563
+ </div>
564
+ <span class="text-muted-color font-medium">
565
+ @if (hasDefaultCompany()) {
566
+ {{ 'auth.register.join.default.company' | translate }}
567
+ } @else {
568
+ {{ 'auth.register.join.or.create.company' | translate }}
569
+ }
570
+ </span>
571
+ </div>
572
+
573
+ @if (!hasDefaultCompany()) {
574
+ <div class="mb-4">
575
+ <f-checkbox
576
+ [formField]="companyForm.createNewCompany"
577
+ [label]="'auth.register.create.new.company' | translate"
578
+ (onChange)="onCreateCompanyToggle($event.checked)"
579
+ />
580
+ </div>
581
+ }
582
+
583
+ @if (!companyFormModel().createNewCompany) {
584
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
585
+ <div>
586
+ <label
587
+ for="companySlug"
588
+ class="block font-medium mb-2"
589
+ >{{ 'auth.register.company.code' | translate }}</label
590
+ >
591
+ @if (hasDefaultCompany()) {
592
+ <input
593
+ fInputText
594
+ id="companySlug"
595
+ [value]="defaultCompanySlug()"
596
+ class="w-full bg-(--f-form-field-filled-background)"
597
+ readonly
598
+ />
599
+ <small class="text-muted-color">{{
600
+ 'auth.register.preconfigured.company' | translate
601
+ }}</small>
602
+ } @else {
603
+ <input
604
+ fInputText
605
+ id="companySlug"
606
+ [formField]="companyForm.companySlug"
607
+ [placeholder]="
608
+ 'auth.register.company.code.placeholder'
609
+ | translate
610
+ "
611
+ class="w-full"
612
+ />
613
+ <small class="text-muted-color">{{
614
+ 'auth.register.enter.company.code' | translate
615
+ }}</small>
616
+ }
617
+ </div>
618
+
619
+ <div>
620
+ <label
621
+ for="branchSlug"
622
+ class="block font-medium mb-2"
623
+ >{{ 'auth.register.branch.code' | translate }}</label
624
+ >
625
+ @if (hasDefaultBranch()) {
626
+ <input
627
+ fInputText
628
+ id="branchSlug"
629
+ [value]="defaultBranchSlug()"
630
+ class="w-full bg-(--f-form-field-filled-background)"
631
+ readonly
632
+ />
633
+ <small class="text-muted-color">{{
634
+ 'auth.register.preconfigured.branch' | translate
635
+ }}</small>
636
+ } @else {
637
+ <input
638
+ fInputText
639
+ id="branchSlug"
640
+ [formField]="companyForm.branchSlug"
641
+ [placeholder]="
642
+ 'auth.register.branch.code.placeholder'
643
+ | translate
644
+ "
645
+ class="w-full"
646
+ />
647
+ }
648
+ </div>
649
+ </div>
650
+ } @else {
651
+ <div class="mb-4">
652
+ <label for="newCompanyName" class="block font-medium mb-2"
653
+ >{{ 'auth.register.company.name' | translate }} *</label
654
+ >
655
+ <input
656
+ fInputText
657
+ id="newCompanyName"
658
+ [formField]="companyForm.newCompanyName"
659
+ [placeholder]="
660
+ 'auth.register.company.name.placeholder' | translate
661
+ "
662
+ class="w-full"
663
+ />
664
+ </div>
665
+
666
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
667
+ <div>
668
+ <label
669
+ for="newCompanyPhone"
670
+ class="block font-medium mb-2"
671
+ >{{ 'auth.phone.label' | translate }}</label
672
+ >
673
+ <input
674
+ fInputText
675
+ id="newCompanyPhone"
676
+ [formField]="companyForm.newCompanyPhone"
677
+ [placeholder]="'auth.phone.placeholder' | translate"
678
+ class="w-full"
679
+ />
680
+ </div>
681
+
682
+ <div>
683
+ <label
684
+ for="newCompanyAddress"
685
+ class="block font-medium mb-2"
686
+ >{{ 'auth.address.label' | translate }}</label
687
+ >
688
+ <input
689
+ fInputText
690
+ id="newCompanyAddress"
691
+ [formField]="companyForm.newCompanyAddress"
692
+ [placeholder]="'auth.address.placeholder' | translate"
693
+ class="w-full"
694
+ />
695
+ </div>
696
+ </div>
697
+ }
698
+ </div>
699
+ }
700
+
701
+ <button
702
+ fButton
703
+ class="w-full mt-4"
704
+ type="submit"
705
+ [disabled]="!isFormValid() || isLoading()"
706
+ >
707
+ @if (isLoading()) {
708
+ <ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
709
+ }
710
+ <span pButtonLabel>{{
711
+ 'auth.register.create.account' | translate
712
+ }}</span>
713
+ </button>
714
+
715
+ <div class="flex items-center justify-center mt-4 gap-2">
716
+ <span class="font-medium">{{
717
+ 'auth.register.already.have.account' | translate
718
+ }}</span>
719
+ <a
720
+ routerLink="/auth/login"
721
+ class="font-semibold text-primary cursor-pointer"
722
+ >
723
+ {{ 'auth.login.sign.in' | translate }}
724
+ </a>
725
+ </div>
726
+ </form>
727
+ </div>
728
+ </div>
729
+ </div>
730
+ </div>
731
+ `,
732
+ isInline: true,
733
+ dependencies: [
734
+ {
735
+ kind: "component",
736
+ type: CheckboxComponent,
737
+ selector: "f-checkbox",
738
+ inputs: [
739
+ "label",
740
+ "binary",
741
+ "disabled",
742
+ "readonly",
743
+ "inputId",
744
+ "invalid",
745
+ "indeterminate",
746
+ "variant",
747
+ "size",
748
+ "touched",
749
+ "styleClass",
750
+ "style",
751
+ "checked"
752
+ ],
753
+ outputs: [
754
+ "onChange",
755
+ "onBlur",
756
+ "touch",
757
+ "checkedChange"
758
+ ]
759
+ },
760
+ {
761
+ kind: "directive",
762
+ type: FButtonDirective,
763
+ selector: "[fButton]",
764
+ inputs: [
765
+ "severity",
766
+ "text",
767
+ "outlined",
768
+ "link",
769
+ "variant",
770
+ "rounded",
771
+ "raised",
772
+ "fluid",
773
+ "disabled",
774
+ "loading",
775
+ "loadingIcon",
776
+ "size",
777
+ "label",
778
+ "icon",
779
+ "iconPos",
780
+ "ariaLabel",
781
+ "plain"
782
+ ]
783
+ },
784
+ {
785
+ kind: "directive",
786
+ type: InputTextDirective,
787
+ selector: "[fInputText]",
788
+ inputs: [
789
+ "invalid",
790
+ "touched",
791
+ "variant",
792
+ "size",
793
+ "fluid"
794
+ ]
795
+ },
796
+ {
797
+ kind: "component",
798
+ type: PasswordComponent,
799
+ selector: "f-password",
800
+ inputs: [
801
+ "toggleMask",
802
+ "feedback",
803
+ "disabled",
804
+ "placeholder",
805
+ "inputId",
806
+ "invalid",
807
+ "touched",
808
+ "inputStyleClass",
809
+ "styleClass",
810
+ "style",
811
+ "ariaDescribedby",
812
+ "autocomplete",
813
+ "variant",
814
+ "size",
815
+ "fluid",
816
+ "appendTo",
817
+ "promptLabel",
818
+ "weakLabel",
819
+ "mediumLabel",
820
+ "strongLabel",
821
+ "mediumRegex",
822
+ "strongRegex"
823
+ ],
824
+ outputs: ["onBlur", "onFocus"]
825
+ },
826
+ {
827
+ kind: "component",
828
+ type: SelectComponent,
829
+ selector: "f-select",
830
+ inputs: [
831
+ "options",
832
+ "optionLabel",
833
+ "optionValue",
834
+ "placeholder",
835
+ "disabled",
836
+ "filter",
837
+ "filterBy",
838
+ "filterMatchMode",
839
+ "filterLocale",
840
+ "filterPlaceholder",
841
+ "resetFilterOnHide",
842
+ "autofocusFilter",
843
+ "emptyMessage",
844
+ "emptyFilterMessage",
845
+ "showClear",
846
+ "loading",
847
+ "loadingIcon",
848
+ "dropdownIcon",
849
+ "clearIcon",
850
+ "inputId",
851
+ "invalid",
852
+ "touched",
853
+ "styleClass",
854
+ "style",
855
+ "appendTo",
856
+ "editable",
857
+ "readonly",
858
+ "autofocus",
859
+ "checkmark",
860
+ "group",
861
+ "optionGroupLabel",
862
+ "optionGroupChildren",
863
+ "virtualScroll",
864
+ "virtualScrollItemSize",
865
+ "lazy",
866
+ "selectedObject"
867
+ ],
868
+ outputs: [
869
+ "onFilter",
870
+ "onChange",
871
+ "onShow",
872
+ "onHide",
873
+ "onBlur",
874
+ "onFocus",
875
+ "onClear",
876
+ "onLazyLoad"
877
+ ]
878
+ },
879
+ {
880
+ kind: "directive",
881
+ type: TextareaDirective,
882
+ selector: "[fTextarea]",
883
+ inputs: [
884
+ "invalid",
885
+ "touched",
886
+ "variant",
887
+ "fluid",
888
+ "autoResize"
889
+ ],
890
+ outputs: ["onResize"]
891
+ },
892
+ {
893
+ kind: "component",
894
+ type: UiIconComponent,
895
+ selector: "ui-icon",
896
+ inputs: [
897
+ "name",
898
+ "size",
899
+ "spin",
900
+ "fill",
901
+ "severity"
902
+ ]
903
+ },
904
+ {
905
+ kind: "ngmodule",
906
+ type: FormsModule
907
+ },
908
+ {
909
+ kind: "directive",
910
+ type: i1.ɵNgNoValidate,
911
+ selector: "form:not([ngNoForm]):not([ngNativeValidate])"
912
+ },
913
+ {
914
+ kind: "directive",
915
+ type: i1.NgControlStatus,
916
+ selector: "[formControlName],[ngModel],[formControl]"
917
+ },
918
+ {
919
+ kind: "directive",
920
+ type: i1.NgControlStatusGroup,
921
+ selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
922
+ },
923
+ {
924
+ kind: "directive",
925
+ type: i1.NgModel,
926
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
927
+ inputs: [
928
+ "name",
929
+ "disabled",
930
+ "ngModel",
931
+ "ngModelOptions"
932
+ ],
933
+ outputs: ["ngModelChange"],
934
+ exportAs: ["ngModel"]
935
+ },
936
+ {
937
+ kind: "directive",
938
+ type: i1.NgForm,
939
+ selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
940
+ inputs: ["ngFormOptions"],
941
+ outputs: ["ngSubmit"],
942
+ exportAs: ["ngForm"]
943
+ },
944
+ {
945
+ kind: "directive",
946
+ type: NgComponentOutlet,
947
+ selector: "[ngComponentOutlet]",
948
+ inputs: [
949
+ "ngComponentOutlet",
950
+ "ngComponentOutletInputs",
951
+ "ngComponentOutletInjector",
952
+ "ngComponentOutletEnvironmentInjector",
953
+ "ngComponentOutletContent",
954
+ "ngComponentOutletNgModule"
955
+ ],
956
+ exportAs: ["ngComponentOutlet"]
957
+ },
958
+ {
959
+ kind: "directive",
960
+ type: NgTemplateOutlet,
961
+ selector: "[ngTemplateOutlet]",
962
+ inputs: [
963
+ "ngTemplateOutletContext",
964
+ "ngTemplateOutlet",
965
+ "ngTemplateOutletInjector"
966
+ ]
967
+ },
968
+ {
969
+ kind: "directive",
970
+ type: RouterLink,
971
+ selector: "[routerLink]",
972
+ inputs: [
973
+ "target",
974
+ "queryParams",
975
+ "fragment",
976
+ "queryParamsHandling",
977
+ "state",
978
+ "info",
979
+ "relativeTo",
980
+ "preserveFragment",
981
+ "skipLocationChange",
982
+ "replaceUrl",
983
+ "browserUrl",
984
+ "routerLink"
985
+ ]
986
+ },
987
+ {
988
+ kind: "directive",
989
+ type: FormField,
990
+ selector: "[formField]",
991
+ inputs: ["formField"],
992
+ exportAs: ["formField"]
993
+ },
994
+ {
995
+ kind: "component",
996
+ type: AppFloatingConfigurator,
997
+ selector: "app-floating-configurator"
998
+ },
999
+ {
1000
+ kind: "pipe",
1001
+ type: TranslatePipe,
1002
+ name: "translate"
1003
+ }
1004
+ ]
1005
+ });
1006
+ };
1007
+ i0.ɵɵngDeclareClassMetadata({
1008
+ minVersion: "12.0.0",
1009
+ version: "22.2.1",
1010
+ ngImport: i0,
1011
+ type: RegisterPageComponent,
1012
+ decorators: [{
1013
+ type: Component,
1014
+ args: [{
1015
+ selector: "lib-register-page",
1016
+ imports: [
1017
+ CheckboxComponent,
1018
+ FButtonDirective,
1019
+ InputTextDirective,
1020
+ PasswordComponent,
1021
+ SelectComponent,
1022
+ TextareaDirective,
1023
+ UiIconComponent,
1024
+ FormsModule,
1025
+ NgComponentOutlet,
1026
+ NgTemplateOutlet,
1027
+ RouterLink,
1028
+ FormField,
1029
+ AppFloatingConfigurator,
1030
+ TranslatePipe
1031
+ ],
1032
+ template: `
1033
+ <app-floating-configurator />
1034
+ <div
1035
+ class="bg-surface-ground flex items-center justify-center min-h-screen py-8"
1036
+ >
1037
+ <div class="flex flex-col items-center justify-center">
1038
+ <div
1039
+ style="border-radius: var(--f-content-border-radius); padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)"
1040
+ >
1041
+ <div
1042
+ class="py-8 px-4 sm:py-10 sm:px-8 md:py-12 md:px-12 w-full sm:w-[650px] max-w-[95vw] sm:max-w-[90vw]"
1043
+ style="border-radius: var(--f-content-border-radius); background: var(--f-content-background)"
1044
+ >
1045
+ <div class="text-center mb-6">
1046
+ <div class="text-3xl font-medium mb-4 text-color">
1047
+ {{ 'auth.register.create.account' | translate }}
1048
+ </div>
1049
+ <span class="text-muted-color font-medium">{{
1050
+ 'auth.register.subtitle' | translate
1051
+ }}</span>
1052
+ </div>
1053
+
1054
+ <form (ngSubmit)="onSubmit()">
1055
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
1056
+ <div>
1057
+ <label for="name" class="block font-medium mb-2"
1058
+ >{{ 'auth.register.full.name' | translate }} *</label
1059
+ >
1060
+ <input
1061
+ fInputText
1062
+ id="name"
1063
+ [formField]="userForm.name"
1064
+ [placeholder]="'auth.register.name.placeholder' | translate"
1065
+ class="w-full"
1066
+ autocomplete="name"
1067
+ />
1068
+ </div>
1069
+
1070
+ <div>
1071
+ <label for="phone" class="block font-medium mb-2">{{
1072
+ 'auth.phone.label' | translate
1073
+ }}</label>
1074
+ <input
1075
+ fInputText
1076
+ id="phone"
1077
+ [formField]="userForm.phone"
1078
+ [placeholder]="'auth.phone.placeholder' | translate"
1079
+ class="w-full"
1080
+ autocomplete="tel"
1081
+ />
1082
+ </div>
1083
+ </div>
1084
+
1085
+ <div class="mb-4">
1086
+ <label for="email" class="block font-medium mb-2"
1087
+ >{{ 'auth.email.label' | translate }} *</label
1088
+ >
1089
+ <input
1090
+ fInputText
1091
+ id="email"
1092
+ type="email"
1093
+ [formField]="userForm.email"
1094
+ [placeholder]="'auth.email.placeholder' | translate"
1095
+ class="w-full"
1096
+ autocomplete="email"
1097
+ />
1098
+ @if (emailValidationError()) {
1099
+ <small class="text-danger block mt-1">{{
1100
+ emailValidationError()
1101
+ }}</small>
1102
+ }
1103
+ </div>
1104
+
1105
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
1106
+ <div>
1107
+ <label for="password" class="block font-medium mb-2"
1108
+ >{{ 'auth.password.label' | translate }} *</label
1109
+ >
1110
+ <f-password
1111
+ [inputId]="'password'"
1112
+ [formField]="userForm.password"
1113
+ [placeholder]="
1114
+ 'shared.min.characters'
1115
+ | translate: { count: passwordPolicy.minLength }
1116
+ "
1117
+ class="w-full"
1118
+ autocomplete="new-password"
1119
+ />
1120
+ @if (passwordValidationError()) {
1121
+ <small class="text-danger block mt-1">{{
1122
+ passwordValidationError()
1123
+ }}</small>
1124
+ }
1125
+ </div>
1126
+
1127
+ <div>
1128
+ <label for="confirmPassword" class="block font-medium mb-2"
1129
+ >{{ 'auth.register.confirm.password' | translate }} *</label
1130
+ >
1131
+ <f-password
1132
+ [inputId]="'confirmPassword'"
1133
+ [formField]="userForm.confirmPassword"
1134
+ [placeholder]="
1135
+ 'auth.register.confirm.password.placeholder' | translate
1136
+ "
1137
+ class="w-full"
1138
+ autocomplete="new-password"
1139
+ />
1140
+ @if (!passwordsMatch() && userFormModel().confirmPassword) {
1141
+ <small class="text-danger block mt-2">{{
1142
+ 'auth.register.passwords.do.not.match' | translate
1143
+ }}</small>
1144
+ }
1145
+ </div>
1146
+ </div>
1147
+
1148
+ @if (extraFields().length > 0) {
1149
+ <div class="border-t border-surface pt-4 mt-4 mb-4">
1150
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
1151
+ @for (field of extraFields(); track field.key) {
1152
+ <div [class]="field.containerClass ?? ''">
1153
+ <label [for]="field.key" class="block font-medium mb-2">
1154
+ {{ field.labelKey | translate: null : field.label
1155
+ }}{{ field.required ? ' *' : '' }}
1156
+ </label>
1157
+ @if (field.component) {
1158
+ <ng-container
1159
+ [ngComponentOutlet]="field.component"
1160
+ [ngComponentOutletInjector]="getFieldInjector(field)"
1161
+ ></ng-container>
1162
+ } @else if (field.template) {
1163
+ <ng-container
1164
+ [ngTemplateOutlet]="field.template"
1165
+ [ngTemplateOutletContext]="
1166
+ getFieldTemplateContext(field)
1167
+ "
1168
+ ></ng-container>
1169
+ } @else {
1170
+ @switch (field.type) {
1171
+ @case ('text') {
1172
+ <input
1173
+ fInputText
1174
+ [id]="field.key"
1175
+ [placeholder]="
1176
+ field.placeholderKey
1177
+ | translate: null : field.placeholder ?? ''
1178
+ "
1179
+ [value]="
1180
+ extraFieldsModel()[field.key] ??
1181
+ field.defaultValue ??
1182
+ ''
1183
+ "
1184
+ (input)="
1185
+ updateExtraField(
1186
+ field.key,
1187
+ $any($event.target).value
1188
+ )
1189
+ "
1190
+ class="w-full"
1191
+ />
1192
+ }
1193
+ @case ('number') {
1194
+ <input
1195
+ fInputText
1196
+ type="number"
1197
+ [id]="field.key"
1198
+ [placeholder]="
1199
+ field.placeholderKey
1200
+ | translate: null : field.placeholder ?? ''
1201
+ "
1202
+ [value]="
1203
+ extraFieldsModel()[field.key] ??
1204
+ field.defaultValue ??
1205
+ ''
1206
+ "
1207
+ (input)="
1208
+ updateExtraField(
1209
+ field.key,
1210
+ $any($event.target).valueAsNumber
1211
+ )
1212
+ "
1213
+ class="w-full"
1214
+ />
1215
+ }
1216
+ @case ('textarea') {
1217
+ <textarea
1218
+ fTextarea
1219
+ [id]="field.key"
1220
+ [placeholder]="
1221
+ field.placeholderKey
1222
+ | translate: null : field.placeholder ?? ''
1223
+ "
1224
+ [value]="
1225
+ extraFieldsModel()[field.key] ??
1226
+ field.defaultValue ??
1227
+ ''
1228
+ "
1229
+ (input)="
1230
+ updateExtraField(
1231
+ field.key,
1232
+ $any($event.target).value
1233
+ )
1234
+ "
1235
+ class="w-full"
1236
+ rows="3"
1237
+ ></textarea>
1238
+ }
1239
+ @case ('select') {
1240
+ <f-select
1241
+ [id]="field.key"
1242
+ class="w-full"
1243
+ [options]="field.options ?? []"
1244
+ optionValue="value"
1245
+ [ngModel]="
1246
+ extraFieldsModel()[field.key] ??
1247
+ field.defaultValue ??
1248
+ ''
1249
+ "
1250
+ [ngModelOptions]="{ standalone: true }"
1251
+ (ngModelChange)="
1252
+ updateExtraField(field.key, $event)
1253
+ "
1254
+ [placeholder]="
1255
+ field.placeholderKey
1256
+ | translate
1257
+ : null
1258
+ : field.placeholder ??
1259
+ ('shared.select' | translate)
1260
+ "
1261
+ >
1262
+ <ng-template #item let-opt>{{
1263
+ opt.labelKey | translate: null : opt.label
1264
+ }}</ng-template>
1265
+ <ng-template #selectedItem let-opt>{{
1266
+ opt.labelKey | translate: null : opt.label
1267
+ }}</ng-template>
1268
+ </f-select>
1269
+ }
1270
+ @case ('checkbox') {
1271
+ <f-checkbox
1272
+ [inputId]="field.key"
1273
+ [checked]="
1274
+ $any(
1275
+ extraFieldsModel()[field.key] ??
1276
+ field.defaultValue ??
1277
+ false
1278
+ )
1279
+ "
1280
+ (onChange)="
1281
+ updateExtraField(field.key, $event.checked)
1282
+ "
1283
+ [label]="
1284
+ field.placeholderKey
1285
+ | translate
1286
+ : null
1287
+ : field.placeholder ??
1288
+ (field.labelKey
1289
+ | translate: null : field.label)
1290
+ "
1291
+ />
1292
+ }
1293
+ @case ('date') {
1294
+ <input
1295
+ fInputText
1296
+ type="date"
1297
+ [id]="field.key"
1298
+ [value]="
1299
+ extraFieldsModel()[field.key] ??
1300
+ field.defaultValue ??
1301
+ ''
1302
+ "
1303
+ (input)="
1304
+ updateExtraField(
1305
+ field.key,
1306
+ $any($event.target).value
1307
+ )
1308
+ "
1309
+ class="w-full"
1310
+ />
1311
+ }
1312
+ }
1313
+ }
1314
+ </div>
1315
+ }
1316
+ </div>
1317
+ @if (extraFieldsValidationError()) {
1318
+ <small class="text-danger block mt-2">{{
1319
+ extraFieldsValidationError()
1320
+ }}</small>
1321
+ }
1322
+ </div>
1323
+ }
1324
+
1325
+ @if (companyFeatureEnabled()) {
1326
+ <div class="border-t border-surface pt-6 mt-6">
1327
+ <div class="text-center mb-6">
1328
+ <div class="text-2xl font-medium mb-2 text-color">
1329
+ {{ 'auth.register.company.details' | translate }}
1330
+ </div>
1331
+ <span class="text-muted-color font-medium">
1332
+ @if (hasDefaultCompany()) {
1333
+ {{ 'auth.register.join.default.company' | translate }}
1334
+ } @else {
1335
+ {{ 'auth.register.join.or.create.company' | translate }}
1336
+ }
1337
+ </span>
1338
+ </div>
1339
+
1340
+ @if (!hasDefaultCompany()) {
1341
+ <div class="mb-4">
1342
+ <f-checkbox
1343
+ [formField]="companyForm.createNewCompany"
1344
+ [label]="'auth.register.create.new.company' | translate"
1345
+ (onChange)="onCreateCompanyToggle($event.checked)"
1346
+ />
1347
+ </div>
1348
+ }
1349
+
1350
+ @if (!companyFormModel().createNewCompany) {
1351
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
1352
+ <div>
1353
+ <label
1354
+ for="companySlug"
1355
+ class="block font-medium mb-2"
1356
+ >{{ 'auth.register.company.code' | translate }}</label
1357
+ >
1358
+ @if (hasDefaultCompany()) {
1359
+ <input
1360
+ fInputText
1361
+ id="companySlug"
1362
+ [value]="defaultCompanySlug()"
1363
+ class="w-full bg-(--f-form-field-filled-background)"
1364
+ readonly
1365
+ />
1366
+ <small class="text-muted-color">{{
1367
+ 'auth.register.preconfigured.company' | translate
1368
+ }}</small>
1369
+ } @else {
1370
+ <input
1371
+ fInputText
1372
+ id="companySlug"
1373
+ [formField]="companyForm.companySlug"
1374
+ [placeholder]="
1375
+ 'auth.register.company.code.placeholder'
1376
+ | translate
1377
+ "
1378
+ class="w-full"
1379
+ />
1380
+ <small class="text-muted-color">{{
1381
+ 'auth.register.enter.company.code' | translate
1382
+ }}</small>
1383
+ }
1384
+ </div>
1385
+
1386
+ <div>
1387
+ <label
1388
+ for="branchSlug"
1389
+ class="block font-medium mb-2"
1390
+ >{{ 'auth.register.branch.code' | translate }}</label
1391
+ >
1392
+ @if (hasDefaultBranch()) {
1393
+ <input
1394
+ fInputText
1395
+ id="branchSlug"
1396
+ [value]="defaultBranchSlug()"
1397
+ class="w-full bg-(--f-form-field-filled-background)"
1398
+ readonly
1399
+ />
1400
+ <small class="text-muted-color">{{
1401
+ 'auth.register.preconfigured.branch' | translate
1402
+ }}</small>
1403
+ } @else {
1404
+ <input
1405
+ fInputText
1406
+ id="branchSlug"
1407
+ [formField]="companyForm.branchSlug"
1408
+ [placeholder]="
1409
+ 'auth.register.branch.code.placeholder'
1410
+ | translate
1411
+ "
1412
+ class="w-full"
1413
+ />
1414
+ }
1415
+ </div>
1416
+ </div>
1417
+ } @else {
1418
+ <div class="mb-4">
1419
+ <label for="newCompanyName" class="block font-medium mb-2"
1420
+ >{{ 'auth.register.company.name' | translate }} *</label
1421
+ >
1422
+ <input
1423
+ fInputText
1424
+ id="newCompanyName"
1425
+ [formField]="companyForm.newCompanyName"
1426
+ [placeholder]="
1427
+ 'auth.register.company.name.placeholder' | translate
1428
+ "
1429
+ class="w-full"
1430
+ />
1431
+ </div>
1432
+
1433
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
1434
+ <div>
1435
+ <label
1436
+ for="newCompanyPhone"
1437
+ class="block font-medium mb-2"
1438
+ >{{ 'auth.phone.label' | translate }}</label
1439
+ >
1440
+ <input
1441
+ fInputText
1442
+ id="newCompanyPhone"
1443
+ [formField]="companyForm.newCompanyPhone"
1444
+ [placeholder]="'auth.phone.placeholder' | translate"
1445
+ class="w-full"
1446
+ />
1447
+ </div>
1448
+
1449
+ <div>
1450
+ <label
1451
+ for="newCompanyAddress"
1452
+ class="block font-medium mb-2"
1453
+ >{{ 'auth.address.label' | translate }}</label
1454
+ >
1455
+ <input
1456
+ fInputText
1457
+ id="newCompanyAddress"
1458
+ [formField]="companyForm.newCompanyAddress"
1459
+ [placeholder]="'auth.address.placeholder' | translate"
1460
+ class="w-full"
1461
+ />
1462
+ </div>
1463
+ </div>
1464
+ }
1465
+ </div>
1466
+ }
1467
+
1468
+ <button
1469
+ fButton
1470
+ class="w-full mt-4"
1471
+ type="submit"
1472
+ [disabled]="!isFormValid() || isLoading()"
1473
+ >
1474
+ @if (isLoading()) {
1475
+ <ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
1476
+ }
1477
+ <span pButtonLabel>{{
1478
+ 'auth.register.create.account' | translate
1479
+ }}</span>
1480
+ </button>
1481
+
1482
+ <div class="flex items-center justify-center mt-4 gap-2">
1483
+ <span class="font-medium">{{
1484
+ 'auth.register.already.have.account' | translate
1485
+ }}</span>
1486
+ <a
1487
+ routerLink="/auth/login"
1488
+ class="font-semibold text-primary cursor-pointer"
1489
+ >
1490
+ {{ 'auth.login.sign.in' | translate }}
1491
+ </a>
1492
+ </div>
1493
+ </form>
1494
+ </div>
1495
+ </div>
1496
+ </div>
1497
+ </div>
1498
+ `
1499
+ }]
1500
+ }],
1501
+ ctorParameters: () => [],
1502
+ propDecorators: { returnUrl: [{
1503
+ type: i0.Input,
1504
+ args: [{
1505
+ isSignal: true,
1506
+ alias: "returnUrl",
1507
+ required: false
1508
+ }]
1509
+ }] }
1510
+ });
1511
+ export { RegisterPageComponent };
1512
+
1513
+ //# sourceMappingURL=flusys-ng-auth-register-page.component-D99y1jiA.mjs.map