@elite.framework/ng.core 1.0.63 → 1.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/fesm2022/elite.framework-ng.core-src-lib-components-attachments.mjs +204 -0
  2. package/fesm2022/elite.framework-ng.core-src-lib-components-attachments.mjs.map +1 -0
  3. package/fesm2022/elite.framework-ng.core-src-lib-components-breadcrumb.mjs +132 -0
  4. package/fesm2022/elite.framework-ng.core-src-lib-components-breadcrumb.mjs.map +1 -0
  5. package/fesm2022/elite.framework-ng.core-src-lib-components-color-picker.mjs +76 -0
  6. package/fesm2022/elite.framework-ng.core-src-lib-components-color-picker.mjs.map +1 -0
  7. package/fesm2022/elite.framework-ng.core-src-lib-components-column-settings-popover.mjs +172 -0
  8. package/fesm2022/elite.framework-ng.core-src-lib-components-column-settings-popover.mjs.map +1 -0
  9. package/fesm2022/elite.framework-ng.core-src-lib-components-condition-editor.mjs +794 -0
  10. package/fesm2022/elite.framework-ng.core-src-lib-components-condition-editor.mjs.map +1 -0
  11. package/fesm2022/elite.framework-ng.core-src-lib-components-custom-switch.mjs +110 -0
  12. package/fesm2022/elite.framework-ng.core-src-lib-components-custom-switch.mjs.map +1 -0
  13. package/fesm2022/elite.framework-ng.core-src-lib-components-deactivation-reason.mjs +130 -0
  14. package/fesm2022/elite.framework-ng.core-src-lib-components-deactivation-reason.mjs.map +1 -0
  15. package/fesm2022/elite.framework-ng.core-src-lib-components-form-button.mjs +50 -0
  16. package/fesm2022/elite.framework-ng.core-src-lib-components-form-button.mjs.map +1 -0
  17. package/fesm2022/elite.framework-ng.core-src-lib-components-form-field.mjs +154 -0
  18. package/fesm2022/elite.framework-ng.core-src-lib-components-form-field.mjs.map +1 -0
  19. package/fesm2022/elite.framework-ng.core-src-lib-components-form-template.mjs +24 -0
  20. package/fesm2022/elite.framework-ng.core-src-lib-components-form-template.mjs.map +1 -0
  21. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-avatar-image.mjs +100 -0
  22. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-avatar-image.mjs.map +1 -0
  23. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-avatar-label.mjs +78 -0
  24. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-avatar-label.mjs.map +1 -0
  25. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-button-selector.mjs +167 -0
  26. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-button-selector.mjs.map +1 -0
  27. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-button.mjs +62 -0
  28. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-button.mjs.map +1 -0
  29. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-split-button.mjs +50 -0
  30. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-split-button.mjs.map +1 -0
  31. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-username-with-domain.mjs +76 -0
  32. package/fesm2022/elite.framework-ng.core-src-lib-components-formly-username-with-domain.mjs.map +1 -0
  33. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-autocomplete.mjs +163 -0
  34. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-autocomplete.mjs.map +1 -0
  35. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-button.mjs +133 -0
  36. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-button.mjs.map +1 -0
  37. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-card.mjs +214 -0
  38. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-card.mjs.map +1 -0
  39. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-crud-table.mjs +385 -0
  40. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-crud-table.mjs.map +1 -0
  41. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-errormessage.mjs +23 -0
  42. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-errormessage.mjs.map +1 -0
  43. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-formly-fields.mjs +53 -0
  44. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-formly-fields.mjs.map +1 -0
  45. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-loadingspinner.mjs +23 -0
  46. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-loadingspinner.mjs.map +1 -0
  47. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-search.mjs +85 -0
  48. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-search.mjs.map +1 -0
  49. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-selector.mjs +430 -0
  50. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-selector.mjs.map +1 -0
  51. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-table.mjs +216 -0
  52. package/fesm2022/elite.framework-ng.core-src-lib-components-generic-table.mjs.map +1 -0
  53. package/fesm2022/elite.framework-ng.core-src-lib-components-header-wrapper.mjs +18 -0
  54. package/fesm2022/elite.framework-ng.core-src-lib-components-header-wrapper.mjs.map +1 -0
  55. package/fesm2022/elite.framework-ng.core-src-lib-components-icon-picker.mjs +195 -0
  56. package/fesm2022/elite.framework-ng.core-src-lib-components-icon-picker.mjs.map +1 -0
  57. package/fesm2022/elite.framework-ng.core-src-lib-components-input-switch.mjs +94 -0
  58. package/fesm2022/elite.framework-ng.core-src-lib-components-input-switch.mjs.map +1 -0
  59. package/fesm2022/elite.framework-ng.core-src-lib-components-input-with-icon.mjs +55 -0
  60. package/fesm2022/elite.framework-ng.core-src-lib-components-input-with-icon.mjs.map +1 -0
  61. package/fesm2022/elite.framework-ng.core-src-lib-components-label-type.mjs +112 -0
  62. package/fesm2022/elite.framework-ng.core-src-lib-components-label-type.mjs.map +1 -0
  63. package/fesm2022/elite.framework-ng.core-src-lib-components-odata-query-builder.mjs +297 -0
  64. package/fesm2022/elite.framework-ng.core-src-lib-components-odata-query-builder.mjs.map +1 -0
  65. package/fesm2022/elite.framework-ng.core-src-lib-components-repeat.mjs +135 -0
  66. package/fesm2022/elite.framework-ng.core-src-lib-components-repeat.mjs.map +1 -0
  67. package/fesm2022/elite.framework-ng.core-src-lib-components-sidebar-cards.mjs +40 -0
  68. package/fesm2022/elite.framework-ng.core-src-lib-components-sidebar-cards.mjs.map +1 -0
  69. package/fesm2022/elite.framework-ng.core-src-lib-components-sidebar-toggles.mjs +41 -0
  70. package/fesm2022/elite.framework-ng.core-src-lib-components-sidebar-toggles.mjs.map +1 -0
  71. package/fesm2022/elite.framework-ng.core-src-lib-components-tabs.mjs +45 -0
  72. package/fesm2022/elite.framework-ng.core-src-lib-components-tabs.mjs.map +1 -0
  73. package/fesm2022/elite.framework-ng.core-src-lib-components-tag-type.mjs +192 -0
  74. package/fesm2022/elite.framework-ng.core-src-lib-components-tag-type.mjs.map +1 -0
  75. package/fesm2022/elite.framework-ng.core-src-lib-components-text-editor.mjs +44 -0
  76. package/fesm2022/elite.framework-ng.core-src-lib-components-text-editor.mjs.map +1 -0
  77. package/fesm2022/elite.framework-ng.core-src-lib-components-wrappers.mjs +174 -0
  78. package/fesm2022/elite.framework-ng.core-src-lib-components-wrappers.mjs.map +1 -0
  79. package/fesm2022/elite.framework-ng.core-src-lib-directives.mjs +59 -0
  80. package/fesm2022/elite.framework-ng.core-src-lib-directives.mjs.map +1 -0
  81. package/fesm2022/elite.framework-ng.core-src-lib-pipes.mjs +135 -0
  82. package/fesm2022/elite.framework-ng.core-src-lib-pipes.mjs.map +1 -0
  83. package/fesm2022/elite.framework-ng.core.mjs +1643 -384
  84. package/fesm2022/elite.framework-ng.core.mjs.map +1 -1
  85. package/index.d.ts +493 -24
  86. package/package.json +14 -62
  87. package/src/lib/components/attachments/index.d.ts +31 -0
  88. package/src/lib/components/breadcrumb/index.d.ts +10 -0
  89. package/src/lib/components/color-picker/index.d.ts +9 -0
  90. package/src/lib/components/column-settings-popover/index.d.ts +39 -0
  91. package/src/lib/components/condition-editor/index.d.ts +73 -0
  92. package/src/lib/components/custom-switch/index.d.ts +12 -0
  93. package/src/lib/components/deactivation-reason/index.d.ts +24 -0
  94. package/src/lib/components/form-button/index.d.ts +10 -0
  95. package/src/lib/components/form-field/index.d.ts +30 -0
  96. package/src/lib/components/form-template/index.d.ts +9 -0
  97. package/src/lib/components/formly-avatar-image/index.d.ts +11 -0
  98. package/src/lib/components/formly-avatar-label/index.d.ts +29 -0
  99. package/src/lib/components/formly-button/index.d.ts +13 -0
  100. package/src/lib/components/formly-button-selector/index.d.ts +28 -0
  101. package/src/lib/components/formly-split-button/index.d.ts +16 -0
  102. package/src/lib/components/formly-username-with-domain/index.d.ts +12 -0
  103. package/src/lib/components/generic-autocomplete/index.d.ts +34 -0
  104. package/src/lib/components/generic-button/index.d.ts +35 -0
  105. package/src/lib/components/generic-card/index.d.ts +90 -0
  106. package/src/lib/components/generic-crud-table/index.d.ts +120 -0
  107. package/src/lib/components/generic-errormessage/index.d.ts +10 -0
  108. package/src/lib/components/generic-formly-fields/index.d.ts +22 -0
  109. package/src/lib/components/generic-loadingspinner/index.d.ts +9 -0
  110. package/src/lib/components/generic-search/index.d.ts +29 -0
  111. package/src/lib/components/generic-selector/index.d.ts +66 -0
  112. package/src/lib/components/generic-table/index.d.ts +60 -0
  113. package/src/lib/components/header-wrapper/index.d.ts +8 -0
  114. package/src/lib/components/icon-picker/index.d.ts +23 -0
  115. package/src/lib/components/input-switch/index.d.ts +9 -0
  116. package/src/lib/components/input-with-icon/index.d.ts +10 -0
  117. package/src/lib/components/label-type/index.d.ts +19 -0
  118. package/src/lib/components/odata-query-builder/index.d.ts +81 -0
  119. package/src/lib/components/repeat/index.d.ts +17 -0
  120. package/src/lib/components/sidebar-cards/index.d.ts +18 -0
  121. package/src/lib/components/sidebar-toggles/index.d.ts +18 -0
  122. package/src/lib/components/tabs/index.d.ts +10 -0
  123. package/src/lib/components/tag-type/index.d.ts +27 -0
  124. package/src/lib/components/text-editor/index.d.ts +9 -0
  125. package/src/lib/components/wrappers/index.d.ts +24 -0
  126. package/src/lib/directives/index.d.ts +23 -0
  127. package/src/lib/pipes/index.d.ts +20 -0
