Skip to content

Commit

Permalink
calender issues solved
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshya chauhan committed Jan 19, 2022
1 parent c14122e commit 6c8743c
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 24 deletions.
30 changes: 28 additions & 2 deletions admin/themes/default/css/overrides.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
/* This stylesheet should be used to add your custom styles to the back-office without using the Sass sources. It will be loaded after all the default styles.
You should NOT edit any other exisiting back-office CSS file manually: they are generated by the Sass preprocessor: http://www.sass-lang.com/ . */
/*This stylesheet should be used to add your custom styles to the back-office without using the Sass sources. It will be loaded after all the default styles. */
/*You should NOT edit any other exisiting back-office CSS file manually: they are generated by the Sass preprocessor: http://www.sass-lang.com/ . */

.datepicker2 {
background: #fff;
position: absolute;
z-index: 99999;
width: 14rem;
}

.bootstrap #datepicker .daterangepicker thead tr th {
color: #fff;
font-size: .8em;
height: 2.5em;
}

.bootstrap #datepicker .daterangepicker thead tr:first-child th {
font-size: 1.2em;
}

.form-date-actions {
bottom: -25px;
position: absolute;
width: 100%;
z-index: 999;
background-color: #fff;
border: solid 1px #ccc;
}
34 changes: 20 additions & 14 deletions admin/themes/default/js/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,15 @@ $( document ).ready(function() {
"start": $("#date-start").val(),
"end": $("#date-end").val()
}).on('changeDate', function(ev){
if (ev.date.valueOf() >= datepickerEnd.date.valueOf()){
datepickerEnd.setValue(ev.date.setMonth(ev.date.getMonth()+1));
}
// if (ev.date.valueOf() >= datepickerEnd.date.valueOf()){
// datepickerEnd.setValue(ev.date.setMonth(ev.date.getMonth()+1));
// }
}).data('daterangepicker');
$('#testdatepic').daterangepicker({
"dates": translated_dates,
"weekStart": 1,
"start": $("#date-start").val(),
"end": $("#date-end").val()
}).data('daterangepicker');

