Survey
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
<nuxt-link :to="{ name: 'contact' }" tag="li">
|
<nuxt-link :to="{ name: 'contact' }" tag="li">
|
||||||
<a>ارتباط با ما</a>
|
<a>ارتباط با ما</a>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
<nuxt-link :to="{ name: 'surveys' }" tag="li">
|
<nuxt-link :to="{ name: 'survey' }" tag="li">
|
||||||
<a>نظرسنجی</a>
|
<a>نظرسنجی</a>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
<nuxt-link :to="{ name: 'complaint' }" tag="li">
|
<nuxt-link :to="{ name: 'complaint' }" tag="li">
|
||||||
|
|||||||
@@ -91,8 +91,8 @@
|
|||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
|
|
||||||
<nuxt-link
|
<nuxt-link
|
||||||
:to="{ name: 'surveys'}"
|
:to="{ name: 'survey'}"
|
||||||
:class="$route.name.includes('surveys') && 'active'"
|
:class="$route.name.includes('survey') && 'active'"
|
||||||
tag="li"
|
tag="li"
|
||||||
>
|
>
|
||||||
<a>نظرسنجی</a>
|
<a>نظرسنجی</a>
|
||||||
|
|||||||
@@ -146,118 +146,113 @@
|
|||||||
|
|
||||||
<p>مشتری گرامی شما میتوانید نظر خود را درباره خدمات ما از طریق فرم زیر با ما در میان بگذارید</p>
|
<p>مشتری گرامی شما میتوانید نظر خود را درباره خدمات ما از طریق فرم زیر با ما در میان بگذارید</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-sm-12 p-3" style="display: flex; align-items: center;">
|
<div class="col-lg-6 col-sm-12 p-3" style="display: flex; align-items: center">
|
||||||
<p>{{ config.survey }}</p>
|
<p>{{ config.survey }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-4 col-sm-12 mt-4">
|
<form class="form form_3" @submit.prevent="post">
|
||||||
<el-input
|
<div v-for="item in surveyOptions" :key="item.fieldName" class="mb-5" style="width: 100%">
|
||||||
v-model="form.fullName"
|
<div class="mb-3">
|
||||||
:class="validation.fullName ? 'err' : null"
|
<label>{{ item.title }}</label>
|
||||||
placeholder="نام و نام خانوادگی"
|
|
||||||
></el-input>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4 col-sm-12 mt-4">
|
|
||||||
<el-input v-model="form.national" :class="validation.national ? 'err' : null" placeholder="کد ملی"></el-input>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4 col-sm-12 mt-4">
|
|
||||||
<el-input
|
|
||||||
v-model="form.phoneNumber"
|
|
||||||
:class="validation.phoneNumber ? 'err' : null"
|
|
||||||
placeholder="شماره تلفن"
|
|
||||||
></el-input>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-4 col-sm-12 mt-4">
|
<el-radio-group v-model="survey[item.fieldName]">
|
||||||
<el-input v-model="form.email" :class="validation.email ? 'err' : null" placeholder="ایمیل"></el-input>
|
<el-radio-button
|
||||||
</div>
|
v-for="option in surveyOptionsValues.keys()"
|
||||||
<div class="col-lg-4 col-sm-12 mt-4">
|
:key="option + '_Option_' + item.fieldName"
|
||||||
<el-input
|
:label="option"
|
||||||
v-model="form.receptionCode"
|
|
||||||
:class="validation.receptionCode ? 'err' : null"
|
|
||||||
placeholder="کد پذیرش"
|
|
||||||
></el-input>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-lg-12 col-sm-12 mt-4">
|
|
||||||
<el-input
|
|
||||||
v-model="form.caption"
|
|
||||||
:class="validation.caption ? 'err' : null"
|
|
||||||
type="textarea"
|
|
||||||
:rows="5"
|
|
||||||
placeholder="توضیحات"
|
|
||||||
>
|
>
|
||||||
</el-input>
|
{{ surveyOptionsValues.get(option) }}
|
||||||
|
</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-12 col-sm-12 mt-4 d-flex" style="justify-content: center">
|
<hr />
|
||||||
<el-button type="primary" @click="sendForm" round>ارسال</el-button>
|
|
||||||
|
<div class="formRow">
|
||||||
|
<label for="description">نظرات ، پیشنهادات و انتقادات (اختیاری):</label>
|
||||||
|
<textarea
|
||||||
|
id="description"
|
||||||
|
v-model="survey.description"
|
||||||
|
name="description"
|
||||||
|
placeholder="نظرات ، پیشنهادات و انتقادات را میتوانید اینجا بنویسید"
|
||||||
|
cols="30"
|
||||||
|
rows="10"
|
||||||
|
></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="formBtnRow">
|
||||||
|
<button class="btn btn-primary" type="submit" :disabled="disabledBtn">ثبت نظر</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</user-dashboard-container>
|
</user-dashboard-container>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PublicComplaint',
|
name: 'PublicComplaint',
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {
|
survey: this.initForm(),
|
||||||
fullName: null,
|
|
||||||
national: null,
|
|
||||||
phoneNumber: null,
|
|
||||||
email: null,
|
|
||||||
receptionCode: null,
|
|
||||||
caption: null
|
|
||||||
},
|
|
||||||
validation: {},
|
validation: {},
|
||||||
hasValidationError: false,
|
hasValidationError: false,
|
||||||
waiting: true
|
waiting: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapGetters({
|
||||||
|
surveyOptions: 'front/surveyOptions',
|
||||||
|
surveyOptionsValues: 'front/surveyOptionsValues'
|
||||||
|
}),
|
||||||
|
|
||||||
|
disabledBtn() {
|
||||||
|
return (
|
||||||
|
!this.survey.purchasedProduct ||
|
||||||
|
!this.survey.guaranteeWorkFlow ||
|
||||||
|
!this.survey.employeeResponsibility ||
|
||||||
|
!this.survey.serviceQuality ||
|
||||||
|
!this.survey.serviceTime ||
|
||||||
|
!this.survey.repairQuality ||
|
||||||
|
!this.survey.coast
|
||||||
|
)
|
||||||
|
},
|
||||||
config() {
|
config() {
|
||||||
return this.$config
|
return this.$config
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
sendForm() {
|
initForm() {
|
||||||
this.validation = {}
|
const survey = {
|
||||||
this.hasValidationError = false
|
purchasedProduct: 0,
|
||||||
this.waiting = true
|
guaranteeWorkFlow: 0,
|
||||||
|
employeeResponsibility: 0,
|
||||||
this.$axios
|
serviceQuality: 0,
|
||||||
.post('/api/public/surveys', this.form)
|
serviceTime: 0,
|
||||||
.then(response => {
|
repairQuality: 0,
|
||||||
this.waiting = false
|
coast: 0,
|
||||||
|
code: '',
|
||||||
this.$message({
|
|
||||||
type: 'success',
|
|
||||||
message: 'با موفقیت ثبت شد'
|
|
||||||
})
|
|
||||||
|
|
||||||
this.form = {
|
|
||||||
fullName: '',
|
fullName: '',
|
||||||
national: '',
|
national: '',
|
||||||
phoneNumber: '',
|
phoneNumber: '',
|
||||||
email: '',
|
email: '',
|
||||||
receptionCode: '',
|
description: ''
|
||||||
caption: ''
|
|
||||||
}
|
}
|
||||||
})
|
return survey
|
||||||
.catch(error => {
|
},
|
||||||
if (error.response.status === 422) {
|
post() {
|
||||||
this.validation = error.response.data.validation
|
if (this.disabledBtn) return
|
||||||
this.hasValidationError = true
|
this.$axios.$post('/api/public/survey', { ...this.survey }).then(res => {
|
||||||
this.waiting = false
|
this.$message.success('با تشکر از زمانی که گذاشتید، نظر شما ثبت شد.')
|
||||||
} else
|
if (this.code) {
|
||||||
this.$message({
|
return this.$router.push('/')
|
||||||
type: 'error',
|
}
|
||||||
message: error.response.data.message
|
this.survey = this.initForm()
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user