testimonial and product
This commit is contained in:
parent
f797f442be
commit
4a1baaf854
@ -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>Airport Admin</title>
|
||||
<title>Jatin Mor 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/
|
||||
|
@ -61,9 +61,9 @@ const _nav = [
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: 'Complaints',
|
||||
name: 'Testimonials',
|
||||
icon: <CIcon icon={cilCompress} customClassName="nav-icon" />,
|
||||
to: '/complaints',
|
||||
to: '/testimonials',
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
|
@ -64,7 +64,7 @@ const AppSidebar = () => {
|
||||
<CSidebarBrand className="d-none d-md-flex" style={{ background: 'rgb(140, 213, 213)' }} to="/">
|
||||
{/* <CIcon className="sidebar-brand-full" icon={logoNegative} height={35} /> */}
|
||||
|
||||
{HeaderlogoUrl ? <Link to='/dashboard'><img src={HeaderlogoUrl} alt='' /></Link> : { AppName } ? <h2>Airport Dashboard</h2> : ''}
|
||||
{HeaderlogoUrl ? <Link to='/dashboard'><img src={HeaderlogoUrl} alt='' /></Link> : { AppName } ? <h2>Jatin Mor </h2> : ''}
|
||||
{/* <CIcon className="sidebar-brand-narrow" height={35} /> */}
|
||||
<CIcon className="sidebar-brand-narrow" icon={sygnet} height={35} />
|
||||
</CSidebarBrand>
|
||||
|
@ -11,7 +11,7 @@ import axios from 'axios'
|
||||
import { store } from './redux/store';
|
||||
|
||||
const setupAxios = () => {
|
||||
axios.defaults.baseURL = 'https://atpapi.checkapp.one'
|
||||
axios.defaults.baseURL = 'https://api-airport.checkapp.one/'
|
||||
//axios.defaults.baseURL = 'http://localhost:5000'
|
||||
axios.defaults.headers = {
|
||||
'Cache-Control': 'no-cache,no-store',
|
||||
|
@ -51,13 +51,14 @@ import Departures from './views/Departures/Departures'
|
||||
import AddDeparture from './views/Departures/AddDeparture'
|
||||
import Informations from './views/Informations/Informations'
|
||||
import AddInformations from './views/Informations/AddInformations'
|
||||
import Complaints from './views/Complaints/Complaints'
|
||||
import AddComplaint from './views/Complaints/AddComplaint'
|
||||
import ViewComplaint from './views/Complaints/ViewComplaint'
|
||||
|
||||
import ApplicationName from './views/configuration/ApplicationName'
|
||||
import CopyrightMessage from './views/configuration/CopyrightMessage'
|
||||
import ContactRequests from './views/ContactRequests/ContactRequests'
|
||||
import AddContactRequest from './views/ContactRequests/AddContactRequest'
|
||||
import Testimonials from './views/Testimonials/Testimonials'
|
||||
import AddTestimonial from './views/Testimonials/AddTestimonial'
|
||||
import ViewTestimonial from './views/Testimonials/ViewTestimonial'
|
||||
|
||||
const routes = [
|
||||
|
||||
@ -82,9 +83,9 @@ const routes = [
|
||||
{ path: '/contact/request/new', name: 'AddContact Request', element: AddContactRequest },
|
||||
// { path: '/complaint/view/:id', name: 'view Complain', element: ViewComplaint },
|
||||
//Complaints
|
||||
{ path: '/complaints', name: 'Complaints', element: Complaints },
|
||||
{ path: '/complaint/new', name: 'Add Complaint', element: AddComplaint },
|
||||
{ path: '/complaint/view/:id', name: 'view Complain', element: ViewComplaint },
|
||||
{ path: '/testimonials', name: 'Testimonials', element: Testimonials },
|
||||
{ path: '/testimonial/new', name: 'AddTestimonial', element: AddTestimonial },
|
||||
{ path: '/testimonial/view/:id', name: 'ViewTestimonial', element: ViewTestimonial },
|
||||
//informations
|
||||
{ path: '/informations', name: 'Informations', element: Informations },
|
||||
{ path: '/information/new', name: 'Add Informations', element: AddInformations },
|
||||
|
@ -1,9 +0,0 @@
|
||||
import React from 'react'
|
||||
|
||||
const ViewComplaint = () => {
|
||||
return (
|
||||
<div>ViewComplaint</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ViewComplaint
|
@ -13,19 +13,13 @@ const AddProduct = () => {
|
||||
const token = isAutheticated()
|
||||
const navigate = useNavigate()
|
||||
const [data, setData] = useState({
|
||||
image: '',
|
||||
imageURL: '',
|
||||
image: [],
|
||||
imageURL: [],
|
||||
name: '',
|
||||
description: '',
|
||||
|
||||
base_Price: '',
|
||||
base_Price_With_Tax: '',
|
||||
price_Level_2: '',
|
||||
price_Level_2_With_Tax: '',
|
||||
price: '',
|
||||
|
||||
price_Level_3: '',
|
||||
price_Level_3_With_Tax: '',
|
||||
taxId: ''
|
||||
|
||||
})
|
||||
|
||||
@ -33,7 +27,8 @@ const AddProduct = () => {
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [allTax, setAllTax] = useState([])
|
||||
|
||||
|
||||
const [imagesPreview, setImagesPreview] = useState([]);
|
||||
const [allimage, setAllImage] = useState([]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
@ -57,10 +52,38 @@ const AddProduct = () => {
|
||||
e.target.files[0]?.type === 'image/png' ||
|
||||
e.target.files[0]?.type === 'image/jpg'
|
||||
) {
|
||||
if (imagesPreview.length > 3) {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'maximum Four image Upload ',
|
||||
icon: 'error',
|
||||
button: 'Close',
|
||||
dangerMode: true,
|
||||
})
|
||||
return
|
||||
}
|
||||
// only for file preview------------------------------------
|
||||
const files = Array.from(e.target.files);
|
||||
files.forEach((file) => {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = () => {
|
||||
if (reader.readyState === 2) {
|
||||
setImagesPreview((old) => [...old, reader.result]);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file)
|
||||
});
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
imageURL: URL.createObjectURL(e.target.files[0]),
|
||||
image: e.target.files[0],
|
||||
|
||||
|
||||
image: [...data.image, ...e.target.files],
|
||||
}))
|
||||
return
|
||||
} else {
|
||||
@ -94,7 +117,7 @@ const AddProduct = () => {
|
||||
}
|
||||
|
||||
let trRate = taxDetails.rate / 100
|
||||
let PriceWithT = Number(data.base_Price);
|
||||
let PriceWithT = Number(data.price);
|
||||
PriceWithT += +((PriceWithT * trRate).toFixed());
|
||||
|
||||
//price_Level_2_With_Tax
|
||||
@ -106,7 +129,7 @@ const AddProduct = () => {
|
||||
price_Level_3_With_Tax += +((price_Level_3_With_Tax * trRate).toFixed());
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
base_Price_With_Tax: PriceWithT,
|
||||
price_With_Tax: PriceWithT,
|
||||
|
||||
price_Level_2_With_Tax: price_Level_2_With_Tax,
|
||||
|
||||
@ -117,19 +140,20 @@ const AddProduct = () => {
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
// console.log(data.image.length)
|
||||
const handleSubmit = () => {
|
||||
if (
|
||||
data.name.trim() === '' ||
|
||||
|
||||
data.description.trim() === '' ||
|
||||
data.base_Price === '' ||
|
||||
data.base_Price_With_Tax === '' ||
|
||||
data.price_Level_2 === '' ||
|
||||
data.price_Level_2_With_Tax === '' ||
|
||||
data.price_Level_3 === '' ||
|
||||
data.price_Level_3_With_Tax === '' ||
|
||||
data.imageURL.trim() === ''
|
||||
data.price === '' ||
|
||||
data.image === ''
|
||||
// data.price_With_Tax === '' ||
|
||||
// data.price_Level_2 === '' ||
|
||||
// data.price_Level_2_With_Tax === '' ||
|
||||
// data.price_Level_3 === '' ||
|
||||
// data.price_Level_3_With_Tax === '' ||
|
||||
// data.imageURL.trim() === ''
|
||||
) {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
@ -142,21 +166,19 @@ const AddProduct = () => {
|
||||
}
|
||||
setLoading(true)
|
||||
const formData = new FormData()
|
||||
formData.set('name', data.name)
|
||||
formData.append('name', data.name)
|
||||
|
||||
formData.set('description', data.description)
|
||||
formData.set('base_Price', data.base_Price)
|
||||
formData.set('base_Price_With_Tax', data.base_Price_With_Tax)
|
||||
|
||||
formData.set('price_Level_2', data.price_Level_2)
|
||||
formData.set('price_Level_2_With_Tax', data.price_Level_2_With_Tax)
|
||||
|
||||
formData.set('price_Level_3', data.price_Level_3)
|
||||
formData.set('price_Level_3_With_Tax', data.price_Level_3_With_Tax)
|
||||
formData.set('taxId', data.taxId)
|
||||
formData.append('description', data.description)
|
||||
formData.append('price', data.price)
|
||||
|
||||
|
||||
formData.append('image', data.image)
|
||||
|
||||
|
||||
data.image.forEach((Singleimage) => {
|
||||
// console.log(Singleimage)
|
||||
formData.append("image", Singleimage);
|
||||
|
||||
});
|
||||
|
||||
|
||||
axios
|
||||
@ -172,14 +194,14 @@ const AddProduct = () => {
|
||||
title: 'Added',
|
||||
text: 'Product added successfully!',
|
||||
icon: 'success',
|
||||
button: 'Return',
|
||||
button: 'ok',
|
||||
})
|
||||
setLoading(false)
|
||||
navigate('/products', { replace: true })
|
||||
})
|
||||
.catch((err) => {
|
||||
setLoading(false)
|
||||
const message = err.response?.data?.message || 'Something went wrong!'
|
||||
const message = err.response?.data?.message ? err.response?.data?.message : 'Something went wrong!'
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: message,
|
||||
@ -296,13 +318,14 @@ const AddProduct = () => {
|
||||
/>
|
||||
<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><strong className="fs-6 fst-italic">*Please Upload maximum four images</strong></div>
|
||||
|
||||
|
||||
<div id="createProductFormImage" className="w-25 d-flex">
|
||||
|
||||
{imagesPreview.map((image, index) => (
|
||||
<img className=" w-50 p-1 " key={index} src={image} alt="Product Preview" />
|
||||
))}
|
||||
</div>
|
||||
|
||||
|
||||
@ -312,126 +335,27 @@ const AddProduct = () => {
|
||||
<div className="col-lg-6 col-md-6 col-sm-12 my-1">
|
||||
<div className="card h-100">
|
||||
<div className="card-body px-5">
|
||||
<div className="d-flex flex-wrap">
|
||||
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Base Price*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
id="base_Price"
|
||||
value={data.base_Price}
|
||||
onChange={(e) => handleChange(e)}
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Base Price With Tax
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
disabled
|
||||
className="form-control"
|
||||
id="base_Price_With_Tax"
|
||||
value={data.base_Price_With_Tax}
|
||||
placeholder={data.base_Price_With_Tax}
|
||||
// onChange={(e) => handleChange(e)}
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
{/* <div className="mb-3">
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Base Price*
|
||||
Price (optional)
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
id="base_Price"
|
||||
value={data.base_Price}
|
||||
id="price"
|
||||
value={data.price}
|
||||
onChange={(e) => handleChange(e)}
|
||||
|
||||
/>
|
||||
</div> */}
|
||||
|
||||
<div className="d-flex flex-wrap">
|
||||
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price Level 2*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
id="price_Level_2"
|
||||
value={data.price_Level_2}
|
||||
onChange={(e) => handleChange(e)}
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price Level 2 with Tax
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
disabled
|
||||
className="form-control"
|
||||
id="price_Level_2_With_Tax"
|
||||
value={data.price_Level_2_With_Tax}
|
||||
placeholder={data.price_Level_2_With_Tax}
|
||||
// onChange={(e) => handleChange(e)}
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-wrap">
|
||||
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price Level 3*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
id="price_Level_3"
|
||||
value={data.price_Level_3}
|
||||
onChange={(e) => handleChange(e)}
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price Level 3 with Tax
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
disabled
|
||||
className="form-control"
|
||||
id="price_Level_3_With_Tax"
|
||||
placeholder={data.price_Level_3_With_Tax}
|
||||
// onChange={(e) => handleChange(e)}
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
{allTax.length > 0 && <div className=" mb-3">
|
||||
|
@ -1,19 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom'
|
||||
@ -28,19 +13,13 @@ const EditProduct = () => {
|
||||
const token = isAutheticated()
|
||||
const navigate = useNavigate()
|
||||
const [data, setData] = useState({
|
||||
image: '',
|
||||
imageURL: '',
|
||||
image: [],
|
||||
imageURL: [],
|
||||
name: '',
|
||||
description: '',
|
||||
|
||||
base_Price: '',
|
||||
base_Price_With_Tax: '',
|
||||
price_Level_2: '',
|
||||
price_Level_2_With_Tax: '',
|
||||
price: '',
|
||||
|
||||
price_Level_3: '',
|
||||
price_Level_3_With_Tax: '',
|
||||
taxId: ''
|
||||
|
||||
})
|
||||
|
||||
@ -48,7 +27,7 @@ const EditProduct = () => {
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [allTax, setAllTax] = useState([])
|
||||
|
||||
|
||||
const [imagesPreview, setImagesPreview] = useState([]);
|
||||
//get Productdata
|
||||
const getProduct = async () => {
|
||||
|
||||
@ -60,6 +39,14 @@ const EditProduct = () => {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
// console.log(res.data?.product?.image)
|
||||
// if (res.data?.product?.image) {
|
||||
// res.data?.product?.image.map(item => {
|
||||
// })
|
||||
|
||||
// }
|
||||
|
||||
// setImagesPreview(res.data?.product?.image)
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
...res.data?.product,
|
||||
@ -68,11 +55,13 @@ const EditProduct = () => {
|
||||
})
|
||||
.catch((err) => { })
|
||||
}
|
||||
|
||||
// console.log(imagesPreview)
|
||||
useEffect(() => {
|
||||
getProduct()
|
||||
}, [])
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const getAllTax = async () => {
|
||||
const res = await axios.get(`/api/tax/view_tax`, {
|
||||
@ -94,10 +83,38 @@ const EditProduct = () => {
|
||||
e.target.files[0]?.type === 'image/png' ||
|
||||
e.target.files[0]?.type === 'image/jpg'
|
||||
) {
|
||||
if (imagesPreview.length > 3) {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: 'maximum Four image Upload ',
|
||||
icon: 'error',
|
||||
button: 'Close',
|
||||
dangerMode: true,
|
||||
})
|
||||
return
|
||||
}
|
||||
// only for file preview------------------------------------
|
||||
const files = Array.from(e.target.files);
|
||||
files.forEach((file) => {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = () => {
|
||||
if (reader.readyState === 2) {
|
||||
setImagesPreview((old) => [...old, reader.result]);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file)
|
||||
});
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
imageURL: URL.createObjectURL(e.target.files[0]),
|
||||
image: e.target.files[0],
|
||||
|
||||
|
||||
image: [...data.image, ...e.target.files],
|
||||
}))
|
||||
return
|
||||
} else {
|
||||
@ -129,8 +146,9 @@ const EditProduct = () => {
|
||||
taxId: e.target.value.slice(24)
|
||||
|
||||
}
|
||||
|
||||
let trRate = taxDetails.rate / 100
|
||||
let PriceWithT = Number(data.base_Price);
|
||||
let PriceWithT = Number(data.price);
|
||||
PriceWithT += +((PriceWithT * trRate).toFixed());
|
||||
|
||||
//price_Level_2_With_Tax
|
||||
@ -142,7 +160,7 @@ const EditProduct = () => {
|
||||
price_Level_3_With_Tax += +((price_Level_3_With_Tax * trRate).toFixed());
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
base_Price_With_Tax: PriceWithT,
|
||||
price_With_Tax: PriceWithT,
|
||||
|
||||
price_Level_2_With_Tax: price_Level_2_With_Tax,
|
||||
|
||||
@ -150,23 +168,23 @@ const EditProduct = () => {
|
||||
price_Level_3_With_Tax: price_Level_3_With_Tax,
|
||||
taxId: taxDetails.taxId
|
||||
|
||||
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
// console.log(data.image.length)
|
||||
const handleSubmit = () => {
|
||||
if (
|
||||
data.name.trim() === '' ||
|
||||
|
||||
data.description.trim() === '' ||
|
||||
data.base_Price === '' ||
|
||||
data.base_Price_With_Tax === '' ||
|
||||
data.price_Level_2 === '' ||
|
||||
data.price_Level_2_With_Tax === '' ||
|
||||
data.price_Level_3 === '' ||
|
||||
data.price_Level_3_With_Tax === '' ||
|
||||
data.imageURL.trim() === ''
|
||||
data.price === '' ||
|
||||
data.image === ''
|
||||
// data.price_With_Tax === '' ||
|
||||
// data.price_Level_2 === '' ||
|
||||
// data.price_Level_2_With_Tax === '' ||
|
||||
// data.price_Level_3 === '' ||
|
||||
// data.price_Level_3_With_Tax === '' ||
|
||||
// data.imageURL.trim() === ''
|
||||
) {
|
||||
swal({
|
||||
title: 'Warning',
|
||||
@ -179,22 +197,18 @@ const EditProduct = () => {
|
||||
}
|
||||
setLoading(true)
|
||||
const formData = new FormData()
|
||||
formData.set('name', data.name)
|
||||
formData.append('name', data.name)
|
||||
|
||||
formData.set('description', data.description)
|
||||
formData.set('base_Price', data.base_Price)
|
||||
formData.set('base_Price_With_Tax', data.base_Price_With_Tax)
|
||||
|
||||
formData.set('price_Level_2', data.price_Level_2)
|
||||
formData.set('price_Level_2_With_Tax', data.price_Level_2_With_Tax)
|
||||
|
||||
formData.set('price_Level_3', data.price_Level_3)
|
||||
|
||||
formData.set('price_Level_3_With_Tax', data.price_Level_3_With_Tax)
|
||||
formData.set('taxId', data.taxId)
|
||||
formData.append('description', data.description)
|
||||
formData.append('price', data.price)
|
||||
|
||||
|
||||
formData.append('image', data.image)
|
||||
|
||||
|
||||
data.image.forEach((Singleimage) => {
|
||||
formData.append("image", Singleimage);
|
||||
|
||||
});
|
||||
|
||||
|
||||
axios
|
||||
@ -207,18 +221,17 @@ const EditProduct = () => {
|
||||
})
|
||||
.then((res) => {
|
||||
swal({
|
||||
title: 'Edited',
|
||||
text: 'Product Edited successfully!',
|
||||
title: 'Updated',
|
||||
text: 'Product Updated successfully!',
|
||||
icon: 'success',
|
||||
button: 'Return',
|
||||
button: 'ok',
|
||||
})
|
||||
setLoading(false)
|
||||
navigate('/products', { replace: true })
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
setLoading(false)
|
||||
const message = err.response?.data?.message || 'Something went wrong!'
|
||||
const message = err.response?.data?.message ? err.response?.data?.message : 'Something went wrong!'
|
||||
swal({
|
||||
title: 'Warning',
|
||||
text: message,
|
||||
@ -335,14 +348,15 @@ const EditProduct = () => {
|
||||
/>
|
||||
<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><strong className="fs-6 fst-italic">*Please Upload maximum four images</strong></div>
|
||||
|
||||
</div>
|
||||
|
||||
{imagesPreview.length > 0 && <div id="createProductFormImage" className="w-25 d-flex">
|
||||
|
||||
{imagesPreview.map((image, index) => (
|
||||
<img className=" w-50 p-1 " key={index} src={image} alt="Product Preview" />
|
||||
))}
|
||||
</div>}
|
||||
|
||||
|
||||
</div>
|
||||
@ -351,126 +365,27 @@ const EditProduct = () => {
|
||||
<div className="col-lg-6 col-md-6 col-sm-12 my-1">
|
||||
<div className="card h-100">
|
||||
<div className="card-body px-5">
|
||||
<div className="d-flex flex-wrap">
|
||||
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Base Price*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
id="base_Price"
|
||||
value={data.base_Price}
|
||||
onChange={(e) => handleChange(e)}
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Base Price With Tax
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
disabled
|
||||
className="form-control"
|
||||
id="base_Price_With_Tax"
|
||||
value={data.base_Price_With_Tax}
|
||||
placeholder={data.base_Price_With_Tax}
|
||||
// onChange={(e) => handleChange(e)}
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
{/* <div className="mb-3">
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Base Price*
|
||||
Price (optional)
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
id="base_Price"
|
||||
value={data.base_Price}
|
||||
id="price"
|
||||
value={data.price}
|
||||
onChange={(e) => handleChange(e)}
|
||||
|
||||
/>
|
||||
</div> */}
|
||||
|
||||
<div className="d-flex flex-wrap">
|
||||
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price Level 2*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
id="price_Level_2"
|
||||
value={data.price_Level_2}
|
||||
onChange={(e) => handleChange(e)}
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price Level 2 with Tax
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
disabled
|
||||
className="form-control"
|
||||
id="price_Level_2_With_Tax"
|
||||
value={data.price_Level_2_With_Tax}
|
||||
placeholder={data.price_Level_2_With_Tax}
|
||||
// onChange={(e) => handleChange(e)}
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-wrap">
|
||||
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price Level 3*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
id="price_Level_3"
|
||||
value={data.price_Level_3}
|
||||
onChange={(e) => handleChange(e)}
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price Level 3 with Tax
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
disabled
|
||||
className="form-control"
|
||||
id="price_Level_3_With_Tax"
|
||||
placeholder={data.price_Level_3_With_Tax}
|
||||
// onChange={(e) => handleChange(e)}
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
{allTax.length > 0 && <div className=" mb-3">
|
||||
@ -479,7 +394,7 @@ const EditProduct = () => {
|
||||
</label> <select className=" form-control" name="" id=""
|
||||
onChange={(e) => TaxRatechange(e)}
|
||||
>
|
||||
<option value="" disabled>---</option>
|
||||
<option value="" disabled>-----</option>
|
||||
|
||||
{allTax.map((t, i) =>
|
||||
<option key={i} value={`tax:${t.tax},name:${t.name} ,taxId:${t._id}`}>{t.tax}% {t.name}</option>
|
||||
@ -496,3 +411,4 @@ const EditProduct = () => {
|
||||
}
|
||||
|
||||
export default EditProduct
|
||||
|
||||
|
@ -67,6 +67,12 @@ const Products = () => {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
swal({
|
||||
title: 'Deleted',
|
||||
text: 'Product Deleted successfully!',
|
||||
icon: 'success',
|
||||
button: 'ok',
|
||||
})
|
||||
setSuccess((prev) => !prev)
|
||||
})
|
||||
.catch((err) => {
|
||||
@ -159,8 +165,8 @@ const Products = () => {
|
||||
<tr>
|
||||
|
||||
<th className="text-start">Product Name</th>
|
||||
<th className="text-start">Thumbnail</th>
|
||||
<th className="text-start">Base Price</th>
|
||||
<th className="text-start">Image</th>
|
||||
<th className="text-start">Price</th>
|
||||
<th className="text-start">Added On</th>
|
||||
<th className="text-start">Actions</th>
|
||||
</tr>
|
||||
@ -185,13 +191,14 @@ const Products = () => {
|
||||
<tr key={i}>
|
||||
<td className="text-start">{product.name}</td>
|
||||
<th>
|
||||
{product?.image && (
|
||||
<>
|
||||
<img src={product.image?.url} width="50" alt="preview" />
|
||||
</>
|
||||
)}
|
||||
{product.image &&
|
||||
product.image.map(i =>
|
||||
<img className="me-2" src={`${i?.url}`} width="40" alt="" />
|
||||
)}
|
||||
|
||||
|
||||
</th>
|
||||
<th className="text-start">₹{product.base_Price}</th>
|
||||
<th className="text-start">₹{product.price}</th>
|
||||
<td className="text-start">
|
||||
{new Date(product.createdAt).toLocaleString('en-IN', {
|
||||
weekday: 'short',
|
||||
|
@ -82,17 +82,17 @@ function ViewProduct() {
|
||||
<table className="table table-centered table-nowrap mb-0">
|
||||
<thead className="thead-light">
|
||||
|
||||
<tr><th>Id</th> <td>{product?._id}</td></tr>
|
||||
<tr><th>Id</th> <td><h5>{product?._id}</h5></td></tr>
|
||||
<tr><th>Name</th> <td>{product?.name}</td></tr>
|
||||
|
||||
<tr><th>image</th><td>
|
||||
<img src={`${product.image?.url}`} width="50" alt="" />
|
||||
</td></tr>
|
||||
{product.image && <tr><th>image</th><td>
|
||||
{product.image.map(i =>
|
||||
<img className="me-2" src={`${i?.url}`} width="70" alt="" />
|
||||
)}
|
||||
</td></tr>}
|
||||
<tr><th>Description</th><td>{product?.description}</td></tr>
|
||||
<tr><th>Base Price</th><td>{product?.base_Price}</td></tr>
|
||||
<tr><th>Price Level 2</th><td>{product?.price_Level_2}</td></tr>
|
||||
<tr><th>Base Price</th><td>₹{product?.price}</td></tr>
|
||||
|
||||
<tr><th>Price Level 3</th><td>{product?.price_Level_3}</td></tr>
|
||||
|
||||
{/* <tr><th>Product Time</th><td>{product?.time}</td></tr>
|
||||
<tr><th>Location</th><td>{product?.location}</td></tr> */}
|
||||
|
@ -8,15 +8,16 @@ import axios from 'axios'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
// import { WebsiteURL } from '../WebsiteURL'
|
||||
|
||||
const AddComplaint = () => {
|
||||
const AddTestimonial = () => {
|
||||
const token = isAutheticated()
|
||||
const navigate = useNavigate()
|
||||
const [data, setData] = useState({
|
||||
|
||||
MobileOrEmail: '',
|
||||
Complaint: '',
|
||||
|
||||
|
||||
name: '',
|
||||
testimonial: '',
|
||||
company: '',
|
||||
image: '',
|
||||
imageURL: '',
|
||||
|
||||
})
|
||||
|
||||
@ -31,18 +32,47 @@ const AddComplaint = () => {
|
||||
|
||||
const handleChange = (e) => {
|
||||
|
||||
|
||||
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.MobileOrEmail.trim() === '' ||
|
||||
data.name.trim() === '' ||
|
||||
data.company.trim() === '' ||
|
||||
data.image === '' ||
|
||||
|
||||
data.Complaint.trim() === ''
|
||||
data.testimonial.trim() === ''
|
||||
|
||||
) {
|
||||
swal({
|
||||
@ -56,14 +86,16 @@ const AddComplaint = () => {
|
||||
}
|
||||
setLoading(true)
|
||||
const formData = new FormData()
|
||||
formData.set('MobileOrEmail', data.MobileOrEmail)
|
||||
formData.set('name', data.name)
|
||||
formData.set('company', data.company)
|
||||
formData.set('image', data.image)
|
||||
|
||||
formData.set('Complaint', data.Complaint)
|
||||
formData.set('testimonial', data.testimonial)
|
||||
|
||||
|
||||
|
||||
axios
|
||||
.post(`/api/complaint/new/`, formData, {
|
||||
.post(`/api/testimonial/new/`, formData, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'multipart/formdata',
|
||||
@ -73,12 +105,12 @@ const AddComplaint = () => {
|
||||
.then((res) => {
|
||||
swal({
|
||||
title: 'Added',
|
||||
text: 'Complaint added successfully!',
|
||||
text: 'Testimonial added successfully!',
|
||||
icon: 'success',
|
||||
button: 'ok',
|
||||
})
|
||||
setLoading(false)
|
||||
navigate('/complaints', { replace: true })
|
||||
navigate('/testimonials', { replace: true })
|
||||
})
|
||||
.catch((err) => {
|
||||
setLoading(false)
|
||||
@ -106,7 +138,7 @@ const AddComplaint = () => {
|
||||
"
|
||||
>
|
||||
<div style={{ fontSize: '22px' }} className="fw-bold">
|
||||
Complaint
|
||||
Testimonial
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '1rem' }}>
|
||||
<h4 className="mb-0"></h4>
|
||||
@ -127,7 +159,7 @@ const AddComplaint = () => {
|
||||
>
|
||||
{loading ? 'Loading' : 'Save'}
|
||||
</Button>
|
||||
<Link to="/complaints">
|
||||
<Link to="/testimonials">
|
||||
<Button
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
@ -151,48 +183,87 @@ const AddComplaint = () => {
|
||||
|
||||
|
||||
|
||||
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Mobile Or Email *
|
||||
Name *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="MobileOrEmail"
|
||||
value={data.MobileOrEmail}
|
||||
maxLength={150}
|
||||
id="name"
|
||||
value={data.name}
|
||||
maxLength={25}
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
{data.MobileOrEmail ? <><small className="charLeft mt-4 fst-italic">
|
||||
{150 - data.MobileOrEmail.length} characters left
|
||||
{data.name ? <><small className="charLeft mt-4 fst-italic">
|
||||
{25 - data.name.length} characters left
|
||||
</small></> : <></>
|
||||
|
||||
} </div>
|
||||
} </div>
|
||||
|
||||
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Complaint *
|
||||
Company (Optional) *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="company"
|
||||
value={data.company}
|
||||
maxLength={30}
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
{data.company ? <><small className="charLeft mt-4 fst-italic">
|
||||
{30 - data.company.length} characters left
|
||||
</small></> : <></>
|
||||
|
||||
} </div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Testimonial *
|
||||
</label>
|
||||
<textarea
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="Complaint"
|
||||
id="testimonial"
|
||||
rows="10"
|
||||
cols="100"
|
||||
value={data.Complaint}
|
||||
placeholder='your Complaint...'
|
||||
maxLength="1000"
|
||||
cols="80"
|
||||
value={data.testimonial}
|
||||
placeholder='your Testimonial...'
|
||||
maxLength="500"
|
||||
onChange={(e) => handleChange(e)}
|
||||
>
|
||||
</textarea>
|
||||
|
||||
{data.Complaint ? <><small className="charLeft mt-4 fst-italic">
|
||||
{1000 - data.Complaint.length} characters left
|
||||
{data.testimonial ? <><small className="charLeft mt-4 fst-italic">
|
||||
{500 - data.testimonial.length} characters left
|
||||
</small></> : <></>
|
||||
}
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label htmlFor="image" className="form-label">
|
||||
Photo (optional)*
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
className="form-control"
|
||||
id="image"
|
||||
accept="image/*"
|
||||
multiple
|
||||
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 className="mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Description *
|
||||
@ -211,4 +282,4 @@ const AddComplaint = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export default AddComplaint
|
||||
export default AddTestimonial
|
@ -7,16 +7,16 @@ import { useNavigate } from 'react-router-dom'
|
||||
import axios from 'axios'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
|
||||
const Complaints = () => {
|
||||
const Testimonials = () => {
|
||||
const token = isAutheticated()
|
||||
const navigate = useNavigate()
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [success, setSuccess] = useState(true)
|
||||
const [ComplaintsData, setComplaintsData] = useState([])
|
||||
const [TestimonialsData, setTestimonialsData] = useState([])
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(1)
|
||||
const [itemPerPage, setItemPerPage] = useState(10)
|
||||
const [showData, setShowData] = useState(ComplaintsData)
|
||||
const [showData, setShowData] = useState(TestimonialsData)
|
||||
|
||||
const handleShowEntries = (e) => {
|
||||
setCurrentPage(1)
|
||||
@ -25,15 +25,15 @@ const Complaints = () => {
|
||||
|
||||
|
||||
|
||||
const getComplaintsData = async () => {
|
||||
const getTestimonialsData = async () => {
|
||||
axios
|
||||
.get(`/api/complaint/getAll/`, {
|
||||
.get(`/api/testimonial/getAll/`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setComplaintsData(res.data?.complaint)
|
||||
setTestimonialsData(res.data?.testimonial)
|
||||
setLoading(false)
|
||||
})
|
||||
.catch((err) => {
|
||||
@ -42,17 +42,17 @@ const Complaints = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getComplaintsData()
|
||||
getTestimonialsData()
|
||||
}, [success])
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = () => {
|
||||
const indexOfLastPost = currentPage * itemPerPage
|
||||
const indexOfFirstPost = indexOfLastPost - itemPerPage
|
||||
setShowData(ComplaintsData.slice(indexOfFirstPost, indexOfLastPost))
|
||||
setShowData(TestimonialsData.slice(indexOfFirstPost, indexOfLastPost))
|
||||
}
|
||||
loadData()
|
||||
}, [currentPage, itemPerPage, ComplaintsData])
|
||||
}, [currentPage, itemPerPage, TestimonialsData])
|
||||
|
||||
const handleDelete = (id) => {
|
||||
swal({
|
||||
@ -62,7 +62,7 @@ const Complaints = () => {
|
||||
}).then((value) => {
|
||||
if (value === true) {
|
||||
axios
|
||||
.delete(`/api/product/delete/${id}`, {
|
||||
.delete(`/api/item/delete/${id}`, {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
@ -99,7 +99,7 @@ const Complaints = () => {
|
||||
"
|
||||
>
|
||||
<div style={{ fontSize: '22px' }} className="fw-bold">
|
||||
Complaints
|
||||
Testimonials
|
||||
</div>
|
||||
|
||||
<div className="page-title-right">
|
||||
@ -112,10 +112,10 @@ const Complaints = () => {
|
||||
textTransform: 'capitalize',
|
||||
}}
|
||||
onClick={() => {
|
||||
navigate('/complaint/new', { replace: true })
|
||||
navigate('/testimonial/new', { replace: true })
|
||||
}}
|
||||
>
|
||||
Add New Complaint
|
||||
Add New Testimonial
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@ -163,8 +163,8 @@ const Complaints = () => {
|
||||
|
||||
|
||||
|
||||
<th className="text-start">Mobile or EMail</th>
|
||||
<th className="text-start">Complaints</th>
|
||||
<th className="text-start">Name</th>
|
||||
<th className="text-start">Testimonials</th>
|
||||
<th className="text-start">Date & Time</th>
|
||||
|
||||
|
||||
@ -186,14 +186,14 @@ const Complaints = () => {
|
||||
</td>
|
||||
</tr>
|
||||
) : (
|
||||
showData.map((product, i) => {
|
||||
showData.map((item, i) => {
|
||||
return (
|
||||
<tr key={i}>
|
||||
<td className="text-start">{product.MobileOrEmail}</td>
|
||||
<td className="text-start">{item.name}</td>
|
||||
|
||||
<td className="text-start">{product.Complaint}</td>
|
||||
<td className="text-start">{item.company}</td>
|
||||
<td className="text-start">
|
||||
{new Date(product.createdAt).toLocaleString('en-IN', {
|
||||
{new Date(item.createdAt).toLocaleString('en-IN', {
|
||||
weekday: 'short',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
@ -205,7 +205,7 @@ const Complaints = () => {
|
||||
</td>
|
||||
<td className="text-start">
|
||||
|
||||
<Link to={`/product/view/${product._id}`}>
|
||||
<Link to={`/testimonial/view/${item._id}`}>
|
||||
<button
|
||||
style={{ color: 'white', marginRight: '1rem' }}
|
||||
type="button"
|
||||
@ -239,8 +239,8 @@ const Complaints = () => {
|
||||
aria-live="polite"
|
||||
>
|
||||
Showing {currentPage * itemPerPage - itemPerPage + 1} to{' '}
|
||||
{Math.min(currentPage * itemPerPage, ComplaintsData.length)} of{' '}
|
||||
{ComplaintsData.length} entries
|
||||
{Math.min(currentPage * itemPerPage, TestimonialsData.length)} of{' '}
|
||||
{TestimonialsData.length} entries
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -283,7 +283,7 @@ const Complaints = () => {
|
||||
|
||||
{!(
|
||||
(currentPage + 1) * itemPerPage - itemPerPage >
|
||||
ComplaintsData.length - 1
|
||||
TestimonialsData.length - 1
|
||||
) && (
|
||||
<li className="paginate_button page-item ">
|
||||
<span
|
||||
@ -302,7 +302,7 @@ const Complaints = () => {
|
||||
className={
|
||||
!(
|
||||
(currentPage + 1) * itemPerPage - itemPerPage >
|
||||
ComplaintsData.length - 1
|
||||
TestimonialsData.length - 1
|
||||
)
|
||||
? 'paginate_button page-item next'
|
||||
: 'paginate_button page-item next disabled'
|
||||
@ -330,4 +330,4 @@ const Complaints = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export default Complaints
|
||||
export default Testimonials
|
122
src/views/Testimonials/ViewTestimonial.js
Normal file
122
src/views/Testimonials/ViewTestimonial.js
Normal file
@ -0,0 +1,122 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import axios from "axios";
|
||||
import React, { useEffect, useState, useCallback, useMemo } from "react";
|
||||
import swal from 'sweetalert';
|
||||
|
||||
import { Link, useParams } from "react-router-dom";
|
||||
import { isAutheticated } from "src/auth";
|
||||
|
||||
function ViewTestimonial() {
|
||||
const [testimonial, setTestimonial] = useState([])
|
||||
const { id } = useParams();
|
||||
const token = isAutheticated();
|
||||
|
||||
const getTestimonial = useCallback(async () => {
|
||||
let res = await axios.get(
|
||||
`/api/testimonial/getOne/${id}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
setTestimonial(res.data.testimonial)
|
||||
|
||||
|
||||
}, [token]);
|
||||
|
||||
useEffect(() => {
|
||||
getTestimonial();
|
||||
}, [getTestimonial]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//change time formate
|
||||
function formatAMPM(date) {
|
||||
var hours = new Date(date).getHours();
|
||||
var minutes = new Date(date).getMinutes();
|
||||
var ampm = hours >= 12 ? 'PM' : 'AM';
|
||||
hours = hours % 12;
|
||||
hours = hours ? hours : 12; // the hour '0' should be '12'
|
||||
minutes = minutes < 10 ? '0' + minutes : minutes;
|
||||
var strTime = hours + ':' + minutes + ' ' + ampm;
|
||||
return strTime;
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<div className=" main-content">
|
||||
<div className=" my-3 page-content">
|
||||
<div className="container-fluid">
|
||||
{/* <!-- start page title --> */}
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<div className="page-title-box d-flex align-items-center justify-content-between">
|
||||
<h4 className="mb-3">Testimonial</h4>
|
||||
<Link to="/testimonials"><button type="button" className="btn btn-info float-end mb-3 ml-4">Back</button></Link>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* <!-- end page title --> */}
|
||||
|
||||
<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>
|
||||
<div className="table-responsive table-shoot">
|
||||
<table className="table table-centered table-nowrap mb-0">
|
||||
<thead className="thead-light">
|
||||
|
||||
<tr><th>Id</th> <td><h5>{testimonial?._id}</h5></td></tr>
|
||||
<tr><th>Name</th> <td>{testimonial?.name}</td></tr>
|
||||
|
||||
{testimonial.image && <tr><th>image</th><td>
|
||||
|
||||
<img className="me-2" src={`${testimonial.image?.url}`} width="70" alt="" />
|
||||
|
||||
</td></tr>}
|
||||
{testimonial?.company && <tr><th> Company</th><td>{testimonial?.company}</td></tr>}
|
||||
<tr><th>Testimonial</th><td>{testimonial?.testimonial}</td></tr>
|
||||
|
||||
|
||||
{/* <tr><th>Testimonial Time</th><td>{testimonial?.time}</td></tr>
|
||||
<tr><th>Location</th><td>{testimonial?.location}</td></tr> */}
|
||||
<tr><th>Created On</th><td>
|
||||
{new Date(`${testimonial?.createdAt}`).toDateString()}<span> , {`${formatAMPM(testimonial?.createdAt)}`}</span>
|
||||
</td></tr>
|
||||
<tr><th>Updated At</th>
|
||||
<td>
|
||||
{new Date(`${testimonial?.updatedAt}`).toDateString()}<span> , {`${formatAMPM(testimonial?.updatedAt)}`}</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
{/* <!-- end table-responsive --> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* <!-- container-fluid --> */}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ViewTestimonial;
|
@ -146,7 +146,7 @@ const Login = () => {
|
||||
<CCardBody>
|
||||
<CForm>
|
||||
<h1>Login</h1>
|
||||
<p className="text-medium-emphasis">Sign In to Your ChatGpt Airport Admin Dashboard Account.</p>
|
||||
<p className="text-medium-emphasis">Sign In to Your Jatin Mor Admin Dashboard Account.</p>
|
||||
<CInputGroup className="mb-3">
|
||||
<CInputGroupText>
|
||||
<CIcon icon={cilUser} />
|
||||
|
Loading…
Reference in New Issue
Block a user