@feedmepos/mf-order-setting 0.0.15-alpha.1 → 0.0.16-alpha

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.
Files changed (44) hide show
  1. package/dist/KioskSettingView-CLLklQtJ.js +4 -0
  2. package/dist/{app-Cu7GdqUm.js → app-DHq9VPij.js} +11872 -11816
  3. package/dist/app.js +5 -4
  4. package/dist/frontend/mf-order/src/api/restaurant-setting/index.d.ts +1 -1
  5. package/dist/frontend/mf-order/src/app.d.ts +1 -0
  6. package/dist/frontend/mf-order/src/helpers/map.d.ts +3 -2
  7. package/dist/frontend/mf-order/src/stores/kiosk/index.d.ts +6 -6
  8. package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +403 -8
  9. package/dist/frontend/mf-order/src/views/all-orders/FilterRestaurant.vue.d.ts +4 -4
  10. package/dist/frontend/mf-order/src/views/all-orders/ReflowOrder.vue.d.ts +2 -2
  11. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  12. package/dist/package/entity/delivery/delivery.dto.d.ts +6 -6
  13. package/dist/package/entity/delivery/gateway/pandago.dto.d.ts +10 -10
  14. package/dist/package/entity/food-court/order.dto.d.ts +42 -36273
  15. package/dist/package/entity/kiosk/kiosk.do.d.ts +20 -20
  16. package/dist/package/entity/kiosk/kiosk.dto.d.ts +24 -24
  17. package/dist/package/entity/order/order-item/order-item.dto.d.ts +52 -0
  18. package/dist/package/entity/order/order.dto.d.ts +734 -278
  19. package/dist/package/entity/order/payment/payment.dto.d.ts +152 -152
  20. package/dist/package/entity/order-platform/foodpanda/foodpanda-order.do.d.ts +24 -24
  21. package/dist/package/entity/order-platform/foodpanda/foodpanda-order.dto.d.ts +6 -6
  22. package/dist/package/entity/order-platform/grabfood/grabfood-menu.do.d.ts +74 -74
  23. package/dist/package/entity/order-platform/grabfood/grabfood-order.do.d.ts +106 -106
  24. package/dist/package/entity/order-platform/grabfood/grabfood.dto.d.ts +32 -32
  25. package/dist/package/entity/order-platform/menu.dto.d.ts +54 -54
  26. package/dist/package/entity/order-platform/shopeefood/shopeefood-order.do.d.ts +238 -238
  27. package/dist/package/entity/order-platform/shopeefood/shopeefood-order.dto.d.ts +64 -64
  28. package/dist/package/entity/payment/payment.dto.d.ts +2 -2
  29. package/dist/package/entity/printer/printer.do.d.ts +2 -2
  30. package/dist/package/entity/websocket/websocket.dto.d.ts +2 -2
  31. package/package.json +1 -1
  32. package/src/Entry.vue +3 -9
  33. package/src/api/restaurant-setting/index.ts +3 -2
  34. package/src/app.ts +17 -0
  35. package/src/components/GoogleMap.vue +102 -104
  36. package/src/helpers/map.ts +23 -15
  37. package/src/stores/restaurant/index.ts +3 -3
  38. package/src/views/order-settings/delivery/DeliverySetting.vue +11 -12
  39. package/src/views/order-settings/delivery/inhouse/DeliveryOrder.vue +3 -2
  40. package/src/views/order-settings/pickup/AddressInput.vue +3 -2
  41. package/src/views/order-settings/pickup/PickUpSetting.vue +34 -25
  42. package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +4 -1
  43. package/vite.config.ts +3 -3
  44. package/dist/KioskSettingView-ChG0eNUq.js +0 -4
@@ -1,216 +1,214 @@
1
1
  <script setup lang="ts">
2
- import { ref, onMounted, watch, type PropType, toRaw, onUnmounted } from 'vue';
3
- import { coordinates, googleMap } from '@/helpers/map';
4
- import type { MarkerChangeEvent, PolygonChangeEvent, MapCoordinate, MapPolygon } from './type';
2
+ import { ref, onMounted, watch, type PropType, toRaw, onUnmounted } from 'vue'
3
+ import { coordinates, googleMap } from '@/helpers/map'
4
+ import type { MarkerChangeEvent, PolygonChangeEvent, MapCoordinate, MapPolygon } from './type'
5
5
 