@@ -1,278 +1,1666 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Output, Input, ChangeDetectionStrategy, Component, inject, Injectable, Directive } from '@angular/core';
2
+ import { InjectionToken, Input, Directive, Pipe, inject, Inject, Injectable, PLATFORM_ID, Optional, ViewChild, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import * as i2$1 from '@angular/forms';
6
- import { ReactiveFormsModule, FormsModule, FormGroup } from '@angular/forms';
7
- import { FormlyPrimeNGModule } from '@ngx-formly/primeng';
8
- import * as i2 from 'primeng/button';
9
- import { ButtonModule } from 'primeng/button';
10
- import { Subject, takeUntil } from 'rxjs';
11
- import { ProgressSpinnerModule } from 'primeng/progressspinner';
12
- import { MessageModule } from 'primeng/message';
13
- import * as i3 from 'primeng/splitbutton';
14
- import { SplitButtonModule } from 'primeng/splitbutton';
15
- import { FormlyForm, FieldType, FormlyAttributes } from '@ngx-formly/core';
16
- import * as i3$1 from '@ngx-translate/core';
17
- import { TranslateService, TranslateModule } from '@ngx-translate/core';
18
- import * as i1$1 from 'primeng/dynamicdialog';
4
+ import { isPlatformBrowser, DOCUMENT, CommonModule } from '@angular/common';
5
+ import { throwError, catchError, map, Subject, takeUntil } from 'rxjs';
6
+ import * as i1$1 from '@angular/common/http';
7
+ import { HttpParams } from '@angular/common/http';
19
8
  import Swal from 'sweetalert2';
9
+ import * as i1$3 from '@ngx-formly/core';
10
+ import { FieldType, FormlyAttributes, FieldWrapper, FormlyModule, FormlyForm } from '@ngx-formly/core';
11
+ import * as i1$2 from '@angular/forms';
12
+ import { ReactiveFormsModule, UntypedFormControl, FormGroup, FormsModule } from '@angular/forms';
13
+ import { FormlyFormFieldModule as FormlyFormFieldModule$1 } from '@ngx-formly/primeng/form-field';
14
+ import * as i2$3 from 'primeng/datepicker';
15
+ import { DatePickerModule } from 'primeng/datepicker';
16
+ import * as i3 from 'primeng/inputtext';
17
+ import { InputTextModule } from 'primeng/inputtext';
18
+ import * as i3$1 from '@ngx-translate/core';
19
+ import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
20
+ import { InputNumber } from 'primeng/inputnumber';
21
+ import * as i3$2 from 'primeng/radiobutton';
22
+ import { RadioButtonModule } from 'primeng/radiobutton';
23
+ import * as i4 from '@ngx-formly/core/select';
24
+ import { FormlySelectModule as FormlySelectModule$1 } from '@ngx-formly/core/select';
25
+ import * as i3$3 from 'primeng/select';
26
+ import { SelectModule } from 'primeng/select';
27
+ import * as i2 from 'primeng/api';
28
+ import * as i2$1 from 'primeng/checkbox';
29
+ import { CheckboxModule } from 'primeng/checkbox';
30
+ import * as i2$2 from 'primeng/textarea';
31
+ import { TextareaModule } from 'primeng/textarea';
20
32
  import { Router, ActivatedRoute } from '@angular/router';
33
+ import * as i3$4 from 'primeng/button';
34
+ import { ButtonModule } from 'primeng/button';
35
+ import * as i1$4 from 'primeng/dynamicdialog';
36
+
37
+ const ENVIRONMENT = new InjectionToken('ENVIRONMENT');
38
+
39
+ const CORE_OPTIONS = new InjectionToken('CORE_OPTIONS');
40
+ function coreOptionsFactory({ ...options }) {
41
+ return {
42
+ ...options,
43
+ };
44
+ }
45
+
46
+ class AutofocusDirective {
47
+ el;
48
+ autoFocus = true;
49
+ constructor(el) {
50
+ this.el = el;
51
+ }
52
+ ngOnChanges() {
53
+ if (this.autoFocus === '' || this.autoFocus === true) {
54
+ this.el.nativeElement.focus();
55
+ }
56
+ }
57
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
58
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.4", type: AutofocusDirective, isStandalone: true, selector: "[appAutofocus]", inputs: { autoFocus: ["appAutofocus", "autoFocus"] }, usesOnChanges: true, ngImport: i0 });
59
+ }
60
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: AutofocusDirective, decorators: [{
61
+ type: Directive,
62
+ args: [{
63
+ selector: '[appAutofocus]',
64
+ standalone: true
65
+ }]
66
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { autoFocus: [{
67
+ type: Input,
68
+ args: ['appAutofocus']
69
+ }] } });
70
+
71
+ class RtlLang {
72
+ el;
73
+ renderer;
74
+ lang = 'ar';
75
+ constructor(el, renderer) {
76
+ this.el = el;
77
+ this.renderer = renderer;
78
+ }
79
+ ngOnChanges(changes) {
80
+ const direction = this.lang === 'ar' ? 'rtl' : 'ltr';
81
+ this.renderer.setStyle(this.el.nativeElement, 'direction', direction);
82
+ }
83
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RtlLang, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
84
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.4", type: RtlLang, isStandalone: true, selector: "[appRtlLang]", inputs: { lang: ["appRtlLang", "lang"] }, usesOnChanges: true, ngImport: i0 });
85
+ }
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RtlLang, decorators: [{
87
+ type: Directive,
88
+ args: [{
89
+ selector: '[appRtlLang]'
90
+ }]
91
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { lang: [{
92
+ type: Input,
93
+ args: ['appRtlLang']
94
+ }] } });
95
+
96
+ // tafqeet.pipe.ts
97
+ class TafqeetPipe {
98
+ transform(value, currencyName = 'ريال سعودي') {
99
+ if (value == null || isNaN(value))
100
+ return '';
101
+ const [intPart, fracPart] = value.toFixed(2).split('.').map(Number);
102
+ const intText = this.toArabicWords(intPart);
103
+ const fracText = this.toArabicWords(fracPart);
104
+ let result = `${intText} ${currencyName}`;
105
+ if (fracPart > 0) {
106
+ result += ` و${fracText} هللة`;
107
+ }
108
+ return result;
109
+ }
110
+ toArabicWords(n) {
111
+ const units = [
112
+ '', 'واحد', 'اثنان', 'ثلاثة', 'أربعة', 'خمسة', 'ستة', 'سبعة', 'ثمانية', 'تسعة'
113
+ ];
114
+ const teens = [
115
+ 'عشرة', 'أحد عشر', 'اثنا عشر', 'ثلاثة عشر', 'أربعة عشر', 'خمسة عشر',
116
+ 'ستة عشر', 'سبعة عشر', 'ثمانية عشر', 'تسعة عشر'
117
+ ];
118
+ const tens = [
119
+ '', '', 'عشرون', 'ثلاثون', 'أربعون', 'خمسون', 'ستون', 'سبعون', 'ثمانون', 'تسعون'
120
+ ];
121
+ const hundreds = [
122
+ '', 'مائة', 'مائتان', 'ثلاثمائة', 'أربعمائة', 'خمسمائة', 'ستمائة', 'سبعمائة', 'ثمانمائة', 'تسعمائة'
123
+ ];
124
+ if (n === 0)
125
+ return 'صفر';
126
+ let words = [];
127
+ if (n >= 100) {
128
+ const h = Math.floor(n / 100);
129
+ words.push(hundreds[h]);
130
+ n %= 100;
131
+ }
132
+ if (n >= 10 && n < 20) {
133
+ words.push(teens[n - 10]);
134
+ }
135
+ else {
136
+ const t = Math.floor(n / 10);
137
+ const u = n % 10;
138
+ if (u > 0) {
139
+ words.push(units[u]);
140
+ }
141
+ if (t > 0) {
142
+ words.push(tens[t]);
143
+ }
144
+ }
145
+ return words.reverse().filter(w => !!w).join(' و ');
146
+ }
147
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TafqeetPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
148
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: TafqeetPipe, isStandalone: true, name: "tafqeet" });
149
+ }
150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TafqeetPipe, decorators: [{
151
+ type: Pipe,
152
+ args: [{
153
+ name: 'tafqeet'
154
+ }]
155
+ }] });
156
+
157
+ class TimeAgoWithFullDatePipe {
158
+ datePipe;
159
+ constructor(datePipe) {
160
+ this.datePipe = datePipe;
161
+ } // حقن DatePipe
162
+ transform(value) {
163
+ if (!value)
164
+ return '';
165
+ const date = typeof value === 'string' ? new Date(value) : value;
166
+ const now = new Date();
167
+ const seconds = Math.floor((now.getTime() - date.getTime()) / 1000);
168
+ let relativeTime;
169
+ if (seconds < 10) { // في بضع ثوانٍ (لأن "few seconds" في Freshdesk تكون قصيرة جداً)
170
+ relativeTime = 'منذ بضع ثوانٍ';
171
+ }
172
+ else if (seconds < 60) {
173
+ relativeTime = `منذ ${seconds} ثانية`;
174
+ }
175
+ else if (seconds < 120) { // 1 to 2 minutes
176
+ relativeTime = 'منذ دقيقة واحدة';
177
+ }
178
+ else if (seconds < 3600) { // less than 1 hour
179
+ relativeTime = `منذ ${Math.floor(seconds / 60)} دقيقة`;
180
+ }
181
+ else if (seconds < 7200) { // 1 to 2 hours
182
+ relativeTime = 'منذ ساعة واحدة';
183
+ }
184
+ else if (seconds < 86400) { // less than 24 hours
185
+ relativeTime = `منذ ${Math.floor(seconds / 3600)} ساعة`;
186
+ }
187
+ else if (seconds < 172800) { // 1 to 2 days
188
+ relativeTime = 'منذ يوم واحد';
189
+ }
190
+ else if (seconds < 2592000) { // less than 30 days (approx. 1 month)
191
+ relativeTime = `منذ ${Math.floor(seconds / 86400)} يومًا`;
192
+ }
193
+ else {
194
+ // For longer periods, Freshdesk typically just shows the full date
195
+ // We'll still keep the 'منذ X' for now based on previous request,
196
+ // but you might consider just returning the full date for older items.
197
+ const months = Math.floor(seconds / 2592000); // 30 days * 24 hours * 60 minutes * 60 seconds
198
+ if (months < 12) {
199
+ relativeTime = `منذ ${months} شهرًا`;
200
+ }
201
+ else {
202
+ relativeTime = `منذ ${Math.floor(months / 12)} سنة`;
203
+ }
204
+ }
205
+ // تنسيق التاريخ الكامل بالضبط كما في Freshdesk: "Sat, 26 Jul 2025 at 9:41 PM"
206
+ const fullDateFormatted = this.datePipe.transform(date, 'E, d MMM yyyy at h:mm a', 'en-US');
207
+ // دمج الوقت النسبي مع التاريخ الكامل
208
+ return `${relativeTime} (${fullDateFormatted})`;
209
+ }
210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TimeAgoWithFullDatePipe, deps: [{ token: i1.DatePipe }], target: i0.ɵɵFactoryTarget.Pipe });
211
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: TimeAgoWithFullDatePipe, isStandalone: true, name: "timeAgoWithFullDate", pure: false });
212
+ }
213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TimeAgoWithFullDatePipe, decorators: [{
214
+ type: Pipe,
215
+ args: [{
216
+ name: 'timeAgoWithFullDate', // تغيير الاسم ليعكس وظيفته الشاملة
217
+ pure: false // مهم لتحديث الـ Pipe بشكل متكرر
218
+ }]
219
+ }], ctorParameters: () => [{ type: i1.DatePipe }] });
220
+
221
+ class AttachmentDto {
222
+ id;
223
+ binaryObjectId;
224
+ description;
225
+ mimeType;
226
+ fileName;
227
+ base64;
228
+ caption;
229
+ link;
230
+ }
231
+
232
+ class ListResultDto {
233
+ items;
234
+ constructor(initialValues = {}) {
235
+ for (const key in initialValues) {
236
+ if (checkHasProp(initialValues, key)) {
237
+ this[key] = initialValues[key];
238
+ }
239
+ }
240
+ }
241
+ }
242
+ class PagedResultDto extends ListResultDto {
243
+ totalCount;
244
+ constructor(initialValues = {}) {
245
+ super(initialValues);
246
+ }
247
+ }
248
+ class GeneralResponse {
249
+ success;
250
+ result;
251
+ targetUrl;
252
+ // error?: IGeneralErrorInfo;
253
+ error;
254
+ unAuthorizedRequest;
255
+ constructor() {
256
+ }
257
+ }
258
+ function checkHasProp(object, key) {
259
+ return Object.prototype.hasOwnProperty.call(object, key);
260
+ }
261
+
262
+ var Rest;
263
+ (function (Rest) {
264
+ let Observe;
265
+ (function (Observe) {
266
+ Observe["Body"] = "body";
267
+ Observe["Events"] = "events";
268
+ Observe["Response"] = "response";
269
+ })(Observe = Rest.Observe || (Rest.Observe = {}));
270
+ let ResponseType;
271
+ (function (ResponseType) {
272
+ ResponseType["ArrayBuffer"] = "arraybuffer";
273
+ ResponseType["Blob"] = "blob";
274
+ ResponseType["JSON"] = "json";
275
+ ResponseType["Text"] = "text";
276
+ })(ResponseType = Rest.ResponseType || (Rest.ResponseType = {}));
277
+ })(Rest || (Rest = {}));
278
+
279
+ class RestService {
280
+ options;
281
+ http;
282
+ environment = inject(ENVIRONMENT);
283
+ constructor(options, http) {
284
+ this.options = options;
285
+ this.http = http;
286
+ }
287
+ getApiFromStore(apiName) {
288
+ return this.environment.apiUrl;
289
+ }
290
+ handleError(err) {
291
+ // this.httpErrorReporter.reportError(err);
292
+ return throwError(() => err);
293
+ }
294
+ request(request, config, api) {
295
+ // debugger
296
+ config = config || {};
297
+ api = api || this.getApiFromStore(config.apiName);
298
+ const { method, params, ...options } = request;
299
+ const { observe = Rest.Observe.Body, skipHandleError } = config;
300
+ const url = this.removeDuplicateSlashes(api + request.url);
301
+ const httpClient = this.getHttpClient(config.skipAddingHeader ?? false);
302
+ return httpClient
303
+ .request(method, url, {
304
+ observe,
305
+ ...(params && {
306
+ params: this.getParams(params, config.httpParamEncoder),
307
+ }),
308
+ ...options,
309
+ })
310
+ .pipe(catchError(err => (skipHandleError ? throwError(() => err) : this.handleError(err))));
311
+ }
312
+ getHttpClient(isExternal) {
313
+ return /* isExternal ? this.externalHttp : */ this.http;
314
+ }
315
+ getParams(params, encoder) {
316
+ const filteredParams = Object.entries(params).reduce((acc, [key, value]) => {
317
+ if (isUndefinedOrEmptyString(value))
318
+ return acc;
319
+ if (value === null && !this.options.sendNullsAsQueryParam)
320
+ return acc;
321
+ acc[key] = value;
322
+ return acc;
323
+ }, {});
324
+ return encoder
325
+ ? new HttpParams({ encoder, fromObject: filteredParams })
326
+ : new HttpParams({ fromObject: filteredParams });
327
+ }
328
+ removeDuplicateSlashes(url) {
329
+ return url.replace(/([^:]\/)\/+/g, '$1');
330
+ }
331
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RestService, deps: [{ token: CORE_OPTIONS }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
332
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RestService, providedIn: 'root' });
333
+ }
334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RestService, decorators: [{
335
+ type: Injectable,
336
+ args: [{
337
+ providedIn: 'root',
338
+ }]
339
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
340
+ type: Inject,
341
+ args: [CORE_OPTIONS]
342
+ }] }, { type: i1$1.HttpClient }] });
343
+ function isUndefinedOrEmptyString(value) {
344
+ return value === undefined || value === '';
345
+ }
346
+
347
+ class BaseService {
348
+ restService;
349
+ apiName = '';
350
+ moduleName = '';
351
+ constructor(restService) {
352
+ this.restService = restService;
353
+ }
354
+ get = (id) => this.restService.request({
355
+ method: 'GET',
356
+ url: `/${this.moduleName}/${this.apiName}/${id}`,
357
+ }, { apiName: this.apiName });
358
+ getList = (input, endpoint) => {
359
+ const params = Object.keys(input).reduce((acc, key) => {
360
+ acc[key] = input[key];
361
+ return acc;
362
+ }, {});
363
+ const url = endpoint ? endpoint : `/${this.moduleName}/${this.apiName}`;
364
+ return this.restService.request({
365
+ method: 'GET',
366
+ url: url,
367
+ params: params,
368
+ }, { apiName: this.apiName })
369
+ .pipe(map(response => response));
370
+ };
371
+ create = (input) => this.restService.request({
372
+ method: 'POST',
373
+ url: `/${this.moduleName}/${this.apiName}`,
374
+ body: input,
375
+ }, { apiName: this.apiName });
376
+ update = (id, input) => this.restService.request({
377
+ method: 'PUT',
378
+ url: `/${this.moduleName}/${this.apiName}/${id}`,
379
+ body: input,
380
+ }, { apiName: this.apiName });
381
+ delete = (id) => this.restService.request({
382
+ method: 'DELETE',
383
+ url: `/${this.moduleName}/${this.apiName}/${id}`,
384
+ }, { apiName: this.apiName });
385
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: BaseService, deps: [{ token: RestService }], target: i0.ɵɵFactoryTarget.Injectable });
386
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: BaseService, providedIn: 'root' });
387
+ }
388
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: BaseService, decorators: [{
389
+ type: Injectable,
390
+ args: [{
391
+ providedIn: 'root',
392
+ }]
393
+ }], ctorParameters: () => [{ type: RestService }] });
394
+
395
+ // src/app/services/generic.service.ts
396
+ /**
397
+ * GenericService<T, K>:
398
+ * - T = نوع الكائن (Model)
399
+ * - K = نوع المفتاح الأساسي (ID)، افتراضي number
400
+ *
401
+ * يحتوي على جميع دوال الـ CRUD القياسية للتوريث في الخدمات المتخصصة.
402
+ */
403
+ class GenericService {
404
+ http;
405
+ constructor(http) {
406
+ this.http = http;
407
+ }
408
+ /**
409
+ * جلب كل السجلات
410
+ */
411
+ getAll() {
412
+ // ملاحظة: يمكن إضافة معالج أخطاء مركزي هنا أو عبر Interceptor
413
+ return this.http.get(this.baseUrl);
414
+ }
415
+ /**
416
+ * جلب سجل واحد بناءً على المعرف
417
+ */
418
+ getById(id) {
419
+ // ملاحظة: تأكد أن الـ endpoint يدعم GET برقم المعرف
420
+ return this.http.get(`${this.baseUrl}/${id}`);
421
+ }
422
+ /**
423
+ * إنشاء سجل جديد
424
+ */
425
+ create(item) {
426
+ // ملاحظة: استخدم Partial<T> للسماح ببعض الحقول الاختيارية
427
+ return this.http.post(this.baseUrl, item);
428
+ }
429
+ /**
430
+ * تحديث سجل موجود
431
+ */
432
+ update(id, item) {
433
+ // ملاحظة: هنا نُعيد Observable<void> لأن API قد لا تُرجع الجسم نفسه
434
+ return this.http.put(`${this.baseUrl}`, item);
435
+ }
436
+ /**
437
+ * حذف سجل
438
+ */
439
+ delete(id) {
440
+ // ملاحظة: يُفضّل استخدام Confirm قبل الحذف في الواجهة
441
+ return this.http.delete(`${this.baseUrl}/${id}`);
442
+ }
443
+ /** endpoint قابل للتخصيص — يمكن للفرع override–ها */
444
+ getPageUrl() {
445
+ return this.baseUrl;
446
+ }
447
+ /**
448
+ * جلب صفحة من البيانات مع دعم الفلاتر والفرز
449
+ * @param pageIndex صفر-based
450
+ * @param pageSize عدد السجلات
451
+ * @param filters كائن Partial<T> أو Record<string,any>
452
+ * @param sort نص الفرز، مثلاً "eiNa:desc"
453
+ */
454
+ getPage(pageIndex, pageSize, filters, sort) {
455
+ // debugger
456
+ let params = new HttpParams()
457
+ .set('pageIndex', pageIndex.toString())
458
+ .set('pageSize', pageSize.toString());
459
+ if (filters) {
460
+ Object.entries(filters).forEach(([key, val]) => {
461
+ if (val != null && val !== '') {
462
+ params = params.set(key, val.toString());
463
+ }
464
+ });
465
+ }
466
+ if (sort) {
467
+ params = params.set('sort', sort);
468
+ }
469
+ // return this.http
470
+ // .get<T[]>(this.getPageUrl(), { params, observe: 'response' })
471
+ // .pipe(
472
+ // map((resp: HttpResponse<T[]>) => ({
473
+ // items: resp.body || [],
474
+ // totalCount: Number(resp.headers.get('X-Total-Count')) || resp.body?.length || 0
475
+ // }))
476
+ // );
477
+ return this.http.get(this.getPageUrl(), { params });
478
+ }
479
+ }
480
+
481
+ // Define the `Request` token
482
+ const REQUEST = new InjectionToken('REQUEST');
483
+ class SsrCookieService {
484
+ document;
485
+ platformId;
486
+ request;
487
+ documentIsAccessible;
488
+ static initialUrl = '';
489
+ constructor(document,
490
+ // Get the `PLATFORM_ID` so we can check if we're in a browser.
491
+ platformId, request) {
492
+ this.document = document;
493
+ this.platformId = platformId;
494
+ this.request = request;
495
+ this.documentIsAccessible = isPlatformBrowser(this.platformId);
496
+ SsrCookieService.initialUrl = this.documentIsAccessible ? this.document.location.href : this.request?.url;
497
+ }
498
+ /**
499
+ * Get cookie Regular Expression
500
+ *
501
+ * @param name Cookie name
502
+ * @returns property RegExp
503
+ *
504
+ * @author: Stepan Suvorov
505
+ * @since: 1.0.0
506
+ */
507
+ static getCookieRegExp(name) {
508
+ const escapedName = name.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi, '\\$1');
509
+ return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
510
+ }
511
+ /**
512
+ * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
513
+ *
514
+ * @param encodedURIComponent A value representing an encoded URI component.
515
+ *
516
+ * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
517
+ *
518
+ * @author: Stepan Suvorov
519
+ * @since: 1.0.0
520
+ */
521
+ static safeDecodeURIComponent(encodedURIComponent) {
522
+ try {
523
+ return decodeURIComponent(encodedURIComponent);
524
+ }
525
+ catch {
526
+ // probably it is not uri encoded. return as is
527
+ return encodedURIComponent;
528
+ }
529
+ }
530
+ /**
531
+ * Return `true` if {@link Document} is accessible, otherwise return `false`
532
+ *
533
+ * @param name Cookie name
534
+ * @returns boolean - whether cookie with specified name exists
535
+ *
536
+ * @author: Stepan Suvorov
537
+ * @since: 1.0.0
538
+ */
539
+ check(name) {
540
+ name = encodeURIComponent(name);
541
+ const regExp = SsrCookieService.getCookieRegExp(name);
542
+ return regExp.test((this.documentIsAccessible ? this.document.cookie : this.request?.headers.cookie) ?? '');
543
+ }
544
+ isDocumentIsAccessible() {
545
+ return this.documentIsAccessible;
546
+ }
547
+ get url() {
548
+ return this.documentIsAccessible ? this.document.location.href : this.request?.url;
549
+ }
550
+ /**
551
+ * Get cookies by name
552
+ *
553
+ * @param name Cookie name
554
+ * @returns property value
555
+ *
556
+ * @author: Stepan Suvorov
557
+ * @since: 1.0.0
558
+ */
559
+ get(name) {
560
+ if (this.check(name)) {
561
+ name = encodeURIComponent(name);
562
+ const regExp = SsrCookieService.getCookieRegExp(name);
563
+ const result = regExp.exec((this.documentIsAccessible ? this.document.cookie : this.request?.headers.cookie) ?? '');
564
+ return result[1] ? SsrCookieService.safeDecodeURIComponent(result[1]) : '';
565
+ }
566
+ else {
567
+ return '';
568
+ }
569
+ }
570
+ /**
571
+ * Get all cookies in JSON format
572
+ *
573
+ * @returns all the cookies in json
574
+ *
575
+ * @author: Stepan Suvorov
576
+ * @since: 1.0.0
577
+ */
578
+ getAll() {
579
+ const cookies = {};
580
+ const cookieString = this.documentIsAccessible ? this.document?.cookie : this.request?.headers.cookie;
581
+ if (cookieString && cookieString !== '') {
582
+ cookieString.split(';').forEach((currentCookie) => {
583
+ const [cookieName, cookieValue] = currentCookie.split('=');
584
+ cookies[SsrCookieService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] = SsrCookieService.safeDecodeURIComponent(cookieValue);
585
+ });
586
+ }
587
+ return cookies;
588
+ }
589
+ set(name, value, expiresOrOptions, path, domain, secure, sameSite, partitioned) {
590
+ if (!this.documentIsAccessible) {
591
+ return;
592
+ }
593
+ if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {
594
+ const optionsBody = {
595
+ expires: expiresOrOptions,
596
+ path,
597
+ domain,
598
+ secure,
599
+ sameSite: sameSite ? sameSite : 'Lax',
600
+ partitioned,
601
+ };
602
+ this.set(name, value, optionsBody);
603
+ return;
604
+ }
605
+ let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
606
+ const options = expiresOrOptions ? expiresOrOptions : {};
607
+ if (options.expires) {
608
+ if (typeof options.expires === 'number') {
609
+ const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);
610
+ cookieString += 'expires=' + dateExpires.toUTCString() + ';';
611
+ }
612
+ else {
613
+ cookieString += 'expires=' + options.expires.toUTCString() + ';';
614
+ }
615
+ }
616
+ if (options.path) {
617
+ cookieString += 'path=' + options.path + ';';
618
+ }
619
+ if (options.domain) {
620
+ cookieString += 'domain=' + options.domain + ';';
621
+ }
622
+ if (options.secure === false && options.sameSite === 'None') {
623
+ options.secure = true;
624
+ console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +
625
+ `More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`);
626
+ }
627
+ if (options.secure) {
628
+ cookieString += 'secure;';
629
+ }
630
+ if (!options.sameSite) {
631
+ options.sameSite = 'Lax';
632
+ }
633
+ cookieString += 'sameSite=' + options.sameSite + ';';
634
+ if (options.partitioned) {
635
+ cookieString += 'Partitioned;';
636
+ }
637
+ this.document.cookie = cookieString;
638
+ }
639
+ /**
640
+ * Delete cookie by name
641
+ *
642
+ * @param name Cookie name
643
+ * @param path Cookie path
644
+ * @param domain Cookie domain
645
+ * @param secure Cookie secure flag
646
+ * @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
647
+ *
648
+ * @author: Stepan Suvorov
649
+ * @since: 1.0.0
650
+ */
651
+ delete(name, path, domain, secure, sameSite = 'Lax') {
652
+ if (!this.documentIsAccessible) {
653
+ return;
654
+ }
655
+ const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');
656
+ this.set(name, '', { expires: expiresDate, path, domain, secure, sameSite });
657
+ }
658
+ /**
659
+ * Delete all cookies
660
+ *
661
+ * @param path Cookie path
662
+ * @param domain Cookie domain
663
+ * @param secure Is the Cookie secure
664
+ * @param sameSite Is the cookie same site
665
+ *
666
+ * @author: Stepan Suvorov
667
+ * @since: 1.0.0
668
+ */
669
+ deleteAll(path, domain, secure, sameSite = 'Lax') {
670
+ if (!this.documentIsAccessible) {
671
+ return;
672
+ }
673
+ const cookies = this.getAll();
674
+ for (const cookieName in cookies) {
675
+ if (cookies.hasOwnProperty(cookieName)) {
676
+ this.delete(cookieName, path, domain, secure, sameSite);
677
+ }
678
+ }
679
+ }
680
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SsrCookieService, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: REQUEST, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
681
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SsrCookieService, providedIn: 'root' });
682
+ }
683
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SsrCookieService, decorators: [{
684
+ type: Injectable,
685
+ args: [{
686
+ providedIn: 'root',
687
+ }]
688
+ }], ctorParameters: () => [{ type: Document, decorators: [{
689
+ type: Inject,
690
+ args: [DOCUMENT]
691
+ }] }, { type: undefined, decorators: [{
692
+ type: Inject,
693
+ args: [PLATFORM_ID]
694
+ }] }, { type: undefined, decorators: [{
695
+ type: Optional
696
+ }, {
697
+ type: Inject,
698
+ args: [REQUEST]
699
+ }] }] });
700
+
701
+ // app/shared/services/swal.service.ts
702
+ class SwalService {
703
+ /** رسالة تأكيد قبل تنفيذ إجراء */
704
+ confirm(title = 'هل أنت متأكد؟', text = 'لن يمكنك التراجع عن هذا الإجراء', confirmButtonText = 'نعم', cancelButtonText = 'إلغاء') {
705
+ return Swal.fire({
706
+ icon: 'warning',
707
+ title,
708
+ text,
709
+ showCancelButton: true,
710
+ confirmButtonText,
711
+ cancelButtonText,
712
+ // reverseButtons: true,
713
+ customClass: {
714
+ container: 'swal2-container' // ✅ أضف هذه الفئة
715
+ }
716
+ });
717
+ }
718
+ /** رسالة نجاح */
719
+ success(title, text, timer = 2000) {
720
+ return Swal.fire({
721
+ icon: 'success',
722
+ title,
723
+ text,
724
+ timer,
725
+ showConfirmButton: false,
726
+ customClass: {
727
+ container: 'swal2-container' // ✅ أضف هذه الفئة
728
+ }
729
+ });
730
+ }
731
+ /** رسالة خطأ */
732
+ error(title, text, footer) {
733
+ return Swal.fire({
734
+ icon: 'error',
735
+ title,
736
+ text,
737
+ footer,
738
+ customClass: {
739
+ container: 'swal2-container' // ✅ أضف هذه الفئة
740
+ }
741
+ });
742
+ }
743
+ /** رسالة معلومات */
744
+ info(title, text) {
745
+ return Swal.fire({
746
+ icon: 'info',
747
+ title,
748
+ text,
749
+ });
750
+ }
751
+ /** عرض نافذة SweetAlert2 بأي خيارات تريد */
752
+ alert(options) {
753
+ return Swal.fire(options);
754
+ }
755
+ /** Toast بسيط قابل لإعادة الاستخدام */
756
+ toast(title, icon = 'info', position = 'top-end', timer = 3000) {
757
+ const Toast = Swal.mixin({
758
+ toast: true,
759
+ position,
760
+ timer,
761
+ showConfirmButton: false,
762
+ });
763
+ Toast.fire({ icon, title });
764
+ }
765
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
766
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, providedIn: 'root' });
767
+ }
768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, decorators: [{
769
+ type: Injectable,
770
+ args: [{ providedIn: 'root' }]
771
+ }] });
772
+
773
+ // core/providers/environment.provider.ts
774
+ function provideEnvironmentConfig(config) {
775
+ return {
776
+ provide: ENVIRONMENT,
777
+ useValue: config
778
+ };
779
+ }
780
+
781
+ // export * from './formly.config';
782
+
783
+ class FormlyFieldInput extends FieldType {
784
+ inputElement;
785
+ inputNumberElement; // p-inputNumber component reference
786
+ ngAfterViewInit() {
787
+ if (this.props.autofocus) {
788
+ setTimeout(() => {
789
+ if (this.props.type === 'number' && this.inputNumberElement?.el?.nativeElement) {
790
+ // Focus for p-inputNumber
791
+ this.inputNumberElement.el.nativeElement.querySelector('input')?.focus();
792
+ }
793
+ else if (this.inputElement?.nativeElement) {
794
+ // Focus for regular input
795
+ this.inputElement.nativeElement.focus();
796
+ }
797
+ });
798
+ }
799
+ }
800
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
801
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldInput, isStandalone: true, selector: "formly-field-primeng-input", viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }, { propertyName: "inputNumberElement", first: true, predicate: ["inputNumberElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
802
+ <input
803
+ *ngIf="props.type !== 'number'; else numberTmp"
804
+ pInputText
805
+ [type]="props['type'] || 'text'"
806
+ [formControl]="formControl"
807
+ [formlyAttributes]="field"
808
+ [placeholder]="(props['placeholder'] ?? '')| translate"
809
+ class="w-full rounded-none block"
810
+ #inputElement
811
+ />
812
+ <ng-template #numberTmp>
813
+ <p-inputNumber
814
+ [formControl]="formControl"
815
+ [formlyAttributes]="field"
816
+ class="w-full rounded-none block"
817
+ [min]="props['min'] || 0"
818
+ [showButtons]="props['showButtons'] ?? false"
819
+ buttonLayout="horizontal"
820
+ spinnerMode="horizontal"
821
+ [useGrouping]="props['useGrouping']"
822
+ [placeholder]="(props['placeholder'] ?? '')| translate"
823
+ #inputNumberElement>
824
+ <ng-template #incrementbuttonicon>
825
+ <span class="pi pi-plus"></span>
826
+ </ng-template>
827
+ <ng-template #decrementbuttonicon>
828
+ <span class="pi pi-minus"></span>
829
+ </ng-template>
830
+ </p-inputNumber>
831
+ </ng-template>
832
+ `, 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: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "ngmodule", type: FormlyFormFieldModule$1 }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3.InputText, selector: "[pInputText]", inputs: ["pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
833
+ }
834
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldInput, decorators: [{
835
+ type: Component,
836
+ args: [{
837
+ selector: 'formly-field-primeng-input',
838
+ template: `
839
+ <input
840
+ *ngIf="props.type !== 'number'; else numberTmp"
841
+ pInputText
842
+ [type]="props['type'] || 'text'"
843
+ [formControl]="formControl"
844
+ [formlyAttributes]="field"
845
+ [placeholder]="(props['placeholder'] ?? '')| translate"
846
+ class="w-full rounded-none block"
847
+ #inputElement
848
+ />
849
+ <ng-template #numberTmp>
850
+ <p-inputNumber
851
+ [formControl]="formControl"
852
+ [formlyAttributes]="field"
853
+ class="w-full rounded-none block"
854
+ [min]="props['min'] || 0"
855
+ [showButtons]="props['showButtons'] ?? false"
856
+ buttonLayout="horizontal"
857
+ spinnerMode="horizontal"
858
+ [useGrouping]="props['useGrouping']"
859
+ [placeholder]="(props['placeholder'] ?? '')| translate"
860
+ #inputNumberElement>
861
+ <ng-template #incrementbuttonicon>
862
+ <span class="pi pi-plus"></span>
863
+ </ng-template>
864
+ <ng-template #decrementbuttonicon>
865
+ <span class="pi pi-minus"></span>
866
+ </ng-template>
867
+ </p-inputNumber>
868
+ </ng-template>
869
+ `,
870
+ changeDetection: ChangeDetectionStrategy.OnPush,
871
+ standalone: true,
872
+ imports: [
873
+ CommonModule,
874
+ ReactiveFormsModule,
875
+ DatePickerModule,
876
+ FormlyFormFieldModule$1,
877
+ FormlyAttributes,
878
+ InputTextModule,
879
+ TranslateModule,
880
+ InputNumber
881
+ ]
882
+ }]
883
+ }], propDecorators: { inputElement: [{
884
+ type: ViewChild,
885
+ args: ['inputElement']
886
+ }], inputNumberElement: [{
887
+ type: ViewChild,
888
+ args: ['inputNumberElement']
889
+ }] } });
890
+
891
+ function withFormlyFieldInput() {
892
+ return {
893
+ types: [
894
+ {
895
+ name: 'input',
896
+ component: FormlyFieldInput,
897
+ wrappers: ['form-field'],
898
+ },
899
+ { name: 'string', extends: 'input' },
900
+ {
901
+ name: 'number',
902
+ extends: 'input',
903
+ defaultOptions: {
904
+ props: {
905
+ type: 'number',
906
+ },
907
+ },
908
+ },
909
+ {
910
+ name: 'integer',
911
+ extends: 'input',
912
+ defaultOptions: {
913
+ props: {
914
+ type: 'number',
915
+ },
916
+ },
917
+ },
918
+ ],
919
+ };
920
+ }
921
+
922
+ class FormlyWrapperFormField extends FieldWrapper {
923
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyWrapperFormField, deps: null, target: i0.ɵɵFactoryTarget.Component });
924
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: FormlyWrapperFormField, isStandalone: false, selector: "formly-wrapper-primeng-form-field", usesInheritance: true, ngImport: i0, template: `
925
+ <div class="p-field">
926
+ <!-- text-lg -->
927
+ @if (props.label && props.hideLabel !== true) {
928
+ <label [for]="id" class="font-bold">
929
+ {{ props.label | translate }}
930
+ @if (props.required && props.hideRequiredMarker !== true) {
931
+ <span aria-hidden="true">*</span>
932
+ }
933
+ </label>
934
+ }
935
+
936
+ <div class="mb-2"></div>
937
+ <ng-container #fieldComponent></ng-container>
938
+
939
+ @if (showError) {
940
+ <small class="text-red-600 text-sm mt-1 block font-medium">
941
+ <formly-validation-message [field]="field"></formly-validation-message>
942
+ </small>
943
+ }
944
+ </div>
945
+ `, isInline: true, dependencies: [{ kind: "component", type: i1$3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }] });
946
+ }
947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyWrapperFormField, decorators: [{
948
+ type: Component,
949
+ args: [{
950
+ selector: 'formly-wrapper-primeng-form-field',
951
+ standalone: false,
952
+ template: `
953
+ <div class="p-field">
954
+ <!-- text-lg -->
955
+ @if (props.label && props.hideLabel !== true) {
956
+ <label [for]="id" class="font-bold">
957
+ {{ props.label | translate }}
958
+ @if (props.required && props.hideRequiredMarker !== true) {
959
+ <span aria-hidden="true">*</span>
960
+ }
961
+ </label>
962
+ }
963
+
964
+ <div class="mb-2"></div>
965
+ <ng-container #fieldComponent></ng-container>
966
+
967
+ @if (showError) {
968
+ <small class="text-red-600 text-sm mt-1 block font-medium">
969
+ <formly-validation-message [field]="field"></formly-validation-message>
970
+ </small>
971
+ }
972
+ </div>
973
+ `,
974
+ }]
975
+ }] });
976
+ class FormlyWrapperFormFieldNo extends FieldWrapper {
977
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyWrapperFormFieldNo, deps: null, target: i0.ɵɵFactoryTarget.Component });
978
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: FormlyWrapperFormFieldNo, isStandalone: false, selector: "formly-wrapper-primeng-form-field-no", usesInheritance: true, ngImport: i0, template: `
979
+ <div class="p-field">
980
+ <!-- text-lg -->
981
+ @if (props.label && props.hideLabel !== true) {
982
+ <label [for]="id" class="font-bold">
983
+ @if (props.required && props.hideRequiredMarker !== true) {
984
+ <span aria-hidden="true">*</span>
985
+ }
986
+ </label>
987
+ }
988
+
989
+ <ng-container #fieldComponent></ng-container>
990
+
991
+ @if (showError) {
992
+ <small class="text-red-600 text-sm mt-1 block font-medium">
993
+ <formly-validation-message [field]="field"></formly-validation-message>
994
+ </small>
995
+ }
996
+ </div>
997
+ `, isInline: true, dependencies: [{ kind: "component", type: i1$3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }] });
998
+ }
999
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyWrapperFormFieldNo, decorators: [{
1000
+ type: Component,
1001
+ args: [{
1002
+ selector: 'formly-wrapper-primeng-form-field-no',
1003
+ standalone: false,
1004
+ template: `
1005
+ <div class="p-field">
1006
+ <!-- text-lg -->
1007
+ @if (props.label && props.hideLabel !== true) {
1008
+ <label [for]="id" class="font-bold">
1009
+ @if (props.required && props.hideRequiredMarker !== true) {
1010
+ <span aria-hidden="true">*</span>
1011
+ }
1012
+ </label>
1013
+ }
1014
+
1015
+ <ng-container #fieldComponent></ng-container>
1016
+
1017
+ @if (showError) {
1018
+ <small class="text-red-600 text-sm mt-1 block font-medium">
1019
+ <formly-validation-message [field]="field"></formly-validation-message>
1020
+ </small>
1021
+ }
1022
+ </div>
1023
+ `,
1024
+ }]
1025
+ }] });
1026
+
1027
+ function withFormlyFormField() {
1028
+ return {
1029
+ wrappers: [
1030
+ {
1031
+ name: 'form-field',
1032
+ component: FormlyWrapperFormField,
1033
+ },
1034
+ {
1035
+ name: 'form-field-no',
1036
+ component: FormlyWrapperFormFieldNo,
1037
+ },
1038
+ ],
1039
+ };
1040
+ }
1041
+
1042
+ class FormlyFormFieldModule {
1043
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1044
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyFormFieldModule, declarations: [FormlyWrapperFormField,
1045
+ FormlyWrapperFormFieldNo], imports: [CommonModule, ReactiveFormsModule, i1$3.FormlyModule, TranslateModule, TranslatePipe], exports: [FormlyWrapperFormField] });
1046
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFormFieldModule, imports: [CommonModule, ReactiveFormsModule, FormlyModule.forChild(withFormlyFormField()), TranslateModule] });
1047
+ }
1048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFormFieldModule, decorators: [{
1049
+ type: NgModule,
1050
+ args: [{
1051
+ declarations: [
1052
+ FormlyWrapperFormField,
1053
+ FormlyWrapperFormFieldNo,
1054
+ // FormlyFormFieldWrapperComponent,
1055
+ ],
1056
+ imports: [CommonModule, ReactiveFormsModule, FormlyModule.forChild(withFormlyFormField()), TranslateModule, TranslatePipe],
1057
+ exports: [FormlyWrapperFormField]
1058
+ }]
1059
+ }] });
1060
+
1061
+ // import { FormlyFormFieldModule } from '../../components/form-field';
1062
+ class FormlyInputModule {
1063
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1064
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyInputModule, imports: [CommonModule,
1065
+ ReactiveFormsModule,
1066
+ InputTextModule,
1067
+ FormlyFormFieldModule, i1$3.FormlyModule] });
1068
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyInputModule, imports: [CommonModule,
1069
+ ReactiveFormsModule,
1070
+ InputTextModule,
1071
+ FormlyFormFieldModule,
1072
+ FormlyModule.forChild(withFormlyFieldInput())] });
1073
+ }
1074
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyInputModule, decorators: [{
1075
+ type: NgModule,
1076
+ args: [{
1077
+ // declarations: [FormlyFieldInput],
1078
+ imports: [
1079
+ CommonModule,
1080
+ ReactiveFormsModule,
1081
+ InputTextModule,
1082
+ FormlyFormFieldModule,
1083
+ FormlyModule.forChild(withFormlyFieldInput()),
1084
+ ],
1085
+ }]
1086
+ }] });
1087
+
1088
+ class FormlyFieldRadio extends FieldType {
1089
+ get disabledControl() {
1090
+ return new UntypedFormControl({ value: this.formControl.value, disabled: true });
1091
+ }
1092
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldRadio, deps: null, target: i0.ɵɵFactoryTarget.Component });
1093
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldRadio, isStandalone: false, selector: "formly-field-primeng-radio", usesInheritance: true, ngImport: i0, template: `
1094
+ <div
1095
+ class="p-field-radiobutton"
1096
+ *ngFor="let option of props.options | formlySelectOptions: field | async; let index = index"
1097
+ >
1098
+ <p-radioButton
1099
+ [name]="field.name || id"
1100
+ [formControl]="option.disabled ? disabledControl : formControl"
1101
+ [value]="option.value"
1102
+ [inputId]="id + index"
1103
+ >
1104
+ </p-radioButton>
1105
+ <label [for]="id + index" class="ml-2">{{ option.label }}</label>
1106
+ </div>
1107
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3$2.RadioButton, selector: "p-radioButton, p-radiobutton, p-radio-button", inputs: ["value", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "styleClass", "autofocus", "binary", "variant", "size"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.LegacyFormlySelectOptionsPipe, name: "formlySelectOptions" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1108
+ }
1109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldRadio, decorators: [{
1110
+ type: Component,
1111
+ args: [{
1112
+ selector: 'formly-field-primeng-radio',
1113
+ template: `
1114
+ <div
1115
+ class="p-field-radiobutton"
1116
+ *ngFor="let option of props.options | formlySelectOptions: field | async; let index = index"
1117
+ >
1118
+ <p-radioButton
1119
+ [name]="field.name || id"
1120
+ [formControl]="option.disabled ? disabledControl : formControl"
1121
+ [value]="option.value"
1122
+ [inputId]="id + index"
1123
+ >
1124
+ </p-radioButton>
1125
+ <label [for]="id + index" class="ml-2">{{ option.label }}</label>
1126
+ </div>
1127
+ `,
1128
+ changeDetection: ChangeDetectionStrategy.OnPush,
1129
+ standalone: false
1130
+ }]
1131
+ }] });
1132
+
1133
+ function withFormlyFieldRadio() {
1134
+ return {
1135
+ types: [
1136
+ {
1137
+ name: 'radio',
1138
+ component: FormlyFieldRadio,
1139
+ wrappers: ['form-field'],
1140
+ },
1141
+ ],
1142
+ };
1143
+ }
1144
+
1145
+ class FormlyRadioModule {
1146
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1147
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyRadioModule, declarations: [FormlyFieldRadio], imports: [CommonModule,
1148
+ ReactiveFormsModule,
1149
+ RadioButtonModule,
1150
+ FormlyFormFieldModule,
1151
+ FormlySelectModule$1, i1$3.FormlyModule] });
1152
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyRadioModule, imports: [CommonModule,
1153
+ ReactiveFormsModule,
1154
+ RadioButtonModule,
1155
+ FormlyFormFieldModule,
1156
+ FormlySelectModule$1,
1157
+ FormlyModule.forChild(withFormlyFieldRadio())] });
1158
+ }
1159
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyRadioModule, decorators: [{
1160
+ type: NgModule,
1161
+ args: [{
1162
+ declarations: [FormlyFieldRadio],
1163
+ imports: [
1164
+ CommonModule,
1165
+ ReactiveFormsModule,
1166
+ RadioButtonModule,
1167
+ FormlyFormFieldModule,
1168
+ FormlySelectModule$1,
1169
+ FormlyModule.forChild(withFormlyFieldRadio()),
1170
+ ],
1171
+ }]
1172
+ }] });
1173
+
1174
+ class FormlyFieldSelect extends FieldType {
1175
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
1176
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: FormlyFieldSelect, isStandalone: true, selector: "formly-field-primeng-select", usesInheritance: true, ngImport: i0, template: `
1177
+ <p-select
1178
+ [options]="(props.options | formlySelectOptions: field | async) ?? []"
1179
+ [formControl]="formControl"
1180
+ [formlyAttributes]="field"
1181
+ [showClear]="!props.required"
1182
+ [appendTo]="props.appendTo"
1183
+ [filter]="props.filter"
1184
+ [filterBy]="props.filterBy ?? 'label'"
1185
+ [optionLabel]="'label'"
1186
+ [optionValue]="'value'"
1187
+ (onChange)="props.change && props.change(field, $event)"
1188
+ [placeholder]="(props['placeholder'] ?? '')| translate"
1189
+ [styleClass]="'w-full rounded-none block'"
1190
+ >
1191
+ <!-- Template for each option in the dropdown -->
1192
+ <ng-template let-option pTemplate="item">
1193
+ <div class="flex items-center gap-2">
1194
+ <!-- Example: add an icon if option has one -->
1195
+ @if (option.icon) {
1196
+
1197
+ <i [class]="option.icon"></i>
1198
+ }
1199
+ <span>{{ option.label | translate }}</span>
1200
+ <!-- Example: show description -->
1201
+ @if (option.description) {
1202
+
1203
+ <small class="text-gray-500"> - {{ option.description | translate}}</small>
1204
+ }
1205
+ </div>
1206
+ </ng-template>
1207
+
1208
+ <!-- Template for selected value -->
1209
+ <ng-template let-selected pTemplate="selectedItem">
1210
+ <div class="flex items-center gap-2">
1211
+ @if (selected?.icon) {
1212
+ <i [class]="selected.icon"></i>
1213
+ }
1214
+ <span>{{ selected?.label | translate}}</span>
1215
+ </div>
1216
+ </ng-template>
1217
+ </p-select>
1218
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: FormlyFormFieldModule }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i3$3.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: FormlySelectModule$1 }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.LegacyFormlySelectOptionsPipe, name: "formlySelectOptions" }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1219
+ }
1220
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldSelect, decorators: [{
1221
+ type: Component,
1222
+ args: [{
1223
+ selector: 'formly-field-primeng-select',
1224
+ template: `
1225
+ <p-select
1226
+ [options]="(props.options | formlySelectOptions: field | async) ?? []"
1227
+ [formControl]="formControl"
1228
+ [formlyAttributes]="field"
1229
+ [showClear]="!props.required"
1230
+ [appendTo]="props.appendTo"
1231
+ [filter]="props.filter"
1232
+ [filterBy]="props.filterBy ?? 'label'"
1233
+ [optionLabel]="'label'"
1234
+ [optionValue]="'value'"
1235
+ (onChange)="props.change && props.change(field, $event)"
1236
+ [placeholder]="(props['placeholder'] ?? '')| translate"
1237
+ [styleClass]="'w-full rounded-none block'"
1238
+ >
1239
+ <!-- Template for each option in the dropdown -->
1240
+ <ng-template let-option pTemplate="item">
1241
+ <div class="flex items-center gap-2">
1242
+ <!-- Example: add an icon if option has one -->
1243
+ @if (option.icon) {
21
1244
 
22
- class GenericButton {
23
- // permissionChecker = inject(PermissionCheckerService);
24
- // لو وُجدت هذه المصفوفة، نُستخدم splitButton
25
- model;
26
- type = 'button';
27
- icon = '';
28
- label = '';
29
- variant = 'raised';
30
- severity = 'primary';
31
- size = 'normal';
32
- iconPosition = 'left';
33
- disabled = false;
34
- loading = false;
35
- ariaLabel;
36
- extraClasses = ''; // لأي Tailwind إضافي
37
- permission;
38
- clicked = new EventEmitter();
39
- itemClick = new EventEmitter();
40
- // خريطة أحجام
41
- sizeMap = {
42
- small: 'px-2 py-1 text-sm',
43
- normal: 'px-4 py-2 text-base',
44
- large: 'px-6 py-3 text-lg',
45
- };
46
- // خريطة ألوان للـ raised و rounded
47
- colorMap = {
48
- primary: 'bg-blue-600 hover:bg-blue-700 focus:ring-blue-500 text-white',
49
- secondary: 'bg-gray-600 hover:bg-gray-700 focus:ring-gray-500 text-white',
50
- success: 'bg-green-600 hover:bg-green-700 focus:ring-green-500 text-white',
51
- info: 'bg-teal-600 hover:bg-teal-700 focus:ring-teal-500 text-white',
52
- warning: 'bg-yellow-500 hover:bg-yellow-600 focus:ring-yellow-400 text-white',
53
- danger: 'bg-red-600 hover:bg-red-700 focus:ring-red-500 text-white',
54
- };
55
- // خريطة حدوده للـ outlined
56
- outlinedMap = {
57
- primary: 'border border-blue-600 text-blue-600 hover:bg-blue-50 focus:ring-blue-500',
58
- secondary: 'border border-gray-600 text-gray-600 hover:bg-gray-50 focus:ring-gray-500',
59
- success: 'border border-green-600 text-green-600 hover:bg-green-50 focus:ring-green-500',
60
- info: 'border border-teal-600 text-teal-600 hover:bg-teal-50 focus:ring-teal-500',
61
- warning: 'border border-yellow-500 text-yellow-500 hover:bg-yellow-50 focus:ring-yellow-400',
62
- danger: 'border border-red-600 text-red-600 hover:bg-red-50 focus:ring-red-500',
1245
+ <i [class]="option.icon"></i>
1246
+ }
1247
+ <span>{{ option.label | translate }}</span>
1248
+ <!-- Example: show description -->
1249
+ @if (option.description) {
1250
+
1251
+ <small class="text-gray-500"> - {{ option.description | translate}}</small>
1252
+ }
1253
+ </div>
1254
+ </ng-template>
1255
+
1256
+ <!-- Template for selected value -->
1257
+ <ng-template let-selected pTemplate="selectedItem">
1258
+ <div class="flex items-center gap-2">
1259
+ @if (selected?.icon) {
1260
+ <i [class]="selected.icon"></i>
1261
+ }
1262
+ <span>{{ selected?.label | translate}}</span>
1263
+ </div>
1264
+ </ng-template>
1265
+ </p-select>
1266
+ `,
1267
+ changeDetection: ChangeDetectionStrategy.OnPush,
1268
+ standalone: true,
1269
+ imports: [CommonModule,
1270
+ ReactiveFormsModule,
1271
+ DatePickerModule,
1272
+ FormlyFormFieldModule, FormlyAttributes, SelectModule, FormlySelectModule$1, TranslateModule]
1273
+ }]
1274
+ }] });
1275
+
1276
+ function withFormlyFieldSelect() {
1277
+ return {
1278
+ types: [
1279
+ {
1280
+ name: 'select',
1281
+ component: FormlyFieldSelect,
1282
+ wrappers: ['form-field'],
1283
+ },
1284
+ { name: 'enum', extends: 'select' },
1285
+ ],
63
1286
  };
64
- get twClasses() {
65
- const base = [
66
- 'inline-flex items-center justify-center font-medium',
67
- 'focus:outline-none focus:ring-2 focus:ring-offset-2 transition',
68
- this.sizeMap[this.size]
69
- ];
70
- // variant-specific
71
- if (this.variant === 'outlined') {
72
- base.push(this.outlinedMap[this.severity]);
73
- }
74
- else {
75
- base.push(this.colorMap[this.severity]);
76
- }
77
- if (this.variant === 'text') {
78
- base.push('bg-transparent hover:bg-gray-100 focus:ring-gray-200 text-gray-700');
79
- }
80
- if (this.variant === 'rounded') {
81
- base.push('rounded-full');
82
- }
83
- else {
84
- base.push('rounded-md');
85
- }
86
- if (this.disabled || this.loading) {
87
- base.push('opacity-50 cursor-not-allowed');
88
- }
89
- if (this.extraClasses) {
90
- base.push(this.extraClasses);
91
- }
92
- return base.join(' ');
93
- }
94
- onClick() {
95
- if (!this.disabled && !this.loading) {
96
- this.clicked.emit();
97
- }
98
- }
99
- onItemClick(evt) {
100
- this.itemClick.emit(evt);
101
- }
102
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
103
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: GenericButton, isStandalone: true, selector: "lib-generic-button", inputs: { model: "model", type: "type", icon: "icon", label: "label", variant: "variant", severity: "severity", size: "size", iconPosition: "iconPosition", disabled: "disabled", loading: "loading", ariaLabel: "ariaLabel", extraClasses: "extraClasses", permission: "permission" }, outputs: { clicked: "clicked", itemClick: "itemClick" }, ngImport: i0, template: "\n<!-- generic-button.component.html -->\n <!-- *hasPermission=\"permission\" -->\n<ng-container >\n <ng-container *ngIf=\"model?.length; else simpleBtn\">\n <!-- \u062D\u0627\u0644\u0629 \u0627\u0644\u0640 splitButton -->\n <p-splitButton\n [model]=\"model\"\n [icon]=\"icon\"\n [label]=\"label\"\n [styleClass]=\"twClasses\"\n [disabled]=\"disabled || loading\" (onClick)=\"onClick()\"\n (onClick)=\"onClick()\"\n (onItemClick)=\"onItemClick($event)\"\n ></p-splitButton>\n </ng-container>\n\n <ng-template #simpleBtn>\n <!-- \u062D\u0627\u0644\u0629 \u0627\u0644\u0632\u0631\u0651 \u0627\u0644\u0639\u0627\u062F\u064A -->\n <button\n [attr.type]=\"type\"\n pButton\n [icon]=\"loading ? 'pi pi-spin pi-spinner' : icon\"\n [label]=\"label\"\n [ngClass]=\"twClasses\"\n [attr.aria-label]=\"ariaLabel || label\"\n [disabled]=\"disabled || loading\" (onClick)=\"onClick()\"\n (click)=\"onClick()\"\n >\n\n <!-- \u0645\u062D\u062A\u0648\u0649 \u0645\u062E\u0635\u0651\u0635 -->\n <ng-content *ngIf=\"!label && !icon && !loading\"></ng-content>\n </button>\n </ng-template>\n </ng-container>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "ngmodule", type: SplitButtonModule }, { kind: "component", type: i3.SplitButton, selector: "p-splitbutton, p-splitButton, p-split-button", inputs: ["model", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "icon", "iconPos", "label", "tooltip", "tooltipOptions", "styleClass", "menuStyle", "menuStyleClass", "dropdownIcon", "appendTo", "dir", "expandAriaLabel", "showTransitionOptions", "hideTransitionOptions", "buttonProps", "menuButtonProps", "autofocus", "disabled", "tabindex", "menuButtonDisabled", "buttonDisabled"], outputs: ["onClick", "onMenuHide", "onMenuShow", "onDropdownClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
104
1287
  }
105
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericButton, decorators: [{
106
- type: Component,
107
- args: [{ selector: 'lib-generic-button', standalone: true, imports: [CommonModule, ButtonModule, SplitButtonModule, /* HasPermissionDirective */], changeDetection: ChangeDetectionStrategy.OnPush, template: "\n<!-- generic-button.component.html -->\n <!-- *hasPermission=\"permission\" -->\n<ng-container >\n <ng-container *ngIf=\"model?.length; else simpleBtn\">\n <!-- \u062D\u0627\u0644\u0629 \u0627\u0644\u0640 splitButton -->\n <p-splitButton\n [model]=\"model\"\n [icon]=\"icon\"\n [label]=\"label\"\n [styleClass]=\"twClasses\"\n [disabled]=\"disabled || loading\" (onClick)=\"onClick()\"\n (onClick)=\"onClick()\"\n (onItemClick)=\"onItemClick($event)\"\n ></p-splitButton>\n </ng-container>\n\n <ng-template #simpleBtn>\n <!-- \u062D\u0627\u0644\u0629 \u0627\u0644\u0632\u0631\u0651 \u0627\u0644\u0639\u0627\u062F\u064A -->\n <button\n [attr.type]=\"type\"\n pButton\n [icon]=\"loading ? 'pi pi-spin pi-spinner' : icon\"\n [label]=\"label\"\n [ngClass]=\"twClasses\"\n [attr.aria-label]=\"ariaLabel || label\"\n [disabled]=\"disabled || loading\" (onClick)=\"onClick()\"\n (click)=\"onClick()\"\n >\n\n <!-- \u0645\u062D\u062A\u0648\u0649 \u0645\u062E\u0635\u0651\u0635 -->\n <ng-content *ngIf=\"!label && !icon && !loading\"></ng-content>\n </button>\n </ng-template>\n </ng-container>\n" }]
108
- }], propDecorators: { model: [{
109
- type: Input
110
- }], type: [{
111
- type: Input
112
- }], icon: [{
113
- type: Input
114
- }], label: [{
115
- type: Input
116
- }], variant: [{
117
- type: Input
118
- }], severity: [{
119
- type: Input
120
- }], size: [{
121
- type: Input
122
- }], iconPosition: [{
123
- type: Input
124
- }], disabled: [{
125
- type: Input
126
- }], loading: [{
127
- type: Input
128
- }], ariaLabel: [{
129
- type: Input
130
- }], extraClasses: [{
131
- type: Input
132
- }], permission: [{
133
- type: Input
134
- }], clicked: [{
135
- type: Output
136
- }], itemClick: [{
137
- type: Output
138
- }] } });
139
1288
 
140
- class GenericFormlyFields {
141
- /** الـ FormGroup الذي يُدار خارجيًا */
142
- form;
143
- /** حقول Formly */
144
- fields = [];
145
- /** النموذج (object) الذي سيُربط بالحقول */
146
- model = {};
147
- /** خيارات Formly (validation, hideExpression, ...) */
148
- options = {};
149
- ngOnInit() {
150
- // ما من حاجة هنا: يفترض أن form مُهيّأ في الخارج
151
- }
152
- ngOnChanges(changes) {
153
- // لو احتجت تتعامل مع تغيّر الحقول أو الموديل، هنا المكان
154
- }
155
- // دالة مساعدة للوصول الآمن لخصائص الحقل
156
- getFieldIcon(field) {
157
- return field.templateOptions?.['icon'] || null;
158
- }
159
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericFormlyFields, deps: [], target: i0.ɵɵFactoryTarget.Component });
160
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: GenericFormlyFields, isStandalone: true, selector: "lib-generic-formly-fields", inputs: { form: "form", fields: "fields", model: "model", options: "options" }, usesOnChanges: true, ngImport: i0, template: "<!-- \u064A\u0631\u0633\u0645 \u062D\u0642\u0648\u0644 Formly \u062F\u0627\u062E\u0644 \u0627\u0644\u0640 form \u0627\u0644\u0645\u0648\u062C\u0648\u062F -->\n<formly-form\n [form]=\"form\"\n [fields]=\"fields\"\n [model]=\"model\"\n [options]=\"options\">\n</formly-form>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }] });
1289
+ class FormlySelectModule {
1290
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlySelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1291
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlySelectModule, imports: [CommonModule,
1292
+ ReactiveFormsModule,
1293
+ SelectModule,
1294
+ FormlyFormFieldModule,
1295
+ FormlySelectModule$1, i1$3.FormlyModule] });
1296
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlySelectModule, imports: [CommonModule,
1297
+ ReactiveFormsModule,
1298
+ SelectModule,
1299
+ FormlyFormFieldModule,
1300
+ FormlySelectModule$1,
1301
+ FormlyModule.forChild(withFormlyFieldSelect())] });
1302
+ }
1303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlySelectModule, decorators: [{
1304
+ type: NgModule,
1305
+ args: [{
1306
+ // declarations: [FormlyFieldSelect],
1307
+ imports: [
1308
+ CommonModule,
1309
+ ReactiveFormsModule,
1310
+ SelectModule,
1311
+ FormlyFormFieldModule,
1312
+ FormlySelectModule$1,
1313
+ FormlyModule.forChild(withFormlyFieldSelect()),
1314
+ ],
1315
+ }]
1316
+ }] });
1317
+
1318
+ class FormlyFieldCheckbox extends FieldType {
1319
+ defaultOptions = { props: { hideLabel: true } };
1320
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldCheckbox, deps: null, target: i0.ɵɵFactoryTarget.Component });
1321
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldCheckbox, isStandalone: true, selector: "formly-field-primeng-checkbox", usesInheritance: true, ngImport: i0, template: `
1322
+ <!-- <div class="p-field-checkbox flex items-center gap-1">
1323
+
1324
+ <p-checkbox
1325
+ [binary]="true"
1326
+ [formControl]="formControl"
1327
+ [formlyAttributes]="field"
1328
+ [inputId]="id"
1329
+
1330
+ />
1331
+ <label [for]="id" class="ml-2">{{ (props['label'] ?? '') | translate}}</label>
1332
+ </div> -->
1333
+
1334
+ <div class="flex items-center justify-end rtl:flex-row-reverse w-full px-2 py-1" style=" border-radius: var(--p-inputtext-border-radius);">
1335
+ <!-- text-lg -->
1336
+ <label [for]="id" class="font-bold text-gray-800 mr-2 whitespace-nowrap">
1337
+ {{ (to.label ?? '') | translate }}
1338
+ </label>
1339
+ <p-checkbox
1340
+ [binary]="true"
1341
+ [formControl]="formControl"
1342
+ [formlyAttributes]="field"
1343
+ [inputId]="id"
1344
+
1345
+ />
1346
+ </div>
1347
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "ngmodule", type: FormlyFormFieldModule }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2$1.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
161
1348
  }
162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericFormlyFields, decorators: [{
1349
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldCheckbox, decorators: [{
163
1350
  type: Component,
164
- args: [{ selector: 'lib-generic-formly-fields', standalone: true, imports: [
1351
+ args: [{
1352
+ selector: 'formly-field-primeng-checkbox',
1353
+ template: `
1354
+ <!-- <div class="p-field-checkbox flex items-center gap-1">
1355
+
1356
+ <p-checkbox
1357
+ [binary]="true"
1358
+ [formControl]="formControl"
1359
+ [formlyAttributes]="field"
1360
+ [inputId]="id"
1361
+
1362
+ />
1363
+ <label [for]="id" class="ml-2">{{ (props['label'] ?? '') | translate}}</label>
1364
+ </div> -->
1365
+
1366
+ <div class="flex items-center justify-end rtl:flex-row-reverse w-full px-2 py-1" style=" border-radius: var(--p-inputtext-border-radius);">
1367
+ <!-- text-lg -->
1368
+ <label [for]="id" class="font-bold text-gray-800 mr-2 whitespace-nowrap">
1369
+ {{ (to.label ?? '') | translate }}
1370
+ </label>
1371
+ <p-checkbox
1372
+ [binary]="true"
1373
+ [formControl]="formControl"
1374
+ [formlyAttributes]="field"
1375
+ [inputId]="id"
1376
+
1377
+ />
1378
+ </div>
1379
+ `,
1380
+ changeDetection: ChangeDetectionStrategy.OnPush,
1381
+ standalone: true,
1382
+ imports: [CommonModule, ReactiveFormsModule, DatePickerModule, FormlyFormFieldModule, FormlyAttributes, TranslateModule, CheckboxModule]
1383
+ }]
1384
+ }] });
1385
+
1386
+ function withFormlyFieldCheckbox() {
1387
+ return {
1388
+ types: [
1389
+ {
1390
+ name: 'checkbox',
1391
+ component: FormlyFieldCheckbox,
1392
+ wrappers: ['form-field'],
1393
+ },
1394
+ {
1395
+ name: 'boolean',
1396
+ extends: 'checkbox',
1397
+ },
1398
+ ],
1399
+ };
1400
+ }
1401
+
1402
+ class FormlyCheckboxModule {
1403
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1404
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyCheckboxModule, imports: [CommonModule,
1405
+ ReactiveFormsModule,
1406
+ CheckboxModule,
1407
+ FormlyFormFieldModule, i1$3.FormlyModule] });
1408
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyCheckboxModule, imports: [CommonModule,
1409
+ ReactiveFormsModule,
1410
+ CheckboxModule,
1411
+ FormlyFormFieldModule,
1412
+ FormlyModule.forChild(withFormlyFieldCheckbox())] });
1413
+ }
1414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyCheckboxModule, decorators: [{
1415
+ type: NgModule,
1416
+ args: [{
1417
+ // declarations: [FormlyFieldCheckbox],
1418
+ imports: [
165
1419
  CommonModule,
166
1420
  ReactiveFormsModule,
167
- FormsModule,
168
- FormlyForm,
169
- // FormlyPrimeNGModule,
170
- ], template: "<!-- \u064A\u0631\u0633\u0645 \u062D\u0642\u0648\u0644 Formly \u062F\u0627\u062E\u0644 \u0627\u0644\u0640 form \u0627\u0644\u0645\u0648\u062C\u0648\u062F -->\n<formly-form\n [form]=\"form\"\n [fields]=\"fields\"\n [model]=\"model\"\n [options]=\"options\">\n</formly-form>\n" }]
171
- }], propDecorators: { form: [{
172
- type: Input
173
- }], fields: [{
174
- type: Input
175
- }], model: [{
176
- type: Input
177
- }], options: [{
178
- type: Input
179
- }] } });
1421
+ CheckboxModule,
1422
+ FormlyFormFieldModule,
1423
+ FormlyModule.forChild(withFormlyFieldCheckbox()),
1424
+ ],
1425
+ }]
1426
+ }] });
180
1427
 
