123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Controls;
- (function (Controls) {
- class PriceList_Import extends Unibase.Platform.Core.BaseComponent {
- constructor() {
- super();
- this.navigationhelper = Unibase.Platform.Helpers.NavigationHelper.Instance();
- }
- cssFiles() {
- return [];
- }
- jsFiles() {
- return ['apps/transact/controls/pricelist/pricelist.import.js', "platform/forms/components/formviewer/formviewer.js", 'libs/parsley/parsley.min.js', 'platform/core/infos/status.js', '/platform/core/helpers/file/filehelper.js'];
- }
- html(id, containerid) {
- var html = `<form id="form_Import" data-validate="parsley" data-isdynamic="false"><div id="div_importmessage" class="clear"></div>` +
- `<div class="b-b bg-white header dataApiHeader"><strong>Import Price List</strong></div><div data-simplebar class="simple-scroll-bar scrollable import-export-body">` +
- `<div class="card" id = "importexportsection"><div class="card-header">Select file to import</div><div class="card-body">` +
- `<div class="col-sm-6"><div id="div_isalltenants" class="form-group floating-label"><br><label for="lbl" id="lbl_isalltenants" style="align:center;">Is All Teanants</label><span id="spnChk_isalltenants" data-isswitch="false"><label id="lblCheckBox_isalltenants" class="lblCheckBox_isalltenants switch m-t pull-right"><input type="checkbox" id="chk_isalltenants" class="type-control chk_isalltenants" name="isalltenants" placeholder="isalltenants" value="false"><span></span></label></span><input type="hidden" id="hfId" value="false"><label for="Validation" id="lblValidation_isalltenants"></label><input type="hidden" id="hfFormPropertyId" value=""></div></div>` +
- `<div class="" id="div_Import"><input type="file" id="import_File" class="bg-light d-none d-sm-block required"><hr /> <a href="javascript:;" id="fileUpload" class="btn btn-warning text-white">Upload</a></div></div></div></div>` +
- `<div class="bg-white footer" ><button id="btn_CloseImport" class="btn btn-sm mr-auto btn-close">Close</button></div></form>`;
- return html;
- }
- load(id, containerid, callback) {
- var instance = this;
- $("#btn_CloseImport").click(function () {
- $('#' + containerid).modal('hide');
- $('#' + containerid).remove();
- });
- $("#btn_Import").click(function () {
- $("#importexportsection").removeClass("hidden");
- $("#div_Import").removeClass("hidden");
- });
- $('#import_File').change(function (e) {
- instance.fileEvent(e);
- });
- $("#fileUpload").click(function () {
- let appcontrolid = "form_Import";
- let result = Unibase.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation(appcontrolid);
- if (result == false) {
- MessageHelper.Instance().showError("Plase Select File", "div_importmessage");
- return false;
- }
- else {
- PriceList_Import.Instance().importapp(containerid);
- }
- });
- }
- importapp(containerid) {
- var instance = this;
- let IsAllTenants = $("#chk_isalltenants").is(":checked");
- instance.navigationHelper.showLoading();
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/pricelist/importpricelistdata/isalltenants/' + IsAllTenants;
- Unibase.Platform.Helpers.FileHelper.Instance().upload(url, Bizgaze.Apps.Transact.Controls.PriceList_Import.fileData).then(function (response) {
- if (response.status == Unibase.Data.Status.Error) {
- instance.navigationHelper.hideLoading();
- MessageHelper.Instance().showError(response.message, "div_importmessage");
- }
- else {
- instance.navigationHelper.hideLoading();
- MessageHelper.Instance().showSuccess(response.message, "div_importmessage");
- $('#' + containerid).modal('hide');
- $('#' + containerid).remove();
- }
- });
- }
- showImport() {
- var obj = new Bizgaze.Apps.Transact.Controls.PriceList_Import;
- this.navigationHelper.popup(0, '', obj, null, Unibase.Platform.Helpers.Size.Large);
- }
- fileEvent($event) {
- const fileSelected = $event.target.files[0];
- Bizgaze.Apps.Transact.Controls.PriceList_Import.fileData = new FormData();
- Bizgaze.Apps.Transact.Controls.PriceList_Import.fileData.append(fileSelected.name, fileSelected);
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new PriceList_Import();
- }
- return this.instance;
- }
- }
- PriceList_Import.fileData = new FormData();
- Controls.PriceList_Import = PriceList_Import;
- })(Controls = Transact.Controls || (Transact.Controls = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|