@@ -375,7 +375,7 @@ export const NeoCustomReportActionsModal = ({
375
375
const td2Styling = ( type ) => ( { width : type === 'bar' ? '15%' : '30%' } ) ;
376
376
const td2DropdownClassname = ( type ) => `n-align-middle n-pr-1 ${ type === 'bar' ? 'n-w-full' : 'n-w-2/5' } ` ;
377
377
const td2Autocomplete = ( type , index , rule ) =>
378
- type !== 'bar' && rule . condition !== 'rowCheck' ? (
378
+ ( type !== 'bar' && rule . condition !== 'rowCheck' ? (
379
379
< Autocomplete
380
380
className = 'n-align-middle n-inline-block n-w-/5'
381
381
disableClearable = { true }
@@ -406,7 +406,7 @@ export const NeoCustomReportActionsModal = ({
406
406
/>
407
407
) : (
408
408
< > </ >
409
- ) ;
409
+ ) ) ;
410
410
const td4Styling = ( type ) => ( { width : type === 'bar' ? '45%' : '40%' } ) ;
411
411
const td4DropdownClassname = 'n-align-middle, n-w-1/3' ;
412
412
const td6Styling = ( type ) => ( { width : type === 'bar' ? '30%' : '20%' } ) ;
@@ -577,114 +577,115 @@ export const NeoCustomReportActionsModal = ({
577
577
</ td >
578
578
</ tr >
579
579
</ table >
580
+ { rules . some ( ( rule ) => rule ?. condition === 'rowCheck' ) && (
581
+ < table >
582
+ < tr >
583
+ < td colSpan = { 7 } >
584
+ < tr >
585
+ < th colSpan = { 7 } className = 'n-text-center n-font-bold n-py-2' >
586
+ Report Pre Conditions
587
+ </ th >
588
+ </ tr >
589
+ </ td >
590
+ </ tr >
591
+ { preConditions . map ( ( con , i ) => {
592
+ return (
593
+ < tr >
594
+ < td width = '2.5%' className = 'n-pr-1' >
595
+ < span className = 'n-pr-1' > { i + 1 } .</ span >
596
+ < span className = 'n-font-bold' > IF</ span >
597
+ </ td >
598
+ < td width = '100%' >
599
+ < div style = { { border : '2px dashed grey' } } className = 'n-p-1' >
600
+ < Autocomplete
601
+ className = 'n-align-middle n-inline-block n-w-5/12 n-pr-1'
602
+ disableClearable = { true }
603
+ id = { `autocomplete-label-type${ i } ` }
604
+ size = 'small'
605
+ noOptionsText = '*Specify an exact field name'
606
+ options = { createFieldVariableSuggestions ( null , null , null ) . filter ( ( e ) =>
607
+ e . toLowerCase ( ) . includes ( con . field . toLowerCase ( ) )
608
+ ) }
609
+ value = { con . field ? con . field : '' }
610
+ inputValue = { con . field ? con . field : '' }
611
+ popupIcon = { < > </ > }
612
+ style = { { minWidth : 125 } }
613
+ onInputChange = { ( event , value ) => {
614
+ updatePreConditionFieldById ( i , 'field' , value ) ;
615
+ } }
616
+ onChange = { ( event , newValue ) => {
617
+ updatePreConditionFieldById ( i , 'field' , newValue ) ;
618
+ } }
619
+ renderInput = { ( params ) => (
620
+ < TextField
621
+ { ...params }
622
+ placeholder = 'Field name...'
623
+ InputLabelProps = { { shrink : true } }
624
+ style = { { padding : '6px 0 7px' } }
625
+ size = { 'small' }
626
+ />
627
+ ) }
628
+ />
629
+ < Dropdown
630
+ type = 'select'
631
+ className = 'n-align-middle n-w-2/12 n-pr-1'
632
+ selectProps = { {
633
+ onChange : ( newValue ) => updatePreConditionFieldById ( i , 'condition' , newValue ?. value ) ,
634
+ options : PRE_CONDITIONS_RULES . map ( ( option ) => ( {
635
+ label : option . label ,
636
+ value : option . value ,
637
+ } ) ) ,
638
+ value : { label : con . condition , value : con . condition } ,
639
+ } }
640
+ style = { { minWidth : 70 , display : 'inline-block' } }
641
+ fluid
642
+ />
643
+ < TextInput
644
+ className = 'n-align-middle n-inline-block n-w-5/12'
645
+ style = { { minWidth : 100 } }
646
+ placeholder = 'Value...'
647
+ value = { con . value }
648
+ onChange = { ( e ) => updatePreConditionFieldById ( i , 'value' , e . target . value ) }
649
+ fluid
650
+ > </ TextInput >
651
+ </ div >
652
+ </ td >
580
653
581
- < table >
582
- < tr >
583
- < td colSpan = { 7 } >
584
- < tr >
585
- < th colSpan = { 7 } className = 'n-text-center n-font-bold n-py-2' >
586
- Report Pre Conditions
587
- </ th >
588
- </ tr >
589
- </ td >
590
- </ tr >
591
- { preConditions . map ( ( con , i ) => {
592
- return (
593
- < tr >
594
- < td width = '2.5%' className = 'n-pr-1' >
595
- < span className = 'n-pr-1' > { i + 1 } .</ span >
596
- < span className = 'n-font-bold' > IF</ span >
597
- </ td >
598
- < td width = '100%' >
599
- < div style = { { border : '2px dashed grey' } } className = 'n-p-1' >
600
- < Autocomplete
601
- className = 'n-align-middle n-inline-block n-w-5/12 n-pr-1'
602
- disableClearable = { true }
603
- id = { `autocomplete-label-type${ i } ` }
604
- size = 'small'
605
- noOptionsText = '*Specify an exact field name'
606
- options = { createFieldVariableSuggestions ( null , null , null ) . filter ( ( e ) =>
607
- e . toLowerCase ( ) . includes ( con . field . toLowerCase ( ) )
608
- ) }
609
- value = { con . field ? con . field : '' }
610
- inputValue = { con . field ? con . field : '' }
611
- popupIcon = { < > </ > }
612
- style = { { minWidth : 125 } }
613
- onInputChange = { ( event , value ) => {
614
- updatePreConditionFieldById ( i , 'field' , value ) ;
615
- } }
616
- onChange = { ( event , newValue ) => {
617
- updatePreConditionFieldById ( i , 'field' , newValue ) ;
618
- } }
619
- renderInput = { ( params ) => (
620
- < TextField
621
- { ...params }
622
- placeholder = 'Field name...'
623
- InputLabelProps = { { shrink : true } }
624
- style = { { padding : '6px 0 7px' } }
625
- size = { 'small' }
626
- />
627
- ) }
628
- />
629
- < Dropdown
630
- type = 'select'
631
- className = 'n-align-middle n-w-2/12 n-pr-1'
632
- selectProps = { {
633
- onChange : ( newValue ) => updatePreConditionFieldById ( i , 'condition' , newValue ?. value ) ,
634
- options : PRE_CONDITIONS_RULES . map ( ( option ) => ( {
635
- label : option . label ,
636
- value : option . value ,
637
- } ) ) ,
638
- value : { label : con . condition , value : con . condition } ,
654
+ < td width = '5%' >
655
+ < IconButton
656
+ aria-label = 'remove rule'
657
+ size = 'medium'
658
+ style = { { marginLeft : 10 } }
659
+ floating
660
+ onClick = { ( ) => {
661
+ setPreConditions ( ( prevItems ) => prevItems . filter ( ( _ , j ) => j !== i ) ) ;
639
662
} }
640
- style = { { minWidth : 70 , display : 'inline-block' } }
641
- fluid
642
- />
643
- < TextInput
644
- className = 'n-align-middle n-inline-block n-w-5/12'
645
- style = { { minWidth : 100 } }
646
- placeholder = 'Value...'
647
- value = { con . value }
648
- onChange = { ( e ) => updatePreConditionFieldById ( i , 'value' , e . target . value ) }
649
- fluid
650
- > </ TextInput >
651
- </ div >
652
- </ td >
653
-
654
- < td width = '5%' >
663
+ >
664
+ < XMarkIconOutline />
665
+ </ IconButton >
666
+ </ td >
667
+ </ tr >
668
+ ) ;
669
+ } ) }
670
+
671
+ < tr >
672
+ < td colSpan = { 7 } >
673
+ < div className = 'n-text-center n-mt-1' >
655
674
< IconButton
656
- aria-label = 'remove rule '
675
+ aria-label = 'add '
657
676
size = 'medium'
658
- style = { { marginLeft : 10 } }
659
677
floating
660
678
onClick = { ( ) => {
661
- setPreConditions ( ( prevItems ) => prevItems . filter ( ( _ , j ) => j !== i ) ) ;
679
+ setPreConditions ( [ ... preConditions , defaultPreCondition ] ) ;
662
680
} }
663
681
>
664
- < XMarkIconOutline />
682
+ < PlusIconOutline />
665
683
</ IconButton >
666
- </ td >
667
- </ tr >
668
- ) ;
669
- } ) }
670
-
671
- < tr >
672
- < td colSpan = { 7 } >
673
- < div className = 'n-text-center n-mt-1' >
674
- < IconButton
675
- aria-label = 'add'
676
- size = 'medium'
677
- floating
678
- onClick = { ( ) => {
679
- setPreConditions ( [ ...preConditions , defaultPreCondition ] ) ;
680
- } }
681
- >
682
- < PlusIconOutline />
683
- </ IconButton >
684
- </ div >
685
- </ td >
686
- </ tr >
687
- </ table >
684
+ </ div >
685
+ </ td >
686
+ </ tr >
687
+ </ table >
688
+ ) }
688
689
</ div >
689
690
</ Dialog . Content >
690
691
< Dialog . Actions >
0 commit comments