add survey
This commit is contained in:
@@ -297,7 +297,14 @@
|
|||||||
<CSidebarNavItem
|
<CSidebarNavItem
|
||||||
v-if="hasPermission('surveys')"
|
v-if="hasPermission('surveys')"
|
||||||
name="نظرسنجی"
|
name="نظرسنجی"
|
||||||
:to="{ name: 'admin-surveys' }"
|
:to="{ name: 'admin-surveys-private' }"
|
||||||
|
font-icon="fal fa-chart-bar"
|
||||||
|
:exact="false"
|
||||||
|
/>
|
||||||
|
<CSidebarNavItem
|
||||||
|
v-if="hasPermission('surveys')"
|
||||||
|
name="نظرسنجی عمومی"
|
||||||
|
:to="{ name: 'admin-surveys-public' }"
|
||||||
font-icon="fal fa-chart-bar"
|
font-icon="fal fa-chart-bar"
|
||||||
:exact="false"
|
:exact="false"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<CustomSubHeader>
|
<CustomSubHeader>
|
||||||
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
||||||
<CButton size="sm" color="primary" class="mr-auto" :to="{ name: 'admin-surveys' }">برگشت به صفحه قبل</CButton>
|
<CButton size="sm" color="primary" class="mr-auto" :to="{ name: 'admin-surveys-private' }">برگشت به صفحه قبل</CButton>
|
||||||
</CustomSubHeader>
|
</CustomSubHeader>
|
||||||
<CRow>
|
<CRow>
|
||||||
<CCol xl="12">
|
<CCol xl="12">
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
:key="scope.row._id"
|
:key="scope.row._id"
|
||||||
color="success"
|
color="success"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
:to="{ name: 'admin-surveys-survey', params: { survey: scope.row._id } }"
|
:to="{ name: 'admin-surveys-private-survey', params: { survey: scope.row._id } }"
|
||||||
>
|
>
|
||||||
<i class="fal fa-eye"></i>
|
<i class="fal fa-eye"></i>
|
||||||
</CButton>
|
</CButton>
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<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,110 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<CustomSubHeader>
|
||||||
|
<CBreadcrumb class="border-0 mb-0"> نظر سنجی </CBreadcrumb>
|
||||||
|
|
||||||
|
</CustomSubHeader>
|
||||||
|
<CCard>
|
||||||
|
<CCardHeader>
|
||||||
|
<slot name="header">
|
||||||
|
<CIcon name="cil-grid" />
|
||||||
|
نظر سنجی
|
||||||
|
</slot>
|
||||||
|
</CCardHeader>
|
||||||
|
|
||||||
|
<CCardBody>
|
||||||
|
<el-table :data="complaint" 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="">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="singleLineTxt" :title="scope.row.national"> {{ scope.row.national }} </span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="متن" width="">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="singleLineTxt" :title="scope.row.caption"> {{ scope.row.caption }} </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="">
|
||||||
|
<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">
|
||||||
|
<CButton
|
||||||
|
:key="scope.row._id + type"
|
||||||
|
color="success"
|
||||||
|
variant="outline"
|
||||||
|
:to="{ name: 'admin-surveys-public-item', params: { item: scope.row._id } }"
|
||||||
|
>
|
||||||
|
<i class="fal fa-eye"></i>
|
||||||
|
</CButton>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</CCardBody>
|
||||||
|
</CCard>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'AdminComplaintsList',
|
||||||
|
layout: 'admin',
|
||||||
|
async asyncData({ $axios, error }) {
|
||||||
|
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
complaint:null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
|
||||||
|
},
|
||||||
|
beforeMount(){
|
||||||
|
|
||||||
|
this.$axios.get('/api/admin/surveysPublic').then(res=>{
|
||||||
|
this.complaint = res.data
|
||||||
|
|
||||||
|
}).catch(err=>{
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -20,8 +20,19 @@ module.exports.create = [
|
|||||||
],
|
],
|
||||||
checkValidations(validationResult),
|
checkValidations(validationResult),
|
||||||
async(req, res) => {
|
async(req, res) => {
|
||||||
|
const { fullName, national, phoneNumber, deviceNumber, email, receptionCode, caption, callType } = req.body
|
||||||
|
|
||||||
const complaint = await Complaint.create(req.body)
|
const complaint = await Complaint.create({
|
||||||
|
fullName,
|
||||||
|
national,
|
||||||
|
type:0,
|
||||||
|
phoneNumber,
|
||||||
|
deviceNumber,
|
||||||
|
callType,
|
||||||
|
email,
|
||||||
|
receptionCode,
|
||||||
|
caption
|
||||||
|
})
|
||||||
|
|
||||||
res.status(201).json(complaint)
|
res.status(201).json(complaint)
|
||||||
|
|
||||||
@@ -29,9 +40,44 @@ module.exports.create = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
module.exports.gets = [
|
module.exports.createSurvey = [
|
||||||
|
[
|
||||||
|
body('fullName').notEmpty().withMessage(_faSr.required.name),
|
||||||
|
body('national').notEmpty().withMessage(_faSr.required.national_code),
|
||||||
|
body('phoneNumber').notEmpty().isMobilePhone().withMessage(_faSr.required.phone_number),
|
||||||
|
body('email').notEmpty().isEmail().withMessage(_faSr.required.email),
|
||||||
|
body('caption').notEmpty().withMessage(_faSr.required.caption),
|
||||||
|
],
|
||||||
|
checkValidations(validationResult),
|
||||||
|
async(req, res) => {
|
||||||
|
const { fullName, national, phoneNumber, email, receptionCode, caption } = req.body
|
||||||
|
const complaint = await Complaint.create({
|
||||||
|
fullName,
|
||||||
|
national,
|
||||||
|
type:1,
|
||||||
|
phoneNumber,
|
||||||
|
email,
|
||||||
|
receptionCode,
|
||||||
|
caption
|
||||||
|
})
|
||||||
|
|
||||||
|
res.status(201).json(complaint)
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
module.exports.getsComplaint = [
|
||||||
async(req, res)=>{
|
async(req, res)=>{
|
||||||
const complaints = await Complaint.find()
|
const complaints = await Complaint.find({type:0})
|
||||||
|
|
||||||
|
res.status(200).json(complaints)
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
module.exports.getsSurvey = [
|
||||||
|
async(req, res)=>{
|
||||||
|
const complaints = await Complaint.find({type:1})
|
||||||
|
|
||||||
res.status(200).json(complaints)
|
res.status(200).json(complaints)
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ const brandController = require('../controllers/brandController')
|
|||||||
|
|
||||||
|
|
||||||
/// //////////////////////////////////////////////////////// routes
|
/// //////////////////////////////////////////////////////// routes
|
||||||
|
/// ///////////// survey
|
||||||
|
router.get('/surveysPublic',hasPermission('surveys'), complaintController.getsSurvey)
|
||||||
|
router.get('/surveys',hasPermission('surveys'), surveyController.getAllForAdmin)
|
||||||
|
router.get('/surveys/:id',hasPermission('surveys'), surveyController.getOneForAdmin)
|
||||||
|
|
||||||
/// ///////////// Brand
|
/// ///////////// Brand
|
||||||
router.post('/brand',hasPermission('brands'), brandController.createbrand)
|
router.post('/brand',hasPermission('brands'), brandController.createbrand)
|
||||||
router.get('/brand/:id',hasPermission('brands'), brandController.getbrand)
|
router.get('/brand/:id',hasPermission('brands'), brandController.getbrand)
|
||||||
@@ -37,7 +42,7 @@ router.delete('/brand/:id',hasPermission('brands'), brandController.deletebrand)
|
|||||||
|
|
||||||
|
|
||||||
/// ///////////// Complaint
|
/// ///////////// Complaint
|
||||||
router.get('/complaint',hasPermission('complaint'), complaintController.gets)
|
router.get('/complaint',hasPermission('complaint'), complaintController.getsComplaint)
|
||||||
router.get('/complaint/:id',hasPermission('complaint'), complaintController.get)
|
router.get('/complaint/:id',hasPermission('complaint'), complaintController.get)
|
||||||
router.put('/complaint/:id',hasPermission('apply'), complaintController.put)
|
router.put('/complaint/:id',hasPermission('apply'), complaintController.put)
|
||||||
|
|
||||||
@@ -205,8 +210,6 @@ router.get('/smsBroadcasts/:id', hasPermission('sms'), smsBroadcastController.ge
|
|||||||
router.get('/usersForSMS', hasPermission('sms'), userController.get_all_users_for_admin)
|
router.get('/usersForSMS', hasPermission('sms'), userController.get_all_users_for_admin)
|
||||||
|
|
||||||
|
|
||||||
/// ///////////// survey
|
|
||||||
router.get('/surveys', surveyController.getAllForAdmin)
|
|
||||||
router.get('/surveys/:id', surveyController.getOneForAdmin)
|
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ const complaintController = require('../controllers/complaintController')
|
|||||||
const brandController = require('../controllers/brandController')
|
const brandController = require('../controllers/brandController')
|
||||||
|
|
||||||
/// //////////////////////////////////////////////////////// routes
|
/// //////////////////////////////////////////////////////// routes
|
||||||
|
/// ///////////// survey
|
||||||
|
router.post('/surveys', complaintController.createSurvey)
|
||||||
|
|
||||||
/// ///////////// Brand
|
/// ///////////// Brand
|
||||||
router.get('/brand', brandController.getbrands)
|
router.get('/brand', brandController.getbrands)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user