mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
remove state & city stuff, Add listener version200
This commit is contained in:
@ -163,15 +163,10 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.state') }}</label>
|
||||
<div class="col-sm-7">
|
||||
<base-select
|
||||
v-model="billingState"
|
||||
:options="billingStates"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:placeholder="$t('general.select_state')"
|
||||
:disabled="isDisabledBillingState"
|
||||
track-by="id"
|
||||
label="name"
|
||||
<base-input
|
||||
v-model="billing.state"
|
||||
type="text"
|
||||
name="billingState"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -179,29 +174,14 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.city') }}</label>
|
||||
<div class="col-sm-7">
|
||||
<base-select
|
||||
v-model="billingCity"
|
||||
:options="billingCities"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:placeholder="$t('general.select_city')"
|
||||
:disabled="isDisabledBillingCity"
|
||||
track-by="id"
|
||||
label="name"
|
||||
<base-input
|
||||
v-model="billing.city"
|
||||
type="text"
|
||||
name="billingCity"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Zip Code</label>
|
||||
<div class="col-sm-7">
|
||||
<base-input
|
||||
v-model="billing.zip"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.zip_code') }}</label>
|
||||
<div class="col-sm-7">
|
||||
@ -294,15 +274,10 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.state') }}</label>
|
||||
<div class="col-sm-7">
|
||||
<base-select
|
||||
v-model="shippingState"
|
||||
:options="shippingStates"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:placeholder="$t('general.select_state')"
|
||||
:disabled="isDisabledShippingState"
|
||||
track-by="id"
|
||||
label="name"
|
||||
<base-input
|
||||
v-model="shipping.state"
|
||||
type="text"
|
||||
name="shippingState"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -310,15 +285,10 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label input-label">{{ $t('customers.city') }}</label>
|
||||
<div class="col-sm-7">
|
||||
<base-select
|
||||
v-model="shippingCity"
|
||||
:options="shippingCities"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:placeholder="$t('general.select_city')"
|
||||
:disabled="isDisabledShippingCity"
|
||||
track-by="id"
|
||||
label="name"
|
||||
<base-input
|
||||
v-model="shipping.city"
|
||||
type="text"
|
||||
name="shippingCity"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -372,16 +342,8 @@ export default {
|
||||
return {
|
||||
isLoading: false,
|
||||
countryList: [],
|
||||
billingStates: [],
|
||||
billingCities: [],
|
||||
billingCountry: null,
|
||||
billingState: null,
|
||||
billingCity: null,
|
||||
shippingStates: [],
|
||||
shippingCities: [],
|
||||
shippingCountry: null,
|
||||
shippingState: null,
|
||||
shippingCity: null,
|
||||
isCopyFromBilling: false,
|
||||
currencyList: [],
|
||||
currency: '',
|
||||
@ -442,61 +404,14 @@ export default {
|
||||
billingCountry () {
|
||||
if (this.billingCountry) {
|
||||
this.billing.country_id = this.billingCountry.id
|
||||
this.isDisabledBillingState = false
|
||||
this.fetchBillingStates(this.billingCountry.id)
|
||||
this.billingState = null
|
||||
this.billingCity = null
|
||||
return true
|
||||
}
|
||||
},
|
||||
billingState () {
|
||||
if (this.billingState) {
|
||||
this.billing.state_id = this.billingState.id
|
||||
this.isDisabledBillingCity = false
|
||||
this.fetchBillingCities(this.billingState.id)
|
||||
this.billingCity = null
|
||||
return true
|
||||
}
|
||||
this.billingCity = null
|
||||
this.isDisabledBillingCity = true
|
||||
},
|
||||
billingCity () {
|
||||
if (this.billingCity) {
|
||||
this.billing.city_id = this.billingCity.id
|
||||
}
|
||||
},
|
||||
shippingCountry () {
|
||||
if (this.shippingCountry) {
|
||||
this.shipping.country_id = this.shippingCountry.id
|
||||
this.isDisabledShippingState = false
|
||||
this.fetchShippingStates(this.shippingCountry.id)
|
||||
if (this.isCopyFromBilling) {
|
||||
return true
|
||||
}
|
||||
this.shippingState = null
|
||||
this.shippingCity = null
|
||||
return true
|
||||
}
|
||||
},
|
||||
shippingState () {
|
||||
if (this.shippingState) {
|
||||
this.shipping.state_id = this.shippingState.id
|
||||
this.isDisabledShippingCity = false
|
||||
this.fetchShippingCities(this.shippingState.id)
|
||||
if (this.isCopyFromBilling) {
|
||||
this.isCopyFromBilling = false
|
||||
return true
|
||||
}
|
||||
this.shippingCity = null
|
||||
return true
|
||||
}
|
||||
this.shippingCity = null
|
||||
this.isDisabledShippingCity = true
|
||||
},
|
||||
shippingCity () {
|
||||
if (this.shippingCity) {
|
||||
this.shipping.city_id = this.shippingCity.id
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@ -529,16 +444,8 @@ export default {
|
||||
addresses: []
|
||||
}
|
||||
|
||||
this.billingStates = []
|
||||
this.billingCities = []
|
||||
this.billingCountry = null
|
||||
this.billingState = null
|
||||
this.billingCity = null
|
||||
this.shippingStates = []
|
||||
this.shippingCities = []
|
||||
this.shippingCountry = null
|
||||
this.shippingState = null
|
||||
this.shippingCity = null
|
||||
|
||||
this.billing = {...AddressStub}
|
||||
this.shipping = {...AddressStub}
|
||||
@ -553,13 +460,9 @@ export default {
|
||||
this.isCopyFromBilling = true
|
||||
this.shipping = {...this.billing, type: 'shipping'}
|
||||
this.shippingCountry = this.billingCountry
|
||||
this.shippingState = this.billingState
|
||||
this.shippingCity = this.billingCity
|
||||
} else {
|
||||
this.shipping = {...AddressStub, type: 'shipping'}
|
||||
this.shippingCountry = null
|
||||
this.shippingState = null
|
||||
this.shippingCity = null
|
||||
}
|
||||
},
|
||||
async loadData () {
|
||||
@ -633,30 +536,6 @@ export default {
|
||||
if (res) {
|
||||
this.countryList = res.data.countries
|
||||
}
|
||||
},
|
||||
async fetchBillingStates (id) {
|
||||
let res = await window.axios.get(`/api/states/${id}`)
|
||||
if (res) {
|
||||
this.billingStates = res.data.states
|
||||
}
|
||||
},
|
||||
async fetchBillingCities (id) {
|
||||
let res = await window.axios.get(`/api/cities/${id}`)
|
||||
if (res) {
|
||||
this.billingCities = res.data.cities
|
||||
}
|
||||
},
|
||||
async fetchShippingStates (id) {
|
||||
let res = await window.axios.get(`/api/states/${id}`)
|
||||
if (res) {
|
||||
this.shippingStates = res.data.states
|
||||
}
|
||||
},
|
||||
async fetchShippingCities (id) {
|
||||
let res = await window.axios.get(`/api/cities/${id}`)
|
||||
if (res) {
|
||||
this.shippingCities = res.data.cities
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ export default {
|
||||
phone: null,
|
||||
address_street_1: null,
|
||||
address_street_2: null,
|
||||
city_id: null,
|
||||
state_id: null,
|
||||
city: null,
|
||||
state: null,
|
||||
country_id: null,
|
||||
zip: null,
|
||||
type: null
|
||||
|
||||
@ -119,16 +119,10 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ $t('customers.state') }}</label>
|
||||
<base-select
|
||||
v-model="billing_state"
|
||||
:options="billingStates"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:tabindex="9"
|
||||
:disabled="isDisabledBillingState"
|
||||
:placeholder="$t('general.select_state')"
|
||||
label="name"
|
||||
track-by="id"
|
||||
<base-input
|
||||
v-model="billing.state"
|
||||
name="billing.state"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -176,16 +170,10 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ $t('customers.city') }}</label>
|
||||
<base-select
|
||||
v-model="billing_city"
|
||||
:options="billingCities"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:disabled="isDisabledBillingCity"
|
||||
:tabindex="10"
|
||||
:placeholder="$t('general.select_city')"
|
||||
label="name"
|
||||
track-by="id"
|
||||
<base-input
|
||||
v-model="billing.city"
|
||||
name="billing.city"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -233,16 +221,10 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ $t('customers.state') }}</label>
|
||||
<base-select
|
||||
v-model="shipping_state"
|
||||
:options="shippingStates"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:tabindex="17"
|
||||
:disabled="isDisabledShippingState"
|
||||
:placeholder="$t('general.select_state')"
|
||||
label="name"
|
||||
track-by="id"
|
||||
<base-input
|
||||
v-model="shipping.state"
|
||||
name="shipping.state"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -290,16 +272,10 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ $t('customers.city') }}</label>
|
||||
<base-select
|
||||
v-model="shipping_city"
|
||||
:options="shippingCities"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:tabindex="18"
|
||||
:disabled="isDisabledShippingCity"
|
||||
:placeholder="$t('general.select_city')"
|
||||
label="name"
|
||||
track-by="id"
|
||||
<base-input
|
||||
v-model="shipping.city"
|
||||
name="shipping.city"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -344,7 +320,7 @@ import { mapActions, mapGetters } from 'vuex'
|
||||
import MultiSelect from 'vue-multiselect'
|
||||
import { validationMixin } from 'vuelidate'
|
||||
import AddressStub from '../../stub/address'
|
||||
const { required, minLength, email, numeric, url, maxLength } = require('vuelidate/lib/validators')
|
||||
const { required, minLength, email, url, maxLength } = require('vuelidate/lib/validators')
|
||||
|
||||
export default {
|
||||
components: { MultiSelect },
|
||||
@ -366,8 +342,8 @@ export default {
|
||||
billing: {
|
||||
name: null,
|
||||
country_id: null,
|
||||
state_id: null,
|
||||
city_id: null,
|
||||
state: null,
|
||||
city: null,
|
||||
phone: null,
|
||||
zip: null,
|
||||
address_street_1: null,
|
||||
@ -377,8 +353,8 @@ export default {
|
||||
shipping: {
|
||||
name: null,
|
||||
country_id: null,
|
||||
state_id: null,
|
||||
city_id: null,
|
||||
state: null,
|
||||
city: null,
|
||||
phone: null,
|
||||
zip: null,
|
||||
address_street_1: null,
|
||||
@ -386,26 +362,12 @@ export default {
|
||||
type: 'shipping'
|
||||
},
|
||||
currencyList: [],
|
||||
isDisabledBillingState: true,
|
||||
isDisabledBillingCity: true,
|
||||
isDisabledShippingState: true,
|
||||
isDisabledShippingCity: true,
|
||||
|
||||
billing_country: null,
|
||||
billing_city: null,
|
||||
billing_state: null,
|
||||
|
||||
shipping_country: null,
|
||||
shipping_city: null,
|
||||
shipping_state: null,
|
||||
|
||||
billingCountries: [],
|
||||
billingStates: [],
|
||||
billingCities: [],
|
||||
|
||||
shippingCountries: [],
|
||||
shippingStates: [],
|
||||
shippingCities: []
|
||||
shippingCountries: []
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
@ -455,61 +417,13 @@ export default {
|
||||
if (newCountry) {
|
||||
this.billing.country_id = newCountry.id
|
||||
this.isDisabledBillingState = false
|
||||
this.billing_state = null
|
||||
this.billing_city = null
|
||||
this.fetchBillingState()
|
||||
}
|
||||
},
|
||||
billing_state (newState) {
|
||||
if (newState) {
|
||||
this.billing.state_id = newState.id
|
||||
this.isDisabledBillingCity = false
|
||||
this.billing_city = null
|
||||
this.fetchBillingCities()
|
||||
return true
|
||||
}
|
||||
this.billing_city = null
|
||||
this.isDisabledBillingCity = true
|
||||
return true
|
||||
},
|
||||
billing_city (newCity) {
|
||||
if (newCity) {
|
||||
this.billing.city_id = newCity.id
|
||||
}
|
||||
},
|
||||
shipping_country (newCountry) {
|
||||
if (newCountry) {
|
||||
this.shipping.country_id = newCountry.id
|
||||
this.isDisabledShippingState = false
|
||||
this.fetchShippingState()
|
||||
if (this.isCopyFromBilling) {
|
||||
return true
|
||||
}
|
||||
this.shipping_state = null
|
||||
this.shipping_city = null
|
||||
return true
|
||||
}
|
||||
},
|
||||
shipping_state (newState) {
|
||||
if (newState) {
|
||||
this.shipping.state_id = newState.id
|
||||
this.isDisabledShippingCity = false
|
||||
this.fetchShippingCities()
|
||||
if (this.isCopyFromBilling) {
|
||||
this.isCopyFromBilling = false
|
||||
return true
|
||||
}
|
||||
this.shipping_city = null
|
||||
return true
|
||||
}
|
||||
this.shipping_city = null
|
||||
this.isDisabledShippingCity = true
|
||||
return true
|
||||
},
|
||||
shipping_city (newCity) {
|
||||
if (newCity) {
|
||||
this.shipping.city_id = newCity.id
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@ -624,42 +538,6 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async fetchBillingState () {
|
||||
let res = await window.axios.get(`/api/states/${this.billing_country.id}`)
|
||||
if (res) {
|
||||
this.billingStates = res.data.states
|
||||
}
|
||||
if (this.isEdit) {
|
||||
this.billing_state = this.billingStates.find((state) => state.id === this.billing.state_id)
|
||||
}
|
||||
},
|
||||
async fetchBillingCities () {
|
||||
let res = await window.axios.get(`/api/cities/${this.billing_state.id}`)
|
||||
if (res) {
|
||||
this.billingCities = res.data.cities
|
||||
}
|
||||
if (this.isEdit) {
|
||||
this.billing_city = this.billingCities.find((city) => city.id === this.billing.city_id)
|
||||
}
|
||||
},
|
||||
async fetchShippingState () {
|
||||
let res = await window.axios.get(`/api/states/${this.shipping_country.id}`)
|
||||
if (res) {
|
||||
this.shippingStates = res.data.states
|
||||
}
|
||||
if (this.isEdit) {
|
||||
this.shipping_state = this.shippingStates.find((s) => s.id === this.shipping.state_id)
|
||||
}
|
||||
},
|
||||
async fetchShippingCities () {
|
||||
let res = await window.axios.get(`/api/cities/${this.shipping_state.id}`)
|
||||
if (res) {
|
||||
this.shippingCities = res.data.cities
|
||||
}
|
||||
if (this.isEdit) {
|
||||
this.shipping_city = this.shippingCities.find((c) => c.id === this.shipping.city_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,37 +72,22 @@
|
||||
</div>
|
||||
<div class="col-md-6 mb-4">
|
||||
<label class="input-label">{{ $tc('settings.company_info.state') }}</label>
|
||||
<base-select
|
||||
v-model="state"
|
||||
:options="states"
|
||||
:searchable="true"
|
||||
:disabled="isDisabledState"
|
||||
:show-labels="false"
|
||||
:placeholder="$t('general.select_state')"
|
||||
label="name"
|
||||
track-by="id"
|
||||
<base-input
|
||||
v-model="formData.state"
|
||||
:placeholder="$tc('settings.company_info.state')"
|
||||
name="state"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-6 mb-4">
|
||||
<label class="input-label">{{ $tc('settings.company_info.city') }}</label>
|
||||
<base-select
|
||||
v-model="city"
|
||||
:options="cities"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:disabled="isDisabledCity"
|
||||
:placeholder="$t('general.select_city')"
|
||||
label="name"
|
||||
track-by="id"
|
||||
<base-input
|
||||
v-model="formData.city"
|
||||
:placeholder="$tc('settings.company_info.city')"
|
||||
name="city"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<!-- <div class="col-md-6 mb-3">
|
||||
<label class="input-label">Website</label>
|
||||
<base-input
|
||||
v-model="formData.website"
|
||||
placeholder="Website"
|
||||
/>
|
||||
</div> -->
|
||||
<div class="col-md-6 mb-4">
|
||||
<label class="input-label">{{ $tc('settings.company_info.zip') }}</label>
|
||||
<base-input
|
||||
@ -157,7 +142,7 @@ import ImageBox from '../components/ImageBox.vue'
|
||||
import AvatarCropper from 'vue-avatar-cropper'
|
||||
import { validationMixin } from 'vuelidate'
|
||||
import { mapActions } from 'vuex'
|
||||
const { required, email, numeric, maxLength } = require('vuelidate/lib/validators')
|
||||
const { required, email, maxLength } = require('vuelidate/lib/validators')
|
||||
|
||||
export default {
|
||||
components: { AvatarCropper, IconUpload, ImageBox },
|
||||
@ -184,20 +169,14 @@ export default {
|
||||
address_street_2: '',
|
||||
website: '',
|
||||
country_id: null,
|
||||
state_id: '',
|
||||
city_id: ''
|
||||
state: '',
|
||||
city: ''
|
||||
},
|
||||
isLoading: false,
|
||||
isHidden: false,
|
||||
country: null,
|
||||
previewLogo: null,
|
||||
city: null,
|
||||
state: null,
|
||||
countries: [],
|
||||
isDisabledState: true,
|
||||
isDisabledCity: true,
|
||||
states: [],
|
||||
cities: [],
|
||||
passData: [],
|
||||
fileSendUrl: '/api/settings/company',
|
||||
fileObject: null
|
||||
@ -206,44 +185,9 @@ export default {
|
||||
watch: {
|
||||
country (newCountry) {
|
||||
this.formData.country_id = newCountry.id
|
||||
if (this.formData.country_id) {
|
||||
this.isDisabledState = false
|
||||
}
|
||||
this.fetchState()
|
||||
if (this.isFetchingData) {
|
||||
return true
|
||||
}
|
||||
|
||||
this.state = null
|
||||
this.city = null
|
||||
},
|
||||
state (newState) {
|
||||
if (newState !== null && newState !== undefined) {
|
||||
this.formData.state_id = newState.id
|
||||
this.fetchCities()
|
||||
this.isDisabledCity = false
|
||||
|
||||
if (this.isFetchingData) {
|
||||
this.isFetchingData = false
|
||||
return true
|
||||
}
|
||||
this.city = null
|
||||
return true
|
||||
}
|
||||
// this.formData.state_id = null
|
||||
this.cities = []
|
||||
this.city = null
|
||||
// this.formData.city_id = null
|
||||
this.isDisabledCity = true
|
||||
return true
|
||||
},
|
||||
city (newCity) {
|
||||
if (newCity !== null && newCity !== undefined) {
|
||||
this.formData.city_id = newCity.id
|
||||
return true
|
||||
}
|
||||
// this.formData.city_id = null
|
||||
// return true
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
@ -292,9 +236,9 @@ export default {
|
||||
this.formData.address_street_2 = response.data.user.addresses[0].address_street_2
|
||||
this.formData.zip = response.data.user.addresses[0].zip
|
||||
this.formData.phone = response.data.user.addresses[0].phone
|
||||
this.formData.state = response.data.user.addresses[0].state
|
||||
this.formData.city = response.data.user.addresses[0].city
|
||||
this.country = response.data.user.addresses[0].country
|
||||
this.state = response.data.user.addresses[0].state
|
||||
this.city = response.data.user.addresses[0].city
|
||||
this.previewLogo = response.data.user.company.logo
|
||||
},
|
||||
async updateCompany () {
|
||||
@ -328,19 +272,6 @@ export default {
|
||||
if (res) {
|
||||
this.countries = res.data.countries
|
||||
}
|
||||
},
|
||||
async fetchState () {
|
||||
this.$v.formData.country_id.$touch()
|
||||
let res = await window.axios.get(`/api/states/${this.country.id}`)
|
||||
if (res) {
|
||||
this.states = res.data.states
|
||||
}
|
||||
},
|
||||
async fetchCities () {
|
||||
let res = await window.axios.get(`/api/cities/${this.state.id}`)
|
||||
if (res) {
|
||||
this.cities = res.data.cities
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,29 +64,18 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">{{ $t('wizard.state') }}</label>
|
||||
<base-select
|
||||
v-model="state"
|
||||
:options="states"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:disabled="isDisabledState"
|
||||
:placeholder="$t('general.select_state')"
|
||||
track-by="id"
|
||||
label="name"
|
||||
@input="fetchCities"
|
||||
<base-input
|
||||
v-model="companyData.state"
|
||||
name="state"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">{{ $t('wizard.city') }}</label>
|
||||
<base-select
|
||||
v-model="city"
|
||||
:options="cities"
|
||||
:searchable="true"
|
||||
:show-labels="false"
|
||||
:disabled="isDisabledCity"
|
||||
:placeholder="$t('general.select_city')"
|
||||
track-by="id"
|
||||
label="name"
|
||||
<base-input
|
||||
v-model="companyData.city"
|
||||
name="city"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -180,8 +169,8 @@ export default {
|
||||
name: null,
|
||||
address_street_1: '',
|
||||
address_street_2: '',
|
||||
city_id: '',
|
||||
state_id: '',
|
||||
city: '',
|
||||
state: '',
|
||||
country_id: '',
|
||||
zip: '',
|
||||
phone: ''
|
||||
@ -190,13 +179,7 @@ export default {
|
||||
step: 1,
|
||||
countries: [],
|
||||
country: null,
|
||||
states: [],
|
||||
state: null,
|
||||
cities: [],
|
||||
city: null,
|
||||
previewLogo: null,
|
||||
isDisabledCity: true,
|
||||
isDisabledState: true
|
||||
previewLogo: null
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
@ -218,35 +201,6 @@ export default {
|
||||
watch: {
|
||||
country ({ id }) {
|
||||
this.companyData.country_id = id
|
||||
this.state = null
|
||||
this.city = null
|
||||
if (id !== null && id !== undefined) {
|
||||
this.isDisabledState = false
|
||||
return true
|
||||
}
|
||||
this.isDisabledState = true
|
||||
return true
|
||||
},
|
||||
state (newState) {
|
||||
if (newState !== null && newState !== undefined) {
|
||||
this.city = null
|
||||
this.companyData.state_id = newState.id
|
||||
this.isDisabledCity = false
|
||||
return true
|
||||
}
|
||||
this.companyData.state_id = null
|
||||
this.isDisabledCity = true
|
||||
this.cities = []
|
||||
this.city = null
|
||||
this.companyData.city_id = null
|
||||
return true
|
||||
},
|
||||
city (newCity) {
|
||||
if (newCity !== null && newCity !== undefined) {
|
||||
this.companyData.city_id = newCity.id
|
||||
return true
|
||||
}
|
||||
this.companyData.city_id = null
|
||||
return true
|
||||
}
|
||||
},
|
||||
@ -307,22 +261,6 @@ export default {
|
||||
if (res) {
|
||||
this.countries = res.data.countries
|
||||
}
|
||||
},
|
||||
async fetchState () {
|
||||
this.$v.companyData.country_id.$touch()
|
||||
let res = await window.axios.get(`/api/states/${this.country.id}`)
|
||||
if (res) {
|
||||
this.states = res.data.states
|
||||
}
|
||||
},
|
||||
async fetchCities () {
|
||||
if (this.state === null || this.state === undefined) {
|
||||
return false
|
||||
}
|
||||
let res = await window.axios.get(`/api/cities/${this.state.id}`)
|
||||
if (res) {
|
||||
this.cities = res.data.cities
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user