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>
|
<span className="ms-1">{new Date().getFullYear()} © CMP.</span>
|
||||||
</div>
|
</div>
|
||||||
\
|
|
||||||
</CFooter>
|
</CFooter>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ import store from './store'
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
const setupAxios = () => {
|
const setupAxios = () => {
|
||||||
axios.defaults.baseURL = 'https://cms-api-dashboard.herokuapp.com/';
|
//axios.defaults.baseURL = 'https://cms-api-dashboard.herokuapp.com/';
|
||||||
//axios.defaults.baseURL = 'http://localhost:5000'
|
axios.defaults.baseURL = 'http://localhost:5000'
|
||||||
axios.defaults.headers = {
|
axios.defaults.headers = {
|
||||||
'Cache-Control': 'no-cache,no-store',
|
'Cache-Control': 'no-cache,no-store',
|
||||||
'Pragma': 'no-cache',
|
'Pragma': 'no-cache',
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
CRow,
|
CRow,
|
||||||
} from '@coreui/react'
|
} from '@coreui/react'
|
||||||
import CIcon from '@coreui/icons-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 AddBanner = () => {
|
||||||
const { token } = isAutheticated();
|
const { token } = isAutheticated();
|
||||||
let history = useHistory();
|
let history = useHistory();
|
||||||
@ -31,17 +31,23 @@ const AddBanner = () => {
|
|||||||
|
|
||||||
const [startDate, setStartDate] = useState(new Date());
|
const [startDate, setStartDate] = useState(new Date());
|
||||||
const [endDate, setEndDate] = useState(new Date());
|
const [endDate, setEndDate] = useState(new Date());
|
||||||
|
const [subSection, setSubSection] = useState("");
|
||||||
|
const [category, setCategory] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const myForm = new FormData();
|
const myForm = new FormData();
|
||||||
|
|
||||||
myForm.set("title", title);
|
myForm.set("title", title);
|
||||||
myForm.set("subTitle", subTitle);
|
myForm.set("subTitle", subTitle);
|
||||||
myForm.set("section", section);
|
myForm.set("section", section);
|
||||||
|
myForm.set("subSection", subSection);
|
||||||
myForm.set("startDate", startDate);
|
myForm.set("startDate", startDate);
|
||||||
myForm.set("endDate", endDate);
|
myForm.set("endDate", endDate);
|
||||||
myForm.set("image", image);
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="bg-light min-vh-70 d-flex flex-row ">
|
<div className="bg-light min-vh-70 d-flex flex-row ">
|
||||||
@ -112,6 +138,7 @@ const AddBanner = () => {
|
|||||||
|
|
||||||
<CInputGroup className="mb-3">
|
<CInputGroup className="mb-3">
|
||||||
<CInputGroupText >
|
<CInputGroupText >
|
||||||
|
Section
|
||||||
<CIcon icon={cilNotes} />
|
<CIcon icon={cilNotes} />
|
||||||
</CInputGroupText>
|
</CInputGroupText>
|
||||||
|
|
||||||
@ -122,16 +149,37 @@ const AddBanner = () => {
|
|||||||
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="home">home</option>
|
||||||
<option value="news">news</option>
|
<option value="news">news</option>
|
||||||
<option value="events">events</option>
|
<option value="events">events</option>
|
||||||
<option value="offers">offers</option>
|
<option value="offers">offers</option>
|
||||||
<option value="category" >category</option>
|
<option value="category" >category</option>
|
||||||
<option value="directory">directory</option>
|
|
||||||
{/* <option value="6">--select--</option> */}
|
{/* <option value="6">--select--</option> */}
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</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>
|
||||||
<CInputGroup className="mb-3">
|
<CInputGroup className="mb-3">
|
||||||
<CInputGroupText>
|
<CInputGroupText>
|
||||||
|
@ -98,6 +98,8 @@ function banner() {
|
|||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Image</th>
|
<th>Image</th>
|
||||||
<th>Section</th>
|
<th>Section</th>
|
||||||
|
<th>Sub Section</th>
|
||||||
|
<th>Status</th>
|
||||||
<th>Added On</th>
|
<th>Added On</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -108,7 +110,18 @@ function banner() {
|
|||||||
<td>{item?.title}</td>
|
<td>{item?.title}</td>
|
||||||
<td>
|
<td>
|
||||||
<img src={`${item?.image.url}`} width="50" alt="" /></td>
|
<img src={`${item?.image.url}`} width="50" alt="" /></td>
|
||||||
|
|
||||||
|
|
||||||
<td>{item?.section}</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>
|
<td>
|
||||||
{/* {item?.addedOn} */}
|
{/* {item?.addedOn} */}
|
||||||
{new Date(`${item?.addedOn}`).toDateString()}<span> , {`${formatAMPM(item?.addedOn)}`}</span>
|
{new Date(`${item?.addedOn}`).toDateString()}<span> , {`${formatAMPM(item?.addedOn)}`}</span>
|
||||||
|
@ -93,7 +93,7 @@ function ViewUsers() {
|
|||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
{/* <th>Description</th> */}
|
{/* <th>Description</th> */}
|
||||||
<tr><th>Pnone No.</th>
|
<tr><th>Phone No.</th>
|
||||||
<td>{user?.phone}</td></tr>
|
<td>{user?.phone}</td></tr>
|
||||||
<tr><th>Role</th>
|
<tr><th>Role</th>
|
||||||
<td>{user?.role}</td></tr>
|
<td>{user?.role}</td></tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user