tnx-shared 5.3.290 → 5.3.291

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27676,7 +27676,7 @@
27676
27676
  var resultValidate, flashShow;
27677
27677
  return __generator(this, function (_b) {
27678
27678
  switch (_b.label) {
27679
- case 0: return [4 /*yield*/, this.validateEdit()];
27679
+ case 0: return [4 /*yield*/, this.validateEdit(rowData)];
27680
27680
  case 1:
27681
27681
  resultValidate = _b.sent();
27682
27682
  if (!resultValidate) {
@@ -27702,7 +27702,7 @@
27702
27702
  });
27703
27703
  });
27704
27704
  };
27705
- ListBase.prototype.validateEdit = function () {
27705
+ ListBase.prototype.validateEdit = function (rowData) {
27706
27706
  return __awaiter(this, void 0, void 0, function () {
27707
27707
  return __generator(this, function (_b) {
27708
27708
  return [2 /*return*/, true];
@@ -27734,35 +27734,57 @@
27734
27734
  ListBase.prototype.getPromiseDeleteItem = function (rowData) {
27735
27735
  return this.setting.baseService.delete(rowData.id, this.deletePlusUrl);
27736
27736
  };
27737
+ ListBase.prototype.validateDelete = function (items) {
27738
+ return __awaiter(this, void 0, void 0, function () {
27739
+ return __generator(this, function (_b) {
27740
+ return [2 /*return*/, true];
27741
+ });
27742
+ });
27743
+ };
27737
27744
  ListBase.prototype._delete = function (rowData) {
27738
- var _this = this;
27739
- if (rowData.__disableDelete) {
27740
- return;
27741
- }
27742
- this._notifierService.showDeleteConfirm().then(function (rs) {
27743
- if (!rs) {
27744
- return;
27745
- }
27746
- if (_this.setting.baseService) {
27747
- _this.getPromiseDeleteItem(rowData)
27748
- .then(function (response) {
27749
- if (response.success) {
27750
- _this.beforeReloadAfterDelete([rowData.id]);
27751
- if (_this.setting.showVersionButton) {
27752
- _this.context.fireEvent(ComCtxConstants.COMMON.RELOAD_DATA_VERSION, {}, true);
27745
+ return __awaiter(this, void 0, void 0, function () {
27746
+ var resultValidate;
27747
+ var _this = this;
27748
+ return __generator(this, function (_b) {
27749
+ switch (_b.label) {
27750
+ case 0:
27751
+ if (rowData.__disableDelete) {
27752
+ return [2 /*return*/];
27753
27753
  }
27754
- else {
27755
- _this._triggerProcessData();
27754
+ return [4 /*yield*/, this.validateDelete([rowData])];
27755
+ case 1:
27756
+ resultValidate = _b.sent();
27757
+ if (!resultValidate) {
27758
+ return [2 /*return*/];
27756
27759
  }
27757
- _this._notifierService.showDeleteDataSuccess();
27758
- }
27759
- else {
27760
- _this._notifierService.showWarningByResponse(response);
27761
- }
27762
- }, function (error) {
27763
- _this._notifierService.showDeleteDataError();
27764
- });
27765
- }
27760
+ this._notifierService.showDeleteConfirm().then(function (rs) {
27761
+ if (!rs) {
27762
+ return;
27763
+ }
27764
+ if (_this.setting.baseService) {
27765
+ _this.getPromiseDeleteItem(rowData)
27766
+ .then(function (response) {
27767
+ if (response.success) {
27768
+ _this.beforeReloadAfterDelete([rowData.id]);
27769
+ if (_this.setting.showVersionButton) {
27770
+ _this.context.fireEvent(ComCtxConstants.COMMON.RELOAD_DATA_VERSION, {}, true);
27771
+ }
27772
+ else {
27773
+ _this._triggerProcessData();
27774
+ }
27775
+ _this._notifierService.showDeleteDataSuccess();
27776
+ }
27777
+ else {
27778
+ _this._notifierService.showWarningByResponse(response);
27779
+ }
27780
+ }, function (error) {
27781
+ _this._notifierService.showDeleteDataError();
27782
+ });
27783
+ }
27784
+ });
27785
+ return [2 /*return*/];
27786
+ }
27787
+ });
27766
27788
  });
27767
27789
  };
27768
27790
  ListBase.prototype.getPromiseDeleteItems = function (items) {
@@ -27770,23 +27792,37 @@
27770
27792
  return this.setting.baseService.deleteMany(ids, this.deleteManyPlusUrl);
27771
27793
  };
27772
27794
  ListBase.prototype._deleteMultiple = function (items) {
27773
- var _this = this;
27774
- this._notifierService.showDeleteConfirm('Bạn có chắc chắn muốn xóa bản ghi đã chọn (Và các bản ghi con tương ứng)?').then(function (rs) {
27775
- if (!rs) {
27776
- return;
27777
- }
27778
- if (_this.setting.baseService) {
27779
- _this.getPromiseDeleteItems(items).then(function (response) {
27780
- if (response.success) {
27781
- _this.beforeReloadAfterDelete(items.map(function (q) { return q.id; }));
27782
- _this._triggerProcessData();
27783
- _this._notifierService.showDeleteDataSuccess();
27784
- }
27785
- else {
27786
- _this._notifierService.showWarningByResponse(response);
27787
- }
27788
- });
27789
- }
27795
+ return __awaiter(this, void 0, void 0, function () {
27796
+ var resultValidate;
27797
+ var _this = this;
27798
+ return __generator(this, function (_b) {
27799
+ switch (_b.label) {
27800
+ case 0: return [4 /*yield*/, this.validateDelete(items)];
27801
+ case 1:
27802
+ resultValidate = _b.sent();
27803
+ if (!resultValidate) {
27804
+ return [2 /*return*/];
27805
+ }
27806
+ this._notifierService.showDeleteConfirm('Bạn có chắc chắn muốn xóa bản ghi đã chọn (Và các bản ghi con tương ứng)?').then(function (rs) {
27807
+ if (!rs) {
27808
+ return;
27809
+ }
27810
+ if (_this.setting.baseService) {
27811
+ _this.getPromiseDeleteItems(items).then(function (response) {
27812
+ if (response.success) {
27813
+ _this.beforeReloadAfterDelete(items.map(function (q) { return q.id; }));
27814
+ _this._triggerProcessData();
27815
+ _this._notifierService.showDeleteDataSuccess();
27816
+ }
27817
+ else {
27818
+ _this._notifierService.showWarningByResponse(response);
27819
+ }
27820
+ });
27821
+ }
27822
+ });
27823
+ return [2 /*return*/];
27824
+ }
27825
+ });
27790
27826
  });
27791
27827
  };
27792
27828
  ListBase.prototype.beforeReloadAfterDelete = function (ids) {