cloud-ide-core 2.0.4 → 2.0.5

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.
@@ -0,0 +1,353 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, DestroyRef, signal, Component } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import * as i1 from '@angular/forms';
5
+ import { FormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
6
+ import { Router, ActivatedRoute } from '@angular/router';
7
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
+ import { NotificationService, ConfirmationService, CideEleButtonComponent, CideIconComponent, CideInputComponent, CideSelectComponent, CideTextareaComponent } from 'cloud-ide-element';
9
+ import { generateObjectFromString } from 'cloud-ide-lms-model';
10
+ import { AppStateHelperService } from 'cloud-ide-layout';
11
+ import { C as CideCoreUserRoleService } from './cloud-ide-core-user-role.service-DNI0f0PM.mjs';
12
+
13
+ class CideCoreUserRoleFormComponent {
14
+ // Dependency injection
15
+ destroyRef = inject(DestroyRef);
16
+ userRoleService = inject(CideCoreUserRoleService);
17
+ router = inject(Router);
18
+ route = inject(ActivatedRoute);
19
+ appState = inject(AppStateHelperService);
20
+ notificationService = inject(NotificationService);
21
+ confirmationService = inject(ConfirmationService);
22
+ fb = inject(FormBuilder);
23
+ // State management
24
+ userRoleForm;
25
+ loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
26
+ error = signal(null, ...(ngDevMode ? [{ debugName: "error" }] : []));
27
+ isEditMode = signal(false, ...(ngDevMode ? [{ debugName: "isEditMode" }] : []));
28
+ isViewMode = signal(false, ...(ngDevMode ? [{ debugName: "isViewMode" }] : []));
29
+ userRoleId = signal(null, ...(ngDevMode ? [{ debugName: "userRoleId" }] : []));
30
+ // Data signals
31
+ entities = signal([], ...(ngDevMode ? [{ debugName: "entities" }] : []));
32
+ menus = signal([], ...(ngDevMode ? [{ debugName: "menus" }] : []));
33
+ permissions = signal([], ...(ngDevMode ? [{ debugName: "permissions" }] : []));
34
+ originalRights = signal([], ...(ngDevMode ? [{ debugName: "originalRights" }] : []));
35
+ // Form mode
36
+ get formTitle() {
37
+ if (this.isViewMode())
38
+ return 'View User Role';
39
+ if (this.isEditMode())
40
+ return 'Edit User Role';
41
+ return 'Create User Role';
42
+ }
43
+ get submitButtonText() {
44
+ if (this.isViewMode())
45
+ return 'Close';
46
+ if (this.isEditMode())
47
+ return 'Update User Role';
48
+ return 'Create User Role';
49
+ }
50
+ ngOnInit() {
51
+ console.log('👥 User Role Form Component initialized');
52
+ this.initializeForm();
53
+ this.loadMasterData();
54
+ this.checkRouteParams();
55
+ }
56
+ ngOnDestroy() {
57
+ console.log('👥 User Role Form Component destroyed');
58
+ }
59
+ /**
60
+ * Initialize the form
61
+ */
62
+ initializeForm() {
63
+ this.userRoleForm = this.fb.group({
64
+ syusrol_role_name: ['', [Validators.required, Validators.minLength(2)]],
65
+ syusrol_role_description: ['', [Validators.required, Validators.minLength(5)]],
66
+ syusrol_role_entity_id_syen: ['', [Validators.required]],
67
+ syusrol_isactive: [true],
68
+ roleRights: this.fb.array([])
69
+ });
70
+ }
71
+ /**
72
+ * Check route parameters to determine mode
73
+ */
74
+ checkRouteParams() {
75
+ const url = this.router.url;
76
+ const queryParams = this.route.snapshot.queryParams;
77
+ if (url.includes('/view/')) {
78
+ this.isViewMode.set(true);
79
+ this.loadUserRoleForView(queryParams);
80
+ }
81
+ else if (url.includes('/edit/')) {
82
+ this.isEditMode.set(true);
83
+ this.loadUserRoleForEdit(queryParams);
84
+ }
85
+ else {
86
+ // Create mode
87
+ this.isEditMode.set(false);
88
+ this.isViewMode.set(false);
89
+ }
90
+ }
91
+ /**
92
+ * Load master data (entities, menus, permissions)
93
+ */
94
+ loadMasterData() {
95
+ // TODO: Implement loading of entities, menus, and permissions
96
+ // For now, using mock data
97
+ this.entities.set([
98
+ { _id: '1', syen_name: 'System Entity', syen_code: 'SYS', syen_description: 'System Entity', syen_isactive: true },
99
+ { _id: '2', syen_name: 'Academic Entity', syen_code: 'ACAD', syen_description: 'Academic Entity', syen_isactive: true }
100
+ ]);
101
+ this.menus.set([
102
+ { _id: '1', syme_menu_name: 'User Management', syme_menu_code: 'USER_MGT', syme_menu_description: 'User Management', syme_menu_url: '/user-management', syme_isactive: true },
103
+ { _id: '2', syme_menu_name: 'Role Management', syme_menu_code: 'ROLE_MGT', syme_menu_description: 'Role Management', syme_menu_url: '/role-management', syme_isactive: true }
104
+ ]);
105
+ this.permissions.set([
106
+ { _id: '1', sygms_name: 'Create', sygms_code: 'CREATE', sygms_description: 'Create Permission', sygms_isactive: true },
107
+ { _id: '2', sygms_name: 'Read', sygms_code: 'READ', sygms_description: 'Read Permission', sygms_isactive: true },
108
+ { _id: '3', sygms_name: 'Update', sygms_code: 'UPDATE', sygms_description: 'Update Permission', sygms_isactive: true },
109
+ { _id: '4', sygms_name: 'Delete', sygms_code: 'DELETE', sygms_description: 'Delete Permission', sygms_isactive: true }
110
+ ]);
111
+ }
112
+ /**
113
+ * Load user role for viewing
114
+ */
115
+ loadUserRoleForView(queryParams) {
116
+ const queryString = queryParams['query'] || '';
117
+ const params = generateObjectFromString(queryString);
118
+ if (params?.syusrol_id) {
119
+ this.userRoleId.set(params.syusrol_id);
120
+ this.loadUserRoleData(params.syusrol_id, true);
121
+ }
122
+ }
123
+ /**
124
+ * Load user role for editing
125
+ */
126
+ loadUserRoleForEdit(queryParams) {
127
+ const queryString = queryParams['query'] || '';
128
+ const params = generateObjectFromString(queryString);
129
+ if (params?.syusrol_id) {
130
+ this.userRoleId.set(params.syusrol_id);
131
+ this.loadUserRoleData(params.syusrol_id, false);
132
+ }
133
+ }
134
+ /**
135
+ * Load user role data
136
+ */
137
+ loadUserRoleData(userRoleId, isViewMode) {
138
+ this.loading.set(true);
139
+ this.error.set(null);
140
+ this.userRoleService.getUserRoleWithRights({ syusrol_id: userRoleId })
141
+ .pipe(takeUntilDestroyed(this.destroyRef))
142
+ .subscribe({
143
+ next: (response) => {
144
+ if (response?.success && response.data) {
145
+ const userRoleData = response.data.core_user_role;
146
+ const rightsData = response.data.core_user_role_rights || [];
147
+ // Populate form with user role data
148
+ this.userRoleForm.patchValue({
149
+ syusrol_role_name: userRoleData.syusrol_role_name,
150
+ syusrol_role_description: userRoleData.syusrol_role_description,
151
+ syusrol_role_entity_id_syen: userRoleData.syusrol_role_entity_id_syen,
152
+ syusrol_isactive: userRoleData.syusrol_isactive
153
+ });
154
+ // Store original rights for comparison
155
+ this.originalRights.set(rightsData);
156
+ // Populate role rights
157
+ this.populateRoleRights(rightsData);
158
+ // Disable form if in view mode
159
+ if (isViewMode) {
160
+ this.userRoleForm.disable();
161
+ }
162
+ this.notificationService.success('User role data loaded successfully.');
163
+ }
164
+ else {
165
+ this.error.set('Failed to load user role data.');
166
+ this.notificationService.error('Failed to load user role data.');
167
+ }
168
+ this.loading.set(false);
169
+ },
170
+ error: (error) => {
171
+ console.error('❌ Error loading user role data:', error);
172
+ this.error.set('Failed to load user role data. Please try again.');
173
+ this.loading.set(false);
174
+ this.notificationService.error('Failed to load user role data. Please try again.');
175
+ }
176
+ });
177
+ }
178
+ /**
179
+ * Populate role rights form array
180
+ */
181
+ populateRoleRights(rights) {
182
+ const rightsArray = this.userRoleForm.get('roleRights');
183
+ rightsArray.clear();
184
+ rights.forEach(right => {
185
+ rightsArray.push(this.createRoleRightFormGroup(right));
186
+ });
187
+ }
188
+ /**
189
+ * Create role right form group
190
+ */
191
+ createRoleRightFormGroup(right) {
192
+ return this.fb.group({
193
+ _id: [right?._id || ''],
194
+ syusrgt_menu_id_syme: [right?.syusrgt_menu_id_syme || '', Validators.required],
195
+ syusrgt_role_permissions_id_sygms: [right?.syusrgt_role_permissions_id_sygms || '', Validators.required],
196
+ syusrgt_isactive: [right?.syusrgt_isactive ?? true]
197
+ });
198
+ }
199
+ /**
200
+ * Get role rights form array
201
+ */
202
+ get roleRightsArray() {
203
+ return this.userRoleForm.get('roleRights');
204
+ }
205
+ /**
206
+ * Add new role right
207
+ */
208
+ addRoleRight() {
209
+ if (this.isViewMode())
210
+ return;
211
+ const rightsArray = this.roleRightsArray;
212
+ rightsArray.push(this.createRoleRightFormGroup());
213
+ }
214
+ /**
215
+ * Remove role right
216
+ */
217
+ removeRoleRight(index) {
218
+ if (this.isViewMode())
219
+ return;
220
+ const rightsArray = this.roleRightsArray;
221
+ rightsArray.removeAt(index);
222
+ }
223
+ /**
224
+ * Get entity name by ID
225
+ */
226
+ getEntityName(entityId) {
227
+ const entity = this.entities().find(e => e._id === entityId);
228
+ return entity?.syen_name || 'N/A';
229
+ }
230
+ /**
231
+ * Get menu name by ID
232
+ */
233
+ getMenuName(menuId) {
234
+ const menu = this.menus().find(m => m._id === menuId);
235
+ return menu?.syme_menu_name || 'N/A';
236
+ }
237
+ /**
238
+ * Get permission name by ID
239
+ */
240
+ getPermissionName(permissionId) {
241
+ const permission = this.permissions().find(p => p._id === permissionId);
242
+ return permission?.sygms_name || 'N/A';
243
+ }
244
+ /**
245
+ * Handle form submission
246
+ */
247
+ onSubmit() {
248
+ if (this.isViewMode()) {
249
+ this.router.navigate(['/control-panel/user-role']);
250
+ return;
251
+ }
252
+ if (this.userRoleForm.invalid) {
253
+ this.notificationService.error('Please fill in all required fields correctly.');
254
+ return;
255
+ }
256
+ const formData = this.userRoleForm.value;
257
+ const payload = {
258
+ core_user_role: {
259
+ _id: this.userRoleId() || undefined,
260
+ syusrol_role_name: formData.syusrol_role_name,
261
+ syusrol_role_description: formData.syusrol_role_description,
262
+ syusrol_role_entity_id_syen: formData.syusrol_role_entity_id_syen,
263
+ syusrol_isactive: formData.syusrol_isactive
264
+ },
265
+ core_user_role_rights: formData.roleRights.map((right) => ({
266
+ _id: right._id || undefined,
267
+ syusrgt_menu_id_syme: right.syusrgt_menu_id_syme,
268
+ syusrgt_role_permissions_id_sygms: right.syusrgt_role_permissions_id_sygms,
269
+ syusrgt_isactive: right.syusrgt_isactive
270
+ })),
271
+ core_user_role_rights_delete: this.getDeletedRightsIds()
272
+ };
273
+ this.saveUserRole(payload);
274
+ }
275
+ /**
276
+ * Get deleted rights IDs
277
+ */
278
+ getDeletedRightsIds() {
279
+ const currentRights = this.roleRightsArray.value;
280
+ const originalRights = this.originalRights();
281
+ return originalRights
282
+ .filter(original => !currentRights.some((current) => current._id === original._id))
283
+ .map(right => right._id)
284
+ .filter(id => id);
285
+ }
286
+ /**
287
+ * Save user role
288
+ */
289
+ saveUserRole(payload) {
290
+ this.loading.set(true);
291
+ const saveOperation = this.isEditMode()
292
+ ? this.userRoleService.saveUpdateUserRoleWithRights(payload)
293
+ : this.userRoleService.saveUpdateUserRoleWithRights(payload);
294
+ saveOperation
295
+ .pipe(takeUntilDestroyed(this.destroyRef))
296
+ .subscribe({
297
+ next: (response) => {
298
+ if (response?.success) {
299
+ const action = this.isEditMode() ? 'updated' : 'created';
300
+ this.notificationService.success(`User role has been ${action} successfully.`);
301
+ this.router.navigate(['/control-panel/user-role']);
302
+ }
303
+ else {
304
+ this.notificationService.error(response?.message || 'Failed to save user role.');
305
+ }
306
+ this.loading.set(false);
307
+ },
308
+ error: (error) => {
309
+ console.error('❌ Error saving user role:', error);
310
+ this.notificationService.error('Failed to save user role. Please try again.');
311
+ this.loading.set(false);
312
+ }
313
+ });
314
+ }
315
+ /**
316
+ * Handle cancel
317
+ */
318
+ onCancel() {
319
+ if (this.userRoleForm.dirty && !this.isViewMode()) {
320
+ this.confirmationService.ask({
321
+ title: 'Discard Changes',
322
+ message: 'You have unsaved changes. Are you sure you want to discard them?',
323
+ confirmText: 'Discard',
324
+ cancelText: 'Keep Editing',
325
+ type: 'warning'
326
+ }).then((confirmed) => {
327
+ if (confirmed) {
328
+ this.router.navigate(['/control-panel/user-role']);
329
+ }
330
+ });
331
+ }
332
+ else {
333
+ this.router.navigate(['/control-panel/user-role']);
334
+ }
335
+ }
336
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideCoreUserRoleFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
337
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.7", type: CideCoreUserRoleFormComponent, isStandalone: true, selector: "cide-core-user-role-form", ngImport: i0, template: "<!-- User Role Form Container -->\n<div class=\"user-role-form-container\">\n <div class=\"tw-max-w-4xl tw-mx-auto\">\n \n <!-- Header -->\n <div class=\"tw-flex tw-items-center tw-justify-between tw-mb-6\">\n <div class=\"tw-flex tw-items-center tw-space-x-3\">\n <button cideEleButton variant=\"ghost\" size=\"sm\" leftIcon=\"arrow_back\" (click)=\"onCancel()\">\n Back\n </button>\n <h1 class=\"tw-text-2xl tw-font-bold tw-text-gray-900 tw-flex tw-items-center tw-gap-2\">\n <cide-ele-icon variant=\"blue\" size=\"lg\">admin_panel_settings</cide-ele-icon>\n {{ formTitle }}\n </h1>\n </div>\n </div>\n\n <!-- Error Message -->\n @if (error()) {\n <div class=\"tw-mb-6 tw-p-4 tw-bg-red-50 tw-border tw-border-red-200 tw-rounded-md\">\n <div class=\"tw-flex tw-items-start\">\n <cide-ele-icon name=\"error\" class=\"tw-text-red-400 tw-w-5 tw-h-5 tw-mt-0.5 tw-flex-shrink-0\"></cide-ele-icon>\n <div class=\"tw-ml-3\">\n <h3 class=\"tw-text-sm tw-font-medium tw-text-red-800 tw-m-0\">Error</h3>\n <p class=\"tw-text-sm tw-text-red-700 tw-mt-1 tw-m-0\">{{ error() }}</p>\n </div>\n </div>\n </div>\n }\n\n <!-- Form -->\n <form [formGroup]=\"userRoleForm\" (ngSubmit)=\"onSubmit()\" class=\"tw-space-y-6\">\n \n <!-- Basic Information Card -->\n <div class=\"tw-bg-white tw-shadow tw-rounded-lg tw-p-6\">\n <h2 class=\"tw-text-lg tw-font-semibold tw-text-gray-900 tw-mb-4\">Basic Information</h2>\n \n <div class=\"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-6\">\n <!-- Role Name -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Role Name <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-input\n formControlName=\"syusrol_role_name\"\n placeholder=\"Enter role name\"\n [disabled]=\"isViewMode()\">\n </cide-ele-input>\n </div>\n\n <!-- Entity -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Entity <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrol_role_entity_id_syen\"\n placeholder=\"Select entity\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Entity</option>\n @for (entity of entities(); track entity._id) {\n <option [value]=\"entity._id\">{{ entity.syen_name }}</option>\n }\n </cide-ele-select>\n </div>\n </div>\n\n <!-- Description -->\n <div class=\"tw-mt-6\">\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Description <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-textarea\n formControlName=\"syusrol_role_description\"\n placeholder=\"Enter role description\"\n rows=\"3\"\n [disabled]=\"isViewMode()\">\n </cide-ele-textarea>\n </div>\n\n <!-- Status Checkbox -->\n <div class=\"tw-mt-6\">\n <div class=\"tw-flex tw-items-center tw-gap-3 tw-p-4 tw-bg-gray-50 tw-rounded-lg tw-border tw-border-gray-200\">\n <cide-ele-input\n formControlName=\"syusrol_isactive\"\n type=\"checkbox\"\n size=\"md\">\n </cide-ele-input>\n <div class=\"tw-flex tw-flex-col\">\n <span class=\"tw-text-sm tw-font-medium tw-text-gray-700\">Active</span>\n <span class=\"tw-text-xs tw-text-gray-500\">Enable/disable this user role</span>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Role Rights Card -->\n <div class=\"tw-bg-white tw-shadow tw-rounded-lg tw-p-6\">\n <div class=\"tw-flex tw-items-center tw-justify-between tw-mb-4\">\n <h2 class=\"tw-text-lg tw-font-semibold tw-text-gray-900\">Role Rights</h2>\n @if (!isViewMode()) {\n <button\n type=\"button\"\n cideEleButton\n variant=\"outline\"\n size=\"sm\"\n leftIcon=\"add\"\n (click)=\"addRoleRight()\">\n Add Right\n </button>\n }\n </div>\n\n <!-- Role Rights List -->\n <div formArrayName=\"roleRights\" class=\"tw-space-y-4\">\n @for (right of roleRightsArray.controls; track $index; let i = $index) {\n <div [formGroupName]=\"i\" class=\"tw-border tw-border-gray-200 tw-rounded-lg tw-p-4\">\n <div class=\"tw-grid tw-grid-cols-1 md:tw-grid-cols-3 tw-gap-4\">\n <!-- Menu -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Menu <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrgt_menu_id_syme\"\n placeholder=\"Select menu\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Menu</option>\n @for (menu of menus(); track menu._id) {\n <option [value]=\"menu._id\">{{ menu.syme_menu_name }}</option>\n }\n </cide-ele-select>\n </div>\n\n <!-- Permission -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Permission <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrgt_role_permissions_id_sygms\"\n placeholder=\"Select permission\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Permission</option>\n @for (permission of permissions(); track permission._id) {\n <option [value]=\"permission._id\">{{ permission.sygms_name }}</option>\n }\n </cide-ele-select>\n </div>\n\n <!-- Actions -->\n <div class=\"tw-flex tw-items-end tw-space-x-2\">\n <div class=\"tw-flex tw-items-center tw-gap-2 tw-p-3 tw-bg-gray-50 tw-rounded-lg tw-border tw-border-gray-200\">\n <cide-ele-input\n formControlName=\"syusrgt_isactive\"\n type=\"checkbox\"\n size=\"sm\">\n </cide-ele-input>\n <div class=\"tw-flex tw-flex-col\">\n <span class=\"tw-text-sm tw-font-medium tw-text-gray-700\">Active</span>\n <span class=\"tw-text-xs tw-text-gray-500\">Enable this right</span>\n </div>\n </div>\n \n @if (!isViewMode()) {\n <button\n type=\"button\"\n cideEleButton\n variant=\"ghost\"\n size=\"sm\"\n leftIcon=\"delete\"\n (click)=\"removeRoleRight(i)\"\n class=\"tw-text-red-600 hover:tw-text-red-700\">\n </button>\n }\n </div>\n </div>\n </div>\n } @empty {\n <div class=\"tw-text-center tw-py-8 tw-text-gray-500\">\n <cide-ele-icon name=\"admin_panel_settings\" class=\"tw-w-12 tw-h-12 tw-mx-auto tw-mb-2 tw-text-gray-300\"></cide-ele-icon>\n <p>No role rights added yet.</p>\n @if (!isViewMode()) {\n <p class=\"tw-text-sm\">Click \"Add Right\" to add permissions for this role.</p>\n }\n </div>\n }\n </div>\n </div>\n\n <!-- Form Actions -->\n <div class=\"tw-flex tw-justify-end tw-space-x-3 tw-pt-6 tw-border-t tw-border-gray-200\">\n <button\n type=\"button\"\n cideEleButton\n variant=\"outline\"\n (click)=\"onCancel()\">\n {{ isViewMode() ? 'Close' : 'Cancel' }}\n </button>\n \n @if (!isViewMode()) {\n <button\n type=\"submit\"\n cideEleButton\n variant=\"primary\"\n [disabled]=\"userRoleForm.invalid || loading()\">\n @if (loading()) {\n <cide-ele-icon name=\"refresh\" class=\"tw-animate-spin tw-mr-2\"></cide-ele-icon>\n Saving...\n } @else {\n {{ submitButtonText }}\n }\n </button>\n }\n </div>\n </form>\n </div>\n</div>\n", styles: [".user-role-form-container{@apply tw-w-full tw-h-full tw-p-6;}:host{@apply tw-w-full tw-h-full tw-flex tw-flex-col;}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: CideEleButtonComponent, selector: "button[cideEleButton], a[cideEleButton]", inputs: ["label", "variant", "size", "type", "shape", "elevation", "disabled", "id", "loading", "fullWidth", "leftIcon", "rightIcon", "customClass", "tooltip", "ariaLabel", "testId", "routerLink", "routerExtras", "preventDoubleClick", "animated"], outputs: ["btnClick", "doubleClick"] }, { kind: "component", type: CideIconComponent, selector: "cide-ele-icon", inputs: ["size", "type", "toolTip"] }, { kind: "component", type: CideInputComponent, selector: "cide-ele-input", inputs: ["fill", "label", "labelHide", "disabled", "clearInput", "labelPlacement", "labelDir", "placeholder", "leadingIcon", "trailingIcon", "helperText", "helperTextCollapse", "hideHelperAndErrorText", "errorText", "maxlength", "minlength", "required", "autocapitalize", "autocomplete", "type", "width", "id", "ngModel", "option", "min", "max", "size"], outputs: ["ngModelChange"] }, { kind: "component", type: CideSelectComponent, selector: "cide-ele-select", inputs: ["label", "labelHide", "placeholder", "helperText", "errorText", "required", "disabled", "id", "ngModel", "size", "fill", "labelPlacement", "labelDir", "leadingIcon", "trailingIcon", "clearInput", "options", "multiple", "searchable", "showSearchInput", "loading", "valueKey", "labelKey"], outputs: ["ngModelChange", "change", "searchChange"] }, { kind: "component", type: CideTextareaComponent, selector: "cide-ele-textarea", inputs: ["label", "labelHide", "placeholder", "helperText", "errorText", "required", "disabled", "minlength", "maxlength", "rows", "id", "ngModel", "size", "fill", "labelPlacement", "labelDir", "leadingIcon", "trailingIcon", "clearInput"], outputs: ["ngModelChange"] }] });
338
+ }
339
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideCoreUserRoleFormComponent, decorators: [{
340
+ type: Component,
341
+ args: [{ selector: 'cide-core-user-role-form', standalone: true, imports: [
342
+ CommonModule,
343
+ ReactiveFormsModule,
344
+ CideEleButtonComponent,
345
+ CideIconComponent,
346
+ CideInputComponent,
347
+ CideSelectComponent,
348
+ CideTextareaComponent
349
+ ], template: "<!-- User Role Form Container -->\n<div class=\"user-role-form-container\">\n <div class=\"tw-max-w-4xl tw-mx-auto\">\n \n <!-- Header -->\n <div class=\"tw-flex tw-items-center tw-justify-between tw-mb-6\">\n <div class=\"tw-flex tw-items-center tw-space-x-3\">\n <button cideEleButton variant=\"ghost\" size=\"sm\" leftIcon=\"arrow_back\" (click)=\"onCancel()\">\n Back\n </button>\n <h1 class=\"tw-text-2xl tw-font-bold tw-text-gray-900 tw-flex tw-items-center tw-gap-2\">\n <cide-ele-icon variant=\"blue\" size=\"lg\">admin_panel_settings</cide-ele-icon>\n {{ formTitle }}\n </h1>\n </div>\n </div>\n\n <!-- Error Message -->\n @if (error()) {\n <div class=\"tw-mb-6 tw-p-4 tw-bg-red-50 tw-border tw-border-red-200 tw-rounded-md\">\n <div class=\"tw-flex tw-items-start\">\n <cide-ele-icon name=\"error\" class=\"tw-text-red-400 tw-w-5 tw-h-5 tw-mt-0.5 tw-flex-shrink-0\"></cide-ele-icon>\n <div class=\"tw-ml-3\">\n <h3 class=\"tw-text-sm tw-font-medium tw-text-red-800 tw-m-0\">Error</h3>\n <p class=\"tw-text-sm tw-text-red-700 tw-mt-1 tw-m-0\">{{ error() }}</p>\n </div>\n </div>\n </div>\n }\n\n <!-- Form -->\n <form [formGroup]=\"userRoleForm\" (ngSubmit)=\"onSubmit()\" class=\"tw-space-y-6\">\n \n <!-- Basic Information Card -->\n <div class=\"tw-bg-white tw-shadow tw-rounded-lg tw-p-6\">\n <h2 class=\"tw-text-lg tw-font-semibold tw-text-gray-900 tw-mb-4\">Basic Information</h2>\n \n <div class=\"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-6\">\n <!-- Role Name -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Role Name <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-input\n formControlName=\"syusrol_role_name\"\n placeholder=\"Enter role name\"\n [disabled]=\"isViewMode()\">\n </cide-ele-input>\n </div>\n\n <!-- Entity -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Entity <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrol_role_entity_id_syen\"\n placeholder=\"Select entity\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Entity</option>\n @for (entity of entities(); track entity._id) {\n <option [value]=\"entity._id\">{{ entity.syen_name }}</option>\n }\n </cide-ele-select>\n </div>\n </div>\n\n <!-- Description -->\n <div class=\"tw-mt-6\">\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Description <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-textarea\n formControlName=\"syusrol_role_description\"\n placeholder=\"Enter role description\"\n rows=\"3\"\n [disabled]=\"isViewMode()\">\n </cide-ele-textarea>\n </div>\n\n <!-- Status Checkbox -->\n <div class=\"tw-mt-6\">\n <div class=\"tw-flex tw-items-center tw-gap-3 tw-p-4 tw-bg-gray-50 tw-rounded-lg tw-border tw-border-gray-200\">\n <cide-ele-input\n formControlName=\"syusrol_isactive\"\n type=\"checkbox\"\n size=\"md\">\n </cide-ele-input>\n <div class=\"tw-flex tw-flex-col\">\n <span class=\"tw-text-sm tw-font-medium tw-text-gray-700\">Active</span>\n <span class=\"tw-text-xs tw-text-gray-500\">Enable/disable this user role</span>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Role Rights Card -->\n <div class=\"tw-bg-white tw-shadow tw-rounded-lg tw-p-6\">\n <div class=\"tw-flex tw-items-center tw-justify-between tw-mb-4\">\n <h2 class=\"tw-text-lg tw-font-semibold tw-text-gray-900\">Role Rights</h2>\n @if (!isViewMode()) {\n <button\n type=\"button\"\n cideEleButton\n variant=\"outline\"\n size=\"sm\"\n leftIcon=\"add\"\n (click)=\"addRoleRight()\">\n Add Right\n </button>\n }\n </div>\n\n <!-- Role Rights List -->\n <div formArrayName=\"roleRights\" class=\"tw-space-y-4\">\n @for (right of roleRightsArray.controls; track $index; let i = $index) {\n <div [formGroupName]=\"i\" class=\"tw-border tw-border-gray-200 tw-rounded-lg tw-p-4\">\n <div class=\"tw-grid tw-grid-cols-1 md:tw-grid-cols-3 tw-gap-4\">\n <!-- Menu -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Menu <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrgt_menu_id_syme\"\n placeholder=\"Select menu\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Menu</option>\n @for (menu of menus(); track menu._id) {\n <option [value]=\"menu._id\">{{ menu.syme_menu_name }}</option>\n }\n </cide-ele-select>\n </div>\n\n <!-- Permission -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Permission <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrgt_role_permissions_id_sygms\"\n placeholder=\"Select permission\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Permission</option>\n @for (permission of permissions(); track permission._id) {\n <option [value]=\"permission._id\">{{ permission.sygms_name }}</option>\n }\n </cide-ele-select>\n </div>\n\n <!-- Actions -->\n <div class=\"tw-flex tw-items-end tw-space-x-2\">\n <div class=\"tw-flex tw-items-center tw-gap-2 tw-p-3 tw-bg-gray-50 tw-rounded-lg tw-border tw-border-gray-200\">\n <cide-ele-input\n formControlName=\"syusrgt_isactive\"\n type=\"checkbox\"\n size=\"sm\">\n </cide-ele-input>\n <div class=\"tw-flex tw-flex-col\">\n <span class=\"tw-text-sm tw-font-medium tw-text-gray-700\">Active</span>\n <span class=\"tw-text-xs tw-text-gray-500\">Enable this right</span>\n </div>\n </div>\n \n @if (!isViewMode()) {\n <button\n type=\"button\"\n cideEleButton\n variant=\"ghost\"\n size=\"sm\"\n leftIcon=\"delete\"\n (click)=\"removeRoleRight(i)\"\n class=\"tw-text-red-600 hover:tw-text-red-700\">\n </button>\n }\n </div>\n </div>\n </div>\n } @empty {\n <div class=\"tw-text-center tw-py-8 tw-text-gray-500\">\n <cide-ele-icon name=\"admin_panel_settings\" class=\"tw-w-12 tw-h-12 tw-mx-auto tw-mb-2 tw-text-gray-300\"></cide-ele-icon>\n <p>No role rights added yet.</p>\n @if (!isViewMode()) {\n <p class=\"tw-text-sm\">Click \"Add Right\" to add permissions for this role.</p>\n }\n </div>\n }\n </div>\n </div>\n\n <!-- Form Actions -->\n <div class=\"tw-flex tw-justify-end tw-space-x-3 tw-pt-6 tw-border-t tw-border-gray-200\">\n <button\n type=\"button\"\n cideEleButton\n variant=\"outline\"\n (click)=\"onCancel()\">\n {{ isViewMode() ? 'Close' : 'Cancel' }}\n </button>\n \n @if (!isViewMode()) {\n <button\n type=\"submit\"\n cideEleButton\n variant=\"primary\"\n [disabled]=\"userRoleForm.invalid || loading()\">\n @if (loading()) {\n <cide-ele-icon name=\"refresh\" class=\"tw-animate-spin tw-mr-2\"></cide-ele-icon>\n Saving...\n } @else {\n {{ submitButtonText }}\n }\n </button>\n }\n </div>\n </form>\n </div>\n</div>\n", styles: [".user-role-form-container{@apply tw-w-full tw-h-full tw-p-6;}:host{@apply tw-w-full tw-h-full tw-flex tw-flex-col;}\n"] }]
350
+ }] });
351
+
352
+ export { CideCoreUserRoleFormComponent };
353
+ //# sourceMappingURL=cloud-ide-core-user-role-form.component-CjoX7xmg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-ide-core-user-role-form.component-CjoX7xmg.mjs","sources":["../../../projects/cloud-ide-core/src/lib/core/user-role-management/components/user-role-form/user-role-form.component.ts","../../../projects/cloud-ide-core/src/lib/core/user-role-management/components/user-role-form/user-role-form.component.html"],"sourcesContent":["import { Component, signal, computed, viewChild, TemplateRef, DestroyRef, inject, OnInit, OnDestroy } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormBuilder, FormGroup, FormArray, Validators, ReactiveFormsModule } from '@angular/forms';\nimport { Router, ActivatedRoute } from '@angular/router';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { CideEleButtonComponent, CideInputComponent, CideSelectComponent, CideTextareaComponent, CideIconComponent, NotificationService, ConfirmationService } from 'cloud-ide-element';\nimport { generateStringFromObject, MUserRoleWithRightsPayload, generateObjectFromString } from 'cloud-ide-lms-model';\nimport { AppStateHelperService } from 'cloud-ide-layout';\nimport { CideCoreUserRoleService } from '../../services/user-role.service';\nimport { Observable, forkJoin, of } from 'rxjs';\nimport { map, catchError, switchMap } from 'rxjs/operators';\nimport type { UserRole, UserRoleRight, Entity, Menu, Permission } from '../../interfaces/user-role.interface';\n\n@Component({\n selector: 'cide-core-user-role-form',\n standalone: true,\n imports: [\n CommonModule,\n ReactiveFormsModule,\n CideEleButtonComponent,\n CideIconComponent,\n CideInputComponent,\n CideSelectComponent,\n CideTextareaComponent\n ],\n templateUrl: './user-role-form.component.html',\n styles: [`\n .user-role-form-container {\n @apply tw-w-full tw-h-full tw-p-6;\n }\n \n :host {\n @apply tw-w-full tw-h-full tw-flex tw-flex-col;\n }\n `]\n})\nexport class CideCoreUserRoleFormComponent implements OnInit, OnDestroy {\n // Dependency injection\n private readonly destroyRef = inject(DestroyRef);\n private readonly userRoleService = inject(CideCoreUserRoleService);\n private readonly router = inject(Router);\n private readonly route = inject(ActivatedRoute);\n private readonly appState = inject(AppStateHelperService);\n private readonly notificationService = inject(NotificationService);\n private readonly confirmationService = inject(ConfirmationService);\n private readonly fb = inject(FormBuilder);\n\n // State management\n userRoleForm!: FormGroup;\n loading = signal(false);\n error = signal<string | null>(null);\n isEditMode = signal(false);\n isViewMode = signal(false);\n userRoleId = signal<string | null>(null);\n\n // Data signals\n entities = signal<Entity[]>([]);\n menus = signal<Menu[]>([]);\n permissions = signal<Permission[]>([]);\n originalRights = signal<UserRoleRight[]>([]);\n\n // Form mode\n get formTitle(): string {\n if (this.isViewMode()) return 'View User Role';\n if (this.isEditMode()) return 'Edit User Role';\n return 'Create User Role';\n }\n\n get submitButtonText(): string {\n if (this.isViewMode()) return 'Close';\n if (this.isEditMode()) return 'Update User Role';\n return 'Create User Role';\n }\n\n ngOnInit(): void {\n console.log('👥 User Role Form Component initialized');\n this.initializeForm();\n this.loadMasterData();\n this.checkRouteParams();\n }\n\n ngOnDestroy(): void {\n console.log('👥 User Role Form Component destroyed');\n }\n\n /**\n * Initialize the form\n */\n private initializeForm(): void {\n this.userRoleForm = this.fb.group({\n syusrol_role_name: ['', [Validators.required, Validators.minLength(2)]],\n syusrol_role_description: ['', [Validators.required, Validators.minLength(5)]],\n syusrol_role_entity_id_syen: ['', [Validators.required]],\n syusrol_isactive: [true],\n roleRights: this.fb.array([])\n });\n }\n\n /**\n * Check route parameters to determine mode\n */\n private checkRouteParams(): void {\n const url = this.router.url;\n const queryParams = this.route.snapshot.queryParams;\n \n if (url.includes('/view/')) {\n this.isViewMode.set(true);\n this.loadUserRoleForView(queryParams);\n } else if (url.includes('/edit/')) {\n this.isEditMode.set(true);\n this.loadUserRoleForEdit(queryParams);\n } else {\n // Create mode\n this.isEditMode.set(false);\n this.isViewMode.set(false);\n }\n }\n\n /**\n * Load master data (entities, menus, permissions)\n */\n private loadMasterData(): void {\n // TODO: Implement loading of entities, menus, and permissions\n // For now, using mock data\n this.entities.set([\n { _id: '1', syen_name: 'System Entity', syen_code: 'SYS', syen_description: 'System Entity', syen_isactive: true },\n { _id: '2', syen_name: 'Academic Entity', syen_code: 'ACAD', syen_description: 'Academic Entity', syen_isactive: true }\n ]);\n\n this.menus.set([\n { _id: '1', syme_menu_name: 'User Management', syme_menu_code: 'USER_MGT', syme_menu_description: 'User Management', syme_menu_url: '/user-management', syme_isactive: true },\n { _id: '2', syme_menu_name: 'Role Management', syme_menu_code: 'ROLE_MGT', syme_menu_description: 'Role Management', syme_menu_url: '/role-management', syme_isactive: true }\n ]);\n\n this.permissions.set([\n { _id: '1', sygms_name: 'Create', sygms_code: 'CREATE', sygms_description: 'Create Permission', sygms_isactive: true },\n { _id: '2', sygms_name: 'Read', sygms_code: 'READ', sygms_description: 'Read Permission', sygms_isactive: true },\n { _id: '3', sygms_name: 'Update', sygms_code: 'UPDATE', sygms_description: 'Update Permission', sygms_isactive: true },\n { _id: '4', sygms_name: 'Delete', sygms_code: 'DELETE', sygms_description: 'Delete Permission', sygms_isactive: true }\n ]);\n }\n\n /**\n * Load user role for viewing\n */\n private loadUserRoleForView(queryParams: any): void {\n const queryString = queryParams['query'] || '';\n const params = generateObjectFromString(queryString);\n \n if (params?.syusrol_id) {\n this.userRoleId.set(params.syusrol_id);\n this.loadUserRoleData(params.syusrol_id, true);\n }\n }\n\n /**\n * Load user role for editing\n */\n private loadUserRoleForEdit(queryParams: any): void {\n const queryString = queryParams['query'] || '';\n const params = generateObjectFromString(queryString);\n \n if (params?.syusrol_id) {\n this.userRoleId.set(params.syusrol_id);\n this.loadUserRoleData(params.syusrol_id, false);\n }\n }\n\n /**\n * Load user role data\n */\n private loadUserRoleData(userRoleId: string, isViewMode: boolean): void {\n this.loading.set(true);\n this.error.set(null);\n\n this.userRoleService.getUserRoleWithRights({ syusrol_id: userRoleId })\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (response) => {\n if (response?.success && response.data) {\n const userRoleData = response.data.core_user_role;\n const rightsData = response.data.core_user_role_rights || [];\n \n // Populate form with user role data\n this.userRoleForm.patchValue({\n syusrol_role_name: userRoleData.syusrol_role_name,\n syusrol_role_description: userRoleData.syusrol_role_description,\n syusrol_role_entity_id_syen: userRoleData.syusrol_role_entity_id_syen,\n syusrol_isactive: userRoleData.syusrol_isactive\n });\n\n // Store original rights for comparison\n this.originalRights.set(rightsData);\n\n // Populate role rights\n this.populateRoleRights(rightsData);\n\n // Disable form if in view mode\n if (isViewMode) {\n this.userRoleForm.disable();\n }\n\n this.notificationService.success('User role data loaded successfully.');\n } else {\n this.error.set('Failed to load user role data.');\n this.notificationService.error('Failed to load user role data.');\n }\n this.loading.set(false);\n },\n error: (error) => {\n console.error('❌ Error loading user role data:', error);\n this.error.set('Failed to load user role data. Please try again.');\n this.loading.set(false);\n this.notificationService.error('Failed to load user role data. Please try again.');\n }\n });\n }\n\n /**\n * Populate role rights form array\n */\n private populateRoleRights(rights: UserRoleRight[]): void {\n const rightsArray = this.userRoleForm.get('roleRights') as FormArray;\n rightsArray.clear();\n\n rights.forEach(right => {\n rightsArray.push(this.createRoleRightFormGroup(right));\n });\n }\n\n /**\n * Create role right form group\n */\n private createRoleRightFormGroup(right?: UserRoleRight): FormGroup {\n return this.fb.group({\n _id: [right?._id || ''],\n syusrgt_menu_id_syme: [right?.syusrgt_menu_id_syme || '', Validators.required],\n syusrgt_role_permissions_id_sygms: [right?.syusrgt_role_permissions_id_sygms || '', Validators.required],\n syusrgt_isactive: [right?.syusrgt_isactive ?? true]\n });\n }\n\n /**\n * Get role rights form array\n */\n get roleRightsArray(): FormArray {\n return this.userRoleForm.get('roleRights') as FormArray;\n }\n\n /**\n * Add new role right\n */\n addRoleRight(): void {\n if (this.isViewMode()) return;\n \n const rightsArray = this.roleRightsArray;\n rightsArray.push(this.createRoleRightFormGroup());\n }\n\n /**\n * Remove role right\n */\n removeRoleRight(index: number): void {\n if (this.isViewMode()) return;\n \n const rightsArray = this.roleRightsArray;\n rightsArray.removeAt(index);\n }\n\n /**\n * Get entity name by ID\n */\n getEntityName(entityId: string): string {\n const entity = this.entities().find(e => e._id === entityId);\n return entity?.syen_name || 'N/A';\n }\n\n /**\n * Get menu name by ID\n */\n getMenuName(menuId: string): string {\n const menu = this.menus().find(m => m._id === menuId);\n return menu?.syme_menu_name || 'N/A';\n }\n\n /**\n * Get permission name by ID\n */\n getPermissionName(permissionId: string): string {\n const permission = this.permissions().find(p => p._id === permissionId);\n return permission?.sygms_name || 'N/A';\n }\n\n /**\n * Handle form submission\n */\n onSubmit(): void {\n if (this.isViewMode()) {\n this.router.navigate(['/control-panel/user-role']);\n return;\n }\n\n if (this.userRoleForm.invalid) {\n this.notificationService.error('Please fill in all required fields correctly.');\n return;\n }\n\n const formData = this.userRoleForm.value;\n const payload: MUserRoleWithRightsPayload = {\n core_user_role: {\n _id: this.userRoleId() || undefined,\n syusrol_role_name: formData.syusrol_role_name,\n syusrol_role_description: formData.syusrol_role_description,\n syusrol_role_entity_id_syen: formData.syusrol_role_entity_id_syen,\n syusrol_isactive: formData.syusrol_isactive\n },\n core_user_role_rights: formData.roleRights.map((right: any) => ({\n _id: right._id || undefined,\n syusrgt_menu_id_syme: right.syusrgt_menu_id_syme,\n syusrgt_role_permissions_id_sygms: right.syusrgt_role_permissions_id_sygms,\n syusrgt_isactive: right.syusrgt_isactive\n })),\n core_user_role_rights_delete: this.getDeletedRightsIds()\n };\n\n this.saveUserRole(payload);\n }\n\n /**\n * Get deleted rights IDs\n */\n private getDeletedRightsIds(): string[] {\n const currentRights = this.roleRightsArray.value;\n const originalRights = this.originalRights();\n \n return originalRights\n .filter(original => !currentRights.some((current: any) => current._id === original._id))\n .map(right => right._id!)\n .filter(id => id);\n }\n\n /**\n * Save user role\n */\n private saveUserRole(payload: MUserRoleWithRightsPayload): void {\n this.loading.set(true);\n\n const saveOperation = this.isEditMode() \n ? this.userRoleService.saveUpdateUserRoleWithRights(payload)\n : this.userRoleService.saveUpdateUserRoleWithRights(payload);\n\n saveOperation\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (response) => {\n if (response?.success) {\n const action = this.isEditMode() ? 'updated' : 'created';\n this.notificationService.success(`User role has been ${action} successfully.`);\n this.router.navigate(['/control-panel/user-role']);\n } else {\n this.notificationService.error(response?.message || 'Failed to save user role.');\n }\n this.loading.set(false);\n },\n error: (error) => {\n console.error('❌ Error saving user role:', error);\n this.notificationService.error('Failed to save user role. Please try again.');\n this.loading.set(false);\n }\n });\n }\n\n /**\n * Handle cancel\n */\n onCancel(): void {\n if (this.userRoleForm.dirty && !this.isViewMode()) {\n this.confirmationService.ask({\n title: 'Discard Changes',\n message: 'You have unsaved changes. Are you sure you want to discard them?',\n confirmText: 'Discard',\n cancelText: 'Keep Editing',\n type: 'warning'\n }).then((confirmed: boolean) => {\n if (confirmed) {\n this.router.navigate(['/control-panel/user-role']);\n }\n });\n } else {\n this.router.navigate(['/control-panel/user-role']);\n }\n }\n}\n","<!-- User Role Form Container -->\n<div class=\"user-role-form-container\">\n <div class=\"tw-max-w-4xl tw-mx-auto\">\n \n <!-- Header -->\n <div class=\"tw-flex tw-items-center tw-justify-between tw-mb-6\">\n <div class=\"tw-flex tw-items-center tw-space-x-3\">\n <button cideEleButton variant=\"ghost\" size=\"sm\" leftIcon=\"arrow_back\" (click)=\"onCancel()\">\n Back\n </button>\n <h1 class=\"tw-text-2xl tw-font-bold tw-text-gray-900 tw-flex tw-items-center tw-gap-2\">\n <cide-ele-icon variant=\"blue\" size=\"lg\">admin_panel_settings</cide-ele-icon>\n {{ formTitle }}\n </h1>\n </div>\n </div>\n\n <!-- Error Message -->\n @if (error()) {\n <div class=\"tw-mb-6 tw-p-4 tw-bg-red-50 tw-border tw-border-red-200 tw-rounded-md\">\n <div class=\"tw-flex tw-items-start\">\n <cide-ele-icon name=\"error\" class=\"tw-text-red-400 tw-w-5 tw-h-5 tw-mt-0.5 tw-flex-shrink-0\"></cide-ele-icon>\n <div class=\"tw-ml-3\">\n <h3 class=\"tw-text-sm tw-font-medium tw-text-red-800 tw-m-0\">Error</h3>\n <p class=\"tw-text-sm tw-text-red-700 tw-mt-1 tw-m-0\">{{ error() }}</p>\n </div>\n </div>\n </div>\n }\n\n <!-- Form -->\n <form [formGroup]=\"userRoleForm\" (ngSubmit)=\"onSubmit()\" class=\"tw-space-y-6\">\n \n <!-- Basic Information Card -->\n <div class=\"tw-bg-white tw-shadow tw-rounded-lg tw-p-6\">\n <h2 class=\"tw-text-lg tw-font-semibold tw-text-gray-900 tw-mb-4\">Basic Information</h2>\n \n <div class=\"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-6\">\n <!-- Role Name -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Role Name <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-input\n formControlName=\"syusrol_role_name\"\n placeholder=\"Enter role name\"\n [disabled]=\"isViewMode()\">\n </cide-ele-input>\n </div>\n\n <!-- Entity -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Entity <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrol_role_entity_id_syen\"\n placeholder=\"Select entity\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Entity</option>\n @for (entity of entities(); track entity._id) {\n <option [value]=\"entity._id\">{{ entity.syen_name }}</option>\n }\n </cide-ele-select>\n </div>\n </div>\n\n <!-- Description -->\n <div class=\"tw-mt-6\">\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Description <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-textarea\n formControlName=\"syusrol_role_description\"\n placeholder=\"Enter role description\"\n rows=\"3\"\n [disabled]=\"isViewMode()\">\n </cide-ele-textarea>\n </div>\n\n <!-- Status Checkbox -->\n <div class=\"tw-mt-6\">\n <div class=\"tw-flex tw-items-center tw-gap-3 tw-p-4 tw-bg-gray-50 tw-rounded-lg tw-border tw-border-gray-200\">\n <cide-ele-input\n formControlName=\"syusrol_isactive\"\n type=\"checkbox\"\n size=\"md\">\n </cide-ele-input>\n <div class=\"tw-flex tw-flex-col\">\n <span class=\"tw-text-sm tw-font-medium tw-text-gray-700\">Active</span>\n <span class=\"tw-text-xs tw-text-gray-500\">Enable/disable this user role</span>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Role Rights Card -->\n <div class=\"tw-bg-white tw-shadow tw-rounded-lg tw-p-6\">\n <div class=\"tw-flex tw-items-center tw-justify-between tw-mb-4\">\n <h2 class=\"tw-text-lg tw-font-semibold tw-text-gray-900\">Role Rights</h2>\n @if (!isViewMode()) {\n <button\n type=\"button\"\n cideEleButton\n variant=\"outline\"\n size=\"sm\"\n leftIcon=\"add\"\n (click)=\"addRoleRight()\">\n Add Right\n </button>\n }\n </div>\n\n <!-- Role Rights List -->\n <div formArrayName=\"roleRights\" class=\"tw-space-y-4\">\n @for (right of roleRightsArray.controls; track $index; let i = $index) {\n <div [formGroupName]=\"i\" class=\"tw-border tw-border-gray-200 tw-rounded-lg tw-p-4\">\n <div class=\"tw-grid tw-grid-cols-1 md:tw-grid-cols-3 tw-gap-4\">\n <!-- Menu -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Menu <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrgt_menu_id_syme\"\n placeholder=\"Select menu\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Menu</option>\n @for (menu of menus(); track menu._id) {\n <option [value]=\"menu._id\">{{ menu.syme_menu_name }}</option>\n }\n </cide-ele-select>\n </div>\n\n <!-- Permission -->\n <div>\n <label class=\"tw-block tw-text-sm tw-font-medium tw-text-gray-700 tw-mb-2\">\n Permission <span class=\"tw-text-red-500\">*</span>\n </label>\n <cide-ele-select\n formControlName=\"syusrgt_role_permissions_id_sygms\"\n placeholder=\"Select permission\"\n [disabled]=\"isViewMode()\">\n <option value=\"\">Select Permission</option>\n @for (permission of permissions(); track permission._id) {\n <option [value]=\"permission._id\">{{ permission.sygms_name }}</option>\n }\n </cide-ele-select>\n </div>\n\n <!-- Actions -->\n <div class=\"tw-flex tw-items-end tw-space-x-2\">\n <div class=\"tw-flex tw-items-center tw-gap-2 tw-p-3 tw-bg-gray-50 tw-rounded-lg tw-border tw-border-gray-200\">\n <cide-ele-input\n formControlName=\"syusrgt_isactive\"\n type=\"checkbox\"\n size=\"sm\">\n </cide-ele-input>\n <div class=\"tw-flex tw-flex-col\">\n <span class=\"tw-text-sm tw-font-medium tw-text-gray-700\">Active</span>\n <span class=\"tw-text-xs tw-text-gray-500\">Enable this right</span>\n </div>\n </div>\n \n @if (!isViewMode()) {\n <button\n type=\"button\"\n cideEleButton\n variant=\"ghost\"\n size=\"sm\"\n leftIcon=\"delete\"\n (click)=\"removeRoleRight(i)\"\n class=\"tw-text-red-600 hover:tw-text-red-700\">\n </button>\n }\n </div>\n </div>\n </div>\n } @empty {\n <div class=\"tw-text-center tw-py-8 tw-text-gray-500\">\n <cide-ele-icon name=\"admin_panel_settings\" class=\"tw-w-12 tw-h-12 tw-mx-auto tw-mb-2 tw-text-gray-300\"></cide-ele-icon>\n <p>No role rights added yet.</p>\n @if (!isViewMode()) {\n <p class=\"tw-text-sm\">Click \"Add Right\" to add permissions for this role.</p>\n }\n </div>\n }\n </div>\n </div>\n\n <!-- Form Actions -->\n <div class=\"tw-flex tw-justify-end tw-space-x-3 tw-pt-6 tw-border-t tw-border-gray-200\">\n <button\n type=\"button\"\n cideEleButton\n variant=\"outline\"\n (click)=\"onCancel()\">\n {{ isViewMode() ? 'Close' : 'Cancel' }}\n </button>\n \n @if (!isViewMode()) {\n <button\n type=\"submit\"\n cideEleButton\n variant=\"primary\"\n [disabled]=\"userRoleForm.invalid || loading()\">\n @if (loading()) {\n <cide-ele-icon name=\"refresh\" class=\"tw-animate-spin tw-mr-2\"></cide-ele-icon>\n Saving...\n } @else {\n {{ submitButtonText }}\n }\n </button>\n }\n </div>\n </form>\n </div>\n</div>\n"],"names":[],"mappings":";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