1 |
- var Bizgaze;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i extends Unibase.Platform.Core.BaseComponent{constructor(){super(...arguments);this._dateTimeHelper=Unibase.Platform.Helpers.DateTimeHelper.Instance()}jsFiles(){return["platform/forms/components/formviewer/formviewer.js","libs/parsley/parsley.min.js"]}cssFiles(){return[]}html(){return""}loadhtml(n){$("."+n).html('<form data-validate="parsley" data-isdynamic="false"><div class="card"><div class="card-header"><h3 class="text-center" style ="color:deepskyblue"><u>Self - Declaration<\/u><\/h3 ><\/div><div style="overflow-x:hidden;" class="d modal-body bg-light"><div class="bg-white mb-10"><div id="bizgaze_CreateErrorMessages" class="clear"><\/div><div class="col-md-12" style ="height:300px; border:1px solid pink"><h4><p>I, <b><span id="userName1"><\/span><\/b> on behalf of <b><span id="lblDistributorName1"><\/span><\/b> hereby, declare that <b><span id="lblDistributorName2"><\/span><\/b> has utilized DMS system to conduct all Mobil related business transactions accurately, completely and in a timely manner for the month of <b><span id="MonthAndYear1"><\/span><\/b>, and the transactional data pertaining to purchase, inventory, sales and market collections (payments received from customers) for the month of <b><span id="MonthAndYear2"><\/span><\/b> is accurate as per my knowledge.<br/><br/><br/> Name: <b><span id="userName2"><\/span><\/b><br/> Date: <b><span id="CurrentDate"><\/span><\/b><br/><br/><\/p><\/h4><span><b><input type="checkbox" style ="width:30px;height:14px;" id="isSelfDeclared"> <span><\/span> Yes, I declare <span id="DeclarationMonthI_e_PreviousMonth" class="hidden"><\/span> <br/><br/><\/span><div class="text-center"><input type="button" class="btn btn-primary btn-md" id="btnSubmit" value="Submit" disabled /><\/div><\/div><\/div><\/div><\/form>')}load(){}init(t){let r=this;i.Instance().fileCacheHelper.loadJsFiles(["platform/forms/components/formviewer/formviewer.js","libs/parsley/parsley.min.js"],function(){var f;i.Instance().loadhtml(t);$("#btn_Close").click(function(){i.Instance().navigationHelper.closePopUp()});f="";Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/crm/contacts/managers/contactmanager.js",function(){n.Apps.Crm.Contacts.Managers.ContactManager.Instance().GetTenants(Number(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().tenantId)).then(function(n){n.result!=null&&(f=n.result.TenantName,$("#lblDistributorName1").text(f.toString()),$("#lblDistributorName2").text(f.toString()))})});$("#userName1").text(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().name);$("#lblDistributorName1").text(f.toString());$("#lblDistributorName2").text(f.toString());$("#userName2").text(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().name);var u=new Date,o=["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"],h=u.getDate(),c=u.getMonth()+1,e=u.getFullYear();o[u.getMonth()]=="DECEMBER"&&(e=e-1);$("#MonthAndYear1").text(o[u.getMonth()]+"-"+e);$("#MonthAndYear2").text(o[u.getMonth()]+"-"+e);$("#CurrentDate").text(h+"/"+c+"/"+e);$("#DeclarationMonthI_e_PreviousMonth").text(o[u.getMonth()]);var l=new Date($.now()),a=r._dateTimeHelper.formatServerDate(l),s=a.split("/");Number(s[2])>=1&&Number(s[2])<=10?$("#btnSubmit").prop("disabled",!1):$("#btnSubmit").prop("disabled",!0);Number(s[2])>10&&($("#btnSubmit").hide(),$("#isSelfDeclared").hide(),$("#description").hide());i.Instance().Enable();$("#btnSubmit").click(function(){i.Instance().save()})})}Enable(){var i,t,r;let u=this;i=new Date($.now());t=u._dateTimeHelper.formatServerDate(i);t=t.replace("/","-").replace("/","-");r=$("#DeclarationMonthI_e_PreviousMonth").text();Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/crm/contacts/managers/contactmanager.js",function(){n.Apps.Crm.Contacts.Managers.ContactManager.Instance().getSelfDeclarationByDate(t,r).then(function(n){n.result=="Record not Found"?$("#btnSubmit").prop("disabled",!1):($("#btnSubmit").prop("disabled",!0),$("#btnSubmit").prop("value","Submitted"),$("#isSelfDeclared").prop("checked",!0),$("#isSelfDeclared").prop("disabled",!0))})})}save(){var r=Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate(),t=$("#isSelfDeclared").prop("checked"),i;if(t==!1)return MessageHelper.Instance().showError("Please Check Declaration","bizgaze_CreateErrorMessages"),!1;i={PciDeclared:t,UserId:Unibase.Platform.Membership.Infos.Identity.getCurrentUser().userId,DeclarationDate:new Date,MonthOfDeclaration:$("#DeclarationMonthI_e_PreviousMonth").text(),PartitionId:Unibase.Platform.Membership.Infos.Identity.getCurrentUser().partitionId};n.Apps.Crm.Contacts.Managers.ContactManager.Instance().saveSelfDeclaration(i).then(function(n){MessageHelper.Instance().showSuccess(n.message,"");$("#isSelfDeclared").prop("checked",!0);$("#isSelfDeclared").prop("disabled",!0);$("#btnSubmit").prop("value","Submitted")})}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.SelfDeclaration=i})(i=t.Components||(t.Components={}))})(i=t.Crm||(t.Crm={}))})(t=n.Apps||(n.Apps={}))})(Bizgaze||(Bizgaze={}));
|