From 4990ee4109a5fd5c8c6fb1867f34a098d203fb93 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 27 Apr 2021 14:01:12 +0530 Subject: [PATCH 1/2] using city state data from single location --- src/containers/AddResources/index.jsx | 676 +------------------------- src/utils/resources.js | 45 ++ 2 files changed, 56 insertions(+), 665 deletions(-) create mode 100644 src/utils/resources.js diff --git a/src/containers/AddResources/index.jsx b/src/containers/AddResources/index.jsx index 05cdd52..25091cd 100644 --- a/src/containers/AddResources/index.jsx +++ b/src/containers/AddResources/index.jsx @@ -3,6 +3,8 @@ import { Autocomplete } from '@material-ui/lab'; import React, {useState} from 'react' import gql from 'graphql-tag'; import { useMutation } from '@apollo/client'; +import statesCitiesData from './../../utils/state-city-map'; +import resourceData from './../../utils/resources'; const useStyles = makeStyles( theme => ({ root: { @@ -34,663 +36,6 @@ const useStyles = makeStyles( theme => ({ } })); -const states = [ - 'Andhra Pradesh', - 'Arunachal Pradesh', - 'Assam', - 'Bihar', - 'Chandigarh', - 'Chhattisgarh', - 'Dadra And Nagar Haveli (Union Territory)', - 'Daman And Diu (Union Territory)', - 'Delhi (National Capital Territory)', - 'Goa', - 'Gujarat', - 'Haryana', - 'Himachal Pradesh', - 'Jammu And Kashmir (Union Territory)', - 'Jharkhand', - 'Karnataka', - 'Kerala', - 'Ladakh', - 'Madhya Pradesh', - 'Maharashtra', - 'Manipur', - 'Meghalaya', - 'Nagaland', - 'Odisha', - 'Pondicherry', - 'Punjab', - 'Rajasthan', - 'Sikkim', - 'Tamil Nadu', - 'Telangana', - 'Tripura', - 'Uttar Pradesh', - 'Uttarakhand', - 'West Bengal' -] - -const cities = { - "Andhra Pradesh": [ - 'Adoni', - 'Amaravati', - 'Anantapur', - 'Chandragiri', - 'Chittoor', - 'Dowlaiswaram', - 'Eluru', - 'Guntur', - 'Kadapa', - 'Kakinada', - 'Kurnool', - 'Machilipatnam', - 'Nagarjunakoṇḍa', - 'Rajahmundry', - 'Srikakulam', - 'Tirupati', - 'Vijayawada', - 'Visakhapatnam', - 'Vizianagaram', - 'Yemmiganur' - ], - 'Arunachal Pradesh': [ - 'Itanagar' - ], - 'Assam': [ - 'Dhuburi', - 'Dibrugarh', - 'Dispur', - 'Guwahati', - 'Jorhat', - 'Nagaon', - 'Sibsagar', - 'Silchar', - 'Tezpur', - 'Tinsukia', - ], - 'Bihar': [ - 'Ara', - 'Baruni', - 'Begusarai', - 'Bettiah', - 'Bhagalpur', - 'Bihar Sharif', - 'Bodh Gaya', - 'Buxar', - 'Chapra', - 'Darbhanga', - 'Dehri', - 'Dinapur Nizamat', - 'Gaya', - 'Hajipur', - 'Jamalpur', - 'Katihar', - 'Madhubani', - 'Motihari', - 'Munger', - 'Muzaffarpur', - 'Patna', - 'Purnia', - 'Pusa', - 'Saharsa', - 'Samastipur', - 'Sasaram', - 'Sitamarhi', - 'Siwan', - ], - 'Chandigarh': [ - 'Chandigarh' - ], - 'Chhattisgarh': [ - 'Ambikapur', - 'Bhilai', - 'Bilaspur', - 'Dhamtari', - 'Durg', - 'Jagdalpur', - 'Raipur', - 'Rajnandgaon', - ], - 'Dadra And Nagar Haveli (Union Territory)': [ - 'Silvassa' - ], - 'Daman And Diu (Union Territory)': [ - 'Daman', - 'Diu', - ], - 'Delhi (National Capital Territory)': [ - 'Old Delhi', - 'New Delhi', - ], - 'Goa': [ - 'Madgaon', - 'Panaji' - ], - 'Gujarat': [ - 'Ahmadabad', - 'Amreli', - 'Bharuch', - 'Bhavnagar', - 'Bhuj', - 'Dwarka', - 'Gandhinagar', - 'Godhra', - 'Jamnagar', - 'Junagadh', - 'Kandla', - 'Khambhat', - 'Kheda', - 'Mahesana', - 'Morvi', - 'Nadiad', - 'Navsari', - 'Okha', - 'Palanpur', - 'Patan', - 'Porbandar', - 'Rajkot', - 'Surat', - 'Surendranagar', - 'Valsad', - 'Veraval', - ], - 'Haryana': [ - 'Ambala', - 'Bhiwani', - 'Chandigarh', - 'Faridabad', - 'Firozpur Jhirka', - 'Gurgaon', - 'Hansi', - 'Hisar', - 'Jind', - 'Kaithal', - 'Karnal', - 'Kurukshetra', - 'Panipat', - 'Pehowa', - 'Rewari', - 'Rohtak', - 'Sirsa', - 'Sonipat', - ], - 'Himachal Pradesh': [ - 'Bilaspur', - 'Chamba', - 'Dalhousie', - 'Dharmshala', - 'Hamirpur', - 'Kangra', - 'Kullu', - 'Mandi', - 'Nahan', - 'Shimla', - 'Una', - ], - 'Jammu And Kashmir (Union Territory)': [ - 'Anantnag', - 'Baramula', - 'Doda', - 'Gulmarg', - 'Jammu', - 'Kathua', - 'Punch', - 'Rajauri', - 'Srinagar', - 'Udhampur', - ], - 'Jharkhand': [ - 'Bokaro', - 'Chaibasa', - 'Deoghar', - 'Dhanbad', - 'Dumka', - 'Giridih', - 'Hazaribag', - 'Jamshedpur', - 'Jharia', - 'Rajmahal', - 'Ranchi', - 'Saraikela', - ], - 'Karnataka': [ - 'Badami', - 'Ballari', - 'Bangalore', - 'Belgavi', - 'Bhadravati', - 'Bidar', - 'Chikkamagaluru', - 'Chitradurga', - 'Davangere', - 'Halebid', - 'Hassan', - 'Hubballi-Dharwad', - 'Kalaburagi', - 'Kolar', - 'Madikeri', - 'Mandya', - 'Mangaluru', - 'Mysuru', - 'Raichur', - 'Shivamogga', - 'Shravanabelagola', - 'Shrirangapattana', - 'Tumkuru', - ], - 'Kerala': [ - 'Alappuzha', - 'Badagara', - 'Idukki', - 'Kannur', - 'Kochi', - 'Kollam', - 'Kottayam', - 'Kozhikode', - 'Mattancheri', - 'Palakkad', - 'Thalassery', - 'Thiruvananthapuram', - 'Thrissur', - ], - 'Ladakh': [ - 'Kargil', - 'Leh', - ], - 'Madhya Pradesh': [ - 'Balaghat', - 'Barwani', - 'Betul', - 'Bharhut', - 'Bhind', - 'Bhojpur', - 'Bhopal', - 'Burhanpur', - 'Chhatarpur', - 'Chhindwara', - 'Damoh', - 'Datia', - 'Dewas', - 'Dhar', - 'Guna', - 'Gwalior', - 'Hoshangabad', - 'Indore', - 'Itarsi', - 'Jabalpur', - 'Jhabua', - 'Khajuraho', - 'Khandwa', - 'Khargon', - 'Maheshwar', - 'Mandla', - 'Mandsaur', - 'Mhow', - 'Morena', - 'Murwara', - 'Narsimhapur', - 'Narsinghgarh', - 'Narwar', - 'Neemuch', - 'Nowgong', - 'Orchha', - 'Panna', - 'Raisen', - 'Rajgarh', - 'Ratlam', - 'Rewa', - 'Sagar', - 'Sarangpur', - 'Satna', - 'Sehore', - 'Seoni', - 'Shahdol', - 'Shajapur', - 'Sheopur', - 'Shivpuri', - 'Ujjain', - 'Vidisha', - ], - 'Maharashtra': [ - 'Ahmadnagar', - 'Akola', - 'Amravati', - 'Aurangabad', - 'Bhandara', - 'Bhusawal', - 'Bid', - 'Buldana', - 'Chandrapur', - 'Daulatabad', - 'Dhule', - 'Jalgaon', - 'Kalyan', - 'Karli', - 'Kolhapur', - 'Mahabaleshwar', - 'Malegaon', - 'Matheran', - 'Mumbai', - 'Nagpur', - 'Nanded', - 'Nashik', - 'Osmanabad', - 'Pandharpur', - 'Parbhani', - 'Pune', - 'Ratnagiri', - 'Sangli', - 'Satara', - 'Sevagram', - 'Solapur', - 'Thane', - 'Ulhasnagar', - 'Vasai-Virar', - 'Wardha', - 'Yavatmal', - ], - 'Manipur': [ - 'Imphal' - ], - 'Meghalaya': [ - 'Cherrapunji', - 'Shillong', - 'Mizoram', - 'Aizawl', - 'Lunglei', - ], - 'Nagaland': [ - 'Kohima', - 'Mon', - 'Phek', - 'Wokha', - 'Zunheboto' - ], - 'Odisha': [ - 'Balangir', - 'Baleshwar', - 'Baripada', - 'Bhubaneshwar', - 'Brahmapur', - 'Cuttack', - 'Dhenkanal', - 'Keonjhar', - 'Konark', - 'Koraput', - 'Paradip', - 'Phulabani', - 'Puri', - 'Sambalpur', - 'Udayagiri', - ], - 'Pondicherry': [ - 'Karaikal', - 'Mahe', - 'Pondicherry', - 'Yanam', - ], - 'Punjab': [ - 'Amritsar', - 'Batala', - 'Chandigarh', - 'Faridkot', - 'Firozpur', - 'Gurdaspur', - 'Hoshiarpur', - 'Jalandhar', - 'Kapurthala', - 'Ludhiana', - 'Nabha', - 'Patiala', - 'Rupnagar', - 'Sangrur', - ], - 'Rajasthan': [ - 'Abu', - 'Ajmer', - 'Alwar', - 'Amer', - 'Barmer', - 'Beawar', - 'Bharatpur', - 'Bhilwara', - 'Bikaner', - 'Bundi', - 'Chittaurgarh', - 'Churu', - 'Dhaulpur', - 'Dungarpur', - 'Ganganagar', - 'Hanumangarh', - 'Jaipur', - 'Jaisalmer', - 'Jalor', - 'Jhalawar', - 'Jhunjhunu', - 'Jodhpur', - 'Kishangarh', - 'Kota', - 'Merta', - 'Nagaur', - 'Nathdwara', - 'Pali', - 'Phalodi', - 'Pushkar', - 'Sawai Madhopur', - 'Shahpura', - 'Sikar', - 'Sirohi', - 'Tonk', - 'Udaipur', - ], - 'Sikkim': [ - 'Gangtok', - 'Gyalsing', - 'Lachung', - 'Mangan', - ], - 'Tamil Nadu': [ - 'Arcot', - 'Chengalpattu', - 'Chennai', - 'Chidambaram', - 'Coimbatore', - 'Cuddalore', - 'Dharmapuri', - 'Dindigul', - 'Erode', - 'Kanchipuram', - 'Kanniyakumari', - 'Kodaikanal', - 'Kumbakonam', - 'Madurai', - 'Mamallapuram', - 'Nagappattinam', - 'Nagercoil', - 'Palayankottai', - 'Pudukkottai', - 'Rajapalaiyam', - 'Ramanathapuram', - 'Salem', - 'Thanjavur', - 'Tiruchchirappalli', - 'Tirunelveli', - 'Tiruppur', - 'Tuticorin', - 'Udhagamandalam', - 'Vellore', - ], - 'Telangana': [ - 'Hyderabad', - 'Karimnagar', - 'Khammam', - 'Mahbubnagar', - 'Nizamabad', - 'Sangareddi', - 'Warangal', - ], - 'Tripura': [ - 'Agartala', - ], - 'Uttar Pradesh': [ - 'Agra', - 'Aligarh', - 'Amroha', - 'Ayodhya', - 'Azamgarh', - 'Bahraich', - 'Ballia', - 'Banda', - 'Bara Banki', - 'Bareilly', - 'Basti', - 'Bijnor', - 'Bithur', - 'Budaun', - 'Bulandshahr', - 'Deoria', - 'Etah', - 'Etawah', - 'Faizabad', - 'Farrukhabad-cum-Fatehgarh', - 'Fatehpur', - 'Fatehpur Sikri', - 'Ghaziabad', - 'Ghazipur', - 'Gonda', - 'Gorakhpur', - 'Hamirpur', - 'Hardoi', - 'Hathras', - 'Jalaun', - 'Jaunpur', - 'Jhansi', - 'Kannauj', - 'Kanpur', - 'Lakhimpur', - 'Lalitpur', - 'Lucknow', - 'Mainpuri', - 'Mathura', - 'Meerut', - 'Mirzapur-Vindhyachal', - 'Moradabad', - 'Muzaffarnagar', - 'Partapgarh', - 'Pilibhit', - 'Prayagraj', - 'Rae Bareli', - 'Rampur', - 'Saharanpur', - 'Sambhal', - 'Shahjahanpur', - 'Sitapur', - 'Sultanpur', - 'Tehri', - 'Varanasi', - ], - 'Uttarakhand': [ - 'Almora', - 'Dehra Dun', - 'Haridwar', - 'Mussoorie', - 'Nainital', - 'Pithoragarh', - ], - 'West Bengal': [ - 'Alipore', - 'Alipur Duar', - 'Asansol', - 'Baharampur', - 'Bally', - 'Balurghat', - 'Bankura', - 'Baranagar', - 'Barasat', - 'Barrackpore', - 'Basirhat', - 'Bhatpara', - 'Bishnupur', - 'Budge Budge', - 'Burdwan', - 'Chandernagore', - 'Darjiling', - 'Diamond Harbour', - 'Dum Dum', - 'Durgapur', - 'Halisahar', - 'Haora', - 'Hugli', - 'Ingraj Bazar', - 'Jalpaiguri', - 'Kalimpong', - 'Kamarhati', - 'Kanchrapara', - 'Kharagpur', - 'Koch Kolkata', - 'Krishnanagar', - 'Malda', - 'Midnapore', - 'Murshidabad', - 'Navadwip', - 'Palashi', - 'Panihati', - 'Purulia', - 'Raiganj', - 'Santipur', - 'Shantiniketan', - 'Shrirampur', - 'Siliguri', - 'Siuri', - 'Tamluk', - 'Titagarh', - ] - -} - - -const resourceTypes = [ - 'Oxygen', - 'Hospital Beds', - 'Medicines/Injections', - 'Blood', - 'Home Care', - 'Testing', - 'Food / Tiffin', - 'Ambulances' -]; - -const resourceSubtypes = { - 'Oxygen': [ - 'New Cylinder', - 'Refill', - 'Concentrator' - ], - 'Hospital Beds': [ - 'ICU Bed', 'Ventilator Bed', 'Oxygen Beds', 'Non-Oxygen Beds' - ], - 'Medicines/Injections': [ - 'Remdesivir', 'Fabiflu', 'Tocilizumab' - ], - 'Blood': [ - 'Plasma', 'Blood' - ], - 'Home Care': [ - 'Home ICU Setup', 'Nursing Staff' - ], - 'Testing': [ - 'Home Testing', 'Lab Testing' - ], - 'Food / Tiffin': [ - 'Tiffin Service', 'Meal Provider' - ], - 'Ambulances': [ - 'Normal / Advanced Life Support' - ] -} - - const CREATE_TICKET = gql` mutation( $state: String @@ -806,7 +151,7 @@ const AddResources = (props) => {