Files
exchange-2.0/resources/assets/vue/components/settings/forms/SegmentFormComponent.vue
T
Farhan 00994d6ac1 Add Label section on Settings
Update create section api to support type
2022-07-26 17:31:07 +08:00

84 lines
3.1 KiB
Vue

<template>
<div class="row">
<div class="col">
<loading-component style="height: 50px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
<div class="row" v-show="!$store.getters.isLoading(section)">
<div class="col">
<div class="row m-b-20">
<div class="col">
<h6 class="all-caps m-b-5 bold no-margin">{{ headerTitle }}</h6>
</div>
</div>
<div class="row m-b-5 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
<div class="col">
<small class="bold fs-10 text-danger">{{error}}</small>
</div>
</div>
<div class="row m-b-10">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.name">
<label>Name</label>
<input type="text" class="form-control" v-model="parameters.name">
</validation-wrapper-component>
</div>
</div>
<div class="row">
<div class="col p-r-5">
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" data-dismiss="modal">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submit(route('api.segment.create'), 'post', section, true, false)">Create</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
import { required, requiredIf } from "vuelidate/lib/validators";
export default {
props: {
type: {
type: Number,
default: 2,
},
},
data(){
return {
parameters: {
name: '',
type: null,
}
}
},
created() {
if (this.type) {
this.parameters.type = this.type;
}
},
computed: {
headerTitle: function () {
if(this.type === 1){
return 'Create Standard Segment'
} else if(this.type === 2){
return 'Create Custom Segment'
} else if(this.type === 3){
return 'Create Label'
}
return 'Create'
}
},
validations: {
parameters: {
name: {
required: true
}
}
},
mixins: [ModalFormHandler]
}
</script>