This commit is contained in:
Swift
2024-02-25 01:32:03 +03:30
parent 994e7f8d97
commit 0867b7ab89
2 changed files with 40 additions and 12 deletions
+32 -8
View File
@@ -1,5 +1,9 @@
<template>
<div>
<CustomSubHeader>
<CBreadcrumb class="border-0 mb-0">شکایت</CBreadcrumb>
<CButton size="sm" color="primary" class="mr-auto" :to="{ name: 'admin-complaint' }">برگشت به صفحه قبل</CButton>
</CustomSubHeader>
<div class="m-3">
<div class="row ui-box p-3">
<h4>شکایت</h4>
@@ -49,15 +53,33 @@
</div>
</div>
</div>
<hr class="mt-3"/>
<div v-if="hasPermission('apply')" >
<hr class="mt-3" />
<div v-if="hasPermission('apply')">
<div class="d-flex mt-3" style="align-items: center">
<h5 style="text-wrap: nowrap; margin-left: 10px;">نام و نام خانوادگی: </h5>
<p>{{ complaint?.user?.first_name + " " + complaint?.user?.last_name }}</p>
</div>
<div class="d-flex mt-3" style="align-items: center">
<h5 style="text-wrap: nowrap; margin-left: 10px;">توضیح :</h5>
<el-input v-model="desc" type="textarea" rows="3"></el-input>
</div>
<div class="d-flex mt-3" style="align-items: center">
<h5>پیگیری شده :</h5>
<el-checkbox v-model="complete" class="p-2"></el-checkbox>
</div>
<div class="d-flex mt-3" style="align-items: center; justify-self: center;">
<el-button class="p-2 w-20 m-auto" type="primary" @click="applyComplaint">تایید</el-button>
<div class="d-flex mt-3" style="align-items: center; justify-self: center">
<el-button class="p-2 w-20 m-auto" type="primary" @click="applyComplaint">تایید</el-button>
</div>
</div>
<div v-else>
<div v-if="complaint?.user" class="d-flex mt-3" style="align-items: center">
<h5 style="text-wrap: nowrap; margin-left: 10px;">نام و نام خانوادگی: </h5>
<p>{{ complaint.user?.first_name + " " + complaint.user?.last_name }}</p>
</div>
<div v-if="complaint?.desc" class="d-flex mt-3" style="align-items: center">
<h5 style="text-wrap: nowrap; margin-left: 10px;">توضیح: </h5>
<p>{{ complaint.desc }}</p>
</div>
</div>
</div>
</div>
@@ -74,7 +96,8 @@ export default {
data() {
return {
complaint: null,
complete: false
complete: false,
desc:''
}
},
@@ -83,6 +106,8 @@ export default {
this.$axios.get(`/api/admin/complaint/${this.$route.params.item}`).then(res => {
this.complaint = res.data
this.complete = res.data.complete
this.desc = res.data.desc
})
},
methods: {
@@ -91,7 +116,7 @@ export default {
else return false
},
applyComplaint() {
this.$axios.put(`/api/admin/complaint/${this.$route.params.item}`, { complete: this.complete }).then(res => {
this.$axios.put(`/api/admin/complaint/${this.$route.params.item}`, { complete: this.complete, desc: this.desc }).then(res => {
this.complaint = res.data
this.complete = res.data.complete
this.$router.push('/admin/complaint')
@@ -126,8 +151,7 @@ export default {
background-color: white;
border-radius: 10px;
}
.w-20{
.w-20 {
width: 20%;
}
</style>
+8 -4
View File
@@ -70,7 +70,7 @@ const { fullName, national, phoneNumber, email, receptionCode, caption } = req.
module.exports.getsComplaint = [
async(req, res)=>{
const complaints = await Complaint.find({type:0})
const complaints = await Complaint.find({type:0}).populate('user', 'first_name last_name')
res.status(200).json(complaints)
@@ -84,7 +84,7 @@ module.exports.get = [
const complaint = await Complaint.findByIdAndUpdate(
req.params.id,
{read: true}
)
).populate('user', 'first_name last_name')
res.status(200).json(complaint)
@@ -94,10 +94,14 @@ module.exports.get = [
module.exports.put = [
async(req, res)=>{
const { complete } = req.body
const { complete, desc } = req.body
const complaint = await Complaint.findByIdAndUpdate(
req.params.id,
{complete},
{
complete,
user:req.user_id,
desc
},
{new:true}
)