-
Notifications
You must be signed in to change notification settings - Fork 68
/
searchResults.js
77 lines (73 loc) · 1.99 KB
/
searchResults.js
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
import React from "react";
import {
sortByEpoch,
getEpochForDate,
getTextToLocalMapping
} from "../../utils";
import {download} from "egov-common/ui-utils/commons"
export const searchResults = {
uiFramework: "custom-molecules",
componentPath: "Table",
visible: false,
props: {
columns: [
{
name : getTextToLocalMapping("Receipt No."),
options: {
filter: false,
customBodyRender: (value, tableMeta, updateValue) => (
<div onClick={value => {
const receiptQueryString = [
{ key: "receiptNumbers", value: tableMeta.rowData[0]},
{ key: "tenantId", value: tableMeta.rowData[7] }
]
download(receiptQueryString , "download" ,tableMeta.rowData[6]) ;
}}>
{value}
</div>
)
}
},
getTextToLocalMapping("Payee Name"),
getTextToLocalMapping("Service Type"),
getTextToLocalMapping("Date"),
getTextToLocalMapping("Amount[INR]"),
getTextToLocalMapping("Status"),
{
name: "receiptKey",
options: {
display: false
}
},
{
name: "tenantId",
options: {
display: false
}
}
],
options: {
filter: false,
download: false,
responsive: "stacked",
selectableRows: false,
hover: true,
rowsPerPageOptions: [10, 15, 20],
},
customSortColumn: {
column: "Date",
sortingFn: (data, i, sortDateOrder) => {
const epochDates = data.reduce((acc, curr) => {
acc.push([...curr, getEpochForDate(curr[4], "dayend")]);
return acc;
}, []);
const order = sortDateOrder === "asc" ? true : false;
const finalData = sortByEpoch(epochDates, !order).map(item => {
item.pop();
return item;
});
return { data: finalData, currentOrder: !order ? "asc" : "desc" };
}
}
}
};