temple
This commit is contained in:
parent
e7f53a9dc4
commit
3fc579218e
@ -53,9 +53,10 @@
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "18.2",
|
||||
"react-app-polyfill": "^2.0.0",
|
||||
"react-bootstrap": "^2.7.0",
|
||||
"react-date-picker": "^8.4.0",
|
||||
"react-datepicker": "^4.8.0",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-dom": "^18.0.0",
|
||||
"react-paginate": "^8.1.3",
|
||||
"react-redux": "^7.2.6",
|
||||
"react-router-dom": "^6.7.0",
|
||||
|
10
src/_nav.js
10
src/_nav.js
@ -13,12 +13,16 @@ import {
|
||||
cilFilterSquare,
|
||||
cilMedicalCross,
|
||||
cilMoney,
|
||||
cilMugTea,
|
||||
cilNewspaper,
|
||||
cilNotes,
|
||||
cilPencil,
|
||||
cilPuzzle,
|
||||
cilSitemap,
|
||||
cilSpeedometer,
|
||||
cilStar,
|
||||
cilTablet,
|
||||
cilTennisBall,
|
||||
cilUser,
|
||||
|
||||
|
||||
@ -35,6 +39,12 @@ const _nav = [
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
component: CNavItem,
|
||||
name: 'Temples',
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: '/temples',
|
||||
},
|
||||
|
||||
{
|
||||
component: CNavItem,
|
||||
|
@ -11,7 +11,8 @@ import store from './store'
|
||||
import axios from 'axios'
|
||||
|
||||
const setupAxios = () => {
|
||||
axios.defaults.baseURL = 'http://localhost:5000'
|
||||
axios.defaults.baseURL = 'https://atpapi.checkapp.one'
|
||||
//axios.defaults.baseURL = 'http://localhost:5000'
|
||||
axios.defaults.headers = {
|
||||
'Cache-Control': 'no-cache,no-store',
|
||||
'Pragma': 'no-cache',
|
||||
|
@ -22,6 +22,10 @@ import Socialmedia from './views/configuration/Socialmedia.js'
|
||||
import Address from './views/configuration/Address.js'
|
||||
import Logo from './views/configuration/Logo.js'
|
||||
import Login from './views/pages/login/Login'
|
||||
//temple
|
||||
import Temples from './views/Temples/Temples'
|
||||
import AddTemple from './views/Temples/AddTemple'
|
||||
import EditTemple from './views/Temples/EditTemple'
|
||||
|
||||
const routes = [
|
||||
|
||||
@ -29,7 +33,10 @@ const routes = [
|
||||
{ path: '/change_password', name: 'Change Password', element: Change_Password },
|
||||
{ path: '/profile/edit', name: 'Edit Profile', element: EditProfile },
|
||||
// { path: '/profile', name: 'Profile', element: Profile },
|
||||
|
||||
//Temple
|
||||
{ path: '/temples', name: 'Temples', element: Temples },
|
||||
{ path: '/temple/add', name: 'Add Temple', element: AddTemple },
|
||||
{ path: '/temple/edit/:id', name: 'Edit Temples', element: EditTemple },
|
||||
|
||||
//dashboard
|
||||
|
||||
|
407
src/views/Temples/AddTemple.js
Normal file
407
src/views/Temples/AddTemple.js
Normal file
@ -0,0 +1,407 @@
|
||||
|
||||
|
||||
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import { Link, useNavigate } from 'react-router-dom'
|
||||
import swal from 'sweetalert'
|
||||
import axios from 'axios'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
// import { WebsiteURL } from '../WebsiteURL'
|
||||
|
||||
const AddTemple = () => {
|
||||
const [WebsiteURL, setWebsiteURL] = useState('https://reinventuniforms.in/')
|
||||
const token = isAutheticated()
|
||||
const navigate = useNavigate()
|
||||
const [data, setData] = useState({
|
||||
image: '',
|
||||
imageURL: '',
|
||||
name: '',
|
||||
address_line_1: '',
|
||||
address_line_2: '',
|
||||
city: '',
|
||||
state_name: '',
|
||||
short_url: '',
|
||||
// pan: '',
|
||||
// business_name: '',
|
||||
// gstin: '',
|
||||
// option: '',
|
||||
})
|
||||
|
||||
const [cities, setCities] = useState([])
|
||||
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [limiter, setLimiter] = useState({
|
||||
name: 100,
|
||||
nameHas: 100,
|
||||
})
|
||||
|
||||
const getRequired = () => {
|
||||
axios
|
||||
.get(`/api/city`, {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setCities([...res.data.data])
|
||||
})
|
||||
.catch((err) => { })
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getRequired()
|
||||
}, [])
|
||||
|
||||
const handleChange = (e) => {
|
||||
if (e.target.id === 'name') {
|
||||
if (e.target.value.length === limiter[e.target.id] + 1) return
|
||||
setLimiter((prev) => ({
|
||||
...prev,
|
||||
[e.target.id + 'Has']: prev[e.target.id] - e.target.value.length,
|
||||
}))
|
||||
setData((prev) => ({ ...prev, short_url: e.target.value.toLowerCase().replace(/\s+/g, '-') }))
|
||||
}
|
||||
if (e.target.id === 'city') {
|
||||
const city = cities.filter((m) => e.target.value === m?._id)
|
||||
setData((prev) => ({ ...prev, state_name: city[0]?.state?.state_name || '' }))
|
||||
}
|
||||
if (e.target.id === 'image') {
|
||||
if (
|
||||
e.target.files[0]?.type === 'image/jpeg' ||
|
||||
e.target.files[0]?.type === 'image/png' ||
|
||||
e.target.files[0]?.type === 'image/jpg'
|
||||
) {
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
imageURL: URL.createObjectURL(e.target.files[0]),
|
||||
image: e.target.files[0],
|
||||
}))
|
||||
return
|
||||
} else {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'Upload jpg, jpeg, png only.',
|
||||
icon: 'error',
|
||||
button: 'Close',
|
||||
dangerMode: true,
|
||||
})
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
imageURL: '',
|
||||
image: '',
|
||||
}))
|
||||
e.target.value = null
|
||||
return
|
||||
}
|
||||
}
|
||||
setData((prev) => ({ ...prev, [e.target.id]: e.target.value }))
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (
|
||||
data.name.trim() === '' ||
|
||||
// data.pan.trim() === '' ||
|
||||
// data.business_name.trim() === '' ||
|
||||
// data.gstin.trim() === '' ||
|
||||
// data.option.trim() === '' ||
|
||||
data.address_line_1.trim() === '' ||
|
||||
data.address_line_2.trim() === '' ||
|
||||
data.city === '' ||
|
||||
data.short_url === '' ||
|
||||
data.state_name === '' ||
|
||||
data.imageURL.trim() === ''
|
||||
) {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'Fill all mandatory fields',
|
||||
icon: 'error',
|
||||
button: 'Close',
|
||||
dangerMode: true,
|
||||
})
|
||||
return
|
||||
}
|
||||
setLoading(true)
|
||||
const formData = new FormData()
|
||||
formData.set('name', data.name)
|
||||
// formData.set('pan', data.pan)
|
||||
// formData.set('business_name', data.business_name)
|
||||
// formData.set('gstin', data.gstin)
|
||||
// formData.set('option', data.option)
|
||||
formData.set('address_line_1', data.address_line_1)
|
||||
formData.set('address_line_2', data.address_line_2)
|
||||
formData.set('city', data.city)
|
||||
formData.set('state_name', data.state_name)
|
||||
formData.set('url', WebsiteURL + data.short_url + '/login')
|
||||
formData.set('short_url', data.short_url)
|
||||
formData.append('image', data.image)
|
||||
axios
|
||||
.post(`/api/temple`, formData, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'multipart/formdata',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
swal({
|
||||
title: 'Added',
|
||||
text: 'Temple added successfully!',
|
||||
icon: 'success',
|
||||
button: 'Return',
|
||||
})
|
||||
setLoading(false)
|
||||
navigate('/temples', { replace: true })
|
||||
})
|
||||
.catch((err) => {
|
||||
setLoading(false)
|
||||
const message = err.response?.data?.message || 'Something went wrong!'
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: message,
|
||||
icon: 'error',
|
||||
button: 'Retry',
|
||||
dangerMode: true,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<div
|
||||
className="
|
||||
page-title-box
|
||||
d-flex
|
||||
align-items-center
|
||||
justify-content-between
|
||||
"
|
||||
>
|
||||
<div style={{ fontSize: '22px' }} className="fw-bold">
|
||||
Add Temple
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '1rem' }}>
|
||||
<h4 className="mb-0"></h4>
|
||||
</div>
|
||||
|
||||
<div className="page-title-right">
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
marginBottom: '1rem',
|
||||
textTransform: 'capitalize',
|
||||
marginRight: '5px',
|
||||
}}
|
||||
onClick={() => handleSubmit()}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? 'Loading' : 'Save'}
|
||||
</Button>
|
||||
<Link to="/temples">
|
||||
<Button
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
marginBottom: '1rem',
|
||||
textTransform: 'capitalize',
|
||||
}}
|
||||
>
|
||||
Back
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-6 my-1">
|
||||
<div className="card h-100">
|
||||
<div className="card-body px-5">
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Temple Name*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="name"
|
||||
value={data.name}
|
||||
maxLength={limiter.name}
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
<p className="pt-1 pl-2 text-secondary">Remaining characters : {limiter.nameHas}</p>
|
||||
</div>
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
PAN*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="pan"
|
||||
value={data.pan}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div> */}
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Address Line 1*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="address_line_1"
|
||||
value={data.address_line_1}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Address Line 2*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="address_line_2"
|
||||
value={data.address_line_2}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div>
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Business Name*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="business_name"
|
||||
value={data.business_name}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div> */}
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
GSTIN*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="gstin"
|
||||
value={data.gstin}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div> */}
|
||||
<div className="mb-3">
|
||||
<label htmlFor="pageToLink" className="form-label">
|
||||
City*
|
||||
</label>
|
||||
<select
|
||||
onChange={(e) => handleChange(e)}
|
||||
value={data.city}
|
||||
className="form-control"
|
||||
id="city"
|
||||
>
|
||||
<option value="">---select---</option>
|
||||
{cities[0] ? (
|
||||
cities.map((c, i) => (
|
||||
<option key={i} value={c._id}>
|
||||
{c.city_name + ', ' + c.state?.state_name}
|
||||
</option>
|
||||
))
|
||||
) : (
|
||||
<option value="" disabled>
|
||||
Please add a City
|
||||
</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
State*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="state_name"
|
||||
value={data.state_name}
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 my-1">
|
||||
<div className="card h-100">
|
||||
<div className="card-body px-5">
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
URL*
|
||||
</label>
|
||||
<div className="input-group mb-3">
|
||||
<span className="input-group-text" id="basic-addon3">
|
||||
{WebsiteURL}
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="short_url"
|
||||
aria-describedby="basic-addon3"
|
||||
value={data.short_url}
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="option" className="form-label">
|
||||
Option*
|
||||
</label>
|
||||
<select
|
||||
className="form-control"
|
||||
id="option"
|
||||
value={data.option}
|
||||
onChange={(e) => handleChange(e)}
|
||||
>
|
||||
<option value="">None</option>
|
||||
<option value="group">Group</option>
|
||||
<option value="bundle">Bundle</option>
|
||||
</select>
|
||||
</div> */}
|
||||
<div className="mb-3">
|
||||
<label htmlFor="image" className="form-label">
|
||||
Temple Banner*
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
className="form-control"
|
||||
id="image"
|
||||
accept="image/*"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
<p className="pt-1 pl-2 text-secondary">Upload jpg, jpeg and png only*</p>
|
||||
</div>
|
||||
<div className="mb-3" style={{ height: '200px', maxWdth: '100%' }}>
|
||||
<img
|
||||
src={data.imageURL}
|
||||
alt="Uploaded Image will be shown here"
|
||||
style={{ maxHeight: '200px', maxWidth: '100%' }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AddTemple
|
423
src/views/Temples/EditTemple.js
Normal file
423
src/views/Temples/EditTemple.js
Normal file
@ -0,0 +1,423 @@
|
||||
|
||||
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom'
|
||||
import swal from 'sweetalert'
|
||||
import axios from 'axios'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
|
||||
const EditTemple = () => {
|
||||
|
||||
|
||||
const [WebsiteURL, setWebsiteURL] = useState('https://reinventuniforms.in/')
|
||||
const id = useParams()?.id
|
||||
const token = isAutheticated()
|
||||
const navigate = useNavigate()
|
||||
const [data, setData] = useState({
|
||||
image: '',
|
||||
imageURL: '',
|
||||
name: '',
|
||||
address_line_1: '',
|
||||
address_line_2: '',
|
||||
city: '',
|
||||
state_name: '',
|
||||
short_url: '',
|
||||
pan: '',
|
||||
business_name: '',
|
||||
gstin: '',
|
||||
option: '',
|
||||
})
|
||||
const [cities, setCities] = useState([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [limiter, setLimiter] = useState({
|
||||
name: 100,
|
||||
nameHas: 100,
|
||||
})
|
||||
|
||||
const getRequired = async () => {
|
||||
await axios
|
||||
.get(`/api/city`, {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setCities([...res.data.data])
|
||||
})
|
||||
.catch((err) => { })
|
||||
axios
|
||||
.get(`/api/Temple/withoutpopulate/${id}`, {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
...res.data?.data,
|
||||
city: res.data?.data?.city,
|
||||
imageURL: res.data?.data?.banner?.url,
|
||||
}))
|
||||
setLimiter((prev) => ({ ...prev, nameHas: prev.name - res.data?.data?.name?.length || 0 }))
|
||||
})
|
||||
.catch((err) => { })
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getRequired()
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const setStateName = () => {
|
||||
const city = cities.filter((m) => data.city === m?._id)
|
||||
setData((prev) => ({ ...prev, state_name: city[0]?.state?.state_name || '' }))
|
||||
}
|
||||
setStateName()
|
||||
}, [data.city])
|
||||
|
||||
const handleChange = (e) => {
|
||||
if (e.target.id === 'name') {
|
||||
if (e.target.value.length === limiter[e.target.id] + 1) return
|
||||
setLimiter((prev) => ({
|
||||
...prev,
|
||||
[e.target.id + 'Has']: prev[e.target.id] - e.target.value.length,
|
||||
}))
|
||||
// setData((prev) => ({ ...prev, short_url: e.target.value.toLowerCase().replace(/\s+/g, '-') }))
|
||||
}
|
||||
if (e.target.id === 'image') {
|
||||
if (
|
||||
e.target.files[0]?.type === 'image/jpeg' ||
|
||||
e.target.files[0]?.type === 'image/png' ||
|
||||
e.target.files[0]?.type === 'image/jpg'
|
||||
) {
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
imageURL: URL.createObjectURL(e.target.files[0]),
|
||||
image: e.target.files[0],
|
||||
}))
|
||||
return
|
||||
} else {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'Upload jpg, jpeg, png only.',
|
||||
icon: 'error',
|
||||
button: 'Close',
|
||||
dangerMode: true,
|
||||
})
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
imageURL: '',
|
||||
image: '',
|
||||
}))
|
||||
e.target.value = null
|
||||
return
|
||||
}
|
||||
}
|
||||
setData((prev) => ({ ...prev, [e.target.id]: e.target.value }))
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (
|
||||
data.name.trim() === '' ||
|
||||
data.address_line_1.trim() === '' ||
|
||||
data.address_line_2.trim() === '' ||
|
||||
data.city === '' ||
|
||||
data.short_url === '' ||
|
||||
data.state_name === ''
|
||||
) {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'Fill all mandatory fields',
|
||||
icon: 'error',
|
||||
button: 'Close',
|
||||
dangerMode: true,
|
||||
})
|
||||
return
|
||||
}
|
||||
setLoading(true)
|
||||
const formData = new FormData()
|
||||
formData.set('name', data.name)
|
||||
// formData.set('pan', data.pan)
|
||||
// formData.set('business_name', data.business_name)
|
||||
// formData.set('gstin', data.gstin)
|
||||
// formData.set('option', data.option)
|
||||
formData.set('address_line_1', data.address_line_1)
|
||||
formData.set('address_line_2', data.address_line_2)
|
||||
formData.set('city', data.city)
|
||||
formData.set('state_name', data.state_name)
|
||||
formData.set('url', WebsiteURL + data.short_url + '/login')
|
||||
formData.set('short_url', data.short_url)
|
||||
formData.append('image', data.image)
|
||||
axios
|
||||
.patch(`/api/Temple/${id}`, formData, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'multipart/formdata',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
swal({
|
||||
title: 'Updated',
|
||||
text: 'Temple updated successfully!',
|
||||
icon: 'success',
|
||||
button: 'Return',
|
||||
})
|
||||
setLoading(false)
|
||||
navigate('/temples', { replace: true })
|
||||
})
|
||||
.catch((err) => {
|
||||
setLoading(false)
|
||||
const message = err.response?.data?.message || 'Something went wrong!'
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: message,
|
||||
icon: 'error',
|
||||
button: 'Retry',
|
||||
dangerMode: true,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<div
|
||||
className="
|
||||
page-title-box
|
||||
d-flex
|
||||
align-items-center
|
||||
justify-content-between
|
||||
"
|
||||
>
|
||||
<div style={{ fontSize: '22px' }} className="fw-bold">
|
||||
Edit Temple
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '1rem' }}>
|
||||
<h4 className="mb-0"></h4>
|
||||
</div>
|
||||
|
||||
<div className="page-title-right">
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
marginBottom: '1rem',
|
||||
textTransform: 'capitalize',
|
||||
marginRight: '5px',
|
||||
}}
|
||||
onClick={() => handleSubmit()}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? 'Loading' : 'Update'}
|
||||
</Button>
|
||||
<Link to="/temples">
|
||||
<Button
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
marginBottom: '1rem',
|
||||
textTransform: 'capitalize',
|
||||
}}
|
||||
>
|
||||
Back
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="row">
|
||||
<div className="col-6 my-1">
|
||||
<div className="card h-100">
|
||||
<div className="card-body px-5">
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Temple Name*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="name"
|
||||
value={data.name}
|
||||
maxLength={limiter.name}
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
<p className="pt-1 pl-2 text-secondary">Remaining characters : {limiter.nameHas}</p>
|
||||
</div>
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
PAN*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="pan"
|
||||
value={data.pan}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div> */}
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Address Line 1*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="address_line_1"
|
||||
value={data.address_line_1}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Address Line 2*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="address_line_2"
|
||||
value={data.address_line_2}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div>
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Business Name*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="business_name"
|
||||
value={data.business_name}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
GSTIN*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="gstin"
|
||||
value={data.gstin}
|
||||
maxLength="50"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div> */}
|
||||
<div className="mb-3">
|
||||
<label htmlFor="pageToLink" className="form-label">
|
||||
City*
|
||||
</label>
|
||||
<select
|
||||
onChange={(e) => handleChange(e)}
|
||||
value={data.city}
|
||||
className="form-control"
|
||||
id="city"
|
||||
>
|
||||
<option value="">---select---</option>
|
||||
{cities[0] ? (
|
||||
cities.map((c, i) => (
|
||||
<option key={i} value={c._id}>
|
||||
{c.city_name + ', ' + c.state?.state_name}
|
||||
</option>
|
||||
))
|
||||
) : (
|
||||
<option value="" disabled>
|
||||
Please add a City
|
||||
</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
State*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="state_name"
|
||||
value={data.state_name}
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 my-1">
|
||||
<div className="card h-100">
|
||||
<div className="card-body px-5">
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
URL*
|
||||
</label>
|
||||
<div className="input-group mb-3">
|
||||
<span className="input-group-text" id="basic-addon3">
|
||||
{WebsiteURL}
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="short_url"
|
||||
aria-describedby="basic-addon3"
|
||||
value={data.short_url}
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="option" className="form-label">
|
||||
Option*
|
||||
</label>
|
||||
<select
|
||||
className="form-control"
|
||||
id="option"
|
||||
value={data.option}
|
||||
onChange={(e) => handleChange(e)}
|
||||
>
|
||||
<option value="">None</option>
|
||||
<option value="group">Group</option>
|
||||
<option value="bundle">Bundle</option>
|
||||
</select>
|
||||
</div> */}
|
||||
<div className="mb-3">
|
||||
<label htmlFor="image" className="form-label">
|
||||
Temple Banner*
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
className="form-control"
|
||||
id="image"
|
||||
accept="image/*"
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
<p className="pt-1 pl-2 text-secondary">Upload jpg, jpeg and png only*</p>
|
||||
</div>
|
||||
<div className="mb-3" style={{ height: '200px', maxWdth: '100%' }}>
|
||||
<img
|
||||
src={data.imageURL}
|
||||
alt="Uploaded Image will be shown here"
|
||||
style={{ maxHeight: '200px', maxWidth: '100%' }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default EditTemple
|
29
src/views/Temples/OverLayButton.js
Normal file
29
src/views/Temples/OverLayButton.js
Normal file
@ -0,0 +1,29 @@
|
||||
import React, { useState, useRef } from 'react'
|
||||
import Button from 'react-bootstrap/Button'
|
||||
import Overlay from 'react-bootstrap/Overlay'
|
||||
import Tooltip from 'react-bootstrap/Tooltip'
|
||||
|
||||
function OverLayButton(props) {
|
||||
const { url } = props?.data || ''
|
||||
const [show, setShow] = useState(false)
|
||||
const target = useRef(null)
|
||||
|
||||
return (
|
||||
<span>
|
||||
<Button ref={target} onClick={() => setShow(!show)} size="sm" variant="outline-info">
|
||||
URL
|
||||
</Button>
|
||||
<Overlay target={target.current} show={show} placement="top">
|
||||
{(props) => (
|
||||
<Tooltip id="overlay-example" {...props}>
|
||||
<a href={url} target="_blank" className="text-white">
|
||||
{url}
|
||||
</a>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Overlay>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
export default OverLayButton
|
351
src/views/Temples/Temples.js
Normal file
351
src/views/Temples/Temples.js
Normal file
@ -0,0 +1,351 @@
|
||||
|
||||
import React, { useEffect } from 'react'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import { useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import axios from 'axios'
|
||||
import swal from 'sweetalert'
|
||||
import OverLayButton from './OverLayButton.js'
|
||||
import { isAutheticated } from 'src/auth.js'
|
||||
|
||||
const Temples = () => {
|
||||
const token = isAutheticated()
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [success, setSuccess] = useState(true)
|
||||
const [TemplesData, setTemplesData] = useState([])
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(1)
|
||||
const [itemPerPage, setItemPerPage] = useState(10)
|
||||
const [showData, setShowData] = useState(TemplesData)
|
||||
|
||||
const handleShowEntries = (e) => {
|
||||
setCurrentPage(1)
|
||||
setItemPerPage(e.target.value)
|
||||
}
|
||||
|
||||
const getCategories = () => {
|
||||
axios
|
||||
.get(`/api/temple`, {
|
||||
headers: { 'Access-Control-Allow-Origin': '*', Authorization: `Bearer ${token}` },
|
||||
})
|
||||
.then((res) => {
|
||||
setTemplesData(res.data.data)
|
||||
setLoading(false)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
setLoading(false)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getCategories()
|
||||
}, [success])
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = () => {
|
||||
const indexOfLastPost = currentPage * itemPerPage
|
||||
const indexOfFirstPost = indexOfLastPost - itemPerPage
|
||||
setShowData(TemplesData.slice(indexOfFirstPost, indexOfLastPost))
|
||||
}
|
||||
loadData()
|
||||
}, [currentPage, itemPerPage, TemplesData])
|
||||
|
||||
const handleDelete = (id) => {
|
||||
swal({
|
||||
title: 'Are you sure?',
|
||||
icon: 'error',
|
||||
buttons: { Yes: { text: 'Yes', value: true }, Cancel: { text: 'Cancel', value: 'cancel' } },
|
||||
}).then((value) => {
|
||||
if (value === true) {
|
||||
axios
|
||||
.delete(`/api/temple/${id}`, {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setSuccess((prev) => !prev)
|
||||
})
|
||||
.catch((err) => {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'Something went wrong!',
|
||||
icon: 'error',
|
||||
button: 'Retry',
|
||||
dangerMode: true,
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="main-content">
|
||||
<div className="page-content">
|
||||
<div className="container-fluid">
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<div
|
||||
className="
|
||||
page-title-box
|
||||
d-flex
|
||||
align-items-center
|
||||
justify-content-between
|
||||
"
|
||||
>
|
||||
<div style={{ fontSize: '22px' }} className="fw-bold">
|
||||
Temples
|
||||
</div>
|
||||
|
||||
<div className="page-title-right">
|
||||
<Link to="/temple/add">
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
marginBottom: '1rem',
|
||||
textTransform: 'capitalize',
|
||||
}}
|
||||
>
|
||||
Add Temple
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-lg-12">
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<div className="row ml-0 mr-0 mb-10">
|
||||
<div className="col-sm-12 col-md-12">
|
||||
<div className="dataTables_length">
|
||||
<label className="w-100">
|
||||
Show
|
||||
<select
|
||||
style={{ width: '10%' }}
|
||||
name=""
|
||||
onChange={(e) => handleShowEntries(e)}
|
||||
className="
|
||||
select-w
|
||||
custom-select custom-select-sm
|
||||
form-control form-control-sm
|
||||
"
|
||||
>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
entries
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="table-responsive table-shoot mt-3">
|
||||
<table
|
||||
className="table table-centered table-nowrap"
|
||||
style={{ border: '1px solid' }}
|
||||
>
|
||||
<thead className="thead-info" style={{ background: 'rgb(140, 213, 213)' }}>
|
||||
<tr>
|
||||
<th className="text-start">Temple Name</th>
|
||||
<th className="text-start">Logo</th>
|
||||
<th className="text-start">City </th>
|
||||
<th className="text-start">Created On</th>
|
||||
<th className="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{!loading && showData.length === 0 && (
|
||||
<tr className="text-center">
|
||||
<td colSpan="6">
|
||||
<h5>No Data Available</h5>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{loading ? (
|
||||
<tr>
|
||||
<td className="text-center" colSpan="6">
|
||||
Loading...
|
||||
</td>
|
||||
</tr>
|
||||
) : (
|
||||
showData.map((temple, i) => {
|
||||
return (
|
||||
<tr key={i}>
|
||||
<td className="text-start">{temple.name}</td>
|
||||
<td className="text-start">
|
||||
<img src={temple.banner.url} alt="Test Image" height="50" />
|
||||
</td>
|
||||
<td className="text-start">{temple?.city?.city_name}</td>
|
||||
<td className="text-start">
|
||||
{new Date(temple.createdAt).toLocaleString('en-IN', {
|
||||
month: '2-digit',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
// hour: 'numeric',
|
||||
// minute: 'numeric',
|
||||
// hour12: true,
|
||||
})}
|
||||
</td>
|
||||
<td className=" text-center">
|
||||
<OverLayButton data={{ url: temple?.url }} />
|
||||
|
||||
<Link to={`/temple/products/${temple._id}`}>
|
||||
<button
|
||||
style={{ color: 'white' }}
|
||||
type="button"
|
||||
className="
|
||||
btn btn-primary btn-sm
|
||||
waves-effect waves-light
|
||||
ms-2
|
||||
"
|
||||
>
|
||||
Products
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
<Link to={`/temple/edit/${temple._id}`}>
|
||||
<button
|
||||
style={{ color: 'white' }}
|
||||
type="button"
|
||||
className="
|
||||
btn btn-success btn-sm
|
||||
waves-effect waves-light
|
||||
ms-2
|
||||
"
|
||||
>
|
||||
Edit
|
||||
</button>
|
||||
</Link>
|
||||
<button
|
||||
style={{ color: 'white' }}
|
||||
type="button"
|
||||
className="
|
||||
btn btn-danger btn-sm
|
||||
waves-effect waves-light
|
||||
ms-2
|
||||
|
||||
"
|
||||
onClick={() => {
|
||||
handleDelete(temple._id)
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div className="row mt-20">
|
||||
<div className="col-sm-12 col-md-6 mb-20">
|
||||
<div
|
||||
className="dataTables_info"
|
||||
id="datatable_info"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
Showing {currentPage * itemPerPage - itemPerPage + 1} to{' '}
|
||||
{Math.min(currentPage * itemPerPage, TemplesData.length)} of{' '}
|
||||
{TemplesData.length} entries
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="col-sm-12 col-md-6">
|
||||
<div className="d-flex">
|
||||
<ul className="pagination ms-auto">
|
||||
<li
|
||||
className={
|
||||
currentPage === 1
|
||||
? 'paginate_button page-item previous disabled'
|
||||
: 'paginate_button page-item previous'
|
||||
}
|
||||
>
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => setCurrentPage((prev) => prev - 1)}
|
||||
>
|
||||
Previous
|
||||
</span>
|
||||
</li>
|
||||
|
||||
{!(currentPage - 1 < 1) && (
|
||||
<li className="paginate_button page-item">
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={(e) => setCurrentPage((prev) => prev - 1)}
|
||||
>
|
||||
{currentPage - 1}
|
||||
</span>
|
||||
</li>
|
||||
)}
|
||||
|
||||
<li className="paginate_button page-item active">
|
||||
<span className="page-link" style={{ cursor: 'pointer' }}>
|
||||
{currentPage}
|
||||
</span>
|
||||
</li>
|
||||
|
||||
{!(
|
||||
(currentPage + 1) * itemPerPage - itemPerPage >
|
||||
TemplesData.length - 1
|
||||
) && (
|
||||
<li className="paginate_button page-item ">
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => {
|
||||
setCurrentPage((prev) => prev + 1)
|
||||
}}
|
||||
>
|
||||
{currentPage + 1}
|
||||
</span>
|
||||
</li>
|
||||
)}
|
||||
|
||||
<li
|
||||
className={
|
||||
!(
|
||||
(currentPage + 1) * itemPerPage - itemPerPage >
|
||||
TemplesData.length - 1
|
||||
)
|
||||
? 'paginate_button page-item next'
|
||||
: 'paginate_button page-item next disabled'
|
||||
}
|
||||
>
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => setCurrentPage((prev) => prev + 1)}
|
||||
>
|
||||
Next
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Temples
|
@ -6,6 +6,7 @@ import { Link } from 'react-router-dom'
|
||||
import swal from 'sweetalert'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
|
||||
|
||||
function Address() {
|
||||
const token = isAutheticated()
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
@ -31,7 +31,7 @@ function Logo() {
|
||||
configDetails.data.result.map((item) => {
|
||||
setHeaderlogo(item?.logo[0]?.Headerlogo)
|
||||
setFooterlogo(item?.logo[0]?.Footerlogo)
|
||||
setAdminlogo(item?.logo[0].Adminlogo)
|
||||
setAdminlogo(item?.logo[0]?.Adminlogo)
|
||||
})
|
||||
}
|
||||
getConfiguration()
|
||||
@ -58,17 +58,19 @@ function Logo() {
|
||||
formdata.append('Footerlogo', Footerlogo)
|
||||
formdata.append('Adminlogo', Adminlogo)
|
||||
|
||||
let res = await axios.post(`/api/config/logo`, formdata, {
|
||||
await axios.post(`/api/config/logo`, formdata, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'multipart/formdata',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
},
|
||||
})
|
||||
if (res) {
|
||||
}).then((res) => {
|
||||
setLoading(false)
|
||||
swal('Success!', res.data.message, res.data.status)
|
||||
}
|
||||
).catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
@ -93,7 +95,7 @@ function Logo() {
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100 mt-3"
|
||||
>
|
||||
Logo htmlFor Website Header(148 x 48 px)
|
||||
{/* Logo htmlFor Website Header(148 x 48 px) */}
|
||||
</label>
|
||||
<div>
|
||||
<input
|
||||
@ -105,13 +107,14 @@ function Logo() {
|
||||
setHeaderlogoUrl({
|
||||
image: URL.createObjectURL(e.target.files[0]),
|
||||
})
|
||||
console.log(setHeaderlogoUrl)
|
||||
}
|
||||
}}
|
||||
className="form-control input-field col-md-6 d-inline-block"
|
||||
className="form-control input-field mb-3 col-md-6 d-inline-block"
|
||||
id="basicpill-phoneno-input"
|
||||
/>
|
||||
{display ? (
|
||||
<img
|
||||
<img className='ms-1'
|
||||
style={{ width: '100px' }}
|
||||
src={HeaderlogoUrl.image ? HeaderlogoUrl.image : Headerlogo}
|
||||
alt="header logo"
|
||||
@ -124,7 +127,7 @@ function Logo() {
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100 mt-3"
|
||||
>
|
||||
Logo htmlFor Website Footer(148 x 48 px)
|
||||
{/* Logo htmlFor Website Footer(148 x 48 px) */}
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
@ -138,7 +141,7 @@ function Logo() {
|
||||
})
|
||||
}
|
||||
}}
|
||||
className="form-control input-field col-md-6 d-inline-block"
|
||||
className="form-control input-field mt-1 col-md-6 d-inline-block"
|
||||
id="basicpill-phoneno-input"
|
||||
/>{' '}
|
||||
{display ? (
|
||||
@ -154,7 +157,7 @@ function Logo() {
|
||||
htmlFor="basicpill-phoneno-input"
|
||||
className="label-100 mt-2 row ms-1"
|
||||
>
|
||||
Logo htmlFor Admin Header(148 x 48 px)
|
||||
{/* Logo htmlFor Admin Header(148 x 48 px) */}
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
|
@ -14,8 +14,7 @@ const AddCity = () => {
|
||||
const [data, setData] = useState({
|
||||
city_name: '',
|
||||
state: '',
|
||||
_id: 'Loading',
|
||||
createdAt: new Date(),
|
||||
|
||||
})
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [limiter, setLimiter] = useState({
|
||||
@ -89,10 +88,11 @@ const AddCity = () => {
|
||||
button: 'Return',
|
||||
})
|
||||
setLoading(false)
|
||||
navigate.push('/cities', { replace: true })
|
||||
navigate('/cities', { replace: true })
|
||||
})
|
||||
.catch((err) => {
|
||||
setLoading(false)
|
||||
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'Something went wrong!',
|
||||
@ -198,14 +198,8 @@ const AddCity = () => {
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label>Unique ID</label>
|
||||
<input type="text" value={data._id} className="form-control" disabled />
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label>TimeStamp</label>
|
||||
<input type="text" value={data.createdAt} className="form-control" disabled />
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -152,7 +152,7 @@ const Cities = () => {
|
||||
className="table table-centered table-nowrap"
|
||||
style={{ border: '1px solid' }}
|
||||
>
|
||||
<thead className="thead-light" style={{ background: '#ecdddd' }}>
|
||||
<thead className="thead" style={{ background: 'rgb(140, 213, 213)' }}>
|
||||
<tr>
|
||||
<th className="text-start">City Name</th>
|
||||
<th className="text-start">State Name</th>
|
||||
|
@ -15,8 +15,7 @@ const EditCity = () => {
|
||||
const [data, setData] = useState({
|
||||
city_name: '',
|
||||
state: '',
|
||||
_id: 'Loading',
|
||||
createdAt: new Date(),
|
||||
|
||||
})
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [limiter, setLimiter] = useState({
|
||||
@ -206,7 +205,7 @@ const EditCity = () => {
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
{/* <div className="mb-3">
|
||||
<label>Unique ID</label>
|
||||
<input type="text" value={data._id} className="form-control" disabled />
|
||||
</div>
|
||||
@ -218,7 +217,7 @@ const EditCity = () => {
|
||||
className="form-control"
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -34,7 +34,7 @@ const AddState = () => {
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (data.state_code.trim() === '' || data.state_name.trim() === '') {
|
||||
if (data.state_name.trim() === '') {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'Fill all mandatory fields',
|
||||
@ -145,7 +145,7 @@ const AddState = () => {
|
||||
Remaining characters : {limiter.state_nameHas}
|
||||
</p>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="city_name" className="form-label">
|
||||
State Code (GST)*
|
||||
</label>
|
||||
@ -160,7 +160,7 @@ const AddState = () => {
|
||||
<p className="pt-1 pl-2 text-secondary">
|
||||
Remaining characters : {limiter.state_codeHas}
|
||||
</p>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -61,7 +61,7 @@ const EditState = () => {
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (data.state_code.trim() === '' || data.state_name.trim() === '') {
|
||||
if (data.state_name.trim() === '') {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'Fill all mandatory fields',
|
||||
@ -172,7 +172,7 @@ const EditState = () => {
|
||||
Remaining characters : {limiter.state_nameHas}
|
||||
</p>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
{/* <div className="mb-3">
|
||||
<label htmlFor="city_name" className="form-label">
|
||||
State Code (GST)*
|
||||
</label>
|
||||
@ -187,7 +187,7 @@ const EditState = () => {
|
||||
<p className="pt-1 pl-2 text-secondary">
|
||||
Remaining characters : {limiter.state_codeHas}
|
||||
</p>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -152,10 +152,10 @@ const States = () => {
|
||||
className="table table-centered table-nowrap"
|
||||
style={{ border: '1px solid' }}
|
||||
>
|
||||
<thead className="thead-info" style={{ background: '#ecdddd' }}>
|
||||
<thead className="thead-info" style={{ background: 'rgb(140, 213, 213)' }}>
|
||||
<tr>
|
||||
<th className="text-start">State Name</th>
|
||||
<th className="text-start">State Code (GST)</th>
|
||||
{/* <th className="text-start">State Code (GST)</th> */}
|
||||
<th className="text-start">Created On</th>
|
||||
<th className="text-start">Actions</th>
|
||||
</tr>
|
||||
@ -179,7 +179,7 @@ const States = () => {
|
||||
return (
|
||||
<tr key={i}>
|
||||
<td className="text-start">{city.state_name}</td>
|
||||
<td className="text-start">{city.state_code}</td>
|
||||
{/* <td className="text-start">{city.state_code}</td> */}
|
||||
<td className="text-start">
|
||||
{new Date(city.createdAt).toLocaleString('en-IN', {
|
||||
weekday: 'short',
|
||||
|
Loading…
Reference in New Issue
Block a user