365 lines
13 KiB
Vue
365 lines
13 KiB
Vue
<template>
|
|
<div>
|
|
<patient-not-chosee-dialog></patient-not-chosee-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 -->
|
|
<v-card-title
|
|
class="teal lighten-2 white--text pt-2 pb-2"
|
|
primary-title
|
|
>
|
|
FORM KLINIK
|
|
</v-card-title>
|
|
<v-card-text class="pt-2 pb-2">
|
|
<v-layout pt-2 row>
|
|
<v-flex xs6 pr-3>
|
|
<v-layout row wrap>
|
|
<v-flex xs8 pr-1>
|
|
<v-text-field
|
|
:value="patient.M_PatientNoReg"
|
|
readonly
|
|
label="No Reg"
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex xs4 pl-1>
|
|
<v-menu
|
|
v-model="menufilterdate"
|
|
: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
|
|
v-model="filterComputedDateFormatted"
|
|
class="ma-1"
|
|
label="Tanggal Order"
|
|
hide-details
|
|
readonly
|
|
v-on="on"
|
|
@blur="date = deFormatedDate(filterComputedDateFormatted)"></v-text-field>
|
|
</template>
|
|
<v-date-picker no-title
|
|
v-model="xdate" @input="menufilterdate = false"></v-date-picker>
|
|
</v-menu>
|
|
</v-flex>
|
|
<v-flex xs8 pr-1>
|
|
<v-text-field
|
|
placeholder=""
|
|
:value="patient.M_PatientName"
|
|
label="Nama Pasien"
|
|
readonly
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex xs4 pl-1>
|
|
<v-text-field
|
|
placeholder=""
|
|
:value="patient_dob"
|
|
label="DOB"
|
|
readonly
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex xs12>
|
|
<v-textarea
|
|
auto-grow
|
|
rows="4"
|
|
:value="patient.M_PatientAddress"
|
|
readonly
|
|
label="Alamat">
|
|
</v-textarea>
|
|
</v-flex>
|
|
<v-flex xs12>
|
|
<v-select
|
|
v-model="selected_company"
|
|
:items="company"
|
|
item-value="M_PatientTypeID"
|
|
item-text="M_PatientTypeName"
|
|
label="Company"
|
|
return-object
|
|
>
|
|
</v-select>
|
|
<p v-if="checkError('requirecompany')" class="error pl-2 pr-2" style="color:#fff">Pilih company dulu</p>
|
|
</v-flex>
|
|
<v-flex xs12>
|
|
<v-select
|
|
v-model="selected_nurse"
|
|
:items="nurse"
|
|
item-value="A_NurseID"
|
|
item-text="A_NurseName"
|
|
label="Perawat"
|
|
return-object
|
|
>
|
|
</v-select>
|
|
<p v-if="checkError('requirenurse')" class="error pl-2 pr-2" style="color:#fff">Pilih perawat dulu</p>
|
|
</v-flex>
|
|
<v-flex xs12>
|
|
<v-select
|
|
v-model="selected_doctor"
|
|
:items="doctor"
|
|
item-value="A_DoctorID"
|
|
item-text="A_DoctorName"
|
|
label="Dokter"
|
|
return-object
|
|
>
|
|
</v-select>
|
|
<p v-if="checkError('requiredokter')" class="error pl-2 pr-2" style="color:#fff">Pilih dokter dulu</p>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-flex>
|
|
<v-flex xs6 pl-3>
|
|
<v-layout row wrap>
|
|
<v-flex xs12>
|
|
<v-text-field
|
|
v-model="keluhan"
|
|
label="keluhan"
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex xs12>
|
|
<v-text-field
|
|
v-model="objective"
|
|
label="Obyektif"
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex xs12>
|
|
<v-textarea
|
|
auto-grow
|
|
rows="4"
|
|
v-model="kesimpulan"
|
|
label="Kesimpulan">
|
|
</v-textarea>
|
|
</v-flex>
|
|
<v-flex xs12>
|
|
<v-textarea
|
|
auto-grow
|
|
rows="4"
|
|
v-model="saran"
|
|
label="Saran">
|
|
</v-textarea>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn
|
|
dark
|
|
color="teal"
|
|
@click="save_clinic()"
|
|
>
|
|
Simpan
|
|
</v-btn>
|
|
</v-card-actions>
|
|
</div>
|
|
</template>
|
|
<style scoped>
|
|
.v-dialog__container {
|
|
display: block !important;
|
|
}
|
|
</style>
|
|
<script>
|
|
module.exports = {
|
|
components : {
|
|
'patient-not-chosee-dialog': httpVueLoader('./patientNotChoseeDialog.vue')
|
|
},
|
|
data() {
|
|
return {
|
|
keluhan: "",
|
|
objective: "",
|
|
kesimpulan: "",
|
|
saran: "",
|
|
menufilterdate: false,
|
|
date: new Date().toISOString().substr(0, 10),
|
|
clr: "success",
|
|
}
|
|
},
|
|
mounted () {
|
|
this.$store.dispatch('patient/getcompanyclinic')
|
|
this.$store.dispatch('patient/getnurseclinic')
|
|
this.$store.dispatch('patient/getdoctorclinic')
|
|
},
|
|
computed: {
|
|
patient() {
|
|
return this.$store.state.patient.selected_patient
|
|
},
|
|
patient_dob () {
|
|
try {
|
|
return this.$store.state.patient.selected_patient.M_PatientDOB.split('-').reverse().join('-')
|
|
} catch (e) {
|
|
}
|
|
|
|
},
|
|
errors: {
|
|
get() {
|
|
return this.$store.state.patient.errors
|
|
},
|
|
set(val) {
|
|
this.$store.commit('patient/update_errors',val)
|
|
}
|
|
},
|
|
company() {
|
|
return this.$store.state.patient.company
|
|
},
|
|
selected_company: {
|
|
get () {
|
|
return this.$store.state.patient.selected_company
|
|
},
|
|
set (val) {
|
|
this.$store.commit('patient/update_selected_company', val)
|
|
}
|
|
},
|
|
nurse() {
|
|
return this.$store.state.patient.nurse
|
|
},
|
|
selected_nurse: {
|
|
get () {
|
|
return this.$store.state.patient.selected_nurse
|
|
},
|
|
set (val) {
|
|
this.$store.commit('patient/update_selected_nurse', val)
|
|
}
|
|
},
|
|
doctor() {
|
|
return this.$store.state.patient.doctor
|
|
},
|
|
selected_doctor: {
|
|
get () {
|
|
return this.$store.state.patient.selected_doctor
|
|
},
|
|
set (val) {
|
|
this.$store.commit('patient/update_selected_doctor', val)
|
|
}
|
|
},
|
|
filterComputedDateFormatted () {
|
|
return this.formatDate(this.xdate)
|
|
},
|
|
xdate : {
|
|
get() {
|
|
return this.$store.state.patient.date
|
|
},
|
|
set(val) {
|
|
this.$store.commit("patient/update_date",val)
|
|
}
|
|
},
|
|
snackbar: {
|
|
get() {
|
|
return this.$store.state.patient.alert_success
|
|
},
|
|
set(val) {
|
|
this.$store.commit("patient/update_alert_success", val)
|
|
}
|
|
},
|
|
msgsnackbar() {
|
|
return this.$store.state.patient.msg_success
|
|
},
|
|
dialog_error: {
|
|
get() {
|
|
return this.$store.state.patient.alert_error
|
|
},
|
|
set(val) {
|
|
this.$store.commit("patient/update_alert_error", val)
|
|
},
|
|
},
|
|
msgError() {
|
|
return this.$store.state.patient.error_message
|
|
},
|
|
},
|
|
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')}`
|
|
},
|
|
checkError(value) {
|
|
var errors = this.$store.state.patient.errors
|
|
if (errors.includes(value)) {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
},
|
|
resetAllInput() {
|
|
this.xdate = ""
|
|
this.$store.state.patient.selected_patient = ""
|
|
this.selected_nurse = ""
|
|
this.selected_company = ""
|
|
this.selected_doctor = ""
|
|
this.keluhan = ""
|
|
this.objective = ""
|
|
this.kesimpulan = ""
|
|
this.saran = ""
|
|
},
|
|
save_clinic() {
|
|
this.$store.commit("patient/update_errors", [])
|
|
var errors = this.$store.state.patient.errors
|
|
|
|
if (_.isEmpty(this.selected_company)) {
|
|
errors.push("requirecompany")
|
|
}
|
|
if (_.isEmpty(this.selected_nurse)) {
|
|
errors.push("requirenurse")
|
|
}
|
|
if (_.isEmpty(this.selected_doctor)) {
|
|
errors.push("requiredokter")
|
|
}
|
|
|
|
if (errors.length === 0) {
|
|
if (this.$store.state.patient.selected_patient.M_PatientID == "" ||
|
|
this.$store.state.patient.selected_patient.M_PatientID == 0 ||
|
|
this.$store.state.patient.selected_patient.M_PatientID == undefined) {
|
|
this.$store.commit('patient/update_dialogchosee', true);
|
|
} else {
|
|
let prm = {
|
|
orderDate: this.xdate,
|
|
M_PatientID: this.$store.state.patient.selected_patient.M_PatientID,
|
|
NurseID: this.selected_nurse.A_NurseID,
|
|
M_CompanyID: this.selected_company.M_PatientTypeID,
|
|
Keluhan: this.keluhan,
|
|
Objective: this.objective,
|
|
Kesimpulan: this.kesimpulan,
|
|
Saran: this.saran
|
|
}
|
|
|
|
// console.log(prm)
|
|
this.$store.dispatch("patient/addclinic", prm)
|
|
this.resetAllInput()
|
|
}
|
|
}
|
|
}
|
|
},
|
|
watch : {
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|