edit gets
This commit is contained in:
@@ -1,64 +1,58 @@
|
||||
<template>
|
||||
<div>
|
||||
<CustomSubHeader>
|
||||
<CBreadcrumb class="border-0 mb-0"> نظر سنجی </CBreadcrumb>
|
||||
|
||||
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
||||
</CustomSubHeader>
|
||||
<CCard>
|
||||
<CCardHeader>
|
||||
<slot name="header">
|
||||
<CIcon name="cil-grid" />
|
||||
نظر سنجی
|
||||
</slot>
|
||||
</CCardHeader>
|
||||
|
||||
<CCard>
|
||||
<CCardBody>
|
||||
<el-table :data="complaint" style="width: 100%">
|
||||
<div>
|
||||
<h3>میزان رضایت کلی مشتریان در تمام نظرات ثبت شده:</h3>
|
||||
|
||||
<ul class="mt-4">
|
||||
<li v-for="item in surveyOptions" :key="item.fieldName + '_Option'">
|
||||
<p>
|
||||
<span>{{ item.title }}</span>
|
||||
<b>%{{ getPercentage(item.fieldName) }}</b>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
|
||||
<CCard>
|
||||
<CCardBody>
|
||||
<el-table :data="surveys" style="width: 100%">
|
||||
<el-table-column type="index" label="#"> </el-table-column>
|
||||
|
||||
<el-table-column prop="fullName" label="نام" width="">
|
||||
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="کد ملی" width="">
|
||||
<el-table-column prop="title" label="کاربر" width="">
|
||||
<template slot-scope="scope">
|
||||
<span class="singleLineTxt" :title="scope.row.national"> {{ scope.row.national }} </span>
|
||||
<nuxt-link :to="{ name: 'admin-customers-customer', params: { customer: scope.row.user._id } }">
|
||||
{{ scope.row.user.first_name + ' ' + scope.row.user.last_name }}
|
||||
</nuxt-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="متن" width="">
|
||||
<el-table-column prop="code" label="کد پذیرش دایم" width="" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span class="singleLineTxt" :title="scope.row.caption"> {{ scope.row.caption }} </span>
|
||||
<span>{{ scope.row.code || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="تاریخ ایجاد" width="">
|
||||
<el-table-column label="تاریخ ایجاد" width="">
|
||||
<template slot-scope="scope">
|
||||
<span> {{ $jDate(scope.row.created_at) }} </span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="شماره تماس" width="">
|
||||
<template slot-scope="scope">
|
||||
<span class="singleLineTxt" :title="scope.row.phoneNumber"> {{ scope.row.phoneNumber }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="ایمیل" width="">
|
||||
<template slot-scope="scope">
|
||||
<span class="singleLineTxt" :title="scope.row.email"> {{ scope.row.email }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="نمایش" width="110" align="center">
|
||||
<el-table-column label="مشاهده" width="70" align="center">
|
||||
<template slot-scope="scope">
|
||||
<CButton
|
||||
:key="scope.row._id + type"
|
||||
:key="scope.row._id"
|
||||
color="success"
|
||||
variant="outline"
|
||||
:to="{ name: 'admin-surveys-public-item', params: { item: scope.row._id } }"
|
||||
:to="{ name: 'admin-surveys-public-survey', params: { survey: scope.row._id } }"
|
||||
>
|
||||
<i class="fal fa-eye"></i>
|
||||
</CButton>
|
||||
@@ -71,40 +65,49 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'AdminComplaintsList',
|
||||
name: 'AdminSurveysList',
|
||||
layout: 'admin',
|
||||
async asyncData({ $axios, error }) {
|
||||
|
||||
try {
|
||||
const surveys = await $axios.$get(`/api/admin/surveys?type=0`)
|
||||
return {
|
||||
surveys
|
||||
}
|
||||
} catch (err) {
|
||||
error({ status: 404, message: 'There is a problem here' })
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
complaint:null
|
||||
title: 'لیست نظرسنجی ها',
|
||||
list_title: 'لیست',
|
||||
surveys: null,
|
||||
search: ''
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
||||
head() {
|
||||
return {
|
||||
title: this.title
|
||||
}
|
||||
},
|
||||
beforeMount(){
|
||||
|
||||
this.$axios.get('/api/admin/surveysPublic').then(res=>{
|
||||
this.complaint = res.data
|
||||
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
computed: {
|
||||
...mapGetters({
|
||||
surveyOptions: 'front/surveyOptions',
|
||||
surveyOptionsValues: 'front/surveyOptionsValues'
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
getPercentage(fieldName) {
|
||||
let totalData = 0
|
||||
let userChoice = 0
|
||||
this.surveys.forEach(item => {
|
||||
totalData += 5
|
||||
userChoice += item[fieldName]
|
||||
})
|
||||
return Math.round((userChoice * 100) / totalData)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user