181
- class GenericErrormessage {
182
- /** نص رسالة الخطأ */
183
- text = '';
184
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericErrormessage, deps: [], target: i0.ɵɵFactoryTarget.Component });
185
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: GenericErrormessage, isStandalone: true, selector: "lib-generic-errormessage", inputs: { text: "text" }, ngImport: i0, template: " \n@if (text) {\n<div class=\"bg-red-100 border border-red-300 text-red-800 px-4 py-3 rounded my-4\"> {{ text }} </div>\n}", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
1428
+ class FormlyFieldTextArea extends FieldType {
1429
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldTextArea, deps: null, target: i0.ɵɵFactoryTarget.Component });
1430
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldTextArea, isStandalone: true, selector: "formly-field-primeng-textarea", usesInheritance: true, ngImport: i0, template: ` <textarea [formControl]="formControl" [formlyAttributes]="field" class="w-full rounded-none block" [placeholder]="(props['placeholder'] ?? '')| translate" pInputTextarea></textarea> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "ngmodule", type: FormlyFormFieldModule }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: SelectModule }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i2$2.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "pSize", "variant", "fluid", "invalid"], outputs: ["onResize"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
186
1431
  }
187
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericErrormessage, decorators: [{
1432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldTextArea, decorators: [{
188
1433
  type: Component,
189
- args: [{ selector: 'lib-generic-errormessage', imports: [CommonModule], template: " \n@if (text) {\n<div class=\"bg-red-100 border border-red-300 text-red-800 px-4 py-3 rounded my-4\"> {{ text }} </div>\n}" }]
190
- }], propDecorators: { text: [{
191
- type: Input
192
- }] } });
1434
+ args: [{
1435
+ selector: 'formly-field-primeng-textarea',
1436
+ template: ` <textarea [formControl]="formControl" [formlyAttributes]="field" class="w-full rounded-none block" [placeholder]="(props['placeholder'] ?? '')| translate" pInputTextarea></textarea> `,
1437
+ changeDetection: ChangeDetectionStrategy.OnPush,
1438
+ standalone: true,
1439
+ imports: [
1440
+ CommonModule,
1441
+ ReactiveFormsModule,
1442
+ DatePickerModule,
1443
+ FormlyFormFieldModule,
1444
+ FormlyAttributes,
1445
+ SelectModule,
1446
+ TextareaModule,
1447
+ TranslateModule
1448
+ ]
1449
+ }]
1450
+ }] });
193
1451
 
194
- class GenericCrudDialog {
195
- ref;
196
- config;
197
- form = new FormGroup({});
198
- model = {};
199
- fields = [];
200
- options = {};
201
- loading = false;
202
- id = null;
203
- errorMessage = null;
204
- translate = inject(TranslateService);
205
- destroy$ = new Subject();
206
- idField;
207
- constructor(ref, config) {
208
- this.ref = ref;
209
- this.config = config;
210
- // استقبال البيانات من المكون الأب
211
- this.fields = this.config.data.fields;
212
- this.idField = this.config.data.idField;
213
- this.model = this.config.data.item ? { ...this.config.data.item } : {};
214
- // تحديد وضع العملية (تعديل أو إضافة)
215
- // this.isEditMode = !!this.config.data.item;
216
- try {
217
- const id = this.model[this.idField];
218
- this.id = id != undefined;
219
- }
220
- catch (error) {
1452
+ function withFormlyFieldTextArea() {
1453
+ return {
1454
+ types: [
1455
+ {
1456
+ name: 'textarea',
1457
+ component: FormlyFieldTextArea,
1458
+ wrappers: ['form-field'],
1459
+ },
1460
+ ],
1461
+ };
1462
+ }
1463
+
1464
+ class FormlyTextAreaModule {
1465
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyTextAreaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1466
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyTextAreaModule, imports: [CommonModule,
1467
+ ReactiveFormsModule,
1468
+ TextareaModule,
1469
+ FormlyFormFieldModule, i1$3.FormlyModule] });
1470
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyTextAreaModule, imports: [CommonModule,
1471
+ ReactiveFormsModule,
1472
+ TextareaModule,
1473
+ FormlyFormFieldModule,
1474
+ FormlyModule.forChild(withFormlyFieldTextArea())] });
1475
+ }
1476
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyTextAreaModule, decorators: [{
1477
+ type: NgModule,
1478
+ args: [{
1479
+ // declarations: [FormlyFieldTextArea],
1480
+ imports: [
1481
+ CommonModule,
1482
+ ReactiveFormsModule,
1483
+ TextareaModule,
1484
+ FormlyFormFieldModule,
1485
+ FormlyModule.forChild(withFormlyFieldTextArea()),
1486
+ ],
1487
+ }]
1488
+ }] });
1489
+
1490
+ class FormlyFieldDatepicker extends FieldType {
1491
+ defaultOptions = {
1492
+ props: {
1493
+ numberOfMonths: 1,
1494
+ },
1495
+ };
1496
+ ngOnInit() {
1497
+ const value = this.formControl.value;
1498
+ // Convert incoming string to Date
1499
+ if (typeof value === 'string') {
1500
+ const parsed = new Date(value);
1501
+ if (!isNaN(parsed.getTime())) {
1502
+ this.formControl.setValue(parsed, { emitEvent: false });
1503
+ }
221
1504
  }
1505
+ // Convert back to string when user selects date (if needed)
1506
+ this.formControl.valueChanges.subscribe(val => {
1507
+ if (val instanceof Date && this.props?.dataType === 'string') {
1508
+ const pad = (n) => n.toString().padStart(2, '0');
1509
+ const year = val.getFullYear();
1510
+ const month = pad(val.getMonth() + 1); // months are 0-based
1511
+ const day = pad(val.getDate());
1512
+ let result = `${year}-${month}-${day}`;
1513
+ if (this.props?.showTime) {
1514
+ const hours = pad(val.getHours());
1515
+ const minutes = pad(val.getMinutes());
1516
+ const seconds = pad(val.getSeconds());
1517
+ result += `T${hours}:${minutes}:${seconds}`;
1518
+ }
1519
+ if (this.formControl.value !== result) {
1520
+ this.formControl.setValue(result, { emitEvent: false });
1521
+ }
1522
+ }
1523
+ });
222
1524
  }
223
- onSubmit() {
224
- if (this.form.invalid)
225
- return;
226
- this.loading = true;
227
- this.errorMessage = null;
228
- const service = this.config.data.service;
229
- console.log('service:', service);
230
- try {
231
- this.id = this.model[this.idField];
1525
+ onDateSelect(date) {
1526
+ if (this.props?.dataType === 'string') {
1527
+ const formatted = this.props.showTime === true
1528
+ ? this.toLocalDateTimeString(date)
1529
+ : this.toLocalDateOnlyString(date);
1530
+ this.formControl.setValue(formatted);
232
1531
  }
233
- catch (error) {
1532
+ else {
1533
+ this.formControl.setValue(date);
234
1534
  }
235
- console.log('isEditMode:', this.id);
236
- debugger;
237
- const isEditMode = !!this.config.data.item;
238
- const operation$ = isEditMode
239
- ? service.update(this.id, this.model)
240
- : service.create(this.model);
241
- operation$.pipe(takeUntil(this.destroy$)).subscribe({
242
- next: () => {
243
- this.ref.close(true); // نجاح العملية
244
- },
245
- error: (err) => {
246
- this.loading = false;
247
- this.errorMessage = err.error?.message ||
248
- err.message ||
249
- 'حدث خطأ أثناء الحفظ. يرجى المحاولة مرة أخرى.';
250
- }
251
- });
252
1535
  }
253
- ngOnDestroy() {
254
- this.destroy$.next();
255
- this.destroy$.complete();
1536
+ onTouched() {
1537
+ this.formControl.markAsTouched();
1538
+ }
1539
+ toLocalDateOnlyString(date) {
1540
+ const pad = (n) => n.toString().padStart(2, '0');
1541
+ const year = date.getFullYear();
1542
+ const month = pad(date.getMonth() + 1);
1543
+ const day = pad(date.getDate());
1544
+ return `${year}-${month}-${day}`;
256
1545
  }
257
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericCrudDialog, deps: [{ token: i1$1.DynamicDialogRef }, { token: i1$1.DynamicDialogConfig }], target: i0.ɵɵFactoryTarget.Component });
258
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: GenericCrudDialog, isStandalone: true, selector: "app-generic-crud-dialog", ngImport: i0, template: " <div class=\"p-4\">\n @if (errorMessage) {\n <lib-generic-errormessage [text]=\"errorMessage\"></lib-generic-errormessage>\n }\n\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <!-- \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0645\u0643\u0648\u0646 \u0627\u0644\u0639\u0627\u0645 \u0644\u0644\u062D\u0642\u0648\u0644 -->\n <lib-generic-formly-fields\n [form]=\"form\"\n [fields]=\"fields\"\n [model]=\"model\"\n [options]=\"options\">\n </lib-generic-formly-fields>\n\n <div class=\"flex justify-end gap-2 mt-4\">\n\n <!-- \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0645\u0643\u0648\u0646 \u0627\u0644\u0639\u0627\u0645 \u0644\u0644\u0623\u0632\u0631\u0627\u0631 - \u0632\u0631 \u0627\u0644\u062D\u0641\u0638 -->\n <lib-generic-button\n variant=\"raised\"\n severity=\"primary\"\n type=\"submit\"\n [loading]=\"loading\"\n [disabled]=\"loading || form.invalid\"\n [label]=\"(id ? 'COMMON.UPDATE' : 'COMMON.SAVE') | translate\">\n </lib-generic-button>\n <!-- \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0645\u0643\u0648\u0646 \u0627\u0644\u0639\u0627\u0645 \u0644\u0644\u0623\u0632\u0631\u0627\u0631 - \u0632\u0631 \u0627\u0644\u0625\u0644\u063A\u0627\u0621 -->\n <lib-generic-button\n variant=\"text\"\n severity=\"secondary\"\n [disabled]=\"loading\"\n [label]=\"'COMMON.CANCEL' | translate\"\n (clicked)=\"ref.close(false)\">\n </lib-generic-button>\n\n </div>\n </form>\n </div>\n", styles: [":host{display:block}button{min-width:120px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyPrimeNGModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: ProgressSpinnerModule }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: GenericButton, selector: "lib-generic-button", inputs: ["model", "type", "icon", "label", "variant", "severity", "size", "iconPosition", "disabled", "loading", "ariaLabel", "extraClasses", "permission"], outputs: ["clicked", "itemClick"] }, { kind: "component", type: // إضافة المكون العام للأزرار
259
- GenericFormlyFields, selector: "lib-generic-formly-fields", inputs: ["form", "fields", "model", "options"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: GenericErrormessage, selector: "lib-generic-errormessage", inputs: ["text"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }] });
1546
+ toLocalDateTimeString(date) {
1547
+ const pad = (n) => n.toString().padStart(2, '0');
1548
+ const year = date.getFullYear();
1549
+ const month = pad(date.getMonth() + 1);
1550
+ const day = pad(date.getDate());
1551
+ const hours = pad(date.getHours());
1552
+ const minutes = pad(date.getMinutes());
1553
+ const seconds = pad(date.getSeconds());
1554
+ return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
1555
+ }
1556
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldDatepicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
1557
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldDatepicker, isStandalone: true, selector: "formly-field-primeng-datepicker", usesInheritance: true, ngImport: i0, template: `
1558
+ <p-datepicker
1559
+ [dataType]="props.dataType ?? 'string'"
1560
+ [dateFormat]="props.dateFormat ?? (props.showTime ? 'yy-mm-dd' : 'yy-mm-dd')"
1561
+ [hourFormat]="props.hourFormat || '12'"
1562
+ [timeOnly]="props.timeOnly || false"
1563
+ [icon]="props.icon"
1564
+ [showTime]="props.showTime || false"
1565
+ [showIcon]="props.showIcon || true"
1566
+ [showButtonBar]="props.showButtonBar"
1567
+ [showOtherMonths]="props.showOtherMonths"
1568
+ [selectOtherMonths]="props.selectOtherMonths"
1569
+ [selectionMode]="props.selectionMode || 'single'"
1570
+ [numberOfMonths]="props.numberOfMonths || 0"
1571
+ [inline]="props.inline"
1572
+ [readonlyInput]="props.readonlyInput"
1573
+ [touchUI]="props.touchUI"
1574
+ [formControl]="formControl"
1575
+ [formlyAttributes]="field"
1576
+ [placeholder]="(props['placeholder'] ?? '') | translate"
1577
+ [styleClass]="'w-full rounded-none block text-base'"
1578
+ appendTo="body"
1579
+ (onSelect)="onDateSelect($event)"
1580
+ (onBlur)="onTouched()"
1581
+ ></p-datepicker>
1582
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2$3.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FormlyFormFieldModule }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
260
1583
  }
