@flusys/ng-auth 9.1.0-rc.1 → 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,775 @@
|
|
|
1
|
+
import { AuthStateService, BranchApiService, BranchPermittedUsersDialogComponent, 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 { BRANCH_PERMISSIONS, HasPermissionDirective, TranslatePipe, TranslateService, USER_PERMISSIONS, buildBranchHierarchy, collectBranchDescendantIds, filterBranchHierarchy } from "@flusys/ng-shared";
|
|
6
|
+
import { CardComponent, ConfirmationService, FButtonDirective, IconFieldComponent, InputIconComponent, InputTextDirective, MessageService, SelectComponent, TagComponent, TooltipDirective, TreeTableComponent, TreeTableTogglerComponent, UiIconComponent } from "@flusys/ng-ui";
|
|
7
|
+
import { toSignal } from "@angular/core/rxjs-interop";
|
|
8
|
+
import * as i1 from "@angular/forms";
|
|
9
|
+
import { FormsModule } from "@angular/forms";
|
|
10
|
+
function matchesSearch(branch, term) {
|
|
11
|
+
return [
|
|
12
|
+
branch.name,
|
|
13
|
+
branch.slug,
|
|
14
|
+
branch.email,
|
|
15
|
+
branch.phone
|
|
16
|
+
].some((v) => v?.toLowerCase().includes(term));
|
|
17
|
+
}
|
|
18
|
+
function buildBranchTree(branches, search = "") {
|
|
19
|
+
const term = search.trim().toLowerCase();
|
|
20
|
+
const hierarchy = buildBranchHierarchy(branches);
|
|
21
|
+
const items = term ? filterBranchHierarchy(hierarchy, (branch) => matchesSearch(branch, term)) : hierarchy;
|
|
22
|
+
const convert = (list) => list.map(({ data, children }) => {
|
|
23
|
+
const childNodes = convert(children);
|
|
24
|
+
return {
|
|
25
|
+
key: data.id,
|
|
26
|
+
data,
|
|
27
|
+
children: childNodes,
|
|
28
|
+
leaf: !childNodes.length,
|
|
29
|
+
expanded: !!term && childNodes.length > 0
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
return convert(items);
|
|
33
|
+
}
|
|
34
|
+
function countBranchDescendants(branches, branchId) {
|
|
35
|
+
return collectBranchDescendantIds(branches, branchId).length;
|
|
36
|
+
}
|
|
37
|
+
const BRANCH_FETCH_LIMIT = 1e3;
|
|
38
|
+
var BranchListComponent = class BranchListComponent {
|
|
39
|
+
BRANCH_PERMISSIONS = BRANCH_PERMISSIONS;
|
|
40
|
+
USER_PERMISSIONS = USER_PERMISSIONS;
|
|
41
|
+
router = inject(Router);
|
|
42
|
+
route = inject(ActivatedRoute);
|
|
43
|
+
messageService = inject(MessageService);
|
|
44
|
+
confirmationService = inject(ConfirmationService);
|
|
45
|
+
branchService = inject(BranchApiService);
|
|
46
|
+
companyService = inject(CompanyApiService);
|
|
47
|
+
authState = inject(AuthStateService);
|
|
48
|
+
translateAdapter = inject(TranslateService, { optional: true });
|
|
49
|
+
translate(key, vars) {
|
|
50
|
+
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
51
|
+
}
|
|
52
|
+
queryParamMap = toSignal(this.route.queryParamMap);
|
|
53
|
+
initialized = false;
|
|
54
|
+
selectedCompanyId = signal(null, ...ngDevMode ? [{ debugName: "selectedCompanyId" }] : /* istanbul ignore next */ []);
|
|
55
|
+
companies = this.companyService.data;
|
|
56
|
+
isLoading = this.branchService.isLoading;
|
|
57
|
+
permittedUsersDialogVisible = signal(false, ...ngDevMode ? [{ debugName: "permittedUsersDialogVisible" }] : /* istanbul ignore next */ []);
|
|
58
|
+
selectedBranch = signal(null, ...ngDevMode ? [{ debugName: "selectedBranch" }] : /* istanbul ignore next */ []);
|
|
59
|
+
_searchTerm = signal("", ...ngDevMode ? [{ debugName: "_searchTerm" }] : /* istanbul ignore next */ []);
|
|
60
|
+
searchTerm = this._searchTerm.asReadonly();
|
|
61
|
+
treeNodes = computed(() => buildBranchTree(this.branchService.data(), this._searchTerm()), ...ngDevMode ? [{ debugName: "treeNodes" }] : /* istanbul ignore next */ []);
|
|
62
|
+
constructor() {
|
|
63
|
+
effect(() => {
|
|
64
|
+
const params = this.queryParamMap();
|
|
65
|
+
if (this.initialized) return;
|
|
66
|
+
this.initialized = true;
|
|
67
|
+
untracked(() => {
|
|
68
|
+
this.companyService.fetchList("", { pagination: {
|
|
69
|
+
currentPage: 0,
|
|
70
|
+
pageSize: 100
|
|
71
|
+
} });
|
|
72
|
+
const queryCompanyId = params?.get("companyId") || null;
|
|
73
|
+
const currentCompanyId = this.authState.company()?.id;
|
|
74
|
+
const companyId = queryCompanyId || currentCompanyId || null;
|
|
75
|
+
this.selectedCompanyId.set(companyId);
|
|
76
|
+
if (companyId) this.loadBranches();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
loadBranches() {
|
|
81
|
+
const companyId = this.selectedCompanyId();
|
|
82
|
+
if (!companyId) return;
|
|
83
|
+
this.branchService.fetchList("", {
|
|
84
|
+
filter: { companyId },
|
|
85
|
+
pagination: {
|
|
86
|
+
currentPage: 0,
|
|
87
|
+
pageSize: BRANCH_FETCH_LIMIT
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
onSearchChange(value) {
|
|
92
|
+
this._searchTerm.set(value);
|
|
93
|
+
}
|
|
94
|
+
onCreate() {
|
|
95
|
+
this.router.navigate(["/administration/branch/new"], { queryParams: { companyId: this.selectedCompanyId() } });
|
|
96
|
+
}
|
|
97
|
+
onAddChild(branch) {
|
|
98
|
+
this.router.navigate(["/administration/branch/new"], { queryParams: {
|
|
99
|
+
companyId: this.selectedCompanyId(),
|
|
100
|
+
parentId: branch.id
|
|
101
|
+
} });
|
|
102
|
+
}
|
|
103
|
+
onEdit(branch) {
|
|
104
|
+
this.router.navigate(["/administration/branch", branch.id]);
|
|
105
|
+
}
|
|
106
|
+
onViewUsers(branch) {
|
|
107
|
+
this.selectedBranch.set(branch);
|
|
108
|
+
this.permittedUsersDialogVisible.set(true);
|
|
109
|
+
}
|
|
110
|
+
onDelete(branch) {
|
|
111
|
+
const descendantCount = countBranchDescendants(this.branchService.data(), branch.id);
|
|
112
|
+
this.confirmationService.confirm({
|
|
113
|
+
message: descendantCount ? this.translate("administrative.branch.confirm.delete.with.children", {
|
|
114
|
+
name: branch.name,
|
|
115
|
+
count: descendantCount
|
|
116
|
+
}) : this.translate("shared.confirm.delete.item", { name: branch.name }),
|
|
117
|
+
header: this.translate("administrative.branch.delete.title"),
|
|
118
|
+
icon: "exclamation-triangle",
|
|
119
|
+
acceptButtonStyleClass: "p-button-danger",
|
|
120
|
+
accept: async () => {
|
|
121
|
+
try {
|
|
122
|
+
const response = await this.branchService.delete({
|
|
123
|
+
id: branch.id,
|
|
124
|
+
type: "permanent"
|
|
125
|
+
});
|
|
126
|
+
this.messageService.add({
|
|
127
|
+
severity: "success",
|
|
128
|
+
summary: this.translate("shared.success"),
|
|
129
|
+
detail: response?.messageKey ? this.translate(response.messageKey, response.messageVariables) : response?.message
|
|
130
|
+
});
|
|
131
|
+
this.branchService.reload();
|
|
132
|
+
} catch {}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
137
|
+
minVersion: "12.0.0",
|
|
138
|
+
version: "22.2.1",
|
|
139
|
+
ngImport: i0,
|
|
140
|
+
type: BranchListComponent,
|
|
141
|
+
deps: [],
|
|
142
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
143
|
+
});
|
|
144
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
145
|
+
minVersion: "17.0.0",
|
|
146
|
+
version: "22.2.1",
|
|
147
|
+
type: BranchListComponent,
|
|
148
|
+
isStandalone: true,
|
|
149
|
+
selector: "lib-branch-list",
|
|
150
|
+
ngImport: i0,
|
|
151
|
+
template: `
|
|
152
|
+
<f-card>
|
|
153
|
+
<ng-template #header>
|
|
154
|
+
<div
|
|
155
|
+
class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 p-4"
|
|
156
|
+
>
|
|
157
|
+
<div
|
|
158
|
+
class="flex flex-col sm:flex-row items-start sm:items-center gap-3 sm:gap-4 w-full sm:w-auto"
|
|
159
|
+
>
|
|
160
|
+
<h2 class="text-xl font-semibold m-0">
|
|
161
|
+
{{ 'administrative.branch.title' | translate }}
|
|
162
|
+
</h2>
|
|
163
|
+
@if (companies().length > 1) {
|
|
164
|
+
<f-select
|
|
165
|
+
[options]="companies()"
|
|
166
|
+
[ngModel]="selectedCompanyId()"
|
|
167
|
+
(ngModelChange)="
|
|
168
|
+
selectedCompanyId.set($event); loadBranches()
|
|
169
|
+
"
|
|
170
|
+
optionLabel="name"
|
|
171
|
+
optionValue="id"
|
|
172
|
+
[placeholder]="'administrative.company.select' | translate"
|
|
173
|
+
styleClass="w-full sm:w-64"
|
|
174
|
+
/>
|
|
175
|
+
}
|
|
176
|
+
</div>
|
|
177
|
+
<div class="flex items-center gap-3 w-full sm:w-auto">
|
|
178
|
+
<f-iconfield class="w-full sm:w-64">
|
|
179
|
+
<f-inputicon icon="search" />
|
|
180
|
+
<input
|
|
181
|
+
fInputText
|
|
182
|
+
type="text"
|
|
183
|
+
[ngModel]="searchTerm()"
|
|
184
|
+
(ngModelChange)="onSearchChange($event)"
|
|
185
|
+
[placeholder]="'shared.search' | translate"
|
|
186
|
+
/>
|
|
187
|
+
</f-iconfield>
|
|
188
|
+
<button
|
|
189
|
+
fButton
|
|
190
|
+
*hasPermission="BRANCH_PERMISSIONS.CREATE"
|
|
191
|
+
[disabled]="!selectedCompanyId()"
|
|
192
|
+
(click)="onCreate()"
|
|
193
|
+
>
|
|
194
|
+
<ui-icon pButtonIcon name="plus"></ui-icon>
|
|
195
|
+
<span pButtonLabel>{{
|
|
196
|
+
'administrative.branch.add' | translate
|
|
197
|
+
}}</span>
|
|
198
|
+
</button>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</ng-template>
|
|
202
|
+
|
|
203
|
+
<div class="overflow-x-auto">
|
|
204
|
+
<f-treetable
|
|
205
|
+
[value]="treeNodes()"
|
|
206
|
+
[loading]="isLoading()"
|
|
207
|
+
dataKey="id"
|
|
208
|
+
[tableStyle]="{ 'min-width': '50rem' }"
|
|
209
|
+
>
|
|
210
|
+
<ng-template #header>
|
|
211
|
+
<tr>
|
|
212
|
+
<th>{{ 'administrative.branch.name' | translate }}</th>
|
|
213
|
+
<th>{{ 'administrative.branch.slug' | translate }}</th>
|
|
214
|
+
<th>{{ 'administrative.email.label' | translate }}</th>
|
|
215
|
+
<th>{{ 'administrative.phone.label' | translate }}</th>
|
|
216
|
+
<th>{{ 'shared.status' | translate }}</th>
|
|
217
|
+
<th class="w-[160px]">{{ 'shared.actions' | translate }}</th>
|
|
218
|
+
</tr>
|
|
219
|
+
</ng-template>
|
|
220
|
+
<ng-template #body let-rowNode let-branch="rowData">
|
|
221
|
+
<tr>
|
|
222
|
+
<td>
|
|
223
|
+
<f-treetabletoggler [rowNode]="rowNode" />
|
|
224
|
+
{{ branch.name }}
|
|
225
|
+
</td>
|
|
226
|
+
<td>{{ branch.slug }}</td>
|
|
227
|
+
<td>{{ branch.email || '-' }}</td>
|
|
228
|
+
<td>{{ branch.phone || '-' }}</td>
|
|
229
|
+
<td>
|
|
230
|
+
<f-tag
|
|
231
|
+
[value]="
|
|
232
|
+
branch.isActive
|
|
233
|
+
? ('shared.active' | translate)
|
|
234
|
+
: ('shared.inactive' | translate)
|
|
235
|
+
"
|
|
236
|
+
[severity]="branch.isActive ? 'success' : 'danger'"
|
|
237
|
+
/>
|
|
238
|
+
</td>
|
|
239
|
+
<td>
|
|
240
|
+
<div class="flex gap-2">
|
|
241
|
+
<button
|
|
242
|
+
fButton
|
|
243
|
+
*hasPermission="BRANCH_PERMISSIONS.CREATE"
|
|
244
|
+
[rounded]="true"
|
|
245
|
+
[text]="true"
|
|
246
|
+
severity="success"
|
|
247
|
+
[fTooltip]="'administrative.branch.add.child' | translate"
|
|
248
|
+
(click)="onAddChild(branch)"
|
|
249
|
+
>
|
|
250
|
+
<ui-icon pButtonIcon name="git-branch-plus"></ui-icon>
|
|
251
|
+
</button>
|
|
252
|
+
<button
|
|
253
|
+
fButton
|
|
254
|
+
*hasPermission="BRANCH_PERMISSIONS.UPDATE"
|
|
255
|
+
[rounded]="true"
|
|
256
|
+
[text]="true"
|
|
257
|
+
severity="info"
|
|
258
|
+
[fTooltip]="'shared.edit' | translate"
|
|
259
|
+
(click)="onEdit(branch)"
|
|
260
|
+
>
|
|
261
|
+
<ui-icon pButtonIcon name="pencil"></ui-icon>
|
|
262
|
+
</button>
|
|
263
|
+
<button
|
|
264
|
+
fButton
|
|
265
|
+
*hasPermission="USER_PERMISSIONS.READ"
|
|
266
|
+
[rounded]="true"
|
|
267
|
+
[text]="true"
|
|
268
|
+
severity="secondary"
|
|
269
|
+
[fTooltip]="'administrative.permission.view.users' | translate"
|
|
270
|
+
(click)="onViewUsers(branch)"
|
|
271
|
+
>
|
|
272
|
+
<ui-icon pButtonIcon name="users"></ui-icon>
|
|
273
|
+
</button>
|
|
274
|
+
@if (!branch.readOnly) {
|
|
275
|
+
<button
|
|
276
|
+
fButton
|
|
277
|
+
*hasPermission="BRANCH_PERMISSIONS.DELETE"
|
|
278
|
+
[rounded]="true"
|
|
279
|
+
[text]="true"
|
|
280
|
+
severity="danger"
|
|
281
|
+
[fTooltip]="'shared.delete' | translate"
|
|
282
|
+
(click)="onDelete(branch)"
|
|
283
|
+
>
|
|
284
|
+
<ui-icon pButtonIcon name="trash"></ui-icon>
|
|
285
|
+
</button>
|
|
286
|
+
}
|
|
287
|
+
</div>
|
|
288
|
+
</td>
|
|
289
|
+
</tr>
|
|
290
|
+
</ng-template>
|
|
291
|
+
<ng-template #emptymessage>
|
|
292
|
+
<tr>
|
|
293
|
+
<td colspan="6" class="text-center py-8">
|
|
294
|
+
@if (!selectedCompanyId()) {
|
|
295
|
+
{{ 'administrative.branch.select.company.first' | translate }}
|
|
296
|
+
} @else {
|
|
297
|
+
{{ 'administrative.branch.no.branches' | translate }}
|
|
298
|
+
}
|
|
299
|
+
</td>
|
|
300
|
+
</tr>
|
|
301
|
+
</ng-template>
|
|
302
|
+
</f-treetable>
|
|
303
|
+
</div>
|
|
304
|
+
</f-card>
|
|
305
|
+
|
|
306
|
+
<lib-branch-permitted-users-dialog
|
|
307
|
+
[visible]="permittedUsersDialogVisible()"
|
|
308
|
+
[branch]="selectedBranch()"
|
|
309
|
+
(closed)="permittedUsersDialogVisible.set(false)"
|
|
310
|
+
/>
|
|
311
|
+
`,
|
|
312
|
+
isInline: true,
|
|
313
|
+
dependencies: [
|
|
314
|
+
{
|
|
315
|
+
kind: "ngmodule",
|
|
316
|
+
type: FormsModule
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
kind: "directive",
|
|
320
|
+
type: i1.DefaultValueAccessor,
|
|
321
|
+
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
kind: "directive",
|
|
325
|
+
type: i1.NgControlStatus,
|
|
326
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
kind: "directive",
|
|
330
|
+
type: i1.NgModel,
|
|
331
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
332
|
+
inputs: [
|
|
333
|
+
"name",
|
|
334
|
+
"disabled",
|
|
335
|
+
"ngModel",
|
|
336
|
+
"ngModelOptions"
|
|
337
|
+
],
|
|
338
|
+
outputs: ["ngModelChange"],
|
|
339
|
+
exportAs: ["ngModel"]
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
kind: "component",
|
|
343
|
+
type: CardComponent,
|
|
344
|
+
selector: "f-card",
|
|
345
|
+
inputs: [
|
|
346
|
+
"header",
|
|
347
|
+
"subheader",
|
|
348
|
+
"styleClass",
|
|
349
|
+
"style"
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
kind: "directive",
|
|
354
|
+
type: FButtonDirective,
|
|
355
|
+
selector: "[fButton]",
|
|
356
|
+
inputs: [
|
|
357
|
+
"severity",
|
|
358
|
+
"text",
|
|
359
|
+
"outlined",
|
|
360
|
+
"link",
|
|
361
|
+
"variant",
|
|
362
|
+
"rounded",
|
|
363
|
+
"raised",
|
|
364
|
+
"fluid",
|
|
365
|
+
"disabled",
|
|
366
|
+
"loading",
|
|
367
|
+
"loadingIcon",
|
|
368
|
+
"size",
|
|
369
|
+
"label",
|
|
370
|
+
"icon",
|
|
371
|
+
"iconPos",
|
|
372
|
+
"ariaLabel",
|
|
373
|
+
"plain"
|
|
374
|
+
]
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
kind: "component",
|
|
378
|
+
type: IconFieldComponent,
|
|
379
|
+
selector: "f-iconfield",
|
|
380
|
+
inputs: ["iconPosition", "styleClass"]
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
kind: "component",
|
|
384
|
+
type: InputIconComponent,
|
|
385
|
+
selector: "f-inputicon",
|
|
386
|
+
inputs: [
|
|
387
|
+
"icon",
|
|
388
|
+
"position",
|
|
389
|
+
"styleClass",
|
|
390
|
+
"style"
|
|
391
|
+
]
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
kind: "directive",
|
|
395
|
+
type: InputTextDirective,
|
|
396
|
+
selector: "[fInputText]",
|
|
397
|
+
inputs: [
|
|
398
|
+
"invalid",
|
|
399
|
+
"touched",
|
|
400
|
+
"variant",
|
|
401
|
+
"size",
|
|
402
|
+
"fluid"
|
|
403
|
+
]
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
kind: "component",
|
|
407
|
+
type: SelectComponent,
|
|
408
|
+
selector: "f-select",
|
|
409
|
+
inputs: [
|
|
410
|
+
"options",
|
|
411
|
+
"optionLabel",
|
|
412
|
+
"optionValue",
|
|
413
|
+
"placeholder",
|
|
414
|
+
"disabled",
|
|
415
|
+
"filter",
|
|
416
|
+
"filterBy",
|
|
417
|
+
"filterMatchMode",
|
|
418
|
+
"filterLocale",
|
|
419
|
+
"filterPlaceholder",
|
|
420
|
+
"resetFilterOnHide",
|
|
421
|
+
"autofocusFilter",
|
|
422
|
+
"emptyMessage",
|
|
423
|
+
"emptyFilterMessage",
|
|
424
|
+
"showClear",
|
|
425
|
+
"loading",
|
|
426
|
+
"loadingIcon",
|
|
427
|
+
"dropdownIcon",
|
|
428
|
+
"clearIcon",
|
|
429
|
+
"inputId",
|
|
430
|
+
"invalid",
|
|
431
|
+
"touched",
|
|
432
|
+
"styleClass",
|
|
433
|
+
"style",
|
|
434
|
+
"appendTo",
|
|
435
|
+
"editable",
|
|
436
|
+
"readonly",
|
|
437
|
+
"autofocus",
|
|
438
|
+
"checkmark",
|
|
439
|
+
"group",
|
|
440
|
+
"optionGroupLabel",
|
|
441
|
+
"optionGroupChildren",
|
|
442
|
+
"virtualScroll",
|
|
443
|
+
"virtualScrollItemSize",
|
|
444
|
+
"lazy",
|
|
445
|
+
"selectedObject"
|
|
446
|
+
],
|
|
447
|
+
outputs: [
|
|
448
|
+
"onFilter",
|
|
449
|
+
"onChange",
|
|
450
|
+
"onShow",
|
|
451
|
+
"onHide",
|
|
452
|
+
"onBlur",
|
|
453
|
+
"onFocus",
|
|
454
|
+
"onClear",
|
|
455
|
+
"onLazyLoad"
|
|
456
|
+
]
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
kind: "component",
|
|
460
|
+
type: TagComponent,
|
|
461
|
+
selector: "f-tag",
|
|
462
|
+
inputs: [
|
|
463
|
+
"value",
|
|
464
|
+
"severity",
|
|
465
|
+
"icon",
|
|
466
|
+
"rounded",
|
|
467
|
+
"color",
|
|
468
|
+
"styleClass",
|
|
469
|
+
"style"
|
|
470
|
+
]
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
kind: "directive",
|
|
474
|
+
type: TooltipDirective,
|
|
475
|
+
selector: "[fTooltip]",
|
|
476
|
+
inputs: [
|
|
477
|
+
"fTooltip",
|
|
478
|
+
"tooltipPosition",
|
|
479
|
+
"positionStyle",
|
|
480
|
+
"tooltipStyleClass",
|
|
481
|
+
"disabled",
|
|
482
|
+
"tooltipEvent",
|
|
483
|
+
"showDelay",
|
|
484
|
+
"hideDelay",
|
|
485
|
+
"life",
|
|
486
|
+
"autoHide",
|
|
487
|
+
"positionTop",
|
|
488
|
+
"positionLeft",
|
|
489
|
+
"escape"
|
|
490
|
+
]
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
kind: "component",
|
|
494
|
+
type: TreeTableComponent,
|
|
495
|
+
selector: "f-treetable",
|
|
496
|
+
inputs: [
|
|
497
|
+
"value",
|
|
498
|
+
"loading",
|
|
499
|
+
"dataKey",
|
|
500
|
+
"styleClass",
|
|
501
|
+
"tableStyle",
|
|
502
|
+
"scrollable",
|
|
503
|
+
"scrollHeight",
|
|
504
|
+
"resizableColumns",
|
|
505
|
+
"lazy",
|
|
506
|
+
"totalRecords",
|
|
507
|
+
"paginator",
|
|
508
|
+
"first",
|
|
509
|
+
"rows",
|
|
510
|
+
"rowsPerPageOptions",
|
|
511
|
+
"showCurrentPageReport",
|
|
512
|
+
"currentPageReportTemplate",
|
|
513
|
+
"globalFilterFields",
|
|
514
|
+
"filterDelay",
|
|
515
|
+
"selectionMode",
|
|
516
|
+
"sortMode",
|
|
517
|
+
"virtualScroll",
|
|
518
|
+
"virtualScrollItemSize",
|
|
519
|
+
"sortField",
|
|
520
|
+
"sortOrder",
|
|
521
|
+
"multiSortMeta",
|
|
522
|
+
"filters",
|
|
523
|
+
"selection",
|
|
524
|
+
"contextMenuSelection"
|
|
525
|
+
],
|
|
526
|
+
outputs: [
|
|
527
|
+
"sortFieldChange",
|
|
528
|
+
"sortOrderChange",
|
|
529
|
+
"multiSortMetaChange",
|
|
530
|
+
"filtersChange",
|
|
531
|
+
"selectionChange",
|
|
532
|
+
"contextMenuSelectionChange",
|
|
533
|
+
"onLazyLoad",
|
|
534
|
+
"onSort",
|
|
535
|
+
"onFilter",
|
|
536
|
+
"onNodeExpand",
|
|
537
|
+
"onNodeCollapse",
|
|
538
|
+
"onNodeSelect",
|
|
539
|
+
"onNodeUnselect",
|
|
540
|
+
"onRowContextMenu"
|
|
541
|
+
]
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
kind: "component",
|
|
545
|
+
type: TreeTableTogglerComponent,
|
|
546
|
+
selector: "f-treetabletoggler",
|
|
547
|
+
inputs: ["rowNode"]
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
kind: "component",
|
|
551
|
+
type: UiIconComponent,
|
|
552
|
+
selector: "ui-icon",
|
|
553
|
+
inputs: [
|
|
554
|
+
"name",
|
|
555
|
+
"size",
|
|
556
|
+
"spin",
|
|
557
|
+
"fill",
|
|
558
|
+
"severity"
|
|
559
|
+
]
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
kind: "directive",
|
|
563
|
+
type: HasPermissionDirective,
|
|
564
|
+
selector: "[hasPermission]",
|
|
565
|
+
inputs: ["hasPermission"]
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
kind: "component",
|
|
569
|
+
type: BranchPermittedUsersDialogComponent,
|
|
570
|
+
selector: "lib-branch-permitted-users-dialog",
|
|
571
|
+
inputs: ["visible", "branch"],
|
|
572
|
+
outputs: ["closed"]
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
kind: "pipe",
|
|
576
|
+
type: TranslatePipe,
|
|
577
|
+
name: "translate"
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
583
|
+
minVersion: "12.0.0",
|
|
584
|
+
version: "22.2.1",
|
|
585
|
+
ngImport: i0,
|
|
586
|
+
type: BranchListComponent,
|
|
587
|
+
decorators: [{
|
|
588
|
+
type: Component,
|
|
589
|
+
args: [{
|
|
590
|
+
selector: "lib-branch-list",
|
|
591
|
+
imports: [
|
|
592
|
+
FormsModule,
|
|
593
|
+
CardComponent,
|
|
594
|
+
FButtonDirective,
|
|
595
|
+
IconFieldComponent,
|
|
596
|
+
InputIconComponent,
|
|
597
|
+
InputTextDirective,
|
|
598
|
+
SelectComponent,
|
|
599
|
+
TagComponent,
|
|
600
|
+
TooltipDirective,
|
|
601
|
+
TreeTableComponent,
|
|
602
|
+
TreeTableTogglerComponent,
|
|
603
|
+
UiIconComponent,
|
|
604
|
+
HasPermissionDirective,
|
|
605
|
+
BranchPermittedUsersDialogComponent,
|
|
606
|
+
TranslatePipe
|
|
607
|
+
],
|
|
608
|
+
template: `
|
|
609
|
+
<f-card>
|
|
610
|
+
<ng-template #header>
|
|
611
|
+
<div
|
|
612
|
+
class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 p-4"
|
|
613
|
+
>
|
|
614
|
+
<div
|
|
615
|
+
class="flex flex-col sm:flex-row items-start sm:items-center gap-3 sm:gap-4 w-full sm:w-auto"
|
|
616
|
+
>
|
|
617
|
+
<h2 class="text-xl font-semibold m-0">
|
|
618
|
+
{{ 'administrative.branch.title' | translate }}
|
|
619
|
+
</h2>
|
|
620
|
+
@if (companies().length > 1) {
|
|
621
|
+
<f-select
|
|
622
|
+
[options]="companies()"
|
|
623
|
+
[ngModel]="selectedCompanyId()"
|
|
624
|
+
(ngModelChange)="
|
|
625
|
+
selectedCompanyId.set($event); loadBranches()
|
|
626
|
+
"
|
|
627
|
+
optionLabel="name"
|
|
628
|
+
optionValue="id"
|
|
629
|
+
[placeholder]="'administrative.company.select' | translate"
|
|
630
|
+
styleClass="w-full sm:w-64"
|
|
631
|
+
/>
|
|
632
|
+
}
|
|
633
|
+
</div>
|
|
634
|
+
<div class="flex items-center gap-3 w-full sm:w-auto">
|
|
635
|
+
<f-iconfield class="w-full sm:w-64">
|
|
636
|
+
<f-inputicon icon="search" />
|
|
637
|
+
<input
|
|
638
|
+
fInputText
|
|
639
|
+
type="text"
|
|
640
|
+
[ngModel]="searchTerm()"
|
|
641
|
+
(ngModelChange)="onSearchChange($event)"
|
|
642
|
+
[placeholder]="'shared.search' | translate"
|
|
643
|
+
/>
|
|
644
|
+
</f-iconfield>
|
|
645
|
+
<button
|
|
646
|
+
fButton
|
|
647
|
+
*hasPermission="BRANCH_PERMISSIONS.CREATE"
|
|
648
|
+
[disabled]="!selectedCompanyId()"
|
|
649
|
+
(click)="onCreate()"
|
|
650
|
+
>
|
|
651
|
+
<ui-icon pButtonIcon name="plus"></ui-icon>
|
|
652
|
+
<span pButtonLabel>{{
|
|
653
|
+
'administrative.branch.add' | translate
|
|
654
|
+
}}</span>
|
|
655
|
+
</button>
|
|
656
|
+
</div>
|
|
657
|
+
</div>
|
|
658
|
+
</ng-template>
|
|
659
|
+
|
|
660
|
+
<div class="overflow-x-auto">
|
|
661
|
+
<f-treetable
|
|
662
|
+
[value]="treeNodes()"
|
|
663
|
+
[loading]="isLoading()"
|
|
664
|
+
dataKey="id"
|
|
665
|
+
[tableStyle]="{ 'min-width': '50rem' }"
|
|
666
|
+
>
|
|
667
|
+
<ng-template #header>
|
|
668
|
+
<tr>
|
|
669
|
+
<th>{{ 'administrative.branch.name' | translate }}</th>
|
|
670
|
+
<th>{{ 'administrative.branch.slug' | translate }}</th>
|
|
671
|
+
<th>{{ 'administrative.email.label' | translate }}</th>
|
|
672
|
+
<th>{{ 'administrative.phone.label' | translate }}</th>
|
|
673
|
+
<th>{{ 'shared.status' | translate }}</th>
|
|
674
|
+
<th class="w-[160px]">{{ 'shared.actions' | translate }}</th>
|
|
675
|
+
</tr>
|
|
676
|
+
</ng-template>
|
|
677
|
+
<ng-template #body let-rowNode let-branch="rowData">
|
|
678
|
+
<tr>
|
|
679
|
+
<td>
|
|
680
|
+
<f-treetabletoggler [rowNode]="rowNode" />
|
|
681
|
+
{{ branch.name }}
|
|
682
|
+
</td>
|
|
683
|
+
<td>{{ branch.slug }}</td>
|
|
684
|
+
<td>{{ branch.email || '-' }}</td>
|
|
685
|
+
<td>{{ branch.phone || '-' }}</td>
|
|
686
|
+
<td>
|
|
687
|
+
<f-tag
|
|
688
|
+
[value]="
|
|
689
|
+
branch.isActive
|
|
690
|
+
? ('shared.active' | translate)
|
|
691
|
+
: ('shared.inactive' | translate)
|
|
692
|
+
"
|
|
693
|
+
[severity]="branch.isActive ? 'success' : 'danger'"
|
|
694
|
+
/>
|
|
695
|
+
</td>
|
|
696
|
+
<td>
|
|
697
|
+
<div class="flex gap-2">
|
|
698
|
+
<button
|
|
699
|
+
fButton
|
|
700
|
+
*hasPermission="BRANCH_PERMISSIONS.CREATE"
|
|
701
|
+
[rounded]="true"
|
|
702
|
+
[text]="true"
|
|
703
|
+
severity="success"
|
|
704
|
+
[fTooltip]="'administrative.branch.add.child' | translate"
|
|
705
|
+
(click)="onAddChild(branch)"
|
|
706
|
+
>
|
|
707
|
+
<ui-icon pButtonIcon name="git-branch-plus"></ui-icon>
|
|
708
|
+
</button>
|
|
709
|
+
<button
|
|
710
|
+
fButton
|
|
711
|
+
*hasPermission="BRANCH_PERMISSIONS.UPDATE"
|
|
712
|
+
[rounded]="true"
|
|
713
|
+
[text]="true"
|
|
714
|
+
severity="info"
|
|
715
|
+
[fTooltip]="'shared.edit' | translate"
|
|
716
|
+
(click)="onEdit(branch)"
|
|
717
|
+
>
|
|
718
|
+
<ui-icon pButtonIcon name="pencil"></ui-icon>
|
|
719
|
+
</button>
|
|
720
|
+
<button
|
|
721
|
+
fButton
|
|
722
|
+
*hasPermission="USER_PERMISSIONS.READ"
|
|
723
|
+
[rounded]="true"
|
|
724
|
+
[text]="true"
|
|
725
|
+
severity="secondary"
|
|
726
|
+
[fTooltip]="'administrative.permission.view.users' | translate"
|
|
727
|
+
(click)="onViewUsers(branch)"
|
|
728
|
+
>
|
|
729
|
+
<ui-icon pButtonIcon name="users"></ui-icon>
|
|
730
|
+
</button>
|
|
731
|
+
@if (!branch.readOnly) {
|
|
732
|
+
<button
|
|
733
|
+
fButton
|
|
734
|
+
*hasPermission="BRANCH_PERMISSIONS.DELETE"
|
|
735
|
+
[rounded]="true"
|
|
736
|
+
[text]="true"
|
|
737
|
+
severity="danger"
|
|
738
|
+
[fTooltip]="'shared.delete' | translate"
|
|
739
|
+
(click)="onDelete(branch)"
|
|
740
|
+
>
|
|
741
|
+
<ui-icon pButtonIcon name="trash"></ui-icon>
|
|
742
|
+
</button>
|
|
743
|
+
}
|
|
744
|
+
</div>
|
|
745
|
+
</td>
|
|
746
|
+
</tr>
|
|
747
|
+
</ng-template>
|
|
748
|
+
<ng-template #emptymessage>
|
|
749
|
+
<tr>
|
|
750
|
+
<td colspan="6" class="text-center py-8">
|
|
751
|
+
@if (!selectedCompanyId()) {
|
|
752
|
+
{{ 'administrative.branch.select.company.first' | translate }}
|
|
753
|
+
} @else {
|
|
754
|
+
{{ 'administrative.branch.no.branches' | translate }}
|
|
755
|
+
}
|
|
756
|
+
</td>
|
|
757
|
+
</tr>
|
|
758
|
+
</ng-template>
|
|
759
|
+
</f-treetable>
|
|
760
|
+
</div>
|
|
761
|
+
</f-card>
|
|
762
|
+
|
|
763
|
+
<lib-branch-permitted-users-dialog
|
|
764
|
+
[visible]="permittedUsersDialogVisible()"
|
|
765
|
+
[branch]="selectedBranch()"
|
|
766
|
+
(closed)="permittedUsersDialogVisible.set(false)"
|
|
767
|
+
/>
|
|
768
|
+
`
|
|
769
|
+
}]
|
|
770
|
+
}],
|
|
771
|
+
ctorParameters: () => []
|
|
772
|
+
});
|
|
773
|
+
export { BranchListComponent };
|
|
774
|
+
|
|
775
|
+
//# sourceMappingURL=flusys-ng-auth-branch-list.component-CWat6QWN.mjs.map
|