wip(freight): migration 0017 + model/column-list groundwork for add-freight-templates

This commit is contained in:
Chengdong Zhang
2026-09-23 17:39:45 +08:00
parent a83e857bdf
commit 5b426486ac
105 changed files with 6193 additions and 1566 deletions
+33 -11
View File
@@ -102,7 +102,15 @@ async function remove(row: AddressBookEntry): Promise<void> {
}
async function save(): Promise<void> {
if (!form.recipient || !form.phone || !form.country || !form.region || !form.city || !form.line1 || !form.postal_code) {
if (
!form.recipient ||
!form.phone ||
!form.country ||
!form.region ||
!form.city ||
!form.line1 ||
!form.postal_code
) {
errorKey.value = "user.validationRequired";
return;
}
@@ -137,8 +145,10 @@ async function save(): Promise<void> {
<template>
<VCard class="min-h-[560px]">
<div class="mb-4 flex items-center justify-between gap-3">
<h1 class="m-0 text-xl font-bold text-text">{{ t("user.addresses") }}</h1>
<VBtn variant="primary" size="sm" type="button" @click="openAdd">{{ t("user.addAddress") }}</VBtn>
<h1 class="text-text m-0 text-xl font-bold">{{ t("user.addresses") }}</h1>
<VBtn variant="primary" size="sm" type="button" @click="openAdd">{{
t("user.addAddress")
}}</VBtn>
</div>
<UiEmptyState v-if="!loading && rows.length === 0" :text="t('user.noAddresses')" />
<VTable v-else>
@@ -165,12 +175,18 @@ async function save(): Promise<void> {
<td>{{ row.line1 }}</td>
<td>{{ row.postal_code }}</td>
<td>
<span v-if="row.is_default" class="text-xs text-primary">{{ t("user.defaultAddress") }}</span>
<VBtn v-else size="sm" type="button" @click="setDefault(row.id)">{{ t("user.setDefault") }}</VBtn>
<span v-if="row.is_default" class="text-primary text-xs">{{
t("user.defaultAddress")
}}</span>
<VBtn v-else size="sm" type="button" @click="setDefault(row.id)">{{
t("user.setDefault")
}}</VBtn>
</td>
<td class="space-x-2 whitespace-nowrap">
<VBtn size="sm" type="button" @click="openEdit(row)">{{ t("common.edit") }}</VBtn>
<VBtn size="sm" variant="danger" type="button" @click="remove(row)">{{ t("common.delete") }}</VBtn>
<VBtn size="sm" variant="danger" type="button" @click="remove(row)">{{
t("common.delete")
}}</VBtn>
</td>
</tr>
</tbody>
@@ -183,16 +199,22 @@ async function save(): Promise<void> {
<VField :label="t('user.country')"><VInput v-model="form.country" /></VField>
<VField :label="t('user.region')"><VInput v-model="form.region" /></VField>
<VField :label="t('user.city')"><VInput v-model="form.city" /></VField>
<VField class="sm:col-span-2" :label="t('user.line1')"><VInput v-model="form.line1" /></VField>
<VField class="sm:col-span-2" :label="t('user.line1')"
><VInput v-model="form.line1"
/></VField>
<VField :label="t('user.postalCode')"><VInput v-model="form.postal_code" /></VField>
<label class="flex items-center gap-2 self-end pb-3 text-sm text-text"><input v-model="form.is_default" class="h-4 w-4 accent-primary" type="checkbox" /> <span>{{ t("user.defaultAddress") }}</span></label>
<label class="text-text flex items-center gap-2 self-end pb-3 text-sm"
><input v-model="form.is_default" class="accent-primary h-4 w-4" type="checkbox" />
<span>{{ t("user.defaultAddress") }}</span></label
>
</div>
<p v-if="errorKey" class="mt-2 text-sm text-danger">{{ t(errorKey) }}</p>
<p v-if="errorKey" class="text-danger mt-2 text-sm">{{ t(errorKey) }}</p>
<template #footer>
<VBtn type="button" @click="open = false">{{ t("common.cancel") }}</VBtn>
<VBtn variant="primary" type="button" :disabled="saving" @click="save">{{ t("user.saveAddress") }}</VBtn>
<VBtn variant="primary" type="button" :disabled="saving" @click="save">{{
t("user.saveAddress")
}}</VBtn>
</template>
</UiModal>
</VCard>
</template>