Built files from Bizgaze WebServer
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

datepicker.component.min.js 12KB

1
  1. var Unibase;(function(n){let t;(function(t){let i;(function(t){class i{constructor(){this._bizgaze_dateFormat="DD/MM/YYYY";this.IsTimePicker=!1;this._time=!1;this.propval="";this.dtime=!1;this.disableFutureDate=!1}init(n,t,r){var f=i.Instance(),u,o;let e=t.PropertySettings.filter(n=>n.ControlPropertyName=="IsTime"&&n.ControlPropertyValue=="true");f.IsTimePicker=e.length>0?!0:!1;r!=null&&r!=1&&r();f.loadControlSettings(t.ControlJsonText,t.FormPropertyId);u="control-container-"+n;$("#"+u).find("#date_"+t.FormPropertyId+".datepicker-input").on("apply.daterangepicker",function(n,i){$("#"+u).find("#date_"+t.FormPropertyId).val(i.startDate.format("YYYY/MM/DD"))});if(o=(new Date).getFullYear(),this._time==!0){$("#"+u).find("#date_"+n+".datepicker-input").daterangepicker({autoUpdateInput:!1,timePicker:!0,timePicker24Hour:!0,locale:{format:"DD/MM/YYYY HH:mm",firstDay:1},singleDatePicker:!0,showDropdowns:!0,minYear:1901});$("#"+u).find("#date_"+n+".datepicker-input").on("apply.daterangepicker",function(t,i){$("#"+u).find("#date_"+n).val(i.startDate.format("DD/MM/YYYY HH:mm"));$("#"+u).find("#hfdate_"+n).val(i.startDate.format("YYYY/MM/DD HH:mm"))});this._time=!1}else $("#"+u).find("#date_"+t.FormPropertyId).daterangepicker({locale:{format:"DD/MM/YYYY",firstDay:1},singleDatePicker:!0,showDropdowns:!0,minYear:1901,maxDate:new Date(2050,11,31)},function(n,i){$("#"+u).find("#hfdate_"+t.FormPropertyId).val(i.format("YYYY-MM-DD"))});f.propval==""&&$("#"+u).find("#date_"+t.FormPropertyId).val("");$(".date_"+t.DocPropertyName).keypress(function(n){if($(".date_"+t.DocPropertyName).attr("maxlength","10"),n.which!=8&&n.which!=0&&(n.which<47||n.which>57))return!1;var i=$(".date_"+t.DocPropertyName).val().toString().replace(/^(\d\d)(\d)$/g,"$1/$2").replace(/^(\d\d\/\d\d)(\d+)$/g,"$1/$2").replace(/[^\d\/]/g,"");$(".date_"+t.DocPropertyName).val(i)});$(".date_"+t.DocPropertyName).focusout(function(){$(".date_"+t.DocPropertyName).val()==""&&$("#hfdate_"+t.FormPropertyId).val("")});f.loadPropertySettings(t.PropertySettings,n,t.DocPropertyName)}loadControl(t,i){var l="",a="",f=i.Validations,u,s,h;if(f!=null)for(u=0;u<f.length;u++)l+=f[u].RegularExp+"||",a+=f[u].ErrorMessage+"||";var c=i.IsRequired!=!0?"hidden":"",e=i.IsRequired!=!0?"":"required",o=i.IsRequired!=!0?"":"*",r=$("#hf_"+$("#hfLayout_InstalledPageId").val()+"_StageId").val();i.IncludedStages!=null&&i.IncludedStages!=""&&(s=i.IncludedStages.split("|"),c=s.find(n=>n==r)?"":"hidden",e=s.find(n=>n==r)?"required":"",o=s.find(n=>n==r)?"*":"");i.ExcludedStages!=null&&i.ExcludedStages!=""&&(h=i.ExcludedStages.split("|"),c=h.find(n=>n==r)?"hidden":"",e=h.find(n=>n==r)?"":"required",o=h.find(n=>n==r)?"":"*");let b="txt_"+i.DocPropertyId;i.IsRequired&&(e="required");let v="";n.Themes.Compact.Components.Index.Instance().desktopMode||(v="readonly");const{helpTooltipHtml:y,helpTextHtml:p}=n.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(i);let w='<div class="floating-label-form-group CancelBtnFloating_'+i.UniqueId+'" id ="div_'+i.UniqueId+'"><label for="lbl" id="lbl_'+i.ControlId+'">'+y+'<span class="label-name">'+i.LabelName+'<\/span><span class="text-danger '+c+'" id="spnIsRequired_'+i.DocPropertyId+'"> *<\/span><\/label><div class="input-group"><input type="hidden" id="hfdate_'+i.UniqueId+'" class="value-control hfdate_'+i.DocPropertyName+'" value=""/><input type="text" id="date_'+i.UniqueId+'" class="form-control type-control datepicker-input hasDatepicker '+e+" floating-label-control txt_"+i.UniqueId+" date_"+i.DocPropertyName+'" placeholder="'+i.LabelName+" "+o+'" data-placeholder="'+i.Placeholder+'" data-label="'+i.LabelName+" "+o+'" data-regularexp="'+l+'" data-validatemsg="'+a+'"'+v+'><span class="input-group-addon mt-10 cursor-pointer"><i class="fa fa-calendar calender_'+i.DocPropertyName+'"><\/i><\/span><input type="hidden" id="hf_'+i.ControlId+'" /><\/div>'+p+"<\/div>";$("#"+t).append(w);n.Forms.Controls.DatePicker.Instance().loadDate(i.UniqueId,i)}loadControlSettings(){return null}loadDate(n,t){var i="control-container-"+n;if(this._time==!0){$("#"+i).find("#date_"+n+".datepicker-input").daterangepicker({autoUpdateInput:!1,timePicker:!0,timePicker24Hour:!0,locale:{format:"DD/MM/YYYY HH:mm",firstDay:1},singleDatePicker:!0,showDropdowns:!0,minYear:1901});$("#"+i).find("#date_"+n+".datepicker-input").on("apply.daterangepicker",function(t,r){$("#"+i).find("#date_"+n).val(r.startDate.format("DD/MM/YYYY HH:mm"));$("#"+i).find("#hfdate_"+n).val(r.startDate.format("YYYY/MM/DD HH:mm"))});this._time=!1}else $("#"+i).find("#date_"+t.FormPropertyId).daterangepicker({locale:{format:"DD/MM/YYYY",firstDay:1},singleDatePicker:!0,showDropdowns:!0,minYear:1901},function(n,r){$("#"+i).find("#hfdate_"+t.FormPropertyId).val(r.format("YYYY-MM-DD"))});$(`.calender_${t.DocPropertyName}`).click(function(){$(this).parents(".input-group").find(".datepicker-input").trigger("click")})}loadPropertySettings(t,i){var f=this,l=!1,p=new Date,r="control-container-"+i,o,u,a,s,e,h,c;if(t!=null)for(o=0;o<t.length;o++){if(u=t[o],u.ControlPropertyName=="IsTodayDate"&&u.ControlPropertyValue=="true"){if(s=$("#"+r).find("#date_"+i).val(),s==""){a=f.disableFutureDate?new Date:new Date(2050,11,31);$("#"+r).find("#date_"+i+".datepicker-input").daterangepicker({singleDatePicker:!0,showDropdowns:!0,minYear:1901,locale:{format:"DD/MM/YYYY",firstDay:1},maxDate:a});var v=$("#"+r).find("#date_"+i).val(),y=moment(v,"DD/MM/YYYY").format("YYYY/MM/DD");$("#"+r).find("#hfdate_"+i).val(y);$("#"+r).find("#date_"+i+".datepicker-input").on("apply.daterangepicker",function(n,t){$("#"+r).find("#date_"+i).val(t.startDate.format("DD/MM/YYYY"));$("#"+r).find("#hfdate_"+i).val(t.startDate.format("YYYY/MM/DD"));$("#"+r).find("#div_"+i).addClass("floating-label-form-group-with-value")})}if($("#"+r).find("#div_"+i).addClass("floating-label-form-group-with-value"),$("#"+r).find("#date_"+i).keypress(function(n){if($(this).attr("maxlength","10"),n.which!=8&&n.which!=0&&(n.which<47||n.which>57))return!1;var t=$(this).val().toString().replace(/^(\d\d)(\d)$/g,"$1/$2").replace(/^(\d\d\/\d\d)(\d+)$/g,"$1/$2").replace(/[^\d\/]/g,"");$(this).val(t)}),f.dtime==!1&&l==!0){s=$("#"+r).find("#date_"+i).val();$("#"+r).find("#date_"+i+".datepicker-input").daterangepicker({autoUpdateInput:!1,timePicker:!0,timePicker24Hour:!0,singleDatePicker:!0,showDropdowns:!0,minYear:1901,locale:{format:"DD/MM/YYYY HH:mm",firstDay:1}});e=new Date;h=n.Platform.Helpers.DateTimeHelper.Instance().formatLocalTime(e,"DD/MM/YYYY HH:mm");$("#"+r).find("#date_"+i).val(h);c=n.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDateTime(e,"YYYY/MM/DD HH:mm");$("#"+r).find("#hfdate_"+i).val(c);$("#"+r).find("#date_"+i+".datepicker-input").on("apply.daterangepicker",function(n,t){$("#"+r).find("#date_"+i).val(t.startDate.format("DD/MM/YYYY HH:mm"));$("#"+r).find("#hfdate_"+i).val(t.startDate.format("YYYY/MM/DD HH:mm"))});let t=new Date;$("#"+r).find("#date_"+i+".datepicker-input").on("show.daterangepicker",function(){var n=$("#"+r).find("#date_"+i).val(),u=n.toString().substring(n.toString().indexOf(":")-2,n.toString().indexOf(":")),t;u.substring(0,1)=="0"&&(u=u.substring(1));t=n.toString().substring(n.toString().indexOf(":")+1,n.toString().indexOf(":")+3);t.substring(0,1)=="0"&&(t=t.substring(1));$(".show-calendar").find(".hourselect option:selected").removeAttr("selected");$(".show-calendar").find(".minuteselect option:selected").removeAttr("selected");$('.hourselect option[value="'+u+'"]').attr("selected","selected");$('.minuteselect option[value="'+t+'"]').attr("selected","selected")})}}if(u.ControlPropertyName=="IsTime"&&f.dtime==!1&&u.ControlPropertyValue=="true"){l=!0;s=$("#"+r).find("#date_"+i).val();$("#"+r).find("#date_"+i+".datepicker-input").daterangepicker({autoUpdateInput:!1,timePicker:!0,timePicker24Hour:!0,singleDatePicker:!0,showDropdowns:!0,minYear:1901,locale:{format:"DD/MM/YYYY HH:mm",firstDay:1}});e=new Date;h=n.Platform.Helpers.DateTimeHelper.Instance().formatLocalTime(e,"DD/MM/YYYY HH:mm");$("#"+r).find("#date_"+i).val(h);c=n.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDateTime(e,"YYYY/MM/DD HH:mm");$("#"+r).find("#hfdate_"+i).val(c);$("#"+r).find("#date_"+i+".datepicker-input").on("apply.daterangepicker",function(n,t){$("#"+r).find("#date_"+i).val(t.startDate.format("DD/MM/YYYY HH:mm"));$("#"+r).find("#hfdate_"+i).val(t.startDate.format("YYYY/MM/DD HH:mm"))});let t=new Date;$("#"+r).find("#date_"+i+".datepicker-input").on("show.daterangepicker",function(){var n=$("#"+r).find("#date_"+i).val(),u=n.toString().substring(n.toString().indexOf(":")-2,n.toString().indexOf(":")),t;u.substring(0,1)=="0"&&(u=u.substring(1));t=n.toString().substring(n.toString().indexOf(":")+1,n.toString().indexOf(":")+3);t.substring(0,1)=="0"&&(t=t.substring(1));$(".show-calendar").find(".hourselect option:selected").removeAttr("selected");$(".show-calendar").find(".minuteselect option:selected").removeAttr("selected");$('.hourselect option[value="'+u+'"]').attr("selected","selected");$('.minuteselect option[value="'+t+'"]').attr("selected","selected")});$(".hasDatepicker").keypress(function(){$(this).attr("maxlength","19");var n=$(this).val().toString().replace(/^(\d\d\/\d\d)(\d+)$/g,"$1/$2").replace(/^(\d\d\/\d\d\/\d\d\d\d)(\d)/g,"$1 ").replace(/^(\d\d\/\d\d\/\d\d\d\d\s\d\d)(\d)/g,"$1:$2$2:");$(this).val(n)})}u.ControlPropertyName=="DisableFutureDate"&&u.ControlPropertyValue=="true"&&($("#"+r).find("#date_"+i+".datepicker-input").daterangepicker({singleDatePicker:!0,showDropdowns:!0,autoUpdateInput:!1,minYear:1901,maxDate:new Date,locale:{format:"DD/MM/YYYY",firstDay:1}},function(n,t){$("#"+r).find("#hfdate_"+i).val(t.format("YYYY-MM-DD"))}),$("#date_"+i+".datepicker-input").keyup(function(){let n=$(this).val(),t=$(this).parents(".formValidate").find(".form-error-message").attr("id"),r=moment(n,["DD/MM/YYYY","D/M/YYYY","DD/M/YYYY","D/MM/YYYY"],!0);MessageHelper.Instance().hideMessage();$(this).attr("data-isValid","false");n.length>=8&&n!=""&&(r.isValid()==!1?MessageHelper.Instance().showError("Enter Correct Date Format!.",t):moment(n,"DD/MM/YYYY").isSameOrBefore(moment().format())==!1?MessageHelper.Instance().showError("You cannot enter a date in the future.",t):moment(n,"DD/MM/YYYY").isSameOrAfter("01/01/1901","year")==!1?MessageHelper.Instance().showError("You cannot enter a date before 1901.",t):(MessageHelper.Instance().hideMessage(),$("#hfdate_"+i).val(moment(n,"DD/MM/YYYY").format("YYYY-MM-DD")),$(this).attr("data-isValid","true")))}),f.disableFutureDate=!0,$("#date_"+i+".datepicker-input").focusout(function(){let n=$(this).attr("data-isValid");n=="false"&&($(this).val(""),$("#hfdate_"+i).val(""),$(this).attr("data-isValid","true"))}))}f.propval="";f.dtime=!1}bindEditFormDetails(t,i){var r=this,f="",u;r.IsTimePicker?(r.propval=moment(i).format("DD/MM/YYYY HH:mm"),f=moment(i).format("YYYY/MM/DD HH:mm"),r._time=!0,$("#date_"+t+".datepicker-input").daterangepicker({autoUpdateInput:!1,timePicker:!0,timePicker24Hour:!0,singleDatePicker:!0,showDropdowns:!0,minYear:1901,locale:{format:"DD/MM/YYYY HH:mm",firstDay:1}}),r.dtime=!0):(r.propval=n.Platform.Helpers.DateTimeHelper.Instance().formatLocalDate1(i,"DD/MM/YYYY"),f=n.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDate(i,"YYYY/MM/DD"));u=n.Platform.Helpers.DateTimeHelper.Instance().serverDateformat(r.propval);(r.propval=="Invalid date"||u=="01/01/1901"||u=="01/01/1900"||u=="01/01/2001"||u=="01/01/0001")&&(r.propval="");$("#hfdate_"+t).val(f);$("#date_"+t).val(r.propval);$("#date_"+t).val()!=""&&$("#div_"+t).addClass("floating-label-form-group-with-value")}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.DatePicker=i})(i=t.Controls||(t.Controls={}))})(t=n.Forms||(n.Forms={}))})(Unibase||(Unibase={}));