status
This commit is contained in:
parent
1d5ae904f9
commit
70e20f4ca8
@ -22,7 +22,7 @@ import {
|
||||
import CIcon from '@coreui/icons-react'
|
||||
import { cilPencil, cilNotes, cilCalendar, cilAddressBook, cil3d, cilActionUndo, cilNoteAdd } from '@coreui/icons'
|
||||
const AddBanner = () => {
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
let history = useHistory();
|
||||
const [image, setImage] = useState("");
|
||||
const [title, setTitle] = useState("");
|
||||
|
@ -9,7 +9,7 @@ import { isAutheticated } from "../../auth";
|
||||
function banner() {
|
||||
const [banner, setBanner] = useState([])
|
||||
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
|
||||
const getEvent = useCallback(async () => {
|
||||
let res = await axios.get(
|
||||
@ -20,7 +20,7 @@ function banner() {
|
||||
},
|
||||
}
|
||||
);
|
||||
console.log(res.data)
|
||||
// console.log(res.data)
|
||||
setBanner(res.data.banner)
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ import CIcon from '@coreui/icons-react'
|
||||
import { cilPencil, cilNotes, cilCalendar, cilNoteAdd } from '@coreui/icons'
|
||||
const EditBanner = () => {
|
||||
const { id } = useParams();
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
let history = useHistory();
|
||||
const [image, setImage] = useState("");
|
||||
const [title, setTitle] = useState("");
|
||||
@ -42,9 +42,9 @@ const EditBanner = () => {
|
||||
//fetch one Offer
|
||||
useEffect(async () => {
|
||||
const res = await axios.get(`/api/banner/getOne/${id}`, {
|
||||
// headers: {
|
||||
// Authorization: `Bearer ${token}`,
|
||||
// },
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
// console.log(res.data.banner)
|
||||
// console.log(res.data.banner.startDate)
|
||||
|
@ -13,7 +13,7 @@ function ViewBanner() {
|
||||
const [banner, setBanner] = useState([])
|
||||
const { id } = useParams();
|
||||
// console.log(id)
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
|
||||
const getBanner = useCallback(async () => {
|
||||
let res = await axios.get(
|
||||
|
@ -23,7 +23,7 @@ import {
|
||||
import CIcon from '@coreui/icons-react'
|
||||
import { cilLockLocked, cilUser } from '@coreui/icons'
|
||||
const AddProduct = () => {
|
||||
// const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
let history = useHistory();
|
||||
const [image, setImage] = useState("");
|
||||
const [name, setName] = useState("");
|
||||
@ -49,7 +49,7 @@ const AddProduct = () => {
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": 'multipart/form-data',
|
||||
// Authorization: `Bearer ${token}`,
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -22,7 +22,7 @@ function Products() {
|
||||
const changeState = (newState) =>
|
||||
setState((prevState) => ({ ...prevState, ...newState }));
|
||||
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
|
||||
const getProducts = useCallback(async () => {
|
||||
let res = await axios.get(
|
||||
|
@ -23,7 +23,7 @@ import {
|
||||
import CIcon from '@coreui/icons-react'
|
||||
import { cilLockLocked, cilUser } from '@coreui/icons'
|
||||
const AddProduct = () => {
|
||||
// const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
let history = useHistory();
|
||||
const { id } = useParams();
|
||||
// console.log(id)
|
||||
@ -32,9 +32,9 @@ const AddProduct = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
useEffect(async () => {
|
||||
const res = await axios.get(`/api/category/getOne/${id}`, {
|
||||
// headers: {
|
||||
// Authorization: `Bearer ${token}`,
|
||||
// },
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ const Add_Business = () => {
|
||||
}
|
||||
);
|
||||
//if (res.status === 200) window.location.reload();
|
||||
console.log(res.status == 201)
|
||||
// console.log(res.status == 201)
|
||||
if (res.status == 201) {
|
||||
changeState({ loading: false });
|
||||
swal("Add Business successfully!");
|
||||
|
@ -9,7 +9,7 @@ const Bisuness = () => {
|
||||
|
||||
|
||||
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
|
||||
const getProducts = useCallback(async () => {
|
||||
let res = await axios.get(
|
||||
@ -53,15 +53,16 @@ const Bisuness = () => {
|
||||
};
|
||||
|
||||
const toggleStatus = async (id) => {
|
||||
let status = window.confirm("Do you want to delete");
|
||||
let status = window.confirm("Do you want to change status");
|
||||
if (!status) {
|
||||
return;
|
||||
}
|
||||
let res = await axios.get(`/api/product/setStatus/${id}`, {
|
||||
let res = await axios.get(`/api/directory/admin/setStatus/${id}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
// console.log(res)
|
||||
if (res.status === 200) window.location.reload();
|
||||
};
|
||||
|
||||
@ -76,14 +77,7 @@ const Bisuness = () => {
|
||||
<div className="page-title-box d-flex align-items-center justify-content-between">
|
||||
<h4 className="mb-3">Bisuness-Directory</h4>
|
||||
<Link to="/add_bisuness"><button type="button" className="btn btn-info float-end mb-3 ml-4"> + Add Bisuness</button></Link>
|
||||
{/* <div className="page-title-right">
|
||||
<ol className="breadcrumb m-0">
|
||||
<li className="breadcrumb-item">
|
||||
<Link to="/dashboard">Dating App</Link>
|
||||
</li>
|
||||
<li className="breadcrumb-item">Commerce - Products</li>
|
||||
</ol>
|
||||
</div> */}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -94,38 +88,7 @@ const Bisuness = () => {
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<div className="row ml-0 mr-0 mb-10">
|
||||
{/* <div className="col-sm-12 col-md-6">
|
||||
<div className="dataTables_length">
|
||||
<label className="w-100">
|
||||
Show{" "}
|
||||
<select
|
||||
onChange={(e) =>
|
||||
changeState({ limit: e.target.value, page: 1 })
|
||||
}
|
||||
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 className="col-sm-12 col-md-6">
|
||||
<div className="dropdown d-block">
|
||||
<a href="/comproducts/add">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary add-btn waves-effect waves-light float-right"
|
||||
>
|
||||
<i className="fa fa-plus" aria-hidden="true"></i>{" "}
|
||||
Add New Product
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
</div>
|
||||
<div className="table-responsive table-shoot">
|
||||
<table className="table table-centered table-nowrap mb-0">
|
||||
@ -147,20 +110,20 @@ const Bisuness = () => {
|
||||
<td>{item?.city}</td>
|
||||
<td>
|
||||
<span
|
||||
className={`badge rounded-pill bg-${status ? "success" : "danger"
|
||||
className={`badge rounded-pill bg-${item.status === "true" ? "success" : "danger"
|
||||
} font-size-10`}
|
||||
>
|
||||
{status ? "Live" : "Suspended"}
|
||||
{item.status === "true" ? "Live" : "Suspended"}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<button
|
||||
type="button"
|
||||
className={`btn btn-${status ? "danger" : "success"
|
||||
className={`btn btn-${item.status === "true" ? "danger" : "success"
|
||||
} btn-sm waves-effect waves-light btn-table ml-1`}
|
||||
onClick={() => toggleStatus('_id')}
|
||||
onClick={() => toggleStatus(item._id)}
|
||||
>
|
||||
{status ? "Suspend" : "Activate"}
|
||||
{item.status === "true" ? "Suspend" : "Activate"}
|
||||
</button>
|
||||
<Link to={`/view_bisuness/${item._id}`}>
|
||||
|
||||
|
@ -151,7 +151,7 @@ const EditBisuness = () => {
|
||||
|
||||
|
||||
|
||||
console.log(image)
|
||||
// console.log(image)
|
||||
return (
|
||||
<>
|
||||
<div className=" main-content">
|
||||
|
@ -14,7 +14,7 @@ const View_Bisuness = () => {
|
||||
// const { products, page, limit, totalProducts, pages } = state;
|
||||
|
||||
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
|
||||
const view_business = useCallback(async () => {
|
||||
let res = await axios.get(
|
||||
|
@ -21,7 +21,7 @@ import {
|
||||
import CIcon from '@coreui/icons-react'
|
||||
import { cilPencil, cilSettings, cilLockLocked, cilUser } from '@coreui/icons'
|
||||
const AddNews = () => {
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
let history = useHistory();
|
||||
const [image, setImage] = useState("");
|
||||
const [title, setTitle] = useState("");
|
||||
|
@ -25,7 +25,7 @@ import { cilPencil, cilSettings, cilLockLocked, cilUser } from '@coreui/icons'
|
||||
const EditNews = () => {
|
||||
const { id } = useParams();
|
||||
// console.log(id)
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
let history = useHistory();
|
||||
const [image, setImage] = useState("");
|
||||
const [title, setTitle] = useState("");
|
||||
|
@ -9,7 +9,7 @@ import { isAutheticated } from "../../auth";
|
||||
function News() {
|
||||
const [news, setNews] = useState([])
|
||||
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
|
||||
const getNews = useCallback(async () => {
|
||||
let res = await axios.get(
|
||||
|
@ -10,7 +10,7 @@ function ViewNews() {
|
||||
const [news, setNews] = useState([])
|
||||
const { id } = useParams();
|
||||
console.log(id)
|
||||
const { token } = isAutheticated();
|
||||
const token = isAutheticated();
|
||||
|
||||
const getNews = useCallback(async () => {
|
||||
let res = await axios.get(
|
||||
|
@ -40,7 +40,7 @@ const ForgotPassword = () => {
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
alert("You are not a User")
|
||||
alert("Wrong Email ID. Enter valid email to get the password")
|
||||
setLoading(false)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user