@feedmepos/mf-order-setting 0.0.19-alpha → 0.0.19-alpha.2

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.
@@ -1,4 +1,4 @@
1
- import { g as i, s as _, S as C, r as g } from "./dayjs.min-BKR4HjS7.js";
1
+ import { g as i, s as _, S as C, r as g } from "./dayjs.min-Sszw1zIA.js";
2
2
  async function R() {
3
3
  const r = await g().get("/order-settings");
4
4
  return i(r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-order-setting",
3
- "version": "0.0.19-alpha",
3
+ "version": "0.0.19-alpha.2",
4
4
  "type": "module",
5
5
  "module": "./dist/app.js",
6
6
  "license": "UNLICENSED",
@@ -28,15 +28,14 @@
28
28
  <script setup lang="ts">
29
29
  import { computed, h, onMounted, ref, watch } from 'vue'
30
30
  import type { ColumnDef } from '@feedmepos/ui-library'
31
- import { useCoreStore } from '@feedmepos/mf-common'
32
- import type { FdoPickupPoint, FdoRestaurantPickup } from '@feedmepos/core/entity'
31
+ import { useCoreStore, useI18n } from '@feedmepos/mf-common'
32
+ import type { FdoRestaurantPickup } from '@feedmepos/core/entity'
33
33
  import { useRestaurantStore } from '@/stores/restaurant'
34
34
  import useSearch from '@/composables/search'
35
35
  import { sentenceCase } from 'change-case'
36
36
  import PickUpSettingDialog from './PickUpSettingDialog.vue'
37
37
  import { useLoading } from '@/composables/loading'
38
38
  import PickupList from './PickupList.vue'
39
- import { useI18n } from '@feedmepos/mf-common'
40
39
 
41
40
  const { t } = useI18n()
42
41
  const { searchKey, filter } = useSearch()
@@ -44,9 +43,12 @@ const { restaurants, changeRestaurant, currentRestaurant } = useCoreStore()
44
43
  const restaurantStore = useRestaurantStore()
45
44
  const sideSheet = ref<boolean>(false)
46
45
  const { isLoading, startAsyncCallWithErr } = useLoading()
46
+ const currentRestaurants = ref<any[]>([])
47
47
 
48
48
  const pickupSetting = computed<RestaurantPickup[]>(() => {
49
- return restaurants.value.map((r) => {
49
+ console.log('computed')
50
+ console.log(`computed - !!${currentRestaurant.value}`)
51
+ return currentRestaurants.value.map((r: any) => {
50
52
  const restaurantSetting = restaurantStore.restaurantSettings[r._id]
51
53
 
52
54
  return {
@@ -63,8 +65,14 @@ const pickupSetting = computed<RestaurantPickup[]>(() => {
63
65
  async function fetchRestaurants() {
64
66
  await startAsyncCallWithErr(async () => {
65
67
  console.log(`restaurants.value - ${!!restaurants.value}`)
68
+ console.log(`fetchRestaurants - !!${currentRestaurant.value}`)
69
+ if (!!restaurants.value) {
70
+ currentRestaurants.value = [...restaurants.value]
71
+ }
72
+ console.log(`fetchRestaurants - !!${currentRestaurant.value}`)
73
+
66
74
  await Promise.all(
67
- restaurants.value.map(async (r) => {
75
+ currentRestaurants.value.map(async (r: any) => {
68
76
  await restaurantStore.readRestaurantSetting(r._id)
69
77
  })
70
78
  )
@@ -85,13 +93,7 @@ watch(
85
93
  )
86
94
 
87
95
  async function onUpdate() {
88
- await startAsyncCallWithErr(async () => {
89
- await Promise.all(
90
- restaurants.value.map(async (r) => {
91
- await restaurantStore.readRestaurantSetting(r._id)
92
- })
93
- )
94
- })
96
+ await fetchRestaurants()
95
97
  }
96
98
 
97
99
  let originalRestaurant: any
@@ -100,7 +102,7 @@ async function toggleSideSheet(rowData: any) {
100
102
  const v = rowData?.original?.restaurantId ?? rowData?.restaurantId
101
103
  originalRestaurant = currentRestaurant.value
102
104
 
103
- const restaurant = restaurants.value.find((r) => r._id === v)
105
+ const restaurant = currentRestaurants.value.find((r: any) => r._id === v)
104
106
  if (restaurant) {
105
107
  await changeRestaurant(restaurant)
106
108
  }