Flatten nested repos
This commit is contained in:
96
test/vuex/one-md-consumable/api/consumable.js
Normal file
96
test/vuex/one-md-consumable/api/consumable.js
Normal file
@@ -0,0 +1,96 @@
|
||||
const URL = "/one-api/one_consumable/masterdata/";
|
||||
|
||||
export async function searchconsumable(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'searchconsumable', 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 addconsumable(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'addconsumable', 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 get_satuan(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'get_satuan', 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 editconsumable(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'editconsumable', 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 deleteitem(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'deleteitem', 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
|
||||
};
|
||||
}
|
||||
}
|
||||
77
test/vuex/one-md-consumable/api/satuan.js
Normal file
77
test/vuex/one-md-consumable/api/satuan.js
Normal file
@@ -0,0 +1,77 @@
|
||||
const URL = "/one-api/one_consumable/masterdata/";
|
||||
|
||||
export async function searchsatuan(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'searchsatuan', 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 addsatuan(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'addsatuan', 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 edit(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'edit', 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 deleterow(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'deleterow', 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
|
||||
};
|
||||
}
|
||||
}
|
||||
677
test/vuex/one-md-consumable/components/oneMdListConsumable.vue
Normal file
677
test/vuex/one-md-consumable/components/oneMdListConsumable.vue
Normal file
@@ -0,0 +1,677 @@
|
||||
<template>
|
||||
<v-layout>
|
||||
<!-- Alert dialog -->
|
||||
<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="deleteRow()">
|
||||
Yakin lah
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- End alert dialog -->
|
||||
<!-- ERROR DIALOG -->
|
||||
<v-dialog v-model="dialog_error" max-width="500px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span>ERROR !</span>
|
||||
<v-spacer></v-spacer>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<div class="ma-3 red--text">{{ msgError }}</div>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="primary" flat @click="dialog_error = false">Close</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- END ERROR DIALOG -->
|
||||
<!-- Snackbar -->
|
||||
<v-snackbar v-model="snackbar" :timeout="5000" :multi-line="false" :vertical="false" :top="true" :color="clr"
|
||||
:value="snackbar">
|
||||
{{ msgsnackbar }}
|
||||
<v-btn flat @click="snackbar = false"> Tutup </v-btn>
|
||||
</v-snackbar>
|
||||
<!-- End Snackbar -->
|
||||
<!-- Dialog -->
|
||||
<v-dialog v-model="dialog_form" persistent max-width="600px">
|
||||
<v-card>
|
||||
<v-form ref="formitemgroup" lazy-validation>
|
||||
<v-card-title>
|
||||
<span class="title">Form Mater Data Item</span></v-card-title
|
||||
>
|
||||
<v-divider></v-divider>
|
||||
<v-progress-linear v-if="loading_save" :indeterminate="true"
|
||||
></v-progress-linear>
|
||||
<v-card-text class="pt-0 pb-2">
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field
|
||||
v-model="xcode"
|
||||
label="Kode*"
|
||||
:error="code_error_message !== ''"
|
||||
:error-messages="code_error_message" @blur="codeValidation"
|
||||
required
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="xname"
|
||||
label="Nama*"
|
||||
:error="name_error_message !== ''"
|
||||
:error-messages="name_error_message" @blur="nameValidation"
|
||||
required
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="xqty"
|
||||
label="Default Qty*"
|
||||
:error="qty_error_message !== ''"
|
||||
:error-messages="qty_error_message" @blur="qtyValidation"
|
||||
type="number"
|
||||
required
|
||||
></v-text-field>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-select v-model="xunit" :items="vsatuan" item-text="M_SatuanName"
|
||||
:error="unit_error_message !== ''"
|
||||
:error-messages="unit_error_message" @blur="unitValidation"
|
||||
item-value="M_SatuanID" return-object label="Default Satuan*" required>
|
||||
</v-select>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row wrap>
|
||||
<!-- Default Show -->
|
||||
<v-flex xs6>
|
||||
<v-radio-group v-model="xshow">
|
||||
<template v-slot:label>
|
||||
<div>Tampilkan Otomatis*</div>
|
||||
</template>
|
||||
<v-radio value="Y">
|
||||
<template v-slot:label>
|
||||
<div>Ya</div>
|
||||
</template>
|
||||
</v-radio>
|
||||
<v-radio value="N">
|
||||
<template v-slot:label>
|
||||
<div>Tidak</div>
|
||||
</template>
|
||||
</v-radio>
|
||||
</v-radio-group>
|
||||
</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="blue darken-1" flat @click="dialog_form = false" :disabled="loading_save"
|
||||
>Tutup</v-btn
|
||||
>
|
||||
<v-btn
|
||||
v-if="xact === 'add'"
|
||||
color="blue darken-1"
|
||||
:disabled="loading_save"
|
||||
flat
|
||||
@click="saveAdd()"
|
||||
>Simpan</v-btn
|
||||
>
|
||||
<v-btn
|
||||
v-if="xact === 'edit'"
|
||||
color="blue darken-1"
|
||||
:disabled="loading_save"
|
||||
flat
|
||||
@click="saveEdit()"
|
||||
>Simpan Perubahan</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- End Dialog -->
|
||||
|
||||
<v-flex xs12>
|
||||
<v-card>
|
||||
<v-toolbar color="blue lighten-3" dark height="50px">
|
||||
<v-toolbar-title>Master Data Item</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<div>
|
||||
<v-btn icon @click="openAddForm()"><v-icon>library_add</v-icon></v-btn>
|
||||
</div>
|
||||
</v-toolbar>
|
||||
<v-layout row style="background:white;padding-top:5px;" justify-left>
|
||||
<v-flex xs4 pl-1>
|
||||
<v-text-field class="ma-1" label="Search" placeholder="Cari Kode atau Nama Item" outline
|
||||
v-model="xsearch" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<div>
|
||||
|
||||
<v-layout row class="scroll-container" style="max-height:600px;overflow: auto;">
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table :headers="headers" :items="vconsumable" :loading="isLoading" hide-actions class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.rownumber }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.M_ConsumableCode }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.M_ConsumableName }}</td>
|
||||
<td class="text-xs-center pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.M_ConsumableDefaultShow }}</td>
|
||||
<td class="text-xs-center pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.M_ConsumableDefaultQty }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.M_SatuanName }}</td>
|
||||
<td class="text-xs-center pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
small class="ml-3"
|
||||
@click="openEdit(props.item)"
|
||||
color="primary">edit
|
||||
</v-icon>
|
||||
</template>
|
||||
<span>Edit</span>
|
||||
</v-tooltip>
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
small
|
||||
class="ml-3"
|
||||
@click="confirmDelete(props.item)"
|
||||
color="error">clear
|
||||
</v-icon>
|
||||
</template>
|
||||
<span>Hapus</span>
|
||||
</v-tooltip>
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-divider></v-divider>
|
||||
<v-flex xs12 class="text-xs-left pt-3 pb-3">
|
||||
<v-pagination v-model="curr_page" :length="xtotal_page"></v-pagination>
|
||||
</v-flex>
|
||||
</div>
|
||||
|
||||
</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.v-table tbody td,
|
||||
table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.textinput {
|
||||
-webkit-transition: width 0.4s ease-in-out;
|
||||
transition: width 0.4s ease-in-out;
|
||||
background-color: white;
|
||||
background-position: 10px 10px;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 40px;
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
margin-bottom: 5px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #607d8b;
|
||||
|
||||
}
|
||||
|
||||
.textinput:focus {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.textinput:focus::-webkit-input-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.textinput:focus::-moz-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.textinput:-moz-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.boxoutline {
|
||||
color: red;
|
||||
border: 1px solid red;
|
||||
justify-content: center;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
padding-left: 10px;
|
||||
background: #ffffff;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border-radius: 1px
|
||||
}
|
||||
|
||||
.boxoutline:hover {
|
||||
background: rgba(0, 0, 0, 0.07) !important;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.boxsolid {
|
||||
color: #ffffff;
|
||||
border: 1px solid #ffffff;
|
||||
justify-content: center;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
padding-left: 10px;
|
||||
background: #f44336;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border-radius: 1px
|
||||
}
|
||||
|
||||
.boxsolid:hover {
|
||||
background: #f44336de;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.scroll-container {
|
||||
scroll-padding: 50px 0 0 50px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
/* this targets the default scrollbar (compulsory) */
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: #73baf3;
|
||||
}
|
||||
|
||||
/* the new scrollbar will have a flat appearance with the set background color */
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: #2196f3;
|
||||
}
|
||||
|
||||
/* this will style the thumb, ignoring the track */
|
||||
|
||||
::-webkit-scrollbar-button {
|
||||
background-color: #0079da;
|
||||
}
|
||||
|
||||
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
dialogdeletealert: false,
|
||||
msgalert: "",
|
||||
xid: "",
|
||||
xcode: "",
|
||||
xname: "",
|
||||
xqty: "",
|
||||
xunit: "",
|
||||
xshow: "N",
|
||||
code_error_message: "",
|
||||
name_error_message: "",
|
||||
qty_error_message: "",
|
||||
unit_error_message: "",
|
||||
clr: "success",
|
||||
headers: [{
|
||||
text: "NO",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "5%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "KODE",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "25%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "TAMPILAN OTOMATIS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "10%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "DEFAULT QTY",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "DEFAULT SATUAN",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("consumable/searchconsumable")
|
||||
this.$store.dispatch("consumable/get_satuan")
|
||||
},
|
||||
computed: {
|
||||
vconsumable() {
|
||||
return this.$store.state.consumable.consumables
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.consumable.search_status == 1
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.consumable.current_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("consumable/update_current_page", val)
|
||||
this.$store.commit("consumable/update_last_id", -1)
|
||||
this.$store.dispatch("consumable/searchconsumable")
|
||||
}
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.consumable.total_consumable
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("consumable/update_total_consumable", val)
|
||||
}
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.consumable.x_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("consumable/update_x_search", val)
|
||||
}
|
||||
},
|
||||
dialog_form: {
|
||||
get() {
|
||||
return this.$store.state.consumable.dialog_form
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("consumable/update_dialog_form", val)
|
||||
},
|
||||
},
|
||||
xact: {
|
||||
get() {
|
||||
return this.$store.state.consumable.act
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("consumable/update_act", val)
|
||||
}
|
||||
},
|
||||
loading_save: {
|
||||
get() {
|
||||
return this.$store.state.consumable.loading_save
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("consumable/update_loading_save", val)
|
||||
},
|
||||
},
|
||||
vsatuan() {
|
||||
return this.$store.state.consumable.satuans
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.consumable.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("consumable/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
msgsnackbar() {
|
||||
return this.$store.state.consumable.msg_success
|
||||
},
|
||||
dialog_error: {
|
||||
get() {
|
||||
return this.$store.state.consumable.alert_error
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("consumable/update_alert_error", val)
|
||||
},
|
||||
},
|
||||
msgError() {
|
||||
return this.$store.state.consumable.error_message
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isSelected(p) {
|
||||
return p.M_ConsumableID == this.$store.state.consumable.selected_consumable.M_ConsumableID
|
||||
},
|
||||
selectMe(selected) {
|
||||
this.$store.commit("consumable/update_selected_consumable", selected)
|
||||
this.$store.commit("consumable/update_last_id", selected.M_ConsumableID)
|
||||
},
|
||||
thr_search: _.debounce(function () {
|
||||
this.$store.dispatch("consumable/searchconsumable")
|
||||
}, 1000),
|
||||
codeValidation() {
|
||||
if (!this.xcode) {
|
||||
this.code_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xcode) {
|
||||
this.code_error_message = ""
|
||||
}
|
||||
},
|
||||
nameValidation() {
|
||||
if (!this.xname) {
|
||||
this.name_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xname) {
|
||||
this.name_error_message = ""
|
||||
}
|
||||
},
|
||||
qtyValidation() {
|
||||
if (!this.xname) {
|
||||
this.qty_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xname) {
|
||||
this.qty_error_message = ""
|
||||
}
|
||||
},
|
||||
unitValidation() {
|
||||
if (this.xunit.M_SatuanID < 1 || !this.xunit.M_SatuanID) {
|
||||
this.unit_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xunit.M_SatuanID > 0 ) {
|
||||
this.unit_error_message = ""
|
||||
}
|
||||
},
|
||||
resetAllInput() {
|
||||
this.xcode = ""
|
||||
this.xname = ""
|
||||
this.xqty = ""
|
||||
this.xunit = ""
|
||||
this.code_error_message = ""
|
||||
this.name_error_message = ""
|
||||
this.qty_error_message = ""
|
||||
this.unit_error_message = ""
|
||||
},
|
||||
resetAllError() {
|
||||
this.code_error_message = ""
|
||||
this.name_error_message = ""
|
||||
this.qty_error_message = ""
|
||||
this.unit_error_message = ""
|
||||
},
|
||||
openAddForm() {
|
||||
this.dialog_form = true
|
||||
this.$store.commit("consumable/update_act", "add")
|
||||
this.xcode = ""
|
||||
this.xname = ""
|
||||
this.xqty = ""
|
||||
this.xunit = ""
|
||||
this.resetAllInput()
|
||||
this.$store.commit("consumable/update_last_id", -1)
|
||||
},
|
||||
saveAdd() {
|
||||
this.codeValidation()
|
||||
this.nameValidation()
|
||||
this.qtyValidation()
|
||||
this.unitValidation()
|
||||
|
||||
if (this.code_error_message === "" &&
|
||||
this.name_error_message === "" &&
|
||||
this.qty_error_message === "" &&
|
||||
this.unit_error_message === "")
|
||||
{
|
||||
var prm = {
|
||||
code: this.xcode,
|
||||
name: this.xname,
|
||||
defaultQty: this.xqty,
|
||||
defaultShow: this.xshow,
|
||||
satuanId: this.xunit.M_SatuanID
|
||||
}
|
||||
this.$store.dispatch("consumable/addconsumable", prm)
|
||||
}
|
||||
},
|
||||
openEdit(data) {
|
||||
this.selectMe(data)
|
||||
this.dialog_form = true
|
||||
this.xid = data.M_ConsumableID
|
||||
this.xcode = data.M_ConsumableCode
|
||||
this.xname = data.M_ConsumableName
|
||||
this.xqty = data.M_ConsumableDefaultQty
|
||||
this.xshow = data.M_ConsumableDefaultShow
|
||||
this.xunit = {
|
||||
M_SatuanID: data.M_ConsumableDefaultM_SatuanID
|
||||
}
|
||||
this.resetAllError()
|
||||
this.$store.commit("consumable/update_act", "edit")
|
||||
this.$store.commit("consumable/update_last_id", data.M_ConsumableID)
|
||||
},
|
||||
saveEdit() {
|
||||
this.codeValidation()
|
||||
this.nameValidation()
|
||||
this.qtyValidation()
|
||||
this.unitValidation()
|
||||
if (this.code_error_message === "" &&
|
||||
this.name_error_message === "" &&
|
||||
this.qty_error_message === "" &&
|
||||
this.unit_error_message === "")
|
||||
{
|
||||
var prm = {
|
||||
id: this.xid,
|
||||
code: this.xcode,
|
||||
name: this.xname,
|
||||
defaultQty: this.xqty,
|
||||
defaultShow: this.xshow,
|
||||
satuanId: this.xunit.M_SatuanID
|
||||
}
|
||||
this.$store.dispatch("consumable/editconsumable", prm)
|
||||
}
|
||||
},
|
||||
confirmDelete(data) {
|
||||
this.dialogdeletealert = true
|
||||
this.xid = data.M_ConsumableID
|
||||
this.xname = data.M_ConsumableName
|
||||
this.msgalert = "Yakin, mau hapus " + data.M_ConsumableName + " ?"
|
||||
this.$store.commit("consumable/update_last_id", data.M_ConsumableID)
|
||||
},
|
||||
deleteRow() {
|
||||
this.$store.commit("consumable/update_last_id", -1)
|
||||
var prm = {
|
||||
id: this.xid,
|
||||
name: this.xname
|
||||
}
|
||||
this.$store.dispatch("consumable/deleteitem", prm)
|
||||
this.dialogdeletealert = false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
xsearch(val, old) {
|
||||
this.xsearch = val
|
||||
this.thr_search()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
487
test/vuex/one-md-consumable/components/oneMdListSatuan.vue
Normal file
487
test/vuex/one-md-consumable/components/oneMdListSatuan.vue
Normal file
@@ -0,0 +1,487 @@
|
||||
<template>
|
||||
<v-layout>
|
||||
<!-- Alert dialog -->
|
||||
<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="deleteRow()">
|
||||
Yakin lah
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- End alert dialog -->
|
||||
<!-- ERROR DIALOG -->
|
||||
<v-dialog v-model="dialog_error" max-width="500px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span>ERROR !</span>
|
||||
<v-spacer></v-spacer>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<div class="ma-3 red--text">{{ msgError }}</div>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="primary" flat @click="dialog_error = false">Close</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- END ERROR DIALOG -->
|
||||
<!-- Snackbar -->
|
||||
<v-snackbar v-model="snackbar" :timeout="5000" :multi-line="false" :vertical="false" :top="true" :color="clr"
|
||||
:value="snackbar">
|
||||
{{ msgsnackbar }}
|
||||
<v-btn flat @click="snackbar = false"> Tutup </v-btn>
|
||||
</v-snackbar>
|
||||
<!-- End Snackbar -->
|
||||
<!-- Form Dialog -->
|
||||
<v-dialog v-model="dialog_form" persistent width="50%">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="title">Form Satuan</span>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<v-progress-linear v-if="loading_save" :indeterminate="true"></v-progress-linear>
|
||||
<v-card-text class="pt-3 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xname" label="Nama*" :error="name_error_message !== ''"
|
||||
:error-messages="name_error_message" @blur="nameValidation" required></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="primary" flat @click="dialog_form = false" :disabled="loading_save">Tutup</v-btn>
|
||||
<v-btn v-if="xact === 'add'" color="primary" flat :disabled="loading_save"
|
||||
@click="saveAdd()">Simpan</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" color="primary" flat :disabled="loading_save" @click="saveEdit()">Simpan
|
||||
Perubahan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- End Form Dialog -->
|
||||
|
||||
<v-flex xs12>
|
||||
<v-card>
|
||||
<v-toolbar color="blue lighten-3" dark height="50px">
|
||||
<v-toolbar-title>Master Data Satuan</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<div>
|
||||
<v-btn icon @click="openAddForm()"><v-icon>library_add</v-icon></v-btn>
|
||||
</div>
|
||||
</v-toolbar>
|
||||
<v-layout row style="background:white;padding-top:5px;" justify-left>
|
||||
<v-flex pl-1 pr-1>
|
||||
<v-text-field class="xs4 ma-1" label="Search" placeholder="Cari Nama Satuan" outline
|
||||
v-model="xsearch" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<div>
|
||||
|
||||
<v-layout row class="scroll-container" style="max-height:600px;overflow: auto;">
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table :headers="headers" :items="vsatuans" :loading="isLoading" hide-actions class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.rownumber }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.M_SatuanName }}</td>
|
||||
<td class="text-xs-center pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
small class="ml-3"
|
||||
@click="openEdit(props.item)"
|
||||
color="primary">edit
|
||||
</v-icon>
|
||||
</template>
|
||||
<span>Edit</span>
|
||||
</v-tooltip>
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
small
|
||||
class="ml-3"
|
||||
@click="confirmDelete(props.item)"
|
||||
color="error">clear
|
||||
</v-icon>
|
||||
</template>
|
||||
<span>Hapus</span>
|
||||
</v-tooltip>
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-divider></v-divider>
|
||||
<v-flex xs12 class="text-xs-left pt-3 pb-3">
|
||||
<v-pagination v-model="curr_page" :length="xtotal_page"></v-pagination>
|
||||
</v-flex>
|
||||
</div>
|
||||
|
||||
</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.v-table tbody td,
|
||||
table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.textinput {
|
||||
-webkit-transition: width 0.4s ease-in-out;
|
||||
transition: width 0.4s ease-in-out;
|
||||
background-color: white;
|
||||
background-position: 10px 10px;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 40px;
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
margin-bottom: 5px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #607d8b;
|
||||
|
||||
}
|
||||
|
||||
.textinput:focus {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.textinput:focus::-webkit-input-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.textinput:focus::-moz-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.textinput:-moz-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.boxoutline {
|
||||
color: red;
|
||||
border: 1px solid red;
|
||||
justify-content: center;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
padding-left: 10px;
|
||||
background: #ffffff;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border-radius: 1px
|
||||
}
|
||||
|
||||
.boxoutline:hover {
|
||||
background: rgba(0, 0, 0, 0.07) !important;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.boxsolid {
|
||||
color: #ffffff;
|
||||
border: 1px solid #ffffff;
|
||||
justify-content: center;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
padding-left: 10px;
|
||||
background: #f44336;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border-radius: 1px
|
||||
}
|
||||
|
||||
.boxsolid:hover {
|
||||
background: #f44336de;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.scroll-container {
|
||||
scroll-padding: 50px 0 0 50px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
/* this targets the default scrollbar (compulsory) */
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: #73baf3;
|
||||
}
|
||||
|
||||
/* the new scrollbar will have a flat appearance with the set background color */
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: #2196f3;
|
||||
}
|
||||
|
||||
/* this will style the thumb, ignoring the track */
|
||||
|
||||
::-webkit-scrollbar-button {
|
||||
background-color: #0079da;
|
||||
}
|
||||
|
||||
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
xname: "",
|
||||
name_error_message: "",
|
||||
clr: "success",
|
||||
xid: "",
|
||||
msgalert: "",
|
||||
dialogdeletealert: false,
|
||||
headers: [{
|
||||
text: "NO",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "5%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("satuan/searchsatuan")
|
||||
},
|
||||
computed: {
|
||||
vsatuans() {
|
||||
return this.$store.state.satuan.satuans
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.satuan.search_status == 1
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.satuan.current_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("satuan/update_current_page", val)
|
||||
this.$store.commit("satuan/update_last_id", -1)
|
||||
this.$store.dispatch("satuan/searchsatuan")
|
||||
}
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.satuan.total_satuan
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("satuan/update_total_satuan", val)
|
||||
}
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.satuan.x_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("satuan/update_x_search", val)
|
||||
}
|
||||
},
|
||||
dialog_form: {
|
||||
get() {
|
||||
return this.$store.state.satuan.dialog_form
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("satuan/update_dialog_form", val)
|
||||
},
|
||||
},
|
||||
xact: {
|
||||
get() {
|
||||
return this.$store.state.satuan.act
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("satuan/update_act", val)
|
||||
}
|
||||
},
|
||||
loading_save: {
|
||||
get() {
|
||||
return this.$store.state.satuan.loading_save
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("satuan/update_loading_save", val)
|
||||
},
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.satuan.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("satuan/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
msgsnackbar() {
|
||||
return this.$store.state.satuan.msg_success
|
||||
},
|
||||
dialog_error: {
|
||||
get() {
|
||||
return this.$store.state.satuan.alert_error
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("satuan/update_alert_error", val)
|
||||
},
|
||||
},
|
||||
msgError() {
|
||||
return this.$store.state.satuan.error_message
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
isSelected(p) {
|
||||
return p.M_SatuanID == this.$store.state.satuan.selected_satuan.M_SatuanID
|
||||
},
|
||||
selectMe(selected) {
|
||||
this.$store.commit("satuan/update_selected_satuan", selected)
|
||||
this.$store.commit("satuan/update_last_id", selected.M_SatuanID)
|
||||
},
|
||||
thr_search: _.debounce(function () {
|
||||
this.$store.dispatch("satuan/searchsatuan")
|
||||
}, 1000),
|
||||
nameValidation() {
|
||||
if (!this.xname) {
|
||||
this.name_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xname) {
|
||||
this.name_error_message = ""
|
||||
}
|
||||
},
|
||||
resetAllInput() {
|
||||
this.xname = ""
|
||||
this.name_error_message = ""
|
||||
},
|
||||
openAddForm() {
|
||||
this.dialog_form = true
|
||||
this.$store.commit("satuan/update_act", "add")
|
||||
this.xname = ""
|
||||
this.resetAllInput()
|
||||
this.$store.commit("satuan/update_last_id", -1)
|
||||
},
|
||||
saveAdd() {
|
||||
this.nameValidation()
|
||||
if (this.name_error_message === "") {
|
||||
let prm = {
|
||||
name: this.xname
|
||||
}
|
||||
this.$store.dispatch("satuan/addsatuan", prm)
|
||||
}
|
||||
},
|
||||
openEdit(data) {
|
||||
this.selectMe(data)
|
||||
this.dialog_form = true
|
||||
this.$store.commit("satuan/update_act", "edit")
|
||||
this.xname = data.M_SatuanName
|
||||
this.xid = data.M_SatuanID
|
||||
this.name_error_message = ""
|
||||
this.$store.commit("satuan/update_last_id", data.M_SatuanID)
|
||||
},
|
||||
saveEdit() {
|
||||
this.nameValidation()
|
||||
if (this.name_error_message === "") {
|
||||
let prm = {
|
||||
id: this.xid,
|
||||
name: this.xname
|
||||
}
|
||||
this.$store.dispatch("satuan/edit", prm)
|
||||
}
|
||||
},
|
||||
confirmDelete(data) {
|
||||
this.selectMe(data)
|
||||
this.xid = data.M_SatuanID
|
||||
this.xname = data.M_SatuanName
|
||||
this.msgalert = "Yakin, mau hapus " + data.M_SatuanName + " ?"
|
||||
|
||||
this.dialogdeletealert = true
|
||||
},
|
||||
deleteRow() {
|
||||
this.$store.commit("satuan/update_last_id", -1)
|
||||
let prm = {
|
||||
id: this.xid,
|
||||
name: this.xname
|
||||
}
|
||||
this.$store.dispatch("satuan/deleterow", prm)
|
||||
this.dialogdeletealert = false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
xsearch(val, old) {
|
||||
this.xsearch = val
|
||||
this.thr_search()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
79
test/vuex/one-md-consumable/index.php
Normal file
79
test/vuex/one-md-consumable/index.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>One</title>
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp">
|
||||
<one-navbar></one-navbar>
|
||||
<v-content class="blue lighten-5">
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs4 class="left" fill-height pa-1>
|
||||
<!-- komponen kiri -->
|
||||
<one-md-satuan></one-md-satuan>
|
||||
</v-flex>
|
||||
<v-flex xs8 class="right" fill-height pa-1>
|
||||
<!-- komponen kanan -->
|
||||
<one-md-consumable></one-md-consumable>
|
||||
</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-md-satuan': httpVueLoader('./components/oneMdListSatuan.vue'),
|
||||
'one-md-consumable': httpVueLoader('./components/oneMdListConsumable.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
|
||||
.left {}
|
||||
|
||||
.right {}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
233
test/vuex/one-md-consumable/modules/consumable.js
Normal file
233
test/vuex/one-md-consumable/modules/consumable.js
Normal file
@@ -0,0 +1,233 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/consumable.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
consumables: [],
|
||||
total_consumable: 0,
|
||||
search_status: 0,
|
||||
selected_consumable: {},
|
||||
current_page: 1,
|
||||
last_id: -1,
|
||||
x_search: "",
|
||||
save_status: 2,
|
||||
loading_save: false,
|
||||
error_message: "",
|
||||
alert_error: false,
|
||||
dialog_error: false,
|
||||
msg_success: "",
|
||||
alert_success: false,
|
||||
dialog_form: false,
|
||||
act: "",
|
||||
satuans: []
|
||||
},
|
||||
mutations: {
|
||||
update_consumables(state, val) {
|
||||
state.consumables = val
|
||||
},
|
||||
update_total_consumable(state, val) {
|
||||
state.total_consumable = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_selected_consumable(state, val) {
|
||||
state.selected_consumable = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_loading_save(state, val) {
|
||||
state.loading_save = val
|
||||
},
|
||||
update_error_message(state, val) {
|
||||
state.error_message = val
|
||||
},
|
||||
update_alert_error(state, val) {
|
||||
state.alert_error = val
|
||||
},
|
||||
update_dialog_error(state, val) {
|
||||
state.dialog_error = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_dialog_form(state, val) {
|
||||
state.dialog_form = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_satuans(state, val) {
|
||||
state.satuans = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async searchconsumable(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
var prm = {
|
||||
token: one_token(),
|
||||
search: context.state.x_search,
|
||||
current_page: context.state.current_page
|
||||
}
|
||||
let resp = await api.searchconsumable(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_display
|
||||
}
|
||||
context.commit("update_consumables", data.records)
|
||||
context.commit("update_total_consumable", data.total)
|
||||
if (
|
||||
!(
|
||||
Object.keys(context.state.selected_consumable).length === 0 &&
|
||||
context.state.selected_consumable.constructor === Object
|
||||
)
|
||||
){
|
||||
let idx = _.findIndex(resp.data.records, function (o) {
|
||||
return o.M_ConsumableID == context.state.selected_consumable.M_ConsumableID
|
||||
});
|
||||
if (idx >= 0) {
|
||||
context.commit("update_selected_consumable", resp.data.records[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
}
|
||||
},
|
||||
|
||||
async addconsumable(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
context.commit("update_loading_save", true)
|
||||
prm.token = one_token()
|
||||
let resp = await api.addconsumable(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
context.commit("update_dialog_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", "")
|
||||
context.commit("update_dialog_error", false)
|
||||
context.commit("update_dialog_form", false)
|
||||
let data = resp.data
|
||||
var msg = "Item " + prm.name + " berhasil di simpan"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.dispatch("searchconsumable")
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
async get_satuan(context) {
|
||||
try {
|
||||
var prm = { token: one_token() }
|
||||
let resp = await api.get_satuan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
context.commit("update_satuans", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async editconsumable(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
context.commit("update_loading_save", true)
|
||||
prm.token = one_token()
|
||||
let resp = await api.editconsumable(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
context.commit("update_dialog_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", "")
|
||||
context.commit("update_dialog_error", false)
|
||||
context.commit("update_dialog_form", false)
|
||||
let data = resp.data
|
||||
var msg = "Item " + prm.name + " berhasil di edit"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.dispatch("searchconsumable")
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
async deleteitem(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
context.commit("update_loading_save", true)
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteitem(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
context.commit("update_dialog_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", "")
|
||||
context.commit("update_dialog_error", false)
|
||||
let data = resp.data
|
||||
var msg = "Item " + prm.name + " berhasil di hapus"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.dispatch("searchconsumable")
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
211
test/vuex/one-md-consumable/modules/satuan.js
Normal file
211
test/vuex/one-md-consumable/modules/satuan.js
Normal file
@@ -0,0 +1,211 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/satuan.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
satuans: [],
|
||||
total_satuan: 0,
|
||||
selected_satuan: {},
|
||||
search_status: 0,
|
||||
last_id: -1,
|
||||
x_search: "",
|
||||
current_page: 1,
|
||||
save_status: 2,
|
||||
loading_save: false,
|
||||
error_message: "",
|
||||
alert_error: false,
|
||||
dialog_error: false,
|
||||
msg_success: "",
|
||||
alert_success: false,
|
||||
act: "add",
|
||||
dialog_form: false
|
||||
},
|
||||
mutations: {
|
||||
update_satuans(state, val) {
|
||||
state.satuans = val
|
||||
},
|
||||
update_total_satuan(state, val) {
|
||||
state.total_satuan = val
|
||||
},
|
||||
update_selected_satuan(state, val) {
|
||||
state.selected_satuan = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
state.current_page = 1
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_loading_save(state, val) {
|
||||
state.loading_save = val
|
||||
},
|
||||
update_error_message(state, val) {
|
||||
state.error_message = val
|
||||
},
|
||||
update_alert_error(state, val) {
|
||||
state.alert_error = val
|
||||
},
|
||||
update_dialog_error(state, val) {
|
||||
state.dialog_error = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_dialog_form(state, val) {
|
||||
state.dialog_form = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async searchsatuan(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
var prm = {
|
||||
token: one_token(),
|
||||
search: context.state.x_search,
|
||||
current_page: context.state.current_page
|
||||
}
|
||||
let resp = await api.searchsatuan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total_page: resp.data.total_page,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_satuans", data.records)
|
||||
context.commit("update_total_satuan", data.total_page)
|
||||
if (
|
||||
!(
|
||||
Object.keys(context.state.selected_satuan).length === 0 &&
|
||||
context.state.selected_satuan.constructor === Object
|
||||
)
|
||||
){
|
||||
let idx = _.findIndex(resp.data.records, function (o) {
|
||||
return o.M_SatuanID == context.state.selected_satuan.M_SatuanID
|
||||
});
|
||||
if (idx >= 0) {
|
||||
context.commit("update_selected_satuan", resp.data.records[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
}
|
||||
},
|
||||
|
||||
async addsatuan(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
context.commit("update_loading_save", true)
|
||||
prm.token = one_token()
|
||||
let resp = await api.addsatuan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
context.commit("update_dialog_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", "")
|
||||
context.commit("update_dialog_error", false)
|
||||
context.commit("update_dialog_form", false)
|
||||
let data = resp.data
|
||||
var msg = "Satuan " + prm.name + " berhasil disimpan"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.dispatch("searchsatuan")
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
async edit(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
context.commit("update_loading_save", true)
|
||||
prm.token = one_token()
|
||||
let resp = await api.edit(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
context.commit("update_dialog_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", "")
|
||||
context.commit("update_dialog_error", false)
|
||||
context.commit("update_dialog_form", false)
|
||||
var msg = "Satuan " + prm.name + " berhasil di edit"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.dispatch("searchsatuan")
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
context.commit("update_dialog_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
async deleterow(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
context.commit("update_loading_save", true)
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleterow(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
context.commit("update_dialog_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", "")
|
||||
context.commit("update_dialog_error", false)
|
||||
context.commit("update_dialog_form", false)
|
||||
var msg = prm.name + " berhasil dihapus"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.dispatch("searchsatuan")
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
context.commit("update_dialog_error", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
test/vuex/one-md-consumable/store.js
Normal file
25
test/vuex/one-md-consumable/store.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import satuan from "./modules/satuan.js";
|
||||
import consumable from "./modules/consumable.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
satuan: satuan,
|
||||
consumable: consumable,
|
||||
system:system
|
||||
},
|
||||
state: {
|
||||
|
||||
},
|
||||
mutations: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user