summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannik Schönartz2016-12-02 05:01:08 +0100
committerJannik Schönartz2016-12-02 05:01:08 +0100
commit18942f2e247d7e195367ddf7048d071be50feef5 (patch)
treef0e96c3fb73c2c2c4e3c4a88a4b6e97695e3258f
parentfixed daystoshow not working (diff)
downloadslx-admin-18942f2e247d7e195367ddf7048d071be50feef5.tar.gz
slx-admin-18942f2e247d7e195367ddf7048d071be50feef5.tar.xz
slx-admin-18942f2e247d7e195367ddf7048d071be50feef5.zip
locationinfo: added easymode to the opening time
-rw-r--r--modules-available/locationinfo/api.inc.php10
-rw-r--r--modules-available/locationinfo/config.json2
-rw-r--r--modules-available/locationinfo/lang/de/messages.json1
-rw-r--r--modules-available/locationinfo/lang/de/template-tags.json5
-rw-r--r--modules-available/locationinfo/lang/en/messages.json1
-rw-r--r--modules-available/locationinfo/lang/en/template-tags.json5
-rw-r--r--modules-available/locationinfo/page.inc.php146
-rw-r--r--modules-available/locationinfo/templates/config.html13
-rw-r--r--modules-available/locationinfo/templates/location-info.html5
-rw-r--r--modules-available/locationinfo/templates/pcsubtable.html2
-rw-r--r--modules-available/locationinfo/templates/timetable.html264
11 files changed, 334 insertions, 120 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php
index 1e765be0..b96dbdc6 100644
--- a/modules-available/locationinfo/api.inc.php
+++ b/modules-available/locationinfo/api.inc.php
@@ -87,17 +87,19 @@ function checkIfHidden($locationID) {
return true;
}
}
+ return -1;
}
function getOpeningTimesFromParent($locationID) {
$dbquery = Database::simpleQuery("SELECT parentlocationid FROM `location` WHERE locationid = :locationID", array('locationID' => $locationID));
+ $parentlocationid = 0;
while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
- $parentlocationid = $dbdata['parentlocationid'];
+ $parentlocationid = (int)$dbdata['parentlocationid'];
}
if ($parentlocationid == 0) {
echo json_encode(array());
}else {
- echo getOpeningTimes($parentlocationid);
+ getOpeningTimes($parentlocationid);
}
}
@@ -110,6 +112,8 @@ function getOpeningTimes($locationID) {
$dbquery = Database::simpleQuery("SELECT openingtime FROM `location_info` WHERE locationid = :locationID", array('locationID' => $locationID));
$result = array();
+ $dbresult = array();
+
while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
$dbresult = json_decode($dbdata['openingtime'], true);
}
@@ -165,8 +169,6 @@ function getRoomInfoJson($locationID, $coords) {
}
function getPcInfos($locationID, $coords) {
- $dbquery;
-
if ($coords == '1') {
$dbquery = Database::simpleQuery("SELECT machineuuid, position, logintime FROM `machine` WHERE locationid = :locationID" , array('locationID' => $locationID));
} else {
diff --git a/modules-available/locationinfo/config.json b/modules-available/locationinfo/config.json
index a6e90714..d4cab3f0 100644
--- a/modules-available/locationinfo/config.json
+++ b/modules-available/locationinfo/config.json
@@ -1,4 +1,4 @@
{
"category":"main.content",
- "dependencies": ["js_jqueryui"]
+ "dependencies": ["js_jqueryui", "bootstrap_timepicker", "locations", "bootstrap_switch"]
}
diff --git a/modules-available/locationinfo/lang/de/messages.json b/modules-available/locationinfo/lang/de/messages.json
index f71ee38d..6526c320 100644
--- a/modules-available/locationinfo/lang/de/messages.json
+++ b/modules-available/locationinfo/lang/de/messages.json
@@ -2,5 +2,6 @@
"no-days-selected": "Es wurden keine Tage ausgewählt.",
"added-x-entries": "Eintr\u00e4ge hinzugef\u00fcgt: {{0}}",
"deleted-x-entries": "Eintr\u00e4ge gelöscht: {{0}}",
+ "openingtime-updated": "Öffnungszeiten aktualisierts.",
"config-saved": "Einstellungen erfolgreich gespeichert."
}
diff --git a/modules-available/locationinfo/lang/de/template-tags.json b/modules-available/locationinfo/lang/de/template-tags.json
index 9f3f0304..da18765a 100644
--- a/modules-available/locationinfo/lang/de/template-tags.json
+++ b/modules-available/locationinfo/lang/de/template-tags.json
@@ -26,6 +26,11 @@
"lang_shortFriday": "Fr",
"lang_shortSaturday": "Sa",
"lang_shortSunday": "So",
+ "lang_shortMonTilFr": "Mo - Fr",
+ "lang_monTilFr": "Montag - Freitag",
+ "lang_saturday": "Samstag",
+ "lang_sunday": "Sonntag",
+ "lang_expertMode": "Experten Modus",
"lang_language": "Sprache",
"lang_languageEn": "en",
diff --git a/modules-available/locationinfo/lang/en/messages.json b/modules-available/locationinfo/lang/en/messages.json
index cbb8006f..22c9b549 100644
--- a/modules-available/locationinfo/lang/en/messages.json
+++ b/modules-available/locationinfo/lang/en/messages.json
@@ -2,5 +2,6 @@
"no-days-selected": "No days selected.",
"added-x-entries": "Entries added: {{0}}",
"deleted-x-entries": "Entries deleted: {{0}}",
+ "openingtime-updated": "Openingtime updated.",
"config-saved": "Config successfully saved."
}
diff --git a/modules-available/locationinfo/lang/en/template-tags.json b/modules-available/locationinfo/lang/en/template-tags.json
index 3a7e8632..b2beabef 100644
--- a/modules-available/locationinfo/lang/en/template-tags.json
+++ b/modules-available/locationinfo/lang/en/template-tags.json
@@ -26,6 +26,11 @@
"lang_shortFriday": "Fri",
"lang_shortSaturday": "Sat",
"lang_shortSunday": "Sun",
+ "lang_shortMonTilFr": "Mon - Fri",
+ "lang_monTilFr": "Monday - Friday",
+ "lang_saturday": "Saturday",
+ "lang_sunday": "Sunday",
+ "lang_expertMode": "Expert mode",
"lang_language": "Language",
"lang_languageEn": "en",
diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php
index 717e3b0b..b05153b0 100644
--- a/modules-available/locationinfo/page.inc.php
+++ b/modules-available/locationinfo/page.inc.php
@@ -17,8 +17,10 @@ class Page_LocationInfo extends Page
}
$this->action = Request::post('action');
- if ($this->action === 'updateOpeningTime') {
- $this->updateOpeningTime();
+ if ($this->action === 'updateOpeningTimeExpert') {
+ $this->updateOpeningTimeExpert();
+ } elseif($this->action === 'updateOpeningTimeEasy') {
+ $this->updateOpeningTimeEasy();
} elseif ($this->action === 'updateConfig') {
$this->updateConfig();
}
@@ -49,6 +51,7 @@ class Page_LocationInfo extends Page
$this->toggleHidden($roomId, $hiddenValue);
Util::redirect('?do=locationinfo&action=infoscreen#row' . $roomId);
}
+
}
private function updateConfig()
@@ -75,13 +78,14 @@ class Page_LocationInfo extends Page
Util::redirect('?do=locationinfo');
}
- private function updateOpeningTime()
+ private function updateOpeningTimeExpert()
{
- $existingDays = Request::post('existingdays');
+ //$existingDays = Request::post('existingdays'); TODO maybe use openingdays from the html so we don't need the db query
$days = Request::post('days');
$locationid = Request::post('id', 0, 'int');
$openingtime = Request::post('openingtime');
$closingtime = Request::post('closingtime');
+ $easyMode = Request::post('easyMode');
$delete = Request::post('delete');
$dontadd = Request::post('dontadd');
$count = 0;
@@ -89,29 +93,31 @@ class Page_LocationInfo extends Page
$resulttmp = array();
$deleteCounter = 0;
- $dbquery = Database::simpleQuery("SELECT openingtime FROM `location_info` WHERE locationid = :id", array('id' => $locationid));
- while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
- $resulttmp = json_decode($dbdata['openingtime'], true);
- }
+ if (!$easyMode) {
+ $dbquery = Database::simpleQuery("SELECT openingtime FROM `location_info` WHERE locationid = :id", array('id' => $locationid));
+ while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
+ $resulttmp = json_decode($dbdata['openingtime'], true);
+ }
- $index = 0;
+ $index = 0;
- foreach ($resulttmp as $day) {
- $skip = false;
- foreach ($delete as $del) {
- if ($del == $index) {
- $skip = true;
- break;
+ foreach ($resulttmp as $day) {
+ $skip = false;
+ foreach ($delete as $del) {
+ if ($del == $index) {
+ $skip = true;
+ break;
+ }
}
- }
- if ($skip == true) {
+ if ($skip == true) {
+ $index++;
+ $deleteCounter++;
+ continue;
+ }
+
+ $result[] = $day;
$index++;
- $deleteCounter++;
- continue;
}
-
- $result[] = $day;
- $index++;
}
if (!empty($days) && !is_array($days)) {
@@ -157,6 +163,34 @@ class Page_LocationInfo extends Page
Util::redirect('?do=locationinfo');
}
+ private function updateOpeningTimeEasy() {
+ $locationid = Request::post('id', 0, 'int');
+ $openingtime = Request::post('openingtime');
+ $closingtime = Request::post('closingtime');
+ $result = array();
+
+ $opt0['days'] = array ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday");
+ $opt0['openingtime'] = $openingtime[0];
+ $opt0['closingtime'] = $closingtime[0];
+ $result[] = $opt0;
+
+ $opt1['days'] = array ("Saturday");
+ $opt1['openingtime'] = $openingtime[1];
+ $opt1['closingtime'] = $closingtime[1];
+ $result[] = $opt1;
+
+ $opt2['days'] = array ("Sunday");
+ $opt2['openingtime'] = $openingtime[2];
+ $opt2['closingtime'] = $closingtime[2];
+ $result[] = $opt2;
+
+ Database::exec("INSERT INTO `location_info` VALUES (:id, :hidden, :openingtime, '', '') ON DUPLICATE KEY UPDATE openingtime=:openingtime",
+ array('id' => $locationid, 'hidden' => false, 'openingtime' => json_encode($result, true)));
+
+ Message::addSuccess('openingtime-updated');
+ Util::redirect('?do=locationinfo');
+ }
+
protected function toggleHidden($id, $val) {
Database::exec("INSERT INTO `location_info` VALUES (:id, :hidden, '', '', '') ON DUPLICATE KEY UPDATE hidden=:hidden", array('id' => $id, 'hidden' => $val));
@@ -194,12 +228,10 @@ class Page_LocationInfo extends Page
FROM `location` AS l LEFT JOIN `location_info` AS li ON l.locationid=li.locationid
WHERE parentlocationid = :parentId;", array('parentId' => $parent));
$amountofzero = 0;
- $amountofone = 0;
$amountofnull = 0;
while($dbd=$dbq->fetch(PDO::FETCH_ASSOC)) {
$amountofzero = (int)$dbd['0'];
- $amountofone = (int)$dbd['1'];
$amountofnull = (int)$dbd['NULL'];
}
@@ -257,13 +289,6 @@ class Page_LocationInfo extends Page
));
}
- protected function updateInfoscreenDb() {
- $dbquery = Database::simpleQuery("SELECT DISTINCT locationid FROM `machine` WHERE locationid IS NOT NULL");
- while($roominfo=$dbquery->fetch(PDO::FETCH_ASSOC)) {
- $this->updatePcInfos($roominfo['locationid']);
- }
- }
-
private function getInUseStatus($logintime, $lastseen) {
if ($logintime == 0) {
return 0;
@@ -273,6 +298,7 @@ class Page_LocationInfo extends Page
} elseif ($lastseen > 610) {
return 2;
}
+ return -1;
}
/**
@@ -309,7 +335,6 @@ class Page_LocationInfo extends Page
$pc['ip'] = $dbdata['clientip'];
$pc['inUse'] = $this->getInUseStatus($dbdata['logintime'], $dbdata['lastseen']);
- $position = array();
$position = json_decode($dbdata['position'], true);
$pc['x'] = $position['gridRow'];
$pc['y'] = $position['gridCol'];
@@ -325,26 +350,51 @@ class Page_LocationInfo extends Page
private function ajaxTimeTable($id) {
$array = array();
$dbquery = Database::simpleQuery("SELECT openingtime FROM `location_info` WHERE locationid = :id", array('id' => $id));
+ $dbresult = array();
while($dbdata=$dbquery->fetch(PDO::FETCH_ASSOC)) {
- $db = array();
- $db = json_decode($dbdata['openingtime'], true);
- $index = 0;
- foreach ($db as $key) {
- $str = "| ";
- foreach ($key['days'] as $val) {
- $str .= $val;
- $str .= " | ";
+ $dbresult[] = json_decode($dbdata['openingtime'], true);
+ }
+ if($this->isEasyMode($dbresult)) {
+ echo Render::parse('timetable', array('id' => $id, 'openingtime0' => $dbresult[0][0]['openingtime'],
+ 'closingtime0' => $dbresult[0][0]['closingtime'], 'openingtime1' => $dbresult[0][1]['openingtime'],
+ 'closingtime1' => $dbresult[0][1]['closingtime'], 'openingtime2' => $dbresult[0][2]['openingtime'],
+ 'closingtime2' => $dbresult[0][2]['closingtime'], 'easyMode' => true, 'expertMode' => false));
+
+ } else{
+ foreach($dbresult as $db) {
+ $index = 0;
+ foreach ($db as $key) {
+ $str = "| ";
+ foreach ($key['days'] as $val) {
+ $str .= $val;
+ $str .= " | ";
+ }
+ $ar = array();
+ $ar['days'] = $str;
+ $ar['openingtime'] = $key['openingtime'];
+ $ar['closingtime'] = $key['closingtime'];
+ $ar['index'] = $index;
+ $array[] = $ar;
+ $index++;
}
- $ar = array();
- $ar['days'] = $str;
- $ar['openingtime'] = $key['openingtime'];
- $ar['closingtime'] = $key['closingtime'];
- $ar['index'] = $index;
- $array[] = $ar;
- $index++;
}
+ echo Render::parse('timetable', array('id' => $id, 'openingtimes' => array_values($array), 'easyMode' => false, 'expertMode' => true));
+ }
+ }
+
+ private function isEasyMode($array) {
+ if(count($array[0]) == 3) {
+ if ($array[0][0]['days'] == array ("Monday","Tuesday","Wednesday","Thursday","Friday")
+ && $array[0][1]['days'] == array ("Saturday") && $array[0][2]['days'] == array ("Sunday")) {
+ return true;
+ } else {
+ return false;
+ }
+ } elseif ($array[0] == 0) {
+ return true;
+ } else {
+ return false;
}
- echo Render::parse('timetable', array('id' => $id, 'openingtimes' => array_values($array)));
}
private function ajaxConfig($id) {
diff --git a/modules-available/locationinfo/templates/config.html b/modules-available/locationinfo/templates/config.html
index 6df69cdc..06240e66 100644
--- a/modules-available/locationinfo/templates/config.html
+++ b/modules-available/locationinfo/templates/config.html
@@ -29,7 +29,7 @@
<div style="float: left; margin-left: 15px;">
<Label data-toggle="tooltip" title="{{lang_daysToShowTooltip}}">{{lang_daysToShow}}</Label><br>
<select name="daystoshow">
- <option value="1" id="day1">1</opton>
+ <option value="1" id="day1">1</option>
<option value="2" id="day2">2</option>
<option value="3" id="day3">3</option>
<option value="4" id="day4">4</option>
@@ -134,19 +134,20 @@ function loadValues() {
}
function showScaleValue(newValue) {
- $("#scale").text(newValue + " %");
+ $("#scale").text(newValue + " %");
}
function showSwitchValue(newValue) {
- $("#switch").text(newValue + " " + '{{lang_sec}}');
+ $("#switch").text(newValue + " " + '{{lang_sec}}');
}
function vertical_cb(value) {
+ var cb = $("#cb_vertical");
if (value == 1) {
- $("#cb_vertical").prop("disabled", false);
+ cb.prop("disabled", false);
} else {
- $("#cb_vertical").prop("disabled", true);
- $("#cb_vertical").prop("checked", false);
+ cb.prop("disabled", true);
+ cb.prop("checked", false);
}
}
</script>
diff --git a/modules-available/locationinfo/templates/location-info.html b/modules-available/locationinfo/templates/location-info.html
index 91a274be..69665d01 100644
--- a/modules-available/locationinfo/templates/location-info.html
+++ b/modules-available/locationinfo/templates/location-info.html
@@ -1,7 +1,7 @@
<div>
<h1>{{lang_mainHeader}}</h1>
-<table class="table table-condensed locations" style="margin-bottom:0px">
+<table class="table table-condensed locations" style="margin-bottom:0">
<tr>
<th>{{lang_locationName}}</th>
@@ -15,7 +15,7 @@
{{#list}}
<tr id="row{{locationid}}" class="tablerow" onclick="{{#hasPcs}}slxOpenLocationInfo(this, {{locationid}}){{/hasPcs}}">
- <td><div style="display:inline-block;width:{{depth}}em"></div>{{#hasPcs}}<a>{{/hasPcs}}{{locationname}}</td>
+ <td><div style="display:inline-block;width:{{depth}}em"></div>{{#hasPcs}}<a>{{/hasPcs}}{{locationname}}{{#hasPcs}}</a>{{/hasPcs}}</td>
<td align="center">[{{locationid}}]</td>
<td align="center">{{#hasPcs}}{{inUse}} / {{total}}{{/hasPcs}}</td>
@@ -110,3 +110,4 @@ function loadConfigModal(locationId, locationName) {
}
</script>
+</div>
diff --git a/modules-available/locationinfo/templates/pcsubtable.html b/modules-available/locationinfo/templates/pcsubtable.html
index 1a7ea81e..22eea6f1 100644
--- a/modules-available/locationinfo/templates/pcsubtable.html
+++ b/modules-available/locationinfo/templates/pcsubtable.html
@@ -1,6 +1,6 @@
<div>
<br>
-<table style="margin-bottom:0px">
+<table style="margin-bottom:0">
<tr>
<th width=320>{{lang_pcID}}</th>
<th width=120>{{lang_pcIP}}</th>
diff --git a/modules-available/locationinfo/templates/timetable.html b/modules-available/locationinfo/templates/timetable.html
index 2484ddc8..05ef7c65 100644
--- a/modules-available/locationinfo/templates/timetable.html
+++ b/modules-available/locationinfo/templates/timetable.html
@@ -1,64 +1,212 @@
<div>
- <form method="post" action="?do=locationinfo" id="timeForm">
- <input type="hidden" name="token" value="{{token}}">
- <input type="hidden" name="action" value="updateOpeningTime">
- <input type="hidden" name="id" value="{{id}}">
-
- <table class="table table-condensed locations" style="margin-bottom:0px">
- <tr>
- <th>{{lang_day}}</th>
- <th>{{lang_openingTime}}</th>
- <th>{{lang_closingTime}}</th>
- <th>{{lang_delete}}</th>
- </tr>
-
- {{#openingtimes}}
- <tr class=tablerow>
- <td>{{days}}</td>
- <td>{{openingtime}}</td>
- <td>{{closingtime}}</td>
- <td align="center"><input type="checkbox" name="delete[]" value="{{index}}"</td>
- <!--<td><button class="btn btn-sm btn-danger">X</button></td>-->
- </tr>
- {{/openingtimes}}
-
- <tr id="lastOpenTimesTableElement"></tr>
- </table>
-
- <br>
- <a class="btn btn-success btn-sm" onclick=newOpeningTime()><span class="glyphicon glyphicon-plus-sign"></span> {{lang_openingTime}}</a>
- <!--<a class="btn btn-danger btn-sm" onclick=>{{lang_deleteAll}}</a>-->
- <br>
- <br>
- <button type="submit" class="btn btn-primary">{{lang_save}}</button>
-
- </form>
+
+<div align="right">
+ <label for="CB_1">{{lang_expertMode}}</label>
+ <input class="bs-switch" name="1" id="CB_1" type="checkbox" {{#expertMode}}checked="checked"{{/expertMode}}>
+</div>
+<br>
+
+ <div id="easyMode" style="{{#expertMode}}display: none;{{/expertMode}}">
+ <form method="post" action="?do=locationinfo" id="timeForm">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="updateOpeningTimeEasy">
+ <input type="hidden" name="id" value="{{id}}">
+ <input type="hidden" name="easyMode" value="{{easyMode}}">
+
+ <table class="table table-condensed locations" style="margin-bottom:0">
+ <tr>
+ <th>{{lang_day}}</th>
+ <th>{{lang_openingTime}}</th>
+ <th>{{lang_closingTime}}</th>
+ </tr>
+
+ <tr class=tablerow>
+ <td>{{lang_monTilFr}}</td>
+ <td>
+ <div class="input-group bootstrap-timepicker">
+ <span class="input-group-addon">
+ <span class="glyphicon glyphicon-time"></span>
+ </span>
+ <input required type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime0}}">
+ </div>
+ </td>
+ <td>
+ <div class="input-group bootstrap-timepicker">
+ <span class="input-group-addon">
+ <span class="glyphicon glyphicon-time"></span>
+ </span>
+ <input required type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime0}}">
+ </div>
+ </td>
+ </tr>
+ <tr class=tablerow>
+ <td>{{lang_saturday}}</td>
+ <td>
+ <div class="input-group bootstrap-timepicker">
+ <span class="input-group-addon">
+ <span class="glyphicon glyphicon-time"></span>
+ </span>
+ <input required type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime1}}">
+ </div>
+ </td>
+ <td>
+ <div class="input-group bootstrap-timepicker">
+ <span class="input-group-addon">
+ <span class="glyphicon glyphicon-time"></span>
+ </span>
+ <input required type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime1}}">
+ </div>
+ </td>
+ </tr>
+ <tr class=tablerow>
+ <td>{{lang_sunday}}</td>
+ <td>
+ <div class="input-group bootstrap-timepicker">
+ <span class="input-group-addon">
+ <span class="glyphicon glyphicon-time"></span>
+ </span>
+ <input required type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{openingtime2}}">
+ </div>
+ </td>
+ <td>
+ <div class="input-group bootstrap-timepicker">
+ <span class="input-group-addon">
+ <span class="glyphicon glyphicon-time"></span>
+ </span>
+ <input required type="text" class="form-control timepicker2" name="closingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="{{closingtime2}}">
+ </div>
+ </td>
+ </tr>
+ </table>
+
+ <br>
+ <br>
+ <br>
+ <button type="submit" class="btn btn-primary">{{lang_save}}</button>
+ <br>
+ </form>
+ </div>
+
+ <div id="expertMode" style="{{#easyMode}}display: none;{{/easyMode}}">
+ <form method="post" action="?do=locationinfo" id="timeForm">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="updateOpeningTimeExpert">
+ <input type="hidden" name="id" value="{{id}}">
+ <input type="hidden" name="easyMode" value="{{easyMode}}">
+
+
+ <table class="table table-condensed locations" style="margin-bottom:0">
+ <tr>
+ <th>{{lang_day}}</th>
+ <th>{{lang_openingTime}}</th>
+ <th>{{lang_closingTime}}</th>
+ <th>{{lang_delete}}</th>
+ </tr>
+
+ {{#openingtimes}}
+ <tr class=tablerow>
+ <td>{{days}}</td>
+ <td>{{openingtime}}</td>
+ <td>{{closingtime}}</td>
+ <td align="center"><input type="checkbox" name="delete[]" value="{{index}}"></td>
+ <!--<td><button class="btn btn-sm btn-danger">X</button></td>-->
+ </tr>
+ {{/openingtimes}}
+
+ <tr id="lastOpenTimesTableElement"></tr>
+ </table>
+
+ <br>
+ <a class="btn btn-success btn-sm" onclick=newOpeningTime()><span class="glyphicon glyphicon-plus-sign"></span> {{lang_openingTime}}</a>
+ <!--<a class="btn btn-danger btn-sm" onclick=>{{lang_deleteAll}}</a>-->
+ <br>
+ <br>
+ <button type="submit" class="btn btn-primary">{{lang_save}}</button>
+ <br>
+ </form>
+ </div>
</div>
<script>
-function newOpeningTime() {
- $('#lastOpenTimesTableElement').before('<tr>\
- <td>\
- <label><input type="checkbox" name="days[]" value="Monday">{{lang_shortMonday}}</label>\
- <label><input type="checkbox" name="days[]" value="Tuesday">{{lang_shortTuesday}}</label>\
- <label><input type="checkbox" name="days[]" value="Wednesday">{{lang_shortWednesday}}</label>\
- <label><input type="checkbox" name="days[]" value="Thursday">{{lang_shortThursday}}</label>\
- <label><input type="checkbox" name="days[]" value="Friday">{{lang_shortFriday}}</label>\
- <label><input type="checkbox" name="days[]" value="Saturday">{{lang_shortSaturday}}</label>\
- <label><input type="checkbox" name="days[]" value="Sunday">{{lang_shortSunday}}</label>\
- <input type="hidden" name="days[]" value="-">\
- </td>\
- <td>\
- <input type="time" name="openingtime[]">\
- </td>\
- <td>\
- <input type="time" name="closingtime[]">\
- </td>\
- <td align="center">\
- <input type="checkbox" name="dontadd[]" value="dontadd"\
- </td>\
- </tr>');
-}
-// <!--<button type="submit" class="btn btn-success btn-sm" onclick=>✓</button>-->\
+setTimepicker();
+$('#CB_1').bootstrapSwitch();
+$('#CB_1').on('switchChange.bootstrapSwitch', function (e, data) {
+
+ if (data == false) {
+ $('#expertMode').hide();
+ $('#easyMode').show();
+ } else {
+ $('#easyMode').hide();
+ $('#expertMode').show();
+ }
+});
+
+ function setTimepicker() {
+ $('.timepicker2').timepicker({
+ minuteStep: 1,
+ template: 'modal',
+ appendWidgetTo: 'body',
+ showSeconds: false,
+ showMeridian: false,
+ defaultTime: false
+ });
+ };
+
+ function newOpeningTime() {
+ $('#lastOpenTimesTableElement').before('<tr>\
+ <td>\
+ <div class="form-group options">\
+ <label><input required type="checkbox" name="days[]" value="Monday">{{lang_shortMonday}}</label>\
+ <label><input required type="checkbox" name="days[]" value="Tuesday">{{lang_shortTuesday}}</label>\
+ <label><input required type="checkbox" name="days[]" value="Wednesday">{{lang_shortWednesday}}</label>\
+ <label><input required type="checkbox" name="days[]" value="Thursday">{{lang_shortThursday}}</label>\
+ <label><input required type="checkbox" name="days[]" value="Friday">{{lang_shortFriday}}</label>\
+ <label><input required type="checkbox" name="days[]" value="Saturday">{{lang_shortSaturday}}</label>\
+ <label><input required type="checkbox" name="days[]" value="Sunday">{{lang_shortSunday}}</label>\
+ </div>\
+ <input type="hidden" name="days[]" value="-">\
+ </td>\
+ <td>\
+ \
+ <div class="input-group bootstrap-timepicker">\
+ <span class="input-group-addon">\
+ <span class="glyphicon glyphicon-time"></span>\
+ </span>\
+ <input required type="text" class="form-control timepicker2" name="openingtime[]" id="openingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="8:00">\
+ </div>\
+ \
+ </td>\
+ <td>\
+ \
+ <div class="input-group bootstrap-timepicker">\
+ <span class="input-group-addon">\
+ <span class="glyphicon glyphicon-time"></span>\
+ </span>\
+ <input required type="text" class="form-control timepicker2" name="closingtime[]" id="closingtimepicker" pattern="[0-9]{1,2}:[0-9]{2}" value="18:00">\
+ </div>\
+ \
+ </td>\
+ <td align="center">\
+ <input type="checkbox" name="dontadd[]" value="dontadd"\
+ </td>\
+ </tr>');
+ setTimepicker();
+
+ $(function(){
+ var requiredCheckboxes = $('.options :checkbox[required]');
+ requiredCheckboxes.change(function(){
+ if(requiredCheckboxes.is(':checked')) {
+ requiredCheckboxes.removeAttr('required');
+ } else {
+ requiredCheckboxes.attr('required', 'required');
+ }
+ });
+ });
+ };
+ // <!--<button type="submit" class="btn btn-success btn-sm" onclick=>✓</button>-->\
+ // <input type="time" name="openingtime[]">\
+ // <input type="time" name="closingtime[]">\
+
+
</script>