123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Crm;
- (function (Crm) {
- let Components;
- (function (Components) {
- class SelfDeclaration 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() {
- var html = '';
- return html;
- }
- loadhtml(Containerid) {
- var 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>';
- $("." + Containerid).html(html);
- }
- load(Containerid) {
- }
- init(Containerid) {
- let instance = this;
- var jsfiles = ["platform/forms/components/formviewer/formviewer.js", 'libs/parsley/parsley.min.js'];
- SelfDeclaration.Instance().fileCacheHelper.loadJsFiles(jsfiles, function () {
- SelfDeclaration.Instance().loadhtml(Containerid);
- $("#btn_Close").click(function () {
- SelfDeclaration.Instance().navigationHelper.closePopUp();
- });
- var tenantname = "";
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/crm/contacts/managers/contactmanager.js", function () {
- Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().GetTenants(Number(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().tenantId)).then(function (res) {
- if (res.result != null) {
- tenantname = res.result.TenantName;
- $("#lblDistributorName1").text(tenantname.toString());
- $("#lblDistributorName2").text(tenantname.toString());
- }
- });
- });
- $("#userName1").text(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().name);
- $("#lblDistributorName1").text(tenantname.toString());
- $("#lblDistributorName2").text(tenantname.toString());
- $("#userName2").text(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().name);
- var TotalDate = new Date();
- var months = ["JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"];
- var date = TotalDate.getDate();
- var month = TotalDate.getMonth() + 1;
- var year = TotalDate.getFullYear();
- if (months[TotalDate.getMonth()] == "DECEMBER") {
- year = year - 1;
- }
- $('#MonthAndYear1').text(months[TotalDate.getMonth()] + "-" + year);
- $('#MonthAndYear2').text(months[TotalDate.getMonth()] + "-" + year);
- $('#CurrentDate').text(date + "/" + month + "/" + year);
- $('#DeclarationMonthI_e_PreviousMonth').text(months[TotalDate.getMonth()]);
- var todayDate = new Date($.now());
- var serverdate = instance._dateTimeHelper.formatServerDate(todayDate);
- var OnlyDate = serverdate.split("/");
- if (Number(OnlyDate[2]) >= 1 && Number(OnlyDate[2]) <= 10) {
- $("#btnSubmit").prop('disabled', false);
- }
- else {
- $("#btnSubmit").prop('disabled', true);
- }
- if (Number(OnlyDate[2]) > 10) {
- $("#btnSubmit").hide();
- $("#isSelfDeclared").hide();
- $("#description").hide();
- }
- SelfDeclaration.Instance().Enable();
- $('#btnSubmit').click(function () {
- SelfDeclaration.Instance().save();
- });
- });
- }
- Enable() {
- let instance = this;
- var da = new Date($.now());
- var date = instance._dateTimeHelper.formatServerDate(da);
- date = date.replace('/', '-').replace('/', '-');
- var month = $('#DeclarationMonthI_e_PreviousMonth').text();
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/crm/contacts/managers/contactmanager.js", function () {
- Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().getSelfDeclarationByDate(date, month).then(function (response) {
- if (response.result == "Record not Found") {
- $("#btnSubmit").prop("disabled", false);
- }
- else {
- $("#btnSubmit").prop("disabled", true);
- $('#btnSubmit').prop('value', 'Submitted');
- $("#isSelfDeclared").prop('checked', true);
- $("#isSelfDeclared").prop("disabled", true);
- }
- });
- });
- }
- save() {
- var date = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- var IsDeclared = $("#isSelfDeclared").prop('checked');
- if (IsDeclared == false) {
- MessageHelper.Instance().showError('Please Check Declaration', 'bizgaze_CreateErrorMessages');
- return false;
- }
- var data = {
- PciDeclared: IsDeclared,
- UserId: Unibase.Platform.Membership.Infos.Identity.getCurrentUser().userId,
- DeclarationDate: new Date(),
- MonthOfDeclaration: $('#DeclarationMonthI_e_PreviousMonth').text(),
- PartitionId: Unibase.Platform.Membership.Infos.Identity.getCurrentUser().partitionId
- };
- Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().saveSelfDeclaration(data).then(function (response) {
- MessageHelper.Instance().showSuccess(response.message, '');
- $("#isSelfDeclared").prop('checked', true);
- $("#isSelfDeclared").prop("disabled", true);
- $('#btnSubmit').prop('value', 'Submitted');
- });
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new SelfDeclaration();
- }
- return this.instance;
- }
- }
- Components.SelfDeclaration = SelfDeclaration;
- })(Components = Crm.Components || (Crm.Components = {}));
- })(Crm = Apps.Crm || (Apps.Crm = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|