';
$("." + Containerid).html(html);
}
load(Containerid) {
}
init(Containerid) {
var jsfiles = ["platform/forms/components/formviewer/formviewer.js", 'libs/parsley/parsley.min.js', "platform/series/managers/seriesmanager.js", 'apps/transact/managers/invoicemanager.js'];
TcsDeclaration.Instance().fileCacheHelper.loadJsFiles(jsfiles, function () {
TcsDeclaration.Instance().loadhtml(Containerid);
$("#btn_Close").click(function () {
TcsDeclaration.Instance().navigationHelper.closePopUp();
});
var tenantname = "";
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/invoicemanager.js", function () {
Bizgaze.Apps.Transact.Managers.InvoiceManager.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 = ["DECEMBER", "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER"];
var cyr = '';
let fromdate = new Date(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().partitionFromDate).getFullYear();
let todate = new Date(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().partitionToDate).getFullYear();
cyr = fromdate + "-" + todate;
$('#MonthAndYear1').text(cyr);
$('#CurrentDate').text(Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDate1(new Date(), ""));
$('#DeclarationMonthI_e_PreviousMonth').text(months[TotalDate.getMonth()]);
var todayDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
var serverdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate(todayDate);
var OnlyDate = serverdate.split("/");
TcsDeclaration.Instance().Enable();
$('#btnSubmit').click(function () {
TcsDeclaration.Instance().save();
});
});
}
Enable() {
var id = Unibase.Platform.Membership.Infos.Identity.getCurrentUser().partitionId;
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/invoicemanager.js", function () {
Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().getTcsDeclaration(id).then(function (response) {
if (response.result == null || response.result == "") {
$("#btnSubmit").removeClass("disabled");
}
else {
$("#btnSubmit").addClass("disabled");
$("#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 = {
Declared: IsDeclared,
UserId: Unibase.Platform.Membership.Infos.Identity.getCurrentUser().userId,
DeclarationDate: new Date(),
PartitionId: Unibase.Platform.Membership.Infos.Identity.getCurrentUser().partitionId
};
Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().saveTcsDeclaration(data).then(function (response) {
MessageHelper.Instance().showSuccess(response.message, '');
$("#isSelfDeclared").prop('checked', true);
$("#isSelfDeclared").prop("disabled", true);
$('#btnSubmit').prop('value', 'Submitted');
$("#btnSubmit").addClass("disabled");
});
}
static Instance() {
if (this.instance === undefined) {
this.instance = new TcsDeclaration();
}
return this.instance;
}
}
Invoices.TcsDeclaration = TcsDeclaration;
})(Invoices = Components.Invoices || (Components.Invoices = {}));
})(Components = Transact.Components || (Transact.Components = {}));
})(Transact = Apps.Transact || (Apps.Transact = {}));
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
})(Bizgaze || (Bizgaze = {}));