6
6
  interface PolygonEventHandler {
7
- click: (ev: google.maps.PolyMouseEvent) => void;
8
- contextmenu: (v: google.maps.PolyMouseEvent) => void;
9
- dblclick: (v: google.maps.PolyMouseEvent) => void;
10
- drag: (v: google.maps.MapMouseEvent) => void;
11
- dragend: (v: google.maps.MapMouseEvent) => void;
12
- dragstart: (v: google.maps.MapMouseEvent) => void;
13
- mousedown: (v: google.maps.PolyMouseEvent) => void;
14
- mousemove: (v: google.maps.PolyMouseEvent) => void;
15
- mouseout: (v: google.maps.PolyMouseEvent) => void;
16
- mouseover: (v: google.maps.PolyMouseEvent) => void;
17
- mouseup: (v: google.maps.PolyMouseEvent) => void;
7
+ click: (ev: google.maps.PolyMouseEvent) => void
8
+ contextmenu: (v: google.maps.PolyMouseEvent) => void
9
+ dblclick: (v: google.maps.PolyMouseEvent) => void
10
+ drag: (v: google.maps.MapMouseEvent) => void
11
+ dragend: (v: google.maps.MapMouseEvent) => void
12
+ dragstart: (v: google.maps.MapMouseEvent) => void
13
+ mousedown: (v: google.maps.PolyMouseEvent) => void
14
+ mousemove: (v: google.maps.PolyMouseEvent) => void
15
+ mouseout: (v: google.maps.PolyMouseEvent) => void
16
+ mouseover: (v: google.maps.PolyMouseEvent) => void
17
+ mouseup: (v: google.maps.PolyMouseEvent) => void
18
18
  }
19
19
 
20
- type Vertex = google.maps.MVCArray<google.maps.LatLng>;
20
+ type Vertex = google.maps.MVCArray<google.maps.LatLng>
21
21
 
22
22
  const props = defineProps({
23
23
  markers: {
24
24
  type: Array as PropType<MapCoordinate[]>,
25
- default: () => [],
25
+ default: () => []
26
26
  },
27
27
  polygons: {
28
28
  type: Array as PropType<MapPolygon[]>,
29
- default: () => [],
29
+ default: () => []
30
30
  },
31
31
  zoom: {
32
32
  type: Number,
33
- default: 14,
33
+ default: 14
34
34
  },
35
35
  editable: {
36
36
  type: Boolean,
37
- default: false,
37
+ default: false
38
38
  },
39
39
  center: {
40
40
  type: Object as PropType<{
41
- lat: number;
42
- lng: number;
41
+ lat: number
42
+ lng: number
43
43
  }>,
44
- default: coordinates.jb,
45
- },
46
- });
44
+ default: coordinates.jb
45
+ }
46
+ })
47
47
 
48
48
  const emits = defineEmits<{
49
- (event: 'map-click', ev: MapCoordinate): void;
50
- (event: 'marker-change', ev: MarkerChangeEvent): void;
51
- (event: 'polygon-change', ev: PolygonChangeEvent): void;
52
- (event: 'polygon-right-click', ev: number): void;
53
- }>();
49
+ (event: 'map-click', ev: MapCoordinate): void
50
+ (event: 'marker-change', ev: MarkerChangeEvent): void
51
+ (event: 'polygon-change', ev: PolygonChangeEvent): void
52
+ (event: 'polygon-right-click', ev: number): void
53
+ }>()
54
54
 
55
55
  defineExpose({
56
56
  setCenter: (coordinate: MapCoordinate) => {
57
- map.value?.setCenter(coordinate);
58
- },
59
- });
57
+ map.value?.setCenter(coordinate)
58
+ }
59
+ })
60
60
 
61
- const mapRef = ref<Element>();
62
- const map = ref<google.maps.Map | null>(null);
63
- const listeners: google.maps.MapsEventListener[] = [];
61
+ const mapRef = ref<Element>()
62
+ const map = ref<google.maps.Map | null>(null)
63
+ const listeners: google.maps.MapsEventListener[] = []
64
64
 
