-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoiceInfo.jsx
More file actions
246 lines (236 loc) · 10.1 KB
/
InvoiceInfo.jsx
File metadata and controls
246 lines (236 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
import { Button } from "./Button";
import Link from 'next/link';
import Image from 'next/image';
import { gql, useMutation } from '@apollo/client';
const invoiceInfo = gql`
query SearchInvoiceByOrderId($orderId: String) {
searchInvoiceByOrderId(orderId: $orderId) {
invoiceId
}
}`
export const InvoiceInfo = () => {
const orderData = {
'order_id':'0d02a456-b5c7-4377-84c7-41848c84e5c3',
'order_date':'2023-05-25T04:25:23.000Z',
'sending_date':'2023-06-01T12:00:00.000Z',
'return_date':'2023-07-04T17:00:00.000Z',
'address_detail':'1044/70',
'street':'Phetkasem',
'sub_distruct':'Nongkangplu',
'distruct':'Naongkham',
'province':'KrungThep',
'zipcode':'10160',
'receiver_tel':'0951165489',
}
const cartList = {
1: {
product_name: "Foot Ball",
quantity: 1,
price_per_day: 100,
pic_URL: "/ikea_black_chair.png",
},
2: {
product_name: "ADiDos chair",
quantity: 1,
price_per_day: 100,
pic_URL: "/ikea_black_chair.png",
},
3: {
product_name: "ADiDos chair",
quantity: 2,
price_per_day: 100,
pic_URL: "/ikea_black_chair.png",
},
4: {
product_name: "Gold balloon",
quantity: 1,
price_per_day: 100,
pic_URL: "/ikea_black_chair.png",
},
}
const deliveryFee = 240;
let priceProduct = 0;
Object.keys(cartList).map(key=>{
priceProduct += cartList[key]['quantity']*cartList[key]['price_per_day']
})
const allPrice = priceProduct + deliveryFee;
const payment = {
deposit:500,
payment_round:{
1:{
total:430,
},
2:{
total:310,
},
},
}
const invoiceInfo = {
}
return (
<>
<div className="mx-auto px-4 mx-16">
<div className=" relative mb-4 w-full rounded-md border-2 border-black px-12 py-6 mx-4">
<div className="text-3xl md:text-4xl font-bold mb-4">Order {orderData.order_id}</div>
<div className='mb-4 grid grid-cols-7'>
<div className='col-span-2'>
<p>วันทำรายการสินค้า</p>
<p className='ml-4 font-bold'>{orderData.order_date}</p>
</div>
<div className='col-span-2'>
<p>วันรับสินค้า</p>
<p className='ml-4 font-bold'>{orderData.sending_date}</p>
</div>
<div className='col-span-2'>
<p>วันคืนสินค้า</p>
<p className='ml-4 font-bold'>{orderData.return_date}</p>
</div>
</div>
<div>
<div> ที่อยู่ </div>
<div className='font-bold ml-4'>{orderData.receiver_tel}</div>
<div className=' ml-4'>{orderData.address_detail} {orderData.street} {orderData.sub_distruct} {orderData.distruct} {orderData.distruct} {orderData.province} {orderData.zipcode}</div>
</div>
<div className="p-4">
<div class="relative overflow-x-auto rounded-lg">
<table class="w-full text-sm text-center text-black">
<thead class="text-xs text-gray-700 bg-[#E1E1E1] uppercase">
<tr>
<th scope="col" class="px-6 py-3">
Item
</th>
<th scope="col" class="px-6 py-3">
Qty
</th>
<th scope="col" class="px-6 py-3">
Price/Day
</th>
<th scope="col" class="px-6 py-3">
Total
</th>
</tr>
</thead>
<tbody>
{Object.keys(cartList).map((key) => (
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
<th scope="row" class="px-6 py-4 font-medium font-bold whitespace-nowrap dark:text-white">
{cartList[key]['product_name']}
</th>
<td class="px-6 py-4">
{cartList[key]['quantity']}
</td>
<td class="px-6 py-4">
{cartList[key]['price_per_day']}
</td>
<td class="px-6 py-4">
{cartList[key]['quantity'] * cartList[key]['price_per_day']}
</td>
</tr>
))}
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
<th scope="row" class="px-6 py-4 font-medium font-bold whitespace-nowrap dark:text-white">
ค่าส่งสินค้า
</th>
<td class="px-6 py-4">
{''}
</td>
<td class="px-6 py-4 text-right">
{''}
</td>
<td class="px-6 py-4 border-b dark:bg-gray-800 dark:border-gray-700">
{deliveryFee}
</td>
</tr>
<tr class="bg-white">
<th scope="row" class="px-6 py-4 font-medium font-bold whitespace-nowrap dark:text-white">
{''}
</th>
<td class="px-6 py-4">
{''}
</td>
<td class="px-6 py-4 text-right">
Total Amount
</td>
<td class="px-6 py-4 bg-white border-b dark:bg-gray-800 dark:border-gray-700">
{allPrice}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div className="p-4">
<div class="relative overflow-x-auto rounded-lg">
<table class="w-full text-sm text-center text-black bg-white">
<thead class="text-xs text-gray-700 bg-[#E1E1E1] uppercase">
<tr>
<th scope="col" class="px-6 py-3">
การแบ่งจ่าย
</th>
<th scope="col" class="px-6 py-3">
Invoice ID
</th>
<th scope="col" class="px-6 py-3">
Total
</th>
</tr>
</thead>
<tbody>
<tr class=" bg-white border-b dark:bg-gray-800 dark:border-gray-700">
<th scope="row" class="px-6 py-4 font-medium font-bold whitespace-nowrap dark:text-white">
มัดจำ
</th>
<td></td>
<td class="px-6 py-4">
{payment['deposit']}
</td>
</tr>
{Object.keys(payment['payment_round']).map((key) => (
<tr class=" bg-white border-b dark:bg-gray-800 dark:border-gray-700">
<th scope="row" class="px-6 py-4 font-medium font-bold whitespace-nowrap dark:text-white">
แบ่งจ่ายงวดที่ {key}
</th>
<td class="px-6 py-4">
{invoiceInfo.invoiceId}
</td>
<td class="px-6 py-4">
{payment['payment_round'][key]['total']}
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
<div className="mb-4">
<div className='mb-2.5'>ช่องทางการจ่ายเงิน</div>
<div className='flex gap-4 items-center'>
<div className='w-[100px] h-[100px]'>
<Image src={'/QR.png'} width={100} height={100} alt="QR"></Image>
</div>
<div>
<div>เลขบัญชี: xxxxxxxxxxx</div>
<div>ชื่อบัญชี: ChowChowCompany999</div>
</div>
</div>
</div>
<div className="flex gap-x-20">
<Link className="w-full" href={'/products'}>
<Button text={'เรียบร้อย'} type={'white'}/>
</Link>
<Link className="w-full" href={'/billing'}>
<Button text={'ไปหน้าแจ้งชำระเงิน'} type={'submit'}/>
</Link>
</div>
<div className="absolute top-4 right-4 flex flex-col items-center">
<Image src={'/dog.svg'} width={50} height={50} alt="chow chow logo"></Image>
<div className="font'bold text-xs">
<div>CHOW CHOW</div>
<div>-Online Rental-</div>
</div>
</div>
</div>
</div>
</>
);
};