@@ -2,7 +2,7 @@ import EditIcon from '@mui/icons-material/Edit';
2
2
import { Button , Grid , TextField , Typography } from '@mui/material' ;
3
3
import CircularProgress from '@mui/material/CircularProgress' ;
4
4
import IconButton from '@mui/material/IconButton' ;
5
- import { DataGrid , GridPaginationModel } from '@mui/x-data-grid' ;
5
+ import { DataGrid , GridColDef , GridPaginationModel } from '@mui/x-data-grid' ;
6
6
import { MakeGenerics , useMatch } from '@tanstack/react-location' ;
7
7
import { getDictionary } from 'api/admin' ;
8
8
import {
@@ -12,10 +12,11 @@ import {
12
12
setTrackingNumberUpdate ,
13
13
} from 'api/orders' ;
14
14
import { common_Dictionary } from 'api/proto-http/admin' ;
15
- import { common_OrderFull } from 'api/proto-http/frontend' ;
15
+ import { common_OrderFull , common_OrderItem } from 'api/proto-http/frontend' ;
16
16
import { CopyToClipboard } from 'components/common/copyToClipboard' ;
17
17
import { Layout } from 'components/login/layout' ;
18
18
import { ROUTES } from 'constants/routes' ;
19
+ import logo from 'img/tex-text.png' ;
19
20
import { useEffect , useState } from 'react' ;
20
21
import styles from 'styles/order.scss' ;
21
22
import { formatDateTime , getOrderStatusName , getStatusColor } from './utility' ;
@@ -44,7 +45,6 @@ export const OrderDetails = () => {
44
45
const [ isPrinting , setIsPrinting ] = useState ( false ) ;
45
46
const [ columnVisibility , setColumnVisibility ] = useState ( {
46
47
thumbnail : true ,
47
- productLink : true ,
48
48
size : true ,
49
49
} ) ;
50
50
const [ isEdit , setIsEdit ] = useState ( false ) ;
@@ -59,7 +59,7 @@ export const OrderDetails = () => {
59
59
} ;
60
60
61
61
useEffect ( ( ) => {
62
- setColumnVisibility ( { thumbnail : ! isPrinting , productLink : ! isPrinting , size : ! isPrinting } ) ;
62
+ setColumnVisibility ( { thumbnail : ! isPrinting , size : ! isPrinting } ) ;
63
63
} , [ isPrinting ] ) ;
64
64
65
65
useEffect ( ( ) => {
@@ -99,10 +99,11 @@ export const OrderDetails = () => {
99
99
setOrderStatus ( getOrderStatusName ( dictionary , orderDetails ?. order ?. orderStatusId ) ) ;
100
100
} , [ orderDetails , dictionary ] ) ;
101
101
102
- const orderItemsColumns = [
102
+ const orderItemsColumns : GridColDef < common_OrderItem > [ ] = [
103
103
{
104
104
field : 'thumbnail' ,
105
105
headerName : '' ,
106
+ align : 'center' ,
106
107
width : 200 ,
107
108
renderCell : ( params : any ) => (
108
109
< a
@@ -119,6 +120,7 @@ export const OrderDetails = () => {
119
120
{
120
121
field : 'sku' ,
121
122
headerName : 'SKU' ,
123
+ align : 'center' ,
122
124
width : isPrinting ? 150 : 300 ,
123
125
renderCell : ( params : any ) => (
124
126
< div
@@ -140,12 +142,16 @@ export const OrderDetails = () => {
140
142
} ,
141
143
{
142
144
field : 'productName' ,
143
- headerName : isPrinting ? 'NAME' : 'PRODUCT NAME' ,
144
- width : isPrinting ? 100 : 200 ,
145
+ align : 'center' ,
146
+ headerAlign : 'center' ,
147
+ headerName : 'PRODUCT NAME' ,
148
+ width : 150 ,
145
149
} ,
146
150
{
147
151
field : 'quantity' ,
148
152
headerName : 'QUANTITY' ,
153
+ headerAlign : 'center' ,
154
+ align : 'center' ,
149
155
width : isPrinting ? 100 : 200 ,
150
156
valueGetter : ( _params : any , row : any ) => {
151
157
return row . orderItem . quantity ;
@@ -154,6 +160,8 @@ export const OrderDetails = () => {
154
160
{
155
161
field : 'size' ,
156
162
headerName : 'SIZE' ,
163
+ align : 'center' ,
164
+ headerAlign : 'center' ,
157
165
width : 200 ,
158
166
cellClassName : styles . hide_cell ,
159
167
valueGetter : ( _params : any , row : any ) => {
@@ -165,17 +173,23 @@ export const OrderDetails = () => {
165
173
{
166
174
field : 'productPrice' ,
167
175
headerName : 'PRICE' ,
168
- width : isPrinting ? 100 : 200 ,
176
+ align : 'center' ,
177
+ headerAlign : 'center' ,
178
+ width : isPrinting ? 90 : 200 ,
169
179
valueGetter : ( params : any , row : any ) =>
170
180
`${ params * row . orderItem . quantity } ${ dictionary ?. baseCurrency } ` ,
171
181
} ,
172
182
{
173
183
field : 'productSalePercentage' ,
174
184
headerName : 'SALE' ,
175
- width : isPrinting ? 100 : 200 ,
185
+ align : 'center' ,
186
+ headerAlign : 'center' ,
187
+ width : isPrinting ? 90 : 200 ,
176
188
} ,
177
189
{
178
190
field : 'productPriceWithSale' ,
191
+ align : 'center' ,
192
+ headerAlign : 'center' ,
179
193
headerName : isPrinting ? 'PWS' : 'PRICE WITH SALE' ,
180
194
width : isPrinting ? 100 : 200 ,
181
195
} ,
@@ -498,17 +512,23 @@ export const OrderDetails = () => {
498
512
return (
499
513
< Layout >
500
514
< Grid container spacing = { 2 } justifyContent = 'center' alignItems = 'center' >
515
+ { isPrinting && (
516
+ < Grid item xs = { 12 } >
517
+ < img src = { logo } alt = 'logo' style = { { width : '30px' , height : 'auto' } } />
518
+ </ Grid >
519
+ ) }
520
+
501
521
< Grid item xs = { 12 } >
502
- < Grid container justifyContent = 'flex-start' >
503
- < Grid item xs = { 12 } sm = { 2 } className = { styles . hide_cell } >
522
+ < Grid container justifyContent = 'flex-start' alignItems = 'center' >
523
+ < Grid item xs = { 12 } md = { 2 } className = { styles . hide_cell } >
504
524
< Typography fontWeight = 'bold' textTransform = 'uppercase' >
505
525
order id: { orderDetails ?. order ?. id }
506
526
</ Typography >
507
527
</ Grid >
508
528
< Grid
509
529
item
510
530
xs = { 12 }
511
- sm = { 2 }
531
+ md = { 2 }
512
532
className = { isPrinting ? styles . hide_cell : styles . non_print_state }
513
533
>
514
534
< Typography fontWeight = 'bold' textTransform = 'uppercase' >
@@ -526,21 +546,18 @@ export const OrderDetails = () => {
526
546
< Grid
527
547
item
528
548
xs = { 12 }
529
- sm = { 2 }
549
+ md = { 2 }
530
550
className = { isPrinting ? styles . hide_cell : styles . non_print_state }
531
551
>
532
552
STATUS: { orderStatusColored }
533
553
</ Grid >
534
- < Grid item xs = { 12 } sm = { 5 } className = { styles . support } >
554
+ < Grid item xs = { 12 } className = { styles . support } >
535
555
COMPANY ADRESS: ADRESS ADRESS ADRESS
536
556
</ Grid >
537
- < Grid item xs = { 12 } sm = { 3 } className = { styles . support } >
538
- COMPANY VAT ID: ID
539
- </ Grid >
540
- < Grid item xs = { 12 } sm = { isPrinting ? 4 : 3 } >
557
+ < Grid item xs = { 12 } md = { 3 } >
541
558
PLACED: { formatDateTime ( orderDetails ?. order ?. placed ) }
542
559
</ Grid >
543
- < Grid item className = { styles . hide_cell } xs = { 12 } sm = { 3 } >
560
+ < Grid item className = { styles . hide_cell } xs = { 12 } md = { 3 } >
544
561
MODIFIED: { formatDateTime ( orderDetails ?. order ?. modified ) }
545
562
</ Grid >
546
563
</ Grid >
0 commit comments