diff --git a/src/components/AppFooter.js b/src/components/AppFooter.js index 0560963..90a810f 100644 --- a/src/components/AppFooter.js +++ b/src/components/AppFooter.js @@ -8,7 +8,7 @@ const AppFooter = () => { {new Date().getFullYear()} © CMP. - \ + ) } diff --git a/src/index.js b/src/index.js index 34efee9..f582681 100644 --- a/src/index.js +++ b/src/index.js @@ -10,8 +10,8 @@ import store from './store' import axios from 'axios' const setupAxios = () => { - axios.defaults.baseURL = 'https://cms-api-dashboard.herokuapp.com/'; - //axios.defaults.baseURL = 'http://localhost:5000' + //axios.defaults.baseURL = 'https://cms-api-dashboard.herokuapp.com/'; + axios.defaults.baseURL = 'http://localhost:5000' axios.defaults.headers = { 'Cache-Control': 'no-cache,no-store', 'Pragma': 'no-cache', diff --git a/src/views/Banners/AddBanner.js b/src/views/Banners/AddBanner.js index 1dbebd0..6affc3c 100644 --- a/src/views/Banners/AddBanner.js +++ b/src/views/Banners/AddBanner.js @@ -20,7 +20,7 @@ import { CRow, } from '@coreui/react' import CIcon from '@coreui/icons-react' -import { cilPencil, cilNotes, cilCalendar } from '@coreui/icons' +import { cilPencil, cilNotes, cilCalendar, cilAddressBook, cil3d, cilActionUndo, cilNoteAdd } from '@coreui/icons' const AddBanner = () => { const { token } = isAutheticated(); let history = useHistory(); @@ -31,17 +31,23 @@ const AddBanner = () => { const [startDate, setStartDate] = useState(new Date()); const [endDate, setEndDate] = useState(new Date()); + const [subSection, setSubSection] = useState(""); + const [category, setCategory] = useState(false); + + const [loading, setLoading] = useState(false); + const handleSubmit = async () => { const myForm = new FormData(); myForm.set("title", title); myForm.set("subTitle", subTitle); myForm.set("section", section); + myForm.set("subSection", subSection); myForm.set("startDate", startDate); myForm.set("endDate", endDate); myForm.set("image", image); @@ -77,6 +83,26 @@ const AddBanner = () => { }; + useEffect(() => { + const getData = async () => { + let res = await axios.get( + `/api/category/getAll`, + { + headers: { + Authorization: `Bearer ${token}`, + }, + } + ); + console.log(res.data) + setCategory(res.data.category) + } + if (section === "category") { + getData() + } else { + setCategory(false) + } + }, [section]) + return ( <>
@@ -111,7 +137,8 @@ const AddBanner = () => { - + + Section @@ -119,19 +146,40 @@ const AddBanner = () => { name="section" value={section} onChange={(e) => setSection(e.target.value)} - className="form-control input-field" + className="form-control input-field " > - + - - + + {/* */} + + {category && <> + + SubSection + + + } diff --git a/src/views/Banners/Banner.js b/src/views/Banners/Banner.js index 928443d..41dfe9c 100644 --- a/src/views/Banners/Banner.js +++ b/src/views/Banners/Banner.js @@ -98,6 +98,8 @@ function banner() { Title Image Section + Sub Section + Status Added On Action @@ -108,7 +110,18 @@ function banner() { {item?.title} + + {item?.section} + {item?.subSection} + + new Date() ? "success" : "danger" + } font-size-10`} + > + {new Date(`${item?.endDate}`) > new Date() ? "Live" : "Suspended"} + + {/* {item?.addedOn} */} {new Date(`${item?.addedOn}`).toDateString()} , {`${formatAMPM(item?.addedOn)}`} diff --git a/src/views/Users/ViewUsers.js b/src/views/Users/ViewUsers.js index 7fd6ba8..0250e1f 100644 --- a/src/views/Users/ViewUsers.js +++ b/src/views/Users/ViewUsers.js @@ -93,7 +93,7 @@ function ViewUsers() { {/* Description */} - Pnone No. + Phone No. {user?.phone} Role {user?.role}