edit gets
This commit is contained in:
@@ -71,7 +71,7 @@ export default {
|
|||||||
layout: 'admin',
|
layout: 'admin',
|
||||||
async asyncData({ $axios, error }) {
|
async asyncData({ $axios, error }) {
|
||||||
try {
|
try {
|
||||||
const surveys = await $axios.$get(`/api/admin/surveys`)
|
const surveys = await $axios.$get(`/api/admin/surveys?type=0`)
|
||||||
return {
|
return {
|
||||||
surveys
|
surveys
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div class="m-3">
|
|
||||||
<div class="row ui-box p-3">
|
|
||||||
<h4>نظر سنجی</h4>
|
|
||||||
<hr />
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<div class="d-flex mt-3" style="align-items: center">
|
|
||||||
<h5 style="margin-bottom: 1rem">نام و نام خانوادگی :</h5>
|
|
||||||
<p class="mr-2" style="margin-bottom: 1rem">{{ complaint?.fullName }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-flex mt-3" style="align-items: center">
|
|
||||||
<h5 style="margin-bottom: 1rem">کد ملی :</h5>
|
|
||||||
<p class="mr-2" style="margin-bottom: 1rem">{{ complaint?.national }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-flex mt-3" style="align-items: center">
|
|
||||||
<h5 style="margin-bottom: 1rem">شماره تماس :</h5>
|
|
||||||
<p class="mr-2" style="margin-bottom: 1rem">{{ complaint?.phoneNumber }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-flex mt-3" style="align-items: center">
|
|
||||||
<h5 style="margin-bottom: 1rem">ایمیل :</h5>
|
|
||||||
<p class="mr-2" style="margin-bottom: 1rem">{{ complaint?.email }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-flex mt-3" style="align-items: center">
|
|
||||||
<h5 style="margin-bottom: 1rem">کد پذیرش :</h5>
|
|
||||||
<p class="mr-2" style="margin-bottom: 1rem">{{ complaint?.receptionCode }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-1" style="border-left: 1px solid #8f8f8f; height: 350px"></div>
|
|
||||||
<div class="col-lg-7">
|
|
||||||
<h5>توضیحات :</h5>
|
|
||||||
<div style="display: flex; align-items: center; justify-content: center">
|
|
||||||
<div class="d-flex mt-3" style="align-items: center; justify-content: center">
|
|
||||||
<p class="mr-2" style="margin-bottom: 1rem">{{ complaint?.caption }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr class="mt-3"/>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'AdminComplaintDetails',
|
|
||||||
|
|
||||||
layout: 'admin',
|
|
||||||
|
|
||||||
async asyncData({ $axios, params, query, error }) {},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
complaint: null,
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {},
|
|
||||||
beforeMount() {
|
|
||||||
this.$axios.get(`/api/admin/complaint/${this.$route.params.item}`).then(res => {
|
|
||||||
this.complaint = res.data
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
hasPermission(permission) {
|
|
||||||
if (this.$auth.loggedIn) return this.$auth.user.permissions.includes(permission)
|
|
||||||
else return false
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.progressBar {
|
|
||||||
.el-progress-bar__inner {
|
|
||||||
left: auto;
|
|
||||||
right: 0;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-upload {
|
|
||||||
background-color: cornflowerblue;
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
cursor: pointer;
|
|
||||||
color: white;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.space {
|
|
||||||
margin: 5rem;
|
|
||||||
}
|
|
||||||
.ui-box {
|
|
||||||
background-color: white;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
.w-20{
|
|
||||||
width: 20%;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<CustomSubHeader>
|
||||||
|
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
||||||
|
<CButton size="sm" color="primary" class="mr-auto" :to="{ name: 'admin-surveys-private' }">برگشت به صفحه قبل</CButton>
|
||||||
|
</CustomSubHeader>
|
||||||
|
<CRow>
|
||||||
|
<CCol xl="12">
|
||||||
|
<CCard>
|
||||||
|
<CCardBody>
|
||||||
|
<CForm>
|
||||||
|
<CInput v-if="survey.code" :value="survey.code" label="شماره پذیرش دایم" disabled />
|
||||||
|
<CInput
|
||||||
|
v-for="item in surveyOptions"
|
||||||
|
:key="item.fieldName"
|
||||||
|
:value="surveyOptionsValues.get(survey[item.fieldName])"
|
||||||
|
:label="item.title"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
<CTextarea :value="survey.description" :rows="5" label="نظرات ، پیشنهادات و انتقادات" disabled />
|
||||||
|
</CForm>
|
||||||
|
</CCardBody>
|
||||||
|
</CCard>
|
||||||
|
</CCol>
|
||||||
|
</CRow>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
|
export default {
|
||||||
|
name: 'AdminSurveyDetails',
|
||||||
|
layout: 'admin',
|
||||||
|
async asyncData({ $axios, params, error }) {
|
||||||
|
try {
|
||||||
|
const survey = await $axios.$get(`/api/admin/surveys/${params.survey}`)
|
||||||
|
return {
|
||||||
|
survey
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
error({ status: 404, message: 'Page not found' })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: 'مشاهده جزعیات نظرسنجی',
|
||||||
|
survey: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
head() {
|
||||||
|
return {
|
||||||
|
title: this.title
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters({
|
||||||
|
surveyOptions: 'front/surveyOptions',
|
||||||
|
surveyOptionsValues: 'front/surveyOptionsValues'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,64 +1,58 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<CustomSubHeader>
|
<CustomSubHeader>
|
||||||
<CBreadcrumb class="border-0 mb-0"> نظر سنجی </CBreadcrumb>
|
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
||||||
|
|
||||||
</CustomSubHeader>
|
</CustomSubHeader>
|
||||||
<CCard>
|
|
||||||
<CCardHeader>
|
|
||||||
<slot name="header">
|
|
||||||
<CIcon name="cil-grid" />
|
|
||||||
نظر سنجی
|
|
||||||
</slot>
|
|
||||||
</CCardHeader>
|
|
||||||
|
|
||||||
|
<CCard>
|
||||||
<CCardBody>
|
<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 type="index" label="#"> </el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="fullName" label="نام" width="">
|
<el-table-column prop="title" label="کاربر" width="">
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="کد ملی" width="">
|
|
||||||
<template slot-scope="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="متن" width="">
|
<el-table-column prop="code" label="کد پذیرش دایم" width="" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span class="singleLineTxt" :title="scope.row.caption"> {{ scope.row.caption }} </span>
|
<span>{{ scope.row.code || '-' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="تاریخ ایجاد" width="">
|
<el-table-column label="تاریخ ایجاد" width="">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span> {{ $jDate(scope.row.created_at) }} </span>
|
<span> {{ $jDate(scope.row.created_at) }} </span>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="مشاهده" width="70" align="center">
|
||||||
<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">
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<CButton
|
<CButton
|
||||||
:key="scope.row._id + type"
|
:key="scope.row._id"
|
||||||
color="success"
|
color="success"
|
||||||
variant="outline"
|
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>
|
<i class="fal fa-eye"></i>
|
||||||
</CButton>
|
</CButton>
|
||||||
@@ -71,40 +65,49 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
name: 'AdminComplaintsList',
|
name: 'AdminSurveysList',
|
||||||
layout: 'admin',
|
layout: 'admin',
|
||||||
async asyncData({ $axios, error }) {
|
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() {
|
data() {
|
||||||
return {
|
return {
|
||||||
complaint:null
|
title: 'لیست نظرسنجی ها',
|
||||||
|
list_title: 'لیست',
|
||||||
|
surveys: null,
|
||||||
|
search: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
head() {
|
||||||
computed: {
|
return {
|
||||||
|
title: this.title
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeMount(){
|
computed: {
|
||||||
|
...mapGetters({
|
||||||
this.$axios.get('/api/admin/surveysPublic').then(res=>{
|
surveyOptions: 'front/surveyOptions',
|
||||||
this.complaint = res.data
|
surveyOptionsValues: 'front/surveyOptionsValues'
|
||||||
|
|
||||||
}).catch(err=>{
|
|
||||||
console.log(err)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
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>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user