This commit is contained in:
Malai Raja
2023-12-29 10:28:20 +05:30
parent 0fee281db0
commit 51e4ea978f
7 changed files with 75 additions and 4 deletions

2
.env
View File

@@ -7,7 +7,7 @@ REACT_APP_API_URL=https://mock-data-api-nextjs.vercel.app/
## Google Map Key
REACT_APP_GOOGLE_MAPS_API_KEY=AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8
REACT_APP_RIDER_ACCESS_ID=AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk
## Firebase - Google Auth
REACT_APP_FIREBASE_API_KEY=

Submodule nearlexpressbuild updated: 5a4660f08d...c351223c49

View File

@@ -163,10 +163,11 @@ navigate('/login')
<Stack>
<Typography variant="h6">
{/* {user?.name} */}
{localStorage.getItem('fullname') || ''}
</Typography>
<Typography variant="body2" color="textSecondary">
{/* UI/UX Designer */}
user
</Typography>
</Stack>
</Stack>

View File

@@ -516,12 +516,22 @@ const Client = () => {
})
setCurrentcustomerid('')
fetchtable(localStorage.getItem('tenantid'))
}else{
enqueueSnackbar(res.data.message, {
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
}
setLoading(false)
}).catch((err) => {
console.log(err)
enqueueSnackbar(err.message, {
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
setLoading(false)
})
} catch (err) {

View File

@@ -542,7 +542,7 @@ const Createclient = () => {
<Grid item xs={12} sm={6}>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-location">Suburb</InputLabel>
<InputLabel htmlFor="personal-location">Location</InputLabel>
<TextField fullWidth
// defaultValue="New York"
id="personal-location" placeholder="Location"

View File

@@ -156,6 +156,7 @@ const Login = () => {
localStorage.setItem("roleid", res.data.details.roleid);
localStorage.setItem("tenantid", res.data.details.tenantid);
localStorage.setItem("applocationid", res.data.details.applocationid);
localStorage.setItem("fullname", res.data.details.fullname);
navigate('/orders');

View File

@@ -156,6 +156,7 @@ const Createorder = () => {
const [tenantinfo, setTenantinfo] = useState({});
const [searchword, setSearchword] = useState('');
const [clientdetailarr, setClientdetailarr] = useState([])
const [admintoken,setAdmintoken]=useState('');
useEffect(() => {
@@ -204,6 +205,24 @@ const Createorder = () => {
console.log(res)
if (res.data.status) {
setTenantinfo(res.data.details);
fetchadmintoken(res.data.details.partnerid)
}
setLoading(false)
}).catch((err) => {
console.log(err)
setLoading(false)
})
}
const fetchadmintoken = async (tid) => {
setLoading(true)
await axios.get(`${process.env.REACT_APP_URL}/partners/getadmintoken/?partnerid=${tid}`)
.then((res) => {
console.log(res)
if (res.data.status) {
// setTenantinfo(res.data.details);
setAdmintoken(res.data.details.userfcmtokem)
}
setLoading(false)
}).catch((err) => {
@@ -304,6 +323,11 @@ const Createorder = () => {
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
if(admintoken){
notifyadmin(admintoken)
}
navigate('/orders')
} else {
opentoast(res.data.message)
@@ -461,6 +485,41 @@ const Createorder = () => {
}
}
const notifyadmin = async (id1) => {
setLoading(true)
await axios.post(`${process.env.REACT_APP_URL}/utils/notifyuser`, {
"sender": localStorage.getItem('firstname'),
"accessid": process.env.REACT_APP_RIDER_ACCESS_ID,
"notification": {
"priority": "high",
"to": id1,
"notification": {
"title": "Nearle Admin",
"body": "Orders has been placed for delivery.Kindly accept and process deliveries",
"sound": "ring"
}
}
})
.then((res) => {
console.log(res)
if (res.data.message == 'Success') {
enqueueSnackbar("Notification sent Successfully", {
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
}
setLoading(false)
}).catch((err) => {
console.log(err)
enqueueSnackbar(err.message, {
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
setLoading(false)
})
}