Files
portal/resources/assets/vue/components/containers/elements/ContainerSearchComponent.vue
T
2022-03-08 12:27:29 +08:00

83 lines
3.8 KiB
Vue

<template>
<div class="row m-b-15" @keyup.enter="updateFilters()">
<div class="col no-margin">
<div class="row m-b-15">
<div class="col col-sm-12 col-md-4">
<label>Container Reference:</label>
<input type="text" class="form-control form-input" placeholder="ABC-12345" v-model="reference_like">
</div>
</div>
<loading-component style="height: 200px; 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-15">
<div class="col-auto p-r-5">
<button type="button" class="btn btn-sm btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="updateFilters()">
<div class="row align-items-center">
<div class="col p-r-5">Search</div>
<div class="col-auto p-l-10">
<i class="fa fa-search fs-16"></i>
</div>
</div>
</button>
</div>
<div class="col-auto p-l-5">
<button type="button" class="btn btn-sm btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-secondary b-rad-none bg-secondary" @click="resetFilter()">
<div class="row align-items-center">
<div class="col p-r-5 text-white">Reset</div>
<div class="col-auto p-l-10">
<i class="fa fa-refresh fs-16 text-white"></i>
</div>
</div>
</button>
</div>
</div>
<div class="row" key="2" v-show="!$store.getters.isLoading(section)">
<div class="col">
</div>
</div>
</div>
</div>
<div class="row" v-show="isSearch" :key="componentKey">
<div class="col bg-master-lightest p-1 p-sm-4">
<list-component section="section" :endpoint="route('api.packing_list.container.list')" :options="{'per_page': 5, 'reference_like': reference_like, order_by: {column: 'loading_date', DESC: true}}">
<template slot="list" slot-scope="{data}">
<container-component :data="data"></container-component>
</template>
</list-component>
</div>
</div>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
data(){
return {
section: 'searchContainerComponent',
componentKey: 3,
reference_like: '',
isSearch: false,
}
},
methods: {
updateFilters() {
this.isSearch = true,
this.componentKey += 1;
this.updateSectiontoggle();
},
resetFilter() {
this.isSearch = false;
this.reference_like = '';
this.updateSectiontoggle();
},
updateSectiontoggle() {
this.$store.dispatch('toggleSection', {name: 'searchContainerSection', status: this.isSearch});
}
},
mixins: [componentHandler]
}
</script>