Flatten nested repos

This commit is contained in:
sas.fajri
2026-04-27 10:13:31 +07:00
parent 01c2963a43
commit 8347aef8f4
17935 changed files with 5015229 additions and 3 deletions

View File

@@ -0,0 +1,768 @@
<template>
<div>
<v-dialog
v-model="dialog_alert"
width="500"
>
<v-card>
<v-card-title
class="headline grey lighten-2"
primary-title
>
PERINGATAN
</v-card-title>
<v-card-text>
<p v-if="_.isEmpty(selected_placed_almari)">Jangan lupa memilih almari, jika otomatis penempatan diaktifkan</p>
<p v-if="_.isEmpty(selected_placed_rack)">Jangan lupa memilih rak, jika otomatis penempatan diaktifkan</p>
<p v-if="!_.isEmpty(selected_placed_almari) && !_.isEmpty(selected_placed_rack)">Rak {{selected_placed_rack.name}} sudah penuh</p>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="primary"
flat
@click="dialog_alert = false"
>
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-layout class="mb-2" column >
<v-card>
<v-layout row>
<v-flex xs12>
<v-subheader red--text text--lighten-1> FORM TRANSAKSI SAMPLE STORAGE
<span v-if="xact === 'edit'"> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{xnumbering}}</span> ]</span>
<v-flex text-md-right>
<v-btn v-if="xact === 'new'" @click="saveNewTransaction()" small color="info">Simpan</v-btn>
<v-btn v-if="xact !== 'new'" @click="printX()" small color="grey">Print</v-btn>
</v-flex>
</v-subheader>
<v-divider></v-divider>
<v-layout row wrap>
<v-flex xs12 pa-2>
<v-layout row>
<v-flex xs3 pa-1>
<v-text-field v-model="xdate" readonly="readonly" label="Tanggal Transaksi*"></v-text-field>
<p v-if="checkError('requiredate')" class="error pl-2 pr-2" style="color:#fff">Tanggal transaksi harus diisi dong</p>
</v-flex>
<v-flex xs2 pa-1>
<v-text-field v-model="xtime" readonly="readonly" label="Waktu Transaksi*"></v-text-field>
<p v-if="checkError('requiretime')" class="error pl-2 pr-2" style="color:#fff">Waktu transaksi harus diisi dong</p>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12 pa-1>
<v-textarea
filled
outline
label="Catatan"
v-model="xnote"
rows="3"
></v-textarea>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card>
</v-layout>
<v-layout class="mb-2" column >
<v-card>
<v-layout row>
<v-flex xs12>
<v-layout row>
<v-flex xs4>
<v-subheader red--text text--lighten-1> DETAIL TRANSAKSI</v-subheader>
</v-flex>
</v-layout>
<v-divider></v-divider>
<v-layout row wrap>
<v-flex xs12 pa-2>
<v-layout v-if="xact === 'new'" row>
<v-flex xs12 pa-1>
<v-layout class="align-center" row>
<v-flex xs3>
<v-switch
v-model="is_autoplaced"
:label="`penempatan otomatis`"
hide-details
></v-switch>
</v-flex>
<v-flex xs3 pl-2>
<v-select
:disabled="!is_autoplaced"
item-text="name"
hide-details
return-object
:items="placed_almaries"
v-model="selected_placed_almari"
label="Pilih Almari"
></v-select>
</v-flex>
<v-flex xs3 pl-2>
<v-select
hide-details
:disabled="!is_autoplaced"
item-text="name"
return-object
:items="placed_rack"
v-model="selected_placed_rack"
label="Pilih Rak"
></v-select>
</v-flex>
<v-flex class="text-xs-right" xs3>
<code style="font-size:32px">{{chupbyrack}}</code>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12 pa-1>
<v-data-table
:headers="headers"
:items="details"
:loading="isLoading"
hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-center pa-1" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
<v-icon v-if="xact === 'new'" color="error" @click="deleteDetail(props.item)">delete</v-icon>
<v-icon v-if="xact === 'edit'" color="success" >check</v-icon>
</td>
<td class="text-xs-left pa-1" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.patientname }}</td>
<td class="text-xs-center pa-1" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.barcode }}</td>
<td class="pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.almari.name }}</td>
<td class="text-xs-center pa-1" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.rack.code }}</td>
<td class="text-xs-center pa-1" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.row }} x {{ props.item.col }}</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card>
</v-layout>
<v-layout v-if="xact === 'new'" class="mb-2" column >
<v-card>
<v-layout row>
<v-flex xs12>
<v-subheader red--text text--lighten-1> PILIH POSISI PENEMPATAN &nbsp;<v-icon style="font-weight:800">dialpad</v-icon>&nbsp;&nbsp;
<span style="font-weight:900; color:#2196f3" v-if="xopenalmari && !xopenrack">{{xselected_almari.name}}</span>
<span style="font-weight:900; color:#2196f3" v-if="!xopenalmari && xopenrack">{{xselected_almari.name}}</span> <v-icon v-if="!xopenalmari && xopenrack" style="font-weight:800">keyboard_arrow_right</v-icon> <span v-if="!xopenalmari && xopenrack" style="font-weight:700; color:#ff5722">{{xselected_rack.code}}</span>
<v-flex text-md-right>
<v-btn v-if="xopenalmari && !xopenrack" @click="backToAlmari()" small color="info">Kembali ke Lemari</v-btn>
<v-btn v-if="!xopenalmari && xopenrack" @click="backToRack()" small color="info">Kembali ke Rak</v-btn>
</v-flex>
</v-subheader>
<v-divider></v-divider>
<v-layout row>
<v-flex xs12 align-center pa-2>
<v-layout align-center justify-center v-if="!xopenalmari && !xopenrack" row wrap>
<v-btn @click="openAlmari(almari)" v-for="almari in xalmaries" color="info" dark large>{{almari.code}}</v-btn>
</v-layout>
<v-layout align-center justify-center v-if="xopenalmari && !xopenrack" row wrap>
<v-btn @click="openRack(rack)" v-for="rack in xracks" color="info" dark>{{rack.code}}</v-btn>
</v-layout>
<v-layout align-center justify-center v-for="(rackcontent, index) in xrackcontents" v-if="!xopenalmari && xopenrack" row wrap>
<v-btn @click="setPosition(position,index)" v-for="position in rackcontent" fab dark :color="checkStatus(position)">
<v-icon v-if="position.status === 'N' && position.selected === 'N'">inbox</v-icon>
<v-icon v-if="position.status === 'N' && position.selected === 'Y'">move_to_inbox</v-icon>
<v-icon v-if="position.status === 'N' && position.selected === 'T'">archive</v-icon>
<v-icon v-if="position.status === 'Y' && position.selected === 'N'">report_problem</v-icon>
</v-btn>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card>
</v-layout>
<one-dialog-print :title="printtitle" :width="printwidth" :height="500" :status="openprint" :urlprint="urlprint" @close-dialog-print="openprint=false"></one-dialog-print>
</div>
</template>
<style scoped>
table, td, th {
border: 1px solid #ddd;
text-align: left;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding-top: 5px;
padding-bottom: 5px;
padding-left: 8px;
padding-right: 5px;
}
.mini-input .v-input{
margin-top: 0px;
}
.mini-input .v-input, .mini-input .v-input--selection-controls,.mini-input .v-input__slot{
margin-top: 0px;
margin-bottom:0px;
margin-left:3px;
}
.mini-input .v-messages{
min-height:0px;
}
input.fhm-input{
border: 1px solid black;
border-radius: 2px;
-webkit-box-shadow:
inset 0 0 2px rgba(0,0,0,0.1),
0 0 4px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 2px rgba(0,0,0,0.1),
0 0 4px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 2px rgba(0,0,0,0.1),
0 0 4px rgba(0,0,0,0.1);
padding: 2px 4px;
background: rgba(255,255,255,0.5);
margin: 0 0 1px 0;
width:30px;
text-align:center;
}
</style>
<script>
module.exports = {
components : {
'one-dialog-print':httpVueLoader('../../common/oneDialogPrintX.vue')
},
data: () => ({
openprint:false,
urlprint:'',
printtitle:'',
printwidth:600,
xalmariname:'',
xrackcode:'',
xrow:0,
xcol:0,
rackrows:[],
rackcols:[],
headers: [
{
text: "",
align: "left",
sortable: false,
width: "8%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "PASIEN",
align: "left",
sortable: false,
width: "20%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "BARCODE",
align: "center",
sortable: false,
width: "15%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "ALMARI",
align: "left",
sortable: false,
width: "25%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "RAK",
align: "center",
sortable: false,
width: "15%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "POSISI",
align: "center",
sortable: false,
width: "10%",
class: "pa-1 blue lighten-3 white--text"
}
]
}),
computed: {
chupbyrack(){
if(this.is_autoplaced && !_.isEmpty(this.selected_placed_almari) && !_.isEmpty(this.selected_placed_rack)){
var details = this.$store.state.form.details
if(details.length > 0){
console.log('yette')
console.log(this.selected_placed_rack.id)
var placedx = _.filter(details, { rackid: this.selected_placed_rack.id})
console.log(placedx)
return placedx.length
}
else{
return 0
}
}
else {
return ''
}
},
dialog_alert:{
get() {
return this.$store.state.samplestorage.dialog_alert
},
set(val) {
this.$store.commit("samplestorage/update_dialog_alert",val)
}
},
xbarcode:{
get() {
return this.$store.state.samplestorage.xbarcode
},
set(val) {
this.$store.commit("samplestorage/update_xbarcode",val)
}
},
is_autoplaced:{
get() {
return this.$store.state.samplestorage.is_autoplaced
},
set(val) {
this.$store.commit("samplestorage/update_is_autoplaced",val)
}
},
placed_almaries:{
get() {
return this.$store.state.samplestorage.placed_almaries
},
set(val) {
this.$store.commit("samplestorage/update_placed_almaries",val)
}
},
selected_placed_almari:{
get() {
return this.$store.state.samplestorage.selected_placed_almari
},
set(val) {
this.$store.commit("samplestorage/update_selected_placed_almari",val)
this.$store.dispatch("samplestorage/getrackbyalmari",val)
}
},
placed_rack:{
get() {
return this.$store.state.samplestorage.placed_rack
},
set(val) {
this.$store.commit("samplestorage/update_placed_rack",val)
}
},
selected_placed_rack:{
get() {
return this.$store.state.samplestorage.selected_placed_rack
},
set(val) {
this.$store.commit("samplestorage/update_selected_placed_rack",val)
}
},
xact(){
return this.$store.state.samplestorage.act
},
xnumbering(){
return this.$store.state.form.transaction_number
},
xdate:{
get() {
return this.$store.state.form.transaction_date
},
set(val) {
this.$store.commit("form/update_transaction_date",val)
this.$store.commit("samplestorage/update_no_save",1)
}
},
xtime:{
get() {
return this.$store.state.form.transaction_time
},
set(val) {
this.$store.commit("form/update_transaction_time",val)
this.$store.commit("samplestorage/update_no_save",1)
}
},
xnote:{
get() {
return this.$store.state.form.transaction_note
},
set(val) {
this.$store.commit("form/update_transaction_note",val)
this.$store.commit("samplestorage/update_no_save",1)
}
},
isLoading() {
return this.$store.state.samplestorage.search_status == 1
},
xalmaries(){
return this.$store.state.form.almaries
},
xracks(){
return this.$store.state.form.racks
},
xselected_almari:{
get() {
return this.$store.state.form.selected_almari
},
set(val) {
this.$store.commit("form/update_selected_almari",val)
this.$store.dispatch("form/getracks",{
id:this.$store.state.form.selected_almari.id
})
}
},
xselected_rack:{
get() {
return this.$store.state.form.selected_rack
},
set(val) {
this.$store.commit("form/update_selected_rack",val)
}
},
details(){
return this.$store.state.form.details
},
xopenalmari(){
return this.$store.state.form.open_almari
},
xopenrack(){
return this.$store.state.form.open_rack
},
xrackcontents(){
return this.$store.state.form.rack_contents
},
},
methods : {
printX(){
var idx = this.$store.state.samplestorage.selected_transaction.id
this.printwidth = 1028
this.printtitle = ""
let user = one_user()
var d = new Date();
var n = d.getTime()
var rptname = "rpt_storage_001"
var xurl = "/birt/run?__report=report/one/rekap/"+rptname+".rptdesign&__format=pdf&username="+user.M_UserUsername+"&PID="+idx+'&tm='+n
this.urlprint = xurl
this.openprint = true
},
checkError(value){
var errors = this.$store.state.form.errors
if(errors.includes(value)){
return true
}
else{
return false
}
},
isSelected(p) {
return p.barcode == this.$store.state.form.selected_detail.barcode
},
selectMe(detail) {
this.$store.commit("form/update_selected_detail",detail)
},
addDetail(){
var barcode = this.xbarcode
this.xbarcode = ''
this.$store.dispatch("form/checkbarcode",{
barcode : barcode,
details : this.$store.state.form.details
})
},
deleteDetail(detail){
var selectedbarcode = this.$store.state.form.selected_detail.barcode
var arr = this.$store.state.form.details
let idx = _.findIndex(arr, function(o) { return o.barcode == detail.barcode })
//arr.splice(idx, 1)
var result = _.reject(arr, { barcode: detail.barcode })
this.$store.commit("form/update_details",result)
if(!_.isEmpty(this.xselected_rack)){
var rackcontents = this.$store.state.form.rack_contents
for (var i = 0; i < rackcontents.length; i++) {
var childs = rackcontents[i]
for (var x = 0; x < childs.length; x++) {
var arrinlist = this.$store.state.form.details
if(childs[x].row !== 0 & childs[x].col !== 0){
let idx = _.findIndex(arrinlist, { rackid: this.xselected_rack.id, row:childs[x].row, col: childs[x].col})
if(idx !== -1){
childs[x].selected = 'T'
}
else{
childs[x].selected = 'N'
}
}
}
}
this.$store.commit("form/update_rack_contents",rackcontents)
}
if(selectedbarcode === detail.barcode){
console.log('empty detail')
this.$store.commit("form/update_selected_detail",{})
if(!_.isEmpty(this.$store.state.form.details)){
var xnewdetail = this.$store.state.form.details[0]
this.selectMe(xnewdetail)
//this.$store.commit("form/update_selected_detail",xnewdetail)
}
}
},
saveNewTransaction(){
this.$store.commit("form/update_errors",[])
var errors = this.$store.state.form.errors
if(this.xdate === ''){
errors.push("requiredate")
}
if(this.xtime === ''){
errors.push("requiretime")
}
if(errors.length === 0){
if(this.$store.state.form.details.length > 0){
var details = this.$store.state.form.details
//console.log(details)
var xerrors = _.filter(details, function(o) { return o.row === 0 })
console.log(xerrors)
if(_.isEmpty(xerrors)){
var prm = {
date: this.$store.state.form.transaction_date,
time: this.$store.state.form.transaction_time,
note: this.$store.state.form.transaction_note,
details : this.$store.state.form.details
}
this.$store.dispatch("form/save",prm)
}
else{
var er_barcodes = ''
for (var i = 0; i < xerrors.length; i++) {
if(er_barcodes === ''){
er_barcodes = xerrors[i]['barcode']
}
else{
er_barcodes += " , "+xerrors[i]['barcode']
}
}
var msg = "<p>Barcode "+er_barcodes+" belum dipilih posisinya dong<p>"
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}
}
else{
var msg = "Belum ada sample yang dipilih dong "
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}
}
},
openAlmari(almari){
/*var xseldel = this.$store.state.form.selected_detail
var zxdetails = this.$store.state.form.details
let zzidxsel = _.findIndex(zxdetails, function(o) { return o.barcode == xseldel.barcode })
if(!_.isEmpty(this.$store.state.form.selected_detail) && zzidxsel !== -1){*/
this.$store.commit("form/update_open_almari",true)
this.$store.commit("form/update_selected_almari",almari)
this.xalmariname = almari.name
this.$store.dispatch("form/getracks",{
id:this.$store.state.form.selected_almari.id
})
this.$store.commit("form/update_selected_rack",{})
/*var arr = this.$store.state.form.details
var nowbarcode = this.$store.state.form.selected_detail.barcode
let idx = _.findIndex(arr, function(o) { return o.barcode == nowbarcode })
console.log(idx)
arr[idx].almari = this.$store.state.form.selected_almari
arr[idx].rack = {}
arr[idx].rackid = 0
arr[idx].row = 0
arr[idx].col = 0
this.$store.commit("form/update_details",arr)*/
/*}
else{
var msg = "Belum memilih salah satu barcode dong "
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}*/
},
openRack(rack){
/*var xseldel = this.$store.state.form.selected_detail
var zxdetails = this.$store.state.form.details
let zzidxsel = _.findIndex(zxdetails, function(o) { return o.barcode == xseldel.barcode })
if(!_.isEmpty(this.$store.state.form.selected_detail) && zzidxsel !== -1){*/
this.$store.commit("form/update_open_almari",false)
this.$store.commit("form/update_open_rack",true)
this.$store.commit("form/update_selected_rack",rack)
this.xrackcode = rack.code
/*var arr = this.$store.state.form.details
var nowbarcode = this.$store.state.form.selected_detail.barcode
let idx = _.findIndex(arr, function(o) { return o.barcode == nowbarcode })
arr[idx].almari = this.$store.state.form.selected_almari
arr[idx].rack = this.$store.state.form.selected_rack
arr[idx].rackid = this.$store.state.form.selected_rack.id
arr[idx].row = 0
arr[idx].col = 0
this.$store.commit("form/update_details",arr)*/
if(!_.isEmpty(this.xselected_rack)){
var rackcontents = rack.rackcontens
for (var i = 0; i < rackcontents.length; i++) {
var childs = rackcontents[i]
for (var x = 0; x < childs.length; x++) {
var arrinlist = this.$store.state.form.details
if(childs[x].row !== 0 & childs[x].col !== 0){
let idx = _.findIndex(arrinlist, { rackid: this.xselected_rack.id, row:childs[x].row, col: childs[x].col})
if(idx !== -1){
childs[x].selected = 'T'
}
else{
childs[x].selected = 'N'
}
}
}
}
this.$store.commit("form/update_rack_contents",rackcontents)
}
/*}
else{
var msg = "Belum memilih salah satu barcode dong "
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}*/
},
setPosition(position,idx){
if(position.status !== 'Y'){
var xseldel = this.$store.state.form.selected_detail
var zxdetails = this.$store.state.form.details
let zzidxsel = _.findIndex(zxdetails, function(o) { return o.barcode == xseldel.barcode })
if(!_.isEmpty(this.$store.state.form.selected_detail) && zzidxsel !== -1){
var arr = this.$store.state.form.details
var existindex = _.findIndex(arr, { rackid : this.xselected_rack.id, row:position.row, col : position.col })
if(existindex === -1){
var nowbarcode = this.$store.state.form.selected_detail.barcode
let ixdx = _.findIndex(arr, function(o) { return o.barcode == nowbarcode })
arr[ixdx].almari = this.$store.state.form.selected_almari
arr[ixdx].rack = this.$store.state.form.selected_rack
arr[ixdx].rackid = this.$store.state.form.selected_rack.id
arr[ixdx].row = position.row
arr[ixdx].col = position.col
this.$store.commit("form/update_details",arr)
if(!_.isEmpty(this.xselected_rack)){
var rackcontents = this.$store.state.form.rack_contents
for (var i = 0; i < rackcontents.length; i++) {
var childs = rackcontents[i]
for (var x = 0; x < childs.length; x++) {
var arrinlist = this.$store.state.form.details
if(childs[x].row !== 0 & childs[x].col !== 0){
let idx = _.findIndex(arrinlist, { rackid: this.xselected_rack.id, row:childs[x].row, col: childs[x].col})
if(idx !== -1){
childs[x].selected = 'T'
}
else{
childs[x].selected = 'N'
}
}
}
}
this.$store.commit("form/update_rack_contents",rackcontents)
}
}
else{
var msg = "Cuman bisa diisi satu dong "
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}
}
else{
var msg = "Belum memilih salah satu barcode dong "
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}
}
else{
var msg = "Sudah ada isinya dong "
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}
},
backToAlmari(){
/*var xseldel = this.$store.state.form.selected_detail
var zxdetails = this.$store.state.form.details
let zzidxsel = _.findIndex(zxdetails, function(o) { return o.barcode == xseldel.barcode })
if(!_.isEmpty(this.$store.state.form.selected_detail) && zzidxsel !== -1){*/
this.$store.commit("form/update_open_almari",false)
this.$store.commit("form/update_open_rack",false)
this.$store.commit("form/update_selected_rack",{})
this.$store.commit("form/update_selected_almari",{})
/*}
else{
var msg = "Belum memilih salah satu barcode dong "
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}*/
},
backToRack(){
/*var xseldel = this.$store.state.form.selected_detail
var zxdetails = this.$store.state.form.details
let zzidxsel = _.findIndex(zxdetails, function(o) { return o.barcode == xseldel.barcode })
if(!_.isEmpty(this.$store.state.form.selected_detail) && zzidxsel !== -1){*/
this.$store.commit("form/update_open_almari",true)
this.$store.commit("form/update_open_rack",false)
this.$store.commit("form/update_selected_rack",{})
/*}
else{
var msg = "Belum memilih salah satu barcode dong "
this.$store.commit("samplestorage/update_msg_info",msg)
this.$store.commit("samplestorage/update_open_dialog_info",true)
}*/
},
checkStatus(value){
if(value.status === 'N' && value.selected === 'N'){
return 'info'
}else if(value.status === 'N' && value.selected === 'T'){
return 'warning'
}
else{
return 'error'
}
}
}
}
</script>

