Initial import
This commit is contained in:
39
fo/one-dashboard-que/api/queue.js
Normal file
39
fo/one-dashboard-que/api/queue.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const URL = "/one-api/v1/su/queue/";
|
||||
|
||||
export async function now() {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'now');
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function status() {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'status');
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
28
fo/one-dashboard-que/components/Antrian.js
Normal file
28
fo/one-dashboard-que/components/Antrian.js
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
export default {
|
||||
extends: VueChartJs.Bar,
|
||||
mixins: [VueChartJs.mixins.reactiveProp],
|
||||
mounted () {
|
||||
this.renderChart(this.chartData,
|
||||
{
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
yAxes : [{
|
||||
ticks: {
|
||||
beginAtZero : true
|
||||
}
|
||||
}]
|
||||
},
|
||||
events: ['click','mousemove','touchstart'],
|
||||
tooltips: {
|
||||
mode:'index',
|
||||
},
|
||||
title : {
|
||||
display: true,
|
||||
text: ['Antrian']
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
27
fo/one-dashboard-que/components/Line.js
Normal file
27
fo/one-dashboard-que/components/Line.js
Normal file
@@ -0,0 +1,27 @@
|
||||
export default {
|
||||
extends: VueChartJs.Line,
|
||||
mixins: [VueChartJs.mixins.reactiveProp],
|
||||
mounted () {
|
||||
this.renderChart(this.chartData,
|
||||
{
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
yAxes : [{
|
||||
ticks: {
|
||||
beginAtZero : true
|
||||
}
|
||||
}]
|
||||
},
|
||||
events: ['click','mousemove','touchstart'],
|
||||
tooltips: {
|
||||
mode:'index',
|
||||
},
|
||||
title : {
|
||||
display: true,
|
||||
text: ['Antrian Status']
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
13
fo/one-dashboard-que/components/SaatIni.js
Normal file
13
fo/one-dashboard-que/components/SaatIni.js
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
const reactiveProp = VueChartJs.mixins.reactiveProp
|
||||
export default {
|
||||
mixins: [reactiveProp],
|
||||
props: ['options'],
|
||||
extends: VueChartJs.Pie,
|
||||
mounted () {
|
||||
this.renderChart(
|
||||
this.chartData, this.options
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
178
fo/one-dashboard-que/index.php
Normal file
178
fo/one-dashboard-que/index.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<!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">
|
||||
</head>
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp" >
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background:#F5E8DF!important" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap >
|
||||
<v-flex xs12 class="one" fill-height pa-1>
|
||||
<v-container>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 md6 style="text-align:center">
|
||||
Antrian Saat Ini {{totalAntrian}}
|
||||
<one-now :chart-data="chartQueueNow" :options="chartOption" ></one-now>
|
||||
</v-flex>
|
||||
<v-flex xs12 md6>
|
||||
<one-antrian :chart-data="chartAntrian"></one-antrian>
|
||||
</v-flex>
|
||||
<v-flex xs12 md6>
|
||||
<one-line :chart-data="chartLine"></one-line>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer> </one-footer>
|
||||
</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/Chart.min.js"></script>
|
||||
<script src="../../libs/vendor/vue-chartjs.min.js"></script>
|
||||
<script src="../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../libs/one_global.js"></script>
|
||||
<script src="../../libs/vendor/socket.io.js"></script>
|
||||
<!-- App Script -->
|
||||
<?php
|
||||
$ts = "?ts=" . Date("ymdhis");
|
||||
?>
|
||||
<script type="module">
|
||||
|
||||
|
||||
import { store } from './store.js<?php echo $ts ?>';
|
||||
import LineChart from './components/Antrian.js';
|
||||
import SaatIni from './components/SaatIni.js';
|
||||
import Line from './components/Line.js';
|
||||
|
||||
//for testing
|
||||
var socketIoUrl = "http://" + window.location.host + ":9090/";
|
||||
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
methods: {
|
||||
},
|
||||
data : {
|
||||
tsInterval:0,
|
||||
socket : io.connect(socketIoUrl,{forceNew:false})
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
|
||||
'one-antrian': LineChart,
|
||||
'one-line': Line,
|
||||
'one-now': SaatIni
|
||||
},
|
||||
computed: {
|
||||
totalAntrian() {
|
||||
let c_data = this.$store.state.queue.queue_now
|
||||
return c_data[0] + c_data[1]
|
||||
},
|
||||
chartAntrian() {
|
||||
let data = this.$store.state.queue.status
|
||||
let c_data = {
|
||||
labels: [ ],
|
||||
datasets: [
|
||||
]
|
||||
}
|
||||
if (data.length > 0 ) {
|
||||
c_data = {
|
||||
labels: [ data[0].Hour , data[1].Hour, data[2].Hour ],
|
||||
datasets: [
|
||||
{
|
||||
label: 'Total',
|
||||
data: [ data[0].Total , data[1].Total, data[2].Total ],
|
||||
fill: false,
|
||||
borderColor: "rgb(51, 153, 51)",
|
||||
backgroundColor: "rgb(51, 153, 51)"
|
||||
},
|
||||
{
|
||||
label: '< 5 menit',
|
||||
data: [ data[0].Done , data[1].Done, data[2].Done ],
|
||||
fill: false,
|
||||
borderColor: "rgba(0, 153, 255,0.4)",
|
||||
backgroundColor: "rgba(0, 153, 255,0.6)"
|
||||
},
|
||||
{
|
||||
label: '> 5 menit',
|
||||
data: [ data[0].More5Min , data[1].More5Min, data[2].More5Min ],
|
||||
fill: false,
|
||||
borderColor: "rgb(204, 0, 153)",
|
||||
backgroundColor: "rgb(204, 0, 153)"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
return c_data
|
||||
},
|
||||
chartQueueNow() {
|
||||
let c_data = this.$store.state.queue.queue_now
|
||||
let data = {
|
||||
labels: ['< 5 menit', '> 5 menit'],
|
||||
datasets: [{
|
||||
data: c_data,
|
||||
borderColor: ["rgb(51, 204, 51)","rgb(255, 51, 0)"],
|
||||
backgroundColor: ["rgb(51, 204, 51)","rgb(255, 51, 0)"],
|
||||
}]
|
||||
}
|
||||
return data
|
||||
},
|
||||
chartOption() {
|
||||
return {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
tooltips: {
|
||||
mode:'index',
|
||||
},
|
||||
cutoutPercentage: 50,
|
||||
title : {
|
||||
display: false,
|
||||
text: 'Antrian Saat Ini'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
let self =this
|
||||
this.socket.on("notification", function(msg) {
|
||||
switch(msg.type) {
|
||||
case "reload-fo" :
|
||||
self.$store.dispatch("queue/update")
|
||||
break;
|
||||
}
|
||||
});
|
||||
this.$store.dispatch("queue/update")
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.tsInterval > 0 ) clearTimeout(this.tsInterval)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
28
fo/one-dashboard-que/modules/queue.js
Normal file
28
fo/one-dashboard-que/modules/queue.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as api from "../api/queue.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
queue_now : [0,0],
|
||||
status: []
|
||||
},
|
||||
mutations: {
|
||||
update_queue_now(state,status) {
|
||||
state.queue_now= status
|
||||
},
|
||||
update_status(state,status) {
|
||||
state.status = status
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
update: async function(context) {
|
||||
let data = await api.now()
|
||||
let q_now = [ parseInt(data.data.Less5Min), parseInt(data.data.More5Min) ]
|
||||
context.commit("update_queue_now", q_now)
|
||||
|
||||
data = await api.status()
|
||||
let last3 = data.data
|
||||
context.commit("update_status", last3)
|
||||
}
|
||||
}
|
||||
}
|
||||
20
fo/one-dashboard-que/store.js
Normal file
20
fo/one-dashboard-que/store.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import system from "../../apps/modules/system/system.js"
|
||||
import queue from "./modules/queue.js"
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
system:system,
|
||||
queue: queue
|
||||
},
|
||||
state: {
|
||||
},
|
||||
mutations: {
|
||||
},
|
||||
actions: {
|
||||
}
|
||||
});
|
||||
1
fo/one-fo-supervisor-v1
Submodule
1
fo/one-fo-supervisor-v1
Submodule
Submodule fo/one-fo-supervisor-v1 added at 5d89efaf9e
Reference in New Issue
Block a user