@masterteam/system-settings 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/i18n/ar.json +42 -1
- package/assets/i18n/en.json +41 -0
- package/assets/system-settings.css +1 -1
- package/fesm2022/masterteam-system-settings.mjs +393 -6
- package/fesm2022/masterteam-system-settings.mjs.map +1 -1
- package/package.json +3 -3
- package/types/masterteam-system-settings.d.ts +155 -2
|
@@ -22,6 +22,9 @@ import { DateField } from '@masterteam/components/date-field';
|
|
|
22
22
|
import { FieldValidation } from '@masterteam/components/field-validation';
|
|
23
23
|
import { TextField } from '@masterteam/components/text-field';
|
|
24
24
|
import { Table } from '@masterteam/components/table';
|
|
25
|
+
import { NumberField } from '@masterteam/components/number-field';
|
|
26
|
+
import { TextareaField } from '@masterteam/components/textarea-field';
|
|
27
|
+
import { ToggleField } from '@masterteam/components/toggle-field';
|
|
25
28
|
|
|
26
29
|
class SystemSettingsGeneralSection {
|
|
27
30
|
timezoneForm = input.required(...(ngDevMode ? [{ debugName: "timezoneForm" }] : /* istanbul ignore next */ []));
|
|
@@ -184,6 +187,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
184
187
|
args: [{ selector: 'mt-system-settings-smtp-section', imports: [ReactiveFormsModule, TranslocoDirective, Card, TextField], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'system-settings'\">\r\n <mt-card class=\"block\">\r\n <div [formGroup]=\"smtpForm()\" class=\"space-y-4\">\r\n <div class=\"space-y-1\">\r\n <h4 class=\"text-base font-semibold text-neutral-900\">\r\n {{ t(\"smtp-title\") }}\r\n </h4>\r\n <p class=\"text-sm text-neutral-600\">\r\n {{ t(\"smtp-description\") }}\r\n </p>\r\n </div>\r\n\r\n <div class=\"grid gap-4 md:grid-cols-2\">\r\n <mt-text-field\r\n formControlName=\"mail\"\r\n [label]=\"t('smtp-mail')\"\r\n [placeholder]=\"t('smtp-mail-placeholder')\"\r\n type=\"email\"\r\n />\r\n\r\n <mt-text-field\r\n formControlName=\"name\"\r\n [label]=\"t('smtp-name')\"\r\n [placeholder]=\"t('smtp-name-placeholder')\"\r\n />\r\n\r\n <mt-text-field\r\n formControlName=\"host\"\r\n [label]=\"t('smtp-host')\"\r\n [placeholder]=\"t('smtp-host-placeholder')\"\r\n />\r\n\r\n <mt-text-field\r\n formControlName=\"port\"\r\n [label]=\"t('smtp-port')\"\r\n [placeholder]=\"t('smtp-port-placeholder')\"\r\n type=\"number\"\r\n />\r\n\r\n <div class=\"md:col-span-2\">\r\n <mt-text-field\r\n formControlName=\"password\"\r\n [label]=\"t('smtp-password')\"\r\n [placeholder]=\"t('smtp-password-placeholder')\"\r\n type=\"password\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n </mt-card>\r\n</ng-container>\r\n", styles: [":host{display:block}\n"] }]
|
|
185
188
|
}], propDecorators: { smtpForm: [{ type: i0.Input, args: [{ isSignal: true, alias: "smtpForm", required: true }] }] } });
|
|
186
189
|
|
|
190
|
+
class SystemSettingsTimeSheetSection {
|
|
191
|
+
policyForm = input.required(...(ngDevMode ? [{ debugName: "policyForm" }] : /* istanbul ignore next */ []));
|
|
192
|
+
globalWorkingHoursForm = input.required(...(ngDevMode ? [{ debugName: "globalWorkingHoursForm" }] : /* istanbul ignore next */ []));
|
|
193
|
+
dayOptions = input([], ...(ngDevMode ? [{ debugName: "dayOptions" }] : /* istanbul ignore next */ []));
|
|
194
|
+
scheduleItemTypeOptions = input([], ...(ngDevMode ? [{ debugName: "scheduleItemTypeOptions" }] : /* istanbul ignore next */ []));
|
|
195
|
+
rateSourceOptions = input([], ...(ngDevMode ? [{ debugName: "rateSourceOptions" }] : /* istanbul ignore next */ []));
|
|
196
|
+
timezoneOptions = input([], ...(ngDevMode ? [{ debugName: "timezoneOptions" }] : /* istanbul ignore next */ []));
|
|
197
|
+
allowOvertimeControl = computed(() => this.policyForm().get('allowOvertime'), ...(ngDevMode ? [{ debugName: "allowOvertimeControl" }] : /* istanbul ignore next */ []));
|
|
198
|
+
costEnabledControl = computed(() => this.policyForm().get('costEnabled'), ...(ngDevMode ? [{ debugName: "costEnabledControl" }] : /* istanbul ignore next */ []));
|
|
199
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SystemSettingsTimeSheetSection, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
200
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: SystemSettingsTimeSheetSection, isStandalone: true, selector: "mt-system-settings-timesheet-section", inputs: { policyForm: { classPropertyName: "policyForm", publicName: "policyForm", isSignal: true, isRequired: true, transformFunction: null }, globalWorkingHoursForm: { classPropertyName: "globalWorkingHoursForm", publicName: "globalWorkingHoursForm", isSignal: true, isRequired: true, transformFunction: null }, dayOptions: { classPropertyName: "dayOptions", publicName: "dayOptions", isSignal: true, isRequired: false, transformFunction: null }, scheduleItemTypeOptions: { classPropertyName: "scheduleItemTypeOptions", publicName: "scheduleItemTypeOptions", isSignal: true, isRequired: false, transformFunction: null }, rateSourceOptions: { classPropertyName: "rateSourceOptions", publicName: "rateSourceOptions", isSignal: true, isRequired: false, transformFunction: null }, timezoneOptions: { classPropertyName: "timezoneOptions", publicName: "timezoneOptions", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'system-settings'\">\n <div class=\"grid gap-6 xl:grid-cols-2\">\n <mt-card class=\"block\">\n <div [formGroup]=\"policyForm()\" class=\"space-y-5\">\n <div class=\"space-y-1\">\n <h4 class=\"text-base font-semibold text-neutral-900\">\n {{ t(\"timesheet-policy-title\") }}\n </h4>\n <p class=\"text-sm text-neutral-600\">\n {{ t(\"timesheet-policy-description\") }}\n </p>\n </div>\n\n <div\n class=\"rounded-lg border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-800\"\n >\n {{ t(\"timesheet-policy-workflow-note\") }}\n </div>\n\n <div class=\"grid gap-4 md:grid-cols-2\">\n <mt-select-field\n formControlName=\"weekStartDay\"\n [options]=\"dayOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'dayNumber'\"\n [label]=\"t('week-start-day')\"\n [placeholder]=\"t('week-start-day-placeholder')\"\n [required]=\"true\"\n />\n\n <mt-multi-select-field\n formControlName=\"allowedScheduleItemTypes\"\n [options]=\"scheduleItemTypeOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'itemType'\"\n [label]=\"t('allowed-schedule-item-types')\"\n [placeholder]=\"t('allowed-schedule-item-types-placeholder')\"\n [display]=\"'chip'\"\n [required]=\"true\"\n [showClear]=\"true\"\n />\n\n <mt-number-field\n formControlName=\"regularDailyHours\"\n [label]=\"t('regular-daily-hours')\"\n [placeholder]=\"t('regular-daily-hours-placeholder')\"\n [min]=\"0\"\n [max]=\"24\"\n [required]=\"true\"\n />\n\n <mt-number-field\n formControlName=\"maxDailyHours\"\n [label]=\"t('max-daily-hours')\"\n [placeholder]=\"t('max-daily-hours-placeholder')\"\n [min]=\"1\"\n [max]=\"24\"\n [required]=\"true\"\n />\n\n <mt-number-field\n formControlName=\"pastEntryLockDays\"\n [label]=\"t('past-entry-lock-days')\"\n [placeholder]=\"t('past-entry-lock-days-placeholder')\"\n [min]=\"0\"\n [max]=\"3650\"\n />\n\n <mt-select-field\n formControlName=\"rateSource\"\n [options]=\"rateSourceOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'id'\"\n [label]=\"t('rate-source')\"\n [placeholder]=\"t('rate-source-placeholder')\"\n [required]=\"true\"\n />\n </div>\n\n <div class=\"grid gap-3 md:grid-cols-2\">\n <mt-toggle-field\n formControlName=\"generationEnabled\"\n [label]=\"t('generation-enabled')\"\n />\n <mt-toggle-field\n formControlName=\"manualGenerationEnabled\"\n [label]=\"t('manual-generation-enabled')\"\n />\n <mt-toggle-field\n formControlName=\"allowOvertime\"\n [label]=\"t('allow-overtime')\"\n />\n <mt-toggle-field\n formControlName=\"requireOvertimeReason\"\n [label]=\"t('require-overtime-reason')\"\n />\n <mt-toggle-field\n formControlName=\"requireDescription\"\n [label]=\"t('require-description')\"\n />\n <mt-toggle-field\n formControlName=\"allowFutureEntry\"\n [label]=\"t('allow-future-entry')\"\n />\n <mt-toggle-field\n formControlName=\"assignedItemsOnly\"\n [label]=\"t('assigned-items-only')\"\n />\n <mt-toggle-field\n formControlName=\"allowZeroHourSubmit\"\n [label]=\"t('allow-zero-hour-submit')\"\n />\n <mt-toggle-field\n formControlName=\"costEnabled\"\n [label]=\"t('cost-enabled')\"\n />\n </div>\n </div>\n </mt-card>\n\n <mt-card class=\"block\">\n <div [formGroup]=\"globalWorkingHoursForm()\" class=\"space-y-5\">\n <div class=\"space-y-1\">\n <h4 class=\"text-base font-semibold text-neutral-900\">\n {{ t(\"global-working-hours-title\") }}\n </h4>\n <p class=\"text-sm text-neutral-600\">\n {{ t(\"global-working-hours-description\") }}\n </p>\n </div>\n\n <div class=\"grid gap-4 md:grid-cols-2\">\n <mt-select-field\n class=\"md:col-span-2\"\n formControlName=\"timeZoneId\"\n [options]=\"timezoneOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'id'\"\n [label]=\"t('global-timezone')\"\n [placeholder]=\"t('global-timezone-placeholder')\"\n [filter]=\"true\"\n [required]=\"true\"\n />\n\n <mt-text-field\n formControlName=\"workDayStart\"\n type=\"time\"\n [label]=\"t('work-day-start')\"\n [placeholder]=\"t('work-day-start-placeholder')\"\n [required]=\"true\"\n />\n\n <mt-text-field\n formControlName=\"workDayEnd\"\n type=\"time\"\n [label]=\"t('work-day-end')\"\n [placeholder]=\"t('work-day-end-placeholder')\"\n [required]=\"true\"\n />\n\n <mt-multi-select-field\n class=\"md:col-span-2\"\n formControlName=\"workingDays\"\n [options]=\"dayOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'dayNumber'\"\n [label]=\"t('working-days')\"\n [placeholder]=\"t('working-days-placeholder')\"\n [display]=\"'chip'\"\n [required]=\"true\"\n [showClear]=\"true\"\n />\n\n <mt-textarea-field\n class=\"md:col-span-2\"\n formControlName=\"holidaysCsv\"\n [label]=\"t('global-holidays')\"\n [placeholder]=\"t('global-holidays-placeholder')\"\n rows=\"3\"\n />\n </div>\n </div>\n </mt-card>\n </div>\n</ng-container>\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { kind: "component", type: MultiSelectField, selector: "mt-multi-select-field", inputs: ["field", "label", "placeholder", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "display", "required", "maxSelectedLabels", "group", "optionGroupLabel", "optionGroupChildren", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape"], outputs: ["onChange"] }, { kind: "component", type: NumberField, selector: "mt-number-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "hint", "label", "placeholder", "hasPlaceholderPrefix", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "clearAfterSelect", "required", "group", "size", "optionGroupLabel", "optionGroupChildren", "loading", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape", "markCurrentUser"], outputs: ["onChange"] }, { kind: "component", type: TextareaField, selector: "mt-textarea-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "noErrorStyle", "pInputs", "rows", "required", "maxLength"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "inputId", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
201
|
+
}
|
|
202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SystemSettingsTimeSheetSection, decorators: [{
|
|
203
|
+
type: Component,
|
|
204
|
+
args: [{ selector: 'mt-system-settings-timesheet-section', imports: [
|
|
205
|
+
ReactiveFormsModule,
|
|
206
|
+
TranslocoDirective,
|
|
207
|
+
Card,
|
|
208
|
+
MultiSelectField,
|
|
209
|
+
NumberField,
|
|
210
|
+
SelectField,
|
|
211
|
+
TextareaField,
|
|
212
|
+
TextField,
|
|
213
|
+
ToggleField,
|
|
214
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'system-settings'\">\n <div class=\"grid gap-6 xl:grid-cols-2\">\n <mt-card class=\"block\">\n <div [formGroup]=\"policyForm()\" class=\"space-y-5\">\n <div class=\"space-y-1\">\n <h4 class=\"text-base font-semibold text-neutral-900\">\n {{ t(\"timesheet-policy-title\") }}\n </h4>\n <p class=\"text-sm text-neutral-600\">\n {{ t(\"timesheet-policy-description\") }}\n </p>\n </div>\n\n <div\n class=\"rounded-lg border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-800\"\n >\n {{ t(\"timesheet-policy-workflow-note\") }}\n </div>\n\n <div class=\"grid gap-4 md:grid-cols-2\">\n <mt-select-field\n formControlName=\"weekStartDay\"\n [options]=\"dayOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'dayNumber'\"\n [label]=\"t('week-start-day')\"\n [placeholder]=\"t('week-start-day-placeholder')\"\n [required]=\"true\"\n />\n\n <mt-multi-select-field\n formControlName=\"allowedScheduleItemTypes\"\n [options]=\"scheduleItemTypeOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'itemType'\"\n [label]=\"t('allowed-schedule-item-types')\"\n [placeholder]=\"t('allowed-schedule-item-types-placeholder')\"\n [display]=\"'chip'\"\n [required]=\"true\"\n [showClear]=\"true\"\n />\n\n <mt-number-field\n formControlName=\"regularDailyHours\"\n [label]=\"t('regular-daily-hours')\"\n [placeholder]=\"t('regular-daily-hours-placeholder')\"\n [min]=\"0\"\n [max]=\"24\"\n [required]=\"true\"\n />\n\n <mt-number-field\n formControlName=\"maxDailyHours\"\n [label]=\"t('max-daily-hours')\"\n [placeholder]=\"t('max-daily-hours-placeholder')\"\n [min]=\"1\"\n [max]=\"24\"\n [required]=\"true\"\n />\n\n <mt-number-field\n formControlName=\"pastEntryLockDays\"\n [label]=\"t('past-entry-lock-days')\"\n [placeholder]=\"t('past-entry-lock-days-placeholder')\"\n [min]=\"0\"\n [max]=\"3650\"\n />\n\n <mt-select-field\n formControlName=\"rateSource\"\n [options]=\"rateSourceOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'id'\"\n [label]=\"t('rate-source')\"\n [placeholder]=\"t('rate-source-placeholder')\"\n [required]=\"true\"\n />\n </div>\n\n <div class=\"grid gap-3 md:grid-cols-2\">\n <mt-toggle-field\n formControlName=\"generationEnabled\"\n [label]=\"t('generation-enabled')\"\n />\n <mt-toggle-field\n formControlName=\"manualGenerationEnabled\"\n [label]=\"t('manual-generation-enabled')\"\n />\n <mt-toggle-field\n formControlName=\"allowOvertime\"\n [label]=\"t('allow-overtime')\"\n />\n <mt-toggle-field\n formControlName=\"requireOvertimeReason\"\n [label]=\"t('require-overtime-reason')\"\n />\n <mt-toggle-field\n formControlName=\"requireDescription\"\n [label]=\"t('require-description')\"\n />\n <mt-toggle-field\n formControlName=\"allowFutureEntry\"\n [label]=\"t('allow-future-entry')\"\n />\n <mt-toggle-field\n formControlName=\"assignedItemsOnly\"\n [label]=\"t('assigned-items-only')\"\n />\n <mt-toggle-field\n formControlName=\"allowZeroHourSubmit\"\n [label]=\"t('allow-zero-hour-submit')\"\n />\n <mt-toggle-field\n formControlName=\"costEnabled\"\n [label]=\"t('cost-enabled')\"\n />\n </div>\n </div>\n </mt-card>\n\n <mt-card class=\"block\">\n <div [formGroup]=\"globalWorkingHoursForm()\" class=\"space-y-5\">\n <div class=\"space-y-1\">\n <h4 class=\"text-base font-semibold text-neutral-900\">\n {{ t(\"global-working-hours-title\") }}\n </h4>\n <p class=\"text-sm text-neutral-600\">\n {{ t(\"global-working-hours-description\") }}\n </p>\n </div>\n\n <div class=\"grid gap-4 md:grid-cols-2\">\n <mt-select-field\n class=\"md:col-span-2\"\n formControlName=\"timeZoneId\"\n [options]=\"timezoneOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'id'\"\n [label]=\"t('global-timezone')\"\n [placeholder]=\"t('global-timezone-placeholder')\"\n [filter]=\"true\"\n [required]=\"true\"\n />\n\n <mt-text-field\n formControlName=\"workDayStart\"\n type=\"time\"\n [label]=\"t('work-day-start')\"\n [placeholder]=\"t('work-day-start-placeholder')\"\n [required]=\"true\"\n />\n\n <mt-text-field\n formControlName=\"workDayEnd\"\n type=\"time\"\n [label]=\"t('work-day-end')\"\n [placeholder]=\"t('work-day-end-placeholder')\"\n [required]=\"true\"\n />\n\n <mt-multi-select-field\n class=\"md:col-span-2\"\n formControlName=\"workingDays\"\n [options]=\"dayOptions()\"\n [optionLabel]=\"'name'\"\n [optionValue]=\"'dayNumber'\"\n [label]=\"t('working-days')\"\n [placeholder]=\"t('working-days-placeholder')\"\n [display]=\"'chip'\"\n [required]=\"true\"\n [showClear]=\"true\"\n />\n\n <mt-textarea-field\n class=\"md:col-span-2\"\n formControlName=\"holidaysCsv\"\n [label]=\"t('global-holidays')\"\n [placeholder]=\"t('global-holidays-placeholder')\"\n rows=\"3\"\n />\n </div>\n </div>\n </mt-card>\n </div>\n</ng-container>\n" }]
|
|
215
|
+
}], propDecorators: { policyForm: [{ type: i0.Input, args: [{ isSignal: true, alias: "policyForm", required: true }] }], globalWorkingHoursForm: [{ type: i0.Input, args: [{ isSignal: true, alias: "globalWorkingHoursForm", required: true }] }], dayOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "dayOptions", required: false }] }], scheduleItemTypeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "scheduleItemTypeOptions", required: false }] }], rateSourceOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rateSourceOptions", required: false }] }], timezoneOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "timezoneOptions", required: false }] }] } });
|
|
216
|
+
|
|
187
217
|
const FIXED_CURRENCIES = [
|
|
188
218
|
{
|
|
189
219
|
code: 'SAR',
|
|
@@ -266,6 +296,24 @@ const WEEKEND_DAY_DEFINITIONS = [
|
|
|
266
296
|
{ dayNumber: 6, translationKey: 'saturday' },
|
|
267
297
|
{ dayNumber: 7, translationKey: 'sunday' },
|
|
268
298
|
];
|
|
299
|
+
const DOTNET_DAY_DEFINITIONS = [
|
|
300
|
+
{ dayNumber: 0, translationKey: 'sunday' },
|
|
301
|
+
{ dayNumber: 1, translationKey: 'monday' },
|
|
302
|
+
{ dayNumber: 2, translationKey: 'tuesday' },
|
|
303
|
+
{ dayNumber: 3, translationKey: 'wednesday' },
|
|
304
|
+
{ dayNumber: 4, translationKey: 'thursday' },
|
|
305
|
+
{ dayNumber: 5, translationKey: 'friday' },
|
|
306
|
+
{ dayNumber: 6, translationKey: 'saturday' },
|
|
307
|
+
];
|
|
308
|
+
const SCHEDULE_ITEM_TYPE_OPTIONS = [
|
|
309
|
+
{ itemType: 'Task', translationKey: 'schedule-item-task' },
|
|
310
|
+
{ itemType: 'Milestone', translationKey: 'schedule-item-milestone' },
|
|
311
|
+
{ itemType: 'Deliverable', translationKey: 'schedule-item-deliverable' },
|
|
312
|
+
];
|
|
313
|
+
const RATE_SOURCE_OPTIONS = [
|
|
314
|
+
{ id: 'UserHourlyRate', translationKey: 'rate-source-user-hourly-rate' },
|
|
315
|
+
{ id: 'None', translationKey: 'rate-source-none' },
|
|
316
|
+
];
|
|
269
317
|
|
|
270
318
|
class SystemSettings {
|
|
271
319
|
http = inject(HttpClient);
|
|
@@ -310,6 +358,53 @@ class SystemSettings {
|
|
|
310
358
|
host: new FormControl('', { nonNullable: true }),
|
|
311
359
|
port: new FormControl('', { nonNullable: true }),
|
|
312
360
|
}),
|
|
361
|
+
timeSheetPolicy: new FormGroup({
|
|
362
|
+
weekStartDay: new FormControl(null, Validators.required),
|
|
363
|
+
generationEnabled: new FormControl(true, { nonNullable: true }),
|
|
364
|
+
manualGenerationEnabled: new FormControl(true, { nonNullable: true }),
|
|
365
|
+
regularDailyHours: new FormControl(8, [
|
|
366
|
+
Validators.required,
|
|
367
|
+
Validators.min(0),
|
|
368
|
+
Validators.max(24),
|
|
369
|
+
]),
|
|
370
|
+
maxDailyHours: new FormControl(24, [
|
|
371
|
+
Validators.required,
|
|
372
|
+
Validators.min(1),
|
|
373
|
+
Validators.max(24),
|
|
374
|
+
]),
|
|
375
|
+
allowOvertime: new FormControl(true, { nonNullable: true }),
|
|
376
|
+
requireOvertimeReason: new FormControl(false, { nonNullable: true }),
|
|
377
|
+
requireDescription: new FormControl(false, { nonNullable: true }),
|
|
378
|
+
allowFutureEntry: new FormControl(true, { nonNullable: true }),
|
|
379
|
+
pastEntryLockDays: new FormControl(null, [
|
|
380
|
+
Validators.min(0),
|
|
381
|
+
Validators.max(3650),
|
|
382
|
+
]),
|
|
383
|
+
allowedScheduleItemTypes: new FormControl(['Deliverable'], {
|
|
384
|
+
nonNullable: true,
|
|
385
|
+
validators: [Validators.required],
|
|
386
|
+
}),
|
|
387
|
+
assignedItemsOnly: new FormControl(false, { nonNullable: true }),
|
|
388
|
+
allowZeroHourSubmit: new FormControl(true, { nonNullable: true }),
|
|
389
|
+
costEnabled: new FormControl(true, { nonNullable: true }),
|
|
390
|
+
rateSource: new FormControl('UserHourlyRate', Validators.required),
|
|
391
|
+
}),
|
|
392
|
+
globalWorkingHours: new FormGroup({
|
|
393
|
+
timeZoneId: new FormControl(null, Validators.required),
|
|
394
|
+
workDayStart: new FormControl('08:00', {
|
|
395
|
+
nonNullable: true,
|
|
396
|
+
validators: [Validators.required],
|
|
397
|
+
}),
|
|
398
|
+
workDayEnd: new FormControl('16:00', {
|
|
399
|
+
nonNullable: true,
|
|
400
|
+
validators: [Validators.required],
|
|
401
|
+
}),
|
|
402
|
+
workingDays: new FormControl([0, 1, 2, 3, 4], {
|
|
403
|
+
nonNullable: true,
|
|
404
|
+
validators: [Validators.required],
|
|
405
|
+
}),
|
|
406
|
+
holidaysCsv: new FormControl('', { nonNullable: true }),
|
|
407
|
+
}),
|
|
313
408
|
});
|
|
314
409
|
settings = signal(null, ...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
|
|
315
410
|
settingsLoading = signal(false, ...(ngDevMode ? [{ debugName: "settingsLoading" }] : /* istanbul ignore next */ []));
|
|
@@ -346,6 +441,8 @@ class SystemSettings {
|
|
|
346
441
|
currencySetting = computed(() => this.findSettingByKey('Currency'), ...(ngDevMode ? [{ debugName: "currencySetting" }] : /* istanbul ignore next */ []));
|
|
347
442
|
weekendSetting = computed(() => this.findSettingByKey('Weekend'), ...(ngDevMode ? [{ debugName: "weekendSetting" }] : /* istanbul ignore next */ []));
|
|
348
443
|
smtpSetting = computed(() => this.findSettingByKey('SMTP'), ...(ngDevMode ? [{ debugName: "smtpSetting" }] : /* istanbul ignore next */ []));
|
|
444
|
+
timeSheetPolicySetting = computed(() => this.findSettingByKey('TimeSheetPolicy'), ...(ngDevMode ? [{ debugName: "timeSheetPolicySetting" }] : /* istanbul ignore next */ []));
|
|
445
|
+
globalWorkingHoursSetting = computed(() => this.findSettingByKey('GlobalWorkingHours'), ...(ngDevMode ? [{ debugName: "globalWorkingHoursSetting" }] : /* istanbul ignore next */ []));
|
|
349
446
|
resolvedFormatSchema = computed(() => {
|
|
350
447
|
const schema = this.formatSchema();
|
|
351
448
|
return {
|
|
@@ -378,6 +475,29 @@ class SystemSettings {
|
|
|
378
475
|
name: this.transloco.translate(`system-settings.${day.translationKey}`),
|
|
379
476
|
}));
|
|
380
477
|
}, ...(ngDevMode ? [{ debugName: "weekendOptions" }] : /* istanbul ignore next */ []));
|
|
478
|
+
dotnetDayOptions = computed(() => {
|
|
479
|
+
this.activeLang();
|
|
480
|
+
return DOTNET_DAY_DEFINITIONS.map((day) => ({
|
|
481
|
+
id: `${day.dayNumber}`,
|
|
482
|
+
dayNumber: day.dayNumber,
|
|
483
|
+
name: this.transloco.translate(`system-settings.${day.translationKey}`),
|
|
484
|
+
}));
|
|
485
|
+
}, ...(ngDevMode ? [{ debugName: "dotnetDayOptions" }] : /* istanbul ignore next */ []));
|
|
486
|
+
scheduleItemTypeOptions = computed(() => {
|
|
487
|
+
this.activeLang();
|
|
488
|
+
return SCHEDULE_ITEM_TYPE_OPTIONS.map((item) => ({
|
|
489
|
+
id: item.itemType,
|
|
490
|
+
itemType: item.itemType,
|
|
491
|
+
name: this.transloco.translate(`system-settings.${item.translationKey}`),
|
|
492
|
+
}));
|
|
493
|
+
}, ...(ngDevMode ? [{ debugName: "scheduleItemTypeOptions" }] : /* istanbul ignore next */ []));
|
|
494
|
+
rateSourceOptions = computed(() => {
|
|
495
|
+
this.activeLang();
|
|
496
|
+
return RATE_SOURCE_OPTIONS.map((item) => ({
|
|
497
|
+
id: item.id,
|
|
498
|
+
name: this.transloco.translate(`system-settings.${item.translationKey}`),
|
|
499
|
+
}));
|
|
500
|
+
}, ...(ngDevMode ? [{ debugName: "rateSourceOptions" }] : /* istanbul ignore next */ []));
|
|
381
501
|
isReady = computed(() => this.hydrationVersion() !== null && this.initialSnapshot() !== null, ...(ngDevMode ? [{ debugName: "isReady" }] : /* istanbul ignore next */ []));
|
|
382
502
|
isLoading = computed(() => this.settingsLoading() || this.timezonesLoading() || !this.isReady(), ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
|
|
383
503
|
hasChanges = computed(() => {
|
|
@@ -395,7 +515,9 @@ class SystemSettings {
|
|
|
395
515
|
!this.areEqual(initial.timezone, current.timezone) ||
|
|
396
516
|
!this.areEqual(initial.currency, current.currency) ||
|
|
397
517
|
!this.areEqual(initial.weekend, current.weekend) ||
|
|
398
|
-
!this.areEqual(initial.smtp, current.smtp)
|
|
518
|
+
!this.areEqual(initial.smtp, current.smtp) ||
|
|
519
|
+
!this.areEqual(initial.timeSheetPolicy, current.timeSheetPolicy) ||
|
|
520
|
+
!this.areEqual(initial.globalWorkingHours, current.globalWorkingHours));
|
|
399
521
|
}, ...(ngDevMode ? [{ debugName: "hasChanges" }] : /* istanbul ignore next */ []));
|
|
400
522
|
canSaveSettings = computed(() => !this.isLoading() &&
|
|
401
523
|
!this.updating() &&
|
|
@@ -423,7 +545,9 @@ class SystemSettings {
|
|
|
423
545
|
if (version === this.hydrationVersion()) {
|
|
424
546
|
return;
|
|
425
547
|
}
|
|
426
|
-
this.hydrateForm(this.holidaysSetting() ?? this.createFallbackSetting('Holidays'), this.timezoneSetting() ?? this.createFallbackSetting('Timezone'), this.currencySetting() ?? this.createFallbackSetting('Currency'), this.weekendSetting() ?? this.createFallbackSetting('Weekend'), this.smtpSetting() ?? this.createFallbackSetting('SMTP'))
|
|
548
|
+
this.hydrateForm(this.holidaysSetting() ?? this.createFallbackSetting('Holidays'), this.timezoneSetting() ?? this.createFallbackSetting('Timezone'), this.currencySetting() ?? this.createFallbackSetting('Currency'), this.weekendSetting() ?? this.createFallbackSetting('Weekend'), this.smtpSetting() ?? this.createFallbackSetting('SMTP'), this.timeSheetPolicySetting() ??
|
|
549
|
+
this.createFallbackSetting('TimeSheetPolicy'), this.globalWorkingHoursSetting() ??
|
|
550
|
+
this.createFallbackSetting('GlobalWorkingHours'));
|
|
427
551
|
this.hydrationVersion.set(version);
|
|
428
552
|
});
|
|
429
553
|
}
|
|
@@ -521,6 +645,18 @@ class SystemSettings {
|
|
|
521
645
|
value: nextSnapshot.smtp,
|
|
522
646
|
});
|
|
523
647
|
}
|
|
648
|
+
if (!this.areEqual(initialSnapshot.timeSheetPolicy, nextSnapshot.timeSheetPolicy)) {
|
|
649
|
+
values.push({
|
|
650
|
+
key: 'TimeSheetPolicy',
|
|
651
|
+
value: nextSnapshot.timeSheetPolicy,
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
if (!this.areEqual(initialSnapshot.globalWorkingHours, nextSnapshot.globalWorkingHours)) {
|
|
655
|
+
values.push({
|
|
656
|
+
key: 'GlobalWorkingHours',
|
|
657
|
+
value: nextSnapshot.globalWorkingHours,
|
|
658
|
+
});
|
|
659
|
+
}
|
|
524
660
|
if (!values.length) {
|
|
525
661
|
this.toast.info(this.transloco.translate('system-settings.no-changes-message'));
|
|
526
662
|
return;
|
|
@@ -582,12 +718,14 @@ class SystemSettings {
|
|
|
582
718
|
},
|
|
583
719
|
});
|
|
584
720
|
}
|
|
585
|
-
hydrateForm(holidaysSetting, timezoneSetting, currencySetting, weekendSetting, smtpSetting) {
|
|
721
|
+
hydrateForm(holidaysSetting, timezoneSetting, currencySetting, weekendSetting, smtpSetting, timeSheetPolicySetting, globalWorkingHoursSetting) {
|
|
586
722
|
const holidays = this.extractHolidaysValue(holidaysSetting);
|
|
587
723
|
const timezone = this.normalizeTimezoneSnapshot(this.extractTimezoneValue(timezoneSetting));
|
|
588
724
|
const currency = this.normalizeCurrencySnapshot(this.extractCurrencyValue(currencySetting));
|
|
589
725
|
const weekend = this.normalizeWeekendSnapshot(this.extractWeekendValue(weekendSetting));
|
|
590
726
|
const smtp = this.normalizeSmtpSnapshot(this.extractSmtpValue(smtpSetting));
|
|
727
|
+
const timeSheetPolicy = this.normalizeTimeSheetPolicySnapshot(this.extractTimeSheetPolicyValue(timeSheetPolicySetting));
|
|
728
|
+
const globalWorkingHours = this.normalizeGlobalWorkingHoursSnapshot(this.extractGlobalWorkingHoursValue(globalWorkingHoursSetting));
|
|
591
729
|
this.holidayItems.set(holidays.data);
|
|
592
730
|
this.form.controls.timezone.setValue({
|
|
593
731
|
regionId: timezone.region?.id ?? null,
|
|
@@ -608,6 +746,30 @@ class SystemSettings {
|
|
|
608
746
|
host: smtp.host,
|
|
609
747
|
port: smtp.port === null ? '' : String(smtp.port),
|
|
610
748
|
});
|
|
749
|
+
this.form.controls.timeSheetPolicy.setValue({
|
|
750
|
+
weekStartDay: timeSheetPolicy.weekStartDay,
|
|
751
|
+
generationEnabled: timeSheetPolicy.generationEnabled,
|
|
752
|
+
manualGenerationEnabled: timeSheetPolicy.manualGenerationEnabled,
|
|
753
|
+
regularDailyHours: timeSheetPolicy.regularDailyHours,
|
|
754
|
+
maxDailyHours: timeSheetPolicy.maxDailyHours,
|
|
755
|
+
allowOvertime: timeSheetPolicy.allowOvertime,
|
|
756
|
+
requireOvertimeReason: timeSheetPolicy.requireOvertimeReason,
|
|
757
|
+
requireDescription: timeSheetPolicy.requireDescription,
|
|
758
|
+
allowFutureEntry: timeSheetPolicy.allowFutureEntry,
|
|
759
|
+
pastEntryLockDays: timeSheetPolicy.pastEntryLockDays,
|
|
760
|
+
allowedScheduleItemTypes: timeSheetPolicy.allowedScheduleItemTypes,
|
|
761
|
+
assignedItemsOnly: timeSheetPolicy.assignedItemsOnly,
|
|
762
|
+
allowZeroHourSubmit: timeSheetPolicy.allowZeroHourSubmit,
|
|
763
|
+
costEnabled: timeSheetPolicy.costEnabled,
|
|
764
|
+
rateSource: timeSheetPolicy.rateSource,
|
|
765
|
+
});
|
|
766
|
+
this.form.controls.globalWorkingHours.setValue({
|
|
767
|
+
timeZoneId: globalWorkingHours.timeZoneId,
|
|
768
|
+
workDayStart: minutesToTime(globalWorkingHours.workDayStartMinute),
|
|
769
|
+
workDayEnd: minutesToTime(globalWorkingHours.workDayEndMinute),
|
|
770
|
+
workingDays: globalWorkingHours.workingDays,
|
|
771
|
+
holidaysCsv: globalWorkingHours.holidays.join(', '),
|
|
772
|
+
});
|
|
611
773
|
this.form.markAsPristine();
|
|
612
774
|
this.form.markAsUntouched();
|
|
613
775
|
this.initialSnapshot.set({
|
|
@@ -616,6 +778,8 @@ class SystemSettings {
|
|
|
616
778
|
currency,
|
|
617
779
|
weekend,
|
|
618
780
|
smtp,
|
|
781
|
+
timeSheetPolicy,
|
|
782
|
+
globalWorkingHours,
|
|
619
783
|
});
|
|
620
784
|
}
|
|
621
785
|
buildCurrentSnapshot() {
|
|
@@ -636,6 +800,8 @@ class SystemSettings {
|
|
|
636
800
|
currency,
|
|
637
801
|
weekend: this.buildWeekendValue(),
|
|
638
802
|
smtp: this.buildSmtpValue(),
|
|
803
|
+
timeSheetPolicy: this.buildTimeSheetPolicyValue(),
|
|
804
|
+
globalWorkingHours: this.buildGlobalWorkingHoursValue(),
|
|
639
805
|
};
|
|
640
806
|
}
|
|
641
807
|
buildTimezoneValue() {
|
|
@@ -688,6 +854,40 @@ class SystemSettings {
|
|
|
688
854
|
port: parsePort(smtpForm.port),
|
|
689
855
|
};
|
|
690
856
|
}
|
|
857
|
+
buildTimeSheetPolicyValue() {
|
|
858
|
+
const policyForm = this.form.controls.timeSheetPolicy.getRawValue();
|
|
859
|
+
return {
|
|
860
|
+
weekStartDay: policyForm.weekStartDay ?? 0,
|
|
861
|
+
generationEnabled: policyForm.generationEnabled,
|
|
862
|
+
manualGenerationEnabled: policyForm.manualGenerationEnabled,
|
|
863
|
+
regularDailyHours: policyForm.regularDailyHours ?? 8,
|
|
864
|
+
maxDailyHours: policyForm.maxDailyHours ?? 24,
|
|
865
|
+
allowOvertime: policyForm.allowOvertime,
|
|
866
|
+
requireOvertimeReason: policyForm.allowOvertime
|
|
867
|
+
? policyForm.requireOvertimeReason
|
|
868
|
+
: false,
|
|
869
|
+
requireDescription: policyForm.requireDescription,
|
|
870
|
+
allowFutureEntry: policyForm.allowFutureEntry,
|
|
871
|
+
pastEntryLockDays: policyForm.pastEntryLockDays,
|
|
872
|
+
allowedScheduleItemTypes: policyForm.allowedScheduleItemTypes,
|
|
873
|
+
assignedItemsOnly: policyForm.assignedItemsOnly,
|
|
874
|
+
allowZeroHourSubmit: policyForm.allowZeroHourSubmit,
|
|
875
|
+
costEnabled: policyForm.costEnabled,
|
|
876
|
+
rateSource: policyForm.costEnabled
|
|
877
|
+
? (policyForm.rateSource ?? 'UserHourlyRate')
|
|
878
|
+
: 'None',
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
buildGlobalWorkingHoursValue() {
|
|
882
|
+
const globalForm = this.form.controls.globalWorkingHours.getRawValue();
|
|
883
|
+
return {
|
|
884
|
+
timeZoneId: globalForm.timeZoneId ?? 'UTC',
|
|
885
|
+
workDayStartMinute: timeToMinutes(globalForm.workDayStart),
|
|
886
|
+
workDayEndMinute: timeToMinutes(globalForm.workDayEnd),
|
|
887
|
+
workingDays: normalizeDotnetDays(globalForm.workingDays),
|
|
888
|
+
holidays: parseCsv(globalForm.holidaysCsv),
|
|
889
|
+
};
|
|
890
|
+
}
|
|
691
891
|
findSettingByKey(key) {
|
|
692
892
|
const normalizedKey = key.trim().toLowerCase();
|
|
693
893
|
return (this.settings()?.find((setting) => setting.key.trim().toLowerCase() === normalizedKey) ?? null);
|
|
@@ -754,6 +954,53 @@ class SystemSettings {
|
|
|
754
954
|
port: getNullableNumber(setting.value['port'] ?? setting.value['Port']),
|
|
755
955
|
};
|
|
756
956
|
}
|
|
957
|
+
extractTimeSheetPolicyValue(setting) {
|
|
958
|
+
if (!isRecord(setting.value)) {
|
|
959
|
+
return this.getDefaultTimeSheetPolicyValue();
|
|
960
|
+
}
|
|
961
|
+
const defaults = this.getDefaultTimeSheetPolicyValue();
|
|
962
|
+
return {
|
|
963
|
+
weekStartDay: getNumber(setting.value['weekStartDay']) ?? defaults.weekStartDay,
|
|
964
|
+
generationEnabled: getBoolean(setting.value['generationEnabled']) ??
|
|
965
|
+
defaults.generationEnabled,
|
|
966
|
+
manualGenerationEnabled: getBoolean(setting.value['manualGenerationEnabled']) ??
|
|
967
|
+
defaults.manualGenerationEnabled,
|
|
968
|
+
regularDailyHours: getNumber(setting.value['regularDailyHours']) ??
|
|
969
|
+
defaults.regularDailyHours,
|
|
970
|
+
maxDailyHours: getNumber(setting.value['maxDailyHours']) ?? defaults.maxDailyHours,
|
|
971
|
+
allowOvertime: getBoolean(setting.value['allowOvertime']) ?? defaults.allowOvertime,
|
|
972
|
+
requireOvertimeReason: getBoolean(setting.value['requireOvertimeReason']) ??
|
|
973
|
+
defaults.requireOvertimeReason,
|
|
974
|
+
requireDescription: getBoolean(setting.value['requireDescription']) ??
|
|
975
|
+
defaults.requireDescription,
|
|
976
|
+
allowFutureEntry: getBoolean(setting.value['allowFutureEntry']) ??
|
|
977
|
+
defaults.allowFutureEntry,
|
|
978
|
+
pastEntryLockDays: getNullableNumber(setting.value['pastEntryLockDays']),
|
|
979
|
+
allowedScheduleItemTypes: getStringArray(setting.value['allowedScheduleItemTypes']) ??
|
|
980
|
+
defaults.allowedScheduleItemTypes,
|
|
981
|
+
assignedItemsOnly: getBoolean(setting.value['assignedItemsOnly']) ??
|
|
982
|
+
defaults.assignedItemsOnly,
|
|
983
|
+
allowZeroHourSubmit: getBoolean(setting.value['allowZeroHourSubmit']) ??
|
|
984
|
+
defaults.allowZeroHourSubmit,
|
|
985
|
+
costEnabled: getBoolean(setting.value['costEnabled']) ?? defaults.costEnabled,
|
|
986
|
+
rateSource: getString(setting.value['rateSource']) ?? defaults.rateSource,
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
extractGlobalWorkingHoursValue(setting) {
|
|
990
|
+
if (!isRecord(setting.value)) {
|
|
991
|
+
return this.getDefaultGlobalWorkingHoursValue();
|
|
992
|
+
}
|
|
993
|
+
const defaults = this.getDefaultGlobalWorkingHoursValue();
|
|
994
|
+
return {
|
|
995
|
+
timeZoneId: getString(setting.value['timeZoneId']) ?? defaults.timeZoneId,
|
|
996
|
+
workDayStartMinute: getNumber(setting.value['workDayStartMinute']) ??
|
|
997
|
+
defaults.workDayStartMinute,
|
|
998
|
+
workDayEndMinute: getNumber(setting.value['workDayEndMinute']) ??
|
|
999
|
+
defaults.workDayEndMinute,
|
|
1000
|
+
workingDays: getNumberArray(setting.value['workingDays']) ?? defaults.workingDays,
|
|
1001
|
+
holidays: getStringArray(setting.value['holidays']) ?? defaults.holidays,
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
757
1004
|
normalizeHolidayItem(value) {
|
|
758
1005
|
if (!isRecord(value)) {
|
|
759
1006
|
return null;
|
|
@@ -847,6 +1094,36 @@ class SystemSettings {
|
|
|
847
1094
|
port: value.port,
|
|
848
1095
|
};
|
|
849
1096
|
}
|
|
1097
|
+
normalizeTimeSheetPolicySnapshot(value) {
|
|
1098
|
+
const defaults = this.getDefaultTimeSheetPolicyValue();
|
|
1099
|
+
const regularDailyHours = clampNumber(value.regularDailyHours, 0, 24);
|
|
1100
|
+
const maxDailyHours = Math.max(regularDailyHours, clampNumber(value.maxDailyHours, 1, 24));
|
|
1101
|
+
const allowedScheduleItemTypes = value.allowedScheduleItemTypes.length
|
|
1102
|
+
? value.allowedScheduleItemTypes
|
|
1103
|
+
: defaults.allowedScheduleItemTypes;
|
|
1104
|
+
return {
|
|
1105
|
+
...defaults,
|
|
1106
|
+
...value,
|
|
1107
|
+
weekStartDay: clampNumber(value.weekStartDay, 0, 6),
|
|
1108
|
+
regularDailyHours,
|
|
1109
|
+
maxDailyHours,
|
|
1110
|
+
pastEntryLockDays: value.pastEntryLockDays === null
|
|
1111
|
+
? null
|
|
1112
|
+
: clampNumber(value.pastEntryLockDays, 0, 3650),
|
|
1113
|
+
allowedScheduleItemTypes,
|
|
1114
|
+
rateSource: value.rateSource || defaults.rateSource,
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
normalizeGlobalWorkingHoursSnapshot(value) {
|
|
1118
|
+
const defaults = this.getDefaultGlobalWorkingHoursValue();
|
|
1119
|
+
return {
|
|
1120
|
+
timeZoneId: value.timeZoneId || defaults.timeZoneId,
|
|
1121
|
+
workDayStartMinute: clampNumber(value.workDayStartMinute, 0, 1439),
|
|
1122
|
+
workDayEndMinute: clampNumber(value.workDayEndMinute, 1, 1440),
|
|
1123
|
+
workingDays: normalizeDotnetDays(value.workingDays),
|
|
1124
|
+
holidays: value.holidays,
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
850
1127
|
createFallbackSetting(key) {
|
|
851
1128
|
switch (key) {
|
|
852
1129
|
case 'Holidays':
|
|
@@ -874,6 +1151,20 @@ class SystemSettings {
|
|
|
874
1151
|
description: key,
|
|
875
1152
|
value: this.getDefaultSmtpValue(),
|
|
876
1153
|
};
|
|
1154
|
+
case 'TimeSheetPolicy':
|
|
1155
|
+
return {
|
|
1156
|
+
key,
|
|
1157
|
+
label: key,
|
|
1158
|
+
description: key,
|
|
1159
|
+
value: this.getDefaultTimeSheetPolicyValue(),
|
|
1160
|
+
};
|
|
1161
|
+
case 'GlobalWorkingHours':
|
|
1162
|
+
return {
|
|
1163
|
+
key,
|
|
1164
|
+
label: key,
|
|
1165
|
+
description: key,
|
|
1166
|
+
value: this.getDefaultGlobalWorkingHoursValue(),
|
|
1167
|
+
};
|
|
877
1168
|
}
|
|
878
1169
|
}
|
|
879
1170
|
getDefaultTimezoneValue() {
|
|
@@ -912,6 +1203,34 @@ class SystemSettings {
|
|
|
912
1203
|
port: null,
|
|
913
1204
|
};
|
|
914
1205
|
}
|
|
1206
|
+
getDefaultTimeSheetPolicyValue() {
|
|
1207
|
+
return {
|
|
1208
|
+
weekStartDay: 0,
|
|
1209
|
+
generationEnabled: true,
|
|
1210
|
+
manualGenerationEnabled: true,
|
|
1211
|
+
regularDailyHours: 8,
|
|
1212
|
+
maxDailyHours: 24,
|
|
1213
|
+
allowOvertime: true,
|
|
1214
|
+
requireOvertimeReason: false,
|
|
1215
|
+
requireDescription: false,
|
|
1216
|
+
allowFutureEntry: true,
|
|
1217
|
+
pastEntryLockDays: null,
|
|
1218
|
+
allowedScheduleItemTypes: ['Deliverable'],
|
|
1219
|
+
assignedItemsOnly: false,
|
|
1220
|
+
allowZeroHourSubmit: true,
|
|
1221
|
+
costEnabled: true,
|
|
1222
|
+
rateSource: 'UserHourlyRate',
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
getDefaultGlobalWorkingHoursValue() {
|
|
1226
|
+
return {
|
|
1227
|
+
timeZoneId: this.timezones()[0]?.id ?? 'UTC',
|
|
1228
|
+
workDayStartMinute: 480,
|
|
1229
|
+
workDayEndMinute: 960,
|
|
1230
|
+
workingDays: [0, 1, 2, 3, 4],
|
|
1231
|
+
holidays: [],
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
915
1234
|
resolveCurrencyCode(value) {
|
|
916
1235
|
const candidates = [value.name, value.unit.en, value.unit.ar].filter((candidate) => !!candidate);
|
|
917
1236
|
for (const candidate of candidates) {
|
|
@@ -1001,7 +1320,7 @@ class SystemSettings {
|
|
|
1001
1320
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
1002
1321
|
}
|
|
1003
1322
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SystemSettings, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1004
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: SystemSettings, isStandalone: true, selector: "mt-system-settings", inputs: { apiBasePath: { classPropertyName: "apiBasePath", publicName: "apiBasePath", isSignal: true, isRequired: false, transformFunction: null }, backRoute: { classPropertyName: "backRoute", publicName: "backRoute", isSignal: true, isRequired: false, transformFunction: null }, formatSchema: { classPropertyName: "formatSchema", publicName: "formatSchema", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'system-settings'\">\r\n <mt-page\r\n [title]=\"t('page-title')\"\r\n [avatarIcon]=\"'general.settings-02'\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-emerald-100)',\r\n '--p-avatar-color': 'var(--p-emerald-700)',\r\n }\"\r\n (backButtonClick)=\"goBack()\"\r\n backButton\r\n >\r\n <div class=\"flex flex-col gap-3\">\r\n <div\r\n class=\"flex flex-col gap-4 md:flex-row md:items-end md:justify-between\"\r\n >\r\n <div>\r\n <h3 class=\"text-lg font-bold text-neutral-900\">\r\n {{ t(\"page-title\") }}\r\n </h3>\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems\"\r\n [styleClass]=\"'flex justify-start mx-1'\"\r\n />\r\n </div>\r\n\r\n <mt-button\r\n [label]=\"t('save')\"\r\n icon=\"general.save-01\"\r\n [tooltip]=\"t('save-tooltip')\"\r\n [badge]=\"hasChanges() ? '!' : ''\"\r\n badgeSeverity=\"warn\"\r\n [loading]=\"updating()\"\r\n [disabled]=\"!canSaveSettings()\"\r\n (onClick)=\"onSave()\"\r\n />\r\n </div>\r\n\r\n @if (isLoading()) {\r\n <div class=\"space-y-4\">\r\n <p-skeleton width=\"100%\" height=\"12rem\" borderRadius=\"0.75rem\" />\r\n <p-skeleton width=\"100%\" height=\"18rem\" borderRadius=\"0.75rem\" />\r\n <p-skeleton width=\"100%\" height=\"14rem\" borderRadius=\"0.75rem\" />\r\n </div>\r\n } @else {\r\n <div class=\"space-y-4\">\r\n @if (timezonesError(); as timezonesErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n >\r\n {{ timezonesErrorMessage }}\r\n </div>\r\n }\r\n\r\n @if (settingsError(); as settingsErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800\"\r\n >\r\n {{ settingsErrorMessage }}\r\n </div>\r\n }\r\n\r\n @if (updateError(); as saveErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n >\r\n {{ saveErrorMessage }}\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"space-y-6\">\r\n <mt-system-settings-holidays-section\r\n [holidays]=\"holidayTableRows()\"\r\n (addHoliday)=\"openAddHoliday()\"\r\n (editHoliday)=\"editHoliday($event)\"\r\n (deleteHoliday)=\"deleteHoliday($event)\"\r\n />\r\n\r\n <mt-system-settings-general-section\r\n [timezoneForm]=\"form.controls.timezone\"\r\n [currencyForm]=\"form.controls.currency\"\r\n [weekendForm]=\"form.controls.weekend\"\r\n [timezoneOptions]=\"timezoneOptions()\"\r\n [dateFormatOptions]=\"dateFormatOptions()\"\r\n [timeFormatOptions]=\"timeFormatOptions()\"\r\n [currencyOptions]=\"currencyOptions()\"\r\n [currencyFormatOptions]=\"currencyFormatOptions()\"\r\n [weekendOptions]=\"weekendOptions()\"\r\n />\r\n\r\n <mt-system-settings-smtp-section [smtpForm]=\"form.controls.smtp\" />\r\n </div>\r\n }\r\n </div>\r\n </mt-page>\r\n</ng-container>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Breadcrumb, selector: "mt-breadcrumb", inputs: ["items", "styleClass"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: SystemSettingsHolidaysSection, selector: "mt-system-settings-holidays-section", inputs: ["holidays"], outputs: ["addHoliday", "editHoliday", "deleteHoliday"] }, { kind: "component", type: SystemSettingsGeneralSection, selector: "mt-system-settings-general-section", inputs: ["timezoneForm", "currencyForm", "weekendForm", "timezoneOptions", "dateFormatOptions", "timeFormatOptions", "currencyOptions", "currencyFormatOptions", "weekendOptions"] }, { kind: "component", type: SystemSettingsSmtpSection, selector: "mt-system-settings-smtp-section", inputs: ["smtpForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1323
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: SystemSettings, isStandalone: true, selector: "mt-system-settings", inputs: { apiBasePath: { classPropertyName: "apiBasePath", publicName: "apiBasePath", isSignal: true, isRequired: false, transformFunction: null }, backRoute: { classPropertyName: "backRoute", publicName: "backRoute", isSignal: true, isRequired: false, transformFunction: null }, formatSchema: { classPropertyName: "formatSchema", publicName: "formatSchema", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'system-settings'\">\r\n <mt-page\r\n [title]=\"t('page-title')\"\r\n [avatarIcon]=\"'general.settings-02'\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-emerald-100)',\r\n '--p-avatar-color': 'var(--p-emerald-700)',\r\n }\"\r\n (backButtonClick)=\"goBack()\"\r\n backButton\r\n >\r\n <div class=\"flex flex-col gap-3\">\r\n <div\r\n class=\"flex flex-col gap-4 md:flex-row md:items-end md:justify-between\"\r\n >\r\n <div>\r\n <h3 class=\"text-lg font-bold text-neutral-900\">\r\n {{ t(\"page-title\") }}\r\n </h3>\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems\"\r\n [styleClass]=\"'flex justify-start mx-1'\"\r\n />\r\n </div>\r\n\r\n <mt-button\r\n [label]=\"t('save')\"\r\n icon=\"general.save-01\"\r\n [tooltip]=\"t('save-tooltip')\"\r\n [badge]=\"hasChanges() ? '!' : ''\"\r\n badgeSeverity=\"warn\"\r\n [loading]=\"updating()\"\r\n [disabled]=\"!canSaveSettings()\"\r\n (onClick)=\"onSave()\"\r\n />\r\n </div>\r\n\r\n @if (isLoading()) {\r\n <div class=\"space-y-4\">\r\n <p-skeleton width=\"100%\" height=\"12rem\" borderRadius=\"0.75rem\" />\r\n <p-skeleton width=\"100%\" height=\"18rem\" borderRadius=\"0.75rem\" />\r\n <p-skeleton width=\"100%\" height=\"14rem\" borderRadius=\"0.75rem\" />\r\n </div>\r\n } @else {\r\n <div class=\"space-y-4\">\r\n @if (timezonesError(); as timezonesErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n >\r\n {{ timezonesErrorMessage }}\r\n </div>\r\n }\r\n\r\n @if (settingsError(); as settingsErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800\"\r\n >\r\n {{ settingsErrorMessage }}\r\n </div>\r\n }\r\n\r\n @if (updateError(); as saveErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n >\r\n {{ saveErrorMessage }}\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"space-y-6\">\r\n <mt-system-settings-holidays-section\r\n [holidays]=\"holidayTableRows()\"\r\n (addHoliday)=\"openAddHoliday()\"\r\n (editHoliday)=\"editHoliday($event)\"\r\n (deleteHoliday)=\"deleteHoliday($event)\"\r\n />\r\n\r\n <mt-system-settings-general-section\r\n [timezoneForm]=\"form.controls.timezone\"\r\n [currencyForm]=\"form.controls.currency\"\r\n [weekendForm]=\"form.controls.weekend\"\r\n [timezoneOptions]=\"timezoneOptions()\"\r\n [dateFormatOptions]=\"dateFormatOptions()\"\r\n [timeFormatOptions]=\"timeFormatOptions()\"\r\n [currencyOptions]=\"currencyOptions()\"\r\n [currencyFormatOptions]=\"currencyFormatOptions()\"\r\n [weekendOptions]=\"weekendOptions()\"\r\n />\r\n\r\n <mt-system-settings-timesheet-section\r\n [policyForm]=\"form.controls.timeSheetPolicy\"\r\n [globalWorkingHoursForm]=\"form.controls.globalWorkingHours\"\r\n [dayOptions]=\"dotnetDayOptions()\"\r\n [scheduleItemTypeOptions]=\"scheduleItemTypeOptions()\"\r\n [rateSourceOptions]=\"rateSourceOptions()\"\r\n [timezoneOptions]=\"timezoneOptions()\"\r\n />\r\n\r\n <mt-system-settings-smtp-section [smtpForm]=\"form.controls.smtp\" />\r\n </div>\r\n }\r\n </div>\r\n </mt-page>\r\n</ng-container>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Breadcrumb, selector: "mt-breadcrumb", inputs: ["items", "styleClass"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: SystemSettingsHolidaysSection, selector: "mt-system-settings-holidays-section", inputs: ["holidays"], outputs: ["addHoliday", "editHoliday", "deleteHoliday"] }, { kind: "component", type: SystemSettingsGeneralSection, selector: "mt-system-settings-general-section", inputs: ["timezoneForm", "currencyForm", "weekendForm", "timezoneOptions", "dateFormatOptions", "timeFormatOptions", "currencyOptions", "currencyFormatOptions", "weekendOptions"] }, { kind: "component", type: SystemSettingsSmtpSection, selector: "mt-system-settings-smtp-section", inputs: ["smtpForm"] }, { kind: "component", type: SystemSettingsTimeSheetSection, selector: "mt-system-settings-timesheet-section", inputs: ["policyForm", "globalWorkingHoursForm", "dayOptions", "scheduleItemTypeOptions", "rateSourceOptions", "timezoneOptions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1005
1324
|
}
|
|
1006
1325
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SystemSettings, decorators: [{
|
|
1007
1326
|
type: Component,
|
|
@@ -1016,7 +1335,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1016
1335
|
SystemSettingsHolidaysSection,
|
|
1017
1336
|
SystemSettingsGeneralSection,
|
|
1018
1337
|
SystemSettingsSmtpSection,
|
|
1019
|
-
|
|
1338
|
+
SystemSettingsTimeSheetSection,
|
|
1339
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'system-settings'\">\r\n <mt-page\r\n [title]=\"t('page-title')\"\r\n [avatarIcon]=\"'general.settings-02'\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-emerald-100)',\r\n '--p-avatar-color': 'var(--p-emerald-700)',\r\n }\"\r\n (backButtonClick)=\"goBack()\"\r\n backButton\r\n >\r\n <div class=\"flex flex-col gap-3\">\r\n <div\r\n class=\"flex flex-col gap-4 md:flex-row md:items-end md:justify-between\"\r\n >\r\n <div>\r\n <h3 class=\"text-lg font-bold text-neutral-900\">\r\n {{ t(\"page-title\") }}\r\n </h3>\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems\"\r\n [styleClass]=\"'flex justify-start mx-1'\"\r\n />\r\n </div>\r\n\r\n <mt-button\r\n [label]=\"t('save')\"\r\n icon=\"general.save-01\"\r\n [tooltip]=\"t('save-tooltip')\"\r\n [badge]=\"hasChanges() ? '!' : ''\"\r\n badgeSeverity=\"warn\"\r\n [loading]=\"updating()\"\r\n [disabled]=\"!canSaveSettings()\"\r\n (onClick)=\"onSave()\"\r\n />\r\n </div>\r\n\r\n @if (isLoading()) {\r\n <div class=\"space-y-4\">\r\n <p-skeleton width=\"100%\" height=\"12rem\" borderRadius=\"0.75rem\" />\r\n <p-skeleton width=\"100%\" height=\"18rem\" borderRadius=\"0.75rem\" />\r\n <p-skeleton width=\"100%\" height=\"14rem\" borderRadius=\"0.75rem\" />\r\n </div>\r\n } @else {\r\n <div class=\"space-y-4\">\r\n @if (timezonesError(); as timezonesErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n >\r\n {{ timezonesErrorMessage }}\r\n </div>\r\n }\r\n\r\n @if (settingsError(); as settingsErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800\"\r\n >\r\n {{ settingsErrorMessage }}\r\n </div>\r\n }\r\n\r\n @if (updateError(); as saveErrorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n >\r\n {{ saveErrorMessage }}\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"space-y-6\">\r\n <mt-system-settings-holidays-section\r\n [holidays]=\"holidayTableRows()\"\r\n (addHoliday)=\"openAddHoliday()\"\r\n (editHoliday)=\"editHoliday($event)\"\r\n (deleteHoliday)=\"deleteHoliday($event)\"\r\n />\r\n\r\n <mt-system-settings-general-section\r\n [timezoneForm]=\"form.controls.timezone\"\r\n [currencyForm]=\"form.controls.currency\"\r\n [weekendForm]=\"form.controls.weekend\"\r\n [timezoneOptions]=\"timezoneOptions()\"\r\n [dateFormatOptions]=\"dateFormatOptions()\"\r\n [timeFormatOptions]=\"timeFormatOptions()\"\r\n [currencyOptions]=\"currencyOptions()\"\r\n [currencyFormatOptions]=\"currencyFormatOptions()\"\r\n [weekendOptions]=\"weekendOptions()\"\r\n />\r\n\r\n <mt-system-settings-timesheet-section\r\n [policyForm]=\"form.controls.timeSheetPolicy\"\r\n [globalWorkingHoursForm]=\"form.controls.globalWorkingHours\"\r\n [dayOptions]=\"dotnetDayOptions()\"\r\n [scheduleItemTypeOptions]=\"scheduleItemTypeOptions()\"\r\n [rateSourceOptions]=\"rateSourceOptions()\"\r\n [timezoneOptions]=\"timezoneOptions()\"\r\n />\r\n\r\n <mt-system-settings-smtp-section [smtpForm]=\"form.controls.smtp\" />\r\n </div>\r\n }\r\n </div>\r\n </mt-page>\r\n</ng-container>\r\n", styles: [":host{display:block}\n"] }]
|
|
1020
1340
|
}], ctorParameters: () => [], propDecorators: { apiBasePath: [{ type: i0.Input, args: [{ isSignal: true, alias: "apiBasePath", required: false }] }], backRoute: [{ type: i0.Input, args: [{ isSignal: true, alias: "backRoute", required: false }] }], formatSchema: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatSchema", required: false }] }] } });
|
|
1021
1341
|
function isRecord(value) {
|
|
1022
1342
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -1044,6 +1364,40 @@ function getNullableNumber(value) {
|
|
|
1044
1364
|
}
|
|
1045
1365
|
return null;
|
|
1046
1366
|
}
|
|
1367
|
+
function getNumber(value) {
|
|
1368
|
+
return getNullableNumber(value);
|
|
1369
|
+
}
|
|
1370
|
+
function getBoolean(value) {
|
|
1371
|
+
if (typeof value === 'boolean') {
|
|
1372
|
+
return value;
|
|
1373
|
+
}
|
|
1374
|
+
if (typeof value === 'string') {
|
|
1375
|
+
const normalizedValue = value.trim().toLowerCase();
|
|
1376
|
+
if (normalizedValue === 'true') {
|
|
1377
|
+
return true;
|
|
1378
|
+
}
|
|
1379
|
+
if (normalizedValue === 'false') {
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
return null;
|
|
1384
|
+
}
|
|
1385
|
+
function getStringArray(value) {
|
|
1386
|
+
if (!Array.isArray(value)) {
|
|
1387
|
+
return null;
|
|
1388
|
+
}
|
|
1389
|
+
return value
|
|
1390
|
+
.map((item) => (typeof item === 'string' ? item.trim() : ''))
|
|
1391
|
+
.filter(Boolean);
|
|
1392
|
+
}
|
|
1393
|
+
function getNumberArray(value) {
|
|
1394
|
+
if (!Array.isArray(value)) {
|
|
1395
|
+
return null;
|
|
1396
|
+
}
|
|
1397
|
+
return value
|
|
1398
|
+
.map((item) => (typeof item === 'number' ? item : Number(item)))
|
|
1399
|
+
.filter((item) => Number.isInteger(item));
|
|
1400
|
+
}
|
|
1047
1401
|
function parsePort(value) {
|
|
1048
1402
|
const normalizedValue = value.trim();
|
|
1049
1403
|
if (!normalizedValue) {
|
|
@@ -1061,6 +1415,39 @@ function normalizeWeekendDays(value) {
|
|
|
1061
1415
|
.filter((item) => Number.isInteger(item) && item >= 1 && item <= 7)
|
|
1062
1416
|
.sort((left, right) => left - right);
|
|
1063
1417
|
}
|
|
1418
|
+
function normalizeDotnetDays(value) {
|
|
1419
|
+
if (!Array.isArray(value)) {
|
|
1420
|
+
return [];
|
|
1421
|
+
}
|
|
1422
|
+
return Array.from(new Set(value
|
|
1423
|
+
.map((item) => (typeof item === 'number' ? item : Number(item)))
|
|
1424
|
+
.filter((item) => Number.isInteger(item) && item >= 0 && item <= 6))).sort((left, right) => left - right);
|
|
1425
|
+
}
|
|
1426
|
+
function clampNumber(value, min, max) {
|
|
1427
|
+
if (!Number.isFinite(value)) {
|
|
1428
|
+
return min;
|
|
1429
|
+
}
|
|
1430
|
+
return Math.min(Math.max(value, min), max);
|
|
1431
|
+
}
|
|
1432
|
+
function timeToMinutes(value) {
|
|
1433
|
+
const [hours, minutes] = value.split(':').map((part) => Number(part));
|
|
1434
|
+
if (!Number.isInteger(hours) || !Number.isInteger(minutes)) {
|
|
1435
|
+
return 0;
|
|
1436
|
+
}
|
|
1437
|
+
return clampNumber(hours * 60 + minutes, 0, 1440);
|
|
1438
|
+
}
|
|
1439
|
+
function minutesToTime(value) {
|
|
1440
|
+
const normalizedValue = clampNumber(value, 0, 1440);
|
|
1441
|
+
const hours = Math.floor(normalizedValue / 60);
|
|
1442
|
+
const minutes = normalizedValue % 60;
|
|
1443
|
+
return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`;
|
|
1444
|
+
}
|
|
1445
|
+
function parseCsv(value) {
|
|
1446
|
+
return value
|
|
1447
|
+
.split(',')
|
|
1448
|
+
.map((item) => item.trim())
|
|
1449
|
+
.filter(Boolean);
|
|
1450
|
+
}
|
|
1064
1451
|
function normalizeDateInput(value) {
|
|
1065
1452
|
if (value instanceof Date) {
|
|
1066
1453
|
if (Number.isNaN(value.getTime())) {
|
|
@@ -1100,5 +1487,5 @@ function formatDateOnly(value) {
|
|
|
1100
1487
|
* Generated bundle index. Do not edit.
|
|
1101
1488
|
*/
|
|
1102
1489
|
|
|
1103
|
-
export { DEFAULT_DATE_FORMAT_OPTIONS, DEFAULT_TIME_FORMAT_OPTIONS, FIXED_CURRENCIES, SystemSettings, SystemSettingsHolidayEditor, WEEKEND_DAY_DEFINITIONS };
|
|
1490
|
+
export { DEFAULT_DATE_FORMAT_OPTIONS, DEFAULT_TIME_FORMAT_OPTIONS, DOTNET_DAY_DEFINITIONS, FIXED_CURRENCIES, RATE_SOURCE_OPTIONS, SCHEDULE_ITEM_TYPE_OPTIONS, SystemSettings, SystemSettingsHolidayEditor, WEEKEND_DAY_DEFINITIONS };
|
|
1104
1491
|
//# sourceMappingURL=masterteam-system-settings.mjs.map
|