73 lines
2.3 KiB
Vue
73 lines
2.3 KiB
Vue
<template>
|
|
<div class="mx-auto">
|
|
<a v-if="route === 'ada'" 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" @change="tukarcawangan" 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>
|
|
</a>
|
|
<a v-if="route === 'tiada'" class="text-yellow-200 rounded bg-gray-400 px-6 py-3 font-bold mr-4 uppercase md:invisible xl:visible">
|
|
CAWANGAN : {{ this.namacawangan(this.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>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
|
|
export default {
|
|
props: {
|
|
status: String,
|
|
roles: String,
|
|
route:String
|
|
},
|
|
data: function(){
|
|
return{
|
|
cawangan:{},
|
|
caw:this.$kodcaw
|
|
}
|
|
},
|
|
|
|
created() {
|
|
|
|
this.caw = this.$kodcaw
|
|
|
|
this.axios.get('/api/check/cawangan').then(response => {
|
|
console.log(response.data)
|
|
this.cawangan = response.data;
|
|
});
|
|
|
|
},
|
|
methods:{
|
|
tukarcawangan: function(){
|
|
|
|
this.setkodcaw(this.caw)
|
|
this.$forceUpdate();
|
|
|
|
location.reload();
|
|
|
|
},
|
|
namacawangan: function(cawangannama){
|
|
let namcaw = '';
|
|
if(this.cawangan.length >0)
|
|
{
|
|
this.cawangan.some(function(value, key) {
|
|
|
|
if(cawangannama === value.kodcaw)
|
|
{
|
|
namcaw = value.details_caw
|
|
}
|
|
});
|
|
}
|
|
|
|
return namcaw;
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
</script>
|