261
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericCrudDialog, decorators: [{
1584
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldDatepicker, decorators: [{
262
1585
  type: Component,
263
- args: [{ selector: 'app-generic-crud-dialog', standalone: true, imports: [
1586
+ args: [{
1587
+ selector: 'formly-field-primeng-datepicker',
1588
+ template: `
1589
+ <p-datepicker
1590
+ [dataType]="props.dataType ?? 'string'"
1591
+ [dateFormat]="props.dateFormat ?? (props.showTime ? 'yy-mm-dd' : 'yy-mm-dd')"
1592
+ [hourFormat]="props.hourFormat || '12'"
1593
+ [timeOnly]="props.timeOnly || false"
1594
+ [icon]="props.icon"
1595
+ [showTime]="props.showTime || false"
1596
+ [showIcon]="props.showIcon || true"
1597
+ [showButtonBar]="props.showButtonBar"
1598
+ [showOtherMonths]="props.showOtherMonths"
1599
+ [selectOtherMonths]="props.selectOtherMonths"
1600
+ [selectionMode]="props.selectionMode || 'single'"
1601
+ [numberOfMonths]="props.numberOfMonths || 0"
1602
+ [inline]="props.inline"
1603
+ [readonlyInput]="props.readonlyInput"
1604
+ [touchUI]="props.touchUI"
1605
+ [formControl]="formControl"
1606
+ [formlyAttributes]="field"
1607
+ [placeholder]="(props['placeholder'] ?? '') | translate"
1608
+ [styleClass]="'w-full rounded-none block text-base'"
1609
+ appendTo="body"
1610
+ (onSelect)="onDateSelect($event)"
1611
+ (onBlur)="onTouched()"
1612
+ ></p-datepicker>
1613
+ `,
1614
+ changeDetection: ChangeDetectionStrategy.OnPush,
1615
+ standalone: true,
1616
+ imports: [
264
1617
  CommonModule,
265
1618
  ReactiveFormsModule,
266
- FormlyPrimeNGModule,
267
- ButtonModule,
268
- ProgressSpinnerModule,
269
- MessageModule,
270
- GenericButton, // إضافة المكون العام للأزرار
271
- GenericFormlyFields,
1619
+ DatePickerModule,
1620
+ FormlyFormFieldModule,
1621
+ FormlyAttributes,
272
1622
  TranslateModule,
273
- GenericErrormessage
274
- ], template: " <div class=\"p-4\">\n @if (errorMessage) {\n <lib-generic-errormessage [text]=\"errorMessage\"></lib-generic-errormessage>\n }\n\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <!-- \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0645\u0643\u0648\u0646 \u0627\u0644\u0639\u0627\u0645 \u0644\u0644\u062D\u0642\u0648\u0644 -->\n <lib-generic-formly-fields\n [form]=\"form\"\n [fields]=\"fields\"\n [model]=\"model\"\n [options]=\"options\">\n </lib-generic-formly-fields>\n\n <div class=\"flex justify-end gap-2 mt-4\">\n\n <!-- \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0645\u0643\u0648\u0646 \u0627\u0644\u0639\u0627\u0645 \u0644\u0644\u0623\u0632\u0631\u0627\u0631 - \u0632\u0631 \u0627\u0644\u062D\u0641\u0638 -->\n <lib-generic-button\n variant=\"raised\"\n severity=\"primary\"\n type=\"submit\"\n [loading]=\"loading\"\n [disabled]=\"loading || form.invalid\"\n [label]=\"(id ? 'COMMON.UPDATE' : 'COMMON.SAVE') | translate\">\n </lib-generic-button>\n <!-- \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0645\u0643\u0648\u0646 \u0627\u0644\u0639\u0627\u0645 \u0644\u0644\u0623\u0632\u0631\u0627\u0631 - \u0632\u0631 \u0627\u0644\u0625\u0644\u063A\u0627\u0621 -->\n <lib-generic-button\n variant=\"text\"\n severity=\"secondary\"\n [disabled]=\"loading\"\n [label]=\"'COMMON.CANCEL' | translate\"\n (clicked)=\"ref.close(false)\">\n </lib-generic-button>\n\n </div>\n </form>\n </div>\n", styles: [":host{display:block}button{min-width:120px}\n"] }]
275
- }], ctorParameters: () => [{ type: i1$1.DynamicDialogRef }, { type: i1$1.DynamicDialogConfig }] });
1623
+ ],
1624
+ }]
1625
+ }] });
1626
+
1627
+ function withFormlyFieldDatepicker() {
1628
+ return {
1629
+ types: [
1630
+ {
1631
+ name: 'datepicker',
1632
+ component: FormlyFieldDatepicker,
1633
+ wrappers: ['form-field'],
1634
+ },
1635
+ ],
1636
+ };
1637
+ }
1638
+
1639
+ class FormlyDatepickerModule {
1640
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1641
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyDatepickerModule, imports: [CommonModule,
1642
+ ReactiveFormsModule,
1643
+ DatePickerModule,
1644
+ FormlyFormFieldModule, i1$3.FormlyModule] });
1645
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyDatepickerModule, imports: [CommonModule,
1646
+ ReactiveFormsModule,
1647
+ DatePickerModule,
1648
+ FormlyFormFieldModule,
1649
+ FormlyModule.forChild(withFormlyFieldDatepicker())] });
1650
+ }
1651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyDatepickerModule, decorators: [{
1652
+ type: NgModule,
1653
+ args: [{
1654
+ // declarations: [FormlyFieldDatepicker],
1655
+ imports: [
1656
+ CommonModule,
1657
+ ReactiveFormsModule,
1658
+ DatePickerModule,
1659
+ FormlyFormFieldModule,
1660
+ FormlyModule.forChild(withFormlyFieldDatepicker()),
1661
+ ],
1662
+ }]
1663
+ }] });
276
1664
 
