|
|
@@ -243,13 +243,15 @@
|
|
|
<script>
|
|
|
import Assist from 'assets/js/Assist.js'
|
|
|
import Enums from 'src/assets/Enums/Enums.js'
|
|
|
+import { Invoice } from 'src/models/Invoice.js'
|
|
|
+import { Payment } from 'src/models/Payment.js'
|
|
|
import { APIGateway } from 'src/api/APIGateway.js'
|
|
|
+import { Classroom } from 'src/models/Classroom.js'
|
|
|
import { EntityEdit, EntityIndex } from 'quasar-crud'
|
|
|
-import { Classroom } from 'src/models/Classroom'
|
|
|
-import { Registration } from 'src/models/Registration'
|
|
|
-import { Invoice } from 'src/models/Invoice'
|
|
|
-import { Payment } from 'src/models/Payment'
|
|
|
-import { Transaction } from 'src/models/Transaction'
|
|
|
+import { Transaction } from 'src/models/Transaction.js'
|
|
|
+import { Registration } from 'src/models/Registration.js'
|
|
|
+import { Provinces, Cities, getCitiesOfProvince } from 'src/assets/js/IranianCities.js'
|
|
|
+import { FormBuilderAssist } from 'quasar-form-builder'
|
|
|
|
|
|
export default {
|
|
|
name: 'Admin.User.Show',
|
|
|
@@ -259,6 +261,7 @@ export default {
|
|
|
return {
|
|
|
tab: 'userInfo',
|
|
|
financialTab: 'invoiceList',
|
|
|
+ inputDataLoaded: false,
|
|
|
api: APIGateway.user.APIAdresses.byId(userId),
|
|
|
mounted: false,
|
|
|
entityIdKey: 'id',
|
|
|
@@ -331,15 +334,63 @@ export default {
|
|
|
col: 'col-md-3 col-12'
|
|
|
},
|
|
|
|
|
|
- { type: 'checkbox', name: 'is_abroad_birth_address', placeholder: ' ', label: 'محل تولد خارج از کشور است؟', responseKey: 'is_abroad_birth_address', className: 'require', col: 'col-12' },
|
|
|
+ { type: 'checkbox', name: 'is_abroad_birth_address', placeholder: ' ', label: 'محل تولد خارج از کشور است؟۳۳۳۳', responseKey: 'is_abroad_birth_address', className: 'require', col: 'col-12' },
|
|
|
{ type: 'input', name: 'birth_country', placeholder: ' ', label: 'کشور محل تولد', responseKey: 'birth_country', col: 'col-md-4 col-12' },
|
|
|
- { type: 'input', name: 'birth_province', placeholder: ' ', label: 'استان محل تولد', responseKey: 'birth_province', col: 'col-md-4 col-12' },
|
|
|
- { type: 'input', name: 'birth_city', placeholder: ' ', label: 'شهر محل تولد', responseKey: 'birth_city', col: 'col-md-4 col-12' },
|
|
|
+ {
|
|
|
+ type: 'select',
|
|
|
+ name: 'birth_province',
|
|
|
+ options: Provinces,
|
|
|
+ optionLabel: 'name',
|
|
|
+ optionValue: 'name',
|
|
|
+ createNewValue: true,
|
|
|
+ newValueMode: 'add-unique',
|
|
|
+ placeholder: ' ',
|
|
|
+ label: 'استان محل تولد',
|
|
|
+ responseKey: 'birth_province',
|
|
|
+ col: 'col-md-4 col-12'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'select',
|
|
|
+ name: 'birth_city',
|
|
|
+ options: Cities,
|
|
|
+ optionLabel: 'name',
|
|
|
+ optionValue: 'name',
|
|
|
+ createNewValue: true,
|
|
|
+ newValueMode: 'add-unique',
|
|
|
+ placeholder: ' ',
|
|
|
+ label: 'شهر محل تولد',
|
|
|
+ responseKey: 'birth_city',
|
|
|
+ col: 'col-md-4 col-12'
|
|
|
+ },
|
|
|
|
|
|
{ type: 'checkbox', name: 'is_abroad_living_address', placeholder: ' ', label: 'محل زندگی فعلی خارج از کشور است؟', responseKey: 'is_abroad_living_address', className: 'require', col: 'col-12' },
|
|
|
{ type: 'input', name: 'living_country', placeholder: ' ', label: 'کشور محل زندگی فعلی', responseKey: 'living_country', col: 'col-md-4 col-12' },
|
|
|
- { type: 'input', name: 'living_province', placeholder: ' ', label: 'استان محل زندگی فعلی', responseKey: 'living_province', col: 'col-md-4 col-12' },
|
|
|
- { type: 'input', name: 'living_city', placeholder: ' ', label: 'شهر محل زندگی فعلی', responseKey: 'living_city', col: 'col-md-4 col-12' },
|
|
|
+ {
|
|
|
+ type: 'select',
|
|
|
+ name: 'living_province',
|
|
|
+ options: Provinces,
|
|
|
+ optionLabel: 'name',
|
|
|
+ optionValue: 'name',
|
|
|
+ createNewValue: true,
|
|
|
+ newValueMode: 'add-unique',
|
|
|
+ placeholder: ' ',
|
|
|
+ label: 'استان محل زندگی فعلی',
|
|
|
+ responseKey: 'living_province',
|
|
|
+ col: 'col-md-4 col-12'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'select',
|
|
|
+ name: 'living_city',
|
|
|
+ options: Cities,
|
|
|
+ optionLabel: 'name',
|
|
|
+ optionValue: 'name',
|
|
|
+ createNewValue: true,
|
|
|
+ newValueMode: 'add-unique',
|
|
|
+ placeholder: ' ',
|
|
|
+ label: 'شهر محل زندگی فعلی',
|
|
|
+ responseKey: 'living_city',
|
|
|
+ col: 'col-md-4 col-12'
|
|
|
+ },
|
|
|
{ type: 'input', name: 'living_postal_code', placeholder: ' ', label: 'کد پستی محل زندگی', responseKey: 'living_postal_code', col: 'col-md-3 col-12' },
|
|
|
{ type: 'input', name: 'living_address', placeholder: ' ', label: 'آدرس پستی محل زندگی', responseKey: 'living_address', col: 'col-md-6 col-12' },
|
|
|
|
|
|
@@ -855,6 +906,135 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ isAbroadBirthAddress () {
|
|
|
+ return FormBuilderAssist.getInputsByName(this.inputs, 'is_abroad_birth_address').value
|
|
|
+ },
|
|
|
+ isAbroadLivingAddress () {
|
|
|
+ return FormBuilderAssist.getInputsByName(this.inputs, 'is_abroad_living_address').value
|
|
|
+ },
|
|
|
+ selectedBirthProvince () {
|
|
|
+ return FormBuilderAssist.getInputsByName(this.inputs, 'birth_province').value
|
|
|
+ },
|
|
|
+ selectedLivingProvince () {
|
|
|
+ return FormBuilderAssist.getInputsByName(this.inputs, 'living_province').value
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ isAbroadBirthAddress (newValue) {
|
|
|
+ if (!newValue) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'value', 'ایران')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'disable', true)
|
|
|
+ if (this.inputDataLoaded) {
|
|
|
+ // province
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'type', 'select')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'disable', false)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'value', null)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'options', Provinces)
|
|
|
+
|
|
|
+ // city
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'select')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', true)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'options', [])
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'value', null)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'disable', false)
|
|
|
+
|
|
|
+ if (this.inputDataLoaded) {
|
|
|
+ // province
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'type', 'input')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'disable', false)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'value', null)
|
|
|
+
|
|
|
+ // city
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'input')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isAbroadLivingAddress (newValue) {
|
|
|
+ if (!newValue) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'value', 'ایران')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'disable', true)
|
|
|
+ if (this.inputDataLoaded) {
|
|
|
+ // province
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'type', 'select')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'disable', false)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'value', null)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'options', Provinces)
|
|
|
+
|
|
|
+ // city
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'select')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', true)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'options', [])
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'value', null)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'disable', false)
|
|
|
+ if (this.inputDataLoaded) {
|
|
|
+ // province
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'type', 'input')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'disable', false)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'value', null)
|
|
|
+
|
|
|
+ // city
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'input')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ selectedBirthProvince (newValue) {
|
|
|
+ if (this.isAbroadBirthAddress) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'input')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!newValue) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', true)
|
|
|
+ if (this.inputDataLoaded) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const filteredCities = getCitiesOfProvince(this.selectedBirthProvince)
|
|
|
+
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'options', filteredCities)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
|
|
|
+ if (this.inputDataLoaded) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ selectedLivingProvince (newValue) {
|
|
|
+ if (this.isAbroadBirthAddress) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'input')
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!newValue) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', true)
|
|
|
+ if (this.inputDataLoaded) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const filteredCities = getCitiesOfProvince(this.selectedLivingProvince)
|
|
|
+
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'options', filteredCities)
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
|
|
|
+ if (this.inputDataLoaded) {
|
|
|
+ FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted () {
|
|
|
this.mounted = true
|
|
|
},
|
|
|
@@ -869,6 +1049,9 @@ export default {
|
|
|
// console.log('roles', roles)
|
|
|
// this.setInputValue('roles', roles)
|
|
|
// setNewInputData(this.inputs)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.inputDataLoaded = true
|
|
|
+ })
|
|
|
},
|
|
|
setInputValue (name, value) {
|
|
|
const inputIndex = this.inputs.findIndex(input => input.name === name)
|