65
65
  function formatCoordinate(ev: google.maps.MapMouseEvent) {
66
66
  return {
67
67
  lat: ev.latLng.lat(),
68
- lng: ev.latLng.lng(),
69
- };
68
+ lng: ev.latLng.lng()
69
+ }
70
70
  }
71
71
 
72
72
  function addListenerToMap(instance: object, eventName: string, callback: (...args: any[]) => void) {
73
- const listener = googleMap.maps.event.addListener(instance, eventName, callback);
74
- listeners.push(listener);
73
+ const listener = googleMap()!.maps.event.addListener(instance, eventName, callback)
74
+ listeners.push(listener)
75
75
  }
76
76
 
77
- const markers = ref<google.maps.Marker[]>([]);
77
+ const markers = ref<google.maps.Marker[]>([])
78
78
 
79
79
  function addMarkerListener<N extends keyof google.maps.MarkerHandlerMap<google.maps.Marker>>(
80
80
  marker: google.maps.Marker,
81
81
  event: N,
82
- callback: google.maps.MarkerHandlerMap<google.maps.Marker>[N],
82
+ callback: google.maps.MarkerHandlerMap<google.maps.Marker>[N]
83
83
  ) {
84
- addListenerToMap(marker, event, callback);
84
+ addListenerToMap(marker, event, callback)
85
85
  }
86
86
 
87
87
  function setMarkers(newMarkers: MapCoordinate[]) {
88
- setMapOnAllMarkers(null);
88
+ setMapOnAllMarkers(null)
89
89
  markers.value = newMarkers.map((m, index) => {
90
- const marker = new googleMap.maps.Marker({
90
+ const map = googleMap()
91
+ const marker = new map.maps.Marker({
91
92
  position: m,
92
- draggable: true,
93
- });
93
+ draggable: true
94
+ })
94
95
  addMarkerListener(marker, 'dragend', (ev) => {
95
- emits('marker-change', { index, position: formatCoordinate(ev) });
96
- });
97
- return marker;
98
- });
99
- setMapOnAllMarkers(map.value);
96
+ emits('marker-change', { index, position: formatCoordinate(ev) })
97
+ })
98
+ return marker
99
+ })
100
+ setMapOnAllMarkers(map.value)
100
101
  }
101
102
 
102
103
  function setMapOnAllMarkers(map: google.maps.Map | null) {
103
- markers.value.map((marker) => toRaw(marker).setMap(map));
104
+ markers.value.map((marker) => toRaw(marker).setMap(map))
104
105
  }
105
106
 
106
- const polygons = ref<google.maps.Polygon[]>([]);
107
+ const polygons = ref<google.maps.Polygon[]>([])
107
108
 
108
109
  function addPolygonListener<N extends keyof PolygonEventHandler>(
109
110
  polygon: google.maps.Polygon,
110
111
  event: N,
111
- callback: PolygonEventHandler[N],
112
+ callback: PolygonEventHandler[N]
112
113
  ) {
113
- addListenerToMap(polygon, event, callback);
114
+ addListenerToMap(polygon, event, callback)
114
115
  }
115
116
 
116
- function addVertexListener<N extends keyof google.maps.MVCArrayHandlerMap<Vertex, google.maps.LatLng>>(
117
- path: Vertex,
118
- event: N,
119
- callback: google.maps.MVCArrayHandlerMap<Vertex, google.maps.LatLng>[N],
120
- ) {
121
- addListenerToMap(path, event, callback);
117
+ function addVertexListener<
118
+ N extends keyof google.maps.MVCArrayHandlerMap<Vertex, google.maps.LatLng>
119
+ >(path: Vertex, event: N, callback: google.maps.MVCArrayHandlerMap<Vertex, google.maps.LatLng>[N]) {
120
+ addListenerToMap(path, event, callback)
122
121
  }
123
122
 
124
123
  function getPolygonPath(index: number) {
125
- const path = polygons.value[index].getPath().getArray();
124
+ const path = polygons.value[index].getPath().getArray()
126
125
  return path.map(({ lat, lng }) => ({
127
126
  lat: lat(),
128
- lng: lng(),
129
- }));
127
+ lng: lng()
128
+ }))
130
129
  }
131
130
 
