update RFM search ui

This commit is contained in:
edmondlang
2022-02-17 22:41:47 +08:00
parent efc5811403
commit b0fa7107f6
3 changed files with 106 additions and 0 deletions
@@ -0,0 +1,77 @@
<template>
<div class="row m-b-20">
<div class="col">
<div class="row">
<div class="col">
<loading-component style="height: 50px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
<div class="row m-l-0 m-r-0 bg-master-light padding-10" v-show="!isLoading">
<div class="col-12 col-md mb-2 mb-md-0">
<validation-wrapper-component :validator="$v.parameters.recency">
<label class="all-caps">Last Payment Date</label>
<date-picker-component :parameters="parameters" v-model.lazy="parameters.recency"></date-picker-component>
</validation-wrapper-component>
</div>
<div class="col-12 col-md mb-2 mb-md-0">
<validation-wrapper-component :validator="$v.parameters.frequency">
<label class="all-caps">Bookings Frequency</label>
<input type="text" class="form-control" v-model.lazy="parameters.frequency">
</validation-wrapper-component>
</div>
<div class="col-12 col-md mb-2 mb-md-0">
<validation-wrapper-component :validator="$v.parameters.monetary">
<label class="all-caps">Total Payments</label>
<input type="text" class="form-control" v-model.lazy="parameters.monetary">
</validation-wrapper-component>
</div>
<div class="col-12 col-md-auto d-flex justify-content-center align-items-center">
<button type="button" class="btn btn-lg btn-primary fs-11 w-100" @click="submitSearch()">Search</button>
</div>
</div>
</div>
</div>
<div class="row no-margin" v-show="search">
<div class="col bg-white padding-25">
<list-component :section="section" :endpoint="route('api.company.list')" :options="{'with_total_payments': true, 'recency': recency, 'frequency': frequency, 'monetary': monetary, 'business_type': 2, with_bookings:true, order_by:{ column:'total_payments', DESC:true}}">
<template slot="list" slot-scope="{data}">
<company-component :data="data"></company-component>
</template>
</list-component>
</div>
</div>
</div>
</div>
</template>
<script>
import componentHandler from "../../../general/mixins/componentHandler";
import { required, minValue} from "vuelidate/lib/validators";
import {VMoney} from 'v-money'
export default {
data(){
return {
section: 'customerSectionComponent',
isLoading: false,
search: false,
parameters: {
recency: '2022-02-15',
frequency: 0,
monetary : 0,
}
}
},
methods: {
submitSearch(){
this.search = true;
}
},
validations: {
parameters: {
recency: {},
frequency: {},
monetary: {},
}
},
mixins: [componentHandler]
};
</script>
@@ -0,0 +1,28 @@
<template>
<input class="form-control">
</template>
<script>
export default {
props: {
value: {
required: false
}
},
mounted(){
let vm = this;
$(this.$el).datepicker({
format: 'dd-mm-yyyy',
autoclose: true,
clearBtn: true,
}).val(this.value).trigger("change").on('changeDate', function(){
vm.$emit('input', this.value);
});
},
watch: {
value: function(value){
$(this.$el).val(value).trigger('change');
}
}
}
</script>
@@ -4,6 +4,7 @@
<div class="col p-t-15 p-b-15">
<div class="row m-b-25">
<div class="col">
<customer-section-component></customer-section-component>
<div class="row tabsContainer">
<div class="col">
<div class="row m-l-0 m-r-0 d-flex">