Files
REG_IBL/one-ui/management/one-sales-per-omset/index.php
2026-05-25 20:01:37 +07:00

397 lines
16 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>One</title>
<link rel="stylesheet" href="../../libs/vendor/css/google-fonts.css">
<link rel="stylesheet" href="../../libs/vendor/css/icomoon-fonts.css">
<link rel="stylesheet" href="../../libs/vendor/css/vuetify.min.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Days+One&display=swap" rel="stylesheet">
</head>
<body>
<div v-cloak id="app">
<v-app id="smartApp" >
<v-card @click="goToMenu('/one-ui/management/one-management-menu')" tile elevation="5" color="#85352e" class="pt-2 pb-2 mb-1">
<v-flex class="text-xs-center" xs12>
<h3 style="font-family: 'Days One', sans-serif;color:#FFFFFF">BISONE</h3>
</v-flex>
</v-card>
<v-content style="background:#fff8dc8c">
<v-layout class="align-center pr-2 mb-2 " row>
<v-flex class="text-xs-left mt-2" xs6>
<p class="pl-2 mb-0 font-weight-black">OMSET PER TIPE OMSET</p>
</v-flex>
<v-flex class="text-xs-right mt-2" xs6>
<v-btn-toggle v-model="xtype">
<v-btn color="#272324" small flat @click="changeType('day')" value="day">
Harian
</v-btn>
<v-btn color="#272324" small flat @click="changeType('month')" value="month">
Bulanan
</v-btn>
</v-btn-toggle>
</v-flex>
</v-layout>
<v-layout row>
<v-flex pa-1 xs12>
<v-card color="#a6cbff">
<v-layout pa-1 align-center row>
<v-flex pl-2 xs6>
<p class="mb-0 font-weight-black subheader">BANDUNG RAYA</p>
<p v-if="xtype === 'month'" class="mb-0">{{getmonthyear()}}</p>
<p v-if="xtype === 'day'" class="mb-0">{{getdaymonthyear()}}</p>
</v-flex>
<v-flex text-xs-right pr-2 xs6>
<p class="mb-1 font-weight-black subheader">{{total_tunai}} JUTA</p>
</v-flex>
</v-layout>
</v-card>
</v-flex>
</v-layout>
<v-container fluid fill-height class="pl-1 pr-1 pt-1 pb-2">
<v-layout row>
<v-flex xs12>
<v-card
color="#a6cbff"
>
<v-card-title
class="white--text"
style="background:#b5abce"
>
<v-layout wrap>
<v-flex xs12>
<v-layout justify-center mb-1 wrap>
<v-flex v-for="value in all" pa-1 xs6>
<v-card :color="value.color">
<v-card-actions class="pa-1">
<v-layout align-center row>
<v-flex pl-2 style="border-right:1px solid grey" xs8>
<h5>{{value.label}}</h5>
<p class="mb-1 caption mono">{{value.total}} juta</p>
</v-flex>
<v-flex pr-2 text-xs-right xs4>
<h5 style="font-size:10px">{{value.persen}}%</h5>
</v-flex>
</v-layout>
</v-card-actions>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-title>
<v-card-text class="py-0">
<v-timeline dense>
<v-timeline-item
color="#b5abce"
small
v-for="omset in datas"
>
<v-container pa-0 >
<v-layout text-xs-center style="background:white" class="font-weight-black mb-1" pa-1 row>
<v-flex mt-1 mb-1 xs12><h4>TOTAL OMSET {{omset.cabang}} {{omset.total}} JUTA</h4></v-flex>
</v-layout>
<v-layout v-for="pertype in omset.details" pa-0 style="background:white" row>
<v-flex class="pl-2 pr-2" xs12>
<v-layout mb-1 row>
<v-flex pa-2 xs12>
<v-layout row>
<v-flex xs8>
<p class="mb-0 font-weight-bold">{{pertype.name_type}}</p>
<p class="mb-0 caption mono">{{pertype.total}} juta</p>
</v-flex>
<v-flex xs4>
<v-progress-linear
color="#b5abce"
height="7"
:value="pertype.persen"
></v-progress-linear>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-container>
</v-timeline-item>
</v-timeline>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-content>
</v-app>
</div>
<!-- Vendor -->
<script src="../../libs/vendor/moment.min.js"></script>
<script src="../../libs/vendor/numeral.min.js"></script>
<script src="../../libs/vendor/moment-locale-id.js"></script>
<script src="../../libs/vendor/lodash.js"></script>
<script src="../../libs/vendor/axios.min.js"></script>
<script src="../../libs/vendor/vue.js"></script>
<script src="../../libs/vendor/vuex.js"></script>
<script src="../../libs/vendor/vuetify.js"></script>
<script src="../../libs/vendor/httpVueLoader.js"></script>
<script src="../../libs/one_global.js"></script>
<script>
window.Promise ||
document.write(
'<script src="../../libs/vendor/polyfill.min.js"><\/script>'
)
window.Promise ||
document.write(
'<script src="../../libs/vendor/classList.min.js"><\/script>'
)
window.Promise ||
document.write(
'<script src="../../libs/vendor/findindex_polyfill_mdn.js"><\/script>'
)
</script>
<script src="../../libs/vendor/apexcharts.js"></script>
<script src="../../libs/vendor/vue-apexcharts.js"></script>
<!-- App Script -->
<?php
$ts = "?ts=" . Date("ymdhis");
?>
<script type="module">
import { store } from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
methods: {
tab_selected : function(tab) {
return this.$store.state.tab_selected == tab
}
},
mounted() {
let self = this
self.$store.dispatch('sales/getdatas_riau',{type:this.xtype})
self.$store.dispatch('sales/getdatas_pajajaran',{type:this.xtype})
self.$store.dispatch('sales/getdatas_toha',{type:this.xtype})
self.$store.dispatch('sales/getdatas_cimahi',{type:this.xtype})
},
computed: {
datas(){
return this.$store.state.sales.datas
},
total_tunai(){
return this.$store.state.sales.total_tunai
},
all(){
var datas = this.$store.state.sales.datas
var all = []
if(this.$store.state.sales.persetase_loading === 100){
console.log(datas[0].details)
var xdetails = datas[0].details
xdetails.forEach(function(value){
let new_obj = {label:value.name_type,color:value.color,total:0,persen:0}
all.push(new_obj)
})
datas.forEach(function(value){
value.details.forEach(function(detail){
let idx = _.findIndex(all, { label:detail.name_type })
let total = all[idx].total
total = total + parseFloat(detail.total)
total = Math.round((total+ Number.EPSILON) * 100) / 100
all[idx].total = total
})
})
var total_value = 0
all.forEach(function(xtot){
total_value = total_value + parseFloat(xtot.total)
total_value = Math.round((total_value+ Number.EPSILON) * 100) / 100
})
this.$store.commit('sales/update_total_tunai',total_value)
all.forEach(function(entry,index){
var persen = (entry.total/total_value) * 100
persen = Math.round((persen + Number.EPSILON) * 100) / 100
all[index].persen = persen
})
}
return all
}
},
data: {
show:true,
width1:'45',
width2:'25%',
width11:'55%',
width3:'10%',
width4:'5%',
width5:'2%',
width6:'18%',
xtype:'day',
types:['day','month']
},
methods:{
goToMenu(url){
window.location.href = url
},
count_persen(value){
var all = this.total_all
var persen = (value/all) * 100
persen = Math.round((persen + Number.EPSILON) * 100) / 100
return persen
},
getmonthyear(){
var d = new Date();
var month = new Array();
month[0] = "Januari";
month[1] = "Pebruari";
month[2] = "Maret";
month[3] = "April";
month[4] = "Mei";
month[5] = "Juni";
month[6] = "Juli";
month[7] = "Agustus";
month[8] = "September";
month[9] = "Oktober";
month[10] = "Nopember";
month[11] = "Desember";
var n = month[d.getMonth()]
return n+' '+d.getFullYear()
},
getdaymonthyear(){
var d = new Date();
var month = new Array();
month[0] = "Januari";
month[1] = "Pebruari";
month[2] = "Maret";
month[3] = "April";
month[4] = "Mei";
month[5] = "Juni";
month[6] = "Juli";
month[7] = "Agustus";
month[8] = "September";
month[9] = "Oktober";
month[10] = "Nopember";
month[11] = "Desember";
var n = month[d.getMonth()]
return d.getDate()+' '+n+' '+d.getFullYear()
},
getdatasx(act){
console.log(act)
var old_type = this.xtype
console.log(old_type)
var idx = this.types.indexOf(old_type)
console.log(idx)
if(act === 'Left'){
if(idx > 0)
idx = idx - 1
}
if(act === 'Right'){
if(idx < (this.types.length-1))
idx = idx + 1;console.log(idx)
}
var type = this.types[idx]
this.xtype = type
console.log(type)
this.$store.commit('sales/update_persetase_loading',0)
this.$store.commit('sales/update_datas',[])
this.$store.commit('sales/update_total_tunai',0)
this.$store.dispatch('sales/getdatas_riau',{type:type})
this.$store.dispatch('sales/getdatas_pajajaran',{type:type})
this.$store.dispatch('sales/getdatas_toha',{type:type})
this.$store.dispatch('sales/getdatas_cimahi',{type:type})
},
changeType(type){
this.xtype = type
console.log(type)
this.$store.commit('sales/update_persetase_loading',0)
this.$store.commit('sales/update_datas',[])
this.$store.commit('sales/update_total_tunai',0)
this.$store.dispatch('sales/getdatas_riau',{type:type})
this.$store.dispatch('sales/getdatas_pajajaran',{type:type})
this.$store.dispatch('sales/getdatas_toha',{type:type})
this.$store.dispatch('sales/getdatas_cimahi',{type:type})
}
},
components: {
apexchart: VueApexCharts
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
} #chart {
padding: 0;
max-width: 650px;
margin: 35px auto;
}
.apexcharts-legend text {
font-weight: 900;
}
select.flat-select:focus, select.flat-select:hover {
border: 0;
outline: 0;
}
.apexcharts-canvas {
margin: 0 auto;
}
</style>
</body>
</html>