From 938491e1e0fa23d31ad09115ded8974303499917 Mon Sep 17 00:00:00 2001 From: dinushara Date: Mon, 2 Mar 2020 10:09:59 +0530 Subject: [PATCH 1/8] add similar inquiry --- frontend/package-lock.json | 76 ++++-- frontend/src/api/incident.js | 88 +++---- .../components/IncidentFormInternal.js | 157 +++++++++---- .../components/IncidentSummaryView.js | 218 +++++++++--------- .../components/SearchForm.js | 83 +++++-- 5 files changed, 389 insertions(+), 233 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a9296e99..15225287 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -5209,7 +5209,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -5227,11 +5228,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5244,15 +5247,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -5355,7 +5361,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -5365,6 +5372,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5377,17 +5385,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -5404,6 +5415,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -5476,7 +5488,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -5486,6 +5499,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5561,7 +5575,8 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -5591,6 +5606,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -5608,6 +5624,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -5646,11 +5663,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.3", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -16838,7 +16857,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -16862,6 +16882,7 @@ "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -16874,7 +16895,8 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -16883,7 +16905,8 @@ }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -16986,7 +17009,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -16996,6 +17020,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -17008,17 +17033,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -17035,6 +17063,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -17107,7 +17136,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -17117,6 +17147,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -17192,7 +17223,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -17222,6 +17254,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -17239,6 +17272,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -17277,11 +17311,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } } diff --git a/frontend/src/api/incident.js b/frontend/src/api/incident.js index 1d49ce84..bc213a10 100644 --- a/frontend/src/api/incident.js +++ b/frontend/src/api/incident.js @@ -1,11 +1,13 @@ -import moment from "moment"; +import * as mockapi from "../data/mockapi"; + import handler from "./apiHandler"; +import moment from "moment"; /* * mock API for Incidents */ -import * as mockapi from "../data/mockapi"; + export const createIncident = async incidentData => { // return mockapi.createIncident(incidentData); @@ -13,63 +15,71 @@ export const createIncident = async incidentData => { }; export const getIncident = async (incidentId) => { - return (await handler.get(`/incidents/${incidentId}`)).data; + return (await handler.get(`/incidents/${incidentId}`)).data; }; -export const getIncidents = async (filters, page=1) => { - var query = "page=" + page; +export const getIncidents = async (filters, page = 1) => { + var query = "page=" + page; + + if (filters.textSearch) { + query += "&q=" + filters.textSearch; + } + + if (filters.severity) { + query += "&severity=" + filters.severity; + } - if(filters.textSearch){ - query += "&q=" + filters.textSearch; - } + if (filters.status) { + query += "&status=" + filters.status; + } - if(filters.severity){ - query += "&severity=" + filters.severity; - } + if (filters.maxResponseTime) { + query += "&response_time=" + filters.maxResponseTime; + } - if(filters.status){ - query += "&status=" + filters.status; - } + if (filters.assignee) { + query += "&assignee=" + filters.assignee; + } - if(filters.maxResponseTime){ - query += "&response_time=" + filters.maxResponseTime; - } + if (filters.user_linked) { + query += "&user_linked=" + filters.user_linked; + } - if(filters.assignee){ - query += "&assignee=" + filters.assignee; - } + if (filters.ministry) { + query += "&ministry=" + filters.ministry; + } - if(filters.user_linked){ - query += "&user_linked=" + filters.user_linked; - } + if (filters.organization) { + query += "&organization=" + filters.organization; + } - if(filters.startTime && filters.endTime){ - const startDate = moment(filters.startTime).format("YYYY-MM-DD HH:mm"); - const endDate = moment(filters.endTime).format("YYYY-MM-DD HH:mm"); - query += "&start_date=" + startDate + "&end_date=" + endDate; - } + if (filters.startTime && filters.endTime) { + const startDate = moment(filters.startTime).format("YYYY-MM-DD HH:mm"); + const endDate = moment(filters.endTime).format("YYYY-MM-DD HH:mm"); + query += "&start_date=" + startDate + "&end_date=" + endDate; + } - if(filters.export){ - query += "&export=" + filters.export; - } + if (filters.export) { + query += "&export=" + filters.export; + } - if(filters.show_closed){ - query += "&show_closed=" + filters.show_closed; - } + if (filters.show_closed) { + query += "&show_closed=" + filters.show_closed; + } - return (await handler.get(`/incidents/?${query}`)).data; + return (await handler.get(`/incidents/?${query}`)).data; }; export const updateIncident = async (incidentId, incidentData) => { - return (await handler.put(`/incidents/${incidentId}`, incidentData)).data; + return (await handler.put(`/incidents/${incidentId}`, incidentData)).data; }; export const getReporter = async (reporterId) => { - return (await handler.get(`/reporters/${reporterId}`)).data; + return (await handler.get(`/reporters/${reporterId}`)).data; }; export const updateReporter = async (reporterId, reporterData) => { - return (await handler.put(`/reporters/${reporterId}`, reporterData)).data; + return (await handler.put(`/reporters/${reporterId}`, reporterData)).data; } export const changeStatus = async (incidentId, status) => { @@ -89,7 +99,7 @@ export const escallateIncident = async (incidentId) => { }; export const updateIncidentWorkflow = async (incidentId, workflowType, workflowUpdate) => { - return (await handler.post(`/incidents/${incidentId}/workflow/${workflowType}`, workflowUpdate) ).data; + return (await handler.post(`/incidents/${incidentId}/workflow/${workflowType}`, workflowUpdate)).data; }; export const uploadFile = async (incidentId, formData) => { diff --git a/frontend/src/incident-filing/components/IncidentFormInternal.js b/frontend/src/incident-filing/components/IncidentFormInternal.js index 7a9e1811..d6bd4915 100644 --- a/frontend/src/incident-filing/components/IncidentFormInternal.js +++ b/frontend/src/incident-filing/components/IncidentFormInternal.js @@ -1,65 +1,69 @@ -import React, { Component, useState, useEffect } from 'react'; -import { connect, useSelector, useDispatch } from 'react-redux' -import { withRouter } from "react-router"; -import { withStyles } from '@material-ui/core/styles'; -import { Formik } from 'formik'; import * as Yup from 'yup'; -import FormHelperText from '@material-ui/core/FormHelperText'; - -import InputLabel from '@material-ui/core/InputLabel'; -import Paper from '@material-ui/core/Paper'; -import Grid from '@material-ui/core/Grid'; -import TextField from '@material-ui/core/TextField'; -import Radio from '@material-ui/core/Radio'; -import RadioGroup from '@material-ui/core/RadioGroup'; -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import FormControl from '@material-ui/core/FormControl'; -import FormLabel from '@material-ui/core/FormLabel'; -import Select from '@material-ui/core/Select'; -import MenuItem from '@material-ui/core/MenuItem'; -import Button from '@material-ui/core/Button'; -import Snackbar from '@material-ui/core/Snackbar'; -import Typography from '@material-ui/core/Typography'; -import Checkbox from '@material-ui/core/Checkbox'; -import ExpansionPanel from '@material-ui/core/ExpansionPanel'; -import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'; -import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'; -import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; -import MaterialTable from "material-table"; -import DialogTitle from '@material-ui/core/DialogTitle'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogActions from '@material-ui/core/DialogActions'; -import Dialog from '@material-ui/core/Dialog'; -import DialogContentText from '@material-ui/core/DialogContentText'; - -import red from '@material-ui/core/colors/red'; -import orange from '@material-ui/core/colors/orange'; -import yellow from '@material-ui/core/colors/yellow'; +import * as incidentUtils from '../../incident/incidentUtils'; +import React, { Component, useEffect, useState } from 'react'; +import { connect, useDispatch, useSelector } from 'react-redux' +import { createInternalIncident, loadIncident, updateInternalIncident } from '../../incident/state/incidentActions'; import { - fetchChannels, - fetchElections, fetchCategories, - fetchProvinces, + fetchChannels, fetchDistricts, fetchDivisionalSecretariats, + fetchElections, fetchGramaNiladharis, - fetchPollingDivisions, + fetchPoliceDivisions, fetchPoliceStations, + fetchPoliticalParties, + fetchPollingDivisions, fetchPollingStations, - fetchPoliceDivisions, + fetchProvinces, fetchWards, resetActiveIncident, - fetchPoliticalParties, } from '../../shared/state/sharedActions'; + +import Button from '@material-ui/core/Button'; +import Card from '@material-ui/core/Card'; +import CardActions from '@material-ui/core/CardActions'; +import CardContent from '@material-ui/core/CardContent'; +import CardHeader from '@material-ui/core/CardHeader'; +import Checkbox from '@material-ui/core/Checkbox'; +import Dialog from '@material-ui/core/Dialog'; +import DialogActions from '@material-ui/core/DialogActions'; +import DialogContent from '@material-ui/core/DialogContent'; +import DialogContentText from '@material-ui/core/DialogContentText'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; +import ExpansionPanel from '@material-ui/core/ExpansionPanel'; +import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'; +import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'; +import FileUploader from '../../files/components/FilePicker'; +import FormControl from '@material-ui/core/FormControl'; +import FormControlLabel from '@material-ui/core/FormControlLabel'; +import FormHelperText from '@material-ui/core/FormHelperText'; +import FormLabel from '@material-ui/core/FormLabel'; +import { Formik } from 'formik'; +import Grid from '@material-ui/core/Grid'; +import InputLabel from '@material-ui/core/InputLabel'; import IntlSelect from './IntlSelect'; +import MaterialTable from "material-table"; +import MenuItem from '@material-ui/core/MenuItem'; +import Paper from '@material-ui/core/Paper'; +import Radio from '@material-ui/core/Radio'; +import RadioGroup from '@material-ui/core/RadioGroup'; +import Select from '@material-ui/core/Select'; +import Snackbar from '@material-ui/core/Snackbar'; +import TelephoneInput from './TelephoneInput'; +import TextField from '@material-ui/core/TextField'; +import Typography from '@material-ui/core/Typography'; +import { getIncidents } from '../../api/incident'; import moment from 'moment'; -import FileUploader from '../../files/components/FilePicker'; +import orange from '@material-ui/core/colors/orange'; +import red from '@material-ui/core/colors/red'; import { showNotification } from '../../notifications/state/notifications.actions'; -import TelephoneInput from './TelephoneInput'; import { useLoadingStatus } from '../../loading-spinners/loadingHook' -import { createInternalIncident, loadIncident, updateInternalIncident } from '../../incident/state/incidentActions'; -import * as incidentUtils from '../../incident/incidentUtils'; +import { withRouter } from "react-router"; +import { withStyles } from '@material-ui/core/styles'; +import yellow from '@material-ui/core/colors/yellow'; const styles = theme => ({ root: { @@ -114,6 +118,23 @@ const styles = theme => ({ "& div": { padding: "0 3px" } + }, + cardRoot: { + cursor: 'grab', + background: '#e0e0e0', + marginBottom: '10px', + marginTop: '10px', + '&:hover': { + background: "#3f51b5", + }, + }, + cardText: { + fontSize: 18, + fontWeight: '400', + color: 'black' + }, + cardContent: { + padding: '10px !important', } }) @@ -121,6 +142,7 @@ function IncidentFormInternal(props) { const dispatch = useDispatch(); + const [similarIncidents, setSimilarIncidents] = useState([]); const { incident, reporter, @@ -137,7 +159,7 @@ function IncidentFormInternal(props) { wards, elections, politicalParties, - } = useSelector(state=>state.shared) + } = useSelector(state => state.shared) const [state, setState] = useState({ incidentType: "COMPLAINT", @@ -176,6 +198,7 @@ function IncidentFormInternal(props) { injuredParties: [], respondents: [], detainedVehicles: [], + similarInquiry: [], // police info nature_of_incident: "", @@ -194,6 +217,14 @@ function IncidentFormInternal(props) { }) + const getSimilarInquiries = async (title) => { + if (title.length > 2) { + const response = await getIncidents({ title: title }, 1); + setSimilarIncidents(response.data.incidents); + } else { + setSimilarIncidents([]); + } + } useEffect(() => { @@ -282,7 +313,7 @@ function IncidentFormInternal(props) { "reporterAddress": reporter.address }); } -//TODO: Need to split the date values to date and time + //TODO: Need to split the date values to date and time if (initData.occured_date) { initData.occured_date = moment(initData.occured_date).format("YYYY-MM-DDTHH:mm") @@ -326,6 +357,7 @@ function IncidentFormInternal(props) { const customValidations = (values) => { + console.log(values) //date time is validated here since it has to be compared with the occurrence. //cannot do this with yup. let errors = {} @@ -418,7 +450,7 @@ function IncidentFormInternal(props) { onSubmit={(e) => { e.preventDefault() if (!isValid) { - dispatch(showNotification({ message:"Missing required values" }, null)) + dispatch(showNotification({ message: "Missing required values" }, null)) window.scroll(0, 0) } handleSubmit(e) @@ -491,12 +523,35 @@ function IncidentFormInternal(props) { placeholder="Title" className={classes.textField} value={values.title} - onChange={handleChange} + onChange={(event) => { handleChange(event); getSimilarInquiries(event.target.value); }} onBlur={handleBlur} error={touched.title && errors.title} helperText={touched.title ? errors.title : null} /> + {similarIncidents && similarIncidents.length > 0 && + Similar Inquiries + {similarIncidents.map((incident, index) => { + return ( + { window.open(`https://incidents.ecdev.opensource.lk/app/review/${incident.id}`) }}> + + + + Title: {incident.title} + Date: {moment(incident.occured_date).format('MMMM Do YYYY, h:mm:ss a')} + Location: {incident.location} + + Description: {incident.description} + {/* Title: {incident.title}      Date: {incident.occured_date}     Location: {incident.location} */} + + + + ) + })} + } - + ({ // dictionary map for occurrence const occurrence = { - "OCCURRED" : "Occurred", - "OCCURRING" : "Occurring", - "WILL_OCCUR" : "Will Occur" + "OCCURRED": "Occurred", + "OCCURRING": "Occurring", + "WILL_OCCUR": "Will Occur" } /** * Basic Information TabView - (1) */ -function BasicDetailTab(props){ +function BasicDetailTab(props) { const { classes, incident, elections, categories, channels } = props; return ( @@ -81,21 +81,21 @@ function BasicDetailTab(props){ Occurrence - { occurrence[incident.occurrence] } + {occurrence[incident.occurrence]} Incident Date - - { (incident.occured_date) ? {incident.occured_date} : "No date set" } - + + {(incident.occured_date) ? {incident.occured_date} : "No date set"} + Incident Time - - { (incident.occured_date) ? {incident.occured_date} : "No time set" } + + {(incident.occured_date) ? {incident.occured_date} : "No time set"} @@ -122,8 +122,8 @@ function BasicDetailTab(props){ Election - - { elections.map((value, index)=>(value.code===incident.election?value.name:null)) } + + {elections.map((value, index) => (value.code === incident.election ? value.name : null))} @@ -131,9 +131,9 @@ function BasicDetailTab(props){ Category - - { categories.map((value, index)=>(value.id==incident.category?value.sub_category:null)) } - + + {categories.map((value, index) => (value.id == incident.category ? value.sub_category : null))} + {/* Sub Category @@ -144,8 +144,8 @@ function BasicDetailTab(props){ Received Mode - - { channels.map((value, index)=>(value.id==incident.infoChannel?value.name:null)) } + + {channels.map((value, index) => (value.id == incident.infoChannel ? value.name : null))} @@ -159,10 +159,10 @@ function BasicDetailTab(props){ ); } -const resolveLocationName = (locationId, locatoinData )=> { - if(locationId && locatoinData.byCode[locationId]){ - return locatoinData.byCode[locationId].name - }else{ +const resolveLocationName = (locationId, locatoinData) => { + if (locationId && locatoinData.byCode[locationId]) { + return locatoinData.byCode[locationId].name + } else { return "" } } @@ -170,7 +170,7 @@ const resolveLocationName = (locationId, locatoinData )=> { /** * Location Information TabView - (2) */ -function LocationTab(props){ +function LocationTab(props) { const { classes, incident, provinces, districts, pollingDivisions, policeStations } = props; @@ -212,11 +212,11 @@ function LocationTab(props){ Province - + { - incident.province && provinces.byCode[incident.province] ? - provinces.byCode[incident.province].name : "" - } + incident.province && provinces.byCode[incident.province] ? + provinces.byCode[incident.province].name : "" + } @@ -224,11 +224,11 @@ function LocationTab(props){ District - + { - incident.district && districts.byCode[incident.district] ? - districts.byCode[incident.district].name : "" - } + incident.district && districts.byCode[incident.district] ? + districts.byCode[incident.district].name : "" + } @@ -268,7 +268,7 @@ function LocationTab(props){ /** * Contact Information TabView - (3) */ -function ContactTab(props){ +function ContactTab(props) { const { classes, reporter } = props; @@ -324,7 +324,7 @@ function ContactTab(props){ /** * Review Summary TabView - (4) */ -function PoliceTab(props){ +function PoliceTab(props) { const { classes, incident } = props; return ( @@ -338,83 +338,83 @@ function PoliceTab(props){ Injured Parties {incident.injuredParties && - - - - - Name - Address - Political Affliation - - - - {incident.injuredParties.map((p) => ( - - {p.name} - {p.address} - {p.political_affliation} + +
+ + + Name + Address + Political Affliation - ))} - -
-
+ + + {incident.injuredParties.map((p) => ( + + {p.name} + {p.address} + {p.political_affliation} + + ))} + + +
}
- + Respondents {incident.respondents && - - - - - Name - Address - Political Affliation - - - - {incident.respondents.map((p) => ( - - {p.name} - {p.address} - {p.political_affliation} + +
+ + + Name + Address + Political Affliation - ))} - -
-
+ + + {incident.respondents.map((p) => ( + + {p.name} + {p.address} + {p.political_affliation} + + ))} + + +
}
- + Detaine Vehicles {incident.detainedVehicles && - - - - - Vehicle Number - Government / Private - - - - {incident.detainedVehicles.map((p) => ( - - {p.vehicle_no} - {p.ownership === "government" ? "Government" : "Private"} + +
+ + + Vehicle Number + Government / Private - ))} - -
-
+ + + {incident.detainedVehicles.map((p) => ( + + {p.vehicle_no} + {p.ownership === "government" ? "Government" : "Private"} + + ))} + + +
} -
+ @@ -422,10 +422,10 @@ function PoliceTab(props){ ); } -function SummaryTabView(props){ +function SummaryTabView(props) { const { - classes, incident, reporter, elections, category, + classes, incident, reporter, elections, category, provinces, districts, divisionalSecretariats, gramaNiladharis, @@ -433,7 +433,7 @@ function SummaryTabView(props){ pollingStations, policeStations, policeDivisions, - categories, + categories, channels } = props @@ -448,22 +448,22 @@ function SummaryTabView(props){ - {currentTab === 0 && + {currentTab === 0 && } - {currentTab === 1 && + {currentTab === 1 && } {currentTab === 2 && } {currentTab === 3 && } diff --git a/frontend/src/ongoing-incidents/components/SearchForm.js b/frontend/src/ongoing-incidents/components/SearchForm.js index 51b04e2e..96aa5492 100644 --- a/frontend/src/ongoing-incidents/components/SearchForm.js +++ b/frontend/src/ongoing-incidents/components/SearchForm.js @@ -1,23 +1,23 @@ +import { Formik, withFormik } from "formik"; import React, { useEffect } from "react"; -import { Formik, withFormik } from "formik"; -import Select from "@material-ui/core/Select"; -import MenuItem from "@material-ui/core/MenuItem"; +import Button from "@material-ui/core/Button"; +import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; +import ExpansionPanel from "@material-ui/core/ExpansionPanel"; +import ExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails"; +import ExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary"; import FormControl from "@material-ui/core/FormControl"; +import Grid from "@material-ui/core/Grid"; import Input from "@material-ui/core/Input"; import InputLabel from "@material-ui/core/InputLabel"; +import MenuItem from "@material-ui/core/MenuItem"; +import SearchIcon from "@material-ui/icons/Search"; +import Select from "@material-ui/core/Select"; import TextField from "@material-ui/core/TextField"; -import Button from "@material-ui/core/Button"; -import Grid from "@material-ui/core/Grid"; +import Typography from "@material-ui/core/Typography"; import moment from "moment"; +import { useSelector } from 'react-redux' import { withStyles } from "@material-ui/core/styles"; -import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import SearchIcon from "@material-ui/icons/Search"; - -import ExpansionPanel from "@material-ui/core/ExpansionPanel"; -import ExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary"; -import ExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails"; -import Typography from "@material-ui/core/Typography"; const styles = theme => ({ root: { @@ -82,7 +82,8 @@ function SearchForm(props) { filterIncidents(); }, []); const { classes, categories } = props; - const severityValues = Array(10).fill(0).map((e,i)=>i+1); + const organizations = useSelector(state => state.user.organizations); + const severityValues = Array(10).fill(0).map((e, i) => i + 1); console.log(props); return ( {severityValues.map((val) => ( {val} - ))} + ))} @@ -289,6 +290,60 @@ function SearchForm(props) { onChange={handleChange} /> + + + Ministry + + + + + + Organization + + + {/* Reset workflow is pending