Flatten nested repos
This commit is contained in:
552
test/vuex/one-md-report/components/oneMdReportGroup.vue
Normal file
552
test/vuex/one-md-report/components/oneMdReportGroup.vue
Normal file
@@ -0,0 +1,552 @@
|
||||
<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 v-if="this.$store.state.reports.reportss.length <= 0" 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 Report Group</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-0">
|
||||
<v-layout row 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-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xnama" label="Nama*" :error="nama_error_message !== ''"
|
||||
:error-messages="nama_error_message" @blur="namaValidation" required></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xcolor" label="Color*" :error="color_error_message !== ''"
|
||||
:error-messages="color_error_message" @blur="colorValidation" 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>REPORT GROUP</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-text-field class=" xs4 ma-1" label="Cari" placeholder="Ketikkan Kode atau Nama Group" outline
|
||||
v-model="xsearch" hide-details></v-text-field>
|
||||
</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="vreportgroup" :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.R_ReportGroupCode }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.R_ReportGroupName }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon small @click="openEdit(props.item)" color="primary">
|
||||
edit</v-icon>
|
||||
<v-icon class="ml-3" small @click="confirmDelete(props.item)"
|
||||
color="red">clear</v-icon>
|
||||
</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 {
|
||||
xcode: "",
|
||||
xnama: "",
|
||||
xcolor: "",
|
||||
code_error_message: "",
|
||||
nama_error_message: "",
|
||||
color_error_message: "",
|
||||
clr: "success",
|
||||
xid: "",
|
||||
msgalert: "",
|
||||
dialogdeletealert: false,
|
||||
nama: "",
|
||||
headers: [{
|
||||
text: "KODE",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA GROUP",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "10%",
|
||||
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("reportgroup/searchgroup")
|
||||
},
|
||||
computed: {
|
||||
vreportgroup() {
|
||||
return this.$store.state.reportgroup.reportgroups
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.reportgroup.search_status
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.current_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportgroup/update_current_page", val)
|
||||
this.$store.commit("reportgroup/update_last_id", -1)
|
||||
this.$store.dispatch("reportgroup/searchgroup")
|
||||
}
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.total_reportgroup
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportgroup/update_total_reportgroup", val)
|
||||
}
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.x_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportgroup/update_x_search", val)
|
||||
}
|
||||
},
|
||||
dialog_form: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.dialog_form
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportgroup/update_dialog_form", val)
|
||||
},
|
||||
},
|
||||
xact: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.act
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportgroup/update_act", val)
|
||||
}
|
||||
},
|
||||
loading_save: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.loading_save
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportgroup/update_loading_save", val)
|
||||
},
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportgroup/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
msgsnackbar() {
|
||||
return this.$store.state.reportgroup.msg_success
|
||||
},
|
||||
dialog_error: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.alert_error
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportgroup/update_alert_error", val)
|
||||
},
|
||||
},
|
||||
msgError() {
|
||||
return this.$store.state.reportgroup.error_message
|
||||
},
|
||||
selected_reportgroup: {
|
||||
get() {
|
||||
return this.$store.state.reportgroup.selected_reportgroup
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isSelected(p) {
|
||||
return p.R_ReportGroupID == this.$store.state.reportgroup.selected_reportgroup.R_ReportGroupID
|
||||
},
|
||||
selectMe(selected) {
|
||||
this.$store.commit("reportgroup/update_selected_reportgroup", selected)
|
||||
// this.$store.commit("reports/update_selected_reportgroup_id", selected.R_ReportGroupID)
|
||||
this.$store.commit("reports/update_last_id", -1)
|
||||
this.$store.commit("reportgroup/update_last_id", selected.R_ReportGroupID)
|
||||
// this.$store.commit("reportparameter/update_selected_reports_id", 0)
|
||||
},
|
||||
thr_search: _.debounce(function () {
|
||||
this.$store.dispatch("reportgroup/searchgroup")
|
||||
}, 1000),
|
||||
codeValidation() {
|
||||
if (!this.xcode) {
|
||||
this.code_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xcode) {
|
||||
this.code_error_message = ""
|
||||
}
|
||||
},
|
||||
namaValidation() {
|
||||
if (!this.xnama) {
|
||||
this.nama_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xnama) {
|
||||
this.nama_error_message = ""
|
||||
}
|
||||
},
|
||||
colorValidation() {
|
||||
if (!this.xcolor) {
|
||||
this.color_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xcolor) {
|
||||
this.color_error_message = ""
|
||||
}
|
||||
},
|
||||
resetAllInput() {
|
||||
this.xcode = ""
|
||||
this.xnama = ""
|
||||
this.xcolor = ""
|
||||
this.code_error_message = ""
|
||||
this.nama_error_message = ""
|
||||
this.color_error_message = ""
|
||||
},
|
||||
resetAllError() {
|
||||
this.code_error_message = ""
|
||||
this.nama_error_message = ""
|
||||
this.color_error_message = ""
|
||||
},
|
||||
openAddForm() {
|
||||
this.dialog_form = true
|
||||
this.$store.commit("reportgroup/update_act", "add")
|
||||
this.xcode = ""
|
||||
this.xnama = ""
|
||||
this.xcolor = ""
|
||||
this.resetAllInput()
|
||||
this.$store.commit("reportgroup/update_last_id", -1)
|
||||
},
|
||||
saveAdd() {
|
||||
this.codeValidation()
|
||||
this.namaValidation()
|
||||
this.colorValidation()
|
||||
if (
|
||||
this.code_error_message === "" &&
|
||||
this.nama_error_message === "" &&
|
||||
this.color_error_message === ""
|
||||
) {
|
||||
let prm = {
|
||||
code: this.xcode,
|
||||
name: this.xnama,
|
||||
color: this.xcolor
|
||||
}
|
||||
this.$store.dispatch("reportgroup/addgroup", prm)
|
||||
this.dialog_form = false
|
||||
}
|
||||
},
|
||||
// edit
|
||||
openEdit(data) {
|
||||
this.dialog_form = true
|
||||
this.$store.commit("reportgroup/update_act", "edit")
|
||||
this.selectMe(data)
|
||||
this.xid = data.R_ReportGroupID
|
||||
this.xcode = data.R_ReportGroupCode
|
||||
this.xnama = data.R_ReportGroupName
|
||||
this.xcolor = data.R_ReportGroupColor
|
||||
this.resetAllError()
|
||||
this.$store.commit("reportgroup/update_last_id", data.R_ReportGroupID)
|
||||
},
|
||||
saveEdit() {
|
||||
this.codeValidation()
|
||||
this.namaValidation()
|
||||
this.colorValidation()
|
||||
if (
|
||||
this.code_error_message === "" &&
|
||||
this.nama_error_message === "" &&
|
||||
this.color_error_message === ""
|
||||
) {
|
||||
let prm = {
|
||||
id: this.xid,
|
||||
code: this.xcode,
|
||||
name: this.xnama,
|
||||
color: this.xcolor
|
||||
}
|
||||
this.$store.dispatch("reportgroup/editgroup", prm)
|
||||
this.dialog_form = false
|
||||
}
|
||||
},
|
||||
// hapus
|
||||
confirmDelete(data) {
|
||||
this.selectMe(data)
|
||||
this.xid = data.R_ReportGroupID
|
||||
this.nama = data.R_ReportGroupName
|
||||
|
||||
if (this.$store.state.reports.reportss.length <= 0) {
|
||||
this.msgalert = "Yakin, mau hapus report group " + data.R_ReportGroupName + " ?"
|
||||
} else {
|
||||
this.msgalert = "Tidak bisa di hapus, masih ada reports"
|
||||
}
|
||||
|
||||
this.dialogdeletealert = true
|
||||
},
|
||||
deleteRow() {
|
||||
this.$store.commit("reportgroup/update_last_id", -1)
|
||||
let prm = {
|
||||
id: this.xid,
|
||||
name: this.nama
|
||||
}
|
||||
this.$store.dispatch("reportgroup/deletegroup", prm)
|
||||
this.dialogdeletealert = false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
xsearch(val, old) {
|
||||
this.xsearch = val
|
||||
this.thr_search()
|
||||
},
|
||||
selected_reportgroup(val, old) {
|
||||
this.$store.commit("reportgroup/update_selected_reportgroup", val)
|
||||
this.$store.commit("reportgroup/update_last_id", val.R_ReportGroupID)
|
||||
this.$store.commit("reports/update_selected_reportgroup_id", val.R_ReportGroupID)
|
||||
this.$store.commit("reportparameter/update_selected_reports_id", 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
732
test/vuex/one-md-report/components/oneMdReportParameter.vue
Normal file
732
test/vuex/one-md-report/components/oneMdReportParameter.vue
Normal file
@@ -0,0 +1,732 @@
|
||||
<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 Report Parameter</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-select v-model="xreports" :items="vreport" item-value="R_ReportID" return-object
|
||||
label="Reports*" item-text="R_ReportName" :error="error_reports_message !== ''"
|
||||
:error-messages="error_reports_message" @blur="reportsValidation" required>
|
||||
</v-select>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xnama" label="Nama*" :error="error_nama_message !== ''"
|
||||
:error-messages="error_nama_message" @blur="namaValidation" required></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xlabel" label="Label*" :error="error_label_message !== ''"
|
||||
:error-messages="error_label_message" @blur="labelValidation" required></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xparameter" label="Parameter*" :error="error_parameter_message !== ''"
|
||||
:error-messages="error_parameter_message" @blur="parameterValidation"
|
||||
required></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xsource" label="Source Sp"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xurl" label="Url"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-select v-model="xtype" :items="vgettype" item-text="R_InputTypeName" item-value="typeid"
|
||||
return-object label="Type*" :error="error_type_message !== ''"
|
||||
:error-messages="error_type_message" @blur="typeValidation" required>
|
||||
</v-select>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xpriority" label="Priority" type="number"></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>REPORT PARAMETER</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-text-field class=" xs4 ma-1" label="Cari" placeholder="Ketikkan Nama atau Parameter" outline
|
||||
v-model="xsearch" hide-details></v-text-field>
|
||||
</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="vreportparam" :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.R_ReportDetailName }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.R_ReportDetailLabel }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.R_ReportDetailParam }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.R_ReportDetailSourceSp }}</td>
|
||||
<td class="text-xs-center pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.R_InputTypeName }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon small @click="openEdit(props.item)" color="primary" dark>edit</v-icon>
|
||||
<v-icon class="ml-3" small @click="confirmDelete(props.item)" color="red"
|
||||
dark>clear</v-icon>
|
||||
</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 {
|
||||
xnama: "",
|
||||
xlabel: "",
|
||||
xparameter: "",
|
||||
xsource: "",
|
||||
xurl: "",
|
||||
xtype: 0,
|
||||
xpriority: 0,
|
||||
search_report: "",
|
||||
error_reports_message: "",
|
||||
error_nama_message: "",
|
||||
error_label_message: "",
|
||||
error_parameter_message: "",
|
||||
error_type_message: "",
|
||||
clr: "success",
|
||||
xid: "",
|
||||
msgalert: "",
|
||||
dialogdeletealert: false,
|
||||
nama: "",
|
||||
xreports: 0,
|
||||
headers: [
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "LABEL",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "PARAMETER",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "SOURCE SP",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "TYPE",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("reportparameter/get_type")
|
||||
},
|
||||
computed: {
|
||||
vreportparam() {
|
||||
return this.$store.state.reportparameter.reportparams
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.reportparameter.search_status
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.reportparameter.current_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportparameter/update_current_page", val)
|
||||
this.$store.commit("reportparameter/update_last_id", -1)
|
||||
this.$store.dispatch("reportparameter/searchparam")
|
||||
}
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.reportparameter.total_reportparam
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportparameter/update_total_reportparam", val)
|
||||
}
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.reportparameter.x_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportparameter/update_x_search", val)
|
||||
}
|
||||
},
|
||||
dialog_form: {
|
||||
get() {
|
||||
return this.$store.state.reportparameter.dialog_form
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportparameter/update_dialog_form", val)
|
||||
},
|
||||
},
|
||||
xact: {
|
||||
get() {
|
||||
return this.$store.state.reportparameter.act
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportparameter/update_act", val)
|
||||
}
|
||||
},
|
||||
loading_save: {
|
||||
get() {
|
||||
return this.$store.state.reportparameter.loading_save
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportparameter/update_loading_save", val)
|
||||
},
|
||||
},
|
||||
|
||||
// dropdown reports
|
||||
vreport() {
|
||||
return this.$store.state.reportparameter.reports
|
||||
},
|
||||
vreportx() {
|
||||
return this.$store.state.reports.selected_reports
|
||||
},
|
||||
// xreports: {
|
||||
// get() {
|
||||
// return this.$store.state.reportparameter.report
|
||||
// },
|
||||
// set(val) {
|
||||
// this.$store.commit("reportparameter/update_report", val)
|
||||
// }
|
||||
// },
|
||||
vgettype() {
|
||||
return this.$store.state.reportparameter.types
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.reportparameter.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportparameter/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
msgsnackbar() {
|
||||
return this.$store.state.reportparameter.msg_success
|
||||
},
|
||||
dialog_error: {
|
||||
get() {
|
||||
return this.$store.state.reportparameter.alert_error
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reportparameter/update_alert_error", val)
|
||||
},
|
||||
},
|
||||
msgError() {
|
||||
return this.$store.state.reportparameter.error_message
|
||||
},
|
||||
xreport() {
|
||||
return this.$store.state.reports.selected_reports
|
||||
},
|
||||
selected_reports_id() {
|
||||
return this.$store.state.reportparameter.selected_reports_id
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isSelected(p) {
|
||||
return p.R_ReportDetailID == this.$store.state.reportparameter.selected_reportparam.R_ReportDetailID
|
||||
},
|
||||
selectMe(selected) {
|
||||
this.$store.commit("reportparameter/update_selected_reportparam", selected)
|
||||
this.$store.commit("reportparameter/update_last_id", selected.R_ReportDetailID)
|
||||
this.$store.commit("reportparameter/update_selected_reports_id", selected.R_ReportID)
|
||||
|
||||
// set value selected reports
|
||||
// this.$store.commit("reportparameter/update_reports", [
|
||||
// {
|
||||
// R_ReportID: selected.R_ReportID,
|
||||
// R_ReportName: selected.R_ReportName
|
||||
// }
|
||||
// ])
|
||||
|
||||
// this.$store.commit("reportparameter/update_report", {
|
||||
// R_ReportID: selected.R_ReportID,
|
||||
// R_ReportName: selected.R_ReportName
|
||||
// })
|
||||
},
|
||||
thr_search: _.debounce(function () {
|
||||
this.$store.dispatch("reportparameter/searchparam")
|
||||
}, 1000),
|
||||
// dropdown report
|
||||
thr_search_report: _.debounce(function () {
|
||||
this.$store.dispatch("reportparameter/get_reports")
|
||||
}, 2000),
|
||||
reportsValidation() {
|
||||
if (_.isEmpty(this.xreports)) {
|
||||
this.error_reports_message = 'Anda belum mengisi'
|
||||
}
|
||||
if (this.xreports) {
|
||||
this.error_reports_message = ""
|
||||
}
|
||||
},
|
||||
namaValidation() {
|
||||
if (_.isEmpty(this.xnama)) {
|
||||
this.error_nama_message = 'Anda belum mengisi'
|
||||
}
|
||||
if (this.xnama) {
|
||||
this.error_nama_message = ""
|
||||
}
|
||||
},
|
||||
labelValidation() {
|
||||
if (_.isEmpty(this.xlabel)) {
|
||||
this.error_label_message = 'Anda belum mengisi'
|
||||
}
|
||||
if (this.xlabel) {
|
||||
this.error_label_message = ""
|
||||
}
|
||||
},
|
||||
parameterValidation() {
|
||||
if (_.isEmpty(this.xparameter)) {
|
||||
this.error_parameter_message = 'Anda belum mengisi'
|
||||
}
|
||||
if (this.xparameter) {
|
||||
this.error_parameter_message = ""
|
||||
}
|
||||
},
|
||||
typeValidation() {
|
||||
if (_.isEmpty(this.xtype)) {
|
||||
this.error_type_message = 'Anda belum mengisi'
|
||||
}
|
||||
if (this.xtype) {
|
||||
this.error_type_message = ""
|
||||
}
|
||||
},
|
||||
resetAllinput() {
|
||||
this.xreports = ""
|
||||
this.xnama = ""
|
||||
this.xlabel = ""
|
||||
this.xparameter = ""
|
||||
this.xsource = ""
|
||||
this.xurl = ""
|
||||
this.xtype = ""
|
||||
this.xpriority = ""
|
||||
this.error_reports_message = ""
|
||||
this.error_nama_message = ""
|
||||
this.error_label_message = ""
|
||||
this.error_parameter_message = ""
|
||||
this.error_type_message = ""
|
||||
},
|
||||
resetAllError() {
|
||||
this.error_reports_message = ""
|
||||
this.error_nama_message = ""
|
||||
this.error_label_message = ""
|
||||
this.error_parameter_message = ""
|
||||
this.error_type_message = ""
|
||||
},
|
||||
// add
|
||||
openAddForm() {
|
||||
this.$store.commit("reportparameter/update_act", "add")
|
||||
this.xreports = ""
|
||||
this.xnama = ""
|
||||
this.xlabel = ""
|
||||
this.xparameter = ""
|
||||
this.xsource = ""
|
||||
this.xurl = ""
|
||||
this.xtype = ""
|
||||
this.xpriority = ""
|
||||
this.resetAllinput()
|
||||
this.$store.commit("reportparameter/update_last_id", -1)
|
||||
this.dialog_form = true
|
||||
},
|
||||
saveAdd() {
|
||||
this.reportsValidation()
|
||||
this.namaValidation()
|
||||
this.labelValidation()
|
||||
this.parameterValidation()
|
||||
this.typeValidation()
|
||||
|
||||
if (
|
||||
this.error_reports_message === "" &&
|
||||
this.error_nama_message === "" &&
|
||||
this.error_label_message === "" &&
|
||||
this.error_parameter_message === "" &&
|
||||
this.error_type_message === ""
|
||||
) {
|
||||
var prm = {}
|
||||
prm.reportsid = this.xreports.R_ReportID
|
||||
// if (!_.isEmpty(this.xreports)) {
|
||||
// prm.reportsid =
|
||||
// }
|
||||
// prm.reportsid = this.xreports.R_ReportID
|
||||
|
||||
prm.name = this.xnama
|
||||
prm.label = this.xlabel
|
||||
prm.parameter = this.xparameter
|
||||
prm.sourcesp = this.xsource
|
||||
prm.url = this.xurl
|
||||
prm.type = this.xtype.typeid
|
||||
prm.priority = this.xpriority
|
||||
|
||||
this.$store.dispatch("reportparameter/addparam", prm)
|
||||
this.dialog_form = false
|
||||
}
|
||||
},
|
||||
openEdit(data) {
|
||||
this.dialog_form = true
|
||||
this.$store.commit("reportparameter/update_act", "edit")
|
||||
this.selectMe(data)
|
||||
this.xid = data.R_ReportDetailID
|
||||
this.xreports = {
|
||||
R_ReportID: data.R_ReportID
|
||||
}
|
||||
this.xnama = data.R_ReportDetailName
|
||||
this.xlabel = data.R_ReportDetailLabel
|
||||
this.xparameter = data.R_ReportDetailParam
|
||||
this.xsource = data.R_ReportDetailSourceSp
|
||||
this.xurl = data.R_ReportDetailSourceUrl
|
||||
this.xtype = {
|
||||
typeid: data.inputypeID
|
||||
}
|
||||
this.xpriority = data.R_ReportDetailPriority
|
||||
this.$store.commit("reportparameter/update_last_id", data.R_ReportDetailID)
|
||||
this.resetAllError()
|
||||
},
|
||||
saveEdit() {
|
||||
this.reportsValidation()
|
||||
this.namaValidation()
|
||||
this.labelValidation()
|
||||
this.parameterValidation()
|
||||
this.typeValidation()
|
||||
if (
|
||||
this.error_reports_message === "" &&
|
||||
this.error_nama_message === "" &&
|
||||
this.error_label_message === "" &&
|
||||
this.error_parameter_message === "" &&
|
||||
this.error_type_message === ""
|
||||
) {
|
||||
var prm = {}
|
||||
prm.id = this.xid
|
||||
prm.reportsid = this.xreports.R_ReportID
|
||||
prm.name = this.xnama
|
||||
prm.label = this.xlabel
|
||||
prm.parameter = this.xparameter
|
||||
prm.sourcesp = this.xsource
|
||||
prm.url = this.xurl
|
||||
prm.type = this.xtype.typeid
|
||||
prm.priority = this.xpriority
|
||||
|
||||
this.$store.dispatch("reportparameter/editparam", prm)
|
||||
this.dialog_form = false
|
||||
}
|
||||
},
|
||||
// hapus
|
||||
confirmDelete(data) {
|
||||
this.selectMe(data)
|
||||
this.xid = data.R_ReportDetailID
|
||||
this.nama = data.R_ReportDetailName
|
||||
|
||||
this.msgalert = "Yakin, mau hapus report detail " + data.R_ReportDetailName + " ?"
|
||||
this.dialogdeletealert = true
|
||||
},
|
||||
deleteRow() {
|
||||
this.$store.commit("reportparameter/update_last_id", -1)
|
||||
let prm = {
|
||||
id: this.xid,
|
||||
name: this.nama
|
||||
}
|
||||
this.$store.dispatch("reportparameter/deleteparam", prm)
|
||||
this.dialogdeletealert = false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
xsearch(val, old) {
|
||||
this.xsearch = val
|
||||
this.thr_search()
|
||||
},
|
||||
|
||||
xreport(val, old) {
|
||||
this.thr_search()
|
||||
},
|
||||
selected_reports_id(val, old) {
|
||||
this.thr_search()
|
||||
},
|
||||
vreportx(val, old) {
|
||||
this.thr_search_report()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
600
test/vuex/one-md-report/components/oneMdReports.vue
Normal file
600
test/vuex/one-md-report/components/oneMdReports.vue
Normal file
@@ -0,0 +1,600 @@
|
||||
<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 v-if="this.$store.state.reportparameter.reportparams.length <= 0" 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 Reports</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-select v-model="xgetreportgroup" :items="vgetReportgroup" item-text="R_ReportGroupName"
|
||||
item-value="reportgroupid" return-object label="Report Group*"
|
||||
:error="reportgroup_error_message !== ''" :error-messages="reportgroup_error_message"
|
||||
@blur="reportgroupValidation" required>
|
||||
</v-select>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row 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-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xnama" label="Nama*" :error="nama_error_message !== ''"
|
||||
:error-messages="nama_error_message" @blur="namaValidation" required></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="xurl" label="Url*" :error="url_error_message !== ''"
|
||||
:error-messages="url_error_message" @blur="urlValidation" 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>REPORTS</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-text-field class=" xs4 ma-1" label="Cari" placeholder="Ketikkan Kode atau Nama" outline
|
||||
v-model="xsearch" hide-details></v-text-field>
|
||||
</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="vreports" :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.R_ReportCode }}</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">{{ props.item.R_ReportName }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon small @click="openEdit(props.item)" color="primary" dark>edit</v-icon>
|
||||
<v-icon class="ml-3" small @click="confirmDelete(props.item)" color="red"
|
||||
dark>clear</v-icon>
|
||||
</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 {
|
||||
xgetreportgroup: 0,
|
||||
xcode: "",
|
||||
xnama: "",
|
||||
xurl: "",
|
||||
reportgroup_error_message: "",
|
||||
code_error_message: "",
|
||||
nama_error_message: "",
|
||||
url_error_message: "",
|
||||
clr: "success",
|
||||
xid: "",
|
||||
msgalert: "",
|
||||
dialogdeletealert: false,
|
||||
nama: "",
|
||||
headers: [
|
||||
{
|
||||
text: "KODE",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("reports/get_reportgroup")
|
||||
},
|
||||
computed: {
|
||||
vreports() {
|
||||
return this.$store.state.reports.reportss
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.reports.search_status
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.reports.current_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reports/update_current_page", val)
|
||||
this.$store.commit("reports/update_last_id", -1)
|
||||
this.$store.dispatch("reports/searchreports")
|
||||
}
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.reports.total_reports
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reports/update_total_reports", val)
|
||||
}
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.reports.x_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reports/update_x_search", val)
|
||||
}
|
||||
},
|
||||
dialog_form: {
|
||||
get() {
|
||||
return this.$store.state.reports.dialog_form
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reports/update_dialog_form", val)
|
||||
},
|
||||
},
|
||||
xact: {
|
||||
get() {
|
||||
return this.$store.state.reports.act
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reports/update_act", val)
|
||||
}
|
||||
},
|
||||
loading_save: {
|
||||
get() {
|
||||
return this.$store.state.reports.loading_save
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reports/update_loading_save", val)
|
||||
},
|
||||
},
|
||||
vgetReportgroup() {
|
||||
return this.$store.state.reports.getreportgroup
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.reports.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reports/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
msgsnackbar() {
|
||||
return this.$store.state.reports.msg_success
|
||||
},
|
||||
dialog_error: {
|
||||
get() {
|
||||
return this.$store.state.reports.alert_error
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("reports/update_alert_error", val)
|
||||
},
|
||||
},
|
||||
msgError() {
|
||||
return this.$store.state.reports.error_message
|
||||
},
|
||||
xreportgroup() {
|
||||
return this.$store.state.reportgroup.selected_reportgroup
|
||||
},
|
||||
selected_reportgroup_id() {
|
||||
return this.$store.state.reports.selected_reportgroup_id
|
||||
},
|
||||
selected_reports: {
|
||||
get() {
|
||||
return this.$store.state.reports.selected_reports
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isSelected(p) {
|
||||
return p.R_ReportID == this.$store.state.reports.selected_reports.R_ReportID
|
||||
},
|
||||
selectMe(selected) {
|
||||
this.$store.commit("reports/update_selected_reports", selected)
|
||||
this.$store.commit("reportparameter/update_selected_reports_id", selected.R_ReportID)
|
||||
this.$store.commit("reports/update_last_id", selected.R_ReportID)
|
||||
this.$store.commit("reportparameter/update_last_id", -1)
|
||||
},
|
||||
thr_search: _.debounce(function () {
|
||||
this.$store.dispatch("reports/searchreports")
|
||||
}, 1000),
|
||||
// Validation
|
||||
reportgroupValidation() {
|
||||
if (this.xgetreportgroup.reportgroupid < 1 || !this.xgetreportgroup.reportgroupid) {
|
||||
this.reportgroup_error_message = "Pilih salah satu report group"
|
||||
}
|
||||
if (this.xgetreportgroup.reportgroupid > 0) {
|
||||
this.reportgroup_error_message = ""
|
||||
}
|
||||
},
|
||||
codeValidation() {
|
||||
if (!this.xcode) {
|
||||
this.code_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xcode) {
|
||||
this.code_error_message = ""
|
||||
}
|
||||
},
|
||||
namaValidation() {
|
||||
if (!this.xnama) {
|
||||
this.nama_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xnama) {
|
||||
this.nama_error_message = ""
|
||||
}
|
||||
},
|
||||
urlValidation() {
|
||||
if (!this.xurl) {
|
||||
this.url_error_message = "Anda belum mengisi"
|
||||
}
|
||||
if (this.xurl) {
|
||||
this.url_error_message = ""
|
||||
}
|
||||
},
|
||||
resetAllinput() {
|
||||
this.xgetreportgroup.reportgroupid = 0
|
||||
this.xcode = ""
|
||||
this.xnama = ""
|
||||
this.xurl = ""
|
||||
this.reportgroup_error_message = ""
|
||||
this.nama_error_message = ""
|
||||
this.code_error_message = ""
|
||||
this.url_error_message = ""
|
||||
},
|
||||
resetAllError() {
|
||||
this.reportgroup_error_message = ""
|
||||
this.nama_error_message = ""
|
||||
this.code_error_message = ""
|
||||
this.url_error_message = ""
|
||||
},
|
||||
// add
|
||||
openAddForm() {
|
||||
this.dialog_form = true
|
||||
this.$store.commit("reports/update_act", "add")
|
||||
this.xgetreportgroup = ""
|
||||
this.xcode = ""
|
||||
this.xnama = ""
|
||||
this.url = ""
|
||||
this.resetAllinput()
|
||||
this.$store.commit("reports/update_last_id", -1)
|
||||
},
|
||||
saveAdd() {
|
||||
this.reportgroupValidation()
|
||||
this.codeValidation()
|
||||
this.namaValidation()
|
||||
this.urlValidation()
|
||||
if (
|
||||
this.reportgroup_error_message === "" &&
|
||||
this.code_error_message === "" &&
|
||||
this.nama_error_message === "" &&
|
||||
this.url_error_message === ""
|
||||
) {
|
||||
let prm = {
|
||||
reportgroupid: this.xgetreportgroup.reportgroupid,
|
||||
code: this.xcode,
|
||||
name: this.xnama,
|
||||
url: this.xurl
|
||||
}
|
||||
this.$store.dispatch("reports/addreport", prm)
|
||||
this.dialog_form = false
|
||||
}
|
||||
},
|
||||
openEdit(data) {
|
||||
this.dialog_form = true
|
||||
this.$store.commit("reports/update_act", "edit")
|
||||
this.selectMe(data)
|
||||
this.xid = data.R_ReportID
|
||||
this.xgetreportgroup = {
|
||||
reportgroupid: data.reportgroupID
|
||||
}
|
||||
this.xcode = data.R_ReportCode
|
||||
this.xnama = data.R_ReportName
|
||||
this.xurl = data.R_ReportUrl
|
||||
this.$store.commit("reports/update_last_id", data.R_ReportID)
|
||||
this.resetAllError()
|
||||
},
|
||||
saveEdit() {
|
||||
this.reportgroupValidation()
|
||||
this.codeValidation()
|
||||
this.namaValidation()
|
||||
this.urlValidation()
|
||||
if (
|
||||
this.reportgroup_error_message === "" &&
|
||||
this.code_error_message === "" &&
|
||||
this.nama_error_message === "" &&
|
||||
this.url_error_message === ""
|
||||
) {
|
||||
let prm = {
|
||||
id: this.xid,
|
||||
reportgroupid: this.xgetreportgroup.reportgroupid,
|
||||
code: this.xcode,
|
||||
name: this.xnama,
|
||||
url: this.xurl
|
||||
}
|
||||
this.$store.dispatch("reports/editreport", prm)
|
||||
this.dialog_form = false
|
||||
}
|
||||
},
|
||||
//hapus
|
||||
confirmDelete(data) {
|
||||
this.selectMe(data)
|
||||
this.xid = data.R_ReportID
|
||||
this.nama = data.R_ReportName
|
||||
// let id_reportdetail = this.$store.state.reportparameter.reportparams.length <= 0;
|
||||
// console.log("cek id report", id_reportdetail)
|
||||
|
||||
if (this.$store.state.reportparameter.reportparams.length <= 0) {
|
||||
this.msgalert = "Yakin, mau hapus report " + data.R_ReportName + " ?"
|
||||
} else {
|
||||
this.msgalert = "Tidak bisa di hapus, masih ada report parameter"
|
||||
}
|
||||
|
||||
this.dialogdeletealert = true
|
||||
},
|
||||
deleteRow() {
|
||||
this.$store.commit("reports/update_last_id", -1)
|
||||
let prm = {
|
||||
id: this.xid,
|
||||
name: this.nama
|
||||
}
|
||||
this.$store.dispatch("reports/deletereport", prm)
|
||||
this.dialogdeletealert = false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
xsearch(val, old) {
|
||||
this.xsearch = val
|
||||
this.thr_search()
|
||||
},
|
||||
xreportgroup(val, old) {
|
||||
this.thr_search()
|
||||
},
|
||||
selected_reports(val, old) {
|
||||
this.$store.commit("reports/update_selected_reports", val)
|
||||
this.$store.commit("reportparameter/update_selected_reports_id", val.R_ReportID)
|
||||
this.$store.commit("reports/update_last_id", val.R_ReportID)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user