View File

@@ -0,0 +1,344 @@
<template>
<v-layout class="fill-height" column>
<v-dialog v-model="dialogsuccess" persistent max-width="290">
<v-card>
<v-card-title color="success" class="headline">Berhasil !</v-card-title>
<v-card-text>
{{msgsuccess}}
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="green darken-1" flat @click="closeDialogSuccess">OK</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-card class="mb-2 pa-2 searchbox">
<v-layout >
<v-menu class="xs6 pr-2"
v-model="menufilterdatestart"
:close-on-content-click="false"
:nudge-right="40"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
class="mt-1"
v-model="filterComputedDateFormattedStart"
label="Tanggal Awal"
outline
hide-details
readonly
v-on="on"
@blur="date = deFormatedDate(filterComputedDateFormattedStart)"
></v-text-field>
</template>
<v-date-picker v-model="xdatestart" no-title @input="menufilterdatestart = false"></v-date-picker>
</v-menu>
<v-menu class="xs6 pl-2"
v-model="menufilterdateend"
:close-on-content-click="false"
:nudge-right="40"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
class="mt-1"
v-model="filterComputedDateFormattedEnd"
label="Tanggal Akhir"
outline
readonly
hide-details
v-on="on"
@blur="date = deFormatedDate(filterComputedDateFormattedEnd)"
></v-text-field>
</template>
<v-date-picker v-model="xdateend" no-title @input="menufilterdateend = false"></v-date-picker>
</v-menu>
<span @click="searchTransaction" class="icon-medium-fill-base xs1 white--text success iconsearch-search"></span>
<span @click="setNewTransaction" class="icon-medium-fill-base xs1 white--text primary ml-1 icon-add"></span>
</v-layout>
</v-card>
<v-card >
<v-layout row>
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
<v-data-table
:headers="headers"
:items="xtransactions"
:loading="isLoading"
hide-actions
class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-left pa-1" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.trx_number }}</td>
<td class="text-xs-center pa-1" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.trx_datetime}}</td>
<td class="text-xs-center pa-1" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.trx_note}}</td>
</template>
</v-data-table>
<v-divider></v-divider>
<v-pagination
style="margin-top:10px;margin-bottom:10px"
v-model="curr_page"
:length="xtotal_page"
></v-pagination>
</v-flex>
</v-layout>
</v-card>
<one-dialog-alert :status="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()" @close-dialog-alert="closeAlertConfirmation()"></one-dialog-alert>
<one-dialog-info :status="opendialoginfo" :msg="msginfo" @close-dialog-info="closeDialogInfo()"></one-dialog-info>
</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;
}
</style>
<script>
module.exports = {
components : {
'one-dialog-info':httpVueLoader('../../common/oneDialogInfo.vue'),
'one-dialog-alert':httpVueLoader('../../common/oneDialogAlert.vue')
},
mounted() {
this.$store.dispatch("form/getalmaries")
this.$store.dispatch("samplestorage/search",{
startdate:this.xdatestart,
enddate: this.xdateend,
current_page:1,
lastid:-1
})
},
methods : {
formatDate (date) {
if (!date) return null
const [year, month, day] = date.split('-')
return `${day}-${month}-${year}`
},
deFormatedDate (date) {
if (!date) return null
const [ day,month, year] = date.split('-')
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
},
isSelected(p) {
return p.id == this.$store.state.samplestorage.selected_transaction.id
},
searchTransaction() {
this.$store.dispatch("samplestorage/search",{
startdate:this.xdatestart,
enddate: this.xdateend,
current_page:1,
lastid:-1
})
},
selectMe(trx) {
if(this.$store.state.samplestorage.no_save == 0 ){
console.log(trx)
this.$store.commit("samplestorage/update_selected_transaction",trx)
this.$store.commit("samplestorage/update_act",'edit')
this.$store.commit("form/update_transaction_number",trx.trx_number)
this.$store.commit("form/update_transaction_date",trx.xdate)
this.$store.commit("form/update_transaction_time",trx.xtime)
this.$store.commit("form/update_transaction_note",trx.trx_note)
this.$store.commit("form/update_details",trx.details)
}else{
this.$store.commit("samplestorage/update_open_alert_confirmation",true)
}
},
closeAlertConfirmation(){
this.$store.commit("samplestorage/update_open_alert_confirmation",false)
},
forgetAlertConfirmation(){
this.$store.commit("samplestorage/update_no_save",0)
this.$store.commit("samplestorage/update_open_alert_confirmation",false)
},
updateAlert_success(val){
this.$store.commit("samplestorage/update_alert_success",val)
},
setNewTransaction(){
this.$store.commit("samplestorage/update_selected_transaction",{})
this.$store.commit("samplestorage/update_act",'new')
this.$store.commit("form/update_transaction_number","")
this.$store.commit("form/update_transaction_date",moment(new Date()).format('DD-MM-YYYY'))
this.$store.commit("form/update_transaction_time",moment(new Date()).format("hh:mm"))
this.$store.commit("form/update_transaction_note",'')
this.$store.commit("form/update_details",[])
},
closeDialogSuccess(){
let arrtrx = this.$store.state.samplestorage.transactions
var idx = _.findIndex(arrtrx, item => item.T_SampleStorageID === this.$store.state.samplestorage.last_id)
console.log(idx)
this.$store.dispatch("samplestorage/search",{
startdate:this.xdatestart,
enddate: this.xdateend,
current_page:1,
lastid: idx
})
this.$store.commit("samplestorage/update_dialog_success",false)
},
closeDialogInfo(){
this.$store.commit("samplestorage/update_open_dialog_info",false)
},
},
computed: {
dialogsuccess: {
get() {
return this.$store.state.samplestorage.dialog_success
},
set(val) {
this.$store.commit("samplestorage/update_dialog_success",val)
}
},
msgsuccess(){
return this.$store.state.samplestorage.msg_success
},
snackbar: {
get() {
return this.$store.state.samplestorage.alert_success
},
set(val) {
this.$store.commit("samplestorage/update_alert_success",val)
}
},
isLoading() {
return this.$store.state.samplestorage.search_status == 1
},
xdatestart : {
get() {
return this.$store.state.samplestorage.start_date
},
set(val) {
this.$store.commit("samplestorage/update_start_date",val)
}
},
xdateend : {
get() {
return this.$store.state.samplestorage.end_date
},
set(val) {
this.$store.commit("samplestorage/update_end_date",val)
}
},
filterComputedDateFormattedStart () {
return this.formatDate(this.xdatestart)
},
filterComputedDateFormattedEnd () {
return this.formatDate(this.xdateend)
},
xtransactions() {
console.log(this.$store.state.samplestorage.transactions)
return this.$store.state.samplestorage.transactions
},
openalertconfirmation: {
get() {
return this.$store.state.samplestorage.open_alert_confirmation
},
set(val) {
this.$store.commit("samplestorage/update_open_alert_confirmation",val)
}
},
opendialoginfo: {
get() {
return this.$store.state.samplestorage.open_dialog_info
},
set(val) {
this.$store.commit("samplestorage/update_open_dialog_info",false)
}
},
msginfo(){
return this.$store.state.samplestorage.msg_info
},
curr_page: {
get() {
return this.$store.state.samplestorage.current_page
},
set(val) {
this.$store.commit("samplestorage/update_current_page",val)
this.$store.dispatch("samplestorage/search",{
startdate:this.xdatestart,
enddate: this.xdateend,
current_page:val,
lastid:-1
})
}
},
xtotal_page: {
get() {
return this.$store.state.samplestorage.total_page
},
set(val) {
this.$store.commit("samplestorage/update_total_page",val)
}
},
},
data() {
return {
msgalertconfirmation:"Perubahan yang telah dilakukan belum disimpan dong !",
menufilterdatestart:false,
menufilterdateend:false,
date: new Date().toISOString().substr(0, 10),
items: [],
name: '',
page:1,
headers: [
{
text: "NO. TRANSAKSI",
align: "left",
sortable: false,
width: "10%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "TANGGAL DAN JAM",
align: "LEFT",
sortable: false,
width: "15%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "CATATAN",
align: "LEFT",
sortable: false,
width: "25%",
class: "pa-1 blue lighten-3 white--text"
}
],
pagination:{
descending: false,
page: 1,
rowsPerPage: 5,
sortBy: 'T_SampleStorageDate',
totalItems: this.$store.state.samplestorage.total_transactions
}
};
}
}
</script>

