Initial import
This commit is contained in:
269
one-ui/masterdata/one-md-staff/api/staff.js
Normal file
269
one-ui/masterdata/one-md-staff/api/staff.js
Normal file
@@ -0,0 +1,269 @@
|
||||
const URL = "/one-api/v1/masterdata/";
|
||||
|
||||
export async function search(token, name, snik, status) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/search', {
|
||||
token:token,
|
||||
nama: name,
|
||||
snik: snik,
|
||||
status: status
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getsexreg(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/getsexreg',{token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function save(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/save',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function newstaff(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/newstaff',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function xdelete(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/deletestaff',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function saveposition(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/addnewposition', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function updateposition(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/editposition', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function deleteposition(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/deleteposition', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function getaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/getaddress',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchcity(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/searchcity',{token:token,search:prm});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getsubarea(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/getsubarea',{id:prm.M_CityID,token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function savenewaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/savenewaddress',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveeditaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/saveeditaddress',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'staff/deleteaddress',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
696
one-ui/masterdata/one-md-staff/components/oneMdStaffDetail.vue
Normal file
696
one-ui/masterdata/one-md-staff/components/oneMdStaffDetail.vue
Normal file
@@ -0,0 +1,696 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-layout class="mb-2" column>
|
||||
<v-dialog v-model="dialogconfirmationdelete" 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>
|
||||
{{msgconfirmationdelete}}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small color="error darken-1 text-sm-left" flat @click="doDeleteData()">Hapus</v-btn>
|
||||
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdelete = false">Batal</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<v-subheader red--text text--lighten-1> DETAIL KARYAWAN
|
||||
<v-flex text-md-right>
|
||||
<v-btn v-if="xact === 'new'" @click="saveNewStaff()" small color="info">Simpan</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" @click="deleteData()" small color="error">Hapus</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" @click="saveData()" small color="primary">Simpan</v-btn>
|
||||
</v-flex>
|
||||
</v-subheader>
|
||||
<v-divider></v-divider>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 pa-2>
|
||||
<v-layout row>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select item-text="M_BranchName" return-object :items="xbranchs" v-model="xbranch" label="Cabang*"></v-select>
|
||||
</v-flex>
|
||||
<v-flex xs5 pa-1>
|
||||
<v-text-field v-model="xstaffname" label="Nama Karyawan*"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field v-model="xnik" label="NIK"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field v-model="xdob" label="Tanggal Lahir*" hint="format : DD-MM-YYYY , contoh : 22-06-1988"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select item-text="m_sexname" return-object :items="xsexes" v-model="xsex" label="Jenis Kelamin*"></v-select>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select item-text="M_ReligionName" return-object :items="xreligions" v-model="xreligion" label="Agama"></v-select>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-text-field v-model="xphone" label="Telepon"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-text-field v-model="xhp" label="HP"></v-text-field>
|
||||
</v-flex>
|
||||
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
|
||||
<v-flex xs12 pa-1>
|
||||
<v-text-field v-model="xaddress" label="Alamat"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs6 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 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>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs6 pa-1>
|
||||
<v-select item-text="M_SubareaName" return-object :items="xsubareas" v-model="subareaaddress" label="Sub Area"></v-select>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select item-text="M_PositionName" return-object :items="xpositions" v-model="xposition" label="Posisi"></v-select>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<span @click="addPosition" class="icon-medium-fill-base xs1 white--text primary ml-1 icon-add"></span>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field v-model="xstudy" label="Pendidikan Terakhir"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field v-model="xblood" label="Golongan Darah"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-menu ref="menustartdate" v-model="menustartdate" :close-on-content-click="false" :nudge-right="0" lazy transition="scale-transition"
|
||||
offset-y full-width max-width="290px" min-width="290px">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field v-model="startComputedDateFormatted" label="Tgl. Mulai Bekerja" readonly v-on="on" @blur="date = deFormatedDate(startComputedDateFormatted)"></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="xstartdate" no-title @input="menustartdate = false"></v-date-picker>
|
||||
</v-flex>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-menu ref="menuenddate" v-model="menuenddate" :close-on-content-click="false" :nudge-right="0" lazy transition="scale-transition"
|
||||
offset-y full-width max-width="290px" min-width="290px">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field v-model="endComputedDateFormatted" label="Tgl. Selesai" readonly v-on="on" @blur="date = deFormatedDate(endComputedDateFormatted)"></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="xenddate" no-title @input="menuenddate = false"></v-date-picker>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-text-field v-model="xtimework" label="Jam Kerja"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-text-field v-model="xtimeworksaturday" label="Jam Kerja (Sabtu)"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs6 pa-1>
|
||||
<div>
|
||||
<v-btn @click="changeBtnFlagCourier(xiscourier)" v-if="xiscourier === 'N'" small color="error">
|
||||
<v-icon left>close</v-icon> Kurir</v-btn>
|
||||
<v-btn @click="changeBtnFlagCourier(xiscourier)" v-if="xiscourier === 'Y'" small color="success">
|
||||
<v-icon left>check</v-icon> Kurir</v-btn>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-flex>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
|
||||
|
||||
<template>
|
||||
|
||||
<v-dialog v-model="dialogerrormsg" max-width="30%">
|
||||
<v-card>
|
||||
<v-card-title class="headline red en-1 pt-2 pb-2" primary-title>
|
||||
<h4 style="color:#FFEBEE">Peringatan !</h4>
|
||||
</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 v-html="errormsg" xs12>
|
||||
|
||||
</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="error" flat @click="dialogerrormsg = false">
|
||||
Tutup
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
|
||||
<v-dialog v-model="dialogposition" persistent max-width="600px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">Posisi</span>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-form ref="formposition" v-model="valid" lazy-validation>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-layout>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-text-field v-model="positionname" label="Nama"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 pa-1>
|
||||
<span @click="saveFormPosition()" class="icon-medium-fill-base xs1 white--text primary ml-1 icon-save"></span>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 pt-2 pb-1>
|
||||
<table style="
|
||||
font-family: arial, sans-serif;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
border: 0px;
|
||||
" class="px">
|
||||
<tr>
|
||||
<td style="border: 1px solid #fff;
|
||||
border-collapse: collapse;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;" width="40%" class="pa-2 blue lighten-1 white--text">POSISI
|
||||
</td>
|
||||
<td style="border: 1px solid #fff;
|
||||
border-collapse: collapse;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;" width="20%" class="pa-2 blue lighten-1 white--text">AKSI
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="mini-input" v-for="(vpx,idx) in xpositions">
|
||||
<td style="border: 1px solid #fff;
|
||||
border-collapse: collapse;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding: 8px;
|
||||
text-align:left;
|
||||
vertical-align:left;" align="left">
|
||||
<v-text-field style="margin-top:0;padidng-top:0" v-model="vpx.M_PositionName" hide-details></v-text-field>
|
||||
</td>
|
||||
<td style="border: 1px solid #fff;
|
||||
border-collapse: collapse;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding: 8px;" class="text-md-center pr-2">
|
||||
<v-icon color="blue" @click="updateFormPosition(vpx)">edit</v-icon>
|
||||
<v-icon color="#c75c3a" :disabled="vpx.used != 0" @click="deleteFormPosition(vpx)">delete</v-icon>
|
||||
</td>
|
||||
</tr>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" flat @click="updateDialogFormPosition()">Tutup</v-btn>
|
||||
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
</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 = {
|
||||
data: () => ({
|
||||
dialogerrormsg: false,
|
||||
valid: false,
|
||||
errormsg: '',
|
||||
search_city: '',
|
||||
startdate: '',
|
||||
enddate: '',
|
||||
menustartdate: false,
|
||||
menuenddate: false,
|
||||
positionname: '',
|
||||
date: new Date().toISOString().substr(0, 10)
|
||||
}),
|
||||
computed: {
|
||||
dialogconfirmationdelete: {
|
||||
get() {
|
||||
return this.$store.state.staff.dialog_confirmation_delete
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_dialog_confirmation_delete", val)
|
||||
}
|
||||
},
|
||||
msgconfirmationdelete() {
|
||||
return this.$store.state.staff.msg_confirmation_delete
|
||||
},
|
||||
xact() {
|
||||
return this.$store.state.staff.act
|
||||
},
|
||||
detail() {
|
||||
return this.$store.state.staff.selected_staff
|
||||
},
|
||||
xbranchs() {
|
||||
return this.$store.state.staff.branchs
|
||||
},
|
||||
xbranch: {
|
||||
get() {
|
||||
return this.$store.state.staff.selected_branch
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_selected_branch", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xstaffname: {
|
||||
get() {
|
||||
return this.$store.state.staff.staff_name
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_staff_name", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xnik: {
|
||||
get() {
|
||||
return this.$store.state.staff.nik
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_nik", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xdob: {
|
||||
get() {
|
||||
return this.$store.state.staff.dob
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_dob", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xsexes() {
|
||||
return this.$store.state.staff.sexes
|
||||
},
|
||||
xsex: {
|
||||
get() {
|
||||
return this.$store.state.staff.selected_sex
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_selected_sex", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xreligions() {
|
||||
return this.$store.state.staff.religions
|
||||
},
|
||||
xreligion: {
|
||||
get() {
|
||||
return this.$store.state.staff.selected_religion
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_selected_religion", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xphone: {
|
||||
get() {
|
||||
return this.$store.state.staff.phone
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_phone", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xhp: {
|
||||
get() {
|
||||
return this.$store.state.staff.hp
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_hp", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xaddress: {
|
||||
get() {
|
||||
return this.$store.state.staff.address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_address", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xcities() {
|
||||
return this.$store.state.staff.cities
|
||||
},
|
||||
cityaddress: {
|
||||
get() {
|
||||
return this.$store.state.staff.city_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_city_address", val)
|
||||
this.$store.dispatch("staff/getsubarea", this.$store.state.staff.city_address)
|
||||
}
|
||||
},
|
||||
xsubareas() {
|
||||
return this.$store.state.staff.subareas
|
||||
},
|
||||
subareaaddress: {
|
||||
get() {
|
||||
return this.$store.state.staff.subarea_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_subarea_address", val)
|
||||
}
|
||||
},
|
||||
xpositions() {
|
||||
return this.$store.state.staff.positions
|
||||
},
|
||||
xposition: {
|
||||
get() {
|
||||
return this.$store.state.staff.selected_position
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_selected_position", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xtimework: {
|
||||
get() {
|
||||
return this.$store.state.staff.timework
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_timework", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xtimeworksaturday: {
|
||||
get() {
|
||||
return this.$store.state.staff.timeworksaturday
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_timeworksaturday", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xblood: {
|
||||
get() {
|
||||
return this.$store.state.staff.blood
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_blood", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xstudy: {
|
||||
get() {
|
||||
return this.$store.state.staff.study
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_study", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xiscourier: {
|
||||
get() {
|
||||
return this.$store.state.staff.iscourier
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_iscourier", val)
|
||||
this.$store.commit("staff/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
startComputedDateFormatted() {
|
||||
return this.formatDate(this.xstartdate)
|
||||
},
|
||||
xstartdate: {
|
||||
get() {
|
||||
return this.$store.state.staff.startdate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_startdate", val)
|
||||
}
|
||||
},
|
||||
endComputedDateFormatted() {
|
||||
return this.formatDate(this.xenddate)
|
||||
},
|
||||
xenddate: {
|
||||
get() {
|
||||
return this.$store.state.staff.enddate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("staff/update_enddate", val)
|
||||
}
|
||||
},
|
||||
dialogposition() {
|
||||
return this.$store.state.staff.dialog_form_position
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
changeBtnFlagCourier(value) {
|
||||
var newval = (value === 'Y') ? 'N' : 'Y'
|
||||
this.xiscourier = newval
|
||||
},
|
||||
changeBtnFlagDefaultCourier(value) {
|
||||
var newval = (value === 'Y') ? 'N' : 'Y'
|
||||
this.xdiscourier = newval
|
||||
},
|
||||
updateDialogFormPosition() {
|
||||
this.$store.commit("staff/update_dialog_form_position", false)
|
||||
},
|
||||
addPosition() {
|
||||
this.$store.commit("staff/update_dialog_form_position", true)
|
||||
},
|
||||
saveFormPosition() {
|
||||
this.$store.dispatch("staff/saveposition", {
|
||||
name: this.positionname
|
||||
})
|
||||
this.positionname = ''
|
||||
},
|
||||
updateFormPosition(val) {
|
||||
this.$store.dispatch("staff/updateposition", {
|
||||
id: val.M_PositionID,
|
||||
name: val.M_PositionName
|
||||
})
|
||||
},
|
||||
deleteFormPosition(val) {
|
||||
this.$store.dispatch("staff/deleteposition", {
|
||||
id: val.M_PositionID
|
||||
})
|
||||
},
|
||||
saveData() {
|
||||
|
||||
var prm = {}
|
||||
prm.Nat_StaffID = this.$store.state.staff.selected_staff.Nat_StaffID
|
||||
prm.Nat_StaffM_BranchID = this.$store.state.staff.selected_branch.M_BranchID
|
||||
prm.Nat_StaffName = this.xstaffname
|
||||
prm.Nat_StaffDOB = this.xdob
|
||||
prm.Nat_StaffM_SexID = this.$store.state.staff.selected_sex.M_SexID
|
||||
prm.Nat_StaffM_ReligionID = this.$store.state.staff.selected_religion.M_ReligionID
|
||||
prm.Nat_StaffHP = this.xhp
|
||||
prm.Nat_StaffPhone = this.xphone
|
||||
prm.Nat_StaffAddress = this.xaddress
|
||||
prm.Nat_StaffNIK = this.xnik
|
||||
prm.Nat_StaffM_CityID = this.cityaddress.M_CityID
|
||||
prm.Nat_StaffM_SubareaID = this.subareaaddress.M_SubareaID
|
||||
prm.Nat_StaffM_PositionID = this.$store.state.staff.selected_position.M_PositionID
|
||||
prm.Nat_StaffStartDate = this.xstartdate
|
||||
prm.Nat_StaffEndDate = this.xenddate
|
||||
prm.Nat_StaffTimeWork = this.xtimework
|
||||
prm.Nat_StaffTimeWorkSaturday = this.xtimeworksaturday
|
||||
prm.Nat_StaffBlood = this.xblood
|
||||
prm.Nat_StaffStudy = this.xstudy
|
||||
prm.Nat_StaffIsCourier = this.xiscourier
|
||||
this.$store.dispatch("staff/save", prm)
|
||||
|
||||
},
|
||||
saveNewStaff() {
|
||||
var error_count = 0
|
||||
var error_msg = ''
|
||||
if (_.isEmpty(this.xbranch)) {
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Cabang</kbd> : Ayo, pilih salah satu cabang</p>"
|
||||
}
|
||||
|
||||
if (this.xstaffname === "") {
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Nama Karyawan</kbd> : Diisi dong nama karyawannya</p>"
|
||||
}
|
||||
|
||||
if (_.isEmpty(this.xsex)) {
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Jenis Kelamin</kbd> : Ayo, pilih salah satu jenis kelamin</p>"
|
||||
}
|
||||
|
||||
if (this.xdob === "") {
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Tanggal Lahir</kbd> : Diisi dong tanggal lahirnya</p>"
|
||||
}
|
||||
|
||||
|
||||
|
||||
var aDOB = moment(this.xdob, 'DD-MM-YYYY', true)
|
||||
var isValidDOB = aDOB.isValid()
|
||||
if (!isValidDOB) {
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Tanggal Lahir</kbd> : Diisi sesuai format dong (DD-MM-YYYY, contoh : 22-06-1988)</p>"
|
||||
}
|
||||
|
||||
if (error_count > 0) {
|
||||
this.errormsg = error_msg
|
||||
this.dialogerrormsg = true
|
||||
} else {
|
||||
var prm = {}
|
||||
prm.Nat_StaffID = 0
|
||||
prm.Nat_StaffM_BranchID = this.$store.state.staff.selected_branch.M_BranchID
|
||||
prm.Nat_StaffName = this.xstaffname
|
||||
prm.Nat_StaffDOB = this.xdob
|
||||
prm.Nat_StaffM_SexID = this.$store.state.staff.selected_sex.M_SexID
|
||||
prm.Nat_StaffM_ReligionID = this.$store.state.staff.selected_religion.M_ReligionID
|
||||
prm.Nat_StaffHP = this.xhp
|
||||
prm.Nat_StaffPhone = this.xphone
|
||||
prm.Nat_StaffAddress = this.xaddress
|
||||
prm.Nat_StaffNIK = this.xnik
|
||||
prm.Nat_StaffM_CityID = this.cityaddress.M_CityID
|
||||
prm.Nat_StaffM_SubareaID = this.subareaaddress.M_SubareaID
|
||||
prm.Nat_StaffM_PositionID = this.$store.state.staff.selected_position.M_PositionID
|
||||
prm.Nat_StaffStartDate = this.xstartdate
|
||||
prm.Nat_StaffEndDate = this.xenddate
|
||||
prm.Nat_StaffTimeWork = this.xtimework
|
||||
prm.Nat_StaffTimeWorkSaturday = this.xtimeworksaturday
|
||||
prm.Nat_StaffBlood = this.xblood
|
||||
prm.Nat_StaffStudy = this.xstudy
|
||||
prm.Nat_StaffIsCourier = this.xiscourier
|
||||
this.$store.dispatch("staff/newstaff", prm)
|
||||
}
|
||||
},
|
||||
thr_search_city: _.debounce(function () {
|
||||
this.$store.dispatch("staff/searchcity", this.search_city)
|
||||
}, 2000),
|
||||
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')}`
|
||||
},
|
||||
deleteData() {
|
||||
let msg = "Yakin, akan menghapus data pasien " + this.xstaffname + " ?"
|
||||
this.$store.commit("staff/update_msg_confirmation_delete", msg)
|
||||
this.$store.commit("staff/update_dialog_confirmation_delete", true)
|
||||
},
|
||||
doDeleteData() {
|
||||
var prm = {}
|
||||
prm.Nat_StaffID = this.$store.state.staff.selected_staff.Nat_StaffID
|
||||
prm.Nat_StaffName = this.xstaffname
|
||||
this.$store.dispatch("staff/delete", prm)
|
||||
}
|
||||
},
|
||||
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>
|
||||
295
one-ui/masterdata/one-md-staff/components/oneMdStaffList.vue
Normal file
295
one-ui/masterdata/one-md-staff/components/oneMdStaffList.vue
Normal file
@@ -0,0 +1,295 @@
|
||||
<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="xs6 ma-1" label="NIK" @keyup.enter="searchStaff" outline v-model="snik" hide-details></v-text-field>
|
||||
|
||||
<v-text-field class="xs6 ma-1" label="Nama" @keyup.enter="searchStaff" outline v-model="name" hide-details></v-text-field>
|
||||
<!--<v-select class="xs6 mini-select ma-1" :items="xstatuses"
|
||||
item-text="label"
|
||||
@change="searchStaff()"
|
||||
return-object
|
||||
v-model="xselectedstatus"
|
||||
label="Status" outline hide-details></v-select>-->
|
||||
<!--<v-btn class="xs3 ma-1" color="success" @click="searchStaff">Cari</v-btn>-->
|
||||
<span @click="setNewStaff" 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="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.Nat_StaffName }}</td>
|
||||
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.Nat_StaffNIK}}</td>
|
||||
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.Nat_StaffHP}}</td>
|
||||
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_PositionName}}</td>
|
||||
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.iskurir}}</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/getsexreg")
|
||||
this.$store.dispatch("staff/search", {
|
||||
name: this.name,
|
||||
snik: this.snik,
|
||||
status: this.xselectedstatus.value,
|
||||
lastid: -1
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
isSelected(p) {
|
||||
return p.Nat_StaffID == this.$store.state.staff.selected_staff.Nat_StaffID
|
||||
},
|
||||
searchStaff() {
|
||||
this.$store.dispatch("staff/search", {
|
||||
name: this.name,
|
||||
snik: this.snik,
|
||||
status: this.xselectedstatus.value,
|
||||
lastid: -1
|
||||
})
|
||||
},
|
||||
selectMe(sta) {
|
||||
if (this.$store.state.staff.no_save == 0) {
|
||||
this.$store.commit("staff/update_selected_staff", sta)
|
||||
this.$store.commit("staff/update_selected_branch", {
|
||||
M_BranchID: sta.Nat_StaffM_BranchID,
|
||||
M_BranchName: sta.M_BranchName
|
||||
})
|
||||
this.$store.commit("staff/update_staff_name", sta.Nat_StaffName)
|
||||
this.$store.commit("staff/update_dob", sta.Nat_StaffDOBx)
|
||||
this.$store.commit("staff/update_selected_sex", {
|
||||
M_SexID: sta.Nat_StaffM_SexID,
|
||||
m_sexname: sta.m_sexname
|
||||
})
|
||||
this.$store.commit("staff/update_address", sta.Nat_StaffAddress)
|
||||
this.$store.commit("staff/update_cities",[{M_CityID:sta.Nat_StaffM_CityID,M_CityName:sta.M_CityName}])
|
||||
this.$store.commit("staff/update_city_address",{M_CityID:sta.Nat_StaffM_CityID,M_CityName:sta.M_CityName})
|
||||
this.$store.commit("staff/update_subareas",[{M_SubareaID:sta.Nat_StaffM_SubareaID,M_SubareaName:sta.M_SubareaName}])
|
||||
this.$store.commit("staff/update_subarea_address",{M_SubareaID:sta.Nat_StaffM_SubareaID,M_SubareaName:sta.M_SubareaName})
|
||||
|
||||
this.$store.commit("staff/update_phone", sta.Nat_StaffPhone)
|
||||
this.$store.commit("staff/update_hp", sta.Nat_StaffHP)
|
||||
this.$store.commit("staff/update_selected_religion", {
|
||||
M_ReligionID: sta.Nat_StaffM_ReligionID,
|
||||
M_ReligionName: sta.M_ReligionName
|
||||
})
|
||||
this.$store.commit("staff/update_startdate", sta.Nat_StaffStartDate)
|
||||
this.$store.commit("staff/update_enddate", sta.Nat_StaffEndDate)
|
||||
this.$store.commit("staff/update_selected_position", {
|
||||
M_PositionID: sta.Nat_StaffM_PositionID,
|
||||
M_PositionName: sta.M_PositionName
|
||||
})
|
||||
this.$store.commit("staff/update_nik", sta.Nat_StaffNIK)
|
||||
this.$store.commit("staff/update_timework", sta.Nat_StaffTimeWork)
|
||||
this.$store.commit("staff/update_timeworksaturday", sta.Nat_StaffTimeWorkSaturday)
|
||||
this.$store.commit("staff/update_blood", sta.Nat_StaffBlood)
|
||||
this.$store.commit("staff/update_study", sta.Nat_StaffStudy)
|
||||
this.$store.commit("staff/update_iscourier",sta.Nat_StaffIsCourier)
|
||||
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)
|
||||
},
|
||||
setNewStaff() {
|
||||
this.$store.commit("staff/update_selected_staff", {})
|
||||
this.$store.commit("staff/update_selected_branch", {})
|
||||
this.$store.commit("staff/update_staff_name", '')
|
||||
this.$store.commit("staff/update_dob", '')
|
||||
this.$store.commit("staff/update_selected_sex", {})
|
||||
this.$store.commit("staff/update_address", '')
|
||||
this.$store.commit("staff/update_city_address", {})
|
||||
this.$store.commit("staff/update_subarea_address", {})
|
||||
this.$store.commit("staff/update_phone", '')
|
||||
this.$store.commit("staff/update_hp", '')
|
||||
this.$store.commit("staff/update_selected_religion", {})
|
||||
this.$store.commit("staff/update_startdate", '')
|
||||
this.$store.commit("staff/update_enddate", '')
|
||||
this.$store.commit("staff/update_selected_position", {})
|
||||
this.$store.commit("staff/update_nik", '')
|
||||
this.$store.commit("staff/update_timework", '')
|
||||
this.$store.commit("staff/update_timeworksaturday", '')
|
||||
this.$store.commit("staff/update_blood", '')
|
||||
this.$store.commit("staff/update_study", '')
|
||||
|
||||
this.$store.commit("staff/update_act", 'new')
|
||||
},
|
||||
closeDialogSuccess() {
|
||||
let arrstaff = this.$store.state.staff.staffs
|
||||
var idx = _.findIndex(arrstaff, item => item.Nat_StaffID === this.$store.state.staff.last_id)
|
||||
console.log(idx)
|
||||
this.$store.dispatch("staff/search", {
|
||||
name: this.name,
|
||||
snik: this.snik,
|
||||
status: this.xselectedstatus.value,
|
||||
lastid: idx
|
||||
})
|
||||
this.$store.commit("staff/update_dialog_success", false)
|
||||
}
|
||||
},
|
||||
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: '',
|
||||
snik: '',
|
||||
page: 1,
|
||||
headers: [{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "25%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NIK",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "10%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "HP",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
|
||||
{
|
||||
text: "POSISI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "SEBAGAI KURIR",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "10%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
pagination: {
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 5,
|
||||
sortBy: 'Nat_StaffName',
|
||||
totalItems: this.$store.state.staff.total_staffs
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
94
one-ui/masterdata/one-md-staff/index.php
Normal file
94
one-ui/masterdata/one-md-staff/index.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>One</title>
|
||||
<link rel="stylesheet" href="../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../libs/vendor/css/vuetify.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp" >
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background:#F5E8DF!important" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap >
|
||||
<v-flex xs6 class="left" fill-height pa-1>
|
||||
<one-md-staff-list></one-md-staff-list>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="right" fill-height pa-1>
|
||||
<one-md-staff-detail></one-md-staff-detail>
|
||||
<!-- <one-md-staff-address></one-md-staff-address> -->
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer> </one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../libs/vendor/vue.js"></script>
|
||||
<script src="../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../libs/one_global.js"></script>
|
||||
<!-- App Script -->
|
||||
<?php
|
||||
$ts = "?ts=" . Date("ymdhis");
|
||||
?>
|
||||
<script type="module">
|
||||
window.calculate_age = function (inp_dob) {
|
||||
var now = moment(new Date())
|
||||
var dob = moment(new Date(inp_dob))
|
||||
var year = now.diff(dob,'years')
|
||||
dob.add(year,'years')
|
||||
var month = now.diff(dob,'months')
|
||||
dob.add(month,'months')
|
||||
var day = now.diff(dob,'days')
|
||||
if (isNaN(year)) return ''
|
||||
return `${year} tahun ${month} bulan ${day} hari`
|
||||
}
|
||||
|
||||
|
||||
import { store } from './store.js<?php echo $ts ?>';
|
||||
//for testing
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
methods: {
|
||||
tab_selected : function(tab) {
|
||||
return this.$store.state.tab_selected == tab
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponentNoMenu.vue'),
|
||||
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
|
||||
'one-md-staff-list': httpVueLoader('./components/oneMdStaffList.vue'),
|
||||
'one-md-staff-detail': httpVueLoader('./components/oneMdStaffDetail.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
618
one-ui/masterdata/one-md-staff/modules/staff.js
Normal file
618
one-ui/masterdata/one-md-staff/modules/staff.js
Normal file
@@ -0,0 +1,618 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/staff.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id:-1,
|
||||
last_saved_id:-1,
|
||||
x_addr_id:0,
|
||||
act:'edit',
|
||||
act_addr:'new',
|
||||
get_data_status:0,
|
||||
search_staff: 0,
|
||||
search_status: 0,
|
||||
statuses:[{label:'Bukan Kurir', value:'N'},{label:'Sebagai Kurir', value:'Y'}],
|
||||
selected_status:{label:'Bukan Kurir', value:'N'},
|
||||
search_error_message: '',
|
||||
dobs:[],
|
||||
selected_dob:{},
|
||||
dob: '',
|
||||
staff_name:'',
|
||||
staffs: [],
|
||||
total_staffs:0,
|
||||
sexes:[],
|
||||
selected_sex:{},
|
||||
address:'',
|
||||
cities: [],
|
||||
city_address: {},
|
||||
subareas: [],
|
||||
subarea_address: {},
|
||||
phone:'',
|
||||
hp:'',
|
||||
branchs:[],
|
||||
selected_branch:{},
|
||||
religions:[],
|
||||
selected_religion:{},
|
||||
startdate:'',
|
||||
enddate:'',
|
||||
positions:[],
|
||||
selected_position:{},
|
||||
nik:'',
|
||||
timework:'',
|
||||
timeworksaturday:'',
|
||||
blood:'',
|
||||
study:'',
|
||||
iscourier:'N',
|
||||
total_staff: 0,
|
||||
selected_staff: {},
|
||||
save_status: 0,
|
||||
btn_save_seen: true,
|
||||
pgrs_save: false,
|
||||
save_error_message: '',
|
||||
no_save: 0,
|
||||
open_alert_confirmation:false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
dialog_success: false,
|
||||
dialog_confirmation_delete: false,
|
||||
msg_confirmation_delete: "",
|
||||
dialog_confirmation_delete_addr: false,
|
||||
msg_confirmation_delete_addr: "",
|
||||
autocomplete_status:0,
|
||||
dialog_form_address: false,
|
||||
errors:[],
|
||||
dialog_form_position: false
|
||||
},
|
||||
mutations: {
|
||||
update_x_addr_id(state, val) {
|
||||
state.x_addr_id = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_last_saved_id(state, val) {
|
||||
state.last_saved_id = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_act_addr(state, val) {
|
||||
state.act_addr = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
update_search_staff(state, staff) {
|
||||
state.search_staff = staff
|
||||
},
|
||||
update_staff_name(state, val) {
|
||||
state.staff_name = val
|
||||
},
|
||||
update_staffs(state, data) {
|
||||
state.staffs = data
|
||||
},
|
||||
update_selected_staff(state, val) {
|
||||
state.selected_staff = val
|
||||
},
|
||||
update_dob(state, val) {
|
||||
state.dob = val
|
||||
},
|
||||
update_sexes(state, val) {
|
||||
state.sexes = val
|
||||
},
|
||||
update_selected_sex(state, val) {
|
||||
state.selected_sex = val
|
||||
},
|
||||
update_address(state, val) {
|
||||
state.address = val
|
||||
},
|
||||
update_cities(state, val) {
|
||||
state.cities = val
|
||||
},
|
||||
update_city_address(state, val) {
|
||||
state.city_address = val
|
||||
},
|
||||
update_subareas(state, val) {
|
||||
state.subareas = val
|
||||
},
|
||||
update_subarea_address(state, val) {
|
||||
state.subarea_address = val
|
||||
},
|
||||
update_phone(state, val) {
|
||||
state.phone = val
|
||||
},
|
||||
update_hp(state, val) {
|
||||
state.hp = val
|
||||
},
|
||||
update_religions(state, val) {
|
||||
state.religions = val
|
||||
},
|
||||
update_selected_religion(state, val) {
|
||||
state.selected_religion = val
|
||||
},
|
||||
update_branchs(state, val) {
|
||||
state.branchs = val
|
||||
},
|
||||
update_selected_branch(state, val) {
|
||||
state.selected_branch = val
|
||||
},
|
||||
update_startdate(state, val) {
|
||||
state.startdate = val
|
||||
},
|
||||
update_enddate(state, val) {
|
||||
state.enddate = val
|
||||
},
|
||||
update_positions(state, val) {
|
||||
state.positions = val
|
||||
},
|
||||
update_selected_position(state, val) {
|
||||
state.selected_position = val
|
||||
},
|
||||
update_nik(state, val) {
|
||||
state.nik = val
|
||||
},
|
||||
update_timework(state, val) {
|
||||
state.timework = val
|
||||
},
|
||||
update_timeworksaturday(state, val) {
|
||||
state.timeworksaturday = val
|
||||
},
|
||||
update_blood(state, val) {
|
||||
state.blood = val
|
||||
},
|
||||
update_study(state, val) {
|
||||
state.study = val
|
||||
},
|
||||
update_iscourier(state, val) {
|
||||
state.iscourier = val
|
||||
},
|
||||
update_btn_save_seen(state, val) {
|
||||
state.btn_save_seen = val
|
||||
},
|
||||
update_pgrs_save(state, val) {
|
||||
state.pgrs_save = val
|
||||
},
|
||||
update_save_error_message(state, msg) {
|
||||
state.save_error_message = ''
|
||||
},
|
||||
update_no_save(state, val) {
|
||||
state.no_save = val
|
||||
},
|
||||
update_open_alert_confirmation(state, val) {
|
||||
state.open_alert_confirmation = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_dialog_success(state, val) {
|
||||
state.dialog_success = val
|
||||
},
|
||||
update_dialog_confirmation_delete(state, val) {
|
||||
state.dialog_confirmation_delete = val
|
||||
},
|
||||
update_msg_confirmation_delete(state, val) {
|
||||
state.msg_confirmation_delete = val
|
||||
},
|
||||
update_dialog_confirmation_delete_addr(state, val) {
|
||||
state.dialog_confirmation_delete_addr = val
|
||||
},
|
||||
update_msg_confirmation_delete_addr(state, val) {
|
||||
state.msg_confirmation_delete_addr = val
|
||||
},
|
||||
update_addresses(state, val) {
|
||||
state.addresses = val
|
||||
},
|
||||
update_autocomplete_status(state,val){
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_dialog_form_address(state, val) {
|
||||
state.dialog_form_address = val
|
||||
},
|
||||
update_label_address(state, val) {
|
||||
state.label_address = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_total_staffs(state, val) {
|
||||
state.total_staffs = val
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_dialog_form_position(state, val) {
|
||||
state.dialog_form_position = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_staff", 1)
|
||||
try {
|
||||
let resp = await api.search(one_token(), prm.name, prm.snik, prm.status)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_staff", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_staff", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_staffs", data.records)
|
||||
context.commit("update_total_staffs", data.total)
|
||||
context.commit("update_no_save", 0)
|
||||
if(prm.lastid === -1){
|
||||
context.commit("update_selected_staff", data.records[0])
|
||||
var sta = data.records[0]
|
||||
context.commit("update_selected_branch",{M_BranchID:sta.Nat_StaffM_BranchID,M_BranchName:sta.M_BranchName})
|
||||
context.commit("update_staff_name",sta.Nat_StaffName)
|
||||
context.commit("update_dob",sta.Nat_StaffDOBx)
|
||||
context.commit("update_selected_sex",{M_SexID:sta.Nat_StaffM_SexID,m_sexname:sta.m_sexname})
|
||||
context.commit("update_address",sta.Nat_StaffAddress)
|
||||
context.commit("update_cities",[{M_CityID:sta.Nat_StaffM_CityID,M_CityName:sta.M_CityName}])
|
||||
context.commit("update_city_address",{M_CityID:sta.Nat_StaffM_CityID,M_CityName:sta.M_CityName})
|
||||
context.commit("update_subareas",[{M_SubareaID:sta.Nat_StaffM_SubareaID,M_SubareaName:sta.M_SubareaName}])
|
||||
context.commit("update_subarea_address",{M_SubareaID:sta.Nat_StaffM_SubareaID,M_SubareaName:sta.M_SubareaName})
|
||||
context.commit("update_phone",sta.Nat_StaffPhone)
|
||||
context.commit("update_hp",sta.Nat_StaffHP)
|
||||
context.commit("update_selected_religion",{M_ReligionID:sta.Nat_StaffM_ReligionID,M_ReligionName:sta.M_ReligionName})
|
||||
context.commit("update_startdate",sta.Nat_StaffStartDate)
|
||||
context.commit("update_enddate",sta.Nat_StaffEndDate)
|
||||
context.commit("update_selected_position",{M_PositionID:sta.Nat_StaffM_PositionID,M_PositionName:sta.M_PositionName})
|
||||
context.commit("update_nik",sta.Nat_StaffNIK)
|
||||
context.commit("update_timework",sta.Nat_StaffTimeWork)
|
||||
context.commit("update_timeworksaturday",sta.Nat_StaffTimeWorkSaturday)
|
||||
context.commit("update_blood",sta.Nat_StaffBlood)
|
||||
context.commit("update_study",sta.Nat_StaffStudy)
|
||||
context.commit("update_iscourier",sta.Nat_StaffIsCourier)
|
||||
}
|
||||
else{
|
||||
context.commit("update_selected_staff", data.records[prm.lastid])
|
||||
var sta = data.records[prm.lastid]
|
||||
context.commit("update_selected_branch",{M_BranchID:sta.Nat_StaffM_BranchID,M_BranchName:sta.M_BranchName})
|
||||
context.commit("update_staff_name",sta.Nat_StaffName)
|
||||
context.commit("update_dob",sta.Nat_StaffDOBx)
|
||||
context.commit("update_selected_sex",{M_SexID:sta.Nat_StaffM_SexID,m_sexname:sta.m_sexname})
|
||||
context.commit("update_address",sta.Nat_StaffAddress)
|
||||
context.commit("update_cities",[{M_CityID:sta.Nat_StaffM_CityID,M_CityName:sta.M_CityName}])
|
||||
context.commit("update_city_address",{M_CityID:sta.Nat_StaffM_CityID,M_CityName:sta.M_CityName})
|
||||
context.commit("update_subareas",[{M_SubareaID:sta.Nat_StaffM_SubareaID,M_SubareaName:sta.M_SubareaName}])
|
||||
context.commit("update_subarea_address",{M_SubareaID:sta.Nat_StaffM_SubareaID,M_SubareaName:sta.M_SubareaName})
|
||||
context.commit("update_phone",sta.Nat_StaffPhone)
|
||||
context.commit("update_hp",sta.Nat_StaffHP)
|
||||
context.commit("update_selected_religion",{M_ReligionID:sta.Nat_StaffM_ReligionID,M_ReligionName:sta.M_ReligionName})
|
||||
context.commit("update_startdate",sta.Nat_StaffStartDate)
|
||||
context.commit("update_enddate",sta.Nat_StaffEndDate)
|
||||
context.commit("update_selected_position",{M_PositionID:sta.Nat_StaffM_PositionID,M_PositionName:sta.M_PositionName})
|
||||
context.commit("update_nik",sta.Nat_StaffNIK)
|
||||
context.commit("update_timework",sta.Nat_StaffTimeWork)
|
||||
context.commit("update_timeworksaturday",sta.Nat_StaffTimeWorkSaturday)
|
||||
context.commit("update_blood",sta.Nat_StaffBlood)
|
||||
context.commit("update_study",sta.Nat_StaffStudy)
|
||||
context.commit("update_iscourier",sta.Nat_StaffIsCourier)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_staff", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getsexreg(context) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
let resp= await api.getsexreg(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status",3)
|
||||
} else {
|
||||
context.commit("update_get_data_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_sexes",data.records.sexes)
|
||||
context.commit("update_religions",data.records.religions)
|
||||
context.commit("update_branchs",data.records.branchs)
|
||||
context.commit("update_positions",data.records.positions)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async save(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_last_id", prm.Nat_StaffID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data karyawan " + prm.Nat_StaffName + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async newstaff(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.newstaff(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
console.log(resp.data.id)
|
||||
context.commit("update_last_id", resp.data.id)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data karyawan " + prm.Nat_StaffName + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async delete(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.xdelete(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_last_id", 0)
|
||||
context.commit("update_dialog_confirmation_delete",false)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data karyawan " + prm.Nat_StaffName + " sudah dihapus dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_selected_branch", {})
|
||||
context.commit("update_staff_name", '')
|
||||
context.commit("update_dob", '')
|
||||
context.commit("update_selected_sex", {})
|
||||
context.commit("update_address", '')
|
||||
context.commit("update_city_address", {})
|
||||
context.commit("update_subarea_address", {})
|
||||
context.commit("update_phone", '')
|
||||
context.commit("update_hp", '')
|
||||
context.commit("update_selected_religion", {})
|
||||
context.commit("update_startdate", '')
|
||||
context.commit("update_enddate", '')
|
||||
context.commit("update_selected_position", {})
|
||||
context.commit("update_nik", '')
|
||||
context.commit("update_timework", '')
|
||||
context.commit("update_timeworksaturday", '')
|
||||
context.commit("update_blood", '')
|
||||
context.commit("update_study", '')
|
||||
context.commit("update_iscourier",'N')
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async saveposition(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveposition(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_errors", [])
|
||||
context.commit("update_positions", resp.data.records.positions)
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async updateposition(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.updateposition(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_positions", resp.data.records.positions)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async deleteposition(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteposition(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_positions", resp.data.records.positions)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_addresses",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async searchcity(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
let resp= await api.searchcity(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_cities",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async getsubarea(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
let resp= await api.getsubarea(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status",3)
|
||||
} else {
|
||||
context.commit("update_get_data_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_subareas",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async savenewaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.savenewaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_dialog_form_address",false)
|
||||
context.commit("update_last_id", prm.Nat_StaffAddressNat_StaffID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Penambahan data alamat karyawan " + prm.Nat_StaffName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async saveeditaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.saveeditaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_dialog_form_address",false)
|
||||
context.commit("update_last_id", prm.Nat_StaffAddressNat_StaffID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Perubahan data alamat karyawan " + prm.Nat_StaffName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async deleteaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.deleteaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_dialog_confirmation_delete_addr",false)
|
||||
context.commit("update_last_id", prm.Nat_StaffAddressNat_StaffID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Penghapusan data alamat "+prm.Nat_StaffAddressNote+" dari karyawan " + prm.Nat_StaffName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
one-ui/masterdata/one-md-staff/store.js
Normal file
27
one-ui/masterdata/one-md-staff/store.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import staff from "./modules/staff.js";
|
||||
import system from "../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
staff: staff,
|
||||
system: system
|
||||
},
|
||||
state: {
|
||||
tab_selected: 'staff'
|
||||
},
|
||||
mutations: {
|
||||
change_tab(state, ntab) {
|
||||
state.tab_selected = ntab
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
change_tab(context, ntab) {
|
||||
context.commit('change_tab', ntab)
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user