71 lines
2.5 KiB
Vue
71 lines
2.5 KiB
Vue
<template>
|
|
<div class="mx-auto">
|
|
<a class="text-yellow-200 rounded bg-gray-400 px-6 py-3 font-bold mr-4 uppercase md:invisible xl:visible">
|
|
CAWANGAN :
|
|
<select v-model="caw" class="rounded-md border bg-gray-400 font-bold border-gray-400 focus:outline-none rounded-md focus:ring-1 ring-cyan-500 uppercase">
|
|
<option v-for="(caw,i) in cawangan" :key="i" :value="caw.kodcaw" >{{ caw.details_caw }}</option>
|
|
</select>
|
|
<!-- {{this.cawangan.details_caw }} -->
|
|
</a>
|
|
<a class="text-yellow-200 rounded bg-gray-400 px-4 py-3 font-bold mr-4 uppercase md:invisible xl:visible">
|
|
<i v-if="this.roles == 'admin'" class="fas fa-1x fa-user-lock"></i>
|
|
<i v-if="this.roles == 'akaun'" class="fas fa-1x fa-calculator"></i>
|
|
<i v-if="this.roles == 'operasi'" class="fas fa-1x fa-user-cog"></i>
|
|
</a>
|
|
<p>{{ answer }}</p>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
|
|
export default {
|
|
props: {
|
|
status: String,
|
|
roles: String
|
|
},
|
|
data: function(){
|
|
return{
|
|
cawangan:{},
|
|
caw:this.$kodcaw,
|
|
answer:'I cannot give you an answer until you ask a question!'
|
|
|
|
}
|
|
},
|
|
watch: {
|
|
// whenever question changes, this function will run
|
|
caw: function (newQuestion, oldQuestion) {
|
|
this.answer = 'Waiting for you to stop typing...'
|
|
this.debouncedtukarcawangan()
|
|
}
|
|
},
|
|
// beforeCreate: function () {
|
|
// this.caw = this.$kodcaw
|
|
// console.log(this.caw)
|
|
// },
|
|
created() {
|
|
// console.log('created',this.$kodcaw)
|
|
// this.axios.get(this.$hostname + '/api/cawangan/' + this.status).then(response => {
|
|
// this.cawangan = response.data;
|
|
// });
|
|
|
|
// console.log(this.$kodcaw)
|
|
this.caw = this.$kodcaw
|
|
|
|
this.axios.get('/api/check/cawangan').then(response => {
|
|
this.cawangan = response.data;
|
|
});
|
|
|
|
this.debouncedtukarcawangan = _.debounce(this.tukarcawangan, 500)
|
|
},
|
|
methods:{
|
|
tukarcawangan: function(){
|
|
console.log(this.caw);
|
|
this.answer = 'stop'
|
|
$kodcaw = this.caw
|
|
|
|
console.log('store',$kodcaw)
|
|
// console.log('prototype',this.$kodcaw)
|
|
}
|
|
}
|
|
}
|
|
</script>
|