wip(freight): migration 0017 + model/column-list groundwork for add-freight-templates
This commit is contained in:
@@ -128,25 +128,39 @@ onMounted(() => void load());
|
||||
|
||||
<template>
|
||||
<VPage :title="$t('admin.pointsProductManagement')">
|
||||
<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="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>
|
||||
|
||||
<VCard class="mb-5">
|
||||
<h2 class="mb-4 text-base font-semibold">{{ editingId ? $t("admin.editPointsProduct") : $t("admin.newPointsProduct") }}</h2>
|
||||
<h2 class="mb-4 text-base font-semibold">
|
||||
{{ editingId ? $t("admin.editPointsProduct") : $t("admin.newPointsProduct") }}
|
||||
</h2>
|
||||
<div class="grid gap-3 md:grid-cols-3">
|
||||
<VField :label="$t('admin.pointsNameEn')"><VInput id="pp-name-en" v-model="form.nameEn" /></VField>
|
||||
<VField :label="$t('admin.pointsNameZh')"><VInput id="pp-name-zh" v-model="form.nameZh" /></VField>
|
||||
<VField :label="$t('admin.pointsImage')"><VInput id="pp-image" v-model="form.image" /></VField>
|
||||
<VField :label="$t('admin.pointsPrice')"><VInput id="pp-price" v-model.number="form.pointsPrice" min="1" step="1" type="number" /></VField>
|
||||
<VField :label="$t('admin.pointsStock')"><VInput id="pp-stock" v-model.number="form.stock" min="0" step="1" type="number" /></VField>
|
||||
<VField :label="$t('admin.pointsPosition')"><VInput id="pp-position" v-model.number="form.position" step="1" type="number" /></VField>
|
||||
<VField :label="$t('admin.pointsNameEn')"
|
||||
><VInput id="pp-name-en" v-model="form.nameEn"
|
||||
/></VField>
|
||||
<VField :label="$t('admin.pointsNameZh')"
|
||||
><VInput id="pp-name-zh" v-model="form.nameZh"
|
||||
/></VField>
|
||||
<VField :label="$t('admin.pointsImage')"
|
||||
><VInput id="pp-image" v-model="form.image"
|
||||
/></VField>
|
||||
<VField :label="$t('admin.pointsPrice')"
|
||||
><VInput id="pp-price" v-model.number="form.pointsPrice" min="1" step="1" type="number"
|
||||
/></VField>
|
||||
<VField :label="$t('admin.pointsStock')"
|
||||
><VInput id="pp-stock" v-model.number="form.stock" min="0" step="1" type="number"
|
||||
/></VField>
|
||||
<VField :label="$t('admin.pointsPosition')"
|
||||
><VInput id="pp-position" v-model.number="form.position" step="1" type="number"
|
||||
/></VField>
|
||||
</div>
|
||||
<label class="my-2 flex items-center gap-2 text-sm">
|
||||
<input v-model="form.recommend" class="h-4 w-4 accent-primary" type="checkbox" />
|
||||
<input v-model="form.recommend" class="accent-primary h-4 w-4" type="checkbox" />
|
||||
{{ $t("admin.pointsRecommend") }}
|
||||
</label>
|
||||
<label class="mb-4 flex items-center gap-2 text-sm">
|
||||
<input v-model="form.published" class="h-4 w-4 accent-primary" type="checkbox" />
|
||||
<input v-model="form.published" class="accent-primary h-4 w-4" type="checkbox" />
|
||||
{{ $t("admin.pointsPublished") }}
|
||||
</label>
|
||||
<div class="flex gap-2">
|
||||
@@ -157,38 +171,51 @@ onMounted(() => void load());
|
||||
</div>
|
||||
</VCard>
|
||||
|
||||
<p v-if="loading" class="text-sm text-muted">{{ $t("common.loading") }}</p>
|
||||
<p v-if="loading" class="text-muted text-sm">{{ $t("common.loading") }}</p>
|
||||
<VCard v-else-if="products.length === 0" class="text-muted">{{ $t("common.empty") }}</VCard>
|
||||
<div v-else class="overflow-x-auto"><div class="min-w-[900px]"><VTable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ $t("admin.pointsNameEn") }}</th>
|
||||
<th>{{ $t("admin.pointsPrice") }}</th>
|
||||
<th>{{ $t("admin.pointsStock") }}</th>
|
||||
<th>{{ $t("admin.pointsPosition") }}</th>
|
||||
<th>{{ $t("admin.pointsRecommend") }}</th>
|
||||
<th>{{ $t("common.status") }}</th>
|
||||
<th>{{ $t("common.actions") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="product in products" :key="product.id">
|
||||
<td>{{ localizedName(product.name) }}</td>
|
||||
<td>{{ product.points_price }}</td>
|
||||
<td>{{ product.stock }}</td>
|
||||
<td>{{ product.position }}</td>
|
||||
<td>{{ product.recommend ? $t("common.yes") : $t("common.no") }}</td>
|
||||
<td><VBadge :tone="product.published ? 'green' : 'orange'">
|
||||
{{ product.published ? $t("admin.publishedOn") : $t("admin.publishedOff") }}
|
||||
</VBadge></td>
|
||||
<td><div class="flex gap-2">
|
||||
<VBtn size="sm" @click="edit(product)">{{ $t("common.edit") }}</VBtn>
|
||||
<VBtn size="sm" variant="primary" :disabled="actionId === product.id" @click="togglePublished(product)">
|
||||
{{ product.published ? $t("product.unpublish") : $t("product.publish") }}
|
||||
</VBtn>
|
||||
</div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</VTable></div></div>
|
||||
<div v-else class="overflow-x-auto">
|
||||
<div class="min-w-[900px]">
|
||||
<VTable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ $t("admin.pointsNameEn") }}</th>
|
||||
<th>{{ $t("admin.pointsPrice") }}</th>
|
||||
<th>{{ $t("admin.pointsStock") }}</th>
|
||||
<th>{{ $t("admin.pointsPosition") }}</th>
|
||||
<th>{{ $t("admin.pointsRecommend") }}</th>
|
||||
<th>{{ $t("common.status") }}</th>
|
||||
<th>{{ $t("common.actions") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="product in products" :key="product.id">
|
||||
<td>{{ localizedName(product.name) }}</td>
|
||||
<td>{{ product.points_price }}</td>
|
||||
<td>{{ product.stock }}</td>
|
||||
<td>{{ product.position }}</td>
|
||||
<td>{{ product.recommend ? $t("common.yes") : $t("common.no") }}</td>
|
||||
<td>
|
||||
<VBadge :tone="product.published ? 'green' : 'orange'">
|
||||
{{ product.published ? $t("admin.publishedOn") : $t("admin.publishedOff") }}
|
||||
</VBadge>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex gap-2">
|
||||
<VBtn size="sm" @click="edit(product)">{{ $t("common.edit") }}</VBtn>
|
||||
<VBtn
|
||||
size="sm"
|
||||
variant="primary"
|
||||
:disabled="actionId === product.id"
|
||||
@click="togglePublished(product)"
|
||||
>
|
||||
{{ product.published ? $t("product.unpublish") : $t("product.publish") }}
|
||||
</VBtn>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</VTable>
|
||||
</div>
|
||||
</div>
|
||||
</VPage>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user