132
131
  function polygonChanged(polygonIndex: number) {
133
- const newPath = getPolygonPath(polygonIndex);
134
- emits('polygon-change', { index: polygonIndex, path: newPath });
132
+ const newPath = getPolygonPath(polygonIndex)
133
+ emits('polygon-change', { index: polygonIndex, path: newPath })
135
134
  }
136
135
 
137
136
  function removePolygonVertex(polygonIndex: number, vertexIndex: number) {
138
- const path = getPolygonPath(polygonIndex);
139
- const newPath = path.filter((_, i) => i !== vertexIndex);
140
- emits('polygon-change', { index: polygonIndex, path: newPath });
137
+ const path = getPolygonPath(polygonIndex)
138
+ const newPath = path.filter((_, i) => i !== vertexIndex)
139
+ emits('polygon-change', { index: polygonIndex, path: newPath })
141
140
  }
142
141
 
143
142
  function polygonRightClick(polygonIndex: number, ev: google.maps.PolyMouseEvent) {
144
143
  if (ev.vertex !== undefined) {
145
- removePolygonVertex(polygonIndex, ev.vertex);
144
+ removePolygonVertex(polygonIndex, ev.vertex)
146
145
  } else {
147
- emits('polygon-right-click', polygonIndex);
146
+ emits('polygon-right-click', polygonIndex)
148
147
  }
149
148
  }
150
149
 
151
150
  function setPolygons(newPolygons: MapPolygon[]) {
152
- setMapOnAllPolygons(null);
151
+ setMapOnAllPolygons(null)
153
152
  polygons.value = newPolygons.map((p, index) => {
154
- const polygon = new googleMap.maps.Polygon({
153
+ const map = googleMap()
154
+ const polygon = new map.maps.Polygon({
155
155
  paths: p.paths,
156
156
  strokeColor: p.strokeColor,
157
157
  fillColor: p.fillColor,
158
158
  fillOpacity: 0.5,
159
- editable: props.editable,
160
- });
161
- addPolygonListener(polygon, 'contextmenu', (v) => polygonRightClick(index, v));
162
- polygon.getPaths().forEach(path => {
163
- addVertexListener(path, 'insert_at', () => polygonChanged(index));
164
- addVertexListener(path, 'set_at', () => polygonChanged(index));
165
- });
166
- return polygon;
167
- });
168
- setMapOnAllPolygons(map.value);
159
+ editable: props.editable
160
+ })
161
+ addPolygonListener(polygon, 'contextmenu', (v) => polygonRightClick(index, v))
162
+ polygon.getPaths().forEach((path) => {
163
+ addVertexListener(path, 'insert_at', () => polygonChanged(index))
164
+ addVertexListener(path, 'set_at', () => polygonChanged(index))
165
+ })
166
+ return polygon
167
+ })
168
+ setMapOnAllPolygons(map.value)
169
169
  }
170
170
 
171
171
  function setMapOnAllPolygons(map: google.maps.Map | null) {
172
- polygons.value.map((polygon) => toRaw(polygon).setMap(map));
172
+ polygons.value.map((polygon) => toRaw(polygon).setMap(map))
173
173
  }
174
174
 
175
175
  function addMapListener<N extends keyof google.maps.MapHandlerMap<google.maps.Map>>(
176
176
  map: google.maps.Map,
177
177
  event: N,
178
- callback: google.maps.MapHandlerMap<google.maps.Map>[N],
178
+ callback: google.maps.MapHandlerMap<google.maps.Map>[N]
179
179
  ) {
180
- addListenerToMap(map, event, callback);
180
+ addListenerToMap(map, event, callback)
181
181
  }
182
182
 
183
183
  function setMap() {
184
- map.value = new googleMap.maps.Map(mapRef.value as Element, {
184
+ const Map = googleMap().maps.Map
185
+ map.value = new Map(mapRef.value as Element, {
185
186
  center: props.center,
186
187
  zoom: props.zoom,
187
188
  mapTypeControl: false,
188
189
  streetViewControl: false,
189
190
  draggable: true,
190
- scrollwheel: true,
191
- });
191
+ scrollwheel: true
192
+ })
192
193
 
193
- addMapListener(map.value, 'click', (ev) => emits('map-click', formatCoordinate(ev)));
194
+ addMapListener(map.value, 'click', (ev) => emits('map-click', formatCoordinate(ev)))
194
195
  }
