Flatten nested repos
This commit is contained in:
203
test/vuex/one-md-form/Formnumber.php
Normal file
203
test/vuex/one-md-form/Formnumber.php
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
class Formnumber extends MY_Controller
|
||||
{
|
||||
var $db_antrione;
|
||||
public function index()
|
||||
{
|
||||
echo "SERVICE API";
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db_smartone = $this->load->database("onedev", true);
|
||||
}
|
||||
|
||||
public function loadx()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
/*if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}*/
|
||||
|
||||
$prm = $this->sys_input;
|
||||
$sql = "select COUNT(*) as total
|
||||
from m_no_form
|
||||
where
|
||||
M_No_FormIsActive = 'Y'";
|
||||
$sql_param = array($search);
|
||||
$total = $this->db_smartone->query($sql,$sql_param)->row()->total;
|
||||
|
||||
|
||||
$sql = "select *
|
||||
from m_no_form
|
||||
where
|
||||
M_No_FormIsActive = 'Y'";
|
||||
$sql_param = array($search);
|
||||
$query = $this->db_smartone->query($sql,$sql_param);
|
||||
//echo $this->db_antrione->last_query();
|
||||
if ($query) {
|
||||
$rows = $query->result_array();
|
||||
|
||||
} else {
|
||||
$this->sys_error_db("m_schedule select");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = array ("total" => $total, "total_filter"=>count($rows),"records" => $rows,
|
||||
"ownIP" => $_SERVER["REMOTE_ADDR"] );
|
||||
$this->sys_ok($result);
|
||||
|
||||
} catch(Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
/*if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}*/
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
$code = $prm['code'];
|
||||
$no = $prm['no'];
|
||||
$note = $prm['note'];
|
||||
|
||||
$query = "SELECT COUNT(*) as exist
|
||||
FROM m_no_form
|
||||
WHERE M_No_FormIsActive = 'Y' AND M_No_FormName = '{$code}'";
|
||||
$exist_code = $this->db_smartone->query($query)->row()->exist;
|
||||
|
||||
if($exist_code == 0){
|
||||
$sql = "insert into m_no_form(
|
||||
M_No_FormName,
|
||||
M_No_FormRev,
|
||||
M_No_FormNote
|
||||
)
|
||||
values( ?,?,?)";
|
||||
$query = $this->db_smartone->query($sql,
|
||||
array(
|
||||
$code,
|
||||
$no,
|
||||
$note
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_no_form insert");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = array ("total" => 1, "records" => array("xid" => 0));
|
||||
$this->sys_ok($result);
|
||||
}else{
|
||||
$result = array ("total" => -1, "records" => 0);
|
||||
$this->sys_ok($result);
|
||||
}
|
||||
|
||||
} catch(Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
/*if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}*/
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
$id = $prm['id'];
|
||||
$code = $prm['code'];
|
||||
$no = $prm['no'];
|
||||
$note = $prm['note'];
|
||||
|
||||
$query = "SELECT COUNT(*) as exist FROM m_no_form WHERE M_No_FormIsActive = 'Y' AND M_No_FormName = '{$code}' AND M_No_FormID <> {$id}";
|
||||
//echo $query;
|
||||
$exist_code = $this->db_smartone->query($query)->row()->exist;
|
||||
|
||||
if($exist_code == 0){
|
||||
$sql = "update m_no_form set
|
||||
M_No_FormName = ?,
|
||||
M_No_FormRev = ?,
|
||||
M_No_FormNote = ?
|
||||
where M_No_FormID = ?
|
||||
";
|
||||
$query = $this->db_smartone->query($sql,
|
||||
array(
|
||||
$code,
|
||||
$no,
|
||||
$note,
|
||||
$id
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_no_form update");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = array ("total" => 1, "records" => array("xid" => 0));
|
||||
$this->sys_ok($result);
|
||||
}else{
|
||||
$result = array ("total" => -1, "records" => 0);
|
||||
$this->sys_ok($result);
|
||||
}
|
||||
|
||||
} catch(Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function deletex()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
/*if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}*/
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
$id = $prm['id'];
|
||||
|
||||
$sql = "update m_no_form set
|
||||
M_No_FormIsActive = 'N'
|
||||
where M_No_FormID = ?
|
||||
";
|
||||
$query = $this->db_smartone->query($sql,
|
||||
array(
|
||||
$id
|
||||
)
|
||||
);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_no_form delete");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = array ("total" => 1, "records" => array("xid" => 0));
|
||||
$this->sys_ok($result);
|
||||
|
||||
} catch(Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
82
test/vuex/one-md-form/api/service.js
Normal file
82
test/vuex/one-md-form/api/service.js
Normal file
@@ -0,0 +1,82 @@
|
||||
// API :
|
||||
// search bank
|
||||
// paramater : query , page , rowPerPage
|
||||
const URL =
|
||||
"/one-api/mockup/masterdata/";
|
||||
|
||||
export async function loadx() {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'formnumber/loadx');
|
||||
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 + 'formnumber/save',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 + 'formnumber/update',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 deletex(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'formnumber/deletex',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
|
||||
};
|
||||
}
|
||||
}
|
||||
BIN
test/vuex/one-md-form/components/.requirementField.vue.swp
Normal file
BIN
test/vuex/one-md-form/components/.requirementField.vue.swp
Normal file
Binary file not shown.
305
test/vuex/one-md-form/components/formNumber.vue
Normal file
305
test/vuex/one-md-form/components/formNumber.vue
Normal file
@@ -0,0 +1,305 @@
|
||||
<template>
|
||||
<v-layout column fill-height>
|
||||
<template>
|
||||
|
||||
<v-dialog
|
||||
v-model="dialogdeletealert"
|
||||
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>
|
||||
{{msgalert}}
|
||||
</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="dialogdeletealert = false"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="primary"
|
||||
flat
|
||||
@click="closeDeleteAlert()"
|
||||
>
|
||||
Yakin lah
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
:color="color"
|
||||
:timeout="5000"
|
||||
:multi-line="false"
|
||||
:vertical="false"
|
||||
:top="true"
|
||||
|
||||
>
|
||||
{{msgsnackbar}}
|
||||
<v-btn
|
||||
flat
|
||||
@click="updateAlert_success(false)"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
<v-toolbar class="pa-1 mb-2" color="blue lighten-3" dark height="50px">
|
||||
<v-toolbar-title>PENOMORAN FORM</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn @click="openFormService()" icon>
|
||||
<v-icon>library_add</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
|
||||
<v-card class="pa-1 p-left-side grow" grow>
|
||||
<v-card-text class="pa-0">
|
||||
<v-layout row wrap>
|
||||
|
||||
<v-flex xs12>
|
||||
<v-data-table :headers="headers" :items="services" :loading="isLoading" hide-actions class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-align:left" v-bind:class="{'amber lighten-4':props.item.selected}">{{ props.item.M_No_FormName }}</td>
|
||||
<td style="text-align:left" v-bind:class="{'amber lighten-4':props.item.selected}">{{ props.item.M_No_FormRev }}</td>
|
||||
<td style="text-align:left" v-bind:class="{'amber lighten-4':props.item.selected}">{{ props.item.M_No_FormNote }}</td>
|
||||
<td style="text-align:center" class="justify-center layout px-0">
|
||||
<v-icon color="primary" small class="mr-2" @click="editService(props.item)" > edit </v-icon>
|
||||
<v-icon color="error" small @click="deleteService(props.item)" > delete </v-icon>
|
||||
</td>
|
||||
</template>
|
||||
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
|
||||
|
||||
<template>
|
||||
<v-layout row justify-center>
|
||||
<v-dialog v-model="xdialogservice" persistent max-width="600px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">Form </span>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-form
|
||||
ref="formservice"
|
||||
v-model="validservice"
|
||||
lazy-validation
|
||||
>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="formname" label="Kode" :rules="formnameRules" required></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex>
|
||||
<p class="error pl-2 pr-2" style="color:#fff" v-if="xerrorcode === true">Udah ada dong kode yang sama</p>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="noform" label="Nama" :rules="noformRules" required></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="note" label="Keterangan" ></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" flat @click="updateDialogService()">Tutup</v-btn>
|
||||
<v-btn v-if="xactservice === 'new'" color="blue darken-1" flat @click="saveFormService()">Simpan</v-btn>
|
||||
<v-btn v-if="xactservice === 'edit'" color="blue darken-1" flat @click="updateFormService()">Simpan Perubahan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-layout>
|
||||
</template>
|
||||
</v-layout>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
table.v-table tbody td,table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
'one-dialog-info':httpVueLoader('../../common/oneDialogInfo.vue'),
|
||||
'one-dialog-alert':httpVueLoader('../../common/oneDialogAlert.vue')
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("service/loadx")
|
||||
},
|
||||
methods : {
|
||||
isSelected(p) {
|
||||
return p.serviceID == this.$store.state.service.selected_service.serviceID
|
||||
},
|
||||
selectMe(val) {
|
||||
|
||||
},
|
||||
updateDialogService(){
|
||||
this.$store.commit("service/update_dialog_service",false)
|
||||
},
|
||||
openFormService(){
|
||||
this.note = 1
|
||||
this.$store.commit("service/update_dialog_service",true)
|
||||
},
|
||||
saveFormService(){
|
||||
if (this.$refs.formservice.validate()) {
|
||||
this.$store.dispatch("service/save",{
|
||||
code:this.formname,
|
||||
no:this.noform,
|
||||
note:this.note
|
||||
})
|
||||
}
|
||||
},
|
||||
editService(data){
|
||||
this.xid = data.M_No_FormID
|
||||
this.formname = data.M_No_FormName
|
||||
this.noform = data.M_No_FormRev
|
||||
this.note = data.M_No_FormNote
|
||||
this.$store.commit("service/update_act",'edit')
|
||||
this.$store.commit("service/update_error_code",false)
|
||||
this.$store.commit("service/update_dialog_service",true)
|
||||
},
|
||||
updateFormService(){
|
||||
if (this.$refs.formservice.validate()) {
|
||||
this.$store.dispatch("service/update",{
|
||||
id:this.xid,
|
||||
code:this.formname,
|
||||
no:this.noform,
|
||||
note:this.note
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
deleteService(data){
|
||||
this.xid = data.M_No_FormID
|
||||
this.msgalert = "Yakin, mau hapus layanan "+data.M_No_FormName+" ?"
|
||||
this.dialogdeletealert = true
|
||||
},
|
||||
closeDeleteAlert(){
|
||||
this.$store.dispatch("service/deletex",{
|
||||
id:this.xid,
|
||||
no:this.M_No_FormName
|
||||
})
|
||||
this.dialogdeletealert = false
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
xactservice(){
|
||||
return this.$store.state.service.act
|
||||
},
|
||||
xerrorcode(){
|
||||
return this.$store.state.service.error_code
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.service.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("service/update_alert_success",val)
|
||||
}
|
||||
},
|
||||
msgsnackbar(){
|
||||
return this.$store.state.service.msg_success
|
||||
},
|
||||
xdialogservice(){
|
||||
return this.$store.state.service.dialog_service
|
||||
},
|
||||
services() {
|
||||
return this.$store.state.service.services
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.service.load_status == 1
|
||||
},
|
||||
updateAlert_success(val){
|
||||
this.$store.commit("service/update_alert_success",val)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
color:"success",
|
||||
validservice:false,
|
||||
formname:'',
|
||||
noform:'',
|
||||
note:1,
|
||||
formnameRules: [
|
||||
v => !!v || 'Nama Layanan harus diisi'
|
||||
],
|
||||
noformRules: [
|
||||
v => !!v || 'Kode Layanan harus diisi'
|
||||
],
|
||||
dialogdeletealert:false,
|
||||
msgalert:"",
|
||||
xid:0,
|
||||
headers: [
|
||||
{
|
||||
text: "KODE",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NOMOR FORM",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "KETERANGAN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
86
test/vuex/one-md-form/index.php
Normal file
86
test/vuex/one-md-form/index.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<!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" >
|
||||
<br/>
|
||||
<one-navbar></one-navbar>
|
||||
<v-content class="blue lighten-5 one" >
|
||||
<v-container fluid pt-2 pb-2 pl-1 pr-1>
|
||||
<v-layout column>
|
||||
<v-flex xs12 shrink>
|
||||
<one-form></one-form>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs12>
|
||||
<!-- <v-layout> -->
|
||||
<!-- </v-layout> -->
|
||||
</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,
|
||||
data : {
|
||||
|
||||
},
|
||||
computed : {
|
||||
tab_active () {
|
||||
return store.state.tab_active
|
||||
}
|
||||
},
|
||||
el: '#app',
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-form': httpVueLoader('./components/formNumber.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.v-content.one {
|
||||
//padding:64px 0px 0px !important;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
72
test/vuex/one-md-form/modules/company.js
Normal file
72
test/vuex/one-md-form/modules/company.js
Normal file
@@ -0,0 +1,72 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/company.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search: '',
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
companies: [],
|
||||
total_company: 0,
|
||||
selected_company: {},
|
||||
selected_mou: {},
|
||||
|
||||
selected_px_tab: 'px'
|
||||
},
|
||||
mutations: {
|
||||
update_selected_px_tab(state,tab) {
|
||||
state.selected_px_tab = tab
|
||||
},
|
||||
|
||||
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
update_selected_mou(state,val) {
|
||||
state.selected_mou = val
|
||||
},
|
||||
update_search(state,val) {
|
||||
state.search=val
|
||||
},
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_companies(state,data) {
|
||||
state.companies= data.records
|
||||
state.total_company= data.total
|
||||
},
|
||||
update_selected_company(state,val) {
|
||||
console.log('company aaaaa')
|
||||
console.log('1:'+JSON.stringify(store.state.company.selected_company))
|
||||
state.selected_company=val
|
||||
console.log('2:'+JSON.stringify(store.state.company.selected_company))
|
||||
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context,prm) {
|
||||
context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.search(context.state.search)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_companies",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
175
test/vuex/one-md-form/modules/counter.js
Normal file
175
test/vuex/one-md-form/modules/counter.js
Normal file
@@ -0,0 +1,175 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/counter.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
act:'new',
|
||||
dialog_counter:false,
|
||||
error_code:false,
|
||||
load_status:0,
|
||||
load_error_message:'',
|
||||
counters: [],
|
||||
total_counter: 0,
|
||||
selected_counter: {},
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
alert_success: false,
|
||||
msg_success: ""
|
||||
},
|
||||
mutations: {
|
||||
update_act(state,val) {
|
||||
state.act = val
|
||||
},
|
||||
update_error_code(state,val) {
|
||||
state.error_code = val
|
||||
},
|
||||
update_dialog_counter(state,val) {
|
||||
state.dialog_counter = val
|
||||
},
|
||||
update_load_status(state,status) {
|
||||
state.load_status = status
|
||||
},
|
||||
update_load_error_message(state,val) {
|
||||
state.load_error_message = val
|
||||
},
|
||||
update_counters(state,data){
|
||||
state.counters = data.records
|
||||
state.total_counter = data.total
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async loadx(context) {
|
||||
context.commit("update_load_status",1)
|
||||
try {
|
||||
let resp= await api.loadx()
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status",3)
|
||||
context.commit("update_load_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_load_status",2)
|
||||
context.commit("update_load_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_display: resp.data.total_display
|
||||
}
|
||||
context.commit("update_counters",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_load_status",3)
|
||||
context.commit("update_load_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("service/update_alert_success", true, { root: true })
|
||||
context.commit("update_dialog_counter", false)
|
||||
var msg = "Counter " + prm.code + " sudah tersimpan dong ..."
|
||||
context.commit("service/update_msg_success", msg, { root: true })
|
||||
context.dispatch("loadx")
|
||||
}else{
|
||||
context.commit("update_error_code", true)
|
||||
}
|
||||
|
||||
}
|
||||
} 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)
|
||||
try {
|
||||
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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("service/update_alert_success", true, { root: true })
|
||||
context.commit("update_dialog_counter", false)
|
||||
var msg = "Counter " + prm.code + " sudah tersimpan dong ..."
|
||||
context.commit("service/update_msg_success", msg, { root: true })
|
||||
context.dispatch("loadx")
|
||||
}else{
|
||||
context.commit("update_error_code", true)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async deletex(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.deletex(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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("service/update_alert_success", true, { root: true })
|
||||
var msg = "Counter " + prm.name + " sudah dihapus dong ..."
|
||||
context.commit("service/update_msg_success", msg, { root: true })
|
||||
context.dispatch("loadx")
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
83
test/vuex/one-md-form/modules/delivery.js
Normal file
83
test/vuex/one-md-form/modules/delivery.js
Normal file
@@ -0,0 +1,83 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/delivery.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
deliveries: [],
|
||||
patient_id: 0,
|
||||
doctor_id: 0,
|
||||
order_id: 0,
|
||||
|
||||
checked_id: []
|
||||
},
|
||||
mutations: {
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_deliveries(state,data) {
|
||||
for (var i in data) {
|
||||
if (state.checked_id.indexOf(data[i].idx) > -1)
|
||||
data[i].selected = true
|
||||
else
|
||||
data[i].selected = false
|
||||
}
|
||||
|
||||
state.deliveries = data
|
||||
},
|
||||
update_deliveries_2(state) {
|
||||
for (var i in state.deliveries) {
|
||||
if (state.checked_id.indexOf(state.deliveries[i].idx) > -1)
|
||||
state.deliveries[i].selected = true
|
||||
else
|
||||
state.deliveries[i].selected = false
|
||||
}
|
||||
// state.deliveries= data
|
||||
},
|
||||
update_selected_delivery(state,val) {
|
||||
state.selected_delivery=val
|
||||
},
|
||||
update_params(state, val) {
|
||||
if (val.p_id)
|
||||
state.patient_id = val.p_id;
|
||||
if (val.o_id)
|
||||
state.order_id = val.o_id;
|
||||
if (val.d_id)
|
||||
state.doctor_id = val.d_id;
|
||||
},
|
||||
update_checked_id(state, val) {
|
||||
state.checked_id = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.search(store.state.delivery.order_id,
|
||||
store.state.delivery.patient_id,
|
||||
store.state.delivery.doctor_id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records
|
||||
}
|
||||
context.commit("update_deliveries",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
test/vuex/one-md-form/modules/doctor.js
Normal file
120
test/vuex/one-md-form/modules/doctor.js
Normal file
@@ -0,0 +1,120 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/doctor.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search : '',
|
||||
search_status: 0,
|
||||
search_error_message: "",
|
||||
doctors: [],
|
||||
total_doctor: 0,
|
||||
selected_doctor: {},
|
||||
selected_address: {},
|
||||
|
||||
doctors_pj: [],
|
||||
selected_doctor_pj : {},
|
||||
search_pj_status: 0,
|
||||
search_pj_error_message: "",
|
||||
|
||||
mounted: 0
|
||||
},
|
||||
mutations: {
|
||||
update_search(state,val) {
|
||||
state.search=val
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_doctors(state,data) {
|
||||
state.doctors = data.records
|
||||
state.total_doctor= data.total
|
||||
},
|
||||
update_selected_doctor(state,doc) {
|
||||
state.selected_doctor= doc
|
||||
|
||||
if (!doc) return
|
||||
if (doc.address.length> 0) {
|
||||
state.selected_address = doc.address[0]
|
||||
} else {
|
||||
state.selected_address = {}
|
||||
}
|
||||
},
|
||||
update_selected_address(state,addr) {
|
||||
state.selected_address = addr
|
||||
},
|
||||
update_search_pj_error_message(state,status) {
|
||||
state.search_pj_error_message = status
|
||||
},
|
||||
update_search_pj_status(state,status) {
|
||||
state.search_pj_status = status
|
||||
},
|
||||
update_doctors_pj(state,data) {
|
||||
state.doctors_pj = data.records
|
||||
let flag_found = false
|
||||
data.records.forEach(function(d) {
|
||||
if (d.M_DoctorIsDefaultPJ == 'Y' ) {
|
||||
state.selected_doctor_pj = d
|
||||
flag_found = true
|
||||
}
|
||||
})
|
||||
if (! flag_found & data.records.length > 0 ) state.selected_doctor_pj = data.records[0]
|
||||
},
|
||||
update_selected_doctor_pj(state,doc) {
|
||||
state.selected_doctor_pj = doc
|
||||
},
|
||||
|
||||
increment_mounted(state, n) {
|
||||
state.mounted = state.mounted + n;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search_pj(context) {
|
||||
context.commit("update_search_pj_status",1)
|
||||
try {
|
||||
let resp= await api.searchPj()
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_pj_status",3)
|
||||
context.commit("update_search_pj_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_pj_status",2)
|
||||
context.commit("update_search_pj_error_message","")
|
||||
let data = {
|
||||
total : resp.data.total,
|
||||
records : resp.data.records
|
||||
}
|
||||
context.commit("update_doctors_pj",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_pj_status",3)
|
||||
context.commit("update_search_pj_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.search(context.state.search)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
total : resp.data.total,
|
||||
records : resp.data.records
|
||||
}
|
||||
context.commit("update_doctors",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
test/vuex/one-md-form/modules/language.js
Normal file
51
test/vuex/one-md-form/modules/language.js
Normal file
@@ -0,0 +1,51 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/language.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
languages: [],
|
||||
selected_language: {},
|
||||
},
|
||||
mutations: {
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_languages(state,data) {
|
||||
state.languages= data.records
|
||||
if (data.records.length > 0) state.selected_language = data.records[0]
|
||||
},
|
||||
update_selected_language(state,val) {
|
||||
state.selected_language=val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.search()
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records
|
||||
}
|
||||
context.commit("update_languages",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
176
test/vuex/one-md-form/modules/numbering.js
Normal file
176
test/vuex/one-md-form/modules/numbering.js
Normal file
@@ -0,0 +1,176 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/numbering.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
act:'new',
|
||||
dialog_numbering:false,
|
||||
error_code:false,
|
||||
load_status:0,
|
||||
load_error_message:'',
|
||||
numberings: [],
|
||||
total_numbering: 0,
|
||||
selected_numbering: {},
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
alert_success: false,
|
||||
msg_success: ""
|
||||
},
|
||||
mutations: {
|
||||
update_act(state,val) {
|
||||
state.act = val
|
||||
},
|
||||
update_error_code(state,val) {
|
||||
state.error_code = val
|
||||
},
|
||||
update_dialog_numbering(state,val) {
|
||||
state.dialog_numbering = val
|
||||
},
|
||||
update_load_status(state,status) {
|
||||
state.load_status = status
|
||||
},
|
||||
update_load_error_message(state,val) {
|
||||
state.load_error_message = val
|
||||
},
|
||||
update_numberings(state,data){
|
||||
state.numberings = data.records
|
||||
state.total_numbering = data.total
|
||||
},
|
||||
update_selected_numbering(state,val) {
|
||||
state.selected_numbering = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async loadx(context) {
|
||||
context.commit("update_load_status",1)
|
||||
try {
|
||||
let resp= await api.loadx()
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status",3)
|
||||
context.commit("update_load_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_load_status",2)
|
||||
context.commit("update_load_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_display: resp.data.total_display
|
||||
}
|
||||
context.commit("update_numberings",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_load_status",3)
|
||||
context.commit("update_load_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("service/update_alert_success", true, { root: true })
|
||||
context.commit("update_dialog_numbering", false)
|
||||
var msg = "Service " + prm.prefix + " sudah tersimpan dong ..."
|
||||
context.commit("service/update_msg_success", msg, { root: true })
|
||||
context.dispatch("loadx")
|
||||
}else{
|
||||
context.commit("update_error_code", true)
|
||||
}
|
||||
|
||||
}
|
||||
} 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)
|
||||
try {
|
||||
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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("service/update_alert_success", true, { root: true })
|
||||
context.commit("update_dialog_numbering", false)
|
||||
var msg = "Service " + prm.prefix + " sudah tersimpan dong ..."
|
||||
context.commit("service/update_msg_success", msg, { root: true })
|
||||
context.dispatch("loadx")
|
||||
}else{
|
||||
context.commit("update_error_code", true)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async deletex(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.deletex(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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("service/update_alert_success", true, { root: true })
|
||||
var msg = "Service " + prm.name + " sudah dihapus dong ..."
|
||||
context.commit("service/update_msg_success", msg, { root: true })
|
||||
context.dispatch("loadx")
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
112
test/vuex/one-md-form/modules/order.js
Normal file
112
test/vuex/one-md-form/modules/order.js
Normal file
@@ -0,0 +1,112 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/order.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
catatan_fo:'',
|
||||
diagnosa:'',
|
||||
patient_note: '',
|
||||
|
||||
finish_dialog_is_active: false,
|
||||
current_order: {},
|
||||
|
||||
received_sample: 'N'
|
||||
},
|
||||
mutations: {
|
||||
update_patient_note(state,val) {
|
||||
state.patient_note=val
|
||||
},
|
||||
update_catatan_fo(state,val) {
|
||||
state.catatan_fo=val
|
||||
},
|
||||
update_diagnosa(state,val) {
|
||||
state.diagnosa=val
|
||||
},
|
||||
update_finish_dialog_is_active(state, val) {
|
||||
state.finish_dialog_is_active = val
|
||||
},
|
||||
update_current_order(state, val) {
|
||||
state.current_order = val
|
||||
},
|
||||
|
||||
update_received_sample(state, val) {
|
||||
state.received_sample = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async save(context) {
|
||||
var order_id = 0;
|
||||
var delivery = [];
|
||||
var detail = [];
|
||||
var header = {
|
||||
patient_id: context.rootState.patient.selected_patient.M_PatientID,
|
||||
age: context.rootState.patient.selected_patient.patient_age,
|
||||
sender_doctor_id: context.rootState.doctor.selected_doctor.M_DoctorID,
|
||||
sender_address_id: context.rootState.doctor.selected_address.M_DoctorAddressID,
|
||||
pj_doctor_id: context.rootState.doctor.selected_doctor_pj.M_DoctorID,
|
||||
lang_id: context.rootState.language.selected_language.id,
|
||||
doctor_note: "",
|
||||
fo_note: "",
|
||||
company_id: context.rootState.company.selected_company.M_CompanyID,
|
||||
mou_id: context.rootState.company.selected_mou.M_MouID,
|
||||
received_sample: context.rootState.order.received_sample
|
||||
};
|
||||
|
||||
let dlv = context.rootState.delivery.deliveries
|
||||
for (var i in dlv) {
|
||||
if (dlv[i].selected == true) {
|
||||
let e = dlv[i].idx.split('-')
|
||||
delivery.push({
|
||||
delivery_id:e[0],
|
||||
delivery_type_id:e[1],
|
||||
address_id:e[2],
|
||||
note:dlv[i].note
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var px_tmp = [];
|
||||
var st = context.rootState.px.selected_test;
|
||||
for (var i in st) {
|
||||
px_tmp.push({
|
||||
t_id: st[i]['T_PriceID'],
|
||||
t_price: st[i]['T_PriceAmount'],
|
||||
t_disc: st[i]['T_PriceDisc'],
|
||||
t_discrp: st[i]['T_PriceDiscRp'],
|
||||
t_cito: st[i]['T_TestIsCito']
|
||||
})
|
||||
}
|
||||
|
||||
detail = px_tmp;
|
||||
|
||||
console.log(header);
|
||||
console.log(delivery)
|
||||
|
||||
// context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.save(0, header, delivery, detail)
|
||||
|
||||
if (resp.status != "200") {
|
||||
// context.commit("update_search_status",3)
|
||||
// context.commit("update_search_error_message",resp.message)
|
||||
alert('error')
|
||||
} else {
|
||||
|
||||
context.commit("update_current_order", resp.data.data)
|
||||
context.commit('update_finish_dialog_is_active', true)
|
||||
|
||||
context.commit('payment/update_order_id', resp.data.data.id, {root:true})
|
||||
context.dispatch('payment/get_order', resp.data.data.id, {root:true})
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
// context.commit("update_search_status",3)
|
||||
// context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
82
test/vuex/one-md-form/modules/patient.js
Normal file
82
test/vuex/one-md-form/modules/patient.js
Normal file
@@ -0,0 +1,82 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patient.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
noreg:'',
|
||||
search: '',
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
total_display: 0,
|
||||
selected_patient: {},
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
update_noreg(state,val) {
|
||||
state.noreg=val
|
||||
},
|
||||
update_search(state,val) {
|
||||
state.search=val
|
||||
},
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_patients(state,data) {
|
||||
state.patients= data.records
|
||||
state.total_patient = data.total
|
||||
state.total_display = data.total_display
|
||||
},
|
||||
update_selected_patient(state,val) {
|
||||
var now = moment(new Date())
|
||||
var dob = moment(new Date(val.M_PatientDOB))
|
||||
var year = now.diff(dob,'years')
|
||||
dob.add(year,'years')
|
||||
var month = now.diff(dob,'months')
|
||||
dob.add(month,'months')
|
||||
var day = now.diff(dob,'days')
|
||||
if (isNaN(year)) val.patient_age = ''
|
||||
else val.patient_age = `${year} tahun ${month} bulan ${day} hari`
|
||||
|
||||
state.selected_patient=val
|
||||
// store.state.patientaddress.patient_id = val.M_PatientID
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context,prm) {
|
||||
context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.search(context.state.noreg,context.state.search)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_display: resp.data.total_display
|
||||
}
|
||||
context.commit("update_patients",data)
|
||||
|
||||
// commit("patientaddress/test", "X", { root: true })
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
86
test/vuex/one-md-form/modules/patientaddress.js
Normal file
86
test/vuex/one-md-form/modules/patientaddress.js
Normal file
@@ -0,0 +1,86 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patientaddress.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
noreg:'',
|
||||
search: '',
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
total_display: 0,
|
||||
selected_patient: {},
|
||||
|
||||
address: [],
|
||||
patient_id: 0
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
update_noreg(state,val) {
|
||||
state.noreg=val
|
||||
},
|
||||
update_search(state,val) {
|
||||
state.search=val
|
||||
},
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_patients(state,data) {
|
||||
state.patients= data.records
|
||||
state.total_patient = data.total
|
||||
state.total_display = data.total_display
|
||||
},
|
||||
update_selected_patient(state,val) {
|
||||
state.selected_patient=val
|
||||
},
|
||||
|
||||
update_address(state, val) {
|
||||
state.address = val;
|
||||
},
|
||||
|
||||
testx(state, val) {
|
||||
state.patient_id = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context,prm) {
|
||||
context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.getAll(context.state.patient_id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = resp.data;
|
||||
context.commit("update_address",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async loadAddress(context, prm) {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
tests (a) {
|
||||
alert(a)
|
||||
}
|
||||
}
|
||||
}
|
||||
107
test/vuex/one-md-form/modules/payment.js
Normal file
107
test/vuex/one-md-form/modules/payment.js
Normal file
@@ -0,0 +1,107 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/payment.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id: 0,
|
||||
|
||||
selected_patient: {
|
||||
order_no: '-',
|
||||
order_date: '-',
|
||||
order_mou: '-',
|
||||
order_company: '-',
|
||||
patient_name: '-',
|
||||
patient_mr: '-',
|
||||
doctor_sender: '-',
|
||||
doctor_pj: '-'
|
||||
},
|
||||
|
||||
order_detail: [
|
||||
// { n:1, d_id:1, t_id:1, t_name:'SGOT', t_price:80000, t_disctotal:7000, t_total:73000 },
|
||||
// { n:2, d_id:2, t_id:2, t_name:'SGPT', t_price:75000, t_disctotal:8000, t_total:67000 }
|
||||
],
|
||||
|
||||
order_subtotal: 0,
|
||||
order_rounding: 0,
|
||||
order_total: 0,
|
||||
|
||||
payment_cash_amount: 0,
|
||||
payment_debit_amount: 0,
|
||||
payment_credit_amount: 0,
|
||||
|
||||
payments: []
|
||||
},
|
||||
mutations: {
|
||||
update_order (state, data) {
|
||||
state.selected_patient = data.order_header
|
||||
state.order_detail = data.order_detail
|
||||
|
||||
state.order_subtotal = data.order_header.order_subtotal
|
||||
state.order_rounding = data.order_header.order_rounding
|
||||
state.order_total = data.order_header.order_total
|
||||
},
|
||||
|
||||
update_order_id (state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_payment(state, o) {
|
||||
if (o.type == 'cash')
|
||||
state.payment_cash_amount = o.amount
|
||||
if (o.type == 'debit')
|
||||
state.payment_debit_amount = o.amount
|
||||
if (o.type == 'credit')
|
||||
state.payment_credit_amount = o.amount
|
||||
},
|
||||
|
||||
update_payments(state, o) {
|
||||
state.payments = o
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async get_order(context, prm) {
|
||||
// context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.get_order(prm)
|
||||
if (resp.status != "OK") {
|
||||
// context.commit("update_search_status",3)
|
||||
// context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
// context.commit("update_search_status",2)
|
||||
// context.commit("update_search_error_message","")
|
||||
let data = resp.data.data
|
||||
context.commit("update_order", data)
|
||||
|
||||
// commit("patientaddress/test", "X", { root: true })
|
||||
}
|
||||
} catch(e) {
|
||||
// context.commit("update_search_status",3)
|
||||
// context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async search(context, prm) {
|
||||
// context.commit("update_search_status",1)
|
||||
try {
|
||||
let resp= await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
// context.commit("update_search_status",3)
|
||||
// context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
// context.commit("update_search_status",2)
|
||||
// context.commit("update_search_error_message","")
|
||||
let data = resp.data
|
||||
context.commit("update_payments", data)
|
||||
|
||||
// commit("patientaddress/test", "X", { root: true })
|
||||
}
|
||||
} catch(e) {
|
||||
// context.commit("update_search_status",3)
|
||||
// context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
250
test/vuex/one-md-form/modules/px.js
Normal file
250
test/vuex/one-md-form/modules/px.js
Normal file
@@ -0,0 +1,250 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/px.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search: '',
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
tests: [],
|
||||
total_test: 0,
|
||||
selected_test: [],
|
||||
|
||||
search_panel: '',
|
||||
search_panel_status:0,
|
||||
panels: [],
|
||||
total_panel: 0,
|
||||
selected_panel: [],
|
||||
requirement: [],
|
||||
|
||||
cito: {test:[], panel:[]}
|
||||
},
|
||||
mutations: {
|
||||
update_requirement(state,val) {
|
||||
state.requirement = val
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
update_selected_test(state,val) {
|
||||
// if (state.cito.length > 0) {
|
||||
for (var i in val) {
|
||||
val[i]['T_TestIsCito'] = 'N'
|
||||
if (state.cito.test.indexOf(val[i]['T_TestID']) > -1)
|
||||
val[i]['T_TestIsCito'] = 'Y'
|
||||
}
|
||||
// }
|
||||
|
||||
state.selected_test = val
|
||||
},
|
||||
update_mouCompanyID(state,val) {
|
||||
state.mouCompanyID=val
|
||||
},
|
||||
update_search(state,val) {
|
||||
state.search=val
|
||||
},
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_tests(state,data) {
|
||||
state.tests= data.records
|
||||
state.total_test= data.total
|
||||
},
|
||||
update_search_panel(state,val) {
|
||||
state.search_panel=val
|
||||
},
|
||||
update_search_panel_status(state,status) {
|
||||
state.search_panel_status = status
|
||||
},
|
||||
update_panels(state,data) {
|
||||
console.log('--comit--',data)
|
||||
state.panels = data.records
|
||||
state.total_panel = data.total
|
||||
},
|
||||
update_selected_panel(state,val) {
|
||||
state.selected_panel= val
|
||||
},
|
||||
|
||||
update_cito(state, val) {
|
||||
let test = state.selected_test
|
||||
// if (val.length > 0) {
|
||||
|
||||
for (var i in test) {
|
||||
test[i]['T_TestIsCito'] = 'N'
|
||||
if (val.v.indexOf(test[i]['T_TestID']) > -1)
|
||||
test[i]['T_TestIsCito'] = 'Y'
|
||||
}
|
||||
// }
|
||||
|
||||
state.cito[val.t] = val.v
|
||||
state.selected_test = test
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
delete_px (context, test) {
|
||||
let sel = context.state.selected_test
|
||||
sel.forEach(function(t, idx) {
|
||||
if(t.T_PriceID == test.T_PriceID) {
|
||||
sel.splice(idx,1)
|
||||
}
|
||||
});
|
||||
|
||||
context.commit("update_selected_test", sel)
|
||||
let tests = context.state.tests
|
||||
if (tests == undefined ) tests = []
|
||||
tests.push(test)
|
||||
|
||||
let dt = {
|
||||
records : tests,
|
||||
total: tests.length
|
||||
}
|
||||
|
||||
context.commit("update_tests", dt)
|
||||
context.dispatch("update_req", null)
|
||||
},
|
||||
|
||||
update_req(context, px) {
|
||||
|
||||
let reqs = []
|
||||
let tests = context.state.selected_test
|
||||
tests.forEach( function(t) {
|
||||
let label = t.T_TestRequirement
|
||||
if (_.indexOf(reqs,label) == -1 ) reqs.push(label)
|
||||
})
|
||||
|
||||
let panels = context.state.selected_panel
|
||||
panels.forEach( function(p) {
|
||||
let tests = p.test
|
||||
tests.forEach( function(t) {
|
||||
let label = t.T_TestRequirement
|
||||
if (_.indexOf(reqs,label) == -1 ) reqs.push(label)
|
||||
})
|
||||
})
|
||||
|
||||
let requirement = context.state.requirement
|
||||
let flag_update_requirement = false
|
||||
if (reqs.length == 0 ) {
|
||||
requirement = []
|
||||
flag_update_requirement = true
|
||||
}
|
||||
requirement.forEach(function(r,idx) {
|
||||
if ( _.indexOf(reqs,r.label) == -1) {
|
||||
flag_update_requirement = true
|
||||
requirement.splice(idx,1)
|
||||
}
|
||||
})
|
||||
|
||||
if (flag_update_requirement) {
|
||||
context.commit('update_requirement', requirement)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
async search(context,prm) {
|
||||
context.commit("update_search_status",1)
|
||||
try {
|
||||
let mouCompanyID = 0
|
||||
if (context.rootState.company.selected_mou.M_MouID) {
|
||||
mouCompanyID = context.rootState.company.selected_mou.M_MouID
|
||||
}
|
||||
let resp= await api.search(mouCompanyID,context.state.search)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_tests",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
async panel(context,prm) {
|
||||
context.commit("update_search_panel_status",1)
|
||||
try {
|
||||
let mouCompanyID = 0
|
||||
if (context.rootState.company.selected_mou.M_MouCompanyID) {
|
||||
mouCompanyID = context.rootState.company.selected_mou.M_MouCompanyID
|
||||
}
|
||||
let resp= await api.panel(mouCompanyID,context.state.search)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_panel_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_panel_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_panels",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_panel_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async get_price(context, prm) {
|
||||
context.commit("update_search_status",1)
|
||||
try {
|
||||
|
||||
let mou_id = context.rootState.company.selected_mou.M_MouID
|
||||
let resp = await api.get_price(prm.test_id, mou_id, prm.cito)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
let x = context.state.selected_test
|
||||
for (let i in x) {
|
||||
if (x[i].T_TestID == prm.test_id) {
|
||||
if (Math.round(resp.data.test_price) == 0) {
|
||||
x[i].T_TestIsCito = "N"
|
||||
let n = context.state.cito.test.indexOf(x[i].T_TestID)
|
||||
if (n > -1)
|
||||
context.state.cito.test.splice(n, 1)
|
||||
|
||||
let tests = context.state.tests
|
||||
if (tests == undefined ) tests = []
|
||||
tests.push(x[i])
|
||||
let dt = {
|
||||
records : tests,
|
||||
total: tests.length
|
||||
}
|
||||
context.commit("update_tests", dt)
|
||||
|
||||
x.splice(i, 1);
|
||||
}
|
||||
|
||||
else {
|
||||
x[i].T_PriceAmount = resp.data.test_price
|
||||
x[i].T_PriceDisc = resp.data.test_disc
|
||||
x[i].T_PriceDiscRp = resp.data.test_discrp
|
||||
}
|
||||
}
|
||||
}
|
||||
context.commit("update_selected_test", x)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
184
test/vuex/one-md-form/modules/service.js
Normal file
184
test/vuex/one-md-form/modules/service.js
Normal file
@@ -0,0 +1,184 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/service.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
act:'new',
|
||||
dialog_service:false,
|
||||
error_code:false,
|
||||
ownIP: '',
|
||||
load_status:0,
|
||||
load_error_message:'',
|
||||
services: [],
|
||||
selected_service:{},
|
||||
total_service: 0,
|
||||
selected_service: {},
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
alert_success: false,
|
||||
msg_success: ""
|
||||
},
|
||||
mutations: {
|
||||
update_ownIP(state,val) {
|
||||
state.ownIP= val
|
||||
},
|
||||
update_act(state,val) {
|
||||
state.act = val
|
||||
},
|
||||
update_error_code(state,val) {
|
||||
state.error_code = val
|
||||
},
|
||||
update_dialog_service(state,val) {
|
||||
state.dialog_service = val
|
||||
},
|
||||
update_load_status(state,status) {
|
||||
state.load_status = status
|
||||
},
|
||||
update_load_error_message(state,val) {
|
||||
state.load_error_message = val
|
||||
},
|
||||
update_services(state,data){
|
||||
state.services = data.records
|
||||
state.total_service = data.total
|
||||
},
|
||||
update_selected_service(state,val) {
|
||||
state.selected_service = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async loadx(context) {
|
||||
context.commit("update_load_status",1)
|
||||
try {
|
||||
let resp= await api.loadx()
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status",3)
|
||||
context.commit("update_load_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_load_status",2)
|
||||
context.commit("update_load_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_display: resp.data.total_display
|
||||
}
|
||||
context.commit("update_ownIP",resp.data.ownIP)
|
||||
context.commit("update_services",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_load_status",3)
|
||||
context.commit("update_load_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_service", false)
|
||||
var msg = "Service " + prm.name + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("loadx")
|
||||
}else{
|
||||
context.commit("update_error_code", true)
|
||||
}
|
||||
|
||||
}
|
||||
} 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)
|
||||
try {
|
||||
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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_service", false)
|
||||
var msg = "Service " + prm.name + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("loadx")
|
||||
}else{
|
||||
context.commit("update_error_code", true)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async deletex(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.deletex(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)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if(data.total !== -1){
|
||||
context.commit("update_alert_success", true)
|
||||
var msg = "Service " + prm.name + " sudah dihapus dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("loadx")
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
test/vuex/one-md-form/store.js
Normal file
22
test/vuex/one-md-form/store.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import service from "./modules/service.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
|
||||
export const store = new Vuex.Store({
|
||||
state : {
|
||||
},
|
||||
|
||||
mutations : {
|
||||
|
||||
},
|
||||
|
||||
modules : {
|
||||
service: service,
|
||||
system: system
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user