add
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<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="m-3">
|
||||||
<div class="row ui-box p-3">
|
<div class="row ui-box p-3">
|
||||||
<h4>شکایت</h4>
|
<h4>شکایت</h4>
|
||||||
@@ -49,15 +53,33 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr class="mt-3"/>
|
<hr class="mt-3" />
|
||||||
<div v-if="hasPermission('apply')" >
|
<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">
|
<div class="d-flex mt-3" style="align-items: center">
|
||||||
<h5>پیگیری شده :</h5>
|
<h5>پیگیری شده :</h5>
|
||||||
<el-checkbox v-model="complete" class="p-2"></el-checkbox>
|
<el-checkbox v-model="complete" class="p-2"></el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex mt-3" style="align-items: center; justify-self: center;">
|
<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>
|
<el-button class="p-2 w-20 m-auto" type="primary" @click="applyComplaint">تایید</el-button>
|
||||||
|
</div>
|
||||||
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -74,7 +96,8 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
complaint: null,
|
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.$axios.get(`/api/admin/complaint/${this.$route.params.item}`).then(res => {
|
||||||
this.complaint = res.data
|
this.complaint = res.data
|
||||||
this.complete = res.data.complete
|
this.complete = res.data.complete
|
||||||
|
this.desc = res.data.desc
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -91,7 +116,7 @@ export default {
|
|||||||
else return false
|
else return false
|
||||||
},
|
},
|
||||||
applyComplaint() {
|
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.complaint = res.data
|
||||||
this.complete = res.data.complete
|
this.complete = res.data.complete
|
||||||
this.$router.push('/admin/complaint')
|
this.$router.push('/admin/complaint')
|
||||||
@@ -126,8 +151,7 @@ export default {
|
|||||||
background-color: white;
|
background-color: white;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
.w-20{
|
.w-20 {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const { fullName, national, phoneNumber, email, receptionCode, caption } = req.
|
|||||||
|
|
||||||
module.exports.getsComplaint = [
|
module.exports.getsComplaint = [
|
||||||
async(req, res)=>{
|
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)
|
res.status(200).json(complaints)
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ module.exports.get = [
|
|||||||
const complaint = await Complaint.findByIdAndUpdate(
|
const complaint = await Complaint.findByIdAndUpdate(
|
||||||
req.params.id,
|
req.params.id,
|
||||||
{read: true}
|
{read: true}
|
||||||
)
|
).populate('user', 'first_name last_name')
|
||||||
|
|
||||||
res.status(200).json(complaint)
|
res.status(200).json(complaint)
|
||||||
|
|
||||||
@@ -94,10 +94,14 @@ module.exports.get = [
|
|||||||
|
|
||||||
module.exports.put = [
|
module.exports.put = [
|
||||||
async(req, res)=>{
|
async(req, res)=>{
|
||||||
const { complete } = req.body
|
const { complete, desc } = req.body
|
||||||
const complaint = await Complaint.findByIdAndUpdate(
|
const complaint = await Complaint.findByIdAndUpdate(
|
||||||
req.params.id,
|
req.params.id,
|
||||||
{complete},
|
{
|
||||||
|
complete,
|
||||||
|
user:req.user_id,
|
||||||
|
desc
|
||||||
|
},
|
||||||
{new:true}
|
{new:true}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user