Built files from Bizgaze WebServer
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

pricelist.import.js 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Apps;
  4. (function (Apps) {
  5. let Transact;
  6. (function (Transact) {
  7. let Controls;
  8. (function (Controls) {
  9. class PriceList_Import extends Unibase.Platform.Core.BaseComponent {
  10. constructor() {
  11. super();
  12. this.navigationhelper = Unibase.Platform.Helpers.NavigationHelper.Instance();
  13. }
  14. cssFiles() {
  15. return [];
  16. }
  17. jsFiles() {
  18. 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'];
  19. }
  20. html(id, containerid) {
  21. var html = `<form id="form_Import" data-validate="parsley" data-isdynamic="false"><div id="div_importmessage" class="clear"></div>` +
  22. `<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">` +
  23. `<div class="card" id = "importexportsection"><div class="card-header">Select file to import</div><div class="card-body">` +
  24. `<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>` +
  25. `<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>` +
  26. `<div class="bg-white footer" ><button id="btn_CloseImport" class="btn btn-sm mr-auto btn-close">Close</button></div></form>`;
  27. return html;
  28. }
  29. load(id, containerid, callback) {
  30. var instance = this;
  31. $("#btn_CloseImport").click(function () {
  32. $('#' + containerid).modal('hide');
  33. $('#' + containerid).remove();
  34. });
  35. $("#btn_Import").click(function () {
  36. $("#importexportsection").removeClass("hidden");
  37. $("#div_Import").removeClass("hidden");
  38. });
  39. $('#import_File').change(function (e) {
  40. instance.fileEvent(e);
  41. });
  42. $("#fileUpload").click(function () {
  43. let appcontrolid = "form_Import";
  44. let result = Unibase.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation(appcontrolid);
  45. if (result == false) {
  46. MessageHelper.Instance().showError("Plase Select File", "div_importmessage");
  47. return false;
  48. }
  49. else {
  50. PriceList_Import.Instance().importapp(containerid);
  51. }
  52. });
  53. }
  54. importapp(containerid) {
  55. var instance = this;
  56. let IsAllTenants = $("#chk_isalltenants").is(":checked");
  57. instance.navigationHelper.showLoading();
  58. var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/pricelist/importpricelistdata/isalltenants/' + IsAllTenants;
  59. Unibase.Platform.Helpers.FileHelper.Instance().upload(url, Bizgaze.Apps.Transact.Controls.PriceList_Import.fileData).then(function (response) {
  60. if (response.status == Unibase.Data.Status.Error) {
  61. instance.navigationHelper.hideLoading();
  62. MessageHelper.Instance().showError(response.message, "div_importmessage");
  63. }
  64. else {
  65. instance.navigationHelper.hideLoading();
  66. MessageHelper.Instance().showSuccess(response.message, "div_importmessage");
  67. $('#' + containerid).modal('hide');
  68. $('#' + containerid).remove();
  69. }
  70. });
  71. }
  72. showImport() {
  73. var obj = new Bizgaze.Apps.Transact.Controls.PriceList_Import;
  74. this.navigationHelper.popup(0, '', obj, null, Unibase.Platform.Helpers.Size.Large);
  75. }
  76. fileEvent($event) {
  77. const fileSelected = $event.target.files[0];
  78. Bizgaze.Apps.Transact.Controls.PriceList_Import.fileData = new FormData();
  79. Bizgaze.Apps.Transact.Controls.PriceList_Import.fileData.append(fileSelected.name, fileSelected);
  80. }
  81. static Instance() {
  82. if (this.instance === undefined) {
  83. this.instance = new PriceList_Import();
  84. }
  85. return this.instance;
  86. }
  87. }
  88. PriceList_Import.fileData = new FormData();
  89. Controls.PriceList_Import = PriceList_Import;
  90. })(Controls = Transact.Controls || (Transact.Controls = {}));
  91. })(Transact = Apps.Transact || (Apps.Transact = {}));
  92. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  93. })(Bizgaze || (Bizgaze = {}));