-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve(ui): add product detail page
- Loading branch information
1 parent
07b69b0
commit 2c80ad7
Showing
6 changed files
with
147 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div>Edit</div> | ||
</template> | ||
|
||
<script setup lang="ts"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,79 @@ | ||
<template> | ||
<div> Product ID </div> | ||
<div> | ||
<n-descriptions label-placement="top"> | ||
<template #header> | ||
<div class="flex justify-between"> | ||
<span>{{ $t('detail') }}</span> | ||
<nav> | ||
<nuxt-link :to="`/products/${id}/edit`"> | ||
<n-button circle quaternary type="primary"> | ||
<template #icon> | ||
<Icon name="system-uicons:pen" /> | ||
</template> | ||
</n-button> | ||
</nuxt-link> | ||
<n-button circle quaternary type="error"> | ||
<template #icon> | ||
<Icon name="system-uicons:trash" /> | ||
</template> | ||
</n-button> | ||
</nav> | ||
</div> | ||
</template> | ||
<n-descriptions-item> | ||
<n-avatar size="large" :src="frm.thumbnail" /> | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('name')" :span="2"> | ||
{{ frm.name }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('category')"> | ||
{{ frm.category?.name }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('type')"> | ||
{{ frm.type?.name }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('unit')"> | ||
{{ frm.unit?.name }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('products.price')"> | ||
{{ $n(frm.unitPrice || 0) }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('products.cost')"> | ||
{{ $n(frm.cost || 0) }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('products.stock')"> | ||
{{ $n(frm.stockQuantity || 0) }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('products.stock_trackable')"> | ||
{{ frm.stockTrackable ? $t('yes') : $t('no') }} | ||
</n-descriptions-item> | ||
|
||
<n-descriptions-item :label="$t('description')" :span="3"> | ||
{{ frm.description || '-' }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('products.sku')"> | ||
{{ frm.sku || '-' }} | ||
</n-descriptions-item> | ||
<n-descriptions-item :label="$t('products.barcode')"> | ||
{{ frm.sku || '-' }} | ||
</n-descriptions-item> | ||
</n-descriptions> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"></script> | ||
<script setup lang="ts"> | ||
const { frm, fetchProduct } = useProduct(); | ||
const { id } = useRoute().params; | ||
const { errors, product } = await fetchProduct(`${id}`); | ||
if (!errors) { | ||
frm.value = { | ||
...product, | ||
}; | ||
useHead({ | ||
title: `${product.name}`, | ||
}); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters