2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

make sure appointment picker works even when no shifts defined

This commit is contained in:
Adam Zammit
2015-08-04 11:15:03 +10:00
parent c097d61e42
commit 760144b929
2 changed files with 17 additions and 10 deletions

View File

@@ -126,9 +126,16 @@ if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET[
if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID " . $appointment_id;} if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID " . $appointment_id;}
xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle); xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle);
$lang = DEFAULT_LOCALE;
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM',r.Time_zone_name) as startdate, CONVERT_TZ(s.end,'UTC',r.Time_zone_name) as enddate FROM `shift` as s, `case` as c, `respondent` as r WHERE s.questionnaire_id = c.questionnaire_id AND c.case_id = $case_id AND r.case_id = c.case_id ORDER BY s.end DESC LIMIT 1"; $lang = DEFAULT_LOCALE;
$rs = $db->GetRow($sql); $startdate = $rs['startdate'];$enddate = $rs['enddate'];
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM',r.Time_zone_name) as startdate, CONVERT_TZ(DATE_ADD(NOW(), INTERVAL 10 YEAR),'SYSTEM',r.Time_zone_name) as enddate
FROM `case` as c, `respondent` as r
WHERE c.case_id = '$case_id' AND r.case_id = c.case_id";
$rs = $db->GetRow($sql);
$startdate = $rs['startdate'];
$enddate = $rs['enddate'];
print "<script type='text/javascript'> print "<script type='text/javascript'>
$(document).ready(function() { var startDateTextBox = $('#start'); var endDateTextBox = $('#end'); $(document).ready(function() { var startDateTextBox = $('#start'); var endDateTextBox = $('#end');
@@ -140,13 +147,13 @@ if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET[
timeFormat: 'HH:mm:ss', timeFormat: 'HH:mm:ss',
showSecond: false, showSecond: false,
regional: '$lang', regional: '$lang',
hourMin: 9, hourMin: 0,
hourMax: 21, hourMax: 23,
stepMinute: 5, stepMinute: 5,
hourGrid: 2, hourGrid: 2,
minuteGrid: 10, minuteGrid: 10,
minDate: '$startdate', minDate: '$startdate',
maxDate: '$enddate', maxDate: '$enddate'
});});</script>"; });});</script>";
if ($_GET['new'] =='new'){ if ($_GET['new'] =='new'){

View File

@@ -28,7 +28,7 @@
*/ */
var Timepicker = function () { var Timepicker = function () {
this.regional = []; // Available regional settings, indexed by language code this.regional = []; // Available regional settings, indexed by language code
this.regional['en'] = { // Default regional settings this.regional[''] = { // Default regional settings
currentText: 'Now', currentText: 'Now',
closeText: 'Done', closeText: 'Done',
amNames: ['AM', 'A'], amNames: ['AM', 'A'],
@@ -104,7 +104,7 @@
defaultValue: null, defaultValue: null,
parse: 'strict' parse: 'strict'
}; };
$.extend(this._defaults, this.regional['en']); $.extend(this._defaults, this.regional['']);
}; };
$.extend(Timepicker.prototype, { $.extend(Timepicker.prototype, {