@iapps/ng-dhis2-ui 1.2.68 → 1.2.71

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.
@@ -3305,7 +3305,7 @@ const OrgUnitSelector = ({ hide, setHide, selectedOrgUnit, setSelectedOrgUnit, s
3305
3305
  const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setOrgUnitState, defaultOrgUnit, setHide, startDateState, setStartDateState, endDateState, setEndDateState, visibleFilters, dateStates, inputValues, setInputValues, handleInputChange, handleInputChangeForSelectField, handleDateSelect, prevValue, setPrevValue, showAllFilters, setShowAllFilters, handleSearch, setTempStartDateState, setTempEndDateState, setTempOrgUnitState, tempStartDateState, tempEndDateState, tempOrgUnitState, dataQueryFiltersState, setDataQueryFiltersState, SetOrgUnitModalVisible, showEnrollmentDates, }) => (React__default.createElement(DataTableToolbar, { className: "table-top-toolbar" },
3306
3306
  React__default.createElement("div", { style: {
3307
3307
  display: 'flex',
3308
- flexDirection: 'column',
3308
+ // flexDirection: 'column',
3309
3309
  gap: '10px',
3310
3310
  flexWrap: 'wrap',
3311
3311
  } },
@@ -3339,20 +3339,14 @@ const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setO
3339
3339
  if (selectedDate.calendarDateString === null) {
3340
3340
  setEndDateState(selectedDate.calendarDateString);
3341
3341
  }
3342
- } }))),
3343
- React__default.createElement(Button$1, { onClick: handleSearch }, "Search"),
3344
- React__default.createElement(Button$1, { onClick: () => setShowAllFilters(!showAllFilters) }, showAllFilters ? 'Less Filters' : 'More Filters')),
3345
- visibleFilters?.length > 0 && (React__default.createElement("div", { style: {
3346
- display: 'flex',
3347
- alignItems: 'center',
3348
- gap: '10px',
3349
- flexWrap: 'wrap',
3350
- } }, (visibleFilters ?? []).map(({ label, key, valueType, options }) => {
3342
+ } })))),
3343
+ (visibleFilters ?? []).map(({ label, key, valueType, options }) => {
3351
3344
  if (valueType === 'DATE') {
3352
3345
  return (React__default.createElement(CalendarInput, { key: key, label: `${label}:`, calendar: "gregory", locale: "en-GB", timeZone: "Africa/Dar_es_Salaam", className: "custom-input", clearable: !!dateStates[key], date: dateStates[key], onDateSelect: (selectedDate) => {
3353
3346
  handleDateSelect(key, selectedDate);
3354
3347
  const filteredFilters = dataQueryFiltersState.filter((f) => f.attribute !== key);
3355
- if (selectedDate === null) {
3348
+ if (selectedDate.calendarDateString === null) {
3349
+ console.log('selectedDate', selectedDate);
3356
3350
  setDataQueryFiltersState(filteredFilters);
3357
3351
  }
3358
3352
  } }));
@@ -3387,164 +3381,15 @@ const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setO
3387
3381
  setPrevValue(currentValue);
3388
3382
  }
3389
3383
  } }));
