ui-soxo-bootstrap-core 2.6.53 → 2.6.55-dev.0

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.
@@ -211,7 +211,9 @@ function FormCreator({
211
211
  // Keep the same value preparation path for normal submit and search reset.
212
212
  fields.forEach((field) => {
213
213
 
214
- if (field.field && field.field.includes('date')) {
214
+ // Only actual date inputs are converted , a field can be named with date
215
+ // and still hold a plain value ( eg : date_filter_type select )
216
+ if (field.field && field.field.includes('date') && ['date', 'datetime'].indexOf(field.type) !== -1) {
215
217
 
216
218
  nextValues[field.field] = moment(nextValues[field.field]).valueOf();
217
219
 
@@ -530,7 +532,7 @@ function UserInput({ field, onUpload, selectedInformation, onChange, onSearchRes
530
532
  return (
531
533
  <Select defaultValue={defaultValue}
532
534
  required={field.required}
533
- style={{ width: '120' }}
535
+ style={{ minWidth: '160px' }}
534
536
  onChange={(value) => onChange(field, value)}
535
537
  >
536
538
  {field.options.map((option, key) => (
@@ -348,8 +348,8 @@ const MenuLists = ({ model, match, relativeAdd = false, additional_queries = [],
348
348
  );
349
349
 
350
350
  return (
351
- <Card className="generic-list">
352
- <div style={{ marginBottom: 16 }}>
351
+ <Card className="generic-list menu-lists">
352
+ <div className="menu-lists__header" style={{ marginBottom: 16 }}>
353
353
  <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
354
354
  <Search placeholder="Search menus & sub-menus…" allowClear style={{ width: 300, marginBottom: '0px' }} onChange={onSearch} />
355
355
 
@@ -399,10 +399,10 @@ const MenuLists = ({ model, match, relativeAdd = false, additional_queries = [],
399
399
  </div>
400
400
  )}
401
401
  </div>
402
- {loading ? (
403
- <Skeleton active />
404
- ) : (
405
- <>
402
+ <div className="menu-lists__body">
403
+ {loading ? (
404
+ <Skeleton active />
405
+ ) : (
406
406
  <>
407
407
  {/* {!view ? ( */}
408
408
  <Card>
@@ -468,8 +468,8 @@ const MenuLists = ({ model, match, relativeAdd = false, additional_queries = [],
468
468
  <CardList model={model} data={filtered ? filtered : records} />
469
469
  )} */}
470
470
  </>
471
- </>
472
- )}
471
+ )}
472
+ </div>
473
473
 
474
474
  <Drawer title={drawerTitle} open={drawerVisible} width="80%" destroyOnClose onClose={() => setDrawerVisible(false)}>
475
475
  {model.ModalAddComponent && (
@@ -1,3 +1,30 @@
1
+ /* Keep the search / order switch / create button row pinned while only the
2
+ menu cards below scroll. */
3
+ .menu-lists {
4
+ height: calc(100vh - 100px);
5
+ display: flex;
6
+ flex-direction: column;
7
+
8
+ > .ant-card-body {
9
+ display: flex;
10
+ flex-direction: column;
11
+ flex: 1 1 auto;
12
+ min-height: 0;
13
+ overflow: hidden;
14
+ }
15
+
16
+ .menu-lists__header {
17
+ flex: 0 0 auto;
18
+ }
19
+
20
+ .menu-lists__body {
21
+ flex: 1 1 auto;
22
+ min-height: 0;
23
+ overflow-y: auto;
24
+ overflow-x: hidden;
25
+ }
26
+ }
27
+
1
28
  .custom-collapse {
2
29
  background: transparent !important;
3
30
  border: none !important;
@@ -15,6 +15,9 @@ import MenuDashBoardComponent from '../../../../lib/elements/basic/menu-dashboar
15
15
 
16
16
  import ReportingTable from './reporting-table';
17
17
 
18
+ // Input parameter that decides which date column the report is filtered by
19
+ const DATE_FILTER_FIELD = 'date_filter_type';
20
+
18
21
  /**
19
22
  * ReportingDashboard component renders the dashboard and handles patient details,
20
23
  * configuration, and form layout for generating reports.
@@ -174,6 +177,9 @@ export default function ReportingDashboard({
174
177
  if (urlParams[record.field]) {
175
178
  if (record.type === 'date') {
176
179
  formContent[record.field] = moment.utc(urlParams[record.field]);
180
+ } else if (record.type !== 'search') {
181
+ // Restore plain values ( eg : select filters ) back from the url
182
+ formContent[record.field] = urlParams[record.field];
177
183
  }
178
184
 
179
185
  // return formContent;
@@ -201,6 +207,10 @@ export default function ReportingDashboard({
201
207
  break;
202
208
 
203
209
  default:
210
+ // Any other default is taken as the value itself ( eg : select filters )
211
+ if (record.default !== undefined && record.default !== null && record.type !== 'date') {
212
+ formContent[record.field] = record.default;
213
+ }
204
214
  break;
205
215
  }
206
216
  }
@@ -209,6 +219,11 @@ export default function ReportingDashboard({
209
219
  if (record.type === 'date' && !formContent[record.field]) {
210
220
  formContent[record.field] = moment().tz(process.env.REACT_APP_TIMEZONE);
211
221
  }
222
+
223
+ // For a static select with no value yet , preselect the first option
224
+ if (record.type === 'select' && Array.isArray(record.options) && formContent[record.field] === undefined) {
225
+ formContent[record.field] = record.options[0]?.valueMember;
226
+ }
212
227
  if (record.type === 'search') {
213
228
  if (!formContent[record.field]) formContent[record.field] = [];
214
229
  return {
@@ -248,8 +263,19 @@ export default function ReportingDashboard({
248
263
  // If enabled, clear the details array
249
264
  setDetails([]);
250
265
  } else {
266
+ // The date filter input is shown only when the filter is enabled in otherDetails .
267
+ // Otherwise it stays hidden holding its default value , so the report keeps filtering
268
+ // on the default date
269
+ const filterKey = otherDetails ? Object.keys(otherDetails).find((key) => key.toLowerCase().trim() === 'enableuserfilter') : null;
270
+
271
+ const isFilterEnabled = filterKey ? otherDetails[filterKey] === true || otherDetails[filterKey] === 'true' : false;
272
+
251
273
  // Keep all parameters with a type (including search) to render in FormCreator
252
- setDetails([...parameters.filter((ele) => ele.type)]);
274
+ setDetails([
275
+ ...parameters
276
+ .filter((ele) => ele.type)
277
+ .map((ele) => (ele.field === DATE_FILTER_FIELD ? { ...ele, visible: isFilterEnabled } : ele)),
278
+ ]);
253
279
  }
254
280
  }
255
281
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-soxo-bootstrap-core",
3
- "version": "2.6.53",
3
+ "version": "2.6.55-dev.0",
4
4
  "description": "All the Core Components for you to start",
5
5
  "keywords": [
6
6
  "all in one"