Skip to content

Commit

Permalink
Merge pull request #5415 from NguyenBao10/REDSHOP-5880
Browse files Browse the repository at this point in the history
REDSHOP-5880 Custom Field type Date Picker have problem when appear on front-end
  • Loading branch information
anhredweb authored Jul 16, 2020
2 parents 37a78bc + a573feb commit ad43c42
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 26 deletions.
56 changes: 32 additions & 24 deletions libraries/redshop/html/redshopcalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,36 +76,44 @@ public static function calendar($value, $name, $id, $format = '', $attribs = nul
JFactory::getDocument()->addScriptDeclaration(
'(function($){
$(document).ready(function(){
$("#' . $id . '_wrapper").datetimepicker({
timeZone: "' . $userTz . '",
collapse: true,
sideBySide: true,
showTodayButton: false,
format: "' . RedshopHelperDatetime::convertPHPToMomentFormat($format) . '",
showClear: ' . (!$inline ? 'true' : 'false') . ',
showClose: ' . (!$inline ? 'true' : 'false') . ',
inline: ' . (!$inline ? 'false' : 'true') . ',
allowInputToggle: true,
' . $defaultDate . '
icons: {
time: "fa fa-time",
date: "fa fa-calendar",
up: "fa fa-chevron-up",
down: "fa fa-chevron-down",
previous: "fa fa-chevron-left",
next: "fa fa-chevron-right",
today: "fa fa-calendar",
clear: "fa fa-trash text-danger",
close: "fa fa-remove"
}
});
addDateTimePicker();
});
$(document).on("AfterGetBillingTemplate", function(){
addDateTimePicker();
});
function addDateTimePicker(){
$("#' . $id . '_wrapper").datetimepicker({
timeZone: "' . $userTz . '",
collapse: true,
sideBySide: true,
showTodayButton: false,
format: "' . RedshopHelperDatetime::convertPHPToMomentFormat($format) . '",
showClear: ' . (!$inline ? 'true' : 'false') . ',
showClose: ' . (!$inline ? 'true' : 'false') . ',
inline: ' . (!$inline ? 'false' : 'true') . ',
allowInputToggle: true,
' . $defaultDate . '
icons: {
time: "fa fa-time",
date: "fa fa-calendar",
up: "fa fa-chevron-up",
down: "fa fa-chevron-down",
previous: "fa fa-chevron-left",
next: "fa fa-chevron-right",
today: "fa fa-calendar",
clear: "fa fa-trash text-danger",
close: "fa fa-remove"
}
});
}
})(jQuery);'
);

if (!$inline) {
// Hide button using inline styles for readonly/disabled fields
return '<div class="input-group" id="' . $id . '_wrapper">'
return '<div class="input-group redshop-datepicker" id="' . $id . '_wrapper">'
. '<span class="input-group-addon" id="' . $id . '_img"><i class="fa fa-calendar"></i></span>'
. '<input type="text" name="' . $name . '" id="' . $id . '" ' . $attribs . ' />'
. '<span class="input-group-addon"><strong>' . strtolower($format) . '</strong></span>'
Expand Down
2 changes: 1 addition & 1 deletion libraries/redshop/src/Fields/SiteHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public static function renderFields($fieldSection = 0, $sectionId = 0, $uniqueCl
$date,
$field->name,
$field->name,
$format = '%d-%m-%Y',
$format = 'd-m-Y',
array('class' => 'inputbox', 'size' => $size, 'maxlength' => '15')
);
break;
Expand Down
8 changes: 8 additions & 0 deletions media/com_redshop/css/redshop.admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -29486,4 +29486,12 @@ div.modal.jviewport-width90 {
div.modal.jviewport-width100 {
width: 100vw;
margin-left: -50vw;
}

.redshop-datepicker {
position: static;
}

.table-striped tbody > tr > td.day.active {
background-color: #337ab7 !important;
}
2 changes: 1 addition & 1 deletion media/com_redshop/css/redshop.admin.min.css

Large diffs are not rendered by default.

0 comments on commit ad43c42

Please sign in to comment.