var Bizgaze;
(function (Bizgaze) {
let Apps;
(function (Apps) {
let Transact;
(function (Transact) {
let Components;
(function (Components) {
let Invoices;
(function (Invoices) {
class printpd extends Unibase.Platform.Core.BaseComponent {
jsFiles() {
return ["apps/transact/Components/Invoices/printpd.js", "platform/core/helpers/autocomplete/autocompletehelper.js", 'libs/parsley/parsley.min.js', , 'tenants/themes/compact/components/details/details.js'];
}
cssFiles() {
return [];
}
html(id, containerid) {
let formid = 0;
var html = '
';
$("." + containerid).html(html);
return "";
}
load(formId, containerid, callback) {
var instance = this;
}
loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
var instance = this;
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
}
init(containerid) {
var instance = this;
instance.getbulkinvoices(containerid);
}
getbulkinvoices(containerid) {
var instance = this;
instance.html("", containerid);
Bizgaze.Apps.Transact.Components.Invoices.printpd.Instance().SalesperonGroupAutoComplete(0);
Bizgaze.Apps.Transact.Components.Invoices.printpd.Instance().OrganizationAutoComplete(0);
$(".invoicefromdate").daterangepicker({
locale: {
format: 'DD/MM/YYYY',
},
singleDatePicker: true,
showDropdowns: true,
minYear: 1901,
maxDate: new Date(2050, 11, 31)
});
$(".invoicefromdate").parents(".floating-label-form-group").addClass("floating-label-form-group-with-value");
$(".invoicetodate").daterangepicker({
locale: {
format: 'DD/MM/YYYY',
},
singleDatePicker: true,
showDropdowns: true,
minYear: 1901,
maxDate: new Date(2050, 11, 31)
});
$(".invoicetodate").parents(".floating-label-form-group").addClass("floating-label-form-group-with-value");
$(".btn_Bulkprint").click(function () {
debugger;
var fromdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate($('.invoicefromdate').val());
var todate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate($('.invoicetodate').val());
var salesperson = $('#hf_AutocompleteId').val();
var organization = $('#hf_OraganizationId').val();
var invoicetype = $('#txt_InvoicetypeName').val();
if (fromdate != "Invalid date" && todate != "Invalid date" && invoicetype != 0) {
instance.getInvoicePrint(fromdate, todate, salesperson, organization, invoicetype);
}
else {
MessageHelper.Instance().showError('From Date and To date are mandatory ', 'bulk_print_error');
}
});
$(".invoicefromdate").change(function (e) {
if (new Date(($(".invoicefromdate").val()).toString().split("/").reverse().join("/")) > new Date(($(".invoicetodate").val()).toString().split("/").reverse().join("/"))) {
setTimeout(function () {
$(".invoicefromdate").val("").trigger("change");
$(".invoicefromdate").attr("placeholder", "dd/mm/yyyy");
}, 200);
MessageHelper.Instance().showError('From Date should not be greater than To Date ', 'bulk_print_error');
e.preventDefault();
}
});
$(".invoicetodate").change(function (e) {
if (new Date(($(".invoicefromdate").val()).toString().split("/").reverse().join("/")) > new Date(($(".invoicetodate").val()).toString().split("/").reverse().join("/"))) {
setTimeout(function () {
$(".invoicetodate").val("").trigger("change");
$(".invoicetodate").attr("placeholder", "dd/mm/yyyy");
}, 200);
MessageHelper.Instance().showError('ToDate should be greater than From Date', 'bulk_print_error');
e.preventDefault();
}
});
}
SalesperonGroupAutoComplete(salespersonId) {
var instance = this;
AutoCompleteHelper.getHelper().Create("#txt_SalesPersonName", "#hf_SalesPersonId", _appsettings.server_url() + "/apis/v4/bizgaze/crm/contacts/getautotextemp", function (result) { });
}
OrganizationAutoComplete(OrganiztionId) {
var instance = this;
AutoCompleteHelper.getHelper().Create("#txt_OraganizationName", "#hf_OraganizationId", _appsettings.server_url() + "/apis/v4/bizgaze/crm/organization/organizationautocompleteasync", function (result) { });
}
getInvoicePrint(fromdate, todate, salesperson, organization, invoicetype) {
var instance = this;
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/invoicemanager.js", function () {
Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().getbulkprint(fromdate, todate, salesperson, organization, invoicetype).then(function (response) {
var info = response.result;
if (info != null) {
var _path = _appsettings.asset_url() + info;
}
else {
MessageHelper.Instance().showError(response.message, 'invoicebulkprint_errormsg');
}
});
});
}
static Instance() {
if (this._instance === undefined) {
this._instance = new printpd();
}
return this._instance;
}
}
Invoices.printpd = printpd;
})(Invoices = Components.Invoices || (Components.Invoices = {}));
})(Components = Transact.Components || (Transact.Components = {}));
})(Transact = Apps.Transact || (Apps.Transact = {}));
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
})(Bizgaze || (Bizgaze = {}));