@elite.framework/ng.core 1.0.28 → 1.0.29
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.
|
@@ -60,6 +60,7 @@ import * as i2$3 from 'primeng/table';
|
|
|
60
60
|
import { TableModule } from 'primeng/table';
|
|
61
61
|
import * as i5$2 from 'primeng/drawer';
|
|
62
62
|
import { DrawerModule, Drawer } from 'primeng/drawer';
|
|
63
|
+
import { SwalService as SwalService$1 } from '@framework/ng.core';
|
|
63
64
|
import * as i2$4 from 'primeng/datepicker';
|
|
64
65
|
import { DatePickerModule } from 'primeng/datepicker';
|
|
65
66
|
import { TabsModule } from 'primeng/tabs';
|
|
@@ -1811,31 +1812,29 @@ class CustomSwitchFieldComponent extends FieldType {
|
|
|
1811
1812
|
this.model[key] = this.formControl.value ? 1 : 2;
|
|
1812
1813
|
}
|
|
1813
1814
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: CustomSwitchFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1814
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: CustomSwitchFieldComponent, isStandalone: true, selector: "formly-field-custom-switch", usesInheritance: true, ngImport: i0, template: `
|
|
1815
|
-
<div class="flex items-center justify-between rtl:flex-row-reverse w-full px-2 py-1"
|
|
1816
|
-
style=" border-radius: var(--p-inputtext-border-radius);">
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: ToggleSwitch, selector: "p-toggleswitch, p-toggleSwitch, p-toggle-switch", inputs: ["styleClass", "tabindex", "inputId", "readonly", "trueValue", "falseValue", "ariaLabel", "size", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$5.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo"] }, { kind: "pipe", type: i1$3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1815
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: CustomSwitchFieldComponent, isStandalone: true, selector: "formly-field-custom-switch", usesInheritance: true, ngImport: i0, template: `
|
|
1816
|
+
<div class="flex items-center justify-between rtl:flex-row-reverse w-full px-2 py-1"
|
|
1817
|
+
style=" border-radius: var(--p-inputtext-border-radius);">
|
|
1818
|
+
|
|
1819
|
+
|
|
1820
|
+
<label [for]="id" class="font-bold text-lg text-gray-800">
|
|
1821
|
+
{{ (to.label ?? '') | translate }}
|
|
1822
|
+
|
|
1823
|
+
<span *ngIf="to.required" class="text-red-500">*</span>
|
|
1824
|
+
</label>
|
|
1825
|
+
|
|
1826
|
+
<!-- التبديل نفسه -->
|
|
1827
|
+
<p-toggleSwitch
|
|
1828
|
+
[formControl]="formControl"
|
|
1829
|
+
[inputId]="id"
|
|
1830
|
+
[pTooltip]="field.props['tooltip']"
|
|
1831
|
+
[styleClass]="''"
|
|
1832
|
+
(onChange)="updateModel($event.checked)"
|
|
1833
|
+
></p-toggleSwitch>
|
|
1834
|
+
|
|
1835
|
+
</div>
|
|
1836
|
+
|
|
1837
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: ToggleSwitch, selector: "p-toggleswitch, p-toggleSwitch, p-toggle-switch", inputs: ["styleClass", "tabindex", "inputId", "readonly", "trueValue", "falseValue", "ariaLabel", "size", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$5.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo"] }, { kind: "pipe", type: i1$3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1839
1838
|
}
|
|
1840
1839
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: CustomSwitchFieldComponent, decorators: [{
|
|
1841
1840
|
type: Component,
|
|
@@ -1850,30 +1849,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
1850
1849
|
TooltipModule,
|
|
1851
1850
|
Tooltip
|
|
1852
1851
|
],
|
|
1853
|
-
template: `
|
|
1854
|
-
<div class="flex items-center justify-between rtl:flex-row-reverse w-full px-2 py-1"
|
|
1855
|
-
style=" border-radius: var(--p-inputtext-border-radius);">
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
</div>
|
|
1876
|
-
|
|
1852
|
+
template: `
|
|
1853
|
+
<div class="flex items-center justify-between rtl:flex-row-reverse w-full px-2 py-1"
|
|
1854
|
+
style=" border-radius: var(--p-inputtext-border-radius);">
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
<label [for]="id" class="font-bold text-lg text-gray-800">
|
|
1858
|
+
{{ (to.label ?? '') | translate }}
|
|
1859
|
+
|
|
1860
|
+
<span *ngIf="to.required" class="text-red-500">*</span>
|
|
1861
|
+
</label>
|
|
1862
|
+
|
|
1863
|
+
<!-- التبديل نفسه -->
|
|
1864
|
+
<p-toggleSwitch
|
|
1865
|
+
[formControl]="formControl"
|
|
1866
|
+
[inputId]="id"
|
|
1867
|
+
[pTooltip]="field.props['tooltip']"
|
|
1868
|
+
[styleClass]="''"
|
|
1869
|
+
(onChange)="updateModel($event.checked)"
|
|
1870
|
+
></p-toggleSwitch>
|
|
1871
|
+
|
|
1872
|
+
</div>
|
|
1873
|
+
|
|
1877
1874
|
`,
|
|
1878
1875
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1879
1876
|
}]
|
|
@@ -3190,6 +3187,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
3190
3187
|
class GenericCrudTableComponent {
|
|
3191
3188
|
genericTable;
|
|
3192
3189
|
translate = inject(TranslateService);
|
|
3190
|
+
swalService = inject(SwalService$1);
|
|
3193
3191
|
home = { icon: 'pi pi-home', routerLink: '/' };
|
|
3194
3192
|
data = [];
|
|
3195
3193
|
formFields_ = []; // <-- هنا
|
|
@@ -3333,32 +3331,68 @@ class GenericCrudTableComponent {
|
|
|
3333
3331
|
}
|
|
3334
3332
|
}
|
|
3335
3333
|
beforeSave = (record) => record;
|
|
3334
|
+
// onSubmit() {
|
|
3335
|
+
// if (this.form.invalid) return;
|
|
3336
|
+
// this.loading = true;
|
|
3337
|
+
// this.errorMessage = null;
|
|
3338
|
+
// const service = this.service /* as CrudService<T> */;
|
|
3339
|
+
// const id = this.isEditMode ? (this.model as any)[this.idField] : null;
|
|
3340
|
+
// const recordToSave = this.beforeSave({ ...this.model });
|
|
3341
|
+
// const operation$: Observable<any> = this.isEditMode
|
|
3342
|
+
// ? service.update(id, recordToSave)
|
|
3343
|
+
// : service.create(recordToSave);
|
|
3344
|
+
// // operation$.pipe(takeUntil(this.destroy$)).subscribe({
|
|
3345
|
+
// operation$.subscribe({
|
|
3346
|
+
// next: () => {
|
|
3347
|
+
// // this.ref.close(true); // نجاح العملية
|
|
3348
|
+
// this.visibleChange.emit(false)
|
|
3349
|
+
// // this.pageChange.emit({ first, rows ,sort, filters });
|
|
3350
|
+
// this.applySearch('');
|
|
3351
|
+
// // this.me
|
|
3352
|
+
// },
|
|
3353
|
+
// error: (err:any) => {
|
|
3354
|
+
// this.loading = false;
|
|
3355
|
+
// this.errorMessage = err.error?.title ||
|
|
3356
|
+
// err.message ||
|
|
3357
|
+
// 'حدث خطأ أثناء الحفظ. يرجى المحاولة مرة أخرى.';
|
|
3358
|
+
// }
|
|
3359
|
+
// });
|
|
3360
|
+
// }
|
|
3336
3361
|
onSubmit() {
|
|
3337
3362
|
if (this.form.invalid)
|
|
3338
3363
|
return;
|
|
3339
|
-
|
|
3340
|
-
this.
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3364
|
+
// ✅ أول شيء نطلب تأكيد من المستخدم
|
|
3365
|
+
this.swalService.confirm(this.isEditMode ? 'تأكيد التعديل' : 'تأكيد الحفظ', this.isEditMode
|
|
3366
|
+
? 'هل تريد حفظ التعديلات على هذا السجل؟'
|
|
3367
|
+
: 'هل تريد حفظ هذا السجل؟', 'نعم', 'إلغاء').then((result) => {
|
|
3368
|
+
if (!result.isConfirmed)
|
|
3369
|
+
return;
|
|
3370
|
+
this.loading = true;
|
|
3371
|
+
this.errorMessage = null;
|
|
3372
|
+
const service = this.service;
|
|
3373
|
+
const id = this.isEditMode ? this.model[this.idField] : null;
|
|
3374
|
+
const recordToSave = this.beforeSave({ ...this.model });
|
|
3375
|
+
const operation$ = this.isEditMode
|
|
3376
|
+
? service.update(id, recordToSave)
|
|
3377
|
+
: service.create(recordToSave);
|
|
3378
|
+
operation$.subscribe({
|
|
3379
|
+
next: () => {
|
|
3380
|
+
this.loading = false;
|
|
3381
|
+
// ✅ رسالة نجاح
|
|
3382
|
+
this.swalService.success(this.isEditMode ? 'تم التعديل بنجاح' : 'تم الحفظ بنجاح');
|
|
3383
|
+
this.visibleChange.emit(false);
|
|
3384
|
+
this.applySearch('');
|
|
3385
|
+
},
|
|
3386
|
+
error: (err) => {
|
|
3387
|
+
this.loading = false;
|
|
3388
|
+
const msg = err.error?.title ||
|
|
3389
|
+
err.message ||
|
|
3390
|
+
'حدث خطأ أثناء الحفظ. يرجى المحاولة مرة أخرى.';
|
|
3391
|
+
this.errorMessage = msg;
|
|
3392
|
+
// ❌ رسالة خطأ
|
|
3393
|
+
this.swalService.error('فشل الحفظ', msg);
|
|
3394
|
+
}
|
|
3395
|
+
});
|
|
3362
3396
|
});
|
|
3363
3397
|
}
|
|
3364
3398
|
trackByIdx(index, item) {
|
|
@@ -4341,32 +4375,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
4341
4375
|
|
|
4342
4376
|
class InputSwitchTypeComponent extends FieldType {
|
|
4343
4377
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: InputSwitchTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4344
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: InputSwitchTypeComponent, isStandalone: true, selector: "formly-field-primeng-input-switch", usesInheritance: true, ngImport: i0, template: `
|
|
4345
|
-
<!-- border border-gray-300 -->
|
|
4346
|
-
<div class="flex items-center justify-between rtl:flex-row-reverse w-full px-2 py-1"
|
|
4347
|
-
style=" border-radius: var(--p-inputtext-border-radius);">
|
|
4348
|
-
|
|
4349
|
-
<label [for]="id" class="font-bold text-lg text-gray-800">
|
|
4350
|
-
{{ (to.label ?? '') | translate }}
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
[
|
|
4357
|
-
[
|
|
4358
|
-
[
|
|
4359
|
-
[
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
</
|
|
4368
|
-
|
|
4369
|
-
|
|
4378
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: InputSwitchTypeComponent, isStandalone: true, selector: "formly-field-primeng-input-switch", usesInheritance: true, ngImport: i0, template: `
|
|
4379
|
+
<!-- border border-gray-300 -->
|
|
4380
|
+
<div class="flex items-center justify-between rtl:flex-row-reverse w-full px-2 py-1"
|
|
4381
|
+
style=" border-radius: var(--p-inputtext-border-radius);">
|
|
4382
|
+
|
|
4383
|
+
<label [for]="id" class="font-bold text-lg text-gray-800">
|
|
4384
|
+
{{ (to.label ?? '') | translate }}
|
|
4385
|
+
|
|
4386
|
+
<span *ngIf="to.required" class="text-red-500">*</span>
|
|
4387
|
+
</label>
|
|
4388
|
+
|
|
4389
|
+
<p-toggleSwitch
|
|
4390
|
+
[formControl]="formControl"
|
|
4391
|
+
[formlyAttributes]="field"
|
|
4392
|
+
[pTooltip]="field.props['tooltip']"
|
|
4393
|
+
[styleClass]="''"
|
|
4394
|
+
[inputId]="id"
|
|
4395
|
+
|
|
4396
|
+
></p-toggleSwitch>
|
|
4397
|
+
|
|
4398
|
+
|
|
4399
|
+
<!-- <label [for]="id" class="font-bold text-lg text-gray-800 mr-2 whitespace-nowrap">
|
|
4400
|
+
{{ (to.label ?? '') | translate}}
|
|
4401
|
+
</label> -->
|
|
4402
|
+
</div>
|
|
4403
|
+
<!-- [style]="to.['style']" -->
|
|
4404
|
+
<!-- [disabled]="to.disabled ?? false" -->
|
|
4370
4405
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: ToggleSwitch, selector: "p-toggleswitch, p-toggleSwitch, p-toggle-switch", inputs: ["styleClass", "tabindex", "inputId", "readonly", "trueValue", "falseValue", "ariaLabel", "size", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$5.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo"] }, { kind: "pipe", type: i1$3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4371
4406
|
}
|
|
4372
4407
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: InputSwitchTypeComponent, decorators: [{
|
|
@@ -4381,32 +4416,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
4381
4416
|
FormlyAttributes,
|
|
4382
4417
|
TranslateModule,
|
|
4383
4418
|
TooltipModule],
|
|
4384
|
-
template: `
|
|
4385
|
-
<!-- border border-gray-300 -->
|
|
4386
|
-
<div class="flex items-center justify-between rtl:flex-row-reverse w-full px-2 py-1"
|
|
4387
|
-
style=" border-radius: var(--p-inputtext-border-radius);">
|
|
4388
|
-
|
|
4389
|
-
<label [for]="id" class="font-bold text-lg text-gray-800">
|
|
4390
|
-
{{ (to.label ?? '') | translate }}
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
[
|
|
4397
|
-
[
|
|
4398
|
-
[
|
|
4399
|
-
[
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
</
|
|
4408
|
-
|
|
4409
|
-
|
|
4419
|
+
template: `
|
|
4420
|
+
<!-- border border-gray-300 -->
|
|
4421
|
+
<div class="flex items-center justify-between rtl:flex-row-reverse w-full px-2 py-1"
|
|
4422
|
+
style=" border-radius: var(--p-inputtext-border-radius);">
|
|
4423
|
+
|
|
4424
|
+
<label [for]="id" class="font-bold text-lg text-gray-800">
|
|
4425
|
+
{{ (to.label ?? '') | translate }}
|
|
4426
|
+
|
|
4427
|
+
<span *ngIf="to.required" class="text-red-500">*</span>
|
|
4428
|
+
</label>
|
|
4429
|
+
|
|
4430
|
+
<p-toggleSwitch
|
|
4431
|
+
[formControl]="formControl"
|
|
4432
|
+
[formlyAttributes]="field"
|
|
4433
|
+
[pTooltip]="field.props['tooltip']"
|
|
4434
|
+
[styleClass]="''"
|
|
4435
|
+
[inputId]="id"
|
|
4436
|
+
|
|
4437
|
+
></p-toggleSwitch>
|
|
4438
|
+
|
|
4439
|
+
|
|
4440
|
+
<!-- <label [for]="id" class="font-bold text-lg text-gray-800 mr-2 whitespace-nowrap">
|
|
4441
|
+
{{ (to.label ?? '') | translate}}
|
|
4442
|
+
</label> -->
|
|
4443
|
+
</div>
|
|
4444
|
+
<!-- [style]="to.['style']" -->
|
|
4445
|
+
<!-- [disabled]="to.disabled ?? false" -->
|
|
4410
4446
|
`,
|
|
4411
4447
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4412
4448
|
}]
|
|
@@ -5475,7 +5511,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
5475
5511
|
args: [{
|
|
5476
5512
|
selector: 'formly-clickable-label-type',
|
|
5477
5513
|
standalone: true,
|
|
5478
|
-
// imports:[NgIf],
|
|
5479
5514
|
template: `
|
|
5480
5515
|
|
|
5481
5516
|
<a class="cursor-pointer hover:underline hover:text-blue-600 font-bold"
|
|
@@ -5517,7 +5552,7 @@ const provideFormly = provideFormlyCore([
|
|
|
5517
5552
|
{ name: 'generic-selector', component: GenericSelectorTypeComponent, wrappers: ['form-field'] },
|
|
5518
5553
|
{ name: 'switch', component: InputSwitchTypeComponent, wrappers: ['form-field-no'] },
|
|
5519
5554
|
{ name: 'username-with-domain', component: UsernameWithDomainComponent, wrappers: ['form-field'] },
|
|
5520
|
-
{ name: 'custom-switch', component: CustomSwitchFieldComponent, wrappers: ['form-field'] },
|
|
5555
|
+
{ name: 'custom-switch', component: CustomSwitchFieldComponent, wrappers: ['form-field-no'] },
|
|
5521
5556
|
{ name: 'Formly-Split', component: FormlySplitButtonComponent, wrappers: ['form-field'] },
|
|
5522
5557
|
{ name: 'Button-Selection', component: FormlySelectionButtonComponent, wrappers: ['form-field'] },
|
|
5523
5558
|
{ name: 'avatar-label-button', component: FormlyAvatarLabelComponent, },
|
|
@@ -5941,6 +5976,7 @@ class BaseCrud {
|
|
|
5941
5976
|
currentFilters = {};
|
|
5942
5977
|
mode = '';
|
|
5943
5978
|
scrollHeight = '400px';
|
|
5979
|
+
swalService = inject(SwalService$1);
|
|
5944
5980
|
dialogRef;
|
|
5945
5981
|
dialogVisible = false;
|
|
5946
5982
|
drawerVisible = false;
|
|
@@ -5986,15 +6022,6 @@ class BaseCrud {
|
|
|
5986
6022
|
}
|
|
5987
6023
|
this.loadPage(0, 10);
|
|
5988
6024
|
}
|
|
5989
|
-
// toQueryParams(obj: any): Record<string, string> {
|
|
5990
|
-
// const params: Record<string, string> = {};
|
|
5991
|
-
// for (const [key, value] of Object.entries(obj)) {
|
|
5992
|
-
// if (value !== null && value !== undefined) {
|
|
5993
|
-
// params[key] = String(value);
|
|
5994
|
-
// }
|
|
5995
|
-
// }
|
|
5996
|
-
// return params;
|
|
5997
|
-
// }
|
|
5998
6025
|
visibleChange(value) {
|
|
5999
6026
|
if (this.mode == 'view') {
|
|
6000
6027
|
this.dialogVisible = value;
|
|
@@ -6117,15 +6144,26 @@ class BaseCrud {
|
|
|
6117
6144
|
this.loadPage(0, this.rows);
|
|
6118
6145
|
});
|
|
6119
6146
|
}
|
|
6147
|
+
// onDelete(item: any): void {
|
|
6148
|
+
// if (!confirm('هل تريد الحذف فعلاً؟')) return;
|
|
6149
|
+
// const id = (item as any)[this.idField];
|
|
6150
|
+
// this.service.delete(id).subscribe(() => {
|
|
6151
|
+
// this.loadPage(0, this.rows);
|
|
6152
|
+
// });
|
|
6153
|
+
// }
|
|
6120
6154
|
onDelete(item) {
|
|
6121
|
-
if (!confirm('هل تريد الحذف فعلاً؟'))
|
|
6122
|
-
return;
|
|
6123
6155
|
const id = item[this.idField];
|
|
6124
|
-
this.
|
|
6125
|
-
|
|
6156
|
+
this.swalService.confirm('تأكيد الحذف', 'هل تريد حذف هذا السجل فعلاً؟', 'نعم، احذف', 'إلغاء').then((result) => {
|
|
6157
|
+
if (result.isConfirmed) {
|
|
6158
|
+
this.service.delete(id).subscribe(() => {
|
|
6159
|
+
this.loadPage(0, this.rows);
|
|
6160
|
+
this.swalService.success('تم الحذف بنجاح');
|
|
6161
|
+
}, () => {
|
|
6162
|
+
this.swalService.error('فشل الحذف', 'حدث خطأ أثناء الحذف');
|
|
6163
|
+
});
|
|
6164
|
+
}
|
|
6126
6165
|
});
|
|
6127
6166
|
}
|
|
6128
|
-
// ✅ Generate table columns from formFields
|
|
6129
6167
|
get columns() {
|
|
6130
6168
|
const flattenFields = (fields) => {
|
|
6131
6169
|
return fields.flatMap(field => {
|