@bjsdistribution/dms-client-return 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/order-daily-overview/common/interface.d.ts +22 -0
- package/dist/components/order-daily-overview/header-filters/Styledfilters.d.ts +1 -2
- package/dist/components/order-daily-overview/header-filters/filterStore.d.ts +16 -0
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.d.ts +1 -0
- package/dist/components/order-daily-overview/shared/utlis.d.ts +2 -2
- package/dist/components/order-daily-overview/store/store.d.ts +4 -0
- package/dist/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDown.d.ts +3 -1
- package/dist/components/order-view/store.d.ts +5 -1
- package/dist/components/store.d.ts +5 -2
- package/dist/components/types.d.ts +1 -1
- package/dist/dms-client-return.cjs.development.js +1065 -964
- package/dist/dms-client-return.cjs.development.js.map +1 -1
- package/dist/dms-client-return.cjs.production.min.js +1 -1
- package/dist/dms-client-return.cjs.production.min.js.map +1 -1
- package/dist/dms-client-return.esm.js +1067 -966
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/order-daily-overview/common/fakedata.tsx +5 -6
- package/src/components/order-daily-overview/common/interface.ts +120 -97
- package/src/components/order-daily-overview/filters/Filters.tsx +1 -8
- package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +56 -67
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +160 -223
- package/src/components/order-daily-overview/header-filters/Styledfilters.tsx +19 -7
- package/src/components/order-daily-overview/header-filters/filterStore.ts +145 -0
- package/src/components/order-daily-overview/index.tsx +59 -6
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +24 -1
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +177 -234
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +63 -6
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +5 -47
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +51 -185
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +62 -0
- package/src/components/order-daily-overview/store/store.ts +23 -12
- package/src/components/order-daily-overview/table/ReturnTable.tsx +193 -205
- package/src/components/order-view/details-filters/DetailsFilters.tsx +3 -2
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDown.tsx +57 -46
- package/src/components/order-view/general-information/Status.tsx +1 -1
- package/src/components/order-view/index.tsx +6 -4
- package/src/components/order-view/modalsPopup/UnReceiveProduct.tsx +1 -1
- package/src/components/order-view/order-actions/actions/escalation/EscalationModal.tsx +1 -1
- package/src/components/order-view/order-details/expanded-content/customer-section/RecipientName.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactEmail.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +1 -1
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Address.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Postcode.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/customer-section/location-info/What3words.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +3 -2
- package/src/components/order-view/order-details/expanded-content/index.tsx +1 -1
- package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +2 -1
- package/src/components/order-view/order-details/expanded-content/orders-section/Carrier.tsx +7 -1
- package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/orders-section/Depot.tsx +14 -1
- package/src/components/order-view/order-details/expanded-content/orders-section/Droptime.tsx +2 -1
- package/src/components/order-view/order-details/expanded-content/orders-section/OrderNumber.tsx +2 -1
- package/src/components/order-view/order-details/expanded-content/orders-section/RecipientReference.tsx +2 -1
- package/src/components/order-view/order-details/expanded-content/orders-section/ScheduleAfter.tsx +1 -0
- package/src/components/order-view/order-details/expanded-content/orders-section/VehicleType.tsx +13 -1
- package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +13 -1
- package/src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx +13 -1
- package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +14 -1
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +2 -2
- package/src/components/order-view/store.ts +40 -12
- package/src/components/store.ts +26 -4
- package/src/components/types.ts +2 -6
- package/dist/components/order-daily-overview/table/InfiniteScrolling.d.ts +0 -5
- package/dist/components/order-daily-overview/table/Return.d.ts +0 -3
- package/dist/components/order-daily-overview/table/table-data/MyTable.d.ts +0 -18
- package/dist/components/order-daily-overview/table/table-data/Table.d.ts +0 -18
- package/src/components/order-daily-overview/table/InfiniteScrolling.tsx +0 -54
- package/src/components/order-daily-overview/table/Return.tsx +0 -156
- package/src/components/order-daily-overview/table/table-data/MyTable.tsx +0 -433
- package/src/components/order-daily-overview/table/table-data/Table.tsx +0 -445
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
// import { ApiResponse, Column } from './types';
|
|
3
|
-
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
4
|
-
// import MultiRFI from './ReadyforInvoicemulti';
|
|
5
|
-
import { useAtom } from 'jotai';
|
|
6
|
-
// import useInfiniteScroll from './InfiniteScrolling';
|
|
7
|
-
// import { overviewFiltersReducerAtom } from '../header-for-invoice/invoice-selection/FilterStore';
|
|
8
|
-
// import {
|
|
9
|
-
// usePrevSelectedClients,
|
|
10
|
-
// useSelectedClients,
|
|
11
|
-
// } from '../header-for-invoice/store';
|
|
12
|
-
import Table from './table-data/Table';
|
|
13
|
-
import { useMaiNTableView } from '../../store';
|
|
14
|
-
import { overviewFiltersReducerAtom } from '../return-order-table/FilterStore';
|
|
15
|
-
import { ApiResponse, Column } from '../../types';
|
|
16
|
-
import useInfiniteScroll from './InfiniteScrolling';
|
|
17
|
-
|
|
18
|
-
const RFI: React.FC = () => {
|
|
19
|
-
// const [, setClient] = useSelectedClients();
|
|
20
|
-
const [tabledata, setMainTableData] = useMaiNTableView();
|
|
21
|
-
const [filterState, dispatchOverviewFilter] = useAtom(
|
|
22
|
-
overviewFiltersReducerAtom
|
|
23
|
-
);
|
|
24
|
-
console.log('tabledata', tabledata);
|
|
25
|
-
const columns: Column[] = [
|
|
26
|
-
{
|
|
27
|
-
Header: 'Trading Name',
|
|
28
|
-
accessor: 'name',
|
|
29
|
-
sortable: true,
|
|
30
|
-
showIcon: true,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
Header: 'Client',
|
|
34
|
-
accessor: 'customer_name',
|
|
35
|
-
sortable: true,
|
|
36
|
-
showIcon: false,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
Header: 'Orders',
|
|
40
|
-
accessor: 'total_amount',
|
|
41
|
-
sortable: true,
|
|
42
|
-
showIcon: true,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
Header: 'Products',
|
|
46
|
-
accessor: 'total_orders',
|
|
47
|
-
sortable: true,
|
|
48
|
-
showIcon: false,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
Header: 'RTS',
|
|
52
|
-
accessor: 'total_amount',
|
|
53
|
-
sortable: true,
|
|
54
|
-
showIcon: true,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
Header: 'Pending',
|
|
58
|
-
accessor: 'total_items',
|
|
59
|
-
sortable: true,
|
|
60
|
-
showIcon: true,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
Header: 'Dispose',
|
|
64
|
-
accessor: 'customer_id',
|
|
65
|
-
sortable: true,
|
|
66
|
-
showIcon: false,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
Header: 'Re-allocate',
|
|
70
|
-
accessor: 'debrief_status',
|
|
71
|
-
sortable: true,
|
|
72
|
-
showIcon: true,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
Header: 'Re-Del',
|
|
76
|
-
accessor: 'vat_rate_amount',
|
|
77
|
-
sortable: true,
|
|
78
|
-
showIcon: true,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
Header: 'Recycle',
|
|
82
|
-
accessor: 'fuel_surcharge_amount',
|
|
83
|
-
sortable: true,
|
|
84
|
-
showIcon: false,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
Header: 'unknown',
|
|
88
|
-
accessor: 'discount_amount',
|
|
89
|
-
sortable: true,
|
|
90
|
-
showIcon: true,
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
// const [invoiceData, setInvoiceData] = useInvoiceData();
|
|
94
|
-
// const [
|
|
95
|
-
// readyForInvoiceOverview,
|
|
96
|
-
// setReadyForInvoiceOverview,
|
|
97
|
-
// ] = useReadyForInvoiceOverview();
|
|
98
|
-
// const [filterApplied] = usefilterApplied();
|
|
99
|
-
|
|
100
|
-
const { 'x-filters': filters, 'x-pagination': pagination } = filterState;
|
|
101
|
-
const {
|
|
102
|
-
data: fetchedOverviewData,
|
|
103
|
-
setShouldPerformAction, // need for infinite
|
|
104
|
-
paginationData, // need for infinite
|
|
105
|
-
// loadingskeleton, // need for infinite
|
|
106
|
-
} = useApiHook<ApiResponse>({
|
|
107
|
-
endpoint: `/invoices/ready_for_invoice/overview/`,
|
|
108
|
-
method: 'GET',
|
|
109
|
-
filters: filters,
|
|
110
|
-
pagination: pagination,
|
|
111
|
-
performAction: true,
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
console.log('fetchedOverviewData', fetchedOverviewData);
|
|
115
|
-
// infinite scrolling code start here
|
|
116
|
-
const { page, scrollActivated } = useInfiniteScroll(
|
|
117
|
-
paginationData,
|
|
118
|
-
setShouldPerformAction,
|
|
119
|
-
'tableScrolling'
|
|
120
|
-
);
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
dispatchOverviewFilter({ type: 'SET_PAGE', payload: page });
|
|
123
|
-
}, [page]);
|
|
124
|
-
|
|
125
|
-
useEffect(() => {
|
|
126
|
-
if (fetchedOverviewData && fetchedOverviewData?.data) {
|
|
127
|
-
const invoiceData = fetchedOverviewData?.data;
|
|
128
|
-
|
|
129
|
-
if (scrollActivated) {
|
|
130
|
-
setMainTableData((prev: any) => {
|
|
131
|
-
const newData = invoiceData?.filter(
|
|
132
|
-
(newItem: any) =>
|
|
133
|
-
!prev?.some((prevItem: any) => prevItem?.id === newItem?.id)
|
|
134
|
-
);
|
|
135
|
-
return [...prev, ...newData];
|
|
136
|
-
});
|
|
137
|
-
} else {
|
|
138
|
-
setMainTableData(invoiceData);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}, [fetchedOverviewData, scrollActivated]);
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<div style={{ textTransform: 'capitalize', overflow: 'auto' }}>
|
|
145
|
-
{/* {renderContent} */}
|
|
146
|
-
<Table
|
|
147
|
-
columns={columns}
|
|
148
|
-
data={tabledata}
|
|
149
|
-
loading={false}
|
|
150
|
-
// loadingskeleton={loadingskeleton}
|
|
151
|
-
view="rfi"
|
|
152
|
-
/>
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
};
|
|
156
|
-
export default RFI;
|
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Back,
|
|
4
|
-
Buttons,
|
|
5
|
-
EmptyDataContainer,
|
|
6
|
-
Header,
|
|
7
|
-
Remove,
|
|
8
|
-
StyledTable,
|
|
9
|
-
StyledTableWrapper,
|
|
10
|
-
StyledTdBasic,
|
|
11
|
-
} from './styles';
|
|
12
|
-
import styled from 'styled-components';
|
|
13
|
-
// import CustomSelectDropdown from '../../components/inqueue/helper';
|
|
14
|
-
import { format } from 'date-fns';
|
|
15
|
-
// import { useStaticData } from '../../components/inqueue/store';
|
|
16
|
-
// import DropdownIcon from '../../assets/DropdownIcon';
|
|
17
|
-
// import { getIntegerValue } from '../../components/utils';
|
|
18
|
-
// import { Skeleton } from 'antd';
|
|
19
|
-
import { atom, useAtom } from 'jotai';
|
|
20
|
-
// import { countReducerAtom } from '../../components/invoice-actions/store';
|
|
21
|
-
import { Empty, Skeleton } from 'antd';
|
|
22
|
-
// import { EmptyDataContainer } from '../../components/emailInvoice/emailStyles';
|
|
23
|
-
// import { Column } from '../../components/readyforinvoice/types';
|
|
24
|
-
import { ConfigProvider } from 'antd';
|
|
25
|
-
import { Column } from '../../../types';
|
|
26
|
-
import ArrowIcon from '../../../../assets/icons/ArrowIcon';
|
|
27
|
-
import ArrivalIcon from '../../../../assets/icons/ArrivalIcon';
|
|
28
|
-
import VehicleIcon from '../../../../assets/icons/VehicleIcon';
|
|
29
|
-
import { getIntegerValue } from '../../../utils';
|
|
30
|
-
import CustomSelectDropdown from './helper';
|
|
31
|
-
import { useStaticData } from '../../../store';
|
|
32
|
-
// import GreenDotIcon from '../../assets/GreenDotIcon';
|
|
33
|
-
// import RedDotIcon from '../../assets/RedDotIcon';
|
|
34
|
-
// import OrangeDotIcon from '../../assets/OrangeDotIcon';
|
|
35
|
-
|
|
36
|
-
export const selectedValueAtom = atom(null);
|
|
37
|
-
export const selectedIDAtom = atom(null);
|
|
38
|
-
|
|
39
|
-
interface TableRow {
|
|
40
|
-
[key: string]: any;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface MyTableProps {
|
|
44
|
-
columns: Column[];
|
|
45
|
-
data: any;
|
|
46
|
-
loading: boolean;
|
|
47
|
-
loadingskeleton?: boolean;
|
|
48
|
-
view?: 'rfi';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Function to render nested content
|
|
52
|
-
const MyTable: React.FC<MyTableProps> = ({
|
|
53
|
-
columns,
|
|
54
|
-
data,
|
|
55
|
-
// loading,
|
|
56
|
-
loadingskeleton,
|
|
57
|
-
view,
|
|
58
|
-
}) => {
|
|
59
|
-
const [staticData] = useStaticData();
|
|
60
|
-
|
|
61
|
-
const statusOptions = staticData?.invoice_discount_status?.map(
|
|
62
|
-
(item: any) => ({
|
|
63
|
-
value: item?.id,
|
|
64
|
-
label: item?.status,
|
|
65
|
-
icon:
|
|
66
|
-
item?.status?.toLowerCase() === 'pending' ? (
|
|
67
|
-
<ArrivalIcon />
|
|
68
|
-
) : item?.status?.toLowerCase() === 'approved' ? (
|
|
69
|
-
<ArrivalIcon />
|
|
70
|
-
) : (
|
|
71
|
-
<VehicleIcon />
|
|
72
|
-
),
|
|
73
|
-
})
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const renderContent = (content: any): React.ReactNode => {
|
|
77
|
-
if (Array.isArray(content)) {
|
|
78
|
-
return (
|
|
79
|
-
<div>
|
|
80
|
-
{content.map((item, index) => (
|
|
81
|
-
<div key={index}>{renderContent(item)}</div>
|
|
82
|
-
))}
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
} else if (typeof content === 'object' && content !== null) {
|
|
86
|
-
return (
|
|
87
|
-
<div>
|
|
88
|
-
{Object.entries(content).map(([key, value]) => (
|
|
89
|
-
<div key={key}>{renderContent(value)}</div>
|
|
90
|
-
))}
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
return content;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// const [, dispatch] = useAtom(countReducerAtom);
|
|
98
|
-
const [, setSelectedValue] = useAtom(selectedValueAtom);
|
|
99
|
-
const [, setSelectedID] = useAtom(selectedIDAtom);
|
|
100
|
-
|
|
101
|
-
const handleSelect = (id: any) => {
|
|
102
|
-
setSelectedID(id);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const handleOption = (event: any) => {
|
|
106
|
-
const selectedValue = event;
|
|
107
|
-
setSelectedValue(selectedValue);
|
|
108
|
-
// 1: For pending 2: For Rejected 3: For Approved
|
|
109
|
-
if (selectedValue === 2 || selectedValue === 3) {
|
|
110
|
-
// dispatch({ type: 'discount-modal' });
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const renderCellContent = (column: Column, tableRow: TableRow) => {
|
|
115
|
-
const cellData = tableRow[column?.accessor];
|
|
116
|
-
const statusID = tableRow?.invoice_discount_queues?.status_id;
|
|
117
|
-
const selectedOption = statusOptions?.find(
|
|
118
|
-
(option: any) => option?.value === statusID
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
switch (column.accessor) {
|
|
122
|
-
case 'action':
|
|
123
|
-
return (
|
|
124
|
-
<Buttons>
|
|
125
|
-
<Back onClick={() => console.log('Action button clicked')}>
|
|
126
|
-
Back to debrief
|
|
127
|
-
</Back>
|
|
128
|
-
<Remove onClick={() => console.log('Another button clicked')}>
|
|
129
|
-
Remove from Invoice
|
|
130
|
-
</Remove>
|
|
131
|
-
</Buttons>
|
|
132
|
-
);
|
|
133
|
-
case 'invoice_date':
|
|
134
|
-
if (!cellData) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
const formattedInvoiceDate = format(new Date(cellData), 'dd/MM/yyyy');
|
|
138
|
-
return <span>{formattedInvoiceDate}</span>;
|
|
139
|
-
|
|
140
|
-
case 'date':
|
|
141
|
-
if (!cellData) {
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
const formattedDate = format(new Date(cellData), 'dd/MM/yyyy');
|
|
145
|
-
return <span>{formattedDate}</span>;
|
|
146
|
-
|
|
147
|
-
case 'total_orders':
|
|
148
|
-
return (
|
|
149
|
-
<span
|
|
150
|
-
style={{
|
|
151
|
-
backgroundColor: 'rgba(153, 153, 153, 0.10)',
|
|
152
|
-
padding: '3px 12px',
|
|
153
|
-
borderRadius: '4px',
|
|
154
|
-
color: '#6A7378',
|
|
155
|
-
}}
|
|
156
|
-
>
|
|
157
|
-
{view !== 'rfi' ? cellData : tableRow?.grand_total?.total_orders}
|
|
158
|
-
</span>
|
|
159
|
-
);
|
|
160
|
-
case 'total_amount':
|
|
161
|
-
const val = +tableRow?.grand_total?.total_amount;
|
|
162
|
-
return (
|
|
163
|
-
<span
|
|
164
|
-
style={{
|
|
165
|
-
backgroundColor: 'rgba(153, 153, 153, 0.10)',
|
|
166
|
-
padding: '3px 12px',
|
|
167
|
-
borderRadius: '4px',
|
|
168
|
-
color: '#6A7378',
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
|
|
172
|
-
{view !== 'rfi'
|
|
173
|
-
? cellData?.toLocaleString()
|
|
174
|
-
: val?.toLocaleString()}
|
|
175
|
-
</span>
|
|
176
|
-
);
|
|
177
|
-
case 'discount':
|
|
178
|
-
return (
|
|
179
|
-
<span
|
|
180
|
-
style={{
|
|
181
|
-
display: 'flex',
|
|
182
|
-
flexDirection: 'row',
|
|
183
|
-
gap: '5px',
|
|
184
|
-
alignItems: 'center',
|
|
185
|
-
}}
|
|
186
|
-
>
|
|
187
|
-
<Percentage>
|
|
188
|
-
{tableRow?.invoice_discount_queues?.new_discount}
|
|
189
|
-
{'%'}
|
|
190
|
-
</Percentage>
|
|
191
|
-
|
|
192
|
-
<span
|
|
193
|
-
style={{
|
|
194
|
-
alignItems: 'center',
|
|
195
|
-
fontSize: '14px',
|
|
196
|
-
color: '#3A3630',
|
|
197
|
-
}}
|
|
198
|
-
>
|
|
199
|
-
{getIntegerValue(cellData)}
|
|
200
|
-
</span>
|
|
201
|
-
</span>
|
|
202
|
-
);
|
|
203
|
-
case 'total':
|
|
204
|
-
const totalVal = +tableRow?.grand_total?.grand_total;
|
|
205
|
-
return (
|
|
206
|
-
<span>
|
|
207
|
-
{'£'}
|
|
208
|
-
{view !== 'rfi'
|
|
209
|
-
? cellData?.toLocaleString()
|
|
210
|
-
: totalVal?.toLocaleString()}
|
|
211
|
-
</span>
|
|
212
|
-
);
|
|
213
|
-
case 'amount':
|
|
214
|
-
return (
|
|
215
|
-
<span>
|
|
216
|
-
{'£'}
|
|
217
|
-
{cellData?.toLocaleString()}
|
|
218
|
-
</span>
|
|
219
|
-
);
|
|
220
|
-
case 'zone':
|
|
221
|
-
return (
|
|
222
|
-
<span
|
|
223
|
-
style={{
|
|
224
|
-
backgroundColor: 'rgba(153, 153, 153, 0.10)',
|
|
225
|
-
padding: '3px 12px',
|
|
226
|
-
borderRadius: '4px',
|
|
227
|
-
}}
|
|
228
|
-
>
|
|
229
|
-
{cellData}
|
|
230
|
-
</span>
|
|
231
|
-
);
|
|
232
|
-
case 'vat_rate':
|
|
233
|
-
return (
|
|
234
|
-
<span
|
|
235
|
-
style={{
|
|
236
|
-
backgroundColor: 'rgba(153, 153, 153, 0.10)',
|
|
237
|
-
padding: '3px 12px',
|
|
238
|
-
borderRadius: '4px',
|
|
239
|
-
}}
|
|
240
|
-
> {view !== 'rfi' ? cellData : tableRow?.grand_total?.vat_rate}
|
|
241
|
-
{'%'}
|
|
242
|
-
</span>
|
|
243
|
-
);
|
|
244
|
-
case 'products':
|
|
245
|
-
return (
|
|
246
|
-
<span
|
|
247
|
-
style={{
|
|
248
|
-
backgroundColor: 'rgba(153, 153, 153, 0.10)',
|
|
249
|
-
padding: '3px 12px',
|
|
250
|
-
borderRadius: '4px',
|
|
251
|
-
}}
|
|
252
|
-
>
|
|
253
|
-
{cellData}
|
|
254
|
-
</span>
|
|
255
|
-
);
|
|
256
|
-
case 'customer_name':
|
|
257
|
-
return (
|
|
258
|
-
<span
|
|
259
|
-
style={{
|
|
260
|
-
color: '#0099ff',
|
|
261
|
-
fontWeight: 600,
|
|
262
|
-
cursor: 'pointer',
|
|
263
|
-
}}
|
|
264
|
-
onClick={() =>
|
|
265
|
-
column.callback !== undefined &&
|
|
266
|
-
column?.callback({
|
|
267
|
-
label: tableRow?.customer_name,
|
|
268
|
-
value: tableRow?.customer_id,
|
|
269
|
-
})
|
|
270
|
-
}
|
|
271
|
-
>
|
|
272
|
-
{cellData}
|
|
273
|
-
</span>
|
|
274
|
-
);
|
|
275
|
-
case 'status_id':
|
|
276
|
-
return (
|
|
277
|
-
<>
|
|
278
|
-
<div onClick={() => handleSelect(tableRow?.id)}>
|
|
279
|
-
<DropdownContainer>
|
|
280
|
-
<ConfigProvider
|
|
281
|
-
theme={{
|
|
282
|
-
components: {
|
|
283
|
-
Select: {
|
|
284
|
-
/* here is your component tokens */
|
|
285
|
-
optionPadding: '10px 6px',
|
|
286
|
-
optionFontSize: 13,
|
|
287
|
-
optionHeight: 16,
|
|
288
|
-
optionSelectedFontWeight: 400,
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
}}
|
|
292
|
-
>
|
|
293
|
-
<CustomSelectDropdown
|
|
294
|
-
value={selectedOption}
|
|
295
|
-
options={statusOptions}
|
|
296
|
-
onChange={handleOption}
|
|
297
|
-
variant="borderless"
|
|
298
|
-
optionRender={(option: any) => (
|
|
299
|
-
<div
|
|
300
|
-
style={{
|
|
301
|
-
display: 'flex',
|
|
302
|
-
gap: '8px',
|
|
303
|
-
alignItems: 'center',
|
|
304
|
-
}}
|
|
305
|
-
>
|
|
306
|
-
<span
|
|
307
|
-
style={{ display: 'flex' }}
|
|
308
|
-
aria-label={option.data.label}
|
|
309
|
-
>
|
|
310
|
-
{option.data.icon}
|
|
311
|
-
</span>
|
|
312
|
-
<span style={{ color: '#8D8F90' }}>
|
|
313
|
-
{option.data.label}
|
|
314
|
-
</span>
|
|
315
|
-
</div>
|
|
316
|
-
)}
|
|
317
|
-
/>
|
|
318
|
-
<IconContainer>
|
|
319
|
-
<ArrowIcon />
|
|
320
|
-
</IconContainer>
|
|
321
|
-
</ConfigProvider>
|
|
322
|
-
</DropdownContainer>
|
|
323
|
-
</div>
|
|
324
|
-
</>
|
|
325
|
-
);
|
|
326
|
-
default:
|
|
327
|
-
return renderContent(cellData);
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
return (
|
|
332
|
-
<CoverDiv>
|
|
333
|
-
<StyledTableWrapper id="tableScrolling">
|
|
334
|
-
<StyledTable className="mainTable">
|
|
335
|
-
<thead>
|
|
336
|
-
<tr>
|
|
337
|
-
{columns?.map(column => (
|
|
338
|
-
<Header key={column.accessor}>{column.Header}</Header>
|
|
339
|
-
))}
|
|
340
|
-
</tr>
|
|
341
|
-
{/* <tr>
|
|
342
|
-
{columns?.map(column => (
|
|
343
|
-
<Header key={column.accessor}>
|
|
344
|
-
{column.Header}
|
|
345
|
-
{column.showIcon && column.sortable && (
|
|
346
|
-
<div style={{ marginTop: '5px' }}>
|
|
347
|
-
<InvoiceSortIcon />
|
|
348
|
-
</div>
|
|
349
|
-
)}
|
|
350
|
-
</Header>
|
|
351
|
-
))}
|
|
352
|
-
</tr> */}
|
|
353
|
-
</thead>
|
|
354
|
-
<tbody>
|
|
355
|
-
{loadingskeleton ? (
|
|
356
|
-
<tr>
|
|
357
|
-
<td colSpan={columns?.length || 7}>
|
|
358
|
-
<Skeleton active />
|
|
359
|
-
</td>
|
|
360
|
-
</tr>
|
|
361
|
-
) : data?.length ? (
|
|
362
|
-
data.map((tableRow: TableRow, index: any) => (
|
|
363
|
-
<tr key={index}>
|
|
364
|
-
{columns?.map(column => (
|
|
365
|
-
<StyledTdBasic key={column.accessor}>
|
|
366
|
-
{renderCellContent(column, tableRow)}
|
|
367
|
-
</StyledTdBasic>
|
|
368
|
-
))}
|
|
369
|
-
</tr>
|
|
370
|
-
))
|
|
371
|
-
) : (
|
|
372
|
-
<tr>
|
|
373
|
-
<td colSpan={columns?.length || 7}>
|
|
374
|
-
<EmptyDataContainer>
|
|
375
|
-
<Empty />
|
|
376
|
-
</EmptyDataContainer>
|
|
377
|
-
</td>
|
|
378
|
-
</tr>
|
|
379
|
-
)}
|
|
380
|
-
</tbody>
|
|
381
|
-
</StyledTable>
|
|
382
|
-
</StyledTableWrapper>
|
|
383
|
-
</CoverDiv>
|
|
384
|
-
);
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
export default MyTable;
|
|
388
|
-
|
|
389
|
-
const Percentage = styled.div`
|
|
390
|
-
border-radius: 4px;
|
|
391
|
-
background: rgba(42, 175, 77, 0.12);
|
|
392
|
-
display: flex;
|
|
393
|
-
padding: 4px 8px;
|
|
394
|
-
align-items: flex-start;
|
|
395
|
-
gap: 24px;
|
|
396
|
-
color: #2aaf4d;
|
|
397
|
-
`;
|
|
398
|
-
|
|
399
|
-
const IconContainer = styled.div`
|
|
400
|
-
position: absolute;
|
|
401
|
-
top: 7px;
|
|
402
|
-
left: 71px;
|
|
403
|
-
border-radius: 18px;
|
|
404
|
-
background: rgba(255, 255, 255, 0.5);
|
|
405
|
-
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
|
|
406
|
-
display: flex;
|
|
407
|
-
width: 18px;
|
|
408
|
-
height: 18px;
|
|
409
|
-
justify-content: center;
|
|
410
|
-
align-items: center;
|
|
411
|
-
cursor: pointer;
|
|
412
|
-
pointer-events: none;
|
|
413
|
-
`;
|
|
414
|
-
|
|
415
|
-
const DropdownContainer = styled.div`
|
|
416
|
-
position: relative;
|
|
417
|
-
.custom-dropdown {
|
|
418
|
-
.ant-select-item {
|
|
419
|
-
font-weight: 400;
|
|
420
|
-
font-size: 13px;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
`;
|
|
424
|
-
|
|
425
|
-
export const CoverDiv = styled.div`
|
|
426
|
-
position: relative;
|
|
427
|
-
min-height: calc(100vh - 396px);
|
|
428
|
-
.ant-skeleton {
|
|
429
|
-
position: absolute;
|
|
430
|
-
bottom: 0;
|
|
431
|
-
background: #fff;
|
|
432
|
-
}
|
|
433
|
-
`;
|