@flusys/ng-auth 9.1.0 → 9.1.1
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.
- package/README.md +2 -0
- package/fesm2022/flusys-ng-auth-administration-page.component-DmN4KqiR.mjs +146 -0
- package/fesm2022/flusys-ng-auth-administration-page.component-DmN4KqiR.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-branch-form.component-Df_sMC2G.mjs +743 -0
- package/fesm2022/flusys-ng-auth-branch-form.component-Df_sMC2G.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-branch-list.component-CWat6QWN.mjs +775 -0
- package/fesm2022/flusys-ng-auth-branch-list.component-CWat6QWN.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-company-form.component-BvZ4Pn8j.mjs +198 -0
- package/fesm2022/flusys-ng-auth-company-form.component-BvZ4Pn8j.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-company-list.component-Corh9AIh.mjs +241 -0
- package/fesm2022/flusys-ng-auth-company-list.component-Corh9AIh.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-extension-order.util-2XWSLqii.mjs +6 -0
- package/fesm2022/flusys-ng-auth-extension-order.util-2XWSLqii.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs +384 -0
- package/fesm2022/flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-login-page.component-DQl52Qau.mjs +1074 -0
- package/fesm2022/flusys-ng-auth-login-page.component-DQl52Qau.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-profile-page.component-b-8rPEXQ.mjs +1792 -0
- package/fesm2022/flusys-ng-auth-profile-page.component-b-8rPEXQ.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-register-page.component-D99y1jiA.mjs +1513 -0
- package/fesm2022/flusys-ng-auth-register-page.component-D99y1jiA.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-reset-password-page.component-C0tN_AW1.mjs +538 -0
- package/fesm2022/flusys-ng-auth-reset-password-page.component-C0tN_AW1.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-social-callback-page.component-gTD7_LJY.mjs +217 -0
- package/fesm2022/flusys-ng-auth-social-callback-page.component-gTD7_LJY.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-social-config-page.component-DpGmcb9n.mjs +541 -0
- package/fesm2022/flusys-ng-auth-social-config-page.component-DpGmcb9n.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-user-form.component-CM9UYc0q.mjs +1171 -0
- package/fesm2022/flusys-ng-auth-user-form.component-CM9UYc0q.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-user-list.component-Bew7gz-H.mjs +1046 -0
- package/fesm2022/flusys-ng-auth-user-list.component-Bew7gz-H.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-verify-email-page.component-DB9iKvt3.mjs +545 -0
- package/fesm2022/flusys-ng-auth-verify-email-page.component-DB9iKvt3.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth.mjs +3030 -10735
- package/fesm2022/flusys-ng-auth.mjs.map +1 -1
- package/package.json +5 -5
- package/types/flusys-ng-auth.d.ts +978 -1558
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
import { AuthStateService, BranchApiService, CompanyApiService } from "./flusys-ng-auth.mjs";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Component, computed, effect, inject, signal, untracked } from "@angular/core";
|
|
4
|
+
import { ActivatedRoute, Router } from "@angular/router";
|
|
5
|
+
import { TranslatePipe, TranslateService, buildBranchTreeNodes } from "@flusys/ng-shared";
|
|
6
|
+
import { CardComponent, CheckboxComponent, FButtonDirective, InputTextDirective, MessageService, SelectComponent, TreeSelectComponent, UiIconComponent } from "@flusys/ng-ui";
|
|
7
|
+
import { toSignal } from "@angular/core/rxjs-interop";
|
|
8
|
+
import { FormField, form, required } from "@angular/forms/signals";
|
|
9
|
+
const BRANCH_FORM_FIELDS = [
|
|
10
|
+
"id",
|
|
11
|
+
"companyId",
|
|
12
|
+
"parentId",
|
|
13
|
+
"name",
|
|
14
|
+
"slug",
|
|
15
|
+
"email",
|
|
16
|
+
"phone",
|
|
17
|
+
"address",
|
|
18
|
+
"isActive",
|
|
19
|
+
"readOnly"
|
|
20
|
+
];
|
|
21
|
+
var BranchFormComponent = class BranchFormComponent {
|
|
22
|
+
router = inject(Router);
|
|
23
|
+
route = inject(ActivatedRoute);
|
|
24
|
+
messageService = inject(MessageService);
|
|
25
|
+
branchService = inject(BranchApiService);
|
|
26
|
+
companyService = inject(CompanyApiService);
|
|
27
|
+
authState = inject(AuthStateService);
|
|
28
|
+
translateAdapter = inject(TranslateService, { optional: true });
|
|
29
|
+
translate(key, vars) {
|
|
30
|
+
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
31
|
+
}
|
|
32
|
+
routeParams = toSignal(this.route.paramMap);
|
|
33
|
+
queryParams = toSignal(this.route.queryParamMap);
|
|
34
|
+
isLoading = signal(false, ...ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []);
|
|
35
|
+
existingBranch = signal(null, ...ngDevMode ? [{ debugName: "existingBranch" }] : /* istanbul ignore next */ []);
|
|
36
|
+
isEditMode = computed(() => !!this.existingBranch(), ...ngDevMode ? [{ debugName: "isEditMode" }] : /* istanbul ignore next */ []);
|
|
37
|
+
companies = this.companyService.data;
|
|
38
|
+
companyBranches = signal([], ...ngDevMode ? [{ debugName: "companyBranches" }] : /* istanbul ignore next */ []);
|
|
39
|
+
parentTreeNodes = computed(() => buildBranchTreeNodes(this.companyBranches(), this.existingBranch()?.id), ...ngDevMode ? [{ debugName: "parentTreeNodes" }] : /* istanbul ignore next */ []);
|
|
40
|
+
selectedCompanyId = computed(() => this.formModel().companyId, ...ngDevMode ? [{ debugName: "selectedCompanyId" }] : /* istanbul ignore next */ []);
|
|
41
|
+
formModel = signal({
|
|
42
|
+
companyId: "",
|
|
43
|
+
parentId: null,
|
|
44
|
+
name: "",
|
|
45
|
+
slug: "",
|
|
46
|
+
email: "",
|
|
47
|
+
phone: "",
|
|
48
|
+
address: "",
|
|
49
|
+
isActive: true
|
|
50
|
+
}, ...ngDevMode ? [{ debugName: "formModel" }] : /* istanbul ignore next */ []);
|
|
51
|
+
branchForm = form(this.formModel, (f) => {
|
|
52
|
+
required(f.companyId, { message: this.translate("auth.validation.company.required") });
|
|
53
|
+
required(f.name, { message: this.translate("shared.name.required") });
|
|
54
|
+
required(f.slug, { message: this.translate("administrative.branch.slug.required") });
|
|
55
|
+
});
|
|
56
|
+
isFormValid = computed(() => {
|
|
57
|
+
const model = this.formModel();
|
|
58
|
+
return model.companyId.trim().length > 0 && model.name.trim().length > 0 && model.slug.trim().length > 0;
|
|
59
|
+
}, ...ngDevMode ? [{ debugName: "isFormValid" }] : /* istanbul ignore next */ []);
|
|
60
|
+
constructor() {
|
|
61
|
+
this.companyService.fetchList("", { pagination: {
|
|
62
|
+
currentPage: 0,
|
|
63
|
+
pageSize: 100
|
|
64
|
+
} });
|
|
65
|
+
effect(() => {
|
|
66
|
+
const params = this.routeParams();
|
|
67
|
+
const query = this.queryParams();
|
|
68
|
+
if (!params) return;
|
|
69
|
+
const id = params.get("id");
|
|
70
|
+
if (id && id !== "new") this.loadBranch(id);
|
|
71
|
+
else {
|
|
72
|
+
const queryCompanyId = query?.get("companyId");
|
|
73
|
+
const currentCompanyId = this.authState.company()?.id;
|
|
74
|
+
const companyId = queryCompanyId || currentCompanyId;
|
|
75
|
+
const parentId = query?.get("parentId") || null;
|
|
76
|
+
this.formModel.update((m) => ({
|
|
77
|
+
...m,
|
|
78
|
+
companyId: companyId || m.companyId,
|
|
79
|
+
parentId
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
effect(() => {
|
|
84
|
+
const companyId = this.selectedCompanyId();
|
|
85
|
+
untracked(() => this.loadCompanyBranches(companyId));
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async loadCompanyBranches(companyId) {
|
|
89
|
+
this.companyBranches.set([]);
|
|
90
|
+
if (!companyId) return;
|
|
91
|
+
try {
|
|
92
|
+
const response = await this.branchService.getAll({
|
|
93
|
+
filter: { companyId },
|
|
94
|
+
pagination: {
|
|
95
|
+
currentPage: 0,
|
|
96
|
+
pageSize: 1e3
|
|
97
|
+
},
|
|
98
|
+
select: [
|
|
99
|
+
"id",
|
|
100
|
+
"name",
|
|
101
|
+
"parentId",
|
|
102
|
+
"serial"
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
if (this.selectedCompanyId() !== companyId) return;
|
|
106
|
+
this.companyBranches.set(response?.success ? response.data ?? [] : []);
|
|
107
|
+
const parentId = this.formModel().parentId;
|
|
108
|
+
if (parentId && !this.companyBranches().some((b) => b.id === parentId)) this.formModel.update((m) => ({
|
|
109
|
+
...m,
|
|
110
|
+
parentId: null
|
|
111
|
+
}));
|
|
112
|
+
} catch {}
|
|
113
|
+
}
|
|
114
|
+
async loadBranch(id) {
|
|
115
|
+
this.isLoading.set(true);
|
|
116
|
+
try {
|
|
117
|
+
const response = await this.branchService.findById(id, BRANCH_FORM_FIELDS);
|
|
118
|
+
if (response.success && response.data) {
|
|
119
|
+
this.existingBranch.set(response.data);
|
|
120
|
+
this.formModel.set(this.toFormModel(response.data));
|
|
121
|
+
}
|
|
122
|
+
} catch {
|
|
123
|
+
this.router.navigate(["/administration/branch"]);
|
|
124
|
+
} finally {
|
|
125
|
+
this.isLoading.set(false);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
toFormModel(branch) {
|
|
129
|
+
return {
|
|
130
|
+
companyId: branch.companyId,
|
|
131
|
+
parentId: branch.parentId ?? null,
|
|
132
|
+
name: branch.name,
|
|
133
|
+
slug: branch.slug,
|
|
134
|
+
email: branch.email || "",
|
|
135
|
+
phone: branch.phone || "",
|
|
136
|
+
address: branch.address || "",
|
|
137
|
+
isActive: branch.isActive
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
generateSlug() {
|
|
141
|
+
const model = this.formModel();
|
|
142
|
+
if (!model.slug && model.name) {
|
|
143
|
+
const slug = model.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
144
|
+
this.formModel.update((m) => ({
|
|
145
|
+
...m,
|
|
146
|
+
slug
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async onSubmit(event) {
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
if (!this.isFormValid()) {
|
|
153
|
+
this.messageService.add({
|
|
154
|
+
severity: "error",
|
|
155
|
+
summary: this.translate("shared.validation.error"),
|
|
156
|
+
detail: this.translate("shared.fill.required.fields")
|
|
157
|
+
});
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.isLoading.set(true);
|
|
161
|
+
try {
|
|
162
|
+
if (this.isEditMode() && this.existingBranch()) await this.updateBranch();
|
|
163
|
+
else await this.createBranch();
|
|
164
|
+
this.navigateToList();
|
|
165
|
+
} catch {} finally {
|
|
166
|
+
this.isLoading.set(false);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async updateBranch() {
|
|
170
|
+
const model = this.formModel();
|
|
171
|
+
const updateData = {
|
|
172
|
+
id: this.existingBranch().id,
|
|
173
|
+
name: model.name,
|
|
174
|
+
slug: model.slug,
|
|
175
|
+
...this.buildOptionalFields(model)
|
|
176
|
+
};
|
|
177
|
+
const response = await this.branchService.update(updateData);
|
|
178
|
+
this.onSaveSuccess(response.messageKey ? this.translate(response.messageKey, response.messageVariables) : response.message);
|
|
179
|
+
}
|
|
180
|
+
async createBranch() {
|
|
181
|
+
const model = this.formModel();
|
|
182
|
+
const createData = {
|
|
183
|
+
companyId: model.companyId,
|
|
184
|
+
name: model.name,
|
|
185
|
+
slug: model.slug,
|
|
186
|
+
...this.buildOptionalFields(model)
|
|
187
|
+
};
|
|
188
|
+
const response = await this.branchService.insert(createData);
|
|
189
|
+
this.onSaveSuccess(response.messageKey ? this.translate(response.messageKey, response.messageVariables) : response.message ?? "");
|
|
190
|
+
}
|
|
191
|
+
buildOptionalFields(model) {
|
|
192
|
+
return {
|
|
193
|
+
parentId: model.parentId || null,
|
|
194
|
+
email: model.email || void 0,
|
|
195
|
+
phone: model.phone || void 0,
|
|
196
|
+
address: model.address || void 0,
|
|
197
|
+
isActive: model.isActive
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
onSaveSuccess(message) {
|
|
201
|
+
this.messageService.add({
|
|
202
|
+
severity: "success",
|
|
203
|
+
summary: this.translate("shared.success"),
|
|
204
|
+
detail: message
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
getTargetCompanyId() {
|
|
208
|
+
return this.existingBranch()?.companyId || this.formModel().companyId || null;
|
|
209
|
+
}
|
|
210
|
+
navigateToList() {
|
|
211
|
+
const companyId = this.getTargetCompanyId();
|
|
212
|
+
this.router.navigate(["/administration/branch"], { queryParams: companyId ? { companyId } : {} });
|
|
213
|
+
}
|
|
214
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
215
|
+
minVersion: "12.0.0",
|
|
216
|
+
version: "22.2.1",
|
|
217
|
+
ngImport: i0,
|
|
218
|
+
type: BranchFormComponent,
|
|
219
|
+
deps: [],
|
|
220
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
221
|
+
});
|
|
222
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
223
|
+
minVersion: "17.0.0",
|
|
224
|
+
version: "22.2.1",
|
|
225
|
+
type: BranchFormComponent,
|
|
226
|
+
isStandalone: true,
|
|
227
|
+
selector: "lib-branch-form",
|
|
228
|
+
ngImport: i0,
|
|
229
|
+
template: `
|
|
230
|
+
<f-card>
|
|
231
|
+
<ng-template #header>
|
|
232
|
+
<div class="flex justify-between items-center p-4">
|
|
233
|
+
<h2 class="text-xl font-semibold m-0">
|
|
234
|
+
{{
|
|
235
|
+
isEditMode()
|
|
236
|
+
? ('administrative.branch.edit' | translate)
|
|
237
|
+
: ('administrative.branch.new' | translate)
|
|
238
|
+
}}
|
|
239
|
+
</h2>
|
|
240
|
+
</div>
|
|
241
|
+
</ng-template>
|
|
242
|
+
|
|
243
|
+
<form
|
|
244
|
+
(submit)="onSubmit($event)"
|
|
245
|
+
class="grid grid-cols-1 md:grid-cols-2 gap-4"
|
|
246
|
+
>
|
|
247
|
+
<!-- Company Selection -->
|
|
248
|
+
@if (!isEditMode()) {
|
|
249
|
+
<div class="flex flex-col gap-2">
|
|
250
|
+
<label for="companyId" class="font-medium"
|
|
251
|
+
>{{ 'shared.company' | translate }} *</label
|
|
252
|
+
>
|
|
253
|
+
<f-select
|
|
254
|
+
inputId="companyId"
|
|
255
|
+
[options]="companies()"
|
|
256
|
+
optionLabel="name"
|
|
257
|
+
optionValue="id"
|
|
258
|
+
[formField]="branchForm.companyId"
|
|
259
|
+
[placeholder]="'administrative.company.select' | translate"
|
|
260
|
+
/>
|
|
261
|
+
</div>
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
<div class="flex flex-col gap-2">
|
|
265
|
+
<label for="parentId" class="font-medium">{{
|
|
266
|
+
'administrative.branch.parent' | translate
|
|
267
|
+
}}</label>
|
|
268
|
+
<f-treeselect
|
|
269
|
+
inputId="parentId"
|
|
270
|
+
[options]="parentTreeNodes()"
|
|
271
|
+
[formField]="branchForm.parentId"
|
|
272
|
+
[placeholder]="'administrative.branch.select.parent' | translate"
|
|
273
|
+
[filterPlaceholder]="'shared.search' | translate"
|
|
274
|
+
[emptyMessage]="'administrative.branch.no.branches' | translate"
|
|
275
|
+
[filter]="true"
|
|
276
|
+
[showClear]="true"
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<!-- Name -->
|
|
281
|
+
<div class="flex flex-col gap-2">
|
|
282
|
+
<label for="name" class="font-medium"
|
|
283
|
+
>{{ 'administrative.branch.name' | translate }} *</label
|
|
284
|
+
>
|
|
285
|
+
<input
|
|
286
|
+
fInputText
|
|
287
|
+
id="name"
|
|
288
|
+
[formField]="branchForm.name"
|
|
289
|
+
(blur)="generateSlug()"
|
|
290
|
+
[placeholder]="'administrative.branch.name.placeholder' | translate"
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<!-- Slug -->
|
|
295
|
+
<div class="flex flex-col gap-2">
|
|
296
|
+
<label for="slug" class="font-medium"
|
|
297
|
+
>{{ 'administrative.branch.slug' | translate }} *</label
|
|
298
|
+
>
|
|
299
|
+
<input
|
|
300
|
+
fInputText
|
|
301
|
+
id="slug"
|
|
302
|
+
[formField]="branchForm.slug"
|
|
303
|
+
[placeholder]="'administrative.branch.slug.placeholder' | translate"
|
|
304
|
+
/>
|
|
305
|
+
</div>
|
|
306
|
+
|
|
307
|
+
<!-- Email -->
|
|
308
|
+
<div class="flex flex-col gap-2">
|
|
309
|
+
<label for="email" class="font-medium">{{
|
|
310
|
+
'administrative.email.label' | translate
|
|
311
|
+
}}</label>
|
|
312
|
+
<input
|
|
313
|
+
fInputText
|
|
314
|
+
id="email"
|
|
315
|
+
type="email"
|
|
316
|
+
[formField]="branchForm.email"
|
|
317
|
+
[placeholder]="'administrative.email.placeholder' | translate"
|
|
318
|
+
/>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
<!-- Phone -->
|
|
322
|
+
<div class="flex flex-col gap-2">
|
|
323
|
+
<label for="phone" class="font-medium">{{
|
|
324
|
+
'administrative.phone.label' | translate
|
|
325
|
+
}}</label>
|
|
326
|
+
<input
|
|
327
|
+
fInputText
|
|
328
|
+
id="phone"
|
|
329
|
+
[formField]="branchForm.phone"
|
|
330
|
+
[placeholder]="'administrative.phone.placeholder' | translate"
|
|
331
|
+
/>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
<!-- Is Active -->
|
|
335
|
+
<div class="flex items-center pt-6">
|
|
336
|
+
<f-checkbox [formField]="branchForm.isActive" [label]="'shared.active' | translate" />
|
|
337
|
+
</div>
|
|
338
|
+
|
|
339
|
+
<!-- Address -->
|
|
340
|
+
<div class="flex flex-col gap-2 md:col-span-2">
|
|
341
|
+
<label for="address" class="font-medium">{{
|
|
342
|
+
'administrative.address.label' | translate
|
|
343
|
+
}}</label>
|
|
344
|
+
<textarea
|
|
345
|
+
id="address"
|
|
346
|
+
fInputText
|
|
347
|
+
[formField]="branchForm.address"
|
|
348
|
+
[placeholder]="'administrative.address.placeholder' | translate"
|
|
349
|
+
rows="3"
|
|
350
|
+
></textarea>
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
<!-- Actions -->
|
|
354
|
+
<div class="flex justify-end gap-4 md:col-span-2 pt-4">
|
|
355
|
+
<button
|
|
356
|
+
fButton
|
|
357
|
+
type="button"
|
|
358
|
+
severity="secondary"
|
|
359
|
+
[outlined]="true"
|
|
360
|
+
(click)="navigateToList()"
|
|
361
|
+
>
|
|
362
|
+
<span pButtonLabel>{{ 'shared.cancel' | translate }}</span>
|
|
363
|
+
</button>
|
|
364
|
+
<button
|
|
365
|
+
fButton
|
|
366
|
+
type="submit"
|
|
367
|
+
[disabled]="!isFormValid() || isLoading()"
|
|
368
|
+
>
|
|
369
|
+
@if (isLoading()) {
|
|
370
|
+
<ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
|
|
371
|
+
}
|
|
372
|
+
<span pButtonLabel>{{
|
|
373
|
+
isEditMode()
|
|
374
|
+
? ('shared.update' | translate)
|
|
375
|
+
: ('shared.create' | translate)
|
|
376
|
+
}}</span>
|
|
377
|
+
</button>
|
|
378
|
+
</div>
|
|
379
|
+
</form>
|
|
380
|
+
</f-card>
|
|
381
|
+
`,
|
|
382
|
+
isInline: true,
|
|
383
|
+
dependencies: [
|
|
384
|
+
{
|
|
385
|
+
kind: "component",
|
|
386
|
+
type: CardComponent,
|
|
387
|
+
selector: "f-card",
|
|
388
|
+
inputs: [
|
|
389
|
+
"header",
|
|
390
|
+
"subheader",
|
|
391
|
+
"styleClass",
|
|
392
|
+
"style"
|
|
393
|
+
]
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
kind: "component",
|
|
397
|
+
type: CheckboxComponent,
|
|
398
|
+
selector: "f-checkbox",
|
|
399
|
+
inputs: [
|
|
400
|
+
"label",
|
|
401
|
+
"binary",
|
|
402
|
+
"disabled",
|
|
403
|
+
"readonly",
|
|
404
|
+
"inputId",
|
|
405
|
+
"invalid",
|
|
406
|
+
"indeterminate",
|
|
407
|
+
"variant",
|
|
408
|
+
"size",
|
|
409
|
+
"touched",
|
|
410
|
+
"styleClass",
|
|
411
|
+
"style",
|
|
412
|
+
"checked"
|
|
413
|
+
],
|
|
414
|
+
outputs: [
|
|
415
|
+
"onChange",
|
|
416
|
+
"onBlur",
|
|
417
|
+
"touch",
|
|
418
|
+
"checkedChange"
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
kind: "directive",
|
|
423
|
+
type: FButtonDirective,
|
|
424
|
+
selector: "[fButton]",
|
|
425
|
+
inputs: [
|
|
426
|
+
"severity",
|
|
427
|
+
"text",
|
|
428
|
+
"outlined",
|
|
429
|
+
"link",
|
|
430
|
+
"variant",
|
|
431
|
+
"rounded",
|
|
432
|
+
"raised",
|
|
433
|
+
"fluid",
|
|
434
|
+
"disabled",
|
|
435
|
+
"loading",
|
|
436
|
+
"loadingIcon",
|
|
437
|
+
"size",
|
|
438
|
+
"label",
|
|
439
|
+
"icon",
|
|
440
|
+
"iconPos",
|
|
441
|
+
"ariaLabel",
|
|
442
|
+
"plain"
|
|
443
|
+
]
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
kind: "directive",
|
|
447
|
+
type: InputTextDirective,
|
|
448
|
+
selector: "[fInputText]",
|
|
449
|
+
inputs: [
|
|
450
|
+
"invalid",
|
|
451
|
+
"touched",
|
|
452
|
+
"variant",
|
|
453
|
+
"size",
|
|
454
|
+
"fluid"
|
|
455
|
+
]
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
kind: "component",
|
|
459
|
+
type: SelectComponent,
|
|
460
|
+
selector: "f-select",
|
|
461
|
+
inputs: [
|
|
462
|
+
"options",
|
|
463
|
+
"optionLabel",
|
|
464
|
+
"optionValue",
|
|
465
|
+
"placeholder",
|
|
466
|
+
"disabled",
|
|
467
|
+
"filter",
|
|
468
|
+
"filterBy",
|
|
469
|
+
"filterMatchMode",
|
|
470
|
+
"filterLocale",
|
|
471
|
+
"filterPlaceholder",
|
|
472
|
+
"resetFilterOnHide",
|
|
473
|
+
"autofocusFilter",
|
|
474
|
+
"emptyMessage",
|
|
475
|
+
"emptyFilterMessage",
|
|
476
|
+
"showClear",
|
|
477
|
+
"loading",
|
|
478
|
+
"loadingIcon",
|
|
479
|
+
"dropdownIcon",
|
|
480
|
+
"clearIcon",
|
|
481
|
+
"inputId",
|
|
482
|
+
"invalid",
|
|
483
|
+
"touched",
|
|
484
|
+
"styleClass",
|
|
485
|
+
"style",
|
|
486
|
+
"appendTo",
|
|
487
|
+
"editable",
|
|
488
|
+
"readonly",
|
|
489
|
+
"autofocus",
|
|
490
|
+
"checkmark",
|
|
491
|
+
"group",
|
|
492
|
+
"optionGroupLabel",
|
|
493
|
+
"optionGroupChildren",
|
|
494
|
+
"virtualScroll",
|
|
495
|
+
"virtualScrollItemSize",
|
|
496
|
+
"lazy",
|
|
497
|
+
"selectedObject"
|
|
498
|
+
],
|
|
499
|
+
outputs: [
|
|
500
|
+
"onFilter",
|
|
501
|
+
"onChange",
|
|
502
|
+
"onShow",
|
|
503
|
+
"onHide",
|
|
504
|
+
"onBlur",
|
|
505
|
+
"onFocus",
|
|
506
|
+
"onClear",
|
|
507
|
+
"onLazyLoad"
|
|
508
|
+
]
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
kind: "component",
|
|
512
|
+
type: TreeSelectComponent,
|
|
513
|
+
selector: "f-treeselect",
|
|
514
|
+
inputs: [
|
|
515
|
+
"options",
|
|
516
|
+
"placeholder",
|
|
517
|
+
"inputId",
|
|
518
|
+
"disabled",
|
|
519
|
+
"filter",
|
|
520
|
+
"filterBy",
|
|
521
|
+
"filterPlaceholder",
|
|
522
|
+
"selectionMode",
|
|
523
|
+
"display",
|
|
524
|
+
"propagateSelectionDown",
|
|
525
|
+
"propagateSelectionUp",
|
|
526
|
+
"showClear",
|
|
527
|
+
"virtualScroll",
|
|
528
|
+
"virtualScrollItemSize",
|
|
529
|
+
"emptyMessage",
|
|
530
|
+
"invalid",
|
|
531
|
+
"touched",
|
|
532
|
+
"styleClass",
|
|
533
|
+
"style",
|
|
534
|
+
"appendTo"
|
|
535
|
+
]
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
kind: "component",
|
|
539
|
+
type: UiIconComponent,
|
|
540
|
+
selector: "ui-icon",
|
|
541
|
+
inputs: [
|
|
542
|
+
"name",
|
|
543
|
+
"size",
|
|
544
|
+
"spin",
|
|
545
|
+
"fill",
|
|
546
|
+
"severity"
|
|
547
|
+
]
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
kind: "directive",
|
|
551
|
+
type: FormField,
|
|
552
|
+
selector: "[formField]",
|
|
553
|
+
inputs: ["formField"],
|
|
554
|
+
exportAs: ["formField"]
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
kind: "pipe",
|
|
558
|
+
type: TranslatePipe,
|
|
559
|
+
name: "translate"
|
|
560
|
+
}
|
|
561
|
+
]
|
|
562
|
+
});
|
|
563
|
+
};
|
|
564
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
565
|
+
minVersion: "12.0.0",
|
|
566
|
+
version: "22.2.1",
|
|
567
|
+
ngImport: i0,
|
|
568
|
+
type: BranchFormComponent,
|
|
569
|
+
decorators: [{
|
|
570
|
+
type: Component,
|
|
571
|
+
args: [{
|
|
572
|
+
selector: "lib-branch-form",
|
|
573
|
+
imports: [
|
|
574
|
+
CardComponent,
|
|
575
|
+
CheckboxComponent,
|
|
576
|
+
FButtonDirective,
|
|
577
|
+
InputTextDirective,
|
|
578
|
+
SelectComponent,
|
|
579
|
+
TreeSelectComponent,
|
|
580
|
+
UiIconComponent,
|
|
581
|
+
FormField,
|
|
582
|
+
TranslatePipe
|
|
583
|
+
],
|
|
584
|
+
template: `
|
|
585
|
+
<f-card>
|
|
586
|
+
<ng-template #header>
|
|
587
|
+
<div class="flex justify-between items-center p-4">
|
|
588
|
+
<h2 class="text-xl font-semibold m-0">
|
|
589
|
+
{{
|
|
590
|
+
isEditMode()
|
|
591
|
+
? ('administrative.branch.edit' | translate)
|
|
592
|
+
: ('administrative.branch.new' | translate)
|
|
593
|
+
}}
|
|
594
|
+
</h2>
|
|
595
|
+
</div>
|
|
596
|
+
</ng-template>
|
|
597
|
+
|
|
598
|
+
<form
|
|
599
|
+
(submit)="onSubmit($event)"
|
|
600
|
+
class="grid grid-cols-1 md:grid-cols-2 gap-4"
|
|
601
|
+
>
|
|
602
|
+
<!-- Company Selection -->
|
|
603
|
+
@if (!isEditMode()) {
|
|
604
|
+
<div class="flex flex-col gap-2">
|
|
605
|
+
<label for="companyId" class="font-medium"
|
|
606
|
+
>{{ 'shared.company' | translate }} *</label
|
|
607
|
+
>
|
|
608
|
+
<f-select
|
|
609
|
+
inputId="companyId"
|
|
610
|
+
[options]="companies()"
|
|
611
|
+
optionLabel="name"
|
|
612
|
+
optionValue="id"
|
|
613
|
+
[formField]="branchForm.companyId"
|
|
614
|
+
[placeholder]="'administrative.company.select' | translate"
|
|
615
|
+
/>
|
|
616
|
+
</div>
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
<div class="flex flex-col gap-2">
|
|
620
|
+
<label for="parentId" class="font-medium">{{
|
|
621
|
+
'administrative.branch.parent' | translate
|
|
622
|
+
}}</label>
|
|
623
|
+
<f-treeselect
|
|
624
|
+
inputId="parentId"
|
|
625
|
+
[options]="parentTreeNodes()"
|
|
626
|
+
[formField]="branchForm.parentId"
|
|
627
|
+
[placeholder]="'administrative.branch.select.parent' | translate"
|
|
628
|
+
[filterPlaceholder]="'shared.search' | translate"
|
|
629
|
+
[emptyMessage]="'administrative.branch.no.branches' | translate"
|
|
630
|
+
[filter]="true"
|
|
631
|
+
[showClear]="true"
|
|
632
|
+
/>
|
|
633
|
+
</div>
|
|
634
|
+
|
|
635
|
+
<!-- Name -->
|
|
636
|
+
<div class="flex flex-col gap-2">
|
|
637
|
+
<label for="name" class="font-medium"
|
|
638
|
+
>{{ 'administrative.branch.name' | translate }} *</label
|
|
639
|
+
>
|
|
640
|
+
<input
|
|
641
|
+
fInputText
|
|
642
|
+
id="name"
|
|
643
|
+
[formField]="branchForm.name"
|
|
644
|
+
(blur)="generateSlug()"
|
|
645
|
+
[placeholder]="'administrative.branch.name.placeholder' | translate"
|
|
646
|
+
/>
|
|
647
|
+
</div>
|
|
648
|
+
|
|
649
|
+
<!-- Slug -->
|
|
650
|
+
<div class="flex flex-col gap-2">
|
|
651
|
+
<label for="slug" class="font-medium"
|
|
652
|
+
>{{ 'administrative.branch.slug' | translate }} *</label
|
|
653
|
+
>
|
|
654
|
+
<input
|
|
655
|
+
fInputText
|
|
656
|
+
id="slug"
|
|
657
|
+
[formField]="branchForm.slug"
|
|
658
|
+
[placeholder]="'administrative.branch.slug.placeholder' | translate"
|
|
659
|
+
/>
|
|
660
|
+
</div>
|
|
661
|
+
|
|
662
|
+
<!-- Email -->
|
|
663
|
+
<div class="flex flex-col gap-2">
|
|
664
|
+
<label for="email" class="font-medium">{{
|
|
665
|
+
'administrative.email.label' | translate
|
|
666
|
+
}}</label>
|
|
667
|
+
<input
|
|
668
|
+
fInputText
|
|
669
|
+
id="email"
|
|
670
|
+
type="email"
|
|
671
|
+
[formField]="branchForm.email"
|
|
672
|
+
[placeholder]="'administrative.email.placeholder' | translate"
|
|
673
|
+
/>
|
|
674
|
+
</div>
|
|
675
|
+
|
|
676
|
+
<!-- Phone -->
|
|
677
|
+
<div class="flex flex-col gap-2">
|
|
678
|
+
<label for="phone" class="font-medium">{{
|
|
679
|
+
'administrative.phone.label' | translate
|
|
680
|
+
}}</label>
|
|
681
|
+
<input
|
|
682
|
+
fInputText
|
|
683
|
+
id="phone"
|
|
684
|
+
[formField]="branchForm.phone"
|
|
685
|
+
[placeholder]="'administrative.phone.placeholder' | translate"
|
|
686
|
+
/>
|
|
687
|
+
</div>
|
|
688
|
+
|
|
689
|
+
<!-- Is Active -->
|
|
690
|
+
<div class="flex items-center pt-6">
|
|
691
|
+
<f-checkbox [formField]="branchForm.isActive" [label]="'shared.active' | translate" />
|
|
692
|
+
</div>
|
|
693
|
+
|
|
694
|
+
<!-- Address -->
|
|
695
|
+
<div class="flex flex-col gap-2 md:col-span-2">
|
|
696
|
+
<label for="address" class="font-medium">{{
|
|
697
|
+
'administrative.address.label' | translate
|
|
698
|
+
}}</label>
|
|
699
|
+
<textarea
|
|
700
|
+
id="address"
|
|
701
|
+
fInputText
|
|
702
|
+
[formField]="branchForm.address"
|
|
703
|
+
[placeholder]="'administrative.address.placeholder' | translate"
|
|
704
|
+
rows="3"
|
|
705
|
+
></textarea>
|
|
706
|
+
</div>
|
|
707
|
+
|
|
708
|
+
<!-- Actions -->
|
|
709
|
+
<div class="flex justify-end gap-4 md:col-span-2 pt-4">
|
|
710
|
+
<button
|
|
711
|
+
fButton
|
|
712
|
+
type="button"
|
|
713
|
+
severity="secondary"
|
|
714
|
+
[outlined]="true"
|
|
715
|
+
(click)="navigateToList()"
|
|
716
|
+
>
|
|
717
|
+
<span pButtonLabel>{{ 'shared.cancel' | translate }}</span>
|
|
718
|
+
</button>
|
|
719
|
+
<button
|
|
720
|
+
fButton
|
|
721
|
+
type="submit"
|
|
722
|
+
[disabled]="!isFormValid() || isLoading()"
|
|
723
|
+
>
|
|
724
|
+
@if (isLoading()) {
|
|
725
|
+
<ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
|
|
726
|
+
}
|
|
727
|
+
<span pButtonLabel>{{
|
|
728
|
+
isEditMode()
|
|
729
|
+
? ('shared.update' | translate)
|
|
730
|
+
: ('shared.create' | translate)
|
|
731
|
+
}}</span>
|
|
732
|
+
</button>
|
|
733
|
+
</div>
|
|
734
|
+
</form>
|
|
735
|
+
</f-card>
|
|
736
|
+
`
|
|
737
|
+
}]
|
|
738
|
+
}],
|
|
739
|
+
ctorParameters: () => []
|
|
740
|
+
});
|
|
741
|
+
export { BranchFormComponent };
|
|
742
|
+
|
|
743
|
+
//# sourceMappingURL=flusys-ng-auth-branch-form.component-Df_sMC2G.mjs.map
|