mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-30 09:54:16 +00:00
change order address
This commit is contained in:
@@ -1,145 +0,0 @@
|
||||
<template>
|
||||
<div class="row p-t-25 text-left">
|
||||
<div class="col">
|
||||
<div class="shadow p-3 bg-white rounded">
|
||||
<div class="d-flex flex-row align-items-center">
|
||||
<input v-show="!isEdit" type="radio" name="answer" id="answer-2"
|
||||
v-model="computeAddressId"
|
||||
:value='-1'
|
||||
:checked="new_address == true"
|
||||
>
|
||||
<label for="answer-2" data-question-number="2" class="mb-0 pl-2 pl-md-2 bold">{{isEdit?'Edit ':'Add New '}}Address</label>
|
||||
</div>
|
||||
<div class="col-0" v-if="computeAddressId==-1">
|
||||
<div class="d-flex flex-column flex-sm-row">
|
||||
<div class="col px-0 pr-sm-2">
|
||||
<validation-wrapper-component selecatable :validator="$v.parameters.district_id">
|
||||
<label class="text-primary fs-12">District</label>
|
||||
<div class="controls">
|
||||
<selectable-component :endpoint="route('api.address.district.list')" section="districtListSection" valueColumn="id" :labelColumn="['city']" v-model="parameters.district_id"></selectable-component>
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col px-0 pl-sm-2">
|
||||
<validation-wrapper-component :validator="$v.parameters.post_code">
|
||||
<label class="text-primary fs-12">Post Code</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12" v-model="parameters.post_code">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column flex-sm-row">
|
||||
<div class="col px-0 pr-sm-2">
|
||||
<validation-wrapper-component :validator="$v.parameters.street_one">
|
||||
<label class="text-primary fs-12">Street one</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12"
|
||||
v-model="parameters.street_one"
|
||||
>
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col px-0 pl-sm-2">
|
||||
<validation-wrapper-component :validator="$v.parameters.street_two">
|
||||
<label class="text-primary fs-12">Street two</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12"
|
||||
v-model="parameters.street_two"
|
||||
>
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-t-25">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col text-right">
|
||||
<button type="button" class="btn btn-sm btn-primary b-rad-none" @click="submitForm()">{{isEdit?'Update':'Create'}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { required ,requiredIf } from "vuelidate/lib/validators";
|
||||
export default {
|
||||
props: {
|
||||
section: {
|
||||
default: 'addressForm'
|
||||
},
|
||||
isEdit:{
|
||||
default: false
|
||||
},
|
||||
populateWith: {
|
||||
type: Object,
|
||||
default: () => ({ empty: true })
|
||||
},
|
||||
address_id: null
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
parameters : {
|
||||
company_module_id:this.$store.getters.getCompanyModuleId,
|
||||
street_one: '',
|
||||
street_two: '',
|
||||
district_id: '',
|
||||
post_code: '',
|
||||
},
|
||||
new_address:false
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
computeAddressId:{
|
||||
get() {
|
||||
if (!this.populateWith.empty) {
|
||||
this.parameters = this.populateWith;
|
||||
this.parameters.district_id = this.populateWith.district.id;
|
||||
this.parameters.id = this.populateWith.id;
|
||||
}
|
||||
return this.address_id;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('input', val);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
validations: {
|
||||
parameters: {
|
||||
street_one: { required:requiredIf(function () { return this.computeAddressId === -1 }) },
|
||||
street_two: {},
|
||||
district_id: { required },
|
||||
post_code: { required },
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
submitForm(){
|
||||
if(!this.validate()){
|
||||
return;
|
||||
}
|
||||
this.isLoading = true;
|
||||
this.isEdit?this.submit(route('api.address.update', this.parameters.id), 'put', this.section, true, true):this.submit((this.route('api.address.create')), 'post', 'addressList', true, true);
|
||||
},
|
||||
successHandler(response){
|
||||
this.$emit('input', response.payload.data.id);
|
||||
this.resetForm();
|
||||
this.closeModal();
|
||||
this.isLoading = false;
|
||||
this.updateList();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="row d-none" :class="[{'d-flex': $store.getters.isAdmin}]" v-if="$store.getters.isAdmin">
|
||||
<div class="col-6">
|
||||
<div class="col-8">
|
||||
<div class="row p-b-5 b-b b-grey m-b-10 m-l-0 m-r-0">
|
||||
<div class="col no-padding">
|
||||
<h6>Customers List</h6>
|
||||
|
||||
Reference in New Issue
Block a user