@webx-ui/module-delivery 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +58 -2
- package/dist/BindingsPage-DiVZys4B.js +280 -0
- package/dist/BindingsPage-DiVZys4B.js.map +1 -0
- package/dist/BindingsPage.d.ts +2 -0
- package/dist/CarrierDialog.d.ts +26 -0
- package/dist/CarriersPage-DlaIE-2K.js +650 -0
- package/dist/CarriersPage-DlaIE-2K.js.map +1 -0
- package/dist/CarriersPage.d.ts +2 -0
- package/dist/GeographyPage-T3vwSyud.js +750 -0
- package/dist/GeographyPage-T3vwSyud.js.map +1 -0
- package/dist/GeographyPage.d.ts +2 -0
- package/dist/LocalityDialog.d.ts +39 -0
- package/dist/LocalitySearch.d.ts +33 -0
- package/dist/MethodPane.d.ts +29 -0
- package/dist/MethodsPage-DrrRpjVY.js +415 -0
- package/dist/MethodsPage-DrrRpjVY.js.map +1 -0
- package/dist/MethodsPage.d.ts +2 -0
- package/dist/OrderChangeDialog.d.ts +7 -0
- package/dist/OrderDeliveryNode.d.ts +2 -0
- package/dist/PointDialog.d.ts +22 -0
- package/dist/PointsPage-C16GT-YH.js +336 -0
- package/dist/PointsPage-C16GT-YH.js.map +1 -0
- package/dist/PointsPage.d.ts +2 -0
- package/dist/PopularPage-BdE59dwB.js +141 -0
- package/dist/PopularPage-BdE59dwB.js.map +1 -0
- package/dist/PopularPage.d.ts +2 -0
- package/dist/RegionDialog.d.ts +11 -0
- package/dist/WaybillDialog.d.ts +8 -0
- package/dist/api.d.ts +151 -0
- package/dist/fields/CountryField.d.ts +14 -0
- package/dist/fields/LocalitiesField.d.ts +14 -0
- package/dist/fields/LocalityField.d.ts +16 -0
- package/dist/fields/PointKindField.d.ts +20 -0
- package/dist/fields/RegionField.d.ts +19 -0
- package/dist/fields/ScheduleField.d.ts +24 -0
- package/dist/i18n.d.ts +5 -0
- package/dist/index-CuhwaAcG.js +2540 -0
- package/dist/index-CuhwaAcG.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +7 -0
- package/dist/module.d.ts +19 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +467 -0
- package/package.json +64 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MethodsPage-DrrRpjVY.js","sources":["../src/MethodPane.vue","../src/MethodsPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue'\nimport {\n confirm,\n localizedValue,\n toast,\n useLocales,\n WxActionBar,\n WxButton,\n WxSkeleton,\n type LocalizedValue,\n} from '@webx-ui/core'\nimport {\n useAdmin,\n useDefaultLocale,\n useErrorText,\n WxSaveState,\n WxScreen,\n WxScreenHead,\n type ScreenAction,\n} from '@webx-ui/module-admin'\nimport type { Patch, ScreenModel } from '@webx-ui/schema'\nimport { createDeliveryApi } from './api'\nimport { useDeliveryWords } from './i18n'\nimport type { MethodDetail, MethodRow, Option } from './types'\n\n/**\n * One method: the pane beside the list, and the whole screen on a phone. The described screen\n * `delivery.method-form`, short of the fields its type has no use for — the kind of points of a\n * method that asks for no point, the localities of anything but the shop's courier.\n *\n * A new method is a form first and a record on the first save, with its type fixed from then on.\n */\nconst props = withDefaults(\n defineProps<{\n id: number | null\n /** The type of a new method. */\n type?: string | null\n inline?: boolean\n }>(),\n { type: null, inline: true },\n)\n\nconst emit = defineEmits<{\n back: []\n saved: [method: MethodRow]\n created: [method: MethodRow]\n removed: [id: number]\n}>()\n\nconst context = useAdmin()\nconst api = createDeliveryApi(context)\nconst locales = useLocales()\nconst main = useDefaultLocale()\nconst t = useDeliveryWords()\nconst message = useErrorText()\n\nconst method = ref<MethodRow | null>(null)\nconst values = ref<ScreenModel>({})\nconst hidden = ref<string[]>([])\nconst kinds = ref<Option[]>([])\nconst typeTitle = ref('')\nconst snapshot = ref('')\nconst loading = ref(true)\nconst saving = ref(false)\nconst errors = ref<Record<string, string[]>>({})\n\nconst canManage = computed(() => context.can('delivery.manage'))\nconst dirty = computed(() => snapshot.value !== JSON.stringify(values.value))\nconst state = computed<'saving' | 'unsaved' | 'saved'>(() =>\n saving.value ? 'saving' : dirty.value || props.id === null ? 'unsaved' : 'saved',\n)\n\nconst title = computed(\n () =>\n localizedValue(\n values.value.titles as LocalizedValue | null | undefined,\n locales.active.value,\n props.id === null ? t('method.new') : (method.value?.title ?? ''),\n ) || t('common.untitled'),\n)\n\n/* The type of the method open: fixed once it is saved. */\nconst type = computed(() => method.value?.type ?? props.type)\n\n/*\n * The fields of another type are not drawn, and the kinds offered are this type's. Only the\n * shop's pick-up names kinds of its own: a carrier's type says what its points are.\n */\nconst patch = computed<Patch>(() => [\n ...hidden.value.map((target) => ({ op: 'remove' as const, target })),\n ...(hidden.value.includes('point_kind')\n ? []\n : [\n {\n op: 'set' as const,\n target: 'point_kind',\n props: { options: kinds.value, creatable: type.value === 'store.pickup' },\n // A carrier's kinds are its branches and lockers, not the shop's points.\n ...(type.value === 'store.pickup' ? {} : { help: t('method.point-kind-carrier-help') }),\n },\n ]),\n])\n\nfunction take(detail: MethodDetail): void {\n method.value = detail.method\n values.value = detail.values\n hidden.value = detail.hidden\n kinds.value = detail.point_kinds\n typeTitle.value = detail.method.type_title\n snapshot.value = JSON.stringify(detail.values)\n}\n\nasync function load(): Promise<void> {\n loading.value = true\n\n try {\n if (props.id !== null) {\n take(await api.method(props.id))\n } else if (props.type) {\n const blank = await api.blank(props.type)\n\n hidden.value = blank.hidden\n kinds.value = blank.point_kinds\n typeTitle.value = blank.type_title\n values.value = {\n titles: { [main.value]: blank.type_title },\n descriptions: {},\n price: null,\n point_kind: blank.point_kinds[0]?.value ?? null,\n countries: [],\n honours_paid_by_store: true,\n enabled: true,\n localities: [],\n }\n snapshot.value = ''\n }\n } catch (error) {\n toast.danger(message(error))\n emit('back')\n } finally {\n loading.value = false\n }\n}\n\nvoid load()\n\nasync function save(): Promise<void> {\n if (saving.value || !canManage.value) return\n\n saving.value = true\n errors.value = {}\n\n try {\n const made = props.id === null\n const detail = made\n ? await api.createMethod(props.type as string, values.value)\n : await api.saveMethod(props.id as number, values.value)\n\n take(detail)\n toast.success(t('common.saved'))\n if (made) emit('created', detail.method)\n else emit('saved', detail.method)\n } catch (error) {\n const fields = (error as { errors?: Record<string, string[]> }).errors\n\n if (fields && Object.keys(fields).length > 0) {\n errors.value = fields\n toast.danger(t('common.save-failed'))\n } else {\n toast.danger(message(error))\n }\n } finally {\n saving.value = false\n }\n}\n\nasync function remove(): Promise<void> {\n const record = method.value\n\n if (!record) return\n\n const agreed = await confirm({\n title: t('method.delete-title', { name: record.title }),\n message: t('method.delete-text'),\n confirmText: t('common.delete'),\n cancelText: t('common.cancel'),\n tone: 'danger',\n })\n\n if (!agreed) return\n\n try {\n await api.removeMethod(record.id)\n toast.success(t('method.deleted'))\n snapshot.value = JSON.stringify(values.value)\n emit('removed', record.id)\n } catch (error) {\n toast.danger(message(error))\n }\n}\n\n/* What leads away from the method; on a narrow pane the head folds it into the ···. */\nconst actions = computed<ScreenAction[]>(() =>\n canManage.value && method.value !== null\n ? [\n {\n key: 'delete',\n label: t('common.delete'),\n icon: 'trash',\n danger: true,\n menu: true,\n run: () => void remove(),\n },\n ]\n : [],\n)\n</script>\n\n<template>\n <div class=\"wx-delivery-pane\">\n <wx-skeleton v-if=\"loading\" title :rows=\"6\" class=\"wx-delivery-pane__ghost\" />\n\n <template v-else>\n <wx-screen-head\n :level=\"3\"\n help=\"delivery.method-form\"\n :back=\"!inline\"\n :title=\"title\"\n :subtitle=\"typeTitle\"\n :actions=\"actions\"\n :collapse-below=\"480\"\n @back=\"emit('back')\"\n />\n\n <wx-screen\n v-model=\"values\"\n name=\"delivery.method-form\"\n :patch=\"patch\"\n :errors=\"errors\"\n :disabled=\"!canManage || saving\"\n />\n\n <wx-action-bar v-if=\"canManage\">\n <template #state>\n <wx-save-state :state=\"state\" />\n </template>\n\n <wx-button\n type=\"primary\"\n :loading=\"saving\"\n :disabled=\"!dirty && props.id !== null\"\n @click=\"save\"\n >\n {{ t('common.save') }}\n </wx-button>\n </wx-action-bar>\n </template>\n </div>\n</template>\n\n<style scoped>\n.wx-delivery-pane {\n display: flex;\n flex-direction: column;\n gap: var(--wx-gap, var(--wx-space-16));\n min-width: 0;\n padding: var(--wx-gap, var(--wx-space-16));\n container-type: inline-size;\n}\n\n.wx-delivery-pane__ghost {\n max-width: 480px;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref } from 'vue'\nimport { useRoute, useRouter } from 'vue-router'\nimport {\n toast,\n WxAlert,\n WxBadge,\n WxButton,\n WxCard,\n WxDialog,\n WxEmpty,\n WxFormItem,\n WxListDetail,\n WxRadio,\n WxRadioGroup,\n WxSkeleton,\n WxSortableList,\n WxSpace,\n} from '@webx-ui/core'\nimport { useAdmin, useErrorText, WxListScreen, type ScreenAction } from '@webx-ui/module-admin'\nimport { createDeliveryApi } from './api'\nimport { useDeliveryWords } from './i18n'\nimport MethodPane from './MethodPane.vue'\nimport type { MethodRow, MethodType } from './types'\n\n/**\n * The methods (§14.2): every one in the order the checkout lists them — dragged by the grip —\n * on the left, the one being written on the right. A new method starts from its type: the shop's\n * pick-up, its courier, or a carrier's method.\n *\n * The open method is in the address (`?method=` — an id, or `new:<type>`), so a link to one is a\n * link to it in its list.\n */\nconst context = useAdmin()\nconst api = createDeliveryApi(context)\nconst route = useRoute()\nconst router = useRouter()\nconst t = useDeliveryWords()\nconst message = useErrorText()\n\nconst rows = ref<MethodRow[]>([])\nconst types = ref<MethodType[]>([])\nconst loading = ref(true)\nconst choosing = ref(false)\nconst picked = ref<string | null>(null)\n\nconst canManage = computed(() => context.can('delivery.manage'))\n\nconst title = computed(\n () =>\n context.state.manifest?.modules.find((module) => module.id === 'delivery')?.title ??\n t('sections.methods'),\n)\n\n/** The open method: an id, or a new one of a type, or nothing. */\nconst selected = computed<{ id: number | null; type: string | null } | null>(() => {\n const raw = route.query.method\n\n if (typeof raw !== 'string' || raw === '') return null\n if (raw.startsWith('new:')) return canManage.value ? { id: null, type: raw.slice(4) } : null\n\n const id = Number(raw)\n\n return Number.isInteger(id) && id > 0 ? { id, type: null } : null\n})\n\nconst open = computed({\n get: () => selected.value !== null,\n set: (value) => {\n if (!value) close()\n },\n})\n\n/* The types by carrier: the shop's own first, as they are the ones a new shop starts with. */\nconst grouped = computed(() => {\n const groups = new Map<string, { title: string; types: MethodType[] }>()\n\n for (const type of types.value) {\n const group = groups.get(type.carrier) ?? { title: type.carrier_title, types: [] }\n\n group.types.push(type)\n groups.set(type.carrier, group)\n }\n\n return [...groups.entries()]\n .sort(([a], [b]) => (a === 'store' ? -1 : b === 'store' ? 1 : a.localeCompare(b)))\n .map(([key, group]) => ({ key, ...group }))\n})\n\nasync function load(): Promise<void> {\n loading.value = true\n\n try {\n const answer = await api.methods()\n\n rows.value = answer.methods\n types.value = answer.types\n } catch (error) {\n toast.danger(message(error))\n } finally {\n loading.value = false\n }\n}\n\nvoid load()\n\nfunction choose(value: string): void {\n void router.replace({ query: { ...route.query, method: value } })\n}\n\nfunction close(): void {\n const query = { ...route.query }\n\n delete query.method\n void router.replace({ query })\n}\n\n/* «Add a method» asks the type first: the form after it depends on it. */\nfunction startChoosing(): void {\n picked.value = types.value[0]?.key ?? null\n choosing.value = true\n}\n\nfunction start(): void {\n if (picked.value === null) return\n\n choosing.value = false\n choose(`new:${picked.value}`)\n}\n\n/* The section's one action, in the head like every list's — a word, no icon (§18.3). */\nconst actions = computed<ScreenAction[]>(() =>\n canManage.value\n ? [{ key: 'new', label: t('method.new'), primary: true, run: () => startChoosing() }]\n : [],\n)\n\n/*\n * The carrier under the method's name, unless the type's name already says it: a type named by\n * the panel reads «Carrier A branch», and «Carrier A branch · Carrier A» says it twice. Nor the\n * type when the method is named after it: «Carrier A branch» under «Carrier A branch» is an echo.\n */\nfunction line(row: MethodRow): string {\n const carrier = row.carrier !== 'store' ? (row.carrier_title ?? '') : ''\n const echo = row.type_title.trim().toLowerCase() === row.title.trim().toLowerCase()\n const said = row.type_title.includes(carrier) || row.title.includes(carrier)\n\n return [echo ? '' : row.type_title, carrier === '' || said ? '' : carrier]\n .filter((part) => part !== '')\n .join(' · ')\n}\n\nfunction created(method: MethodRow): void {\n choose(String(method.id))\n void load()\n}\n\nfunction removed(): void {\n close()\n void load()\n}\n\n/* The list is in its new order already; a refusal puts the database's back on screen. */\nasync function reorder(): Promise<void> {\n try {\n await api.orderMethods(rows.value.map((row) => row.id))\n } catch (error) {\n toast.danger(message(error, t('common.order-failed')))\n await load()\n }\n}\n\nfunction countries(row: MethodRow): string {\n return row.countries.length === 0 ? t('method.all-countries') : row.countries.join(', ')\n}\n\nconst paneKey = computed(() => String(route.query.method ?? ''))\n</script>\n\n<template>\n <wx-list-screen :title=\"title\" :actions=\"actions\" :card=\"false\">\n <wx-card class=\"wx-delivery-methods\" padding=\"none\">\n <wx-list-detail v-model:open=\"open\" :list-width=\"380\" :detail-min=\"460\" :detail-label=\"title\">\n <template #list>\n <wx-skeleton\n v-if=\"loading && rows.length === 0\"\n class=\"wx-delivery-methods__ghost\"\n :rows=\"4\"\n />\n\n <wx-empty\n v-else-if=\"rows.length === 0\"\n :title=\"t('method.empty')\"\n :description=\"t('method.empty-help')\"\n />\n\n <template v-else>\n <wx-sortable-list\n v-model=\"rows\"\n class=\"wx-delivery-methods__list\"\n hoverable\n plain\n item-key=\"id\"\n :handle=\"canManage ? 'grip' : 'row'\"\n :item-label=\"(item: MethodRow) => item.title\"\n :disabled=\"!canManage\"\n @move=\"reorder\"\n >\n <template #default=\"{ item }\">\n <button\n type=\"button\"\n class=\"wx-delivery-method\"\n :class=\"{ 'is-current': selected?.id === item.id }\"\n @click=\"choose(String(item.id))\"\n >\n <span class=\"wx-delivery-method__title\">{{ item.title }}</span>\n <span v-if=\"line(item)\" class=\"wx-delivery-method__line\">{{ line(item) }}</span>\n <span class=\"wx-delivery-method__facts\">\n <span class=\"wx-delivery-method__price\">{{\n item.price_text ?? t('method.free')\n }}</span>\n <span class=\"wx-delivery-method__countries\">{{ countries(item) }}</span>\n <wx-badge v-if=\"!item.enabled\" dot size=\"sm\">{{ t('method.off') }}</wx-badge>\n <wx-badge v-if=\"item.missing\" type=\"danger\" size=\"sm\">{{\n t('method.missing-type')\n }}</wx-badge>\n </span>\n </button>\n </template>\n </wx-sortable-list>\n\n <wx-alert\n v-if=\"canManage && rows.length > 1\"\n class=\"wx-delivery-methods__note\"\n type=\"info\"\n :description=\"t('common.drag')\"\n />\n </template>\n </template>\n\n <template #detail=\"{ inline, back }\">\n <method-pane\n v-if=\"selected !== null\"\n :id=\"selected.id\"\n :key=\"paneKey\"\n :type=\"selected.type\"\n :inline=\"inline\"\n @back=\"back\"\n @saved=\"load\"\n @created=\"created\"\n @removed=\"removed\"\n />\n </template>\n\n <template #empty>\n <wx-empty\n :title=\"t('method.choose')\"\n :description=\"canManage ? t('method.choose-help') : undefined\"\n />\n </template>\n </wx-list-detail>\n </wx-card>\n\n <!--\n A list of choices and not a wall of buttons: one name and one line of what it is per type,\n under the carrier it belongs to — the shape «New block» asks its kind in (module-blocks).\n -->\n <wx-dialog v-model:open=\"choosing\" :title=\"t('method.choose-type')\" :width=\"520\">\n <div class=\"wx-delivery-types\">\n <wx-form-item v-for=\"group in grouped\" :key=\"group.key\" :label=\"group.title\">\n <wx-radio-group v-model=\"picked\" class=\"wx-delivery-types__list\">\n <wx-radio\n v-for=\"type in group.types\"\n :key=\"type.key\"\n :value=\"type.key\"\n :data-test=\"`type-${type.key}`\"\n @dblclick=\"start\"\n >\n <span class=\"wx-delivery-types__title\">{{ type.title }}</span>\n <span v-if=\"type.description\" class=\"wx-delivery-types__help\">{{\n type.description\n }}</span>\n </wx-radio>\n </wx-radio-group>\n </wx-form-item>\n </div>\n\n <template #footer>\n <wx-space size=\"sm\">\n <wx-button variant=\"outline\" @click=\"choosing = false\">{{\n t('common.cancel')\n }}</wx-button>\n <wx-button\n type=\"primary\"\n :disabled=\"picked === null\"\n data-test=\"type-start\"\n @click=\"start\"\n >\n {{ t('common.add') }}\n </wx-button>\n </wx-space>\n </template>\n </wx-dialog>\n </wx-list-screen>\n</template>\n\n<style>\n.wx-delivery-methods > .wx-card__body {\n display: flex;\n flex-direction: column;\n overflow: clip;\n border-radius: inherit;\n}\n</style>\n\n<style scoped>\n.wx-delivery-methods__ghost {\n padding: var(--wx-space-12);\n}\n\n/* Nothing stands above the list in its card, so it keeps off the top edge too (as Menu's lists do). */\n.wx-delivery-methods__list {\n padding: var(--wx-space-8);\n}\n\n.wx-delivery-methods__list :deep(.wx-sortable-list__row) {\n gap: var(--wx-space-4);\n padding-inline: var(--wx-space-4);\n}\n\n.wx-delivery-methods__note {\n margin: var(--wx-space-8);\n}\n\n.wx-delivery-method {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: var(--wx-space-2);\n width: 100%;\n min-width: 0;\n padding-block: var(--wx-space-8);\n padding-inline: 0;\n border: 0;\n background: none;\n font: inherit;\n color: inherit;\n text-align: start;\n cursor: pointer;\n}\n\n.wx-delivery-method__title {\n overflow: hidden;\n font-weight: var(--wx-font-weight-medium);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.wx-delivery-method.is-current .wx-delivery-method__title {\n color: var(--wx-color-primary);\n}\n\n.wx-delivery-method__line {\n overflow: hidden;\n color: var(--wx-text-muted);\n font-size: var(--wx-font-size-sm);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.wx-delivery-method__facts {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--wx-space-8);\n font-size: var(--wx-font-size-sm);\n}\n\n.wx-delivery-method__price {\n font-variant-numeric: tabular-nums;\n}\n\n.wx-delivery-method__countries {\n color: var(--wx-text-muted);\n}\n\n.wx-delivery-types {\n display: flex;\n flex-direction: column;\n gap: var(--wx-space-12);\n}\n\n.wx-delivery-types__list {\n gap: var(--wx-space-10);\n}\n\n/* The circle beside the name, not beside the middle of name and line. */\n.wx-delivery-types__list :deep(.wx-radio) {\n align-items: flex-start;\n}\n\n.wx-delivery-types__title {\n display: block;\n font-weight: var(--wx-font-weight-medium);\n}\n\n.wx-delivery-types__help {\n display: block;\n color: var(--wx-text-muted);\n font-size: var(--wx-font-size-sm);\n}\n</style>\n"],"names":["props","__props","emit","__emit","context","useAdmin","api","createDeliveryApi","locales","useLocales","main","useDefaultLocale","t","useDeliveryWords","message","useErrorText","method","ref","values","hidden","kinds","typeTitle","snapshot","loading","saving","errors","canManage","computed","dirty","state","title","localizedValue","type","patch","target","take","detail","load","blank","error","toast","save","made","fields","remove","record","confirm","actions","_openBlock","_createElementBlock","_hoisted_1","_createBlock","_unref","WxSkeleton","_Fragment","_createVNode","WxScreenHead","WxScreen","$event","WxActionBar","WxSaveState","WxButton","route","useRoute","router","useRouter","rows","types","choosing","picked","module","selected","raw","id","open","value","close","grouped","groups","group","a","b","key","answer","choose","query","startChoosing","start","line","row","carrier","echo","said","part","created","removed","reorder","countries","paneKey","WxListScreen","WxCard","WxListDetail","WxEmpty","WxSortableList","item","_withCtx","_createElementVNode","_normalizeClass","_hoisted_2","_toDisplayString","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","WxBadge","WxAlert","inline","back","MethodPane","WxDialog","WxSpace","_hoisted_7","_renderList","WxFormItem","WxRadioGroup","WxRadio","_hoisted_8","_hoisted_9"],"mappings":";;;;;;;;;;;;;;AAiCA,UAAMA,IAAQC,GAURC,IAAOC,GAOPC,IAAUC,EAAA,GACVC,IAAMC,GAAkBH,CAAO,GAC/BI,IAAUC,GAAA,GACVC,IAAOC,GAAA,GACPC,IAAIC,GAAA,GACJC,IAAUC,GAAA,GAEVC,IAASC,EAAsB,IAAI,GACnCC,IAASD,EAAiB,EAAE,GAC5BE,IAASF,EAAc,EAAE,GACzBG,IAAQH,EAAc,EAAE,GACxBI,IAAYJ,EAAI,EAAE,GAClBK,IAAWL,EAAI,EAAE,GACjBM,IAAUN,EAAI,EAAI,GA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,EAAK;AAAA,wBACZ,aAAS,QAAUA,EAAK,GAAG;AAAA,wBAC3B,YAAUuD;AAAA,sBAAA;mCAEX,MAA8D;AAAA,0BAA9DmB,EAA8D,QAA9DoB,IAA8DjB,EAApB7E,EAAK,KAAK,GAAA,CAAA;AAAA,0BACxCA,EAAK,eAAjBgB,EAAA,GAAAC,EAES,QAFT8E,IAESlB,EADP7E,EAAK,WAAW,GAAA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OrderDeliveryChangeState } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
orderId: number;
|
|
4
|
+
start: OrderDeliveryChangeState;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One of the shop's own points (§14.2): the screen `delivery.point-form` in a dialog. Its
|
|
3
|
+
* locality field searches the shared geography and adds a town it does not find (decision 42).
|
|
4
|
+
*/
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
id?: number | null;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_PublicProps = {
|
|
9
|
+
'open'?: boolean;
|
|
10
|
+
} & __VLS_Props;
|
|
11
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
12
|
+
saved: () => any;
|
|
13
|
+
removed: () => any;
|
|
14
|
+
"update:open": (value: boolean) => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
|
+
onSaved?: (() => any) | undefined;
|
|
17
|
+
onRemoved?: (() => any) | undefined;
|
|
18
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
id: number | null;
|
|
21
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { defineComponent as A, useModel as K, ref as u, computed as h, watch as F, openBlock as W, createBlock as B, unref as t, createSlots as Q, withCtx as a, createVNode as d, createTextVNode as m, toDisplayString as p, createCommentVNode as I, createElementVNode as X, mergeModels as N, createElementBlock as Y } from "vue";
|
|
2
|
+
import { WxDialog as Z, WxText as O, WxSkeleton as ee, WxSpace as te, WxButton as U, toast as g, confirm as j, WxTable as le, WxBadge as ae, WxIcon as ne, WxFormItem as E, WxSelect as R } from "@webx-ui/core";
|
|
3
|
+
import { useAdmin as q, useErrorText as L, WxScreen as oe, rowMenuWidth as ie, WxListScreen as se, WxRowMenu as de } from "@webx-ui/module-admin";
|
|
4
|
+
import { c as G, u as H, _ as J } from "./index-CuhwaAcG.js";
|
|
5
|
+
const re = /* @__PURE__ */ A({
|
|
6
|
+
__name: "PointDialog",
|
|
7
|
+
props: /* @__PURE__ */ N({
|
|
8
|
+
id: { default: null }
|
|
9
|
+
}, {
|
|
10
|
+
open: { type: Boolean, default: !1 },
|
|
11
|
+
openModifiers: {}
|
|
12
|
+
}),
|
|
13
|
+
emits: /* @__PURE__ */ N(["saved", "removed"], ["update:open"]),
|
|
14
|
+
setup(S, { emit: C }) {
|
|
15
|
+
const c = S, e = K(S, "open"), T = C, _ = q(), b = G(_), n = H(), f = L(), v = u(null), y = u({}), k = u({}), x = u(!1), V = u(!1), z = h(() => _.can("delivery.manage")), D = h(
|
|
16
|
+
() => c.id === null ? n("point.new") : v.value?.point.title || n("point.title")
|
|
17
|
+
);
|
|
18
|
+
async function $() {
|
|
19
|
+
if (k.value = {}, v.value = null, c.id === null) {
|
|
20
|
+
y.value = {
|
|
21
|
+
kind: "store",
|
|
22
|
+
titles: {},
|
|
23
|
+
address: {},
|
|
24
|
+
locality_id: null,
|
|
25
|
+
lat: null,
|
|
26
|
+
lng: null,
|
|
27
|
+
phone: null,
|
|
28
|
+
active: !0,
|
|
29
|
+
schedule: null
|
|
30
|
+
};
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
x.value = !0;
|
|
34
|
+
try {
|
|
35
|
+
v.value = await b.point(c.id), y.value = v.value.values;
|
|
36
|
+
} catch (r) {
|
|
37
|
+
g.danger(f(r)), e.value = !1;
|
|
38
|
+
} finally {
|
|
39
|
+
x.value = !1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
F(e, (r) => {
|
|
43
|
+
r && $();
|
|
44
|
+
});
|
|
45
|
+
async function M() {
|
|
46
|
+
V.value = !0, k.value = {};
|
|
47
|
+
try {
|
|
48
|
+
c.id === null ? await b.createPoint(y.value) : await b.savePoint(c.id, y.value), g.success(n("common.saved")), T("saved"), e.value = !1;
|
|
49
|
+
} catch (r) {
|
|
50
|
+
const i = r.errors;
|
|
51
|
+
i && Object.keys(i).length > 0 ? (k.value = i, g.danger(n("common.save-failed"))) : g.danger(f(r));
|
|
52
|
+
} finally {
|
|
53
|
+
V.value = !1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function w() {
|
|
57
|
+
if (!(c.id === null || !await j({
|
|
58
|
+
title: n("point.delete-title", { name: D.value }),
|
|
59
|
+
message: n("point.delete-text"),
|
|
60
|
+
confirmText: n("common.delete"),
|
|
61
|
+
cancelText: n("common.cancel"),
|
|
62
|
+
tone: "danger"
|
|
63
|
+
})))
|
|
64
|
+
try {
|
|
65
|
+
await b.removePoint(c.id), g.success(n("point.deleted")), T("removed"), e.value = !1;
|
|
66
|
+
} catch (i) {
|
|
67
|
+
g.danger(f(i));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return (r, i) => (W(), B(t(Z), {
|
|
71
|
+
open: e.value,
|
|
72
|
+
"onUpdate:open": i[2] || (i[2] = (P) => e.value = P),
|
|
73
|
+
title: D.value,
|
|
74
|
+
width: 640,
|
|
75
|
+
scroll: "body"
|
|
76
|
+
}, Q({
|
|
77
|
+
default: a(() => [
|
|
78
|
+
d(t(O), {
|
|
79
|
+
class: "wx-delivery-point__intro",
|
|
80
|
+
tone: "muted",
|
|
81
|
+
size: "sm"
|
|
82
|
+
}, {
|
|
83
|
+
default: a(() => [
|
|
84
|
+
m(p(t(n)("point.intro")), 1)
|
|
85
|
+
]),
|
|
86
|
+
_: 1
|
|
87
|
+
}),
|
|
88
|
+
x.value ? (W(), B(t(ee), {
|
|
89
|
+
key: 0,
|
|
90
|
+
rows: 6
|
|
91
|
+
})) : (W(), B(t(oe), {
|
|
92
|
+
key: 1,
|
|
93
|
+
modelValue: y.value,
|
|
94
|
+
"onUpdate:modelValue": i[0] || (i[0] = (P) => y.value = P),
|
|
95
|
+
name: "delivery.point-form",
|
|
96
|
+
errors: k.value,
|
|
97
|
+
disabled: !z.value || V.value
|
|
98
|
+
}, null, 8, ["modelValue", "errors", "disabled"]))
|
|
99
|
+
]),
|
|
100
|
+
_: 2
|
|
101
|
+
}, [
|
|
102
|
+
z.value ? {
|
|
103
|
+
name: "footer",
|
|
104
|
+
fn: a(() => [
|
|
105
|
+
d(t(te), {
|
|
106
|
+
size: "sm",
|
|
107
|
+
class: "wx-delivery-point__footer"
|
|
108
|
+
}, {
|
|
109
|
+
default: a(() => [
|
|
110
|
+
S.id !== null ? (W(), B(t(U), {
|
|
111
|
+
key: 0,
|
|
112
|
+
variant: "text",
|
|
113
|
+
type: "danger",
|
|
114
|
+
icon: "trash",
|
|
115
|
+
onClick: w
|
|
116
|
+
}, {
|
|
117
|
+
default: a(() => [
|
|
118
|
+
m(p(t(n)("common.delete")), 1)
|
|
119
|
+
]),
|
|
120
|
+
_: 1
|
|
121
|
+
})) : I("", !0),
|
|
122
|
+
i[3] || (i[3] = X("span", { class: "wx-delivery-point__gap" }, null, -1)),
|
|
123
|
+
d(t(U), {
|
|
124
|
+
variant: "outline",
|
|
125
|
+
onClick: i[1] || (i[1] = (P) => e.value = !1)
|
|
126
|
+
}, {
|
|
127
|
+
default: a(() => [
|
|
128
|
+
m(p(t(n)("common.cancel")), 1)
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
}),
|
|
132
|
+
d(t(U), {
|
|
133
|
+
type: "primary",
|
|
134
|
+
loading: V.value,
|
|
135
|
+
disabled: x.value,
|
|
136
|
+
onClick: M
|
|
137
|
+
}, {
|
|
138
|
+
default: a(() => [
|
|
139
|
+
m(p(S.id === null ? t(n)("common.create") : t(n)("common.save")), 1)
|
|
140
|
+
]),
|
|
141
|
+
_: 1
|
|
142
|
+
}, 8, ["loading", "disabled"])
|
|
143
|
+
]),
|
|
144
|
+
_: 1
|
|
145
|
+
})
|
|
146
|
+
]),
|
|
147
|
+
key: "0"
|
|
148
|
+
} : void 0
|
|
149
|
+
]), 1032, ["open", "title"]));
|
|
150
|
+
}
|
|
151
|
+
}), ue = /* @__PURE__ */ J(re, [["__scopeId", "data-v-42847273"]]), ce = { key: 0 }, ve = /* @__PURE__ */ A({
|
|
152
|
+
__name: "PointsPage",
|
|
153
|
+
setup(S) {
|
|
154
|
+
const C = q(), c = G(C), e = H(), T = L(), _ = u(null), b = u([]), n = u(!1), f = u(""), v = u(""), y = u(null), k = u(!1), x = h(() => C.can("delivery.manage")), V = h(
|
|
155
|
+
() => C.state.manifest?.modules.find((o) => o.id === "delivery-points")?.title ?? e("sections.points")
|
|
156
|
+
), z = h(
|
|
157
|
+
() => x.value ? [{ key: "new", label: e("point.new"), primary: !0, run: () => r(null) }] : []
|
|
158
|
+
), D = h(() => [
|
|
159
|
+
{ key: "title", label: e("point.titles"), minWidth: 180, sortable: !0 },
|
|
160
|
+
{ key: "kind", label: e("point.kind"), width: 150, hideBelow: 560, sortable: !0 },
|
|
161
|
+
{ key: "locality", label: e("point.locality"), minWidth: 160, sortable: !0 },
|
|
162
|
+
{ key: "address", label: e("point.address"), minWidth: 180, hideBelow: 760 },
|
|
163
|
+
{ key: "today", label: e("point.today"), width: 140, hideBelow: 900 },
|
|
164
|
+
{ key: "active", label: e("point.active"), width: 110, sortable: !0 },
|
|
165
|
+
{ key: "actions", label: "", width: ie, align: "right" }
|
|
166
|
+
]), $ = h(() => [
|
|
167
|
+
{ value: "", label: e("common.any-state") },
|
|
168
|
+
{ value: "active", label: e("common.active") },
|
|
169
|
+
{ value: "inactive", label: e("common.inactive") }
|
|
170
|
+
]);
|
|
171
|
+
let M = { page: 1, perPage: 25, sort: null, search: "" };
|
|
172
|
+
async function w(o = M) {
|
|
173
|
+
M = o, n.value = !0;
|
|
174
|
+
try {
|
|
175
|
+
_.value = await c.points({
|
|
176
|
+
page: o.page,
|
|
177
|
+
per_page: o.perPage,
|
|
178
|
+
q: o.search,
|
|
179
|
+
kind: f.value,
|
|
180
|
+
state: v.value,
|
|
181
|
+
sort: o.sort ? `${o.sort.order === "desc" ? "-" : ""}${o.sort.key}` : void 0
|
|
182
|
+
}), b.value = _.value.filters.kinds;
|
|
183
|
+
} catch (s) {
|
|
184
|
+
g.danger(T(s));
|
|
185
|
+
} finally {
|
|
186
|
+
n.value = !1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
F([f, v], () => {
|
|
190
|
+
w({ ...M, page: 1 });
|
|
191
|
+
});
|
|
192
|
+
function r(o) {
|
|
193
|
+
y.value = o, k.value = !0;
|
|
194
|
+
}
|
|
195
|
+
async function i(o) {
|
|
196
|
+
if (await j({
|
|
197
|
+
title: e("point.delete-title", { name: o.title || e("point.title") }),
|
|
198
|
+
message: e("point.delete-text"),
|
|
199
|
+
confirmText: e("common.delete"),
|
|
200
|
+
cancelText: e("common.cancel"),
|
|
201
|
+
tone: "danger"
|
|
202
|
+
}))
|
|
203
|
+
try {
|
|
204
|
+
await c.removePoint(o.id), g.success(e("point.deleted")), await w();
|
|
205
|
+
} catch (l) {
|
|
206
|
+
g.danger(T(l));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function P(o) {
|
|
210
|
+
return x.value ? [
|
|
211
|
+
{ key: "edit", icon: "edit", label: e("common.edit"), run: () => r(o.id) },
|
|
212
|
+
{
|
|
213
|
+
key: "delete",
|
|
214
|
+
icon: "trash",
|
|
215
|
+
label: e("common.delete"),
|
|
216
|
+
danger: !0,
|
|
217
|
+
run: () => {
|
|
218
|
+
i(o);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
] : [];
|
|
222
|
+
}
|
|
223
|
+
return (o, s) => (W(), B(t(se), {
|
|
224
|
+
title: V.value,
|
|
225
|
+
actions: z.value
|
|
226
|
+
}, {
|
|
227
|
+
before: a(() => [
|
|
228
|
+
d(t(O), {
|
|
229
|
+
class: "wx-delivery-intro",
|
|
230
|
+
tone: "muted",
|
|
231
|
+
size: "sm"
|
|
232
|
+
}, {
|
|
233
|
+
default: a(() => [
|
|
234
|
+
m(p(t(e)("point.intro")), 1)
|
|
235
|
+
]),
|
|
236
|
+
_: 1
|
|
237
|
+
})
|
|
238
|
+
]),
|
|
239
|
+
default: a(() => [
|
|
240
|
+
d(t(le), {
|
|
241
|
+
data: _.value,
|
|
242
|
+
columns: D.value,
|
|
243
|
+
"row-key": "id",
|
|
244
|
+
searchable: "",
|
|
245
|
+
clickable: "",
|
|
246
|
+
hover: "",
|
|
247
|
+
flush: "",
|
|
248
|
+
loading: n.value,
|
|
249
|
+
"search-placeholder": t(e)("common.search"),
|
|
250
|
+
"empty-text": t(e)("point.empty"),
|
|
251
|
+
"filters-count": (f.value ? 1 : 0) + (v.value ? 1 : 0),
|
|
252
|
+
onRowClick: s[2] || (s[2] = (l) => r(l.id)),
|
|
253
|
+
onStateChange: w
|
|
254
|
+
}, {
|
|
255
|
+
filters: a(() => [
|
|
256
|
+
d(t(E), {
|
|
257
|
+
label: t(e)("point.kind")
|
|
258
|
+
}, {
|
|
259
|
+
default: a(() => [
|
|
260
|
+
d(t(R), {
|
|
261
|
+
modelValue: f.value,
|
|
262
|
+
"onUpdate:modelValue": s[0] || (s[0] = (l) => f.value = l),
|
|
263
|
+
options: [{ value: "", label: t(e)("point.any-kind") }, ...b.value],
|
|
264
|
+
size: "sm"
|
|
265
|
+
}, null, 8, ["modelValue", "options"])
|
|
266
|
+
]),
|
|
267
|
+
_: 1
|
|
268
|
+
}, 8, ["label"]),
|
|
269
|
+
d(t(E), {
|
|
270
|
+
label: t(e)("point.active")
|
|
271
|
+
}, {
|
|
272
|
+
default: a(() => [
|
|
273
|
+
d(t(R), {
|
|
274
|
+
modelValue: v.value,
|
|
275
|
+
"onUpdate:modelValue": s[1] || (s[1] = (l) => v.value = l),
|
|
276
|
+
options: $.value,
|
|
277
|
+
size: "sm"
|
|
278
|
+
}, null, 8, ["modelValue", "options"])
|
|
279
|
+
]),
|
|
280
|
+
_: 1
|
|
281
|
+
}, 8, ["label"])
|
|
282
|
+
]),
|
|
283
|
+
"cell-title": a(({ row: l }) => [
|
|
284
|
+
m(p(l.title || "—"), 1)
|
|
285
|
+
]),
|
|
286
|
+
"cell-kind": a(({ row: l }) => [
|
|
287
|
+
m(p(l.kind_label), 1)
|
|
288
|
+
]),
|
|
289
|
+
"cell-locality": a(({ row: l }) => [
|
|
290
|
+
l.locality ? (W(), Y("span", ce, [
|
|
291
|
+
m(p(l.locality.label) + " ", 1),
|
|
292
|
+
l.locality.active ? I("", !0) : (W(), B(t(ne), {
|
|
293
|
+
key: 0,
|
|
294
|
+
name: "warning",
|
|
295
|
+
size: "sm"
|
|
296
|
+
}))
|
|
297
|
+
])) : I("", !0)
|
|
298
|
+
]),
|
|
299
|
+
"cell-today": a(({ row: l }) => [
|
|
300
|
+
m(p(l.today ?? ""), 1)
|
|
301
|
+
]),
|
|
302
|
+
"cell-active": a(({ row: l }) => [
|
|
303
|
+
d(t(ae), {
|
|
304
|
+
type: l.active ? "success" : "default",
|
|
305
|
+
dot: ""
|
|
306
|
+
}, {
|
|
307
|
+
default: a(() => [
|
|
308
|
+
m(p(l.active ? t(e)("common.active") : t(e)("common.inactive")), 1)
|
|
309
|
+
]),
|
|
310
|
+
_: 2
|
|
311
|
+
}, 1032, ["type"])
|
|
312
|
+
]),
|
|
313
|
+
"cell-actions": a(({ row: l }) => [
|
|
314
|
+
d(t(de), {
|
|
315
|
+
actions: P(l),
|
|
316
|
+
label: l.title
|
|
317
|
+
}, null, 8, ["actions", "label"])
|
|
318
|
+
]),
|
|
319
|
+
_: 1
|
|
320
|
+
}, 8, ["data", "columns", "loading", "search-placeholder", "empty-text", "filters-count"]),
|
|
321
|
+
d(ue, {
|
|
322
|
+
id: y.value,
|
|
323
|
+
open: k.value,
|
|
324
|
+
"onUpdate:open": s[3] || (s[3] = (l) => k.value = l),
|
|
325
|
+
onSaved: s[4] || (s[4] = (l) => w()),
|
|
326
|
+
onRemoved: s[5] || (s[5] = (l) => w())
|
|
327
|
+
}, null, 8, ["id", "open"])
|
|
328
|
+
]),
|
|
329
|
+
_: 1
|
|
330
|
+
}, 8, ["title", "actions"]));
|
|
331
|
+
}
|
|
332
|
+
}), ge = /* @__PURE__ */ J(ve, [["__scopeId", "data-v-7016fad1"]]);
|
|
333
|
+
export {
|
|
334
|
+
ge as default
|
|
335
|
+
};
|
|
336
|
+
//# sourceMappingURL=PointsPage-C16GT-YH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointsPage-C16GT-YH.js","sources":["../src/PointDialog.vue","../src/PointsPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\nimport { confirm, toast, WxButton, WxDialog, WxSkeleton, WxSpace, WxText } from '@webx-ui/core'\nimport { useAdmin, useErrorText, WxScreen } from '@webx-ui/module-admin'\nimport type { ScreenModel } from '@webx-ui/schema'\nimport { createDeliveryApi } from './api'\nimport { useDeliveryWords } from './i18n'\nimport type { PointDetail } from './types'\n\n/**\n * One of the shop's own points (§14.2): the screen `delivery.point-form` in a dialog. Its\n * locality field searches the shared geography and adds a town it does not find (decision 42).\n */\nconst props = withDefaults(defineProps<{ id?: number | null }>(), { id: null })\n\nconst open = defineModel<boolean>('open', { default: false })\n\nconst emit = defineEmits<{ saved: []; removed: [] }>()\n\nconst context = useAdmin()\nconst api = createDeliveryApi(context)\nconst t = useDeliveryWords()\nconst message = useErrorText()\n\nconst detail = ref<PointDetail | null>(null)\nconst values = ref<ScreenModel>({})\nconst errors = ref<Record<string, string[]>>({})\nconst loading = ref(false)\nconst saving = ref(false)\n\nconst canManage = computed(() => context.can('delivery.manage'))\nconst title = computed(() =>\n props.id === null ? t('point.new') : detail.value?.point.title || t('point.title'),\n)\n\nasync function reset(): Promise<void> {\n errors.value = {}\n detail.value = null\n\n if (props.id === null) {\n values.value = {\n kind: 'store',\n titles: {},\n address: {},\n locality_id: null,\n lat: null,\n lng: null,\n phone: null,\n active: true,\n schedule: null,\n }\n\n return\n }\n\n loading.value = true\n\n try {\n detail.value = await api.point(props.id)\n values.value = detail.value.values\n } catch (error) {\n toast.danger(message(error))\n open.value = false\n } finally {\n loading.value = false\n }\n}\n\nwatch(open, (now) => {\n if (now) void reset()\n})\n\nasync function save(): Promise<void> {\n saving.value = true\n errors.value = {}\n\n try {\n if (props.id === null) await api.createPoint(values.value)\n else await api.savePoint(props.id, values.value)\n\n toast.success(t('common.saved'))\n emit('saved')\n open.value = false\n } catch (error) {\n const fields = (error as { errors?: Record<string, string[]> }).errors\n\n if (fields && Object.keys(fields).length > 0) {\n errors.value = fields\n toast.danger(t('common.save-failed'))\n } else {\n toast.danger(message(error))\n }\n } finally {\n saving.value = false\n }\n}\n\nasync function remove(): Promise<void> {\n if (props.id === null) return\n\n const agreed = await confirm({\n title: t('point.delete-title', { name: title.value }),\n message: t('point.delete-text'),\n confirmText: t('common.delete'),\n cancelText: t('common.cancel'),\n tone: 'danger',\n })\n\n if (!agreed) return\n\n try {\n await api.removePoint(props.id)\n toast.success(t('point.deleted'))\n emit('removed')\n open.value = false\n } catch (error) {\n toast.danger(message(error))\n }\n}\n</script>\n\n<template>\n <wx-dialog v-model:open=\"open\" :title=\"title\" :width=\"640\" scroll=\"body\">\n <!-- What a point is, before the fields: the shop's own, never a carrier's branch. -->\n <wx-text class=\"wx-delivery-point__intro\" tone=\"muted\" size=\"sm\">{{\n t('point.intro')\n }}</wx-text>\n <wx-skeleton v-if=\"loading\" :rows=\"6\" />\n <wx-screen\n v-else\n v-model=\"values\"\n name=\"delivery.point-form\"\n :errors=\"errors\"\n :disabled=\"!canManage || saving\"\n />\n\n <template v-if=\"canManage\" #footer>\n <wx-space size=\"sm\" class=\"wx-delivery-point__footer\">\n <wx-button v-if=\"id !== null\" variant=\"text\" type=\"danger\" icon=\"trash\" @click=\"remove\">\n {{ t('common.delete') }}\n </wx-button>\n <span class=\"wx-delivery-point__gap\" />\n <wx-button variant=\"outline\" @click=\"open = false\">{{ t('common.cancel') }}</wx-button>\n <wx-button type=\"primary\" :loading=\"saving\" :disabled=\"loading\" @click=\"save\">\n {{ id === null ? t('common.create') : t('common.save') }}\n </wx-button>\n </wx-space>\n </template>\n </wx-dialog>\n</template>\n\n<style scoped>\n.wx-delivery-point__intro {\n display: block;\n margin-bottom: var(--wx-space-16);\n}\n\n.wx-delivery-point__footer {\n width: 100%;\n}\n\n.wx-delivery-point__gap {\n flex: 1 1 auto;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\nimport {\n confirm,\n toast,\n WxBadge,\n WxFormItem,\n WxIcon,\n WxSelect,\n WxTable,\n WxText,\n type TableColumn,\n type TableState,\n} from '@webx-ui/core'\nimport {\n rowMenuWidth,\n useAdmin,\n useErrorText,\n WxListScreen,\n WxRowMenu,\n type RowAction,\n type ScreenAction,\n} from '@webx-ui/module-admin'\nimport { createDeliveryApi } from './api'\nimport { useDeliveryWords } from './i18n'\nimport PointDialog from './PointDialog.vue'\nimport type { Option, PointRow, PointsPage } from './types'\n\n/**\n * The shop's own points (§14.2): stores and pick-up points a page at a time, by kind and state,\n * searched by name and address, sorted by any column but the address. A row opens its form, its\n * `···` offers the same and the deletion — the table every list of the panel is (Blog → Tags).\n */\nconst context = useAdmin()\nconst api = createDeliveryApi(context)\nconst t = useDeliveryWords()\nconst message = useErrorText()\n\nconst page = ref<PointsPage | null>(null)\nconst kinds = ref<Option[]>([])\nconst loading = ref(false)\nconst kind = ref('')\nconst state = ref('')\nconst editing = ref<number | null>(null)\nconst opened = ref(false)\n\nconst canManage = computed(() => context.can('delivery.manage'))\nconst title = computed(\n () =>\n context.state.manifest?.modules.find((module) => module.id === 'delivery-points')?.title ??\n t('sections.points'),\n)\n\nconst actions = computed<ScreenAction[]>(() =>\n canManage.value\n ? [{ key: 'new', label: t('point.new'), primary: true, run: () => edit(null) }]\n : [],\n)\n\nconst columns = computed<TableColumn<PointRow>[]>(() => [\n { key: 'title', label: t('point.titles'), minWidth: 180, sortable: true },\n { key: 'kind', label: t('point.kind'), width: 150, hideBelow: 560, sortable: true },\n { key: 'locality', label: t('point.locality'), minWidth: 160, sortable: true },\n { key: 'address', label: t('point.address'), minWidth: 180, hideBelow: 760 },\n { key: 'today', label: t('point.today'), width: 140, hideBelow: 900 },\n { key: 'active', label: t('point.active'), width: 110, sortable: true },\n { key: 'actions', label: '', width: rowMenuWidth, align: 'right' },\n])\n\nconst stateOptions = computed(() => [\n { value: '', label: t('common.any-state') },\n { value: 'active', label: t('common.active') },\n { value: 'inactive', label: t('common.inactive') },\n])\n\nlet last: TableState = { page: 1, perPage: 25, sort: null, search: '' }\n\nasync function load(next: TableState = last): Promise<void> {\n last = next\n loading.value = true\n\n try {\n page.value = await api.points({\n page: next.page,\n per_page: next.perPage,\n q: next.search,\n kind: kind.value,\n state: state.value,\n sort: next.sort ? `${next.sort.order === 'desc' ? '-' : ''}${next.sort.key}` : undefined,\n })\n kinds.value = page.value.filters.kinds\n } catch (error) {\n toast.danger(message(error))\n } finally {\n loading.value = false\n }\n}\n\nwatch([kind, state], () => void load({ ...last, page: 1 }))\n\nfunction edit(id: number | null): void {\n editing.value = id\n opened.value = true\n}\n\nasync function remove(row: PointRow): Promise<void> {\n const agreed = await confirm({\n title: t('point.delete-title', { name: row.title || t('point.title') }),\n message: t('point.delete-text'),\n confirmText: t('common.delete'),\n cancelText: t('common.cancel'),\n tone: 'danger',\n })\n\n if (!agreed) return\n\n try {\n await api.removePoint(row.id)\n toast.success(t('point.deleted'))\n await load()\n } catch (error) {\n toast.danger(message(error))\n }\n}\n\nfunction actionsFor(row: PointRow): RowAction[] {\n if (!canManage.value) return []\n\n return [\n { key: 'edit', icon: 'edit', label: t('common.edit'), run: () => edit(row.id) },\n {\n key: 'delete',\n icon: 'trash',\n label: t('common.delete'),\n danger: true,\n run: () => void remove(row),\n },\n ]\n}\n</script>\n\n<template>\n <wx-list-screen :title=\"title\" :actions=\"actions\">\n <!-- What the screen is, in full: a heading's subtitle is one line and cuts this short. -->\n <template #before>\n <wx-text class=\"wx-delivery-intro\" tone=\"muted\" size=\"sm\">{{ t('point.intro') }}</wx-text>\n </template>\n\n <wx-table\n :data=\"page\"\n :columns=\"columns\"\n row-key=\"id\"\n searchable\n clickable\n hover\n flush\n :loading=\"loading\"\n :search-placeholder=\"t('common.search')\"\n :empty-text=\"t('point.empty')\"\n :filters-count=\"(kind ? 1 : 0) + (state ? 1 : 0)\"\n @row-click=\"(row: PointRow) => edit(row.id)\"\n @state-change=\"load\"\n >\n <template #filters>\n <wx-form-item :label=\"t('point.kind')\">\n <wx-select\n v-model=\"kind\"\n :options=\"[{ value: '', label: t('point.any-kind') }, ...kinds]\"\n size=\"sm\"\n />\n </wx-form-item>\n <wx-form-item :label=\"t('point.active')\">\n <wx-select v-model=\"state\" :options=\"stateOptions\" size=\"sm\" />\n </wx-form-item>\n </template>\n\n <template #cell-title=\"{ row }\">{{ row.title || '—' }}</template>\n <template #cell-kind=\"{ row }\">{{ row.kind_label }}</template>\n <template #cell-locality=\"{ row }\">\n <span v-if=\"row.locality\">\n {{ row.locality.label }}\n <wx-icon v-if=\"!row.locality.active\" name=\"warning\" size=\"sm\" />\n </span>\n </template>\n <template #cell-today=\"{ row }\">{{ row.today ?? '' }}</template>\n <template #cell-active=\"{ row }\">\n <wx-badge :type=\"row.active ? 'success' : 'default'\" dot>\n {{ row.active ? t('common.active') : t('common.inactive') }}\n </wx-badge>\n </template>\n <template #cell-actions=\"{ row }\">\n <wx-row-menu :actions=\"actionsFor(row)\" :label=\"row.title\" />\n </template>\n </wx-table>\n\n <point-dialog :id=\"editing\" v-model:open=\"opened\" @saved=\"load()\" @removed=\"load()\" />\n </wx-list-screen>\n</template>\n\n<style scoped>\n/* A paragraph and not a line: read once, it has to fit without running the whole width. */\n.wx-delivery-intro {\n display: block;\n max-width: 760px;\n}\n</style>\n"],"names":["props","__props","open","_useModel","emit","__emit","context","useAdmin","api","createDeliveryApi","t","useDeliveryWords","message","useErrorText","detail","ref","values","errors","loading","saving","canManage","computed","title","reset","error","toast","watch","now","save","fields","remove","confirm","_createBlock","_unref","WxDialog","$event","_createVNode","WxText","WxSkeleton","WxScreen","WxSpace","WxButton","_createElementVNode","page","kinds","kind","state","editing","opened","module","actions","edit","columns","rowMenuWidth","stateOptions","last","load","next","id","row","actionsFor","WxListScreen","WxTable","WxFormItem","Wx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+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { defineComponent as C, ref as g, computed as w, openBlock as n, createBlock as d, unref as e, withCtx as c, createVNode as m, createElementBlock as k, createElementVNode as v, toDisplayString as _, createCommentVNode as x, Fragment as S, createSlots as A, createTextVNode as B } from "vue";
|
|
2
|
+
import { WxCard as E, WxSkeleton as N, WxEmpty as D, WxSortableList as L, WxBadge as z, WxAction as M, WxAlert as T, toast as i } from "@webx-ui/core";
|
|
3
|
+
import { useAdmin as F, useErrorText as I, WxListScreen as U } from "@webx-ui/module-admin";
|
|
4
|
+
import { c as $, u as j, a as q, _ as G } from "./index-CuhwaAcG.js";
|
|
5
|
+
const H = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "wx-delivery-popular__add"
|
|
8
|
+
}, J = { class: "wx-delivery-popular__help" }, K = { class: "wx-delivery-popular__row" }, O = { class: "wx-delivery-popular__name" }, Q = { class: "wx-delivery-popular__label" }, R = /* @__PURE__ */ C({
|
|
9
|
+
__name: "PopularPage",
|
|
10
|
+
setup(X) {
|
|
11
|
+
const y = F(), p = $(y), a = j(), u = I(), t = g([]), f = g(!0), s = w(() => y.can("delivery.manage")), b = w(
|
|
12
|
+
() => y.state.manifest?.modules.find((l) => l.id === "delivery-popular")?.title ?? a("sections.popular")
|
|
13
|
+
);
|
|
14
|
+
async function h() {
|
|
15
|
+
f.value = !0;
|
|
16
|
+
try {
|
|
17
|
+
t.value = await p.popular();
|
|
18
|
+
} catch (l) {
|
|
19
|
+
i.danger(u(l));
|
|
20
|
+
} finally {
|
|
21
|
+
f.value = !1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
h();
|
|
25
|
+
async function W(l) {
|
|
26
|
+
if (t.value.some((r) => r.id === l.id)) {
|
|
27
|
+
i.info(a("popular.already"));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
t.value = await p.addPopular(l.id), i.success(a("popular.added"));
|
|
32
|
+
} catch (r) {
|
|
33
|
+
i.danger(u(r));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function P(l) {
|
|
37
|
+
try {
|
|
38
|
+
t.value = await p.removePopular(l.id), i.success(a("popular.removed"));
|
|
39
|
+
} catch (r) {
|
|
40
|
+
i.danger(u(r));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function V() {
|
|
44
|
+
try {
|
|
45
|
+
t.value = await p.setPopular(t.value.map((l) => l.id));
|
|
46
|
+
} catch (l) {
|
|
47
|
+
i.danger(u(l, a("common.order-failed"))), await h();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return (l, r) => (n(), d(e(U), {
|
|
51
|
+
title: b.value,
|
|
52
|
+
card: !1
|
|
53
|
+
}, {
|
|
54
|
+
default: c(() => [
|
|
55
|
+
m(e(E), { class: "wx-delivery-popular" }, {
|
|
56
|
+
default: c(() => [
|
|
57
|
+
s.value ? (n(), k("div", H, [
|
|
58
|
+
m(q, {
|
|
59
|
+
creatable: "",
|
|
60
|
+
exclude: t.value.map((o) => o.id),
|
|
61
|
+
placeholder: e(a)("popular.add"),
|
|
62
|
+
onPick: W
|
|
63
|
+
}, null, 8, ["exclude", "placeholder"]),
|
|
64
|
+
v("span", J, _(e(a)("popular.add-help")), 1)
|
|
65
|
+
])) : x("", !0),
|
|
66
|
+
f.value && t.value.length === 0 ? (n(), d(e(N), {
|
|
67
|
+
key: 1,
|
|
68
|
+
rows: 4
|
|
69
|
+
})) : t.value.length === 0 ? (n(), d(e(D), {
|
|
70
|
+
key: 2,
|
|
71
|
+
title: e(a)("popular.empty"),
|
|
72
|
+
description: e(a)("popular.empty-help")
|
|
73
|
+
}, null, 8, ["title", "description"])) : (n(), k(S, { key: 3 }, [
|
|
74
|
+
m(e(L), {
|
|
75
|
+
modelValue: t.value,
|
|
76
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => t.value = o),
|
|
77
|
+
class: "wx-delivery-popular__list",
|
|
78
|
+
hoverable: "",
|
|
79
|
+
plain: "",
|
|
80
|
+
"item-key": "id",
|
|
81
|
+
handle: s.value ? "grip" : "row",
|
|
82
|
+
"item-label": (o) => o.name,
|
|
83
|
+
disabled: !s.value,
|
|
84
|
+
"data-test": "popular-list",
|
|
85
|
+
onMove: V
|
|
86
|
+
}, A({
|
|
87
|
+
default: c(({ item: o }) => [
|
|
88
|
+
v("span", K, [
|
|
89
|
+
v("span", O, _(o.name), 1),
|
|
90
|
+
v("span", Q, _(o.label), 1),
|
|
91
|
+
o.active ? x("", !0) : (n(), d(e(z), {
|
|
92
|
+
key: 0,
|
|
93
|
+
size: "sm",
|
|
94
|
+
type: "warning",
|
|
95
|
+
dot: ""
|
|
96
|
+
}, {
|
|
97
|
+
default: c(() => [
|
|
98
|
+
B(_(e(a)("popular.hidden")), 1)
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
}))
|
|
102
|
+
])
|
|
103
|
+
]),
|
|
104
|
+
_: 2
|
|
105
|
+
}, [
|
|
106
|
+
s.value ? {
|
|
107
|
+
name: "actions",
|
|
108
|
+
fn: c(({ item: o }) => [
|
|
109
|
+
m(e(M), {
|
|
110
|
+
type: "remove",
|
|
111
|
+
size: "sm",
|
|
112
|
+
title: e(a)("popular.remove"),
|
|
113
|
+
confirm: e(a)("popular.remove-title", { name: o.name }),
|
|
114
|
+
"confirm-text": e(a)("popular.remove"),
|
|
115
|
+
"cancel-text": e(a)("common.cancel"),
|
|
116
|
+
"data-test": "popular-remove",
|
|
117
|
+
onClick: (Y) => P(o)
|
|
118
|
+
}, null, 8, ["title", "confirm", "confirm-text", "cancel-text", "onClick"])
|
|
119
|
+
]),
|
|
120
|
+
key: "0"
|
|
121
|
+
} : void 0
|
|
122
|
+
]), 1032, ["modelValue", "handle", "item-label", "disabled"]),
|
|
123
|
+
s.value && t.value.length > 1 ? (n(), d(e(T), {
|
|
124
|
+
key: 0,
|
|
125
|
+
class: "wx-delivery-popular__note",
|
|
126
|
+
type: "info",
|
|
127
|
+
description: e(a)("common.drag")
|
|
128
|
+
}, null, 8, ["description"])) : x("", !0)
|
|
129
|
+
], 64))
|
|
130
|
+
]),
|
|
131
|
+
_: 1
|
|
132
|
+
})
|
|
133
|
+
]),
|
|
134
|
+
_: 1
|
|
135
|
+
}, 8, ["title"]));
|
|
136
|
+
}
|
|
137
|
+
}), te = /* @__PURE__ */ G(R, [["__scopeId", "data-v-bbd29c30"]]);
|
|
138
|
+
export {
|
|
139
|
+
te as default
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=PopularPage-BdE59dwB.js.map
|