Browse Source

Inputs with date type in the cmskit have been changed to single daterangepicker

pull/14017/head
Salih 4 years ago
parent
commit
ca4e8fa587
  1. 16
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml
  2. 6
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml
  3. 51
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.js
  4. 51
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js

16
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml

@ -80,13 +80,15 @@
<abp-row>
<input type="hidden" name="@nameof(Model.CommentWithAuthorDto.RepliedCommentId)" value="@Model.CommentWithAuthorDto.Id"/>
<abp-column size-lg="_6" size-md="_12" class="input-group input-daterange">
<abp-column size="_6" style="padding-left: 0">
<abp-input asp-for="@Model.CreationStartDate" label="@L["StartDate"].Value" type="text"/>
</abp-column>
<abp-column size="_6" style="padding-right: 0">
<abp-input asp-for="@Model.CreationEndDate" label="@L["EndDate"].Value" type="text"/>
</abp-column>
<abp-column size-lg="_4" size-md="_12">
<abp-row>
<abp-column size-lg="_6" size-md="_6">
<abp-input asp-for="@Model.CreationStartDate" class="singleDatePicker" label="@L["StartDate"].Value" type="text" />
</abp-column>
<abp-column size-lg="_6" size-md="_6">
<abp-input asp-for="@Model.CreationEndDate" class="singleDatePicker" label="@L["EndDate"].Value" type="text" />
</abp-column>
</abp-row>
</abp-column>
<abp-column size-lg="_4" size-md="_12">
<abp-input asp-for="@Model.Author" label="@L["Username"].Value" type="text"/>

6
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml

@ -39,12 +39,12 @@
<form id="CmsKitCommentsFilterForm" method="post">
<abp-row class="align-items-end">
<abp-column size-lg="_4" size-md="_12">
<abp-row class="input-daterange">
<abp-row>
<abp-column size-lg="_6" size-md="_6">
<abp-input asp-for="@Model.CreationStartDate" label="@L["StartDate"].Value" value="@defaultStartDate" type="text" />
<abp-input asp-for="@Model.CreationStartDate" class="singleDatePicker" label="@L["StartDate"].Value" value="@defaultStartDate" type="text" />
</abp-column>
<abp-column size-lg="_6" size-md="_6">
<abp-input asp-for="@Model.CreationEndDate" label="@L["EndDate"].Value" type="text" />
<abp-input asp-for="@Model.CreationEndDate" class="singleDatePicker" label="@L["EndDate"].Value" type="text" />
</abp-column>
</abp-row>
</abp-column>

51
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.js

@ -5,38 +5,37 @@ $(function (){
var detailsModal = new abp.ModalManager(abp.appPath + "CmsKit/Comments/DetailsModal");
$(".input-daterange")
.datepicker({
todayBtn: "linked",
autoclose: true,
language: abp.localization.currentCulture.cultureName,
})
.on("hide", function (e) {
e.stopPropagation();
});
var getFormattedDate = function ($datePicker) {
return $datePicker.data('date');
};
$('.singleDatePicker').daterangepicker({
"singleDatePicker": true,
"showDropdowns": true,
"autoUpdateInput": false,
"autoApply": true,
"opens": "center",
"drops": "auto",
"minYear": 1901,
"maxYear": 2199,
});
$('.singleDatePicker').attr('autocomplete', 'off');
$('.singleDatePicker').on('apply.daterangepicker', function (ev, picker) {
$(this).val(picker.startDate.format('l'));
$(this).data('date', picker.startDate.locale('en').format('YYYY-MM-DD'));
});
var filterForm = $('#CmsKitCommentsFilterForm');
var getFilter = function () {
var filterObj = filterForm.serializeFormToObject();
var startDate = luxon.DateTime.fromFormat(
filterObj.creationStartDate,
abp.localization.currentCulture.dateTimeFormat.shortDatePattern,
{ locale: abp.localization.currentCulture.cultureName }
);
if (!startDate.invalid) {
filterObj.creationStartDate = startDate.toFormat("yyyy-MM-dd");
}
var endDate = luxon.DateTime.fromFormat(
filterObj.creationEndDate,
abp.localization.currentCulture.dateTimeFormat.shortDatePattern,
{ locale: abp.localization.currentCulture.cultureName }
);
if (!endDate.invalid) {
filterObj.creationEndDate = endDate.toFormat("yyyy-MM-dd");
}
filterObj.creationStartDate = getFormattedDate($('#creationStartDate'));
filterObj.creationEndDate = getFormattedDate($('#creationEndDate'));
return filterObj;
};

51
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js

@ -5,41 +5,40 @@ $(function (){
var detailsModal = new abp.ModalManager(abp.appPath + "CmsKit/Comments/DetailsModal");
$(".input-daterange")
.datepicker({
todayBtn: "linked",
autoclose: true,
language: abp.localization.currentCulture.cultureName,
})
.on("hide", function (e) {
e.stopPropagation();
});
var getFormattedDate = function ($datePicker) {
return $datePicker.data('date');
};
$('.singleDatePicker').daterangepicker({
"singleDatePicker": true,
"showDropdowns": true,
"autoUpdateInput": false,
"autoApply": true,
"opens": "center",
"drops": "auto",
"minYear": 1901,
"maxYear": 2199,
});
$('.singleDatePicker').attr('autocomplete', 'off');
$('.singleDatePicker').on('apply.daterangepicker', function (ev, picker) {
$(this).val(picker.startDate.format('l'));
$(this).data('date', picker.startDate.locale('en').format('YYYY-MM-DD'));
});
var filterForm = $('#CmsKitCommentsFilterForm');
var getFilter = function () {
var filterObj = filterForm.serializeFormToObject();
var startDate = luxon.DateTime.fromFormat(
filterObj.creationStartDate,
abp.localization.currentCulture.dateTimeFormat.shortDatePattern,
{ locale: abp.localization.currentCulture.cultureName }
);
if (!startDate.invalid) {
filterObj.creationStartDate = startDate.toFormat("yyyy-MM-dd");
}
var endDate = luxon.DateTime.fromFormat(
filterObj.creationEndDate,
abp.localization.currentCulture.dateTimeFormat.shortDatePattern,
{ locale: abp.localization.currentCulture.cultureName }
);
if (!endDate.invalid) {
filterObj.creationEndDate = endDate.toFormat("yyyy-MM-dd");
}
filterObj.creationStartDate = getFormattedDate($('#creationStartDate'));
filterObj.creationEndDate = getFormattedDate($('#creationEndDate'));
return filterObj;
};
var _dataTable = $('#CommentsTable').DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,

Loading…
Cancel
Save