195
196
 
196
- watch(() => props.markers, setMarkers, { deep: true });
197
- watch(() => props.polygons, setPolygons, { deep: true });
197
+ watch(() => props.markers, setMarkers, { deep: true })
198
+ watch(() => props.polygons, setPolygons, { deep: true })
198
199
 
199
200
  onMounted(() => {
200
- if (!mapRef.value || !googleMap) return;
201
- setMap();
202
- setMarkers(props.markers);
203
- setPolygons(props.polygons);
204
- });
201
+ if (!mapRef.value || !googleMap()) return
202
+ setMap()
203
+ setMarkers(props.markers)
204
+ setPolygons(props.polygons)
205
+ })
205
206
 
206
207
  onUnmounted(() => {
207
- listeners.forEach((listener) => listener.remove());
208
- });
208
+ listeners.forEach((listener) => listener.remove())
209
+ })
209
210
  </script>
210
211
 
211
212
  <template>
212
- <div
213
- ref="mapRef"
214
- class="map app-map"
215
- />
216
- </template>
213
+ <div ref="mapRef" class="map app-map" />
214
+ </template>
@@ -1,9 +1,16 @@
1
+ /// <reference types="googlemaps" />
1
2
  import { type MapCoordinate } from '@/components/type';
3
+ import { ref } from "vue"
2
4
 
3
- let googleMap: typeof google;
5
+ const _googleMap = ref<typeof google | null>(null)
6
+
7
+ // defines a getter
8
+ const googleMap = (): typeof google => {
9
+ return _googleMap.value!
10
+ }
4
11
 
5
12
  export function setGoogleMap(map: typeof google) {
6
- if (!googleMap) googleMap = map;
13
+ if (!_googleMap.value) _googleMap.value = map
7
14
  }
8
15
 
