forked from unicef-drp/GeoSight-OS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses field config and related table modal picker
- Loading branch information
Showing
7 changed files
with
143 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
django_project/frontend/src/pages/Admin/ContextLayer/StyleConfig/RelatedTable/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* GeoSight is UNICEF's geospatial web-based business intelligence platform. | ||
* | ||
* Contact : [email protected] | ||
* | ||
* .. note:: This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* __author__ = '[email protected]' | ||
* __date__ = '12/04/2024' | ||
* __copyright__ = ('Copyright 2024, Unicef') | ||
*/ | ||
|
||
/* ========================================================================== | ||
ARCGIS STYLE | ||
========================================================================== */ | ||
|
||
import React, { Fragment } from 'react'; | ||
import { Checkbox, FormControlLabel, FormGroup } from "@mui/material"; | ||
|
||
import FieldConfig from "../../../../../components/FieldConfig"; | ||
|
||
/** | ||
* Map Config component. | ||
*/ | ||
export default function RelatedTableConfig( | ||
{ | ||
originalData, | ||
setData, | ||
RelatedTableData, | ||
useOverride = false, | ||
useOverrideLabel = true | ||
} | ||
) { | ||
const data = JSON.parse(JSON.stringify(originalData)) | ||
|
||
const update = () => { | ||
setData({ ...data }) | ||
} | ||
return <Fragment> | ||
<div className='ArcgisConfig Fields'> | ||
{ | ||
useOverride ? | ||
<FormGroup> | ||
<FormControlLabel | ||
control={ | ||
<Checkbox | ||
checked={data?.override_field ? data?.override_field : false} | ||
onChange={evt => { | ||
setData({ | ||
...data, | ||
data_fields: RelatedTableData?.data?.fields, | ||
override_field: evt.target.checked | ||
}) | ||
}} /> | ||
} | ||
label="Override field config from default" /> | ||
</FormGroup> : null | ||
} | ||
{ | ||
(!useOverride || data.override_field) ? | ||
data.data_fields ? | ||
<Fragment> | ||
<div className='ArcgisConfigFields'> | ||
<FieldConfig | ||
data_fields={data.data_fields} | ||
update={(fields) => { | ||
data.data_fields = fields | ||
update() | ||
}} /> | ||
</div> | ||
</Fragment> : <div>Loading</div> : null | ||
} | ||
</div> | ||
</Fragment> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters