ui-soxo-bootstrap-core 2.6.1-dev.1 → 2.6.1-dev.11
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/core/components/extra-info/extra-info-details.js +2 -2
- package/core/lib/Store.js +3 -3
- package/core/lib/components/global-header/global-header.js +2 -2
- package/core/lib/components/sidemenu/sidemenu.js +19 -13
- package/core/lib/elements/basic/country-phone-input/country-phone-input.js +14 -8
- package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +1 -1
- package/core/lib/elements/basic/menu-tree/menu-tree.js +26 -13
- package/core/lib/models/forms/components/form-creator/form-creator.scss +5 -4
- package/core/lib/models/menus/components/menu-list/menu-list.js +424 -467
- package/core/lib/pages/change-password/change-password.js +17 -24
- package/core/lib/pages/change-password/change-password.scss +45 -48
- package/core/lib/pages/login/commnication-mode-selection.js +46 -0
- package/core/lib/pages/login/communication-mode-selection.scss +60 -0
- package/core/lib/pages/login/login.js +126 -22
- package/core/lib/pages/login/login.scss +229 -334
- package/core/lib/pages/login/reset-password.js +124 -0
- package/core/lib/pages/login/reset-password.scss +31 -0
- package/core/lib/pages/profile/themes.json +4 -4
- package/core/lib/utils/api/api.utils.js +30 -18
- package/core/lib/utils/common/common.utils.js +85 -0
- package/core/lib/utils/http/http.utils.js +1 -0
- package/core/lib/utils/index.js +4 -1
- package/core/models/base/base.js +7 -3
- package/core/models/core-scripts/core-scripts.js +9 -0
- package/core/models/doctor/components/doctor-add/doctor-add.js +9 -4
- package/core/models/menus/components/menu-add/menu-add.js +1 -1
- package/core/models/menus/components/menu-lists/menu-lists.js +5 -9
- package/core/models/menus/menus.js +21 -2
- package/core/models/roles/components/role-add/role-add.js +92 -59
- package/core/models/roles/components/role-list/role-list.js +1 -1
- package/core/models/staff/components/staff-add/staff-add.js +20 -32
- package/core/models/users/components/assign-role/assign-role.js +145 -50
- package/core/models/users/components/assign-role/assign-role.scss +209 -45
- package/core/models/users/components/assign-role/avatar-props.js +45 -0
- package/core/models/users/components/user-add/user-add.js +46 -55
- package/core/models/users/components/user-add/user-edit.js +25 -4
- package/core/models/users/users.js +16 -1
- package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +1 -1
- package/core/modules/reporting/components/reporting-dashboard/README.md +316 -0
- package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.js +266 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +75 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +252 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +126 -0
- package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +285 -399
- package/core/modules/steps/action-buttons.js +42 -44
- package/core/modules/steps/action-buttons.scss +35 -6
- package/core/modules/steps/steps.js +12 -10
- package/core/modules/steps/steps.scss +229 -31
- package/core/modules/steps/timeline.js +21 -19
- package/package.json +2 -1
|
@@ -16,7 +16,7 @@ import { ReloadOutlined, OrderedListOutlined, PicCenterOutlined, DeleteOutlined
|
|
|
16
16
|
|
|
17
17
|
// import TableSettings from './../../' './table-settings/table-settings';
|
|
18
18
|
|
|
19
|
-
import { Location } from './../../../../utils/location/location.utils'
|
|
19
|
+
import { Location } from './../../../../utils/location/location.utils';
|
|
20
20
|
|
|
21
21
|
import { ModelColumns, UserPreferences } from './../../../../models/';
|
|
22
22
|
|
|
@@ -30,469 +30,419 @@ const { Title } = Typography;
|
|
|
30
30
|
* @param {*} param0
|
|
31
31
|
*/
|
|
32
32
|
function MenuList({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
menu,
|
|
34
|
+
match,
|
|
35
|
+
model = {
|
|
36
|
+
columns: [],
|
|
37
|
+
actions: [],
|
|
38
|
+
queries: [],
|
|
39
|
+
filterDate: () => {},
|
|
40
|
+
},
|
|
41
|
+
actions = [],
|
|
42
|
+
queries = model.queries,
|
|
43
|
+
disableAdd = model.disableAdd,
|
|
44
|
+
disableEdit = model.disableEdit,
|
|
45
|
+
disableDelete = model.disableDelete,
|
|
46
|
+
disableAddModal = model.disableAddModal,
|
|
47
|
+
additional_queries = [],
|
|
48
|
+
|
|
49
|
+
config = {},
|
|
50
|
+
// columns = schema.columns || [],
|
|
51
|
+
// isDirect = schema.isDirect,
|
|
52
|
+
// disableUpload = schema.disableUpload,
|
|
53
|
+
// disableAdd = schema.disableAdd,
|
|
54
|
+
// disableSelect = schema.disableSelect,
|
|
55
|
+
// queries = schema.queries || [],
|
|
56
|
+
// actions = schema.actions || [],
|
|
57
57
|
}) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const step = Location.search().step || 1;
|
|
61
|
-
|
|
62
|
-
const [today, setToday] = useState(moment());
|
|
63
|
-
|
|
64
|
-
const [records, setRecords] = useState({ [model.name]: [] });
|
|
65
|
-
|
|
66
|
-
const [single, setSingle] = useState({});
|
|
67
|
-
|
|
68
|
-
const [columns, setColumns] = useState([]);
|
|
69
|
-
|
|
70
|
-
const { params } = match;
|
|
71
|
-
|
|
72
|
-
const [loading, setLoading] = useState(true);
|
|
73
|
-
|
|
74
|
-
let cardView = JSON.parse(localStorage.getItem('card-view'))
|
|
75
|
-
|
|
76
|
-
const [view, setView] = useState(cardView);
|
|
77
|
-
|
|
78
|
-
const [selected, setSelected] = useState([]);
|
|
79
|
-
|
|
80
|
-
const [visible, setVisible] = useState(false);
|
|
81
|
-
|
|
82
|
-
const [layout, setLayout] = useState({});
|
|
83
|
-
|
|
84
|
-
// Index for the columns : #Note This should be moved to a generic utils to make this complete leaner
|
|
85
|
-
let columnIndex = [
|
|
86
|
-
{
|
|
87
|
-
title: '#',
|
|
88
|
-
dataIndex: 'index',
|
|
89
|
-
render: (value, item, index) => (options.page - 1) * options.pageSize + index + 1,
|
|
90
|
-
},
|
|
91
|
-
]
|
|
92
|
-
|
|
93
|
-
let nextStep = parseInt(step) + 1;
|
|
94
|
-
|
|
95
|
-
// Actions for the generic list
|
|
96
|
-
let columnActions = [
|
|
97
|
-
|
|
98
|
-
{
|
|
99
|
-
title: '',
|
|
100
|
-
key: '',
|
|
101
|
-
render: (text, record) => {
|
|
102
|
-
return (
|
|
103
|
-
<Space size="middle">
|
|
104
|
-
|
|
105
|
-
{/* Edit */}
|
|
106
|
-
{disableAddModal() || !model.ModalAddComponent ? null : (
|
|
107
|
-
<Button type="dashed" onClick={() => {
|
|
108
|
-
|
|
109
|
-
setSingle({ ...record });
|
|
110
|
-
|
|
111
|
-
setVisible(true);
|
|
112
|
-
}}>
|
|
113
|
-
Edit
|
|
114
|
-
</Button>
|
|
115
|
-
)}
|
|
116
|
-
{/* Edit Ends */}
|
|
117
|
-
|
|
118
|
-
{/* Edit */}
|
|
119
|
-
{disableDelete() ? null : (
|
|
120
|
-
<Popconfirm
|
|
121
|
-
title="Are you sure you want to delete this record ? "
|
|
122
|
-
onConfirm={() => deleteRecord(record)}
|
|
123
|
-
onCancel={() => { }}
|
|
124
|
-
okText="Yes"
|
|
125
|
-
cancelText="No"
|
|
126
|
-
>
|
|
127
|
-
<Button size="small">
|
|
128
|
-
<DeleteOutlined />
|
|
129
|
-
</Button>
|
|
130
|
-
</Popconfirm>
|
|
131
|
-
)}
|
|
132
|
-
{/* Edit Ends */}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</Space>
|
|
136
|
-
);
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
{
|
|
143
|
-
title: '',
|
|
144
|
-
key: 'action',
|
|
145
|
-
render: (text, record) => {
|
|
146
|
-
return (
|
|
147
|
-
<Space size="middle">
|
|
148
|
-
{!model.hideView && !actions.length ? <Link to={`/${model.name}/${text.id}?step=${nextStep}`}>View</Link> : null}
|
|
149
|
-
|
|
150
|
-
{actions.map((action) => (
|
|
151
|
-
<Link to={action.url(record)}>{action.caption}</Link>
|
|
152
|
-
))}
|
|
153
|
-
</Space>
|
|
154
|
-
);
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
]
|
|
158
|
-
|
|
159
|
-
const cols = [
|
|
160
|
-
...columnIndex
|
|
161
|
-
,
|
|
162
|
-
...model.columns.map((entry) => {
|
|
163
|
-
if (entry.sort) {
|
|
164
|
-
return {
|
|
165
|
-
render: (record) => {
|
|
166
|
-
if (entry.render) {
|
|
167
|
-
return entry.render(record);
|
|
168
|
-
} else {
|
|
169
|
-
return entry.field.split('.').reduce((acc, part) => acc && acc[part], record);
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
title: entry.caption,
|
|
173
|
-
key: entry.field,
|
|
174
|
-
sorter: (a, b) => entry.sort(a, b),
|
|
175
|
-
sortDirections: ['ascend', 'descend', 'ascend'],
|
|
176
|
-
};
|
|
177
|
-
} else {
|
|
178
|
-
return {
|
|
179
|
-
render: (record) => {
|
|
180
|
-
if (entry.render) {
|
|
181
|
-
return entry.render(record);
|
|
182
|
-
// return entry.field.split('.').reduce((acc, part) => acc && acc[part], record);
|
|
183
|
-
} else {
|
|
184
|
-
return entry.field.split('.').reduce((acc, part) => acc && acc[part], record);
|
|
185
|
-
}
|
|
186
|
-
// return record[entry.field]
|
|
187
|
-
},
|
|
188
|
-
title: entry.caption,
|
|
189
|
-
key: entry.field,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
}),
|
|
193
|
-
...columnActions,
|
|
194
|
-
];
|
|
195
|
-
|
|
196
|
-
const [options, setOptions] = useState({
|
|
197
|
-
page: 1,
|
|
198
|
-
current: 1,
|
|
199
|
-
pageSize: 20,
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
useEffect(() => {
|
|
58
|
+
// console.log(model);
|
|
203
59
|
|
|
204
|
-
|
|
60
|
+
const step = Location.search().step || 1;
|
|
205
61
|
|
|
206
|
-
|
|
62
|
+
const [today, setToday] = useState(moment());
|
|
207
63
|
|
|
64
|
+
const [records, setRecords] = useState({ [model.name]: [] });
|
|
208
65
|
|
|
66
|
+
const [single, setSingle] = useState({});
|
|
209
67
|
|
|
210
|
-
|
|
68
|
+
const [columns, setColumns] = useState([]);
|
|
211
69
|
|
|
212
|
-
|
|
213
|
-
// loadConfiguration(menu.model.id);
|
|
70
|
+
const { params } = match;
|
|
214
71
|
|
|
215
|
-
|
|
72
|
+
const [loading, setLoading] = useState(true);
|
|
216
73
|
|
|
217
|
-
|
|
74
|
+
let cardView = JSON.parse(localStorage.getItem('card-view'));
|
|
218
75
|
|
|
219
|
-
|
|
76
|
+
const [view, setView] = useState(cardView);
|
|
220
77
|
|
|
221
|
-
|
|
222
|
-
setColumns(cols);
|
|
78
|
+
const [selected, setSelected] = useState([]);
|
|
223
79
|
|
|
224
|
-
|
|
80
|
+
const [visible, setVisible] = useState(false);
|
|
225
81
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
82
|
+
const [layout, setLayout] = useState({});
|
|
229
83
|
|
|
84
|
+
// Index for the columns : #Note This should be moved to a generic utils to make this complete leaner
|
|
85
|
+
let columnIndex = [
|
|
86
|
+
{
|
|
87
|
+
title: '#',
|
|
88
|
+
dataIndex: 'index',
|
|
89
|
+
render: (value, item, index) => (options.page - 1) * options.pageSize + index + 1,
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
let nextStep = parseInt(step) + 1;
|
|
94
|
+
|
|
95
|
+
// Actions for the generic list
|
|
96
|
+
let columnActions = [
|
|
97
|
+
{
|
|
98
|
+
title: '',
|
|
99
|
+
key: '',
|
|
100
|
+
render: (text, record) => {
|
|
101
|
+
return (
|
|
102
|
+
<Space size="middle">
|
|
103
|
+
{/* Edit */}
|
|
104
|
+
{disableAddModal() || !model.ModalAddComponent ? null : (
|
|
105
|
+
<Button
|
|
106
|
+
type="dashed"
|
|
107
|
+
onClick={() => {
|
|
108
|
+
setSingle({ ...record });
|
|
109
|
+
|
|
110
|
+
setVisible(true);
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
Edit
|
|
114
|
+
</Button>
|
|
115
|
+
)}
|
|
116
|
+
{/* Edit Ends */}
|
|
117
|
+
|
|
118
|
+
{/* Edit */}
|
|
119
|
+
{disableDelete() ? null : (
|
|
120
|
+
<Popconfirm
|
|
121
|
+
title="Are you sure you want to delete this record ? "
|
|
122
|
+
onConfirm={() => deleteRecord(record)}
|
|
123
|
+
onCancel={() => {}}
|
|
124
|
+
okText="Yes"
|
|
125
|
+
cancelText="No"
|
|
126
|
+
>
|
|
127
|
+
<Button size="small">
|
|
128
|
+
<DeleteOutlined />
|
|
129
|
+
</Button>
|
|
130
|
+
</Popconfirm>
|
|
131
|
+
)}
|
|
132
|
+
{/* Edit Ends */}
|
|
133
|
+
</Space>
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
},
|
|
230
137
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
key: record.field
|
|
257
|
-
}
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
setColumns(
|
|
261
|
-
|
|
262
|
-
[
|
|
263
|
-
...columnIndex
|
|
264
|
-
,
|
|
265
|
-
|
|
266
|
-
...mapped,
|
|
267
|
-
...columnActions,
|
|
268
|
-
|
|
269
|
-
]
|
|
270
|
-
)
|
|
271
|
-
|
|
138
|
+
{
|
|
139
|
+
title: '',
|
|
140
|
+
key: 'action',
|
|
141
|
+
render: (text, record) => {
|
|
142
|
+
return (
|
|
143
|
+
<Space size="middle">
|
|
144
|
+
{!model.hideView && !actions.length ? <Link to={`/${model.name}/${text.id}?step=${nextStep}`}>View</Link> : null}
|
|
145
|
+
|
|
146
|
+
{actions.map((action) => (
|
|
147
|
+
<Link to={action.url(record)}>{action.caption}</Link>
|
|
148
|
+
))}
|
|
149
|
+
</Space>
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const cols = [
|
|
156
|
+
...columnIndex,
|
|
157
|
+
...model.columns.map((entry) => {
|
|
158
|
+
if (entry.sort) {
|
|
159
|
+
return {
|
|
160
|
+
render: (record) => {
|
|
161
|
+
if (entry.render) {
|
|
162
|
+
return entry.render(record);
|
|
272
163
|
} else {
|
|
273
|
-
|
|
274
|
-
|
|
164
|
+
return entry.field.split('.').reduce((acc, part) => acc && acc[part], record);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
title: entry.caption,
|
|
168
|
+
key: entry.field,
|
|
169
|
+
sorter: (a, b) => entry.sort(a, b),
|
|
170
|
+
sortDirections: ['ascend', 'descend', 'ascend'],
|
|
171
|
+
};
|
|
172
|
+
} else {
|
|
173
|
+
return {
|
|
174
|
+
render: (record) => {
|
|
175
|
+
if (entry.render) {
|
|
176
|
+
return entry.render(record);
|
|
177
|
+
// return entry.field.split('.').reduce((acc, part) => acc && acc[part], record);
|
|
178
|
+
} else {
|
|
179
|
+
return entry.field.split('.').reduce((acc, part) => acc && acc[part], record);
|
|
275
180
|
}
|
|
276
|
-
|
|
181
|
+
// return record[entry.field]
|
|
182
|
+
},
|
|
183
|
+
title: entry.caption,
|
|
184
|
+
key: entry.field,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
188
|
+
...columnActions,
|
|
189
|
+
];
|
|
190
|
+
|
|
191
|
+
const [options, setOptions] = useState({
|
|
192
|
+
page: 1,
|
|
193
|
+
current: 1,
|
|
194
|
+
pageSize: 20,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
loadListing();
|
|
199
|
+
}, []);
|
|
200
|
+
|
|
201
|
+
function loadListing() {
|
|
202
|
+
if (menu && menu.model && menu.model.id) {
|
|
203
|
+
// loadConfiguration(menu.model.id);
|
|
204
|
+
|
|
205
|
+
loadConfiguration(menu.id).then(() => {
|
|
206
|
+
loadData(queries);
|
|
207
|
+
});
|
|
208
|
+
} else {
|
|
209
|
+
setColumns(cols);
|
|
210
|
+
|
|
211
|
+
loadData(queries);
|
|
277
212
|
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Load the configuration
|
|
217
|
+
*/
|
|
218
|
+
function loadConfiguration(id) {
|
|
219
|
+
var queries = [
|
|
220
|
+
{
|
|
221
|
+
field: 'menu_id',
|
|
222
|
+
value: id,
|
|
223
|
+
},
|
|
224
|
+
];
|
|
278
225
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
localStorage.setItem('card-view', result);
|
|
283
|
-
}
|
|
226
|
+
return UserPreferences.get(queries).then((result) => {
|
|
227
|
+
// console.log(result);
|
|
284
228
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
*/
|
|
288
|
-
const getRecords = (today) => {
|
|
289
|
-
// console.log(model);
|
|
229
|
+
if (result.user_preferences.length) {
|
|
230
|
+
let cols = result.user_preferences[0].selected;
|
|
290
231
|
|
|
291
|
-
|
|
292
|
-
field: 'step',
|
|
293
|
-
value: parseInt(step) || 1
|
|
294
|
-
}]
|
|
232
|
+
setLayout(result.user_preferences[0]);
|
|
295
233
|
|
|
296
|
-
|
|
234
|
+
let mapped = cols.map((record) => {
|
|
235
|
+
return {
|
|
236
|
+
dataIndex: record.field,
|
|
237
|
+
title: record.caption,
|
|
238
|
+
key: record.field,
|
|
239
|
+
};
|
|
240
|
+
});
|
|
297
241
|
|
|
298
|
-
|
|
242
|
+
setColumns([...columnIndex, ...mapped, ...columnActions]);
|
|
243
|
+
} else {
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
299
247
|
|
|
300
|
-
|
|
301
|
-
|
|
248
|
+
function changeView(result) {
|
|
249
|
+
setView(result);
|
|
302
250
|
|
|
303
|
-
|
|
251
|
+
localStorage.setItem('card-view', result);
|
|
252
|
+
}
|
|
304
253
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
254
|
+
/**
|
|
255
|
+
*
|
|
256
|
+
*/
|
|
257
|
+
const getRecords = (today) => {
|
|
258
|
+
// console.log(model);
|
|
310
259
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
260
|
+
let firstStepQueries = [
|
|
261
|
+
{
|
|
262
|
+
field: 'step',
|
|
263
|
+
value: parseInt(step) || 1,
|
|
264
|
+
},
|
|
265
|
+
];
|
|
317
266
|
|
|
318
|
-
|
|
319
|
-
console.log(result);
|
|
267
|
+
var queries = [...additional_queries, ...firstStepQueries];
|
|
320
268
|
|
|
321
|
-
|
|
269
|
+
if (!additional_queries.length) {
|
|
270
|
+
queries.push({
|
|
271
|
+
field: 'header_id',
|
|
272
|
+
value: null,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
322
275
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
276
|
+
// if (model.filterDate()) {
|
|
277
|
+
// queries.push({
|
|
278
|
+
// field: 'created_date',
|
|
279
|
+
// value: moment(today).startOf('day').valueOf(),
|
|
280
|
+
// });
|
|
281
|
+
// }
|
|
326
282
|
|
|
327
|
-
|
|
328
|
-
|
|
283
|
+
return model.get(queries, config).then((result) => {
|
|
284
|
+
// console.log(result);
|
|
329
285
|
|
|
330
|
-
|
|
286
|
+
setRecords(result);
|
|
331
287
|
|
|
332
|
-
|
|
288
|
+
setLoading(false);
|
|
289
|
+
});
|
|
290
|
+
};
|
|
333
291
|
|
|
334
|
-
|
|
292
|
+
const loadData = (today, queries) => {
|
|
293
|
+
// console.log('queries', queries);
|
|
335
294
|
|
|
336
|
-
|
|
337
|
-
};
|
|
295
|
+
setLoading(true);
|
|
338
296
|
|
|
339
|
-
|
|
340
|
-
loadData(today, queries);
|
|
341
|
-
}
|
|
297
|
+
setToday(today);
|
|
342
298
|
|
|
343
|
-
|
|
344
|
-
* Delete multiple selected records
|
|
345
|
-
*/
|
|
346
|
-
function deleteSelected() {
|
|
299
|
+
setSelected([]);
|
|
347
300
|
|
|
348
|
-
|
|
301
|
+
getRecords(today, queries);
|
|
302
|
+
};
|
|
349
303
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
304
|
+
function refresh() {
|
|
305
|
+
loadData(today, queries);
|
|
306
|
+
}
|
|
353
307
|
|
|
354
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Delete multiple selected records
|
|
310
|
+
*/
|
|
311
|
+
function deleteSelected() {
|
|
312
|
+
setLoading(true);
|
|
355
313
|
|
|
356
|
-
|
|
314
|
+
Promise.all(selected.map((entry) => model.delete(entry.id, { hideAlert: true }))).then(() => {
|
|
315
|
+
message.success('Selected records has been deleted');
|
|
357
316
|
|
|
358
|
-
|
|
317
|
+
setLoading(false);
|
|
359
318
|
|
|
360
|
-
|
|
361
|
-
});
|
|
362
|
-
}
|
|
319
|
+
setSelected([]);
|
|
363
320
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
321
|
+
loadData();
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Delete the record
|
|
327
|
+
*/
|
|
328
|
+
function deleteRecord(record) {
|
|
329
|
+
return model.delete(record.id).then(() => {
|
|
330
|
+
loadData();
|
|
331
|
+
});
|
|
332
|
+
}
|
|
368
333
|
|
|
369
|
-
|
|
334
|
+
/**
|
|
335
|
+
* Close the modal
|
|
336
|
+
*/
|
|
337
|
+
function closeModal(refresh) {
|
|
338
|
+
setSingle({});
|
|
370
339
|
|
|
371
|
-
|
|
340
|
+
setVisible(false);
|
|
372
341
|
|
|
373
|
-
|
|
342
|
+
if (refresh) {
|
|
343
|
+
loadData();
|
|
374
344
|
}
|
|
345
|
+
}
|
|
375
346
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
setSingle({});
|
|
382
|
-
|
|
383
|
-
setVisible(false);
|
|
347
|
+
// rowSelection object indicates the need for row selection
|
|
348
|
+
const rowSelection = {
|
|
349
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
350
|
+
// console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
|
384
351
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
<
|
|
405
|
-
|
|
406
|
-
<
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
okText="Yes"
|
|
449
|
-
cancelText="No"
|
|
450
|
-
>
|
|
451
|
-
<Button size="small">{action.caption}</Button>
|
|
452
|
-
</Popconfirm>
|
|
453
|
-
);
|
|
454
|
-
})
|
|
455
|
-
}
|
|
456
|
-
{/* Custom Actions */}
|
|
457
|
-
|
|
458
|
-
</>
|
|
459
|
-
) : null}
|
|
460
|
-
|
|
461
|
-
<Space size="small">
|
|
462
|
-
{/* {model.filterDate() ? (
|
|
352
|
+
setSelected(selectedRows);
|
|
353
|
+
},
|
|
354
|
+
getCheckboxProps: (record) => ({
|
|
355
|
+
disabled: record.name === 'Disabled User', // Column configuration not to be checked
|
|
356
|
+
name: record.name,
|
|
357
|
+
}),
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<section className="generic-list">
|
|
362
|
+
{/* Table Header */}
|
|
363
|
+
<div className="table-header">
|
|
364
|
+
<div className="table-title">
|
|
365
|
+
<Title level={4}>{model.name}</Title>
|
|
366
|
+
|
|
367
|
+
<p>{loading ? 'Loading records' : `${records[model.name].length} records`}</p>
|
|
368
|
+
</div>
|
|
369
|
+
|
|
370
|
+
{/* Table Filters */}
|
|
371
|
+
<div className="table-filters">
|
|
372
|
+
<Space direction="vertical" size={12}>
|
|
373
|
+
{/* <RangePicker onChange={updateFilter} /> */}
|
|
374
|
+
</Space>
|
|
375
|
+
</div>
|
|
376
|
+
{/* Table Filters Ends */}
|
|
377
|
+
|
|
378
|
+
<div className="table-actions">
|
|
379
|
+
<div className="button-container">
|
|
380
|
+
{/* Selected Actions */}
|
|
381
|
+
{selected.length ? (
|
|
382
|
+
<>
|
|
383
|
+
{selected.length} selected .
|
|
384
|
+
<Popconfirm
|
|
385
|
+
title="Are you sure you want to delete the selected rows ? "
|
|
386
|
+
onConfirm={() => deleteSelected()}
|
|
387
|
+
onCancel={() => {}}
|
|
388
|
+
okText="Yes"
|
|
389
|
+
cancelText="No"
|
|
390
|
+
>
|
|
391
|
+
<Button size="small">
|
|
392
|
+
<DeleteOutlined />
|
|
393
|
+
</Button>
|
|
394
|
+
</Popconfirm>
|
|
395
|
+
{/* Custom Actions */}
|
|
396
|
+
{actions.map((action) => {
|
|
397
|
+
return (
|
|
398
|
+
<Popconfirm
|
|
399
|
+
title="Are you sure you want to perform the action on selected rows ? "
|
|
400
|
+
onConfirm={() => action.onClick(selected, refresh)}
|
|
401
|
+
onCancel={() => {}}
|
|
402
|
+
okText="Yes"
|
|
403
|
+
cancelText="No"
|
|
404
|
+
>
|
|
405
|
+
<Button size="small">{action.caption}</Button>
|
|
406
|
+
</Popconfirm>
|
|
407
|
+
);
|
|
408
|
+
})}
|
|
409
|
+
{/* Custom Actions */}
|
|
410
|
+
</>
|
|
411
|
+
) : null}
|
|
412
|
+
|
|
413
|
+
<Space size="small">
|
|
414
|
+
{/* {model.filterDate() ? (
|
|
463
415
|
<DatePicker defaultValue={today} format={'DD/MM/YYYY'} allowClear={false} onChange={loadData} />
|
|
464
416
|
) : null} */}
|
|
465
417
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
<Button onClick={refresh} type="secondary" size={'small'}>
|
|
476
|
-
<ReloadOutlined />
|
|
477
|
-
</Button>
|
|
418
|
+
<Switch
|
|
419
|
+
size={'small'}
|
|
420
|
+
defaultChecked
|
|
421
|
+
onChange={changeView}
|
|
422
|
+
checked={view}
|
|
423
|
+
checkedChildren={<OrderedListOutlined />}
|
|
424
|
+
unCheckedChildren={<PicCenterOutlined />}
|
|
425
|
+
/>
|
|
478
426
|
|
|
427
|
+
<Button onClick={refresh} type="secondary" size={'small'}>
|
|
428
|
+
<ReloadOutlined />
|
|
429
|
+
</Button>
|
|
479
430
|
|
|
480
|
-
|
|
431
|
+
{/* <Button onClick={refresh} type="secondary" size={'small'}>
|
|
481
432
|
<TableOutlined />
|
|
482
433
|
</Button> */}
|
|
483
434
|
|
|
484
|
-
|
|
485
|
-
|
|
435
|
+
{/* */}
|
|
436
|
+
{/* {!loading ? <TableSettings refresh={loadListing} layout={layout} menu={menu} model={model} onUpdate={() => { }} /> : null} */}
|
|
486
437
|
|
|
487
|
-
|
|
488
|
-
{/* <Button onClick={exportTableLocal} type="secondary" size={'small'}>
|
|
438
|
+
{/* <Button onClick={exportTableLocal} type="secondary" size={'small'}>
|
|
489
439
|
Download
|
|
490
440
|
</Button> */}
|
|
491
441
|
|
|
492
|
-
|
|
493
|
-
|
|
442
|
+
{/*table data export to csc component*/}
|
|
443
|
+
{/* {records && <ExportReactCSV csvData={expRecord} />} */}
|
|
494
444
|
|
|
495
|
-
|
|
445
|
+
{/* <Button disabled={options.page <= 1} size="small" onClick={() => { }}>
|
|
496
446
|
<CaretLeftOutlined />
|
|
497
447
|
</Button>
|
|
498
448
|
|
|
@@ -502,7 +452,7 @@ function MenuList({
|
|
|
502
452
|
|
|
503
453
|
</Button> */}
|
|
504
454
|
|
|
505
|
-
|
|
455
|
+
{/* {
|
|
506
456
|
disableUpload
|
|
507
457
|
?
|
|
508
458
|
null
|
|
@@ -514,80 +464,87 @@ function MenuList({
|
|
|
514
464
|
</Button>
|
|
515
465
|
} */}
|
|
516
466
|
|
|
517
|
-
|
|
518
|
-
|
|
467
|
+
{/* Add Redirection */}
|
|
468
|
+
{/* {disableAdd ? null : (
|
|
519
469
|
<Button type="dashed" size={'small'}>
|
|
520
470
|
<Link to={`/${model.name}/create`}>Add</Link>
|
|
521
471
|
</Button>
|
|
522
472
|
)} */}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
473
|
+
{/* Add Redirection Ends */}
|
|
474
|
+
|
|
475
|
+
{disableAddModal() || !model.ModalAddComponent ? null : (
|
|
476
|
+
<Button size={'small'} type="dashed" onClick={() => setVisible(true)}>
|
|
477
|
+
Add
|
|
478
|
+
</Button>
|
|
479
|
+
)}
|
|
480
|
+
</Space>
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
</div>
|
|
484
|
+
|
|
485
|
+
{/* Table Header Ends */}
|
|
486
|
+
|
|
487
|
+
{loading ? (
|
|
488
|
+
<Skeleton type="listing" />
|
|
489
|
+
) : (
|
|
490
|
+
<>
|
|
491
|
+
<>
|
|
492
|
+
{!view ? (
|
|
493
|
+
<Table
|
|
494
|
+
// ref={(ref) => { tableRef = ref }}
|
|
495
|
+
className="table-exportable"
|
|
496
|
+
loading={loading}
|
|
497
|
+
size="small"
|
|
498
|
+
rowSelection={rowSelection}
|
|
499
|
+
scroll={{ x: true, y: 750 }}
|
|
500
|
+
// scroll={{ x: true, y: 750 }}
|
|
501
|
+
rowKey={(record) => record.id}
|
|
502
|
+
// rowKey={record => record[model + 'Id']}
|
|
503
|
+
dataSource={records[model.name]}
|
|
504
|
+
columns={columns}
|
|
505
|
+
// onChange={handleTableChange}
|
|
506
|
+
pagination={false}
|
|
507
|
+
></Table>
|
|
539
508
|
) : (
|
|
540
|
-
|
|
541
|
-
<>
|
|
542
|
-
{!view ? (
|
|
543
|
-
<Table
|
|
544
|
-
// ref={(ref) => { tableRef = ref }}
|
|
545
|
-
className="table-exportable"
|
|
546
|
-
loading={loading}
|
|
547
|
-
size="small"
|
|
548
|
-
rowSelection={rowSelection}
|
|
549
|
-
scroll={{ x: true, y: 750 }}
|
|
550
|
-
|
|
551
|
-
// scroll={{ x: true, y: 750 }}
|
|
552
|
-
rowKey={(record) => record.id}
|
|
553
|
-
// rowKey={record => record[model + 'Id']}
|
|
554
|
-
dataSource={records[model.name]}
|
|
555
|
-
columns={columns}
|
|
556
|
-
// onChange={handleTableChange}
|
|
557
|
-
pagination={false}
|
|
558
|
-
></Table>
|
|
559
|
-
) : (
|
|
560
|
-
<CardList model={model} data={records[model.name]} />
|
|
561
|
-
)}
|
|
562
|
-
</>
|
|
563
|
-
</>
|
|
509
|
+
<CardList model={model} data={records[model.name]} />
|
|
564
510
|
)}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
511
|
+
</>
|
|
512
|
+
</>
|
|
513
|
+
)}
|
|
514
|
+
|
|
515
|
+
{/* Add Modal */}
|
|
516
|
+
<Modal
|
|
517
|
+
destroyOnClose
|
|
518
|
+
confirmLoading={loading}
|
|
519
|
+
title="Add New"
|
|
520
|
+
visible={visible}
|
|
521
|
+
onCancel={() => {
|
|
522
|
+
closeModal();
|
|
523
|
+
}}
|
|
524
|
+
footer={null}
|
|
525
|
+
>
|
|
526
|
+
<model.ModalAddComponent
|
|
527
|
+
match={match}
|
|
528
|
+
menu={menu}
|
|
529
|
+
model={model}
|
|
530
|
+
additional_queries={additional_queries}
|
|
531
|
+
formContent={single}
|
|
532
|
+
callback={() => {
|
|
533
|
+
closeModal(true);
|
|
534
|
+
}}
|
|
535
|
+
/>
|
|
536
|
+
{/* <FormCreator formContent={{ [model]: {} }} modelIndex="requestId" model={model} onSubmit={createRecord} config={step} /> */}
|
|
537
|
+
</Modal>
|
|
538
|
+
|
|
539
|
+
{/* Add Modal Ends */}
|
|
540
|
+
</section>
|
|
541
|
+
);
|
|
585
542
|
}
|
|
586
543
|
|
|
587
544
|
export default withRouter(MenuList);
|
|
588
545
|
|
|
589
546
|
function CardList({ model, data, ...props }) {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
547
|
+
return data.map((record, index) => {
|
|
548
|
+
return <model.Card index={index} key={index} record={record} {...record} {...props} />;
|
|
549
|
+
});
|
|
593
550
|
}
|