9
16
  const coordinates = Object.freeze({
@@ -27,25 +34,26 @@ function arrayToCoordinate(arr: number[]) {
27
34
 
28
35
  function generateAreaPaths({
29
36
  center,
30
- radius,
37
+ radius
31
38
  }: {
32
- radius: number;
39
+ radius: number
33
40
  center: {
34
- lng: number;
35
- lat: number;
41
+ lng: number
42
+ lat: number
36
43
  }
37
44
  }): { lat: number; lng: number }[] {
38
- const searchPoint = [];
39
- const radiusLat = (radius / 6371) * (180 / Math.PI);
40
- const radiusLng = radiusLat / Math.cos(center.lat * (Math.PI / 180));
45
+ const searchPoint: google.maps.LatLng[] = []
46
+ const radiusLat = (radius / 6371) * (180 / Math.PI)
47
+ const radiusLng = radiusLat / Math.cos(center.lat * (Math.PI / 180))
41
48
  for (let a = 0; a < 361; a += 45) {
42
- const aRad = a * (Math.PI / 180);
43
- const x = center.lng + (radiusLng * Math.cos(aRad));
44
- const y = center.lat + (radiusLat * Math.sin(aRad));
45
- const point = new googleMap.maps.LatLng(y, x, true);
46
- searchPoint.push(point);
49
+ const aRad = a * (Math.PI / 180)
50
+ const x = center.lng + radiusLng * Math.cos(aRad)
51
+ const y = center.lat + radiusLat * Math.sin(aRad)
52
+ const map = googleMap()
53
+ const point = new map.maps.LatLng(y, x, true)
54
+ searchPoint.push(point)
47
55
  }
48
- return searchPoint.map(v => ({ lat: v.lat(), lng: v.lng() }));
56
+ return searchPoint.map((v) => ({ lat: v.lat(), lng: v.lng() }))
49
57
  }
50
58
 
51
59
  function pathToPolygon(path: MapCoordinate[]): number[][] {
@@ -72,7 +72,7 @@ export const useRestaurantStore = defineStore('restaurant', {
72
72
  },
73
73
  actions: {
74
74
  async readRestaurantSetting(restaurantId: string) {
75
- const restaurantSetting = await restaurantApi.readRestaurantSetting()
75
+ const restaurantSetting = await restaurantApi.readRestaurantSetting(restaurantId)
76
76
  this.restaurantSettings = {
77
77
  ...this.restaurantSettings,
78
78
  [restaurantId]: restaurantSetting
@@ -101,7 +101,7 @@ export const useRestaurantStore = defineStore('restaurant', {
101
101
  await remoteOrderApi.integratedDelivery.updateInhouse(restaurantId, dto)
102
102
  },
103
103
  async updateFeedmeDelivery(restaurantId: string, dto: FdoRestaurantFeedmeDelivery) {
104
- await remoteOrderApi.integratedDelivery.updateFeedme(restaurantId, dto)
104
+ return await remoteOrderApi.integratedDelivery.updateFeedme(restaurantId, dto)
105
105
  },
106
106
  async updateIntegratedFoodpandaDelivery(restaurantId: string, dto: FdoFoodpandaSettings) {
107
107
  await remoteOrderApi.integratedDelivery.updateFoodpanda(restaurantId, dto)
@@ -126,7 +126,7 @@ export const useRestaurantStore = defineStore('restaurant', {
126
126
  })
127
127
 
128
128
  if (!validPosVersion)
129
- return t('order.payoutPosVersion', {version: Pos.minVersionToUse(F_FEATURE.enum.qrEPayment)})
129
+ return t('order.payoutPosVersion', { version: Pos.minVersionToUse(F_FEATURE.enum.qrEPayment) })
130
130
  if (!payoutAccount || !payoutAccount.enable) {
131
131
  return t('order.payoutAccountIsRequired')
132
132
  }
@@ -746,11 +746,16 @@ async function updateIntegratedDeliverySetting() {
746
746
 
747
747
  async function updateFeedmeExpressSetting() {
748
748
  sideSheetIntegrated.value = false
749
- await restaurantStore.updateFeedmeDelivery(currentRestaurant.value?._id ?? '', feedMeDoc.value)
750
- const res = (await readRestaurants())?.find((res) => res._id === currentRestaurant.value?._id)
751
- if (!!res) {
752
- changeRestaurant(res)
753
- }
749
+
750
+ await startAsyncCallWithErr(async () => {
751
+ const restaurant = await restaurantStore.updateFeedmeDelivery(
752
+ currentRestaurant.value?._id ?? '',
753
+ feedMeDoc.value
754
+ )
755
+ if (!!currentRestaurant.value?.feedmeDelivery) {
756
+ currentRestaurant.value.feedmeDelivery = restaurant.feedmeDelivery
757
+ }
758
+ })
754
759
  showSuccess('Delivery setting updated. ')
755
760
  }
756
761
 
@@ -759,7 +764,7 @@ async function updateInHouseSetting() {
759
764
  await restaurantStore.updateInhouseDelivery(currentRestaurant.value?._id ?? '', inHouseDoc.value)
760
765
  const res = (await readRestaurants())?.find((res) => res._id === currentRestaurant.value?._id)
761
766
  if (!!res) {
762
- changeRestaurant(res)
767
+ await changeRestaurant(res)
763
768
  }
764
769
  showSuccess('Delivery setting updated. ')
765
770
  }
@@ -800,11 +805,6 @@ async function updateDelivery(
800
805
  break
801
806
  }
802
807
  }
803
-
804
- const res = (await readRestaurants())?.find((res) => res._id === currentRestaurant.value?._id)
805
- if (!!res) {
806
- changeRestaurant(res)
807
- }
808
808
  }
809
809
 
810
810
  const feedMeDoc = computed(() => feedMeComponentProps.value.initialValue)
@@ -876,7 +876,6 @@ function convertIntegratedCompanyName(name: companyName): string {
876
876
 
877
877
  watch(
878
878
  () => currentRestaurant.value,
879
-
880
879
  async (newRestaurant) => {
881
880
  if (newRestaurant) {
882
881
  await readData()
@@ -2,7 +2,7 @@
2
2
  import type { MapPolygon } from '@/components/type'
3
3
  import { useLoading } from '@/composables/loading'
4
4
  import { formatCurrency } from '@/helpers/currency'
5
- import { arrayToCoordinate, getPolygonCenter, googleMap as gm } from '@/helpers/map'
5
+ import { arrayToCoordinate, getPolygonCenter, googleMap } from '@/helpers/map'
6
6
  import { clone } from '@/helpers/object'
7
7
  import type { FdoAddress, FdoDeliveryArea } from '@feedmepos/core/entity'
8
8
  import GoogleMap from '@/components/GoogleMap.vue'
@@ -147,7 +147,8 @@ async function getCenter() {
147
147
  center.value = arrayToCoordinate(coordinates || [])
148
148
  gmRef.value?.setCenter(center.value)
149
149
  } catch (err) {
150
- const geocoder = new gm.maps.Geocoder()
150
+ const map = googleMap()
151
+ const geocoder = new map.maps.Geocoder()
151
152
  await startAsyncCallWithErr(async () => {
152
153
  await new Promise((resolve) => {
153
154
  geocoder.geocode({ address: formatted }, (res) => {
@@ -22,7 +22,8 @@ function input(v: string) {
22
22
 
23
23
  const modelValue = ref(props.initialValue || '')
24
24
  const placeOptions = ref<string[]>([])
25
- const autocomplete = new googleMap.maps.places.AutocompleteService()
25
+ const map = googleMap()
26
+ const autocomplete = new map.maps.places.AutocompleteService()
26
27
 
27
28
  function filterFn(val: string) {
28
29
  autocomplete.getPlacePredictions({ input: val }, (res) => {
@@ -34,7 +35,7 @@ function filterFn(val: string) {
34
35
 
35
36
  watch(modelValue, (newVal) => {
36
37
  filterFn(newVal)
37
- if (googleMap) {
38
+ if (googleMap()) {
38
39
  input(newVal)
39
40
  }
40
41
  })
@@ -6,10 +6,20 @@
6
6
  <div class="flex justify-end items-center mb-3">
7
7
  <FmSearch v-model="searchKey" :placeholder="t('order.search')" />
8
8
  </div>
9
- <PickupList :pickupSettingData="pickupSettingData" @toggleSideSheet="toggleSideSheet"
10
- class="mt-5 md:hidden lg:hidden xl:hidden" />
11
- <FmTable class="h-[500px] xs:hidden sm:hidden" :row-data="pickupSettingData" :hideFooter="true"
12
- :column-defs="columns" :loading="isLoading" @row-click="toggleSideSheet" :pageSize="pickupSettingData.length">
9
+ <PickupList
10
+ :pickupSettingData="pickupSettingData"
11
+ @toggleSideSheet="toggleSideSheet"
12
+ class="mt-5 md:hidden lg:hidden xl:hidden"
13
+ />
14
+ <FmTable
15
+ class="h-[500px] xs:hidden sm:hidden"
16
+ :row-data="pickupSettingData"
17
+ :hideFooter="true"
18
+ :column-defs="columns"
19
+ :loading="isLoading"
20
+ @row-click="toggleSideSheet"
21
+ :pageSize="pickupSettingData.length"
22
+ >
13
23
  </FmTable>
14
24
  <PickUpSettingDialog :showPickupDialog="sideSheet" @closeSideSheet="closeSideSheet" />
15
25
  </div>
@@ -54,7 +64,6 @@ onMounted(async () => {
54
64
  await startAsyncCallWithErr(async () => {
55
65
  await Promise.all(
56
66
  restaurants.value.map(async (r) => {
57
- await changeRestaurant(r)
58
67
  await restaurantStore.readRestaurantSetting(r._id)
59
68
  })
60
69
  )
@@ -65,7 +74,7 @@ async function onUpdate() {
65
74
  await startAsyncCallWithErr(async () => {
66
75
  await Promise.all(
67
76
  restaurants.value.map(async (r) => {
68
- changeRestaurant(r)
77
+ await changeRestaurant(r)
69
78
  await restaurantStore.readRestaurantSetting(r._id)
70
79
  })
71
80
  )
@@ -80,7 +89,7 @@ async function toggleSideSheet(rowData: any) {
80
89
 
81
90
  const restaurant = restaurants.value.find((r) => r._id === v)
82
91
  if (restaurant) {
83
- changeRestaurant(restaurant)
92
+ await changeRestaurant(restaurant)
84
93
  }
85
94
  sideSheet.value = true
86
95
  }
@@ -88,7 +97,7 @@ async function toggleSideSheet(rowData: any) {
88
97
  async function closeSideSheet(refresh = false) {
89
98
  sideSheet.value = false
90
99
  if (originalRestaurant) {
91
- changeRestaurant(originalRestaurant)
100
+ await changeRestaurant(originalRestaurant)
92
101
  }
93
102
  if (refresh) {
94
103
  await onUpdate()
@@ -112,16 +121,16 @@ const pickupSettingData = computed<PickupSettingData[]>(() => {
112
121
  const paymentMethod = !hasCustomOfflinePayment
113
122
  ? (item.paymentTypes || []).map((p) => sentenceCase(p)).join(', ')
114
123
  : [
115
- (item.paymentTypes || [])
116
- .filter((p) => p !== 'cash')
117
- .map((p) => sentenceCase(p))
118
- .join(', '),
119
- canOfflinePayment
120
- ? (item.offlinePaymentTypes || []).map((p) => sentenceCase(p.name)).join(', ')
121
- : ''
122
- ]
123
- .filter((v) => !!v)
124
- .join(', ')
124
+ (item.paymentTypes || [])
125
+ .filter((p) => p !== 'cash')
126
+ .map((p) => sentenceCase(p))
127
+ .join(', '),
128
+ canOfflinePayment
129
+ ? (item.offlinePaymentTypes || []).map((p) => sentenceCase(p.name)).join(', ')
130
+ : ''
131
+ ]
132
+ .filter((v) => !!v)
133
+ .join(', ')
125
134
 
126
135
  const onlineStatus = item.enable ? t('order.activated') : t('order.inactive')
127
136
 
@@ -143,13 +152,13 @@ const pickupSettingData = computed<PickupSettingData[]>(() => {
143
152
  })
144
153
 
145
154
  export interface PickupSettingData {
146
- restaurantId: string;
147
- restaurant: string;
148
- paymentmethod: string;
149
- online: string;
150
- enable: boolean;
151
- preorder: string;
152
- pickuppoint: string;
155
+ restaurantId: string
156
+ restaurant: string
157
+ paymentmethod: string
158
+ online: string
159
+ enable: boolean
160
+ preorder: string
161
+ pickuppoint: string
153
162
  }
154
163
 
155
164
  export interface RestaurantPickup extends FdoRestaurantPickup {
@@ -247,7 +247,10 @@ watch(
247
247
  () => currentRestaurant.value,
248
248
  async (newValue) => {
249
249
  if (newValue) {
250
- const restaurantSetting = restaurantStore.restaurantSettings[newValue._id]
250
+ let restaurantSetting = restaurantStore.restaurantSettings[newValue._id]
251
+ if (!restaurantSetting) {
252
+ restaurantSetting = await restaurantStore.readRestaurantSetting(newValue._id)
253
+ }
251
254
  initialize(restaurantSetting)
252
255
  await startAsyncCallWithErr(tableSettingStore.readTables)
253
256
  }
package/vite.config.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { fileURLToPath, URL } from 'node:url'
2
- import { defineConfig } from 'vite'
2
+ import { defineConfig, loadEnv } from 'vite'
3
3
  import vue from '@vitejs/plugin-vue'
4
4
  import { fmmfVitePresent } from "@feedmepos/mf-common/vite-preset";
5
5
 
6
6
 
7
7
  // https://vitejs.dev/config/
8
8
  export default defineConfig((env) => {
9
+ process.env = { ...process.env, ...loadEnv(env.mode, process.cwd(), "") }
9
10
  const config = {
10
11
  plugins: [vue()],
11
12
  resolve: {
@@ -18,10 +19,9 @@ export default defineConfig((env) => {
18
19
  },
19
20
  define: {
20
21
  devInfo: JSON.stringify({
21
-
22
22
  }),
23
23
  appApi: JSON.stringify({
24
- googleMap: process.env.GOOGLE_MAP_API_KEY,
24
+ googleMap: process.env.VITE_GOOGLE_MAP_API_KEY,
25
25
  firebase: {
26
26
  apiKey: process.env.FIREBASE_API_KEY,
27
27
  authDomain: process.env.FIREBASE_AUTH_DOMAIN,
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./app-Cu7GdqUm.js";
2
- export {
3
- f as default
4
- };