wip(freight): migration 0017 + model/column-list groundwork for add-freight-templates
This commit is contained in:
@@ -35,10 +35,7 @@ async function load(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function transition(
|
||||
order: IntegralOrder,
|
||||
action: "fulfill" | "cancel",
|
||||
): Promise<void> {
|
||||
async function transition(order: IntegralOrder, action: "fulfill" | "cancel"): Promise<void> {
|
||||
actionId.value = order.id;
|
||||
error.value = "";
|
||||
notice.value = "";
|
||||
@@ -46,9 +43,7 @@ async function transition(
|
||||
if (action === "fulfill") await $api.admin.fulfillRedemption(order.id);
|
||||
else await $api.admin.cancelRedemption(order.id);
|
||||
notice.value =
|
||||
action === "fulfill"
|
||||
? t("admin.redemptionFulfilled")
|
||||
: t("admin.redemptionCancelled");
|
||||
action === "fulfill" ? t("admin.redemptionFulfilled") : t("admin.redemptionCancelled");
|
||||
await load();
|
||||
} catch (err: unknown) {
|
||||
error.value = err instanceof Error ? err.message : t("common.error");
|
||||
@@ -62,42 +57,61 @@ onMounted(() => void load());
|
||||
|
||||
<template>
|
||||
<VPage :title="$t('admin.pointsOrderManagement')">
|
||||
<p v-if="error" class="my-2 text-sm text-danger" role="alert">{{ error }}</p>
|
||||
<p v-if="notice" class="text-sm text-muted" role="status">{{ notice }}</p>
|
||||
<p v-if="loading" class="text-sm text-muted">{{ $t("common.loading") }}</p>
|
||||
<p v-if="error" class="text-danger my-2 text-sm" role="alert">{{ error }}</p>
|
||||
<p v-if="notice" class="text-muted text-sm" role="status">{{ notice }}</p>
|
||||
<p v-if="loading" class="text-muted text-sm">{{ $t("common.loading") }}</p>
|
||||
<VCard v-else-if="orders.length === 0" class="text-muted">{{ $t("common.empty") }}</VCard>
|
||||
<div v-else class="overflow-x-auto"><div class="min-w-[980px]"><VTable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ $t("admin.redemptionNo") }}</th>
|
||||
<th>{{ $t("admin.redemptionCustomer") }}</th>
|
||||
<th>{{ $t("admin.redemptionReward") }}</th>
|
||||
<th>{{ $t("admin.redemptionPoints") }}</th>
|
||||
<th>{{ $t("admin.created") }}</th>
|
||||
<th>{{ $t("admin.redemptionStatus") }}</th>
|
||||
<th>{{ $t("common.actions") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="order in orders" :key="order.id">
|
||||
<td>{{ order.order_no }}</td>
|
||||
<td class="text-muted">{{ order.user_id }}</td>
|
||||
<td>{{ rewardName(order) }}</td>
|
||||
<td>{{ order.total_points }}</td>
|
||||
<td>{{ order.created_at.slice(0, 10) }}</td>
|
||||
<td><VBadge :tone="statusClass(order.status)">{{ $t(`admin.redemptionStatuses.${order.status}`) }}</VBadge></td>
|
||||
<td><div class="flex gap-2">
|
||||
<template v-if="order.status === 'pending_fulfillment'">
|
||||
<VBtn size="sm" variant="primary" :disabled="actionId === order.id" @click="transition(order, 'fulfill')">
|
||||
{{ $t("admin.fulfillRedemption") }}
|
||||
</VBtn>
|
||||
<VBtn size="sm" :disabled="actionId === order.id" @click="transition(order, 'cancel')">
|
||||
{{ $t("admin.cancelRedemption") }}
|
||||
</VBtn>
|
||||
</template>
|
||||
</div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</VTable></div></div>
|
||||
<div v-else class="overflow-x-auto">
|
||||
<div class="min-w-[980px]">
|
||||
<VTable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ $t("admin.redemptionNo") }}</th>
|
||||
<th>{{ $t("admin.redemptionCustomer") }}</th>
|
||||
<th>{{ $t("admin.redemptionReward") }}</th>
|
||||
<th>{{ $t("admin.redemptionPoints") }}</th>
|
||||
<th>{{ $t("admin.created") }}</th>
|
||||
<th>{{ $t("admin.redemptionStatus") }}</th>
|
||||
<th>{{ $t("common.actions") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="order in orders" :key="order.id">
|
||||
<td>{{ order.order_no }}</td>
|
||||
<td class="text-muted">{{ order.user_id }}</td>
|
||||
<td>{{ rewardName(order) }}</td>
|
||||
<td>{{ order.total_points }}</td>
|
||||
<td>{{ order.created_at.slice(0, 10) }}</td>
|
||||
<td>
|
||||
<VBadge :tone="statusClass(order.status)">{{
|
||||
$t(`admin.redemptionStatuses.${order.status}`)
|
||||
}}</VBadge>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex gap-2">
|
||||
<template v-if="order.status === 'pending_fulfillment'">
|
||||
<VBtn
|
||||
size="sm"
|
||||
variant="primary"
|
||||
:disabled="actionId === order.id"
|
||||
@click="transition(order, 'fulfill')"
|
||||
>
|
||||
{{ $t("admin.fulfillRedemption") }}
|
||||
</VBtn>
|
||||
<VBtn
|
||||
size="sm"
|
||||
:disabled="actionId === order.id"
|
||||
@click="transition(order, 'cancel')"
|
||||
>
|
||||
{{ $t("admin.cancelRedemption") }}
|
||||
</VBtn>
|
||||
</template>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</VTable>
|
||||
</div>
|
||||
</div>
|
||||
</VPage>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user