first commit
This commit is contained in:
parent
ba5f9d1826
commit
7ed4d69138
@ -15,7 +15,7 @@
|
||||
<meta name="description" content="CoreUI for React - Open Source Bootstrap Admin Template">
|
||||
<meta name="author" content="Łukasz Holeczek">
|
||||
<meta name="keyword" content="Bootstrap,Admin,Template,Open,Source,CSS,SCSS,HTML,RWD,Dashboard,React">
|
||||
<title>ATP-Dashboard</title>
|
||||
<title>Airport Admin</title>
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
|
||||
|
@ -11,8 +11,8 @@ import axios from 'axios'
|
||||
import { store } from './redux/store';
|
||||
|
||||
const setupAxios = () => {
|
||||
axios.defaults.baseURL = 'https://atpapi.checkapp.one'
|
||||
//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',
|
||||
|
@ -183,8 +183,8 @@ const AddFranchisee = () => {
|
||||
data.city === '' ||
|
||||
data.pin_Code.trim() === '' ||
|
||||
data.short_url === '' ||
|
||||
data.state_name === '' ||
|
||||
data.imageURL.trim() === ''
|
||||
data.state_name === ''
|
||||
// data.imageURL.trim() === ''
|
||||
) {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
@ -483,7 +483,7 @@ const AddFranchisee = () => {
|
||||
|
||||
<div className="mb-3">
|
||||
<label htmlFor="image" className="form-label">
|
||||
Temple Banner*
|
||||
Franchisee Banner (optional)
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
|
@ -115,54 +115,6 @@ const EditFranchisee = () => {
|
||||
}
|
||||
}, [errors])
|
||||
|
||||
// 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,
|
||||
// }))
|
||||
// if (e.target.id === 'email') {
|
||||
// setErrors({
|
||||
// ...errors,
|
||||
// emailError: validEmailRegex.test(e.target.value) ? '' : 'Email is not valid!',
|
||||
// })
|
||||
|
||||
|
||||
// }
|
||||
// // 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 handleChange = (e) => {
|
||||
if (e.target.id === 'name') {
|
||||
@ -230,8 +182,8 @@ const EditFranchisee = () => {
|
||||
data.city === '' ||
|
||||
data.pin_Code === '' ||
|
||||
data.short_url === '' ||
|
||||
data.state_name === '' ||
|
||||
data.imageURL.trim() === ''
|
||||
data.state_name === ''
|
||||
// data.imageURL.trim() === ''
|
||||
) {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
@ -553,7 +505,7 @@ const EditFranchisee = () => {
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="image" className="form-label">
|
||||
franchisee Banner*
|
||||
Franchisee Banner (optional)
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
|
@ -29,6 +29,7 @@ const Franchisees = () => {
|
||||
headers: { 'Access-Control-Allow-Origin': '*', Authorization: `Bearer ${token}` },
|
||||
})
|
||||
.then((res) => {
|
||||
// console.log(res.data.data)
|
||||
setFranchiseesData(res.data.data)
|
||||
setLoading(false)
|
||||
})
|
||||
@ -51,6 +52,43 @@ const Franchisees = () => {
|
||||
loadData()
|
||||
}, [currentPage, itemPerPage, FranchiseesData])
|
||||
|
||||
|
||||
const handleVarification = (id) => {
|
||||
swal({
|
||||
title: 'Are you sure?',
|
||||
icon: 'warning',
|
||||
buttons: { Yes: { text: 'Yes', value: true }, Cancel: { text: 'Cancel', value: 'cancel' } },
|
||||
}).then((value) => {
|
||||
if (value === true) {
|
||||
axios
|
||||
.get(`/api/franchisee/admin/verify/${id}`, {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
swal({
|
||||
title: 'success',
|
||||
text: res.data.message ? res.data.message : 'Verified Successfully!',
|
||||
icon: 'success',
|
||||
button: 'ok',
|
||||
dangerMode: true,
|
||||
})
|
||||
setSuccess((prev) => !prev)
|
||||
})
|
||||
.catch((err) => {
|
||||
swal({
|
||||
title: 'Failled',
|
||||
text: 'Something went wrong!',
|
||||
icon: 'error',
|
||||
button: 'Retry',
|
||||
dangerMode: true,
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleDelete = (id) => {
|
||||
swal({
|
||||
title: 'Are you sure?',
|
||||
@ -158,6 +196,7 @@ const Franchisees = () => {
|
||||
<th className="text-start">Logo</th>
|
||||
<th className="text-start">City </th>
|
||||
<th className="text-start">Created On</th>
|
||||
<th className="text-start">Status</th>
|
||||
<th className="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -180,10 +219,14 @@ const Franchisees = () => {
|
||||
return (
|
||||
<tr key={i}>
|
||||
<td className="text-start">{franchisee.name}</td>
|
||||
<td className="text-start">
|
||||
<img src={franchisee.banner.url} alt="Test Image" height="50" />
|
||||
</td>
|
||||
{franchisee.banner && franchisee.banner ?
|
||||
<td className="text-start">
|
||||
<img src={franchisee.banner.url} alt="No Image" height="50" />
|
||||
</td> :
|
||||
<p>No image!</p>
|
||||
}
|
||||
<td className="text-start">{franchisee?.city?.city_name}</td>
|
||||
|
||||
<td className="text-start">
|
||||
{new Date(franchisee.createdAt).toLocaleString('en-IN', {
|
||||
month: '2-digit',
|
||||
@ -194,6 +237,25 @@ const Franchisees = () => {
|
||||
// hour12: true,
|
||||
})}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
<button
|
||||
style={{ color: 'white' }}
|
||||
type="button"
|
||||
className={`
|
||||
|
||||
btn ${franchisee?.verify === true ? 'btn-success' : 'btn-danger'} btn-sm
|
||||
waves-effect waves-light
|
||||
ms-2
|
||||
|
||||
`}
|
||||
disabled={franchisee?.verify === true}
|
||||
onClick={() => {
|
||||
handleVarification(franchisee._id)
|
||||
}}
|
||||
>
|
||||
{franchisee?.verify ? 'verified' : 'Not Verify'}
|
||||
</button>
|
||||
</td>
|
||||
<td className=" text-center">
|
||||
<OverLayButton data={{ url: franchisee?.url }} />
|
||||
|
||||
|
@ -146,7 +146,7 @@ const Login = () => {
|
||||
<CCardBody>
|
||||
<CForm>
|
||||
<h1>Login</h1>
|
||||
<p className="text-medium-emphasis">Sign In to Your ATP Dashboard Account.</p>
|
||||
<p className="text-medium-emphasis">Sign In to Your ChatGpt Airport Admin Dashboard Account.</p>
|
||||
<CInputGroup className="mb-3">
|
||||
<CInputGroupText>
|
||||
<CIcon icon={cilUser} />
|
||||
|
Loading…
Reference in New Issue
Block a user