Flatten nested repos
This commit is contained in:
0
test/vuex/one-dashboard/action.js
Normal file
0
test/vuex/one-dashboard/action.js
Normal file
31
test/vuex/one-dashboard/api.js
Normal file
31
test/vuex/one-dashboard/api.js
Normal file
@@ -0,0 +1,31 @@
|
||||
// API :
|
||||
// search bank
|
||||
// paramater : query , page , rowPerPage
|
||||
const URL =
|
||||
"http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank";
|
||||
|
||||
export async function searchBank(query, page, rowPerPage = 15) {
|
||||
try {
|
||||
var resp = await axios.post(URL, {
|
||||
query: query,
|
||||
page: page,
|
||||
rowPerPage: rowPerPage
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
query: query,
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
data.query = query;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
query: query,
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
78
test/vuex/one-dashboard/api/bahan.js
Normal file
78
test/vuex/one-dashboard/api/bahan.js
Normal file
@@ -0,0 +1,78 @@
|
||||
const URL = "/one-api/mockup/masterdata/";
|
||||
|
||||
export async function lookup(token, search,all ) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'bahan/lookup', { token: token, search: search, all:all });
|
||||
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 save(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'bahan/addnewbahan', prm);
|
||||
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 update(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'bahan/editbahan', prm);
|
||||
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 xdelete(token,id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'bahan/deletebahan', { id: id, token:token });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
59
test/vuex/one-dashboard/api/sampletype.js
Normal file
59
test/vuex/one-dashboard/api/sampletype.js
Normal file
@@ -0,0 +1,59 @@
|
||||
const URL = "/one-api/mockup/masterdata/";
|
||||
|
||||
export async function save(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'bahan/addnewsampletype', prm);
|
||||
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 xdelete(token,id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'bahan/deletesampletype', { id: id ,token:token});
|
||||
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 lookup(token,id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'bahan/lookupsampletype', { id: id, token:token });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
124
test/vuex/one-dashboard/components/oneDashboard.vue
Normal file
124
test/vuex/one-dashboard/components/oneDashboard.vue
Normal file
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<one-dialog-info :status="xinfo" :msg="xmsginfo" @close-dialog-info="closeInfo()"></one-dialog-info>
|
||||
|
||||
<v-toolbar class="pa-1 mb-2" color="blue lighten-3" dark height="50px">
|
||||
<v-toolbar-title>DASHBOARD</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card class="grow" >
|
||||
<v-img
|
||||
src="/one-ui/apps/image/welcome.png" style = "max-width: 40%; height: auto; display: block; margin-left: auto; margin-right: auto; margin-top: 10px;"
|
||||
></v-img>
|
||||
|
||||
<v-container grid-list-md text-xs-center>
|
||||
<v-layout row wrap>
|
||||
|
||||
|
||||
<v-flex xs4>
|
||||
<v-card color=" blue darken-1" style="height: 500px" class="white--text">
|
||||
<v-card-title primary-title>
|
||||
<div>
|
||||
<div class="headline">Spesifikasi</div>
|
||||
</br>
|
||||
<v-list three-line style ="background-color: #1E88E5;" class="white--text">
|
||||
<v-list-tile>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>Content filtering</v-list-tile-title>
|
||||
<v-list-tile-sub-title class="white--text">Set the content filtering level to restrict appts that can be downloaded</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
|
||||
<v-list-tile>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>Password</v-list-tile-title>
|
||||
<v-list-tile-sub-title class="white--text">Require password for purchase or use password to restrict purchase</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
</div>
|
||||
</v-card-title>
|
||||
|
||||
</v-card>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs4>
|
||||
<v-card color="light-green lighten-1" style="height: 500px" class="white--text">
|
||||
<v-card-title primary-title>
|
||||
<div>
|
||||
<div class="headline">Kelebihan</div>
|
||||
</br>
|
||||
<v-list three-line style ="background-color:#9CCC65;" class="white--text">
|
||||
<v-list-tile>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>Content filtering</v-list-tile-title>
|
||||
<v-list-tile-sub-title class="white--text">Set the content filtering level to restrict appts that can be downloaded</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
|
||||
<v-list-tile>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>Password</v-list-tile-title>
|
||||
<v-list-tile-sub-title class="white--text">Require password for purchase or use password to restrict purchase</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
</div>
|
||||
</v-card-title>
|
||||
|
||||
</v-card>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs4>
|
||||
<v-card color=" purple lighten-2" style="height: 500px" class="white--text">
|
||||
<v-card-title primary-title>
|
||||
<div>
|
||||
<div class="headline">Cara Penggunaan</div>
|
||||
</br>
|
||||
<v-list three-line style ="background-color: #BA68C8;" class="white--text">
|
||||
<v-list-tile>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>Content filtering</v-list-tile-title>
|
||||
<v-list-tile-sub-title class="white--text">Set the content filtering level to restrict appts that can be downloaded</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
|
||||
<v-list-tile>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>Password</v-list-tile-title>
|
||||
<v-list-tile-sub-title class="white--text">Require password for purchase or use password to restrict purchase</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
</div>
|
||||
</v-card-title>
|
||||
|
||||
</v-card>
|
||||
</v-flex>
|
||||
|
||||
|
||||
</v-layout>
|
||||
</v-container>
|
||||
|
||||
</v-card>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</v-layout>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.v-divider {
|
||||
border-color: rgba(90,114,246,1) !important;
|
||||
margin-top: 0.55rem !important;
|
||||
margin-bottom: 0.55rem !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
294
test/vuex/one-dashboard/components/oneMdNatSampletypeList.vue
Normal file
294
test/vuex/one-dashboard/components/oneMdNatSampletypeList.vue
Normal file
@@ -0,0 +1,294 @@
|
||||
<template>
|
||||
<v-layout >
|
||||
<v-flex xs12 >
|
||||
<v-card class="mb-2" color="white" >
|
||||
<v-toolbar color="blue lighten-3" dark height="50px">
|
||||
<v-toolbar-title>Bahan : {{xbahan.name}}</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn @click="openFormSampletype(0)" icon>
|
||||
<v-icon>library_add</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
<v-layout row wrap>
|
||||
<v-flex class="border-bottom-dashed" xs12 pt-2 pl-4 pr-4 pb-4>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="25%" class="text-md-center pt-2 pb-2">KODE</th>
|
||||
<th width="35%" class="text-md-center pt-2 pb-2">NAMA</th>
|
||||
<th width="15%" class="text-md-center pt-2 pb-2">SUFFIX</th>
|
||||
<th class="text-md-center pt-2 pb-2">AKSI</th>
|
||||
</tr>
|
||||
<tr v-if="sampletypes.length > 0 " v-for="(sampletype,idx) in sampletypes">
|
||||
<td class="text-md-left pl-3">{{sampletype.code}}</td>
|
||||
<td class="text-md-center">{{sampletype.name}}</td>
|
||||
<td class="text-md-center">{{sampletype.suffix}}</td>
|
||||
<td align="center" class="text-md-center">
|
||||
<v-btn @click="editFormSampletype(sampletype)" depressed small color="primary"><v-icon>edit</v-icon></v-btn>
|
||||
<v-btn @click="deleteSampletype(sampletype)" depressed small color="error"><v-icon>delete</v-icon></v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="sampletypes.length === 0"><td align="center" style="height:50px;text-align:center" colspan="8">Belum ada data</td> </tr>
|
||||
</table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<template>
|
||||
|
||||
<v-dialog
|
||||
v-model="dialogdeletealertsampletype"
|
||||
max-width="30%"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title
|
||||
class="headline grey lighten-2 pt-2 pb-2"
|
||||
primary-title
|
||||
>
|
||||
Peringatan !
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout row>
|
||||
<v-flex xs12 d-flex>
|
||||
<v-layout row>
|
||||
<v-flex pb-1 xs12>
|
||||
<v-layout row>
|
||||
<v-flex pt-2 pr-2 xs12>
|
||||
{{msgalertsampletype}}
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="primary"
|
||||
flat
|
||||
@click="dialogdeletealertsampletype = false"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="primary"
|
||||
flat
|
||||
@click="closeDeleteAlertSampletype()"
|
||||
>
|
||||
Yakin lah
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<template>
|
||||
<v-layout row justify-center>
|
||||
<v-dialog v-model="dialogsampletype" persistent max-width="600px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">Form Sampletype</span>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-form
|
||||
ref="formbahansampletype"
|
||||
v-model="validsampletype"
|
||||
lazy-validation
|
||||
>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
BAHAN : {{xbahan.name}}
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-text-field
|
||||
label="Kode"
|
||||
v-model="code"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-text-field
|
||||
label="Nama"
|
||||
v-model="name"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-text-field
|
||||
label="Suffix"
|
||||
v-model="suffix"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex>
|
||||
<p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" flat @click="updateDialogFormSampletype()">Tutup</v-btn>
|
||||
<v-btn color="blue darken-1" flat @click="saveFormSampletype()">Simpan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
</v-card>
|
||||
</v-flex>
|
||||
|
||||
|
||||
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.searchbox .v-input.v-text-field .v-input__slot{
|
||||
min-height:60px;
|
||||
}
|
||||
.searchbox .v-btn {
|
||||
min-height:60px;
|
||||
}
|
||||
|
||||
|
||||
table {
|
||||
font-family: arial, sans-serif;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
background:white;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
table>tr>td {
|
||||
padding: 8px;
|
||||
}
|
||||
table>tr>td:first {
|
||||
padding-left:15px!important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
query: "",
|
||||
items: [],
|
||||
headers: [
|
||||
{
|
||||
text: "KODE",
|
||||
align: "Center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "30%",
|
||||
class: " blue lighten-4"
|
||||
},
|
||||
{
|
||||
text: "NAME",
|
||||
align: "Center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "30%",
|
||||
class: "blue lighten-4"
|
||||
},
|
||||
{
|
||||
text: "SUFFIX",
|
||||
align: "Center",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "30%",
|
||||
class: "blue lighten-4"
|
||||
},
|
||||
|
||||
{
|
||||
text: "Action",
|
||||
align: "Center",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "15%",
|
||||
class: "blue lighten-4"
|
||||
}
|
||||
],
|
||||
isLoading: false,
|
||||
color:"success",
|
||||
validsampletype:false,
|
||||
xid:0,
|
||||
code:"",
|
||||
name:"",
|
||||
suffix:"",
|
||||
dialogdeletealertsampletype:false,
|
||||
msgalertsampletype:""
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
sampletypes() {
|
||||
return this.$store.state.sampletype.sampletypes
|
||||
},
|
||||
xbahan(){
|
||||
return this.$store.state.bahan.selected_bahan
|
||||
},
|
||||
dialogsampletype(){
|
||||
return this.$store.state.sampletype.dialog_form_sampletype
|
||||
},
|
||||
xerrors() {
|
||||
return this.$store.state.sampletype.errors
|
||||
}
|
||||
},
|
||||
methods : {
|
||||
updateDialogFormSampletype(){
|
||||
this.$store.commit("sampletype/update_dialog_form_sampletype",false)
|
||||
},
|
||||
openFormSampletype(val){
|
||||
this.xid = val
|
||||
this.code = ''
|
||||
this.name = ''
|
||||
this.suffix = ''
|
||||
this.$store.commit("sampletype/update_dialog_form_sampletype",true)
|
||||
},
|
||||
editFormSampletype(val){
|
||||
this.$store.commit("sampletype/update_error_code",false)
|
||||
this.$store.commit("sampletype/update_error_name",false)
|
||||
this.xid = val.id
|
||||
this.code = val.code
|
||||
this.name = val.name
|
||||
this.suffix = val.suffix
|
||||
this.$store.commit("sampletype/update_dialog_form_sampletype",true)
|
||||
},
|
||||
saveFormSampletype(){
|
||||
this.$store.dispatch("sampletype/save",{
|
||||
xid:this.xid,
|
||||
bahanid:this.$store.state.bahan.selected_bahan.id,
|
||||
bahanname:this.$store.state.bahan.selected_bahan.name,
|
||||
code:this.code,
|
||||
name:this.name,
|
||||
suffix:this.suffix
|
||||
})
|
||||
},
|
||||
updateAlert_success(val){
|
||||
this.$store.commit("bahan/update_alert_success",val)
|
||||
},
|
||||
deleteSampletype(data){
|
||||
this.xid = data.id
|
||||
|
||||
this.msgalertsampletype = "Yakin, mau hapus sampletype ?"
|
||||
this.dialogdeletealertsampletype = true
|
||||
},
|
||||
closeDeleteAlertSampletype(){
|
||||
this.$store.dispatch("sampletype/delete",{
|
||||
xid:this.xid,
|
||||
bahanid:this.$store.state.bahan.selected_bahan.id,
|
||||
bahanname:this.$store.state.bahan.selected_bahan.name,
|
||||
name:this.name
|
||||
})
|
||||
this.dialogdeletealertsampletype = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
72
test/vuex/one-dashboard/index.php
Normal file
72
test/vuex/one-dashboard/index.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<!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/vuetify.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp" >
|
||||
<one-navbar></one-navbar>
|
||||
<v-content class="blue lighten-5" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap >
|
||||
<v-flex xs12 class="left" fill-height pa-1>
|
||||
<!-- komponen kiri -->
|
||||
<one-dashboard></one-dashboard>
|
||||
</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/httpVueLoader.js"></script>
|
||||
<script src="../../../libs/one_global.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',
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-dashboard': httpVueLoader('./components/oneDashboard.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
198
test/vuex/one-dashboard/modules/bahan.js
Normal file
198
test/vuex/one-dashboard/modules/bahan.js
Normal file
@@ -0,0 +1,198 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/bahan.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
act:'new',
|
||||
lookup_bahan: 0,
|
||||
lookup_error_message: '',
|
||||
bahans: [],
|
||||
total_bahans: 0,
|
||||
total_filter_bahans: 0,
|
||||
selected_bahan: { name: "[ Belum memilih Bahan ]" },
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_bahan: false,
|
||||
dialog_edit_form_bahan:false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
show_all:'N',
|
||||
errors:[]
|
||||
},
|
||||
mutations: {
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_show_all(state, val) {
|
||||
state.show_all = val
|
||||
},
|
||||
update_lookup_error_message(state, status) {
|
||||
state.lookup_error_message = status
|
||||
},
|
||||
update_lookup_bahan(state, status) {
|
||||
state.lookup_bahan = status
|
||||
},
|
||||
update_bahans(state, data) {
|
||||
state.bahans = data.records
|
||||
state.total_bahans = data.total
|
||||
state.total_filter_bahans = data.total_filter
|
||||
},
|
||||
update_selected_bahan(state, val) {
|
||||
state.selected_bahan = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_bahan(state, val) {
|
||||
state.dialog_form_bahan = val
|
||||
},
|
||||
update_dialog_edit_form_bahan(state, val) {
|
||||
state.dialog_edit_form_bahan = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
}
|
||||
|
||||
},
|
||||
actions: {
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_lookup_bahan", 1)
|
||||
try {
|
||||
let resp = await api.lookup(one_token(), prm.search, prm.all)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_bahan", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_bahan", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_bahans", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_bahan", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("update_error_name", false)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("update_errors",[])
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_bahan", false)
|
||||
var msg = "Bahan " + prm.name + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookup", { search: "" , all:context.show_all})
|
||||
}else{
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async update(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("update_error_name", false)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.update(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("update_error_name", false)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_bahan", false)
|
||||
var msg = "Bahan " + prm.name + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookup", { search: "" , all:context.show_all})
|
||||
}else{
|
||||
if(resp.data.errorcode === 'Y'){
|
||||
context.commit("update_error_code", true)
|
||||
}
|
||||
if(resp.data.errorname === 'Y'){
|
||||
context.commit("update_error_name", true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(),prm.bahanid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_alert_success", true)
|
||||
|
||||
var msg = "Schedule " + prm.bahanname + " sudah dihapus dong"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_selected_bahan", {})
|
||||
context.dispatch("lookup", { search: "" })
|
||||
context.commit("sampletype/update_bahan_sampletype", [], { root: true })
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
test/vuex/one-dashboard/modules/sampletype.js
Normal file
120
test/vuex/one-dashboard/modules/sampletype.js
Normal file
@@ -0,0 +1,120 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/sampletype.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
sampletypes: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_sampletype: false,
|
||||
lookup_sampletype: 0,
|
||||
errors:[]
|
||||
},
|
||||
mutations: {
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_sampletypes(state, data) {
|
||||
state.sampletypes = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_sampletype(state, val) {
|
||||
state.dialog_form_sampletype = val
|
||||
console.log(state.dialog_form_schedule_promise)
|
||||
},
|
||||
update_lookup_sampletype(state, val) {
|
||||
state.lookup_sampletype = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("update_error_name", false)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("bahan/update_save_status", 3, { root: true })
|
||||
context.commit("bahan/update_save_error_message", resp.message, { root: true })
|
||||
} else {
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if(data.total !== -1){
|
||||
context.commit("bahan/update_save_status", 2, { root: true })
|
||||
context.commit("bahan/update_save_error_message", resp.message, { root: true })
|
||||
context.commit("bahan/update_alert_success", true, { root: true })
|
||||
|
||||
context.commit("update_dialog_form_sampletype", false)
|
||||
var msg = "Bahan " + prm.bahanname + " sudah update dong"
|
||||
context.commit("bahan/update_msg_success", msg, { root: true })
|
||||
context.commit("bahan/update_alert_success", true, { root: true })
|
||||
context.dispatch("lookup", {
|
||||
id: prm.bahanid
|
||||
})
|
||||
}else{
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_lookup_sampletype", 1)
|
||||
try {
|
||||
let resp = await api.lookup(one_token(),prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_sampletype", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_sampletype", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_sampletypes", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_sampletype", 3)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(),prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("bahan/update_save_status", 3, { root: true })
|
||||
context.commit("bahan/update_save_error_message", resp.message, { root: true })
|
||||
} else {
|
||||
context.commit("bahan/update_save_status", 2, { root: true })
|
||||
context.commit("bahan/update_save_error_message", resp.message, { root: true })
|
||||
context.commit("bahan/update_alert_success", true, { root: true })
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Sampletype "+prm.name+" dari bahan " + prm.bahanname + " sudah dihapus dong"
|
||||
context.commit("bahan/update_msg_success", msg, { root: true })
|
||||
context.commit("bahan/update_alert_success", true, { root: true })
|
||||
context.dispatch("lookup", {
|
||||
id: prm.bahanid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
0
test/vuex/one-dashboard/mutation.js
Normal file
0
test/vuex/one-dashboard/mutation.js
Normal file
23
test/vuex/one-dashboard/store.js
Normal file
23
test/vuex/one-dashboard/store.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import bahan from "./modules/bahan.js";
|
||||
import sampletype from "./modules/sampletype.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
bahan: bahan,
|
||||
sampletype: sampletype
|
||||
},
|
||||
state: {
|
||||
|
||||
},
|
||||
mutations: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user