124 lines
4.2 KiB
Vue
124 lines
4.2 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 sm:invisible lg:visible 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 sm:invisible lg:visible 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: {
|
|
roles: String,
|
|
route:String,
|
|
akaun:String
|
|
},
|
|
data: function(){
|
|
return{
|
|
cawangan:{},
|
|
caw:this.$kodcaw
|
|
}
|
|
},
|
|
|
|
created() {
|
|
|
|
this.caw = this.$kodcaw
|
|
|
|
this.axios.get('/api/check/cawangan').then(response => {
|
|
this.cawangan = response.data;
|
|
});
|
|
|
|
},
|
|
methods:{
|
|
tukarcawangan: function(){
|
|
|
|
this.setkodcaw(this.caw)
|
|
// this.sethostname(this.caw)
|
|
this.pembahagiancawangan(this.caw)
|
|
this.$forceUpdate();
|
|
if(this.akaun =='no')
|
|
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;
|
|
|
|
|
|
},
|
|
pembahagiancawangan: function(cawangannama){
|
|
switch (cawangannama) {
|
|
case 'KB2':
|
|
case 'WCY':
|
|
case '1STOP':
|
|
case '020301':
|
|
case 'WB':
|
|
case 'ALS':
|
|
case '020306':
|
|
case 'ARM':
|
|
case 'APM':
|
|
case '010311':
|
|
case 'GC':
|
|
case 'JLI':
|
|
case 'ARP':
|
|
case '020303':{
|
|
this.sethostname('http://api.arrahn')
|
|
break;
|
|
}
|
|
case '010621':
|
|
case '010136':
|
|
case '011235':
|
|
case '010620':
|
|
case '010617':
|
|
case '010915':
|
|
case '010219':
|
|
case '010618':
|
|
case '011013':
|
|
case '011412':{
|
|
// this.$hostname = 'http://api2.arrahn'
|
|
this.sethostname('http://api2.arrahn')
|
|
break;
|
|
}
|
|
case '011229':
|
|
case '011230':
|
|
case '011227':
|
|
case '011231':
|
|
case '011232':
|
|
case '011228':
|
|
case '011234':
|
|
case '011237':
|
|
case '011233':{
|
|
// this.$hostname = 'http://api3.arrahn'
|
|
this.sethostname('http://api3.arrahn')
|
|
break;
|
|
}
|
|
default: this.sethostname('http://api.arrahn')
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|