Skip to content

Commit

Permalink
Merge pull request #311 from digitalgreenorg/FSPROD-1001
Browse files Browse the repository at this point in the history
Fsprod 1001
  • Loading branch information
i-am-waseem authored Nov 9, 2022
2 parents 2f2a999 + 4d1314f commit 279c571
Show file tree
Hide file tree
Showing 11 changed files with 574 additions and 320 deletions.
4 changes: 4 additions & 0 deletions src/Components/Datasets/DataSetForm.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
float: left;
/*margin-left: 20%;*/
margin-top: 3%;
margin-bottom: 3%;
}
.datasetform .name {
width: 100%;
Expand Down Expand Up @@ -144,6 +145,9 @@
.datasetform .notavaiable {
margin-left: 13%;
}
.datasetform .private {
margin-left: 15%
}
.datasetupload {
background: #ffffff;
border: 1px dashed #d8af28;
Expand Down
76 changes: 49 additions & 27 deletions src/Components/Datasets/DataSetForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ import { width } from "@mui/system";

export default function DataSetForm(props) {
const [screenlabels, setscreenlabels] = useState(labels["en"]);
const fileTypes = ["csv", "xls", "xlsx"];
const privateFileTypes = ["csv", "xls", "xlsx"];
const publicFileTypes = privateFileTypes.concat([
"jpg",
"jpeg",
"pdf",
"png",
]);

return (
<Container className="datasetform">
Expand All @@ -31,6 +37,29 @@ export default function DataSetForm(props) {
<span className="AddDatasetmainheading">{props.title}</span>
</Col>
</Row>
<Row>
<Col xs={12} sm={12} md={12} lg={12} className="recordradiobtns">
<RadioGroup
row
aria-labelledby="demo-row-radio-buttons-group-label"
name="row-radio-buttons-group"
value={props.isPublic}
onChange={props.handleChangeIsPublic}
>
<FormControlLabel
value={true}
control={<Radio />}
label={screenlabels.dataset.public}
/>
<FormControlLabel
value={false}
control={<Radio />}
label={screenlabels.dataset.private}
className="private"
/>
</RadioGroup>
</Col>
</Row>
<Row>
<Col xs={12} sm={12} md={6} lg={6}>
<TextField
Expand Down Expand Up @@ -62,23 +91,6 @@ export default function DataSetForm(props) {
error={props.descriptionErrorMessage ? true : false}
helperText={props.descriptionErrorMessage}
/>

{/* <TextareaAutosize
className="description"
maxRows={4}
placeholder={screenlabels.dataset.description}
variant="filled"
defaultValue={props.reply}
maxLength={500}
width="100%"
onKeyDown={props.handledescriptionKeydown}
onChange={props.handleChangedescription}
style={{
border: "none !important",
"min-height": "50px",
"border-bottom": "1px solid #9AA1A9 !important",
}}
/> */}
</Col>
</Row>
<Row>
Expand Down Expand Up @@ -341,7 +353,8 @@ export default function DataSetForm(props) {
aria-labelledby="demo-row-radio-buttons-group-label"
name="row-radio-buttons-group"
value={props.value}
onChange={props.handleChange}>
onChange={props.handleChange}
>
<FormControlLabel
value="3 months"
control={<Radio />}
Expand Down Expand Up @@ -424,7 +437,8 @@ export default function DataSetForm(props) {
sm={12}
md={6}
lg={6}
className="FromDate addDatasetFromdate">
className="FromDate addDatasetFromdate"
>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<DatePicker
inputFormat="dd/MM/yyyy"
Expand All @@ -448,7 +462,8 @@ export default function DataSetForm(props) {
sm={12}
md={6}
lg={6}
className="toDate addDatasetTodate">
className="toDate addDatasetTodate"
>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<DatePicker
inputFormat="dd/MM/yyyy"
Expand Down Expand Up @@ -486,7 +501,8 @@ export default function DataSetForm(props) {
aria-labelledby="demo-row-radio-buttons-group-label"
name="row-radio-buttons-group"
value={props.recordsvalue}
onChange={props.handleChangeRecords}>
onChange={props.handleChangeRecords}
>
<FormControlLabel value="<100k" control={<Radio />} label="<100k" />
<FormControlLabel
value="100k-300k"
Expand Down Expand Up @@ -523,7 +539,8 @@ export default function DataSetForm(props) {
aria-labelledby="demo-row-radio-buttons-group-label"
name="row-radio-buttons-group"
value={props.availablevalue}
onChange={props.handleChangeAvailable}>
onChange={props.handleChangeAvailable}
>
<FormControlLabel
value="Available"
control={<Radio />}
Expand All @@ -550,10 +567,14 @@ export default function DataSetForm(props) {
<FileUploader
handleChange={props.handleFileChange}
name="file"
types={fileTypes}
types={props.isPublic ? publicFileTypes : privateFileTypes}
children={
<UploadDataset
uploaddes="Supports CSV and Excel file formats upto 2MB "
uploaddes={`Supports ${
props.isPublic
? "CSV, PDF, JPG, JPEG, PNG, XLS and XLSX file formats upto 50 MB"
: "CSV and XLSX file formats upto 2 MB "
}`}
uploadtitle="Upload Dataset"
/>
}
Expand All @@ -571,8 +592,9 @@ export default function DataSetForm(props) {
: ""}
</p>
<p className="oversizemb-uploadimglogo">
{props.file != null && props.file.size > 2097152
? "File uploaded is more than 2MB!"
{props.file != null &&
props.file.size > (props.isPublic ? 52428800 : 2097152)
? `File uploaded is more than ${props.isPublic ? 50 : 2} MB!`
: ""}
{props.fileValid}
</p>
Expand Down
Loading

0 comments on commit 279c571

Please sign in to comment.