<fields oils_persist:primary="id">
<field name="dow_0_close" />
<field name="dow_0_open" />
+ <field name="dow_0_note" reporter:datatype="text" />
<field name="dow_1_close" />
<field name="dow_1_open" />
+ <field name="dow_1_note" reporter:datatype="text" />
<field name="dow_2_close" />
<field name="dow_2_open" />
+ <field name="dow_2_note" reporter:datatype="text" />
<field name="dow_3_close" />
<field name="dow_3_open" />
+ <field name="dow_3_note" reporter:datatype="text" />
<field name="dow_4_close" />
<field name="dow_4_open" />
+ <field name="dow_4_note" reporter:datatype="text" />
<field name="dow_5_close" />
<field name="dow_5_open" />
+ <field name="dow_5_note" reporter:datatype="text" />
<field name="dow_6_close" />
<field name="dow_6_open" />
+ <field name="dow_6_note" reporter:datatype="text" />
<field name="id" reporter:datatype="id" />
<field name="org_unit" oils_persist:virtual="true" reporter:datatype="org_unit"/>
</fields>
<div class="row font-weight-bold mb-2">
<div class="col-lg-3 offset-lg-2" i18n>Open Time</div>
<div class="col-lg-3" i18n>Close Time</div>
+ <div class="col-lg-2 offset-lg-2" i18n>Edit Note Field?</div>
</div>
<div class="row mb-2" *ngFor="let dow of [0,1,2,3,4,5,6]">
<div class="col-lg-2" [ngSwitch]="dow">
<button class="btn btn-outline-dark" (click)="closedOn(dow)"
[disabled]="isClosed(dow)" i18n>Closed</button>
</div>
+ <div class="col-lg-2">
+ <input type="checkbox" [(ngModel)]="editNote"/>
+ </div>
+ <div class="col-lg-6 offset-lg-6" *ngIf="editNote">
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="input-group">
+ <div class="input-group-prepend">
+ <div class="input-group-text" i18n>Note: </div>
+ </div>
+ <input class="form-control" type='text'
+ [ngModel]="getNote(dow)"
+ (ngModelChange)="setNote(dow, $event)"
+ placeholder="e.g. 'Closed for lunch from Noon to 1PM'" i18n-placeholder />
+ </div>
+ </div>
+ </div>
+ </div>
</div>
<div class="row d-flex justify-content-end">
<div class="alert alert-warning mr-2 p-1"
// if a 'value' is passed, it will be applied to the optional
// hours-of-operation object, otherwise the hours on the currently
// selected org unit.
- hours(dow: number, which: 'open' | 'close', value?: string, hoo?: IdlObject): string {
+ hours(dow: number, which: 'open' | 'close' | 'note', value?: string, hoo?: IdlObject): string {
if (!hoo && !this.selected) { return null; }
const hours = hoo || this.selected.callerData.orgUnit.hours_of_operation();
this.hours(dow, 'close') === '00:00:00'
);
}
+
+ getNote(dow: number, hoo?: IdlObject) {
+ if (!hoo && !this.selected) { return null; }
+
+ const hours = hoo || this.selected.callerData.orgUnit.hours_of_operation();
+
+ return hours['dow_' + dow + '_note']();
+ }
+
+ setNote(dow: number, value?: string, hoo?: IdlObject) {
+ console.log(value);
+ if (!hoo && !this.selected) { return null; }
+
+ const hours = hoo || this.selected.callerData.orgUnit.hours_of_operation();
+
+ hours['dow_' + dow + '_note'](value);
+ hours.ischanged(true);
+
+ return hours['dow_' + dow + '_note']();
+ }
+
+ note(dow: number, which: 'note', value?: string, hoo?: IdlObject) {
+ if (!hoo && !this.selected) { return null; }
+
+ const hours = hoo || this.selected.callerData.orgUnit.hours_of_operation();
+ if (!value) {
+ hours[`dow_${dow}_${which}`]("");
+ hours.ischanged(true);
+ } else if (value != hours[`dow_${dow}_${which}`]()) {
+ hours[`dow_${dow}_${which}`](value);
+ hours.ischanged(true);
+ }
+ return hours[`dow_${dow}_${which}`]();
+ }
closedOn(dow: number) {
this.hours(dow, 'open', '00:00:00');
id INT PRIMARY KEY REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
dow_0_open TIME NOT NULL DEFAULT '09:00',
dow_0_close TIME NOT NULL DEFAULT '17:00',
+ dow_0_note TEXT,
dow_1_open TIME NOT NULL DEFAULT '09:00',
dow_1_close TIME NOT NULL DEFAULT '17:00',
+ dow_1_note TEXT,
dow_2_open TIME NOT NULL DEFAULT '09:00',
dow_2_close TIME NOT NULL DEFAULT '17:00',
+ dow_2_note TEXT,
dow_3_open TIME NOT NULL DEFAULT '09:00',
dow_3_close TIME NOT NULL DEFAULT '17:00',
+ dow_3_note TEXT,
dow_4_open TIME NOT NULL DEFAULT '09:00',
dow_4_close TIME NOT NULL DEFAULT '17:00',
+ dow_4_note TEXT,
dow_5_open TIME NOT NULL DEFAULT '09:00',
dow_5_close TIME NOT NULL DEFAULT '17:00',
+ dow_5_note TEXT,
dow_6_open TIME NOT NULL DEFAULT '09:00',
- dow_6_close TIME NOT NULL DEFAULT '17:00'
+ dow_6_close TIME NOT NULL DEFAULT '17:00',
+ dow_6_note TEXT
);
COMMENT ON TABLE actor.hours_of_operation IS $$
When does this org_unit usually open and close? (Variations
--- /dev/null
+BEGIN;\r
+\r
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);\r
+\r
+ALTER TABLE actor.hours_of_operation\r
+ ADD COLUMN dow_0_note TEXT,\r
+ ADD COLUMN dow_1_note TEXT,\r
+ ADD COLUMN dow_2_note TEXT,\r
+ ADD COLUMN dow_3_note TEXT,\r
+ ADD COLUMN dow_4_note TEXT,\r
+ ADD COLUMN dow_5_note TEXT,\r
+ ADD COLUMN dow_6_note TEXT;\r
+COMMIT;
\ No newline at end of file
[%-
open = today _ ctx.hours.dow_0_open;
close = today _ ctx.hours.dow_0_close;
+ note = ctx.hours.dow_0_note;
IF open == close;
%]
<div class="opening-hours">[% l('Monday: closed') %]</div>
[%- ELSE %]
<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday" />[%
l('Monday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
- '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
+ '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
+-%]
+[% IF ctx.hours.dow_0_note %]
+ <span>[%l('(' _ note _ ')')%]</span>
+[% END -%]
</div>
[%- END %]
[%-
open = today _ ctx.hours.dow_1_open;
close = today _ ctx.hours.dow_1_close;
+ note = ctx.hours.dow_1_note;
IF open == close;
%]
<div class="opening-hours">[% l('Tuesday: closed') %]</div>
[%- ELSE %]
<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />[%
l('Tuesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
- '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
+ '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
+-%]
+[% IF ctx.hours.dow_1_note %]
+ <span>[%l('(' _ note _ ')')%]</span>
+[% END -%]
</div>
[%- END %]
[%-
open = today _ ctx.hours.dow_2_open;
close = today _ ctx.hours.dow_2_close;
+ note = ctx.hours.dow_2_note;
IF open == close;
%]
<div class="opening-hours">[% l('Wednesday: closed') %]</div>
[%- ELSE %]
<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday" />[%
l('Wednesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
- '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
+ '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
+-%]
+[% IF ctx.hours.dow_2_note %]
+ <span>[%l('(' _ note _ ')')%]</span>
+[% END -%]
</div>
[%- END %]
[%-
open = today _ ctx.hours.dow_3_open;
close = today _ ctx.hours.dow_3_close;
+ note = ctx.hours.dow_3_note;
IF open == close;
%]
<div class="opening-hours">[% l('Thursday: closed') %]</div>
[%- ELSE %]
<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday" />[%
l('Thursday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
- '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
+ '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
+-%]
+[% IF ctx.hours.dow_3_note %]
+ <span>[%l('(' _ note _ ')')%]</span>
+[% END -%]
</div>
[%- END %]
[%-
open = today _ ctx.hours.dow_4_open;
close = today _ ctx.hours.dow_4_close;
+ note = ctx.hours.dow_4_note;
IF open == close;
%]
<div class="opening-hours">[% l('Friday: closed') %]</div>
[%- ELSE %]
<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday" />[%
l('Friday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
- '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
+ '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
+-%]
+[% IF ctx.hours.dow_4_note %]
+ <span>[%l('(' _ note _ ')')%]</span>
+[% END -%]
</div>
[%- END %]
[%-
open = today _ ctx.hours.dow_5_open;
close = today _ ctx.hours.dow_5_close;
+ note = ctx.hours.dow_5_note;
IF open == close;
%]
<div class="opening-hours">[% l('Saturday: closed') %]</div>
[%- ELSE %]
<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday" />[%
l('Saturday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
- '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
+ '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
+-%]
+[% IF ctx.hours.dow_5_note %]
+ <span>[%l('(' _ note _ ')')%]</span>
+[% END -%]
</div>
[%- END %]
[%-
open = today _ ctx.hours.dow_6_open;
close = today _ ctx.hours.dow_6_close;
+ note = ctx.hours.dow_6_note;
IF open == close;
%]
<div class="opening-hours">[% l('Sunday: closed') %]</div>
[%- ELSE %]
<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Sunday" />[%
l('Sunday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
- '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
+ '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
+-%]
+[% IF ctx.hours.dow_6_note %]
+ <span>[%l('(' _ note _ ')')%]</span>
+[% END -%]
</div>
[%- END %]
</div>
\ No newline at end of file