53 lines
1.5 KiB
Vue
53 lines
1.5 KiB
Vue
<template>
|
|
<label>Pilih Batch Lelong</label>
|
|
<div class="d-flex">
|
|
<select class="custom-select" @change="pilihBatchLelong($event)">
|
|
<option selected>Batch Lelong</option>
|
|
<option v-for="val in listLelong" :key="val" v-bind:value="val.id">{{ val.id }}, ({{ val.tarikh_lelong }})
|
|
</option>
|
|
</select>
|
|
<button class="btn btn-primary d-flex" @click="reloadComponent()">Kemaskini <span class="material-symbols-rounded">refresh</span></button>
|
|
</div>
|
|
<div class="mt-3">
|
|
<DisplayLelongBid v-if="pilihLelong != 'Batch Lelong'" v-bind:key="componentKeySecond"
|
|
v-bind:selectedIdCawangan="pilihIdCawangan" v-bind:selectedBatchLelong="pilihLelong" />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, onMounted } from "vue";
|
|
import DisplayLelongBid from "./DisplayLelongBid.vue.vue"
|
|
import axios from "axios";
|
|
|
|
const listLelong = ref();
|
|
const pilihLelong = ref('Batch Lelong');
|
|
const pilihIdCawangan = ref(branch_code);
|
|
const componentKeySecond = ref(0);
|
|
|
|
function getListLelongByCawangan() {
|
|
axios.get("/listLelongByCawangan", {
|
|
params: {
|
|
caw_id: branch_code,
|
|
},
|
|
}).then((response) => {
|
|
listLelong.value = response.data;
|
|
}).catch((error) => {
|
|
alert(error);
|
|
});
|
|
};
|
|
|
|
function pilihBatchLelong(e) {
|
|
let val = e.target.value;
|
|
pilihLelong.value = val;
|
|
componentKeySecond.value += 1;
|
|
};
|
|
|
|
function reloadComponent() {
|
|
componentKeySecond.value += 1;
|
|
}
|
|
|
|
onMounted(() => {
|
|
getListLelongByCawangan();
|
|
})
|
|
</script>
|