277
1665
  class DeactivationReasonFormComponent {
278
1666
  ref;
@@ -327,7 +1715,7 @@ class DeactivationReasonFormComponent {
327
1715
  this.destroy$.next();
328
1716
  this.destroy$.complete();
329
1717
  }
330
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: DeactivationReasonFormComponent, deps: [{ token: i1$1.DynamicDialogRef }, { token: i1$1.DynamicDialogConfig }], target: i0.ɵɵFactoryTarget.Component });
1718
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: DeactivationReasonFormComponent, deps: [{ token: i1$4.DynamicDialogRef }, { token: i1$4.DynamicDialogConfig }], target: i0.ɵɵFactoryTarget.Component });
331
1719
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: DeactivationReasonFormComponent, isStandalone: true, selector: "app-deactivation-reason-form", ngImport: i0, template: `
332
1720
  <form [formGroup]="form" (ngSubmit)="onSubmit()" class="p-4 space-y-4">
333
1721
  <formly-form [form]="form" [fields]="fields" [model]="model"></formly-form>
@@ -351,7 +1739,7 @@ class DeactivationReasonFormComponent {
351
1739
 
352
1740
  </div>
353
1741
  </form>
354
- `, isInline: true, dependencies: [{ kind: "component", type: FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }] });
1742
+ `, isInline: true, dependencies: [{ kind: "component", type: FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3$4.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }] });
355
1743
  }
356
1744
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: DeactivationReasonFormComponent, decorators: [{
357
1745
  type: Component,
@@ -383,79 +1771,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
383
1771
  `,