datepickerEnd = $('.datepicker2').daterangepicker({
Expand All @@ -308,39 +314,39 @@ $( document ).ready(function() {
}
}).data('daterangepicker');

//Set first date picker to month -1 if same month
// Set first date picker to month -1 if same month
startDate = Date.parseDate($("#date-start").val(), $("#date-start").data('date-format'));
endDate = Date.parseDate($("#date-end").val(), $("#date-end").data('date-format'));

if (startDate.getFullYear() == endDate.getFullYear() && startDate.getMonth() == endDate.getMonth())
datepickerStart.setValue(startDate.subMonths(1));

//Events binding
// Events binding
$("#date-start").focus(function() {
datepickerStart.setCompare(false);
datepickerEnd.setCompare(false);
// datepickerEnd.setCompare(false);
$(".date-input").removeClass("input-selected");
$(this).addClass("input-selected");
});

$("#date-end").focus(function() {
datepickerStart.setCompare(false);
datepickerEnd.setCompare(false);
// datepickerEnd.setCompare(false);
$(".date-input").removeClass("input-selected");
$(this).addClass("input-selected");
});

$("#date-start-compare").focus(function() {
datepickerStart.setCompare(true);
datepickerEnd.setCompare(true);
// datepickerEnd.setCompare(true);
$('#compare-options').val(3);
$(".date-input").removeClass("input-selected");
$(this).addClass("input-selected");
});

$("#date-end-compare").focus(function() {
datepickerStart.setCompare(true);
datepickerEnd.setCompare(true);
// datepickerEnd.setCompare(true);
$('#compare-options').val(3);
$(".date-input").removeClass("input-selected");
$(this).addClass("input-selected");
Expand All @@ -363,8 +369,8 @@ $( document ).ready(function() {
} else {
datepickerStart.setStartCompare(null);
datepickerStart.setEndCompare(null);
datepickerEnd.setStartCompare(null);
datepickerEnd.setEndCompare(null);
// datepickerEnd.setStartCompare(null);
// datepickerEnd.setEndCompare(null);
$('#form-date-body-compare').hide();
$('#compare-options').prop('disabled', true);
$('#date-start').focus();
Expand All @@ -380,10 +386,10 @@ $( document ).ready(function() {

datepickerStart.setStartCompare($("#date-start-compare").val());
datepickerStart.setEndCompare($("#date-end-compare").val());
datepickerEnd.setStartCompare($("#date-start-compare").val());
datepickerEnd.setEndCompare($("#date-end-compare").val());
// datepickerEnd.setStartCompare($("#date-start-compare").val());
// datepickerEnd.setEndCompare($("#date-end-compare").val());
datepickerStart.setCompare(true);
datepickerEnd.setCompare(true);
// datepickerEnd.setCompare(true);

if (this.value == 3)
$('#date-start-compare').focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="alert alert-warning">{$warning}</div>
{/if}
<div id="calendar" class="panel">
<form action="{$action|escape}" method="get" id="calendar_form" name="calendar_form" class="form-inline">
<form action="{$action|escape}" method="post" id="calendar_form" name="calendar_form" class="form-inline">
<div class="btn-group">
<button type="button" name="submitDateDay" class="btn btn-default submitDateDay{if (!isset($preselect_date_range) || !$preselect_date_range) || (isset($preselect_date_range) && $preselect_date_range == 'day')} active{/if}">
{l s='Day'}
Expand Down Expand Up @@ -74,8 +74,8 @@
</span>
<i class="icon-caret-down"></i>
</button>
{$calendar}
</div>
{$calendar}
</form>
</div>
</div>
Expand Down
34 changes: 28 additions & 6 deletions admin/themes/default/template/helpers/calendar/calendar.tpl
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
<div id="datepicker" class="row row-padding-top hide">
<div id="datepicker" class="row hide">
<div class="col-lg-12">
<div class="daterangepicker-days">
<div class="row">
{if $is_rtl}
<div class="col-sm-6 col-lg-4">
<div class="datepicker2" data-date="{$date_to}" data-date-format="{$date_format}"></div>
<div class="datepicker2" data-date="{$date_to}" data-date-format="{$date_format}">
<div class='form-date-actions'>
<button class='btn btn-link' type='button' id="datepicker-cancel" tabindex="7">
<i class='icon-remove'></i>
{l s='Cancel'}
</button>
<button class='btn btn-default pull-right' type='submit' name="submitDateRange" tabindex="6">
<i class='icon-ok text-success'></i>
{l s='Apply'}
</button>
</div>
</div>
</div>
<div class="col-sm-6 col-lg-4">
<div class="col-sm-6 col-lg-4 hide">
<div class="datepicker1" data-date="{$date_from}" data-date-format="{$date_format}"></div>
</div>
{else}
<div class="col-sm-6 col-lg-4">
<div class="col-sm-6 col-lg-4 hide">
<div class="datepicker1" data-date="{$date_from}" data-date-format="{$date_format}"></div>
</div>
<div class="col-sm-6 col-lg-4">
<div class="datepicker2" data-date="{$date_to}" data-date-format="{$date_format}"></div>
<div class="datepicker2" data-date="{$date_to}" data-date-format="{$date_format}">
<div class='form-date-actions'>
<button class='btn btn-link' type='button' id="datepicker-cancel" tabindex="7">
<i class='icon-remove'></i>
{l s='Cancel'}
</button>
<button class='btn btn-default pull-right' type='submit' name="submitDateRange" tabindex="6">
<i class='icon-ok text-success'></i>
{l s='Apply'}
</button>
</div>
</div>
</div>
{/if}
<div class="col-xs-12 col-sm-6 col-lg-4 pull-right">
<div class="col-xs-12 col-sm-6 col-lg-4 pull-right hide">
<div id='datepicker-form' class='form-inline'>
<div id='date-range' class='form-date-group'>
<div class='form-date-heading'>
Expand Down

0 comments on commit 6c8743c

Please sign in to comment.