wip(freight): migration 0017 + model/column-list groundwork for add-freight-templates
This commit is contained in:
@@ -157,61 +157,104 @@ onMounted(() => {
|
||||
<VInput id="currency-symbol" v-model="form.symbol" required />
|
||||
</VField>
|
||||
<VField :label="$t('admin.exponent')">
|
||||
<VInput id="currency-exponent" v-model.number="form.exponent" min="0" max="6" type="number" required />
|
||||
<VInput
|
||||
id="currency-exponent"
|
||||
v-model.number="form.exponent"
|
||||
min="0"
|
||||
max="6"
|
||||
type="number"
|
||||
required
|
||||
/>
|
||||
</VField>
|
||||
<VField :label="$t('admin.rate')">
|
||||
<VInput id="currency-rate" v-model="form.rateToBase" min="0" step="any" type="number" required />
|
||||
<VInput
|
||||
id="currency-rate"
|
||||
v-model="form.rateToBase"
|
||||
min="0"
|
||||
step="any"
|
||||
type="number"
|
||||
required
|
||||
/>
|
||||
</VField>
|
||||
</div>
|
||||
<label class="my-0 mb-4 flex items-center gap-2 text-sm">
|
||||
<input v-model="form.enabled" class="h-4 w-4 accent-primary" type="checkbox" />
|
||||
<input v-model="form.enabled" class="accent-primary h-4 w-4" type="checkbox" />
|
||||
{{ $t("admin.enabled") }}
|
||||
</label>
|
||||
<p v-if="formError" class="my-2 text-sm text-danger" role="alert">{{ formError }}</p>
|
||||
<p v-if="formError" class="text-danger my-2 text-sm" role="alert">{{ formError }}</p>
|
||||
<VBtn variant="primary" :disabled="creating" @click="createCurrency">
|
||||
{{ creating ? $t("common.loading") : $t("admin.saveCurrency") }}
|
||||
</VBtn>
|
||||
</VCard>
|
||||
<p v-if="loading" class="text-sm text-muted">{{ $t("common.loading") }}</p>
|
||||
<p v-else-if="errorMessage" class="my-2 text-sm text-danger" role="alert">{{ errorMessage }}</p>
|
||||
<p v-if="loading" class="text-muted text-sm">{{ $t("common.loading") }}</p>
|
||||
<p v-else-if="errorMessage" class="text-danger my-2 text-sm" role="alert">{{ errorMessage }}</p>
|
||||
<VCard v-else-if="currencies.length === 0" class="text-muted">{{ $t("common.empty") }}</VCard>
|
||||
<div v-else class="overflow-x-auto">
|
||||
<div class="min-w-[1080px]"><VTable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ $t("common.currency") }}</th>
|
||||
<th>{{ $t("admin.currencyNameEn") }}</th>
|
||||
<th>{{ $t("admin.symbol") }}</th>
|
||||
<th>{{ $t("admin.exponent") }}</th>
|
||||
<th>{{ $t("admin.rate") }}</th>
|
||||
<th>{{ $t("admin.baseCurrency") }}</th>
|
||||
<th>{{ $t("admin.enabled") }}</th>
|
||||
<th>{{ $t("common.actions") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="currency in currencies" :key="currency.code">
|
||||
<td><strong>{{ currency.code }}</strong></td>
|
||||
<td>{{ localizedName(currency.name) }}</td>
|
||||
<td>{{ currency.symbol }}</td>
|
||||
<td>{{ currency.exponent }}</td>
|
||||
<td><VInput v-model="rateDrafts[currency.code]" class="min-w-[110px]" type="number" min="0" step="any" /></td>
|
||||
<td>
|
||||
<VBadge v-if="currency.is_base" tone="blue">{{ $t("admin.baseCurrency") }}</VBadge>
|
||||
<span v-else class="text-muted">—</span>
|
||||
</td>
|
||||
<td><VBadge :tone="currency.enabled ? 'green' : 'red'">{{ currency.enabled ? $t("common.yes") : $t("common.no") }}</VBadge></td>
|
||||
<td><div class="flex gap-2">
|
||||
<VBtn size="sm" variant="primary" :disabled="savingCode === currency.code" @click="saveRate(currency)">
|
||||
{{ savingCode === currency.code ? $t("common.loading") : $t("admin.updateRate") }}
|
||||
</VBtn>
|
||||
<VBtn size="sm" :disabled="savingCode === currency.code" @click="toggleEnabled(currency)">
|
||||
{{ currency.enabled ? $t("admin.suspend") : $t("admin.activate") }}
|
||||
</VBtn>
|
||||
</div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</VTable></div>
|
||||
<div class="min-w-[1080px]">
|
||||
<VTable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ $t("common.currency") }}</th>
|
||||
<th>{{ $t("admin.currencyNameEn") }}</th>
|
||||
<th>{{ $t("admin.symbol") }}</th>
|
||||
<th>{{ $t("admin.exponent") }}</th>
|
||||
<th>{{ $t("admin.rate") }}</th>
|
||||
<th>{{ $t("admin.baseCurrency") }}</th>
|
||||
<th>{{ $t("admin.enabled") }}</th>
|
||||
<th>{{ $t("common.actions") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="currency in currencies" :key="currency.code">
|
||||
<td>
|
||||
<strong>{{ currency.code }}</strong>
|
||||
</td>
|
||||
<td>{{ localizedName(currency.name) }}</td>
|
||||
<td>{{ currency.symbol }}</td>
|
||||
<td>{{ currency.exponent }}</td>
|
||||
<td>
|
||||
<VInput
|
||||
v-model="rateDrafts[currency.code]"
|
||||
class="min-w-[110px]"
|
||||
type="number"
|
||||
min="0"
|
||||
step="any"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<VBadge v-if="currency.is_base" tone="blue">{{ $t("admin.baseCurrency") }}</VBadge>
|
||||
<span v-else class="text-muted">—</span>
|
||||
</td>
|
||||
<td>
|
||||
<VBadge :tone="currency.enabled ? 'green' : 'red'">{{
|
||||
currency.enabled ? $t("common.yes") : $t("common.no")
|
||||
}}</VBadge>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex gap-2">
|
||||
<VBtn
|
||||
size="sm"
|
||||
variant="primary"
|
||||
:disabled="savingCode === currency.code"
|
||||
@click="saveRate(currency)"
|
||||
>
|
||||
{{
|
||||
savingCode === currency.code ? $t("common.loading") : $t("admin.updateRate")
|
||||
}}
|
||||
</VBtn>
|
||||
<VBtn
|
||||
size="sm"
|
||||
:disabled="savingCode === currency.code"
|
||||
@click="toggleEnabled(currency)"
|
||||
>
|
||||
{{ currency.enabled ? $t("admin.suspend") : $t("admin.activate") }}
|
||||
</VBtn>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</VTable>
|
||||
</div>
|
||||
</div>
|
||||
</VPage>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user