-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBusinessHours.php
More file actions
41 lines (36 loc) · 1.06 KB
/
BusinessHours.php
File metadata and controls
41 lines (36 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
const PAGE_TYPE = "Employer";
require "Head.php";
if ($_POST["action"] == "SaveBusinessHours") {
if (TimeBlockForm::checkNoDeletion()) {
$week = Business::getBusiness()->getBusinessHours();
foreach ($_POST["TimeBlocks"] as $blockData)
$week->addTimeBlock(new TimeBlock($blockData));
Business::getBusiness()->sync();
}
Util::redir("BusinessHours.php");
}
?>
<h1>Business Hours</h1>
<form method='post'>
<input type='hidden' name='action' value='SaveBusinessHours'>
<div class='form-group'>
<button class='btn btn-primary'>Save</button>
</div>
<?php
$businessHours = Business::getBusiness()->getBusinessHours();
$formCount = 0;
$timeBlocks = $businessHours->getTimeBlocks();
foreach ($timeBlocks as $block) {
(new TimeBlockForm)
->dayOfWeek($block->getDayOfWeek())
->label("we're open from")
->timeBlock($block)
->echo();
$formCount++;
}
for(; $formCount < 7; $formCount++)
(new TimeBlockForm)->dayOfWeek(TimeBlock::DAYS[$formCount])->label("we're open from")->echo();
?>
</form>
<?php require "Foot.php";