Add complaint

This commit is contained in:
Swift
2024-02-02 16:11:14 +03:30
parent cb3f8fa902
commit 1ca41258a6
6 changed files with 31 additions and 6 deletions
+13 -1
View File
@@ -82,6 +82,8 @@
font-icon="fas fa-folder"
@update:show="val => setDropdownState('adminS_CustomerM_Dropdown', val)"
>
<CSidebarNavItem
v-if="hasPermission('customers')"
@@ -106,6 +108,15 @@
font-icon="fal fa-plus"
exact
/>
<CSidebarNavItem
v-if="hasPermission('complaint')"
name="لیست شکایات "
:to="{ name: 'admin-complaint' }"
font-icon="fal fa-list"
:exact="false"
:badge="newComplaintReports ? { text: newComplaintReports, color: 'danger' } : null"
/>
</CSidebarNavDropdown>
<CSidebarNavDropdown
@@ -305,7 +316,8 @@ export default {
newPieceRequests: state => state.admin.newPieceRequests,
newOldPieceRequests: state => state.admin.newOldPieceRequests,
newBufferRequests: state => state.admin.newBufferRequests,
newGuaranteeReports: state => state.admin.newGuaranteeReports
newGuaranteeReports: state => state.admin.newGuaranteeReports,
newComplaintReports: state => state.admin.newComplaintReports
})
},
methods: {
+1 -1
View File
@@ -87,7 +87,7 @@ export default {
computed: {
},
mounted(){
beforeMount(){
this.$axios.get('/api/admin/complaint').then(res=>{
this.complaint = res.data
@@ -6,6 +6,8 @@ const PieceRequest = require('../../models/PieceRequest')
const OldPieceRequest = require('../../models/OldPieceRequest')
const BufferRequest = require('../../models/BufferRequest')
const GuaranteeReport = require('../../models/GuaranteeReport')
const Complaint = require('../../models/Complaint')
module.exports.getAllNotifs = async socket => {
try {
@@ -32,7 +34,9 @@ module.exports.getAllNotifs = async socket => {
BufferRequest.find({ status: 'sent' }),
// newGuaranteeReports
GuaranteeReport.find({ status: 'sent', seen: false })
GuaranteeReport.find({ status: 'sent', seen: false }),
Complaint.find({ read: false })
])
const unreadCuMsgs = allData[0]
@@ -43,6 +47,8 @@ module.exports.getAllNotifs = async socket => {
const newOldPieceRequests = allData[5]
const newBufferRequests = allData[6]
const newGuaranteeReports = allData[7]
const complaint = allData[8]
socket.emit(`admin:allNotifs`, {
unreadCuMsgs: unreadCuMsgs.length,
@@ -52,7 +58,8 @@ module.exports.getAllNotifs = async socket => {
newPieceRequests: newPieceRequests.length,
newOldPieceRequests: newOldPieceRequests.length,
newBufferRequests: newBufferRequests.length,
newGuaranteeReports: newGuaranteeReports.length
newGuaranteeReports: newGuaranteeReports.length,
newComplaintReports:complaint.length
})
} catch (e) {
console.log(e)
+4 -1
View File
@@ -41,7 +41,10 @@ module.exports.gets = [
module.exports.get = [
async(req, res)=>{
const complaint = await Complaint.findById(req.params.id)
const complaint = await Complaint.findByIdAndUpdate(
req.params.id,
{read: true}
)
res.status(200).json(complaint)
+3 -1
View File
@@ -11,7 +11,9 @@ const ComplaintSchema = mongoose.Schema({
email: String,
receptionCode: String,
caption: String,
callType: Boolean
callType: Boolean,
read: { type: Boolean, default: false },
})
+1
View File
@@ -10,6 +10,7 @@ export const state = () => ({
newOldPieceRequests: 0,
newBufferRequests: 0,
newGuaranteeReports: 0,
newComplaintReports: 0,
verityProducts: [],
panatechProducts: [],
iranProvinces: [],