@feedmepos/mf-order-setting 0.0.15 → 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.
- package/dist/KioskSettingView-CLLklQtJ.js +4 -0
- package/dist/{app-CoLf05s5.js → app-DHq9VPij.js} +11871 -11818
- package/dist/app.js +5 -5
- package/dist/frontend/mf-order/src/api/restaurant-setting/index.d.ts +1 -1
- package/dist/frontend/mf-order/src/app.d.ts +5 -4
- package/dist/frontend/mf-order/src/helpers/map.d.ts +3 -2
- package/dist/frontend/mf-order/src/stores/kiosk/index.d.ts +6 -6
- package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +403 -8
- package/dist/frontend/mf-order/src/views/all-orders/FilterRestaurant.vue.d.ts +4 -4
- package/dist/frontend/mf-order/src/views/all-orders/ReflowOrder.vue.d.ts +2 -2
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/package/entity/delivery/delivery.dto.d.ts +6 -6
- package/dist/package/entity/delivery/gateway/pandago.dto.d.ts +10 -10
- package/dist/package/entity/food-court/order.dto.d.ts +42 -36273
- package/dist/package/entity/kiosk/kiosk.do.d.ts +20 -20
- package/dist/package/entity/kiosk/kiosk.dto.d.ts +24 -24
- package/dist/package/entity/order/order-item/order-item.dto.d.ts +52 -0
- package/dist/package/entity/order/order.dto.d.ts +734 -278
- package/dist/package/entity/order/payment/payment.dto.d.ts +152 -152
- package/dist/package/entity/order-platform/foodpanda/foodpanda-order.do.d.ts +24 -24
- package/dist/package/entity/order-platform/foodpanda/foodpanda-order.dto.d.ts +6 -6
- package/dist/package/entity/order-platform/grabfood/grabfood-menu.do.d.ts +74 -74
- package/dist/package/entity/order-platform/grabfood/grabfood-order.do.d.ts +106 -106
- package/dist/package/entity/order-platform/grabfood/grabfood.dto.d.ts +32 -32
- package/dist/package/entity/order-platform/menu.dto.d.ts +54 -54
- package/dist/package/entity/order-platform/shopeefood/shopeefood-order.do.d.ts +238 -238
- package/dist/package/entity/order-platform/shopeefood/shopeefood-order.dto.d.ts +64 -64
- package/dist/package/entity/payment/payment.dto.d.ts +2 -2
- package/dist/package/entity/printer/printer.do.d.ts +2 -2
- package/dist/package/entity/websocket/websocket.dto.d.ts +2 -2
- package/package.json +1 -1
- package/src/Entry.vue +3 -9
- package/src/api/restaurant-setting/index.ts +3 -2
- package/src/app.ts +17 -4
- package/src/components/GoogleMap.vue +102 -104
- package/src/helpers/map.ts +23 -15
- package/src/main.ts +5 -6
- package/src/stores/restaurant/index.ts +3 -3
- package/src/views/order-settings/delivery/DeliverySetting.vue +11 -12
- package/src/views/order-settings/delivery/inhouse/DeliveryOrder.vue +3 -2
- package/src/views/order-settings/pickup/AddressInput.vue +3 -2
- package/src/views/order-settings/pickup/PickUpSetting.vue +34 -25
- package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +4 -1
- package/vite.config.ts +3 -3
- package/dist/KioskSettingView-D75QMFoF.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
|
|
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
|
|
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<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
214
|
-
class="map app-map"
|
|
215
|
-
/>
|
|
216
|
-
</template>
|
|
213
|
+
<div ref="mapRef" class="map app-map" />
|
|
214
|
+
</template>
|
package/src/helpers/map.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
/// <reference types="googlemaps" />
|
|
1
2
|
import { type MapCoordinate } from '@/components/type';
|
|
3
|
+
import { ref } from "vue"
|
|
2
4
|
|
|
3
|
-
|
|
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 (!
|
|
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 +
|
|
44
|
-
const y = center.lat +
|
|
45
|
-
const
|
|
46
|
-
|
|
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[][] {
|
package/src/main.ts
CHANGED
|
@@ -24,16 +24,15 @@ function initI18n(): I18n {
|
|
|
24
24
|
|
|
25
25
|
const app = createApp(Entry)
|
|
26
26
|
|
|
27
|
-
app.use(initI18n())
|
|
28
|
-
app.use(createPinia())
|
|
29
|
-
app.use(router)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
27
|
app.use(FeedMeUI, {
|
|
34
28
|
locale: detectLocale(),
|
|
35
29
|
})
|
|
36
30
|
|
|
31
|
+
app.use(createPinia())
|
|
32
|
+
app.use(router)
|
|
33
|
+
app.use(initI18n())
|
|
34
|
+
|
|
35
|
+
|
|
37
36
|
const CoreStore = useCoreStore();
|
|
38
37
|
const iframeMode = computed(() => {
|
|
39
38
|
return new URLSearchParams(window.location.search).get('iframe') === 'true';
|
|
@@ -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
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
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.
|
|
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,
|