Skip to content

Commit

Permalink
added filter condition to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
SteRiccio committed Jul 3, 2024
1 parent e1286dc commit 22fba15
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 45 deletions.
3 changes: 2 additions & 1 deletion collect-webapp/frontend/public/assets/locales/labels_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,11 @@
},
"exportToCollectFormat": "Export to Collect Format",
"filter": "Filter",
"filterCondition": "Filter condition",
"mode": {
"label": "Export mode",
"allEntities": "All entities",
"onlySelectedEntities": "Only selected entities"
"selectedEntities": "Only selected entities"
},
"modifiedSince": "Modified since",
"modifiedUntil": "until",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ const defaultState = {
languageCode: '',
includeGroupingLabels: true,
includeImages: false,
<<<<<<< Updated upstream
alwaysEvaluateCalculatedAttributes: false,
=======
filterCondition: '',
>>>>>>> Stashed changes
}

class CsvDataExportPage extends Component {
Expand Down Expand Up @@ -125,6 +129,7 @@ class CsvDataExportPage extends Component {
alwaysGenerateZipFile: true,
keyAttributeValues,
summaryAttributeValues,
filterCondition,
}

additionalOptions.forEach((o) => {
Expand Down Expand Up @@ -200,6 +205,7 @@ class CsvDataExportPage extends Component {
modifiedUntil,
headingSource,
languageCode,
filterCondition,
} = this.state

const additionalOptionsFormGroups = additionalOptions
Expand Down Expand Up @@ -267,27 +273,21 @@ class CsvDataExportPage extends Component {
</Label>
<Col md={10}>
<FormGroup check>
<Label check>
<Input
type="radio"
value={outputFormats.CSV}
name="outputFormat"
checked={outputFormat === outputFormats.CSV}
onChange={this.handleOutputFormatChange}
/>
{L.l('dataManagement.export.outputFormat.csv')}
</Label>
<span style={{ display: 'inline-block', width: '40px' }}></span>
<Label check>
<Input
type="radio"
value={outputFormats.XLSX}
name="outputFormat"
checked={outputFormat === outputFormats.XLSX}
onChange={this.handleOutputFormatChange}
/>
{L.l('dataManagement.export.outputFormat.xlsx')}
</Label>
{Object.values(outputFormats).map((of) => (
<>
<Label check>
<Input
type="radio"
value={of}
name="outputFormat"
checked={outputFormat === of}
onChange={this.handleOutputFormatChange}
/>
{L.l(`dataManagement.export.outputFormat.${of.toLocaleLowerCase()}`)}
</Label>
<span style={{ display: 'inline-block', width: '40px' }}></span>
</>
))}
</FormGroup>
</Col>
</FormGroup>
Expand All @@ -314,27 +314,21 @@ class CsvDataExportPage extends Component {
</Label>
<Col md={10}>
<FormGroup check>
<Label check>
<Input
type="radio"
value={exportModes.allEntities}
name="exportMode"
checked={exportMode === exportModes.allEntities}
onChange={(event) => this.setState({ ...this.state, exportMode: event.target.value })}
/>
{L.l('dataManagement.export.mode.allEntities')}
</Label>
<span style={{ display: 'inline-block', width: '40px' }}></span>
<Label check>
<Input
type="radio"
value={exportModes.selectedEntity}
name="exportMode"
checked={exportMode === exportModes.selectedEntity}
onChange={(event) => this.setState({ ...this.state, exportMode: event.target.value })}
/>
{L.l('dataManagement.export.mode.onlySelectedEntities')}
</Label>
{Object.values(exportModes).map((mode) => (
<>
<Label check>
<Input
type="radio"
value={mode}
name="exportMode"
checked={exportMode === mode}
onChange={(e) => this.setState({ ...this.state, exportMode: e.target.value })}
/>
{L.l(`dataManagement.export.mode.${mode}`)}
</Label>
<span style={{ display: 'inline-block', width: '40px' }}></span>
</>
))}
</FormGroup>
</Col>
</FormGroup>
Expand All @@ -357,9 +351,9 @@ class CsvDataExportPage extends Component {
<Label check>
<Input
type="checkbox"
onChange={(event) => this.setState({ exportOnlyOwnedRecords: event.target.checked })}
onChange={(e) => this.setState({ exportOnlyOwnedRecords: e.target.checked })}
checked={exportOnlyOwnedRecords}
/>{' '}
/>
{L.l('dataManagement.export.onlyOwnedRecords')}
</Label>
</FormGroup>
Expand Down Expand Up @@ -391,6 +385,15 @@ class CsvDataExportPage extends Component {
</FormGroup>
{keyAttributeFormGroups}
{summaryFormGroups}
<FormGroup check row>
<Label check>
<Input
onChange={(e) => this.setState({ filterCondition: e.target.value })}
value={filterCondition}
/>
{L.l('dataManagement.export.filterCondition')}
</Label>
</FormGroup>
</div>
</AccordionDetails>
</Accordion>
Expand Down

0 comments on commit 22fba15

Please sign in to comment.