384
1772
  imports: [FormlyForm, CommonModule, ReactiveFormsModule, FormsModule, TranslateModule, ButtonModule]
385
1773
  }]
386
- }], ctorParameters: () => [{ type: i1$1.DynamicDialogRef }, { type: i1$1.DynamicDialogConfig }] });
387
-
388
- // app/shared/services/swal.service.ts
389
- class SwalService {
390
- /** رسالة تأكيد قبل تنفيذ إجراء */
391
- confirm(title = 'هل أنت متأكد؟', text = 'لن يمكنك التراجع عن هذا الإجراء', confirmButtonText = 'نعم', cancelButtonText = 'إلغاء') {
392
- return Swal.fire({
393
- icon: 'warning',
394
- title,
395
- text,
396
- showCancelButton: true,
397
- confirmButtonText,
398
- cancelButtonText,
399
- // reverseButtons: true,
400
- customClass: {
401
- container: 'swal2-container' // ✅ أضف هذه الفئة
402
- }
403
- });
404
- }
405
- /** رسالة نجاح */
406
- success(title, text, timer = 2000) {
407
- return Swal.fire({
408
- icon: 'success',
409
- title,
410
- text,
411
- timer,
412
- showConfirmButton: false,
413
- customClass: {
414
- container: 'swal2-container' // ✅ أضف هذه الفئة
415
- }
416
- });
417
- }
418
- /** رسالة خطأ */
419
- error(title, text, footer) {
420
- return Swal.fire({
421
- icon: 'error',
422
- title,
423
- text,
424
- footer,
425
- customClass: {
426
- container: 'swal2-container' // ✅ أضف هذه الفئة
427
- }
428
- });
429
- }
430
- /** رسالة معلومات */
431
- info(title, text) {
432
- return Swal.fire({
433
- icon: 'info',
434
- title,
435
- text,
436
- });
437
- }
438
- /** عرض نافذة SweetAlert2 بأي خيارات تريد */
439
- alert(options) {
440
- return Swal.fire(options);
441
- }
442
- /** Toast بسيط قابل لإعادة الاستخدام */
443
- toast(title, icon = 'info', position = 'top-end', timer = 3000) {
444
- const Toast = Swal.mixin({
445
- toast: true,
446
- position,
447
- timer,
448
- showConfirmButton: false,
449
- });
450
- Toast.fire({ icon, title });
451
- }
452
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
453
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, providedIn: 'root' });
454
- }
455
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, decorators: [{
456
- type: Injectable,
457
- args: [{ providedIn: 'root' }]
458
- }] });
1774
+ }], ctorParameters: () => [{ type: i1$4.DynamicDialogRef }, { type: i1$4.DynamicDialogConfig }] });
459
1775
 
