Initial import
This commit is contained in:
@@ -0,0 +1,240 @@
|
||||
<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-text-field class="xs9 ma-1"
|
||||
label=""
|
||||
placeholder="Nama"
|
||||
single-line
|
||||
outline
|
||||
v-model="name"
|
||||
hide-details
|
||||
></v-text-field>
|
||||
|
||||
|
||||
<v-btn class="xs6 ma-1" color="success" @click="searchDoctor" >Cari</v-btn>
|
||||
|
||||
</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="staffs"
|
||||
:loading="isLoading"
|
||||
:pagination.sync="pagination"
|
||||
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.M_StaffName }}</td>
|
||||
<td class="text-xs-right pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<div>
|
||||
<v-btn @click="addToHomeService(props.item,'select')" v-if="props.item.status === 0 || props.item.status === '0'" small color="error"><v-icon left>close</v-icon> Belum dipilih</v-btn>
|
||||
<v-btn v-if="props.item.status > 0" flat small color="success"><v-icon left>check</v-icon> Sudah terpilih</v-btn>
|
||||
</div>
|
||||
</td>
|
||||
</template>
|
||||
<template>
|
||||
<div class="text-xs-center">
|
||||
<v-pagination
|
||||
v-model="page"
|
||||
:length="15"
|
||||
:total-visible="7"
|
||||
></v-pagination>
|
||||
</div>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<one-dialog-alert :status="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()" @close-dialog-alert="closeAlertConfirmation()"></one-dialog-alert>
|
||||
</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("staff/search",{
|
||||
name:this.name,
|
||||
lastid:-1
|
||||
})
|
||||
},
|
||||
methods : {
|
||||
isSelected(p) {
|
||||
return p.M_StaffID == this.$store.state.staff.selected_staff.M_StaffID
|
||||
},
|
||||
searchDoctor() {
|
||||
this.$store.dispatch("staff/search",{
|
||||
name:this.name,
|
||||
status: this.xselectedstatus.value,
|
||||
lastid:-1
|
||||
})
|
||||
},
|
||||
selectMe(staff) {
|
||||
if(this.$store.state.staff.no_save == 0 ){
|
||||
this.$store.commit("staff/update_selected_staff",staff)
|
||||
this.$store.commit("staff/update_act",'edit')
|
||||
}else{
|
||||
this.$store.commit("staff/update_open_alert_confirmation",true)
|
||||
}
|
||||
|
||||
},
|
||||
closeAlertConfirmation(){
|
||||
this.$store.commit("staff/update_open_alert_confirmation",false)
|
||||
},
|
||||
forgetAlertConfirmation(){
|
||||
this.$store.commit("staff/update_no_save",0)
|
||||
this.$store.commit("staff/update_open_alert_confirmation",false)
|
||||
},
|
||||
updateAlert_success(val){
|
||||
this.$store.commit("staff/update_alert_success",val)
|
||||
},
|
||||
setNewDoctor(){
|
||||
this.$store.commit("staff/update_selected_staff",{})
|
||||
this.$store.commit("staff/update_preffix",'')
|
||||
this.$store.commit("staff/update_staff_name",'')
|
||||
this.$store.commit("staff/update_suffix",'')
|
||||
this.$store.commit("staff/update_selected_sex",{})
|
||||
this.$store.commit("staff/update_selected_religion",{})
|
||||
this.$store.commit("staff/update_phone",'')
|
||||
this.$store.commit("staff/update_email",'')
|
||||
this.$store.commit("staff/update_hp",'')
|
||||
this.$store.commit("staff/update_pj",'N')
|
||||
this.$store.commit("staff/update_dpj",'N')
|
||||
this.$store.commit("staff/update_clinic",'N')
|
||||
this.$store.commit("staff/update_marketing_confirm",'N')
|
||||
this.$store.commit("staff/update_is_default",'N')
|
||||
this.$store.commit("staff/update_addresses",[])
|
||||
|
||||
this.$store.commit("staff/update_act",'new')
|
||||
},
|
||||
closeDialogSuccess(){
|
||||
let arrstaff = this.$store.state.staff.staffs
|
||||
var idx = _.findIndex(arrstaff, item => item.M_StaffID === this.$store.state.staff.last_id)
|
||||
console.log(idx)
|
||||
this.$store.dispatch("staff/search",{
|
||||
name:this.name,
|
||||
status: this.xselectedstatus.value,
|
||||
lastid: idx
|
||||
})
|
||||
this.$store.commit("staff/update_dialog_success",false)
|
||||
},
|
||||
addToHomeService(value,act){
|
||||
value.searchname = this.name
|
||||
this.$store.dispatch("staff/settohomeservice",value)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialogsuccess: {
|
||||
get() {
|
||||
return this.$store.state.staff.dialog_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_dialog_success",val)
|
||||
}
|
||||
},
|
||||
msgsuccess(){
|
||||
return this.$store.state.staff.msg_success
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.staff.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_alert_success",val)
|
||||
}
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.staff.search_status == 1
|
||||
},
|
||||
xstatuses() {
|
||||
return this.$store.state.staff.statuses
|
||||
},
|
||||
xselectedstatus: {
|
||||
get() {
|
||||
return this.$store.state.staff.selected_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_selected_status",val)
|
||||
}
|
||||
},
|
||||
staffs() {
|
||||
return this.$store.state.staff.staffs
|
||||
},
|
||||
openalertconfirmation: {
|
||||
get() {
|
||||
return this.$store.state.staff.open_alert_confirmation
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_open_alert_confirmation",val)
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
msgalertconfirmation:"Perubahan yang telah dilakukan belum disimpan dong !",
|
||||
items: [],
|
||||
name: '',
|
||||
page:1,
|
||||
headers: [
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "M_StaffName",
|
||||
width: "25%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "right",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
pagination:{
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
sortBy: 'M_StaffName',
|
||||
totalItems: this.$store.state.staff.total_staffs
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,292 @@
|
||||
<template>
|
||||
<v-layout column >
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<v-subheader red--text text--lighten-1> STAF HOME SERVICE
|
||||
<!--<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="xhomeservicestaffs"
|
||||
: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="deleteStaff(props.item)">delete</v-icon>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">{{ props.item.M_StaffName}}</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: "5%",
|
||||
class: "pa-1 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "STAF",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "20%",
|
||||
class: "pa-1 blue lighten-3 white--text"
|
||||
}
|
||||
]
|
||||
}),
|
||||
computed: {
|
||||
dialogconfirmationdeleteaddr:{
|
||||
get() {
|
||||
return this.$store.state.staff.dialog_confirmation_delete_addr
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_dialog_confirmation_delete_addr",val)
|
||||
}
|
||||
},
|
||||
msgconfirmationdeleteaddr(){
|
||||
return this.$store.state.staff.msg_confirmation_delete_addr
|
||||
},
|
||||
xact() {
|
||||
return this.$store.state.staff.act
|
||||
},
|
||||
xactaddr() {
|
||||
return this.$store.state.staff.act_addr
|
||||
},
|
||||
dialogformaddress:{
|
||||
get() {
|
||||
return this.$store.state.staff.dialog_form_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_dialog_form_address",val)
|
||||
}
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.staff.search_status == 1
|
||||
},
|
||||
xhomeservicestaffs() {
|
||||
return this.$store.state.staff.homeservice_staffs
|
||||
},
|
||||
xcities(){
|
||||
return this.$store.state.staff.cities
|
||||
},
|
||||
labeladdress:{
|
||||
get() {
|
||||
return this.$store.state.staff.label_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_label_address",val)
|
||||
}
|
||||
},
|
||||
cityaddress:{
|
||||
get() {
|
||||
return this.$store.state.staff.city_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_city_address",val)
|
||||
this.$store.dispatch("staff/getdistrict",this.$store.state.staff.city_address)
|
||||
}
|
||||
},
|
||||
xdistricts(){
|
||||
return this.$store.state.staff.districts
|
||||
},
|
||||
districtaddress:{
|
||||
get() {
|
||||
return this.$store.state.staff.district_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_district_address",val)
|
||||
this.$store.dispatch("staff/getkelurahan",this.$store.state.staff.district_address)
|
||||
}
|
||||
},
|
||||
xkelurahans(){
|
||||
return this.$store.state.staff.kelurahans
|
||||
},
|
||||
kelurahanaddress:{
|
||||
get() {
|
||||
return this.$store.state.staff.kelurahan_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_kelurahan_address",val)
|
||||
}
|
||||
},
|
||||
descriptionaddress:{
|
||||
get() {
|
||||
return this.$store.state.staff.description_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_description_address",val)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods : {
|
||||
createNewAddress(){
|
||||
this.$store.commit("staff/update_act_addr",'new')
|
||||
this.search_city = ''
|
||||
this.labeladdress = ''
|
||||
this.$store.commit("staff/update_cities",[])
|
||||
this.cityaddress = {}
|
||||
this.$store.commit("staff/update_districts",[])
|
||||
this.districtaddress = {}
|
||||
this.$store.commit("staff/update_kelurahans",[])
|
||||
this.kelurahanaddress = {}
|
||||
this.descriptionaddress = ''
|
||||
this.$store.commit("staff/update_dialog_form_address",true)
|
||||
},
|
||||
thr_search_city: _.debounce( function () {
|
||||
this.$store.dispatch("staff/searchcity",this.search_city)
|
||||
},2000),
|
||||
checkError(value){
|
||||
var errors = this.$store.state.staff.errors
|
||||
if(errors.includes(value)){
|
||||
return true
|
||||
}
|
||||
else{
|
||||
return false
|
||||
}
|
||||
},
|
||||
saveNewAddress(){
|
||||
this.$store.commit("staff/update_errors",[])
|
||||
var errors = this.$store.state.staff.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.staff.selected_doctor.M_DoctorID
|
||||
prm.M_DoctorName = this.$store.state.staff.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("staff/savenewaddress",prm)
|
||||
}
|
||||
},
|
||||
editAddress(value){
|
||||
this.$store.commit("staff/update_act_addr",'edit')
|
||||
this.$store.commit("staff/update_x_addr_id",value.M_DoctorAddressID)
|
||||
this.labeladdress = value.M_DoctorAddressNote
|
||||
this.oldlabel = value.M_DoctorAddressNote
|
||||
this.$store.commit("staff/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("staff/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("staff/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("staff/update_dialog_form_address",true)
|
||||
},
|
||||
saveEditAddress(){
|
||||
this.$store.commit("staff/update_errors",[])
|
||||
var errors = this.$store.state.staff.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.staff.x_addr_id
|
||||
prm.M_DoctorAddressM_DoctorID = this.$store.state.staff.selected_doctor.M_DoctorID
|
||||
prm.M_DoctorName = this.$store.state.staff.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("staff/saveeditaddress",prm)
|
||||
}
|
||||
},
|
||||
deleteAddress(value){
|
||||
this.$store.commit("staff/update_act_addr",'delete')
|
||||
this.$store.commit("staff/update_x_addr_id",value.M_DoctorAddressID)
|
||||
this.$store.commit("staff/update_errors",[])
|
||||
this.oldlabel = value.M_DoctorAddressNote
|
||||
var errors = this.$store.state.staff.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("staff/update_msg_confirmation_delete_addr",msg)
|
||||
this.$store.commit("staff/update_dialog_confirmation_delete_addr",true)
|
||||
},
|
||||
doDeleteAddr(){
|
||||
var prm = {}
|
||||
prm.M_DoctorAddressID = this.$store.state.staff.x_addr_id
|
||||
prm.M_DoctorAddressM_DoctorID = this.$store.state.staff.selected_doctor.M_DoctorID
|
||||
prm.M_DoctorName = this.$store.state.staff.selected_doctor.M_DoctorName
|
||||
prm.M_DoctorAddressNote = this.oldlabel
|
||||
this.$store.dispatch("staff/deleteaddress",prm)
|
||||
},
|
||||
deleteStaff(value){
|
||||
value.searchname = this.name
|
||||
this.$store.dispatch("staff/settohomeservice",value)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
search_city(val,old) {
|
||||
if (val == old ) return
|
||||
if (! val) return
|
||||
if (val.length < 1 ) return
|
||||
if (this.$store.state.staff.update_autocomplete_status == 1 ) return
|
||||
this.thr_search_city()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user