tin-spa 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1199,8 +1199,12 @@ class DataServiceLib {
1199
1199
  { name: 'gender', alias: 'Gender', type: 'select', options: this.genders, required: true },
1200
1200
  { name: 'firstName', type: 'text', required: true },
1201
1201
  { name: 'lastName', type: 'text', required: true },
1202
+ { name: 'dateOfBirth', type: 'date', alias: 'Date of Birth', required: true },
1203
+ { name: 'employmentDate', type: 'date', alias: 'Employment Date', required: true },
1202
1204
  { name: 'departmentID', alias: 'Department', type: 'select', options: [], optionDisplay: 'name', optionValue: 'departmentID' },
1203
1205
  { name: 'positionID', alias: 'Position', type: 'select', options: [], optionDisplay: 'name', optionValue: 'positionID', masterField: 'departmentID', },
1206
+ { name: 'employmentStatus', alias: 'Employment Status', type: 'select', options: [], optionDisplay: 'name', optionValue: 'value' },
1207
+ { name: 'activeStatus', alias: 'Active Status', type: 'select', options: [], optionDisplay: 'name', optionValue: 'value' },
1204
1208
  { name: 'address', type: 'text', rows: 2, span: true },
1205
1209
  { name: 'phone', type: 'text' },
1206
1210
  { name: 'email', type: 'text' },
@@ -1212,12 +1216,12 @@ class DataServiceLib {
1212
1216
  minColumns: ['name', 'departmentName', 'positionName'],
1213
1217
  flatButtons: true,
1214
1218
  columns: [
1215
- { name: 'employeeID', type: 'number', alias: 'ID' },
1216
1219
  { name: 'name', type: 'text' },
1217
- { name: 'nationalID', type: 'text' },
1218
- { name: 'genderName', type: 'text' },
1219
- { name: 'departmentName', type: 'text' },
1220
- { name: 'positionName', type: 'text' },
1220
+ { name: 'genderName', type: 'text', alias: 'Gender' },
1221
+ { name: 'departmentName', type: 'text', alias: 'Department' },
1222
+ { name: 'positionName', type: 'text', alias: 'Position' },
1223
+ { name: 'employmentStatusName', type: 'text', alias: 'Employment Status' },
1224
+ { name: 'activeStatusName', type: 'text', alias: 'Active Status' },
1221
1225
  ],
1222
1226
  buttons: [
1223
1227
  { name: 'create', display: 'Create', dialog: true, action: { url: 'general/employees?action=create', method: 'post' } },
@@ -1415,6 +1419,8 @@ class DataServiceLib {
1415
1419
  this.CallApi({ url: 'general/employeesmeta/x' }, "").subscribe((apiResponse) => {
1416
1420
  this.employeeFormConfig.fields.find(x => x.name == 'departmentID').options = apiResponse.data.departments;
1417
1421
  this.employeeFormConfig.fields.find(x => x.name == 'positionID').masterOptions = apiResponse.data.positions;
1422
+ this.employeeFormConfig.fields.find(x => x.name == 'employmentStatus').options = apiResponse.data.employmentStatuses;
1423
+ this.employeeFormConfig.fields.find(x => x.name == 'activeStatus').options = apiResponse.data.activeStatuses;
1418
1424
  });
1419
1425
  }
1420
1426
  //--------------------------Positions-------------------------
@@ -1868,16 +1874,26 @@ class DateComponent {
1868
1874
  this.placeholder = "";
1869
1875
  this.width = "100%";
1870
1876
  this.valueChange = new EventEmitter();
1871
- this.control = new FormControl(new Date());
1872
1877
  }
1873
1878
  ngOnInit() {
1879
+ this.initializeDateControls();
1880
+ }
1881
+ ngOnChanges(changes) {
1882
+ if (changes['readonly']) {
1883
+ this.updateControlState();
1884
+ }
1885
+ if (changes['value']) {
1886
+ this.control.setValue(new Date(this.value));
1887
+ }
1888
+ }
1889
+ initializeDateControls() {
1874
1890
  this.minDate = new FormControl(new Date(this.min));
1875
1891
  this.maxDate = new FormControl(new Date(this.max));
1876
- if (!this.value || this.value == "") {
1877
- this.control = new FormControl(new Date());
1878
- ;
1879
- }
1880
- setTimeout(() => { this.onChangeEvent(); }, 5);
1892
+ this.control = new FormControl({ value: new Date(this.value), disabled: this.readonly });
1893
+ this.updateControlState();
1894
+ setTimeout(() => this.onChangeEvent(), 5);
1895
+ }
1896
+ updateControlState() {
1881
1897
  if (this.readonly) {
1882
1898
  this.control.disable();
1883
1899
  }
@@ -1885,16 +1901,13 @@ class DateComponent {
1885
1901
  this.control.enable();
1886
1902
  }
1887
1903
  }
1888
- ngOnChanges() {
1889
- this.control = new FormControl(new Date(this.value));
1890
- }
1891
1904
  onChangeEvent() {
1892
- let d = Core.getFormatedDate2(this.control.value, true);
1893
- this.valueChange.emit(d);
1905
+ const formattedDate = Core.getFormatedDate2(this.control.value, true);
1906
+ this.valueChange.emit(formattedDate);
1894
1907
  }
1895
1908
  validate(control) {
1896
1909
  if (control.hasError('matDatepickerMin')) {
1897
- return `Minimun date is ${this.min}`;
1910
+ return `Minimum date is ${this.min}`;
1898
1911
  }
1899
1912
  if (control.hasError('matDatepickerMax')) {
1900
1913
  return `Maximum date is ${this.max}`;
@@ -1903,11 +1916,11 @@ class DateComponent {
1903
1916
  }
1904
1917
  }
1905
1918
  DateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1906
- DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DateComponent, selector: "spa-date", inputs: { required: "required", min: "min", max: "max", readonly: "readonly", hint: "hint", value: "value", display: "display", placeholder: "placeholder", width: "width" }, outputs: { valueChange: "valueChange" }, usesOnChanges: true, ngImport: i0, template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n<input [formControl]=\"control\" [min]=\"minDate.value\" [max]=\"maxDate.value\" matInput [matDatepicker]=\"picker_date\" (dateInput)=\"onChangeEvent()\" [placeholder]=\"display\" [readonly]=\"true\" >\r\n<mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n<mat-datepicker #picker_date></mat-datepicker>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }] });
1919
+ DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DateComponent, selector: "spa-date", inputs: { required: "required", min: "min", max: "max", readonly: "readonly", hint: "hint", value: "value", display: "display", placeholder: "placeholder", width: "width" }, outputs: { valueChange: "valueChange" }, usesOnChanges: true, ngImport: i0, template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n <input [formControl]=\"control\" [min]=\"minDate.value\" [max]=\"maxDate.value\" matInput [matDatepicker]=\"picker_date\" (dateInput)=\"onChangeEvent()\" [placeholder]=\"display\" [readonly]=\"true\">\r\n <mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker_date></mat-datepicker>\r\n <mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }] });
1907
1920
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateComponent, decorators: [{
1908
1921
  type: Component,
1909
- args: [{ selector: 'spa-date', template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n<input [formControl]=\"control\" [min]=\"minDate.value\" [max]=\"maxDate.value\" matInput [matDatepicker]=\"picker_date\" (dateInput)=\"onChangeEvent()\" [placeholder]=\"display\" [readonly]=\"true\" >\r\n<mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n<mat-datepicker #picker_date></mat-datepicker>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n" }]
1910
- }], ctorParameters: function () { return []; }, propDecorators: { required: [{
1922
+ args: [{ selector: 'spa-date', template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n <input [formControl]=\"control\" [min]=\"minDate.value\" [max]=\"maxDate.value\" matInput [matDatepicker]=\"picker_date\" (dateInput)=\"onChangeEvent()\" [placeholder]=\"display\" [readonly]=\"true\">\r\n <mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker_date></mat-datepicker>\r\n <mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n" }]
1923
+ }], propDecorators: { required: [{
1911
1924
  type: Input
1912
1925
  }], min: [{
1913
1926
  type: Input