mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
146 lines
7.5 KiB
Vue
146 lines
7.5 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-margiPsn">Edit Service Charge</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 m-r-0">
|
|
<div class="col p-r-0">
|
|
<validation-wrapper-component :validator="$v.parameters.detail.amount.value">
|
|
<label>Service Charge (MYR)</label>
|
|
<input type="text" class="form-control" v-model="parameters.detail.amount.value" v-money="parameters.detail.amount.type === 'percentage' ? threeDecimalPercentage : productPrice">
|
|
</validation-wrapper-component>
|
|
</div>
|
|
<div class="col-2 text-white pointer text-center" :class="[{'bg-master-lightest': parameters.detail.amount.type === 'percentage'}, {'bg-info': parameters.detail.amount.type === 'fix_amount'}]" @click="parameters.detail.amount.type = 'fix_amount'">
|
|
<div class="row h-100 align-items-center">
|
|
<div class="col p-r-20 fs-20" :class="[{'text-master': parameters.detail.amount.type === 'percentage'}]">
|
|
MYR
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-2 text-white pointer text-center" :class="[{'bg-master-lightest': parameters.detail.amount.type === 'fix_amount'}, {'bg-info': parameters.detail.amount.type === 'percentage'}]" @click="parameters.detail.amount.type = 'percentage'">
|
|
<div class="row h-100 align-items-center">
|
|
<div class="col p-r-20 fs-20" :class="[{'text-master': parameters.detail.amount.type === 'fix_amount'}]">
|
|
%
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row m-b-10 m-r-0">
|
|
<div class="col p-r-0">
|
|
<validation-wrapper-component :validator="$v.parameters.detail.transferFee.value" >
|
|
<label>Transfer Fee (FEC)</label>
|
|
<input type="text" class="form-control" v-model="parameters.detail.transferFee.value" v-money="parameters.detail.transferFee.type === 'percentage' ? threeDecimalPercentage : productPrice">
|
|
</validation-wrapper-component>
|
|
</div>
|
|
<div class="col-2 text-white pointer" :class="[{'bg-master-lightest': parameters.detail.transferFee.type === 'percentage'}, {'bg-info': parameters.detail.transferFee.type === 'fix_amount'}]" @click="parameters.detail.transferFee.type = 'fix_amount'">
|
|
<div class="row h-100 align-items-center text-center">
|
|
<div class="col p-r-20 p-l-20 fs-20" :class="[{'text-master': parameters.detail.transferFee.type === 'percentage'}]">
|
|
FEC
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-2 text-white pointer" :class="[{'bg-master-lightest': parameters.detail.transferFee.type === 'fix_amount'}, {'bg-info': parameters.detail.transferFee.type === 'percentage'}]" @click="parameters.detail.transferFee.type = 'percentage'">
|
|
<div class="row h-100 align-items-center text-center">
|
|
<div class="col p-r-20 fs-20" :class="[{'text-master': parameters.detail.transferFee.type === 'fix_amount'}]">
|
|
%
|
|
</div>
|
|
</div>
|
|
</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="submitForm()">Confirm</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: {
|
|
supplierId: {
|
|
type: Number,
|
|
required: true
|
|
}
|
|
},
|
|
data(){
|
|
return {
|
|
parameters: {
|
|
name: 'Service Charge',
|
|
reference: 'SERVICE_CHARGE',
|
|
detail: {
|
|
id: this.supplierId,
|
|
amount: {
|
|
type: "percentage",
|
|
value: 0
|
|
},
|
|
transferFee: {
|
|
type: "percentage",
|
|
value: 0
|
|
},
|
|
transferCompanyId: this.supplierId
|
|
},
|
|
segment_id: 1
|
|
},
|
|
serviceChargeOptions: false,
|
|
transferFeeOptions: false,
|
|
}
|
|
},
|
|
validations: {
|
|
parameters: {
|
|
detail: {
|
|
amount: {
|
|
value: required
|
|
},
|
|
transferFee: {
|
|
value: required
|
|
},
|
|
transferCompanyId: {
|
|
required: true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
created(){
|
|
if(this.data){
|
|
this.parameters.detail = {
|
|
id: this.supplierId,
|
|
amount: {
|
|
type: this.data.detail.amount.type,
|
|
value: parseFloat(this.data.detail.amount.value).toFixed(3)
|
|
},
|
|
transferFee: {
|
|
type: this.data.detail.transferFee.type,
|
|
value: parseFloat(this.data.detail.transferFee.value).toFixed(3)
|
|
},
|
|
transferCompanyId: this.data.detail.transferCompanyId
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
submitForm(){
|
|
this.submit(this.data ? this.route('api.segment_constant.update', this.data.id) : this.route('api.segment_constant.create'), this.data ? 'put' : 'post', this.section, true, true);
|
|
},
|
|
},
|
|
mixins: [ModalFormHandler]
|
|
|
|
}
|
|
</script> |