Add complate

This commit is contained in:
Swift
2024-02-03 20:12:03 +03:30
parent ecce34213e
commit 82d763785e
4 changed files with 32 additions and 4 deletions
+24 -2
View File
@@ -50,6 +50,12 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="hasPermission('apply')" class="d-flex mt-3" style="align-items: center">
<h5>پیگیری شده :</h5>
<el-checkbox v-model="complete" class="p-2"></el-checkbox>
</div>
<el-button v-if="hasPermission('apply')" class="p-2" type="primary" @click="applyComplaint">تایید</el-button>
</div> </div>
</div> </div>
</div> </div>
@@ -64,7 +70,9 @@ export default {
async asyncData({ $axios, params, query, error }) {}, async asyncData({ $axios, params, query, error }) {},
data() { data() {
return { return {
complaint: null complaint: null,
complete:false
} }
}, },
@@ -72,9 +80,23 @@ export default {
beforeMount() { beforeMount() {
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
}) })
}, },
methods: {} methods: {
hasPermission(permission) {
if (this.$auth.loggedIn) return this.$auth.user.permissions.includes(permission)
else return false
},
applyComplaint(){
this.$axios.put(`/api/admin/complaint/${this.$route.params.item}`,{ complete: this.complete }).then(res => {
this.complaint = res.data
this.complete = res.data.complete
this.$router.push('/admin/complaint')
})
}
}
} }
</script> </script>
+6
View File
@@ -52,6 +52,12 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="پیگیری شکایت" width="">
<template slot-scope="scope">
<span class="singleLineTxt" :title="scope.row.email"> {{ scope.row.complete ? "پیگیری شده" : "پیگیری نشده" }} </span>
</template>
</el-table-column>
<el-table-column label="نمایش" width="110" align="center"> <el-table-column label="نمایش" width="110" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<CButton <CButton
+1 -1
View File
@@ -109,6 +109,6 @@ module.exports = [
}, },
{ {
name: 'تایید پیگیریه شکایت', name: 'تایید پیگیریه شکایت',
value: 'applay' value: 'apply'
} }
] ]
+1 -1
View File
@@ -30,7 +30,7 @@ const complaintController = require('../controllers/complaintController')
/// ///////////// Complaint /// ///////////// Complaint
router.get('/complaint',hasPermission('complaint'), complaintController.gets) router.get('/complaint',hasPermission('complaint'), complaintController.gets)
router.get('/complaint/:id',hasPermission('complaint'), complaintController.get) router.get('/complaint/:id',hasPermission('complaint'), complaintController.get)
router.put('/complaint/:id',hasPermission('complaint'), complaintController.put) router.put('/complaint/:id',hasPermission('apply'), complaintController.put)
/// ///////////// warranty terms /// ///////////// warranty terms
router.post('/warranty', hasPermission('warranty-terms'), warrantyTermsController.create) router.post('/warranty', hasPermission('warranty-terms'), warrantyTermsController.create)