Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI_Detail_product_Order_list_Order_detail_view #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions front-end/src/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
--section-gap: 160px;
}

:root {
display: flex;
justify-content: center;
}

@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
Expand Down
15 changes: 10 additions & 5 deletions front-end/src/components/cart/CartItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,24 @@ export default defineComponent({
type: Number,
required: true,
},
isOrderDetailView: {
type: Boolean,
default: false,
},
},
setup(props) {
const { t } = useI18n()

const removeItem = () => {
const removeCartItem = () => {
console.log(`remove ${props.item.id}`)
}
return {
t,
removeItem
removeCartItem
}
}
})

</script>

<template>
Expand All @@ -34,7 +39,7 @@ export default defineComponent({
<td class="py-2 px-4">
<h2 class="text-lg font-semibold">{{ item.name }}</h2>
</td>
<td class="py-2 px-4 text-center">
<td class="py-2 px-4 flex justify-center items-center">
<img :src="item.image" alt="Product Image" class="w-16 h-16 object-cover" />
</td>
<td class="py-2 px-4 text-center">
Expand All @@ -46,8 +51,8 @@ export default defineComponent({
<td class="py-2 px-4 text-center">
<span class="text-lg font-bold">{{ item.price }} Đ</span>
</td>
<td class="py-2 px-4 text-center">
<button @click="removeItem" class="bg-red-400 hover:bg-red-500 text-white px-4 py-2 rounded">
<td v-if="!isOrderDetailView" class="py-2 px-4 text-center">
<button @click="removeCartItem" class="bg-red-400 hover:bg-red-500 text-white px-4 py-2 rounded">
{{ t('cart.remove') }}
</button>
</td>
Expand Down
4 changes: 2 additions & 2 deletions front-end/src/components/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</script>

<template>
<div>
<div class="flex flex-col min-h-screen">
<HeaderSection />
<div class="flex justify-center min-w-[1028px]">
<div class="flex flex-grow justify-center min-w-[1028px] min-h-screen">
<div class="flex justify-center gap-10 mt-6 px-2 py-6 w-[80%]">
<Sidebar />
<main>
Expand Down
4 changes: 2 additions & 2 deletions front-end/src/components/layouts/PaymentLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</script>

<template>
<div>
<div class="flex flex-col min-h-screen">
<HeaderSection />
<div class="flex justify-center">
<div class="flex flex-grow justify-center">
<main>
<RouterView />
</main>
Expand Down
57 changes: 57 additions & 0 deletions front-end/src/components/order/OrderItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<script>
import { defineComponent } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';

export default defineComponent({
name: 'OrderItem',
props: {
order: {
type: Object,
Required: true,
},
index: {
type: Number,
Required: true,
}
},
setup() {
const { t } = useI18n();
const router = useRouter();

const showDetailOrderItem = (order) => {
router.push({ name: 'OrderDetail', params: { orderId: order.id } });
};

return {
t,
showDetailOrderItem,
};
}
});
</script>

<template>
<td class="px-4 py-2">{{ index + 1 }}</td>
<td class="px-4 py-2">{{ order.order_code }}</td>
<td class="px-4 py-2">{{ order.date }}</td>
<td class="px-4 py-2">{{ order.customer }}</td>
<td class="px-4 py-2">{{ order.total_amount }}</td>
<td class="px-4 py-2 font-bold">
<span
:class="order.status === 'done' ? 'text-[#8ca25a]' : 'text-[#f47171]'"
class="font-bold"
>
{{ order.status === 'done' ?
`${t('order_list.done')}` : `${t('order_list.in_progress')}` }}
</span>
</td>
<td class="px-4 py-2">
<button
@click="showDetailOrderItem(order)"
class="text-white px-4 py-2 rounded bg-[#778e40] hover:bg-[#4c5b29]"
>
{{ t('order_list.show_detail') }}
</button>
</td>
</template>
5 changes: 3 additions & 2 deletions front-end/src/components/product/ProductItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ export default defineComponent({
<span class="imgPrd">
<img :src=product.image
:alt=product.name
class="max-w-[250px]"
style="background:
url(&quot;https://cong-news.appwifi.com/wp-content/uploads/2023/02/cốt-dừa-đậu-xanh_1.jpg&quot;)
center center / cover no-repeat;">
</span>
<h2 class="itemTitle">{{ product.name }}</h2>
<span class="price">
<h2 class="itemTitle font-bold text-[#4c5b29]">{{ product.name }}</h2>
<span class="price font-medium text-[#4c5b29]">
{{product.price}} Đ
</span>
</a>
Expand Down
Loading