Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Controls/DatePickerSetupControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ public function PageLoad()
$this->SetDefault('MinDate', null);
$this->SetDefault('MaxDate', null);

if ($controlId == 'datepicker') {
$this->Display('Controls/DatePickerSetup.tpl');
} else {
$this->Display('Controls/DateSetup.tpl');
}
$this->Display('Controls/DateSetup.tpl');
}

private function SetDefault($key, $value)
Expand Down
60 changes: 0 additions & 60 deletions tpl/Controls/DatePickerSetup.tpl

This file was deleted.

30 changes: 5 additions & 25 deletions tpl/Controls/DateSetup.tpl
Original file line number Diff line number Diff line change
@@ -1,49 +1,29 @@
{function name=dateFormat}
new Date({$date->Year()}, {$date->Month()-1}, {$date->Day()}).toISOString().split('T')[0]
{/function}
<script type="text/javascript">
$(function() {
let $controlId = $("#{$ControlId}");
let $altId = $("#{$AltId}");

{if $MinDate}
var minDate = {dateFormat date=$MinDate};
var minDate = "{$MinDate->format('Y-m-d')}"
$controlId.attr('min', minDate);
{/if}

{if $MaxDate}
var maxDate = {dateFormat date=$MaxDate->AddDays(1)};
var maxDate = "{$MaxDate->AddDays(1)->format('Y-m-d')}"
$controlId.attr('max', maxDate);
{/if}

{if $DefaultDate}
var defaultDate = {dateFormat date=$DefaultDate};
var defaultDate = "{$DefaultDate->format('Y-m-d')}";
$controlId.val(defaultDate);

{/if}

{if $AltId neq ''}
$controlId.on('change', function() {
var dateVal = $controlId.val();

if (dateVal === '') {
$altId.val('');
} else {
var date = new Date(dateVal);
var dateString = date.toISOString().split('T')[0];

{if $HasTimepicker}
var time = dateVal.split('T')[1];
if (time) {
dateString += ' ' + time.split('.')[0];
}
{/if}

$altId.val(dateString);
}
$altId.val(dateVal);
});
{/if}


});
</script>
</script>
4 changes: 1 addition & 3 deletions tpl/Reservation/create.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@
{control type="DatePickerSetupControl" ControlId="EndRepeat" AltId="formattedEndRepeat" DefaultDate=$RepeatTerminationDate MinDate=$StartDate MaxDate=$AvailabilityEnd FirstDay=$FirstWeekday}
{control type="DatePickerSetupControl" ControlId="RepeatDate" AltId="formattedRepeatDate" MaxDate=$AvailabilityEnd FirstDay=$FirstWeekday MinDate=Date::Now()->ToTimezone($Timezone)}

{jsfile src="js/jquery.autogrow.js"}
{jsfile src="js/moment.min.js"}
{jsfile src="resourcePopup.js"}
{jsfile src="userPopup.js"}
Expand Down Expand Up @@ -643,7 +642,6 @@
return false;
});

$('#description').autogrow();
$('#userName').bindUserDetails();

// jsPDF
Expand Down Expand Up @@ -680,4 +678,4 @@
}
</script>

{include file='globalfooter.tpl'}
{include file='globalfooter.tpl'}
3 changes: 1 addition & 2 deletions tpl/Reservation/view.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@
{include file="javascript-includes.tpl"}
{jsfile src="participation.js"}
{jsfile src="approval.js"}
{jsfile src="js/jquery.autogrow.js"}
{jsfile src="resourcePopup.js"}
{jsfile src="userPopup.js"}
{jsfile src="date-helper.js"}
Expand Down Expand Up @@ -437,4 +436,4 @@
//
});
</script>
{include file='globalfooter.tpl'}
{include file='globalfooter.tpl'}