eztech-core-components 1.0.81 → 1.0.82

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eztech-core-components",
3
- "version": "1.0.81",
3
+ "version": "1.0.82",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -160,6 +160,7 @@ export const tableData = {
160
160
  data: [],
161
161
  loading: false,
162
162
  confirming: false,
163
+ confirmCancelling: false,
163
164
  loadingForm: false,
164
165
  loadingExcel: false,
165
166
  restoringPassword: false,
@@ -943,7 +944,7 @@ export const tableMethods = {
943
944
  if (description) {
944
945
  updateData.confirmed_description = description
945
946
  }
946
- const { data } = await this.$axios.post(this.urlConfirm || `confirm/${this.url}`, updateData, {
947
+ const { data } = await this.$axios.post(`confirm/${this.url}`, updateData, {
947
948
  params: { extraFields: extraFields.join(',') }
948
949
  })
949
950
  this.set_unsaved_changes(false)
@@ -959,6 +960,42 @@ export const tableMethods = {
959
960
  this.confirming = false
960
961
  }
961
962
  },
963
+ async handleConfirmCancel () {
964
+ try {
965
+ if (this.unsavedChanges) {
966
+ this.$customError('Та эхлээд өөрчлөлтийг хадгална уу')
967
+ }
968
+ await this.$showConfirm('Та тухайн бүртгэлийг цуцлахдаа итгэлтэй байна уу?')
969
+ this.confirmCancelling = true
970
+ const extraFields = []
971
+ if (this.extraFields) {
972
+ extraFields.push(...this.extraFields?.split(','))
973
+ }
974
+ if (this.customExtraFields) {
975
+ extraFields.push(...this.customExtraFields?.split(','))
976
+ }
977
+ const updateData = {
978
+ _id: this.temp._id,
979
+ is_confirmed: false,
980
+ confirmed_date: null,
981
+ confirmed_user_id: null
982
+ }
983
+ const { data } = await this.$axios.post(`confirm/cancel/${this.url}`, updateData, {
984
+ params: { extraFields: extraFields.join(',') }
985
+ })
986
+ this.set_unsaved_changes(false)
987
+ this.$showSuccess('Амжилттай цуцаллаа.')
988
+ if (this.handleAfterConfirmCancel) {
989
+ this.handleAfterConfirmCancel(data)
990
+ } else {
991
+ await this.resetTemp()
992
+ }
993
+ } catch (err) {
994
+ this.$showError(err)
995
+ } finally {
996
+ this.confirmCancelling = false
997
+ }
998
+ },
962
999
  async handleSave () {
963
1000
  try {
964
1001
  const form = get(this.$refs, 'coreForm') // || get(this.$refs, 'form')