View File

@@ -0,0 +1,397 @@
<template>
<v-layout v-if="xact !== 'new'" column >
<v-dialog v-model="dialogconfirmationdeleteaddr" persistent max-width="290">
<v-card>
<v-card-title
dark
class="headline error pt-2 pb-2"
primary-title
style="color:white"
>
<h4 dark>Konfirmasi</h4>
</v-card-title>
<v-card-text>
{{msgconfirmationdeleteaddr}}
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn small v-if="!checkError('deleteutama')" color="error darken-1 text-sm-left" flat @click="doDeleteAddr()">Hapus</v-btn>
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdeleteaddr = false">Batal</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialogformaddress" persistent max-width="650">
<v-card>
<v-card-title>
<span class="headline">Form Alamat Dokter</span>
</v-card-title>
<v-card-text class="pt-0 pb-0">
<v-layout wrap>
<v-flex xs12>
<v-text-field v-model="labeladdress" label="Label"></v-text-field>
<p v-if="checkError('requiredlabel')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
<p v-if="checkError('readonlyutama')" class="error pl-2 pr-2" style="color:#fff">Biarkan jadi yang utama</p>
</v-flex>
<v-flex xs12>
<v-layout row>
<v-flex xs4 pa-1>
<v-autocomplete
label="Kota"
v-model="cityaddress"
:items="xcities"
:search-input.sync="search_city"
auto-select-first
no-filter
item-text="M_CityName"
return-object
:loading="isLoading"
no-data-text="Pilih Kota"
>
<template
slot="item"
slot-scope="{ item }"
>
<v-list-tile-content>
<v-list-tile-title v-text="item.M_CityName"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
<p v-if="checkError('requiredcity')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
</v-flex>
<v-flex xs4 pa-1>
<v-select
item-text="M_DistrictName"
return-object
:items="xdistricts"
v-model="districtaddress"
label="Kecamatan*"
></v-select>
<p v-if="checkError('requireddistrict')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
</v-flex>
<v-flex xs4 pa-1>
<v-select
item-text="M_KelurahanName"
return-object
:items="xkelurahans"
v-model="kelurahanaddress"
label="Kelurahan / Desa*"
></v-select>
<p v-if="checkError('requiredkelurahan')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
</v-flex>
</v-layout>
</v-flex>
<v-flex xs12>
<v-textarea
box
label="Alamat Lengkap"
v-model="descriptionaddress"
></v-textarea>
<p v-if="checkError('requireddescription')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="dialogformaddress = false">Tutup</v-btn>
<v-btn v-if="xactaddr === 'new'" color="blue darken-1" flat @click="saveNewAddress()">Simpan</v-btn>
<v-btn v-if="xactaddr === 'edit'" color="blue darken-1" flat @click="saveEditAddress()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-card>
<v-layout row>
<v-flex xs12>
<v-subheader red--text text--lighten-1> ALAMAT DOKTER
<v-flex text-md-right>
<v-btn @click="createNewAddress()" small color="info">Baru</v-btn>
</v-flex>
</v-subheader>
<v-divider></v-divider>
<v-layout row wrap>
<v-flex xs12 pa-2>
<v-data-table
:headers="headers"
:items="xaddresses"
:loading="isLoading"
hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-center pa-2">
<v-icon color="error" @click="deleteAddress(props.item)">delete</v-icon>
<v-icon class="ml-3" color="primary" @click="editAddress(props.item)">edit</v-icon>
</td>
<td class="text-xs-left pa-2">{{ props.item.M_DoctorAddressNote}}</td>
<td class="text-xs-left pa-2">{{ props.item.M_DoctorAddressDescription}}</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-flex>
</v-flex>
</v-card>
</v-layout>
</template>
<style scoped>
</style>
<script>
module.exports = {
data: () => ({
search_city:'',
oldlabel:'',
headers: [
{
text: "AKSI",
align: "center",
sortable: false,
value: "action",
width: "10%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "LABEL",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "ALAMAT",
align: "left",
sortable: false,
value: "lab",
width: "40%",
class: "pa-1 blue lighten-3 white--text"
}
]
}),
computed: {
dialogconfirmationdeleteaddr:{
get() {
return this.$store.state.doctor.dialog_confirmation_delete_addr
},
set(val) {
this.$store.commit("doctor/update_dialog_confirmation_delete_addr",val)
}
},
msgconfirmationdeleteaddr(){
return this.$store.state.doctor.msg_confirmation_delete_addr
},
xact() {
return this.$store.state.doctor.act
},
xactaddr() {
return this.$store.state.doctor.act_addr
},
dialogformaddress:{
get() {
return this.$store.state.doctor.dialog_form_address
},
set(val) {
this.$store.commit("doctor/update_dialog_form_address",val)
}
},
isLoading() {
return this.$store.state.doctor.search_status == 1
},
xaddresses(p) {
return this.$store.state.doctor.addresses
},
xcities(){
return this.$store.state.doctor.cities
},
labeladdress:{
get() {
return this.$store.state.doctor.label_address
},
set(val) {
this.$store.commit("doctor/update_label_address",val)
}
},
cityaddress:{
get() {
return this.$store.state.doctor.city_address
},
set(val) {
this.$store.commit("doctor/update_city_address",val)
this.$store.dispatch("doctor/getdistrict",this.$store.state.doctor.city_address)
}
},
xdistricts(){
return this.$store.state.doctor.districts
},
districtaddress:{
get() {
return this.$store.state.doctor.district_address
},
set(val) {
this.$store.commit("doctor/update_district_address",val)
this.$store.dispatch("doctor/getkelurahan",this.$store.state.doctor.district_address)
}
},
xkelurahans(){
return this.$store.state.doctor.kelurahans
},
kelurahanaddress:{
get() {
return this.$store.state.doctor.kelurahan_address
},
set(val) {
this.$store.commit("doctor/update_kelurahan_address",val)
}
},
descriptionaddress:{
get() {
return this.$store.state.doctor.description_address
},
set(val) {
this.$store.commit("doctor/update_description_address",val)
}
},
},
methods : {
createNewAddress(){
this.$store.commit("doctor/update_act_addr",'new')
this.search_city = ''
this.labeladdress = ''
this.$store.commit("doctor/update_cities",[])
this.cityaddress = {}
this.$store.commit("doctor/update_districts",[])
this.districtaddress = {}
this.$store.commit("doctor/update_kelurahans",[])
this.kelurahanaddress = {}
this.descriptionaddress = ''
this.$store.commit("doctor/update_dialog_form_address",true)
},
thr_search_city: _.debounce( function () {
this.$store.dispatch("doctor/searchcity",this.search_city)
},2000),
checkError(value){
var errors = this.$store.state.doctor.errors
if(errors.includes(value)){
return true
}
else{
return false
}
},
saveNewAddress(){
this.$store.commit("doctor/update_errors",[])
var errors = this.$store.state.doctor.errors
if(this.labeladdress === ''){
errors.push("requiredlabel")
}
if(_.isEmpty(this.cityaddress)){
errors.push("requiredcity")
}
if(_.isEmpty(this.districtaddress)){
errors.push("requireddistrict")
}
if(_.isEmpty(this.kelurahanaddress)){
errors.push("requiredkelurahan")
}
if(_.isEmpty(this.descriptionaddress)){
errors.push("requireddescription")
}
if(errors.length === 0){
var prm = {}
prm.M_DoctorAddressM_DoctorID = this.$store.state.doctor.selected_doctor.M_DoctorID
prm.M_DoctorName = this.$store.state.doctor.selected_doctor.M_DoctorName
prm.M_DoctorAddressNote = this.labeladdress
prm.M_DoctorAddressDescription = this.descriptionaddress
prm.M_DoctorAddressM_KelurahanID = this.kelurahanaddress.M_KelurahanID
this.$store.dispatch("doctor/savenewaddress",prm)
}
},
editAddress(value){
this.$store.commit("doctor/update_act_addr",'edit')
this.$store.commit("doctor/update_x_addr_id",value.M_DoctorAddressID)
this.labeladdress = value.M_DoctorAddressNote
this.oldlabel = value.M_DoctorAddressNote
this.$store.commit("doctor/update_cities",[{M_CityID:value.M_CityID,M_CityName:value.M_CityName}])
this.cityaddress = {M_CityID:value.M_CityID,M_CityName:value.M_CityName}
this.$store.commit("doctor/update_districts",[{M_DistrictID:value.M_DistrictID,M_DistrictName:value.M_DistrictName}])
this.districtaddress = {M_DistrictID:value.M_DistrictID,M_DistrictName:value.M_DistrictName}
this.$store.commit("doctor/update_kelurahans",[{M_KelurahanID:value.M_DoctorAddressM_KelurahanID,M_KelurahanName:value.M_KelurahanName}])
this.kelurahanaddress = {M_KelurahanID:value.M_DoctorAddressM_KelurahanID,M_KelurahanName:value.M_KelurahanName}
this.descriptionaddress = value.M_DoctorAddressDescription
this.$store.commit("doctor/update_dialog_form_address",true)
},
saveEditAddress(){
this.$store.commit("doctor/update_errors",[])
var errors = this.$store.state.doctor.errors
if(this.labeladdress === ''){
errors.push("requiredlabel")
}
if(this.oldlabel.toLowerCase() === 'utama' && this.labeladdress.toLowerCase() !== 'utama'){
errors.push("readonlyutama")
}
if(_.isEmpty(this.cityaddress)){
errors.push("requiredcity")
}
if(_.isEmpty(this.districtaddress)){
errors.push("requireddistrict")
}
if(_.isEmpty(this.kelurahanaddress)){
errors.push("requiredkelurahan")
}
if(_.isEmpty(this.descriptionaddress)){
errors.push("requireddescription")
}
if(errors.length === 0){
var prm = {}
prm.M_DoctorAddressID = this.$store.state.doctor.x_addr_id
prm.M_DoctorAddressM_DoctorID = this.$store.state.doctor.selected_doctor.M_DoctorID
prm.M_DoctorName = this.$store.state.doctor.selected_doctor.M_DoctorName
prm.M_DoctorAddressNote = this.labeladdress
prm.M_DoctorAddressDescription = this.descriptionaddress
prm.M_DoctorAddressM_KelurahanID = this.kelurahanaddress.M_KelurahanID
this.$store.dispatch("doctor/saveeditaddress",prm)
}
},
deleteAddress(value){
this.$store.commit("doctor/update_act_addr",'delete')
this.$store.commit("doctor/update_x_addr_id",value.M_DoctorAddressID)
this.$store.commit("doctor/update_errors",[])
this.oldlabel = value.M_DoctorAddressNote
var errors = this.$store.state.doctor.errors
if(value.M_DoctorAddressNote.toLowerCase() === 'utama'){
errors.push("deleteutama")
}
var msg = ''
if(errors.includes("deleteutama")){
msg = "Biarkan yang utama tetap ada"
}
else{
msg = "Yakin, akan menghapus data alamat dokter "+value.M_DoctorAddressNote+" ?"
}
this.$store.commit("doctor/update_msg_confirmation_delete_addr",msg)
this.$store.commit("doctor/update_dialog_confirmation_delete_addr",true)
},
doDeleteAddr(){
var prm = {}
prm.M_DoctorAddressID = this.$store.state.doctor.x_addr_id
prm.M_DoctorAddressM_DoctorID = this.$store.state.doctor.selected_doctor.M_DoctorID
prm.M_DoctorName = this.$store.state.doctor.selected_doctor.M_DoctorName
prm.M_DoctorAddressNote = this.oldlabel
this.$store.dispatch("doctor/deleteaddress",prm)
}
},
watch: {
search_city(val,old) {
if (val == old ) return
if (! val) return
if (val.length < 1 ) return
if (this.$store.state.doctor.update_autocomplete_status == 1 ) return
this.thr_search_city()
}
}
}
</script>