From: Jane Sandberg Date: Wed, 27 Mar 2019 03:10:37 +0000 (-0700) Subject: adding datetime-select to fmeditor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=de7e0cf56013e1bf9e91e1816d78cfa2d4b81cd4;p=working%2FEvergreen.git adding datetime-select to fmeditor --- diff --git a/Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.html b/Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.html index 96b17e90d4..ee006604b5 100644 --- a/Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.html +++ b/Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.html @@ -43,7 +43,6 @@ [hourStep]="1" [minuteStep]="minuteStep || 15" > - America/Los_Angeles + {{ timezone || 'America/Los_Angeles'}} - diff --git a/Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.ts b/Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.ts index c11ecfac6a..aa8eb98680 100644 --- a/Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.ts +++ b/Open-ILS/src/eg2/src/app/share/datetime-select/datetime-select.component.ts @@ -10,16 +10,16 @@ import { NgbTimeStruct, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'; templateUrl: './datetime-select.component.html' }) export class DateTimeSelectComponent implements OnInit { - @Input() formModel: any; // External model bound back to parent @Input() domId = ''; @Input() fieldName: string; @Input() required: boolean; @Input() minuteStep: number; @Input() showTZ = true; + @Input() timezone: string; @Input() initialIso: string; - @Output() formModelChange = new EventEmitter(); + @Output() onChangeAsIso = new EventEmitter(); dateTime: any; // Used internally on internal input timeModel: NgbTimeStruct; @@ -29,11 +29,11 @@ export class DateTimeSelectComponent implements OnInit { } ngOnInit() { - const start = this.formModel ? Moment(this.formModel) : Moment(); + const start = this.initialIso ? Moment(this.initialIso) : Moment(); this.setDefaultDate(start); this.setDefaultTime(start); - if (this.formModel) { + if (this.initialIso) { this.modelChanged(null); } } @@ -70,7 +70,7 @@ export class DateTimeSelectComponent implements OnInit { // Set component view value this.dateTime = Moment(newDate).format('MM/D/YYYY h:mm A'); // Update form passed in view value - this.formModelChange.emit(Moment(newDate)); + this.onChangeAsIso.emit(Moment(newDate).toISOString); } } diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html index 31a3cd7f17..cacd278058 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html @@ -45,6 +45,14 @@ + + + + + Cancel + diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts index c8933a74e2..007891aa50 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts @@ -109,6 +109,10 @@ export class FmRecordEditorComponent @Input() requiredFieldsList: string[] = []; @Input() requiredFields: string; // comma-separated string version + // list of timezone fields that should display with a timepicker + @Input() datetimeFieldsList: string[] = []; + @Input() datetimeFields: string; // comma-separated string version + // list of org_unit fields where a default value may be applied by // the org-select if no value is present. @Input() orgDefaultAllowedList: string[] = []; @@ -192,6 +196,9 @@ export class FmRecordEditorComponent if (this.requiredFields) { this.requiredFieldsList = this.requiredFields.split(/,/); } + if (this.datetimeFields) { + this.datetimeFieldsList = this.requiredFields.split(/,/); + } if (this.orgDefaultAllowed) { this.orgDefaultAllowedList = this.orgDefaultAllowed.split(/,/); } @@ -355,6 +362,8 @@ export class FmRecordEditorComponent promise = this.wireUpCombobox(field); + } else if (field.datatype === 'timestamp') { + field.datetime = this.datetimeFieldsList.includes(field.name); } else if (field.datatype === 'org_unit') { field.orgDefaultAllowed = this.orgDefaultAllowedList.includes(field.name); @@ -465,6 +474,10 @@ export class FmRecordEditorComponent return 'template'; } + if ( field.datatype === 'timestamp' && field.datetime ) { + return 'timestamp-timepicker'; + } + // Some widgets handle readOnly for us. if ( field.datatype === 'timestamp' || field.datatype === 'org_unit' @@ -477,7 +490,7 @@ export class FmRecordEditorComponent return 'readonly-money'; } - if ((field.datatype === 'link' || field.linkedValues) && field.class === 'au') { + if ((field.datatype === 'link' || field.linkedValues.length) && field.class === 'au') { return 'readonly-au'; } diff --git a/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts index 2f69592932..6f771d0e90 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts @@ -36,7 +36,7 @@ export class ManageReservationsComponent implements OnInit { private router: Router, private pcrud: PcrudService, private patron: PatronService, - private store: ServerStoreService, + private store: ServerStoreService, private toast: ToastService ) { } diff --git a/Open-ILS/src/eg2/src/app/staff/booking/reservations-grid.component.html b/Open-ILS/src/eg2/src/app/staff/booking/reservations-grid.component.html index 1a26a73cbb..7b48afa97c 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/reservations-grid.component.html +++ b/Open-ILS/src/eg2/src/app/staff/booking/reservations-grid.component.html @@ -36,6 +36,7 @@ @@ -46,3 +47,4 @@ +