3390
- })))))
3391
- // <DataTableToolbar className="table-top-toolbar">
3392
- // <div
3393
- // style={{
3394
- // display: 'flex',
3395
- // alignItems: 'center',
3396
- // gap: '10px',
3397
- // flexWrap: 'wrap',
3398
- // }}
3399
- // >
3400
- // <InputField
3401
- // key="location"
3402
- // label={orgUnitLabel ? orgUnitLabel : 'registering unit:'}
3403
- // value={selectedOrgUnit}
3404
- // onFocus={() => setHide(false)}
3405
- // className="custom-input"
3406
- // clearable
3407
- // onChange={(event: { value: string }) => {
3408
- // setSelectedOrgUnit(event.value);
3409
- // setOrgUnitState(defaultOrgUnit);
3410
- // }}
3411
- // />
3412
- // <CalendarInput
3413
- // label="Start date:"
3414
- // calendar="gregory"
3415
- // locale="en-GB"
3416
- // timeZone="Africa/Dar_es_Salaam"
3417
- // className="custom-input"
3418
- // clearable={!!tempStartDateState}
3419
- // date={tempStartDateState}
3420
- // onDateSelect={(selectedDate: any) => {
3421
- // // if (!(selectedDate.calendarDateString === null)) {
3422
- // setTempStartDateState(selectedDate.calendarDateString);
3423
- // //}
3424
- // if (selectedDate.calendarDateString === null) {
3425
- // setStartDateState(selectedDate.calendarDateString);
3426
- // }
3427
- // }}
3428
- // />
3429
- // <CalendarInput
3430
- // label="End date:"
3431
- // calendar="gregory"
3432
- // locale="en-GB"
3433
- // timeZone="Africa/Dar_es_Salaam"
3434
- // className="custom-input"
3435
- // clearable={!!tempEndDateState}
3436
- // date={tempEndDateState}
3437
- // onDateSelect={(selectedDate: any) => {
3438
- // // if (!(selectedDate.calendarDateString === null)) {
3439
- // setTempEndDateState(selectedDate.calendarDateString);
3440
- // //}
3441
- // if (selectedDate.calendarDateString === null) {
3442
- // setEndDateState(selectedDate.calendarDateString);
3443
- // }
3444
- // }}
3445
- // />
3446
- // <Button onClick={() => handleSearch()}>Search</Button>
3447
- // <Button onClick={() => setShowAllFilters(!showAllFilters)}>
3448
- // {showAllFilters ? 'Less Filters' : 'More Filters'}
3449
- // </Button>
3450
- // {(visibleFilters ?? []).map(({ label, key, valueType, options }: any) => {
3451
- // if (valueType === 'DATE') {
3452
- // return (
3453
- // <CalendarInput
3454
- // key={key}
3455
- // label={`${label}:`}
3456
- // calendar="gregory"
3457
- // locale="en-GB"
3458
- // timeZone="Africa/Dar_es_Salaam"
3459
- // className="custom-input"
3460
- // clearable={!!dateStates[key]}
3461
- // date={dateStates[key]}
3462
- // onDateSelect={(selectedDate: any) => {
3463
- // handleDateSelect(key, selectedDate);
3464
- // const filteredFilters = dataQueryFiltersState.filter(
3465
- // (f: { attribute: any }) => f.attribute !== key
3466
- // );
3467
- // if (selectedDate === null) {
3468
- // setDataQueryFiltersState(filteredFilters);
3469
- // }
3470
- // }}
3471
- // />
3472
- // );
3473
- // }
3474
- // // const filteredFilters = prevFilters.filter((f) => f.attribute !== key);
3475
- // if (options && options.options.length > 0) {
3476
- // return (
3477
- // <SingleSelectField
3478
- // key={key}
3479
- // label={`${label}:`}
3480
- // selected={inputValues[key] || ''}
3481
- // className="custom-select-input"
3482
- // clearable
3483
- // onChange={({ selected }: { selected: string }) => {
3484
- // setInputValues((prevValues: any) => ({
3485
- // ...prevValues,
3486
- // [key]: selected ?? '',
3487
- // }));
3488
- // handleInputChangeForSelectField(key, selected ?? '');
3489
- // const filteredFilters = dataQueryFiltersState.filter(
3490
- // (f: { attribute: any }) => f.attribute !== key
3491
- // );
3492
- // if (selected === '') {
3493
- // setDataQueryFiltersState(filteredFilters);
3494
- // }
3495
- // }}
3496
- // >
3497
- // {(options.options ?? []).map((opt: any) => (
3498
- // <SingleSelectOption
3499
- // key={opt.id}
3500
- // label={opt.name}
3501
- // value={opt.code}
3502
- // />
3503
- // ))}
3504
- // </SingleSelectField>
3505
- // );
3506
- // }
3507
- // return (
3508
- // <InputField
3509
- // key={key}
3510
- // label={`${label}:`}
3511
- // className="custom-input"
3512
- // value={inputValues[key] || ''}
3513
- // clearable
3514
- // onChange={(e: any) => {
3515
- // const currentValue =
3516
- // 'target' in e ? e.target.value : e.value ?? '';
3517
- // setInputValues((prevValues: any) => ({
3518
- // ...prevValues,
3519
- // [key]: currentValue,
3520
- // }));
3521
- // // if (currentValue === '') {
3522
- // // handleInputChange(key, '');
3523
- // // }
3524
- // const filteredFilters = dataQueryFiltersState.filter(
3525
- // (f: { attribute: any }) => f.attribute !== key
3526
- // );
3527
- // if (currentValue === '') {
3528
- // setDataQueryFiltersState(filteredFilters);
3529
- // }
3530
- // }}
3531
- // onBlur={(e: any) => {
3532
- // const currentValue =
3533
- // 'target' in e ? e.target.value : e.value ?? '';
3534
- // if (currentValue !== '' && currentValue !== prevValue) {
3535
- // handleInputChange(key, currentValue);
3536
- // setPrevValue(currentValue);
3537
- // }
3538
- // }}
3539
- // />
3540
- // );
3541
- // })}
3542
- // <div>
3543
- // {/* <p>hello</p> */}
3544
- // </div>
3545
- // </div>
3546
- // </DataTableToolbar>
3547
- );
3384
+ }),
3385
+ React__default.createElement("div", { style: {
3386
+ display: 'flex',
3387
+ // alignItems: 'center',
3388
+ gap: '10px',
3389
+ // flexWrap: 'wrap',
3390
+ } },
3391
+ React__default.createElement(Button$1, { onClick: handleSearch }, "Search"),
3392
+ React__default.createElement(Button$1, { onClick: () => setShowAllFilters(!showAllFilters) }, showAllFilters ? 'Less Filters' : 'More Filters')))));
3548
3393
 
3549
3394
  // export const TableHeader = ({
3550
3395
  // columns,
@@ -4174,6 +4019,7 @@ class LineListTableComponent extends ReactWrapperModule {
4174
4019
  constructor() {
4175
4020
  super(...arguments);
4176
4021
  this.actionOptionOrientation = 'DROPDOWN';
4022
+ this.dataQueryFilters = [];
4177
4023
  this.isButtonLoading = false;
4178
4024
  this.filterRootOrgUnit = false;
4179
4025
  this.showFilters = false;