AppName Copyright message

This commit is contained in:
pawan-dot 2023-02-24 18:09:23 +05:30
parent 407ba2868a
commit dc06854fbd
10 changed files with 523 additions and 28 deletions

View File

@ -30,6 +30,7 @@ import {
cilTablet,
cilTags,
cilTennisBall,
cilText,
cilUser,
@ -187,6 +188,13 @@ const _nav = [
icon: <CIcon icon={cilMedicalCross} customClassName="nav-icon" />,
to: '/socialmedia',
},
{
component: CNavItem,
name: 'Application Name',
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
to: '/application/name',
},
{
component: CNavItem,
name: 'Address',
@ -199,6 +207,12 @@ const _nav = [
icon: <CIcon icon={cilCommand} customClassName="nav-icon" />,
to: '/logo',
},
{
component: CNavItem,
name: 'Copyright Message',
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
to: '/copyright/message',
},
],
},

View File

@ -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 (
<CFooter>
<div>
<span className="ms-1">{new Date().getFullYear()} &copy; Any Time Prasad ( ATP ) .</span>
<span className="ms-1">{new Date().getFullYear()} &copy; {copyright ? copyright : ''} .</span>
</div>
</CFooter>

View File

@ -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 (
<CHeader position="sticky" className="mb-4">
<CContainer fluid>
@ -32,12 +51,12 @@ const AppHeader = () => {
<CIcon icon={cilMenu} size="lg" />
</CHeaderToggler>
<CHeaderBrand className="mx-auto d-md-none" to="/">
<h3>Any Time Prasad</h3>
<h3>{AppName}</h3>
</CHeaderBrand>
<CHeaderNav className="d-none d-md-flex me-auto">
<CNavItem>
<CNavLink to="/dashboard" component={NavLink} activeClassName="active">
ATP Dashboard
<h3>{AppName}</h3>
</CNavLink>
</CNavItem>
{/* <CNavItem>

View File

@ -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 = () => {
<CSidebarBrand className="d-none d-md-flex" style={{ background: 'rgb(140, 213, 213)' }} to="/">
{/* <CIcon className="sidebar-brand-full" icon={logoNegative} height={35} /> */}
{HeaderlogoUrl ? <Link to='/dashboard'><img src={HeaderlogoUrl} alt='' /></Link> : <h2>ATP Dashboard</h2>}
{HeaderlogoUrl ? <Link to='/dashboard'><img src={HeaderlogoUrl} alt='' /></Link> : { AppName } ? <h2>Airport Dashboard</h2> : ''}
{/* <CIcon className="sidebar-brand-narrow" height={35} /> */}
<CIcon className="sidebar-brand-narrow" icon={sygnet} height={35} />
</CSidebarBrand>

View File

@ -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',

View File

@ -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 },

View File

@ -1,8 +1,213 @@
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 (
<div>AddComplaint</div>
<div className="container">
<div className="row">
<div className="col-12">
<div
className="
page-title-box
d-flex
align-items-center
justify-content-between
"
>
<div style={{ fontSize: '22px' }} className="fw-bold">
Complaint
</div>
<div style={{ display: 'flex', gap: '1rem' }}>
<h4 className="mb-0"></h4>
</div>
<div className="page-title-right">
<Button
variant="contained"
color="primary"
style={{
fontWeight: 'bold',
marginBottom: '1rem',
textTransform: 'capitalize',
marginRight: '5px',
}}
onClick={() => handleSubmit()}
disabled={loading}
>
{loading ? 'Loading' : 'Save'}
</Button>
<Link to="/complaints">
<Button
variant="contained"
color="secondary"
style={{
fontWeight: 'bold',
marginBottom: '1rem',
textTransform: 'capitalize',
}}
>
Back
</Button>
</Link>
</div>
</div>
</div>
</div>
<div className="row">
<div className="col-lg-12 col-md-12 col-sm-12 my-1">
<div className="card h-100">
<div className="card-body px-5">
<div className="mb-3">
<label htmlFor="title" className="form-label">
Mobile Or Email *
</label>
<input
type="text"
className="form-control"
id="MobileOrEmail"
value={data.MobileOrEmail}
maxLength={150}
onChange={(e) => handleChange(e)}
/>
{data.MobileOrEmail ? <><small className="charLeft mt-4 fst-italic">
{150 - data.MobileOrEmail.length} characters left
</small></> : <></>
} </div>
<div className="mb-3">
<label htmlFor="title" className="form-label">
Complaint *
</label>
<textarea
type="text"
className="form-control"
id="Complaint"
rows="10"
cols="100"
value={data.Complaint}
placeholder='your Complaint...'
maxLength="1000"
onChange={(e) => handleChange(e)}
>
</textarea>
{data.Complaint ? <><small className="charLeft mt-4 fst-italic">
{1000 - data.Complaint.length} characters left
</small></> : <></>
}
</div>
{/* <div className="mb-3">
<label htmlFor="title" className="form-label">
Description *
</label>
<br />
<textarea id="w3review" name="w3review" rows="10" cols="100">
At w3schools.com you will learn how to make a website. They offer free tutorials in all web development technologies.
</textarea>
</div> */}
</div>
</div>
</div>
</div>
</div>
)
}

View File

@ -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 (
<tr key={i}>
<td className="text-start">{product.title}</td>
<td className="text-start">{product.MobileOrEmail}</td>
<td className="text-start">{product.description}</td>
<td className="text-start">{product.Complaint}</td>
<td className="text-start">
{new Date(product.createdAt).toLocaleString('en-IN', {
weekday: 'short',

View File

@ -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 (
<div>
<div className="main-content">
<div className="page-content">
<div className="container-fluid">
<div className="row">
<div className="col-lg-12">
<div className="card">
<div className="card-body">
<div className="row">
<div className="col-md-12 col-lg-6 col-xl-6">
<h1 className="text-left head-small">Application Name</h1>
<form>
<div className="row">
<div className="col-lg-12">
<div className="form-group">
<>
<label for="basicpill-phoneno-input" className="label-100 mt-3">
Application Name
</label>
<input
value={appName}
type="text"
name="appName"
onChange={(e) => handelChange(e)}
className="form-control input-field "
id="basicpill-phoneno-input"
/>
</>
</div>
</div>
</div>
<div className="row mt-1">
<div className="col-lg-12">
<div className="form-group text-left">
<button
type="button"
onClick={handelSubmit}
className="btn btn-success btn-login waves-effect waves-light me-3 pt-2 pb-2 pr-4 pl-4"
>
<ClipLoader loading={loading} size={18} />
{!loading && 'Save'}
</button>
</div>
</div>
</div>
</form>
</div>
</div>
{/* <!-- end table-responsive --> */}
</div>
</div>
</div>
</div>
</div>
{/* <!-- container-fluid --> */}
</div>
{/* <!-- End Page-content --> */}
</div>
</div>
)
}
export default ApplicationName

View File

@ -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 (
<div>
<div className="main-content">
<div className="page-content">
<div className="container-fluid">
<div className="row">
<div className="col-lg-12">
<div className="card">
<div className="card-body">
<div className="row">
<div className="col-md-12 col-lg-6 col-xl-6">
<h1 className="text-left head-small">Copyright Message</h1>
<form>
<div className="row">
<div className="col-lg-12">
<div className="form-group">
<>
<label for="basicpill-phoneno-input" className="label-100 mt-3">
Copyright Message
</label>
<input
value={copyright}
type="text"
name="copyright"
onChange={(e) => handelChange(e)}
className="form-control input-field "
id="basicpill-phoneno-input"
/>
</>
</div>
</div>
</div>
<div className="row mt-1">
<div className="col-lg-12">
<div className="form-group text-left">
<button
type="button"
onClick={handelSubmit}
className="btn btn-success btn-login waves-effect waves-light me-3 pt-2 pb-2 pr-4 pl-4"
>
<ClipLoader loading={loading} size={18} />
{!loading && 'Save'}
</button>
</div>
</div>
</div>
</form>
</div>
</div>
{/* <!-- end table-responsive --> */}
</div>
</div>
</div>
</div>
</div>
{/* <!-- container-fluid --> */}
</div>
{/* <!-- End Page-content --> */}
</div>
</div>
)
}
export default CopyrightMessage