make it betterlkjkfkf
This commit is contained in:
parent
6fc6d8b36f
commit
973783b95a
@ -8,7 +8,7 @@ const AppFooter = () => {
|
||||
|
||||
<span className="ms-1">{new Date().getFullYear()} © CMP.</span>
|
||||
</div>
|
||||
\
|
||||
|
||||
</CFooter>
|
||||
)
|
||||
}
|
||||
|
@ -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',
|
||||
|
@ -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 (
|
||||
<>
|
||||
<div className="bg-light min-vh-70 d-flex flex-row ">
|
||||
@ -111,7 +137,8 @@ const AddBanner = () => {
|
||||
</CInputGroup>
|
||||
|
||||
<CInputGroup className="mb-3">
|
||||
<CInputGroupText>
|
||||
<CInputGroupText >
|
||||
Section
|
||||
<CIcon icon={cilNotes} />
|
||||
</CInputGroupText>
|
||||
|
||||
@ -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 "
|
||||
>
|
||||
|
||||
<option value="1">--select--</option>
|
||||
<option value="1">--Select--</option>
|
||||
<option value="home">home</option>
|
||||
<option value="news">news</option>
|
||||
<option value="events">events</option>
|
||||
<option value="offers">offers</option>
|
||||
<option value="category">category</option>
|
||||
<option value="directory">directory</option>
|
||||
<option value="category" >category</option>
|
||||
|
||||
{/* <option value="6">--select--</option> */}
|
||||
|
||||
|
||||
</select>
|
||||
{category && <>
|
||||
<CInputGroupText className="ml-2 mt-1">
|
||||
SubSection
|
||||
<CIcon icon={cilNoteAdd} />
|
||||
</CInputGroupText>
|
||||
<select
|
||||
name="subSection"
|
||||
value={subSection}
|
||||
onChange={(e) => setSubSection(e.target.value)}
|
||||
className="form-control input-field mt-1"
|
||||
>
|
||||
<option value="1">--Select SubCategory--</option>
|
||||
{category.map((item, index) => (
|
||||
|
||||
<option value={item.name}>{item.name}</option>
|
||||
))}
|
||||
{/* <option value="6">--select--</option> */}
|
||||
|
||||
|
||||
</select></>}
|
||||
</CInputGroup>
|
||||
<CInputGroup className="mb-3">
|
||||
<CInputGroupText>
|
||||
|
@ -98,6 +98,8 @@ function banner() {
|
||||
<th>Title</th>
|
||||
<th>Image</th>
|
||||
<th>Section</th>
|
||||
<th>Sub Section</th>
|
||||
<th>Status</th>
|
||||
<th>Added On</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -108,7 +110,18 @@ function banner() {
|
||||
<td>{item?.title}</td>
|
||||
<td>
|
||||
<img src={`${item?.image.url}`} width="50" alt="" /></td>
|
||||
|
||||
|
||||
<td>{item?.section}</td>
|
||||
<th>{item?.subSection}</th>
|
||||
<td>
|
||||
<span
|
||||
className={`badge rounded-pill bg-${new Date(`${item?.endDate}`) > new Date() ? "success" : "danger"
|
||||
} font-size-10`}
|
||||
>
|
||||
{new Date(`${item?.endDate}`) > new Date() ? "Live" : "Suspended"}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{/* {item?.addedOn} */}
|
||||
{new Date(`${item?.addedOn}`).toDateString()}<span> , {`${formatAMPM(item?.addedOn)}`}</span>
|
||||
|
@ -93,7 +93,7 @@ function ViewUsers() {
|
||||
</td></tr>
|
||||
|
||||
{/* <th>Description</th> */}
|
||||
<tr><th>Pnone No.</th>
|
||||
<tr><th>Phone No.</th>
|
||||
<td>{user?.phone}</td></tr>
|
||||
<tr><th>Role</th>
|
||||
<td>{user?.role}</td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user