diff --git a/src/_nav.js b/src/_nav.js index 1c3eb0a..5b6f404 100644 --- a/src/_nav.js +++ b/src/_nav.js @@ -30,6 +30,7 @@ import { cilTablet, cilTags, cilTennisBall, + cilText, cilUser, @@ -187,6 +188,13 @@ const _nav = [ icon: , to: '/socialmedia', }, + { + component: CNavItem, + name: 'Application Name', + icon: , + to: '/application/name', + }, + { component: CNavItem, name: 'Address', @@ -199,6 +207,12 @@ const _nav = [ icon: , to: '/logo', }, + { + component: CNavItem, + name: 'Copyright Message', + icon: , + to: '/copyright/message', + }, ], }, diff --git a/src/components/AppFooter.js b/src/components/AppFooter.js index 79a0602..6fe21c2 100644 --- a/src/components/AppFooter.js +++ b/src/components/AppFooter.js @@ -1,12 +1,33 @@ -import React from 'react' +import React, { useEffect, useState } from 'react' import { CFooter } from '@coreui/react' +import { isAutheticated } from 'src/auth' +import axios from 'axios' const AppFooter = () => { + const token = isAutheticated() + + const [copyright, setCopyright] = useState('') + + useEffect(() => { + async function getConfiguration() { + const configDetails = await axios.get(`/api/config`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + configDetails.data.result.map((item) => { + setCopyright(item?.copyrightMessage) + + }) + } + getConfiguration() + }, []) + return (
- {new Date().getFullYear()} © Any Time Prasad ( ATP ) . + {new Date().getFullYear()} © {copyright ? copyright : ''} .
diff --git a/src/components/AppHeader.js b/src/components/AppHeader.js index 04c70ef..7ad2c6e 100644 --- a/src/components/AppHeader.js +++ b/src/components/AppHeader.js @@ -17,11 +17,30 @@ import { cilBell, cilEnvelopeOpen, cilList, cilMenu } from '@coreui/icons' import { AppBreadcrumb } from './index' import { AppHeaderDropdown } from './header/index' import { logo } from 'src/assets/brand/logo' +import axios from 'axios' +import { useEffect } from 'react' +import { useState } from 'react' +import { isAutheticated } from 'src/auth' const AppHeader = () => { const dispatch = useDispatch() const sidebarShow = useSelector((state) => state.sidebarShow) + const [AppName, setAppName] = useState('') + const token = isAutheticated() + + useEffect(() => { + async function getConfiguration() { + const configDetails = await axios.get(`/api/config`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + setAppName(configDetails.data.result[0]?.appName) + + } + getConfiguration() + }, []) return ( @@ -32,12 +51,12 @@ const AppHeader = () => { -

Any Time Prasad

+

{AppName}

- ATP Dashboard +

{AppName}

{/* diff --git a/src/components/AppSidebar.js b/src/components/AppSidebar.js index 20908da..0d4f6d1 100644 --- a/src/components/AppSidebar.js +++ b/src/components/AppSidebar.js @@ -29,7 +29,7 @@ const AppSidebar = () => { const token = isAutheticated() // urlcreated images - + const [AppName, setAppName] = useState('') const [HeaderlogoUrl, setHeaderlogoUrl] = useState('') const [FooterlogoUrl, setFooterlogoUrl] = useState('') const [AdminlogoUrl, setAdminlogoUrl] = useState('') @@ -41,6 +41,7 @@ const AppSidebar = () => { Authorization: `Bearer ${token}`, }, }) + setAppName(configDetails.data.result[0]?.appName) configDetails.data.result.map((item) => { setHeaderlogoUrl(item?.logo[0]?.Headerlogo) setFooterlogoUrl(item?.logo[0]?.Footerlogo) @@ -63,7 +64,7 @@ const AppSidebar = () => { {/* */} - {HeaderlogoUrl ? :

ATP Dashboard

} + {HeaderlogoUrl ? : { AppName } ?

Airport Dashboard

: ''} {/* */}
diff --git a/src/index.js b/src/index.js index c7cc467..2ede575 100644 --- a/src/index.js +++ b/src/index.js @@ -11,8 +11,8 @@ import axios from 'axios' import { store } from './redux/store'; const setupAxios = () => { - axios.defaults.baseURL = 'https://atpapi.checkapp.one' - //axios.defaults.baseURL = 'http://localhost:5000' + //axios.defaults.baseURL = 'https://atpapi.checkapp.one' + axios.defaults.baseURL = 'http://localhost:5000' axios.defaults.headers = { 'Cache-Control': 'no-cache,no-store', 'Pragma': 'no-cache', diff --git a/src/routes.js b/src/routes.js index c0d8f27..cd7cd23 100644 --- a/src/routes.js +++ b/src/routes.js @@ -54,6 +54,8 @@ 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' const routes = [ @@ -97,28 +99,20 @@ const routes = [ { path: '/order/:status/:id', name: 'View Order', element: ViewOrder }, - //Temple - { path: '/franchisees', name: 'Franchisees', element: Franchisees }, - { path: '/franchisee/add', name: 'Add Franchisee', element: AddFranchisee }, - { path: '/franchisee/edit/:id', name: 'Edit Franchisee', element: EditFranchisee }, + //dashboard { path: '/dashboard', name: 'Dashboard', element: Dashboard }, //------------settings------------------------// - //cities - { path: '/cities', name: 'Cities', element: Cities }, - { path: '/cities/add', name: 'Add City', element: AddCity }, - { path: '/cities/edit/:id', name: 'Edit City', element: EditCity }, - //states - { path: '/states', name: 'States', element: States }, - { path: '/states/add', name: 'Add State', element: AddState }, - { path: '/states/edit/:id', name: 'Edit State', element: EditState }, - // { path: '/socialmedia', name: 'Social Media', element: Socialmedia }, + { path: '/application/name', name: 'ApplicationName', element: ApplicationName }, + { path: '/copyright/message', name: 'Copyright Message', element: CopyrightMessage }, + + { path: '/address', name: 'Address', element: Address }, { path: '/logo', name: 'Logo', element: Logo }, diff --git a/src/views/Complaints/AddComplaint.js b/src/views/Complaints/AddComplaint.js index b968f84..74fc7ad 100644 --- a/src/views/Complaints/AddComplaint.js +++ b/src/views/Complaints/AddComplaint.js @@ -1,9 +1,214 @@ -import React from 'react' + + +import React, { useEffect, useState } from 'react' +import Button from '@material-ui/core/Button' +import { Link, useNavigate } from 'react-router-dom' +import swal from 'sweetalert' +import axios from 'axios' +import { isAutheticated } from 'src/auth' +// import { WebsiteURL } from '../WebsiteURL' const AddComplaint = () => { + const token = isAutheticated() + const navigate = useNavigate() + const [data, setData] = useState({ + + MobileOrEmail: '', + Complaint: '', + + + + }) + + + const [loading, setLoading] = useState(false) + + + + + + + + const handleChange = (e) => { + + + setData((prev) => ({ ...prev, [e.target.id]: e.target.value })) + } + + + + + const handleSubmit = () => { + if ( + data.MobileOrEmail.trim() === '' || + + data.Complaint.trim() === '' + + ) { + swal({ + title: 'Warning', + text: 'Fill all mandatory fields', + icon: 'error', + button: 'Close', + dangerMode: true, + }) + return + } + setLoading(true) + const formData = new FormData() + formData.set('MobileOrEmail', data.MobileOrEmail) + + formData.set('Complaint', data.Complaint) + + + + axios + .post(`/api/complaint/new/`, formData, { + headers: { + Authorization: `Bearer ${token}`, + 'Content-Type': 'multipart/formdata', + 'Access-Control-Allow-Origin': '*', + }, + }) + .then((res) => { + swal({ + title: 'Added', + text: 'Complaint added successfully!', + icon: 'success', + button: 'ok', + }) + setLoading(false) + navigate('/complaints', { replace: true }) + }) + .catch((err) => { + setLoading(false) + const message = err.response?.data?.message || 'Something went wrong!' + swal({ + title: 'Warning', + text: message, + icon: 'error', + button: 'Retry', + dangerMode: true, + }) + }) + } + return ( -
AddComplaint
+
+
+
+
+
+ Complaint +
+
+

+
+ +
+ + + + +
+
+
+
+
+
+
+
+ + + +
+ + handleChange(e)} + /> + {data.MobileOrEmail ? <> + {150 - data.MobileOrEmail.length} characters left + : <> + + }
+ +
+ + + + {data.Complaint ? <> + {1000 - data.Complaint.length} characters left + : <> + } +
+ + + {/*
+ +
+ +
*/} +
+
+
+ +
+
) } -export default AddComplaint \ No newline at end of file +export default AddComplaint diff --git a/src/views/Complaints/Complaints.js b/src/views/Complaints/Complaints.js index f1191fe..8af0336 100644 --- a/src/views/Complaints/Complaints.js +++ b/src/views/Complaints/Complaints.js @@ -27,13 +27,13 @@ const Complaints = () => { const getComplaintsData = async () => { axios - .get(`/api/information/getAll/`, { + .get(`/api/complaint/getAll/`, { headers: { Authorization: `Bearer ${token}`, }, }) .then((res) => { - setComplaintsData(res.data?.information) + setComplaintsData(res.data?.complaint) setLoading(false) }) .catch((err) => { @@ -188,9 +188,9 @@ const Complaints = () => { showData.map((product, i) => { return ( - {product.title} + {product.MobileOrEmail} - {product.description} + {product.Complaint} {new Date(product.createdAt).toLocaleString('en-IN', { weekday: 'short', diff --git a/src/views/configuration/ApplicationName.js b/src/views/configuration/ApplicationName.js new file mode 100644 index 0000000..5e1597d --- /dev/null +++ b/src/views/configuration/ApplicationName.js @@ -0,0 +1,119 @@ +import React, { useEffect, useState } from 'react' +import { Link } from 'react-router-dom' +import ClipLoader from 'react-spinners/ClipLoader' + +import swal from 'sweetalert' +import axios from 'axios' +import { isAutheticated } from 'src/auth' + +function ApplicationName() { + const [loading, setLoading] = useState(false) + const token = isAutheticated() + + const [appName, setAppName] = useState('') + + useEffect(() => { + async function getConfiguration() { + const configDetails = await axios.get(`/api/config`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + configDetails.data.result.map((item) => { + setAppName(item?.appName) + + }) + } + getConfiguration() + }, []) + + async function handelChange(e) { + + + setAppName(e.target.value) + } + async function handelSubmit() { + setLoading(true) + + let res = await axios.post(`/api/config/application/name`, { appName }, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + + if (res) { + setLoading(false) + console.log(res) + swal('Success!', res.data.message, res.data.status) + } + } + return ( +
+ +
+
+
+
+
+
+
+
+
+

Application Name

+ +
+
+
+
+ <> + + + + + handelChange(e)} + className="form-control input-field " + id="basicpill-phoneno-input" + /> + +
+
+
+
+
+
+ +
+
+
+
+
+
+ + {/* */} +
+
+
+
+
+ {/* */} +
+ {/* */} +
+
+ ) +} + +export default ApplicationName diff --git a/src/views/configuration/CopyrightMessage.js b/src/views/configuration/CopyrightMessage.js new file mode 100644 index 0000000..4b2d896 --- /dev/null +++ b/src/views/configuration/CopyrightMessage.js @@ -0,0 +1,122 @@ + + +import React, { useEffect, useState } from 'react' +import { Link } from 'react-router-dom' +import ClipLoader from 'react-spinners/ClipLoader' + +import swal from 'sweetalert' +import axios from 'axios' +import { isAutheticated } from 'src/auth' + +function CopyrightMessage() { + const [loading, setLoading] = useState(false) + const token = isAutheticated() + + const [copyright, setCopyright] = useState('') + + useEffect(() => { + async function getConfiguration() { + const configDetails = await axios.get(`/api/config`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + configDetails.data.result.map((item) => { + setCopyright(item?.copyrightMessage) + + }) + } + getConfiguration() + }, []) + + async function handelChange(e) { + + + setCopyright(e.target.value) + } + async function handelSubmit() { + setLoading(true) + + let res = await axios.post(`/api/config/copyright/message`, { copyright }, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + + if (res) { + setLoading(false) + console.log(res) + swal('Success!', res.data.message, res.data.status) + } + } + return ( +
+ +
+
+
+
+
+
+
+
+
+

Copyright Message

+ +
+
+
+
+ <> + + + + + handelChange(e)} + className="form-control input-field " + id="basicpill-phoneno-input" + /> + +
+
+
+
+
+
+ +
+
+
+
+
+
+ + {/* */} +
+
+
+
+
+ {/* */} +
+ {/* */} +
+
+ ) +} + +export default CopyrightMessage