somewhere
This commit is contained in:
@@ -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' }">برگشت به صفحه قبل</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>
|
||||
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<div>
|
||||
<CustomSubHeader>
|
||||
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
||||
</CustomSubHeader>
|
||||
|
||||
<CCard>
|
||||
<CCardBody>
|
||||
<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="title" label="کاربر" width="">
|
||||
<template slot-scope="scope">
|
||||
<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 prop="code" label="کد پذیرش دایم" width="" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.code || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<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="70" align="center">
|
||||
<template slot-scope="scope">
|
||||
<CButton
|
||||
:key="scope.row._id"
|
||||
color="success"
|
||||
variant="outline"
|
||||
:to="{ name: 'admin-surveys-survey', params: { survey: scope.row._id } }"
|
||||
>
|
||||
<i class="fal fa-eye"></i>
|
||||
</CButton>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'AdminSurveysList',
|
||||
layout: 'admin',
|
||||
async asyncData({ $axios, error }) {
|
||||
try {
|
||||
const surveys = await $axios.$get(`/api/admin/surveys`)
|
||||
return {
|
||||
surveys
|
||||
}
|
||||
} catch (err) {
|
||||
error({ status: 404, message: 'There is a problem here' })
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: 'لیست نظرسنجی ها',
|
||||
list_title: 'لیست',
|
||||
surveys: null,
|
||||
search: ''
|
||||
}
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
title: this.title
|
||||
}
|
||||
},
|
||||
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