diff --git a/components/admin/TheSidebar.vue b/components/admin/TheSidebar.vue
index 5eb5abd..56816a3 100644
--- a/components/admin/TheSidebar.vue
+++ b/components/admin/TheSidebar.vue
@@ -297,7 +297,14 @@
+
diff --git a/pages/admin/surveys/_survey.vue b/pages/admin/surveys/private/_survey.vue
similarity index 95%
rename from pages/admin/surveys/_survey.vue
rename to pages/admin/surveys/private/_survey.vue
index 0797493..758ab55 100644
--- a/pages/admin/surveys/_survey.vue
+++ b/pages/admin/surveys/private/_survey.vue
@@ -2,7 +2,7 @@
{{ title }}
- برگشت به صفحه قبل
+ برگشت به صفحه قبل
diff --git a/pages/admin/surveys/index.vue b/pages/admin/surveys/private/index.vue
similarity index 96%
rename from pages/admin/surveys/index.vue
rename to pages/admin/surveys/private/index.vue
index d63c205..3fdff63 100644
--- a/pages/admin/surveys/index.vue
+++ b/pages/admin/surveys/private/index.vue
@@ -52,7 +52,7 @@
:key="scope.row._id"
color="success"
variant="outline"
- :to="{ name: 'admin-surveys-survey', params: { survey: scope.row._id } }"
+ :to="{ name: 'admin-surveys-private-survey', params: { survey: scope.row._id } }"
>
diff --git a/pages/admin/surveys/public/_item.vue b/pages/admin/surveys/public/_item.vue
new file mode 100644
index 0000000..83b40b5
--- /dev/null
+++ b/pages/admin/surveys/public/_item.vue
@@ -0,0 +1,107 @@
+
+
+
+
+
نظر سنجی
+
+
+
+
نام و نام خانوادگی :
+
{{ complaint?.fullName }}
+
+
+
+
کد ملی :
+
{{ complaint?.national }}
+
+
+
+
شماره تماس :
+
{{ complaint?.phoneNumber }}
+
+
+
+
ایمیل :
+
{{ complaint?.email }}
+
+
+
+
کد پذیرش :
+
{{ complaint?.receptionCode }}
+
+
+
+
+
توضیحات :
+
+
+
{{ complaint?.caption }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/admin/surveys/public/index.vue b/pages/admin/surveys/public/index.vue
new file mode 100644
index 0000000..b84ac01
--- /dev/null
+++ b/pages/admin/surveys/public/index.vue
@@ -0,0 +1,110 @@
+
+
+
+ نظر سنجی
+
+
+
+
+
+
+ نظر سنجی
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.national }}
+
+
+
+
+
+ {{ scope.row.caption }}
+
+
+
+
+
+ {{ $jDate(scope.row.created_at) }}
+
+
+
+
+
+
+
+ {{ scope.row.phoneNumber }}
+
+
+
+
+
+ {{ scope.row.email }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/server/controllers/complaintController.js b/server/controllers/complaintController.js
index 6e4b6db..0aec74e 100644
--- a/server/controllers/complaintController.js
+++ b/server/controllers/complaintController.js
@@ -20,8 +20,19 @@ module.exports.create = [
],
checkValidations(validationResult),
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)
@@ -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)=>{
- 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)
diff --git a/server/routes/admin.js b/server/routes/admin.js
index 58728e9..12cc6fd 100644
--- a/server/routes/admin.js
+++ b/server/routes/admin.js
@@ -29,6 +29,11 @@ const brandController = require('../controllers/brandController')
/// //////////////////////////////////////////////////////// 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
router.post('/brand',hasPermission('brands'), brandController.createbrand)
router.get('/brand/:id',hasPermission('brands'), brandController.getbrand)
@@ -37,7 +42,7 @@ router.delete('/brand/:id',hasPermission('brands'), brandController.deletebrand)
/// ///////////// Complaint
-router.get('/complaint',hasPermission('complaint'), complaintController.gets)
+router.get('/complaint',hasPermission('complaint'), complaintController.getsComplaint)
router.get('/complaint/:id',hasPermission('complaint'), complaintController.get)
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)
-/// ///////////// survey
-router.get('/surveys', surveyController.getAllForAdmin)
-router.get('/surveys/:id', surveyController.getOneForAdmin)
+
module.exports = router
diff --git a/server/routes/public.js b/server/routes/public.js
index d8c7d1b..1ee0431 100644
--- a/server/routes/public.js
+++ b/server/routes/public.js
@@ -19,6 +19,9 @@ const complaintController = require('../controllers/complaintController')
const brandController = require('../controllers/brandController')
/// //////////////////////////////////////////////////////// routes
+/// ///////////// survey
+router.post('/surveys', complaintController.createSurvey)
+
/// ///////////// Brand
router.get('/brand', brandController.getbrands)