460
1776
  // src/app/shared/components/base-crud.component.ts
461
1777
  class BaseCrud {
@@ -632,24 +1948,6 @@ class BaseCrud {
632
1948
  this.isEditMode = false;
633
1949
  }
634
1950
  }
635
- openDialog(item) {
636
- this.dialogRef = this.dialogService.open((GenericCrudDialog), {
637
- header: item ? 'تعديل' : 'اضافه',
638
- styleClass: 'w-1/2',
639
- modal: true,
640
- data: {
641
- item,
642
- fields: this.formFields,
643
- service: this.service,
644
- idField: this.idField
645
- }
646
- });
647
- //
648
- this.dialogRef.onClose.subscribe((reload) => {
649
- if (reload)
650
- this.loadPage(0, this.rows);
651
- });
652
- }
653
1951
  openDeactivationReason(model) {
654
1952
  this.selectedItem = model;
655
1953
  if (this.selectedItem.isActive == true) {
@@ -762,48 +2060,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
762
2060
  type: Directive
763
2061
  }] });
764
2062
 
765
- class InputWithIconType extends FieldType {
766
- get type() {
767
- return this.to.type || 'text';
768
- }
769
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: InputWithIconType, deps: null, target: i0.ɵɵFactoryTarget.Component });
770
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: InputWithIconType, isStandalone: true, selector: "formly-field-input-with-icon", usesInheritance: true, ngImport: i0, template: `
771
- <div class="relative">
772
- <!-- [formControl]="formControl" -->
773
- <input
774
- [type]="type"
775
-
776
- [formlyAttributes]="field"
777
- class="w-full rounded-xl border border-gray-200 bg-gray-50 pl-12 pr-4 py-3 text-sm focus:border-primary focus:ring-2 focus:ring-blue-100 transition-all"
778
- [placeholder]="to.placeholder"
779
- [disabled]="to.disabled ? true : false"
780
- />
781
- <i class="{{ to['icon'] }} absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 text-base"></i>
782
- </div>
783
- `, isInline: true, dependencies: [{ kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }] });
784
- }
785
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: InputWithIconType, decorators: [{
786
- type: Component,
787
- args: [{
788
- selector: 'formly-field-input-with-icon',
789
- imports: [FormlyAttributes, ReactiveFormsModule, CommonModule, FormsModule],
790
- template: `
791
- <div class="relative">
792
- <!-- [formControl]="formControl" -->
793
- <input
794
- [type]="type"
795
-
796
- [formlyAttributes]="field"
797
- class="w-full rounded-xl border border-gray-200 bg-gray-50 pl-12 pr-4 py-3 text-sm focus:border-primary focus:ring-2 focus:ring-blue-100 transition-all"
798
- [placeholder]="to.placeholder"
799
- [disabled]="to.disabled ? true : false"
800
- />
801
- <i class="{{ to['icon'] }} absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 text-base"></i>
802
- </div>
803
- `,
804
- }]
805
- }] });
806
-
807
2063
  const DEFAULT_CONTROL_CLASS = [
808
2064
  'w-full',
809
2065
  'border',
@@ -983,9 +2239,12 @@ function checkboxField(key, label, required = false, className = 'col-span-1') {
983
2239
  };
984
2240
  }
985
2241
 
2242
+ // export * from './lib/components';
2243
+ // export * from './lib/components/InputWithIconType';
2244
+
986
2245
  /**
987
2246
  * Generated bundle index. Do not edit.
988
2247
  */
989
2248
 
990
- export { BaseCrud, DEFAULT_CONTROL_CLASS, InputWithIconType, checkboxField, numberField, selectField, textField, textField2, textareaField };
2249
+ export { AttachmentDto, AutofocusDirective, BaseCrud, BaseService, CORE_OPTIONS, DEFAULT_CONTROL_CLASS, ENVIRONMENT, FormlyCheckboxModule, FormlyDatepickerModule, FormlyFieldCheckbox, FormlyFieldInput, FormlyFieldRadio, FormlyFieldSelect, FormlyFieldTextArea, FormlyFormFieldModule, FormlyInputModule, FormlyRadioModule, FormlySelectModule, FormlyTextAreaModule, FormlyWrapperFormField, GeneralResponse, GenericService, ListResultDto, PagedResultDto, REQUEST, Rest, RestService, RtlLang, SsrCookieService, SwalService, TafqeetPipe, TimeAgoWithFullDatePipe, checkHasProp, checkboxField, coreOptionsFactory, isUndefinedOrEmptyString, numberField, provideEnvironmentConfig, selectField, textField, textField2, textareaField, withFormlyFieldCheckbox, withFormlyFieldDatepicker, withFormlyFieldInput, withFormlyFieldRadio, withFormlyFieldSelect, withFormlyFieldTextArea, withFormlyFormField };
991
2250
  //# sourceMappingURL=elite.framework-ng.core.mjs.map