Initial import

This commit is contained in:
sas.fajri
2026-05-25 20:01:37 +07:00
commit 710d7c1b97
10371 changed files with 2381698 additions and 0 deletions

10
one-ui/.vscode/sftp.json vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"name": "Bandung Raya",
"host": "bandungraya.aplikasi.web.id",
"protocol": "sftp",
"port": 22,
"username": "regional",
"password": "sasone102938",
"remotePath": "/home/regional/project/regional/one-ui",
"uploadOnSave": false
}

View File

@@ -0,0 +1,75 @@
<template>
<v-menu
v-model="menu2"
:close-on-content-click="false"
:nudge-right="40"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<v-text-field
slot="activator"
v-model="computedDateFormatted"
:label=init_label
hint="DD-MM-YYYY format"
persistent-hint
readonly
></v-text-field>
<v-date-picker v-model="init_date" no-title @input="menu2 = false"></v-date-picker>
</v-menu>
</template>
<script>
module.exports = {
props : ['label', 'date', 'data'],
data () {
return {
init_date: this.date ? this.date : new Date().toISOString().substr(0, 10),
dateFormatted: this.formatDate(new Date().toISOString().substr(0, 10)),
menu1: false,
menu2: false,
init_label: this.label ? this.label : 'Date',
init_data: this.data ? this.data : ''
}
},
computed: {
computedDateFormatted () {
return this.formatDate(this.init_date)
}
},
watch: {
init_date (n, o) {
this.dateFormatted = this.formatDate(this.init_date)
this.$emit('change', {"old_date":o, "new_date":n, "data":this.init_data});
}
},
methods: {
formatDate (date) {
if (!date) return null
const [year, month, day] = date.split('-')
return `${day}-${month}-${year}`
},
parseDate (date) {
if (!date) return null
const [month, day, year] = date.split('/')
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
},
emitChange (n, o) {
console.log("old:"+o)
console.log("new:"+n)
}
}
}
</script>

View File

@@ -0,0 +1,80 @@
<template>
<v-dialog
v-model="dialog"
max-width="30%"
>
<v-card>
<v-card-title
class="headline grey lighten-2 pt-2 pb-2"
primary-title
>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pt-2 pr-2 xs12>
{{xmsg}}
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-btn
color="error"
flat
@click="forgetAlert()"
>
Abaikan
</v-btn>
<v-spacer></v-spacer>
<v-btn
color="primary"
flat
@click="closeAlert()"
>
OK
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped>
</style>
<script>
module.exports = {
props : ['status', 'msg'],
computed : {
xmsg() {
return this.msg
},
dialog: {
get() {
return this.status
},
set(val) {
this.$emit('close-dialog-alert')
}
}
},
methods: {
closeAlert() {
this.$emit('close-dialog-alert')
},
forgetAlert() {
this.$emit('forget-dialog-alert')
}
}
}
</script>

View File

@@ -0,0 +1,56 @@
<template>
<v-dialog
v-model="dialog"
max-width="30%"
>
<v-card>
<v-card-title
class="headline grey lighten-2 pt-2 pb-2"
primary-title
>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2" v-html="xmsg">
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-btn
color="primary"
flat
@click="closeAlertValidation()"
>
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped>
</style>
<script>
module.exports = {
props : ['status', 'msg'],
computed : {
xmsg() {
return this.msg
},
dialog: {
get() {
return this.status
},
set(val) {
this.$emit('close-dialog-alert-validation')
}
}
},
methods: {
closeAlertValidation() {
this.$emit('close-dialog-alert-validation')
}
}
}
</script>

View File

@@ -0,0 +1,49 @@
<template>
<v-layout row justify-center>
<v-dialog v-model="dialog" persistent max-width="290">
<v-card>
<v-card-title class="headline">Konfirmasi</v-card-title>
<v-card-text>{{ init_text }}</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="green darken-1" flat @click="dialog = false">Batal</v-btn>
<v-btn color="green darken-1" dark @click="confirm">{{ init_button_confirm }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-layout>
</template>
<script>
module.exports = {
props : ['text', 'data', 'button_confirm'],
data () {
return {
init_text : this.text ? this.text : 'Apakah anda akan menghapus data tersebut ?',
init_data : this.data ? this.data : null,
init_button_confirm : this.button_confirm ? this.button_confirm : 'Hapus'
}
},
computed : {
dialog : {
get () {
return this.$store.state.dialog_confirm
},
set (v) {
this.$store.commit('update_dialog_confirm', v)
}
}
},
methods : {
confirm : function() {
this.dialog = false
console.log('Confirm dialog : confirmed')
this.$emit('confirm', {data: this.init_data});
}
}
}
</script>

View File

@@ -0,0 +1,71 @@
<template>
<v-dialog
v-model="dialog"
max-width="30%"
>
<v-card>
<v-card-title
class="headline error pt-2 pb-2"
primary-title
dark
>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 xs12>
<v-layout row>
<v-flex v-html="xmsg" pt-2 pr-2 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="primary"
flat
@click="closeError()"
>
OK
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped>
</style>
<script>
module.exports = {
props : ['status', 'msg'],
computed : {
xmsg() {
return this.msg
},
dialog: {
get() {
return this.status
},
set(val) {
this.$emit('close-dialog-error')
}
}
},
methods: {
closeError() {
this.$emit('close-dialog-error')
}
}
}
</script>

View File

@@ -0,0 +1,70 @@
<template>
<v-dialog
v-model="dialog"
max-width="30%"
>
<v-card>
<v-card-title
class="headline info pt-2 pb-2"
primary-title
>
Informasi
</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 v-html="xmsg" pt-2 pr-2 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="primary"
flat
@click="closeInfo()"
>
OK
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped>
</style>
<script>
module.exports = {
props : ['status', 'msg'],
computed : {
xmsg() {
return this.msg
},
dialog: {
get() {
return this.status
},
set(val) {
this.$emit('close-dialog-info')
}
}
},
methods: {
closeInfo() {
this.$emit('close-dialog-info')
}
}
}
</script>

View File

@@ -0,0 +1,63 @@
<template>
<v-dialog
v-model="dialog"
scrollable fullscreen
persistent
transition="dialog-transition"
>
<v-card
color="transparent"
dark
>
<v-card-text>
<v-layout row wrap class="vertical-center">
<v-flex xs4>&nbsp;</v-flex>
<v-flex xs4>
<v-card color="primary">
<v-card-text>
Mohon tunggu sebentar ...
<v-progress-linear
indeterminate
color="white"
class="mb-0"
></v-progress-linear>
</v-card-text>
</v-card>
</v-flex>
<v-flex xs4>&nbsp;</v-flex>
</v-layout>
</v-card-text>
</v-card>
</v-dialog>
</template>
<style>
.transparent {
background-color: rgba(255, 255, 255, 0.35) !important;
border-color: transparent!important;
}
.vertical-center {
margin-top: 20%
}
</style>
<script>
module.exports = {
data () {
return {
}
},
computed : {
dialog : {
get () { return this.$store.state.dialog_loading },
set (v) { this.$store.commit('update_dialog_loading', v) }
}
}
}
</script>

View File

@@ -0,0 +1,76 @@
<template>
<v-dialog
v-model="dialog"
width="1000px"
>
<v-card>
<v-card-title
class="headline grey lighten-2 pt-2 pb-2"
primary-title
>
Laporan
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout>
<v-flex xs12>
<object data="https://anggrek.aplikasi.web.id/one-ui/test/vuex/common/under-cons.pdf"
width="100%"></object>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="primary"
@click="dialog = false"
flat
>
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped>
</style>
<script>
module.exports = {
components : {
},
methods : {
tuing: function() {
alert('x')
},
processMee () {
this.$store.dispatch('order/process')
}
},
computed : {
dialog: {
get() {
return this.$store.state.order.confirm_process_dialog_is_active;
},
set(val) {
this.$store.commit('order/update_confirm_process_dialog_is_active', val);
}
},
queue_number () {
return this.$store.state.order.queue_number
}
}
}
</script>

View File

@@ -0,0 +1,71 @@
<template>
<div class="text-xs-center">
<v-dialog
v-model="dialog"
:width="xwidth"
persistent
>
<v-card >
<v-card-title
class="headline grey lighten-2"
primary-title
>
{{xtitle}}
</v-card-title>
<v-card-text >
<object style="overflow: hidden;" width="100%" :height="xheight" :data="xurl"></object>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="primary"
flat
@click="closeDialog()"
>
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<style scoped>
</style>
<script>
module.exports = {
props : ['title','width','height','status','urlprint'],
computed : {
dialog: {
get() {
return this.status
},
set(val) {
this.status = val
}
},
xurl(){
return this.urlprint
},
xwidth(){
return this.width
},
xheight(){
return this.height
},
xtitle(){
return this.title
}
},
methods: {
closeDialog() {
this.$emit('close-dialog-print')
}
}
}
</script>

View File

@@ -0,0 +1,121 @@
<template>
<v-layout>
<v-checkbox
v-model="init_value"
@change="changeLahBrooo"
hide-details class="shrink mr-2"
></v-checkbox>
<v-text-field
:label="__label"
placeholder="Alasan"
outline
:disabled=x_disabled
:error-messages="init_error ? x_error_messages : ''"
:error_count="init_error ? x_error_count : 0 "
:error=init_error
:hide-details=!init_error
v-model=init_note
></v-text-field>
</v-layout>
</template>
<script>
module.exports = {
props : ['label', 'value', 'is_error', 'note'],
mounted: function() {
this.$nextTick( function() {
this.init_note = this.note ? this.note : "";
this.init_value = this.value;
})
},
data () {
return {
init_value : false,
init_note : ""
}
},
methods : {
changeLahBrooo (n, o) {
if (n) {
this.init_note = "";
// this.init_error = false;
} /* else {
if (this.init_note.length < 1)
this.init_error = true;
else
this.init_error = false;
}*/
var prm = {checked: n, note: this.init_note, error: this.init_error};
this.$emit('x_change',prm);
console.log('emit change');
// this.x_note = "aaaaaaaaaaaaaaaaaaa"
// alert(this.x_note)
}
},
computed : {
__label () {
if (this.label)
return this.label;
return "";
},
x_disabled () {
// return false;
if (this.init_value === "true" || this.init_value === true)
return true;
return false;
},
init_error () {
if ((this.init_value === "false" || this.init_value === false) && this.init_note.length < 1)
return true;
else {
// this.x_note = "";
return false;
}
},
x_error_count () {
// return 0;
if (this.init_error)
return 1;
return 0;
},
x_error_messages () {
if (this.init_error)
return ["Kolom ini harus diisi !"];
return [];
},
x_note () {
if (this.note)
return this.note;
return "";
}
}
}
</script>

View File

@@ -0,0 +1,125 @@
<template>
<v-layout>
<v-checkbox
v-model="init_value"
@change="checkbox_change"
hide-details class="shrink mr-2"
:disabled="init_disabled"
></v-checkbox>
<v-text-field
:label="__label"
placeholder="Alasan"
outline
:disabled="x_disabled || init_disabled"
:error-messages="init_error && !init_disabled ? x_error_messages : ''"
:error_count="init_error && !init_disabled ? x_error_count : 0 "
:error="init_error && !init_disabled"
:hide-details=!init_error
v-model=init_note
@input="note_change"
></v-text-field>
</v-layout>
</template>
<script>
module.exports = {
props : ['label', 'value', 'is_error', 'note', 'disabled'],
mounted: function() {
this.$nextTick( function() {
this.init_note = this.note ? this.note : "";
this.init_value = this.value;
})
},
data () {
return {
init_value : false,
init_note : ""
}
},
methods : {
checkbox_change (n, o) {
if (n) {
this.init_note = "";
}
var prm = {checked: n, note: this.init_note, error: this.init_error};
this.$emit('x_change', prm);
this.$emit('change', prm);
// console.log('"' + this.label + '" changed value to : ' + n);
},
note_change (n) {
let prm = { checked: this.init_value, note: n, error: this.init_error };
this.$emit('change', prm);
this.$emit('input', n);
}
},
computed : {
__label () {
if (this.label)
return this.label;
return "";
},
x_disabled () {
// return false;
if (this.init_value === "true" || this.init_value === true)
return true;
return false;
},
init_error () {
if ((this.init_value === "false" || this.init_value === false) && this.init_note.length < 1)
return true;
else {
// this.x_note = "";
return false;
}
},
x_error_count () {
// return 0;
if (this.init_error)
return 1;
return 0;
},
x_error_messages () {
if (this.init_error)
return ["Kolom ini harus diisi !"];
return [];
},
x_note () {
if (this.note)
return this.note;
return "";
},
init_disabled () {
return this.disabled ? this.disabled : false
}
}
}
</script>

View File

@@ -0,0 +1,126 @@
<template>
<div>
<v-layout row v-if="xtype == 'reguler'">
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pl-3 pt-2 xs1>
<v-checkbox
v-model="xcbx"
hide-details
></v-checkbox>
</v-flex>
<v-flex pt-2 xs8 >
<v-text-field
:label="xlabel"
:disabled="xdisabled"
:error="xerror"
:error-messages="xerror ? xerrormessages : ''"
:error_count="xerror ? xerrorcount : 0 "
:hide-details=!xerror
placeholder="Alasan"
outline
v-model="xtxt"
></v-text-field>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-layout v-else-if="xtype == 'indigo'">
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pl-3 pt-2 xs1 class="indigo lighten-5">
<v-checkbox
v-model="xcbx"
hide-details
></v-checkbox>
</v-flex>
<v-flex pt-2 pb-2 xs8 class="indigo lighten-5">
<v-text-field
:label="xlabel"
:disabled="xdisabled"
:error="xerror"
:error-messages="xerror ? xerrormessages : ''"
:error_count="xerror ? xerrorcount : 0 "
:hide-details=!xerror
placeholder="Alasan"
outline
v-model="xtxt"
></v-text-field>
</v-flex>
<v-flex class="indigo lighten-5" pt-3 xs3>
<v-layout align-center justify-center row>
<v-icon large @click="deleteData()" color="red">delete</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</div>
</template>
<script>
module.exports = {
props : ['xdatalabel','xdatacbx','xdatatxt','xdatatype'],
computed :{
xtype : function(type) {
return this.xdatatype
},
xcbx: {
get() {
return this.xdatacbx
},
set(val) {
if(val == true && this.xdatatxt !== "")
this.$emit('update-data-txt', "")
this.$emit('update-data-cbx', val)
}
},
xtxt: {
get() {
return this.xdatatxt
},
set(val) {
this.$emit('update-data-txt', val)
}
},
xlabel(){
if (this.xdatalabel)
return this.xdatalabel;
return "";
},
xdisabled () {
if (this.xcbx === "true" || this.xcbx === true)
return true;
return false;
},
xerror () {
if ((this.xcbx === "false" || this.xcbx === false) && this.xtxt.length < 1)
return true;
else {
return false;
}
},
xerrormessages () {
if (this.xerror)
return ["Alasan harus diisi !"];
return [];
},
xerrorcount () {
if (this.xerror)
return 1;
return 0;
}
},
methods: {
deleteData() {
this.$emit('update-data-delete', true)
}
}
}
</script>

View File

@@ -0,0 +1,72 @@
<template>
<v-layout>
<v-checkbox
v-model="init_value"
@change="changeCbx"
hide-details class="shrink mr-2"
></v-checkbox>
<v-text-field
:label="__label"
outline
v-model=init_note
></v-text-field>
</v-layout>
</template>
<script>
module.exports = {
props : ['label', 'value', 'note'],
mounted: function() {
this.$nextTick( function() {
this.init_note = this.note ? this.note : "";
this.init_value = this.value;
})
},
data () {
return {
init_value : false,
init_note : ""
}
},
methods : {
changeCbx (n, o) {
/* if (n) {
this.init_note = "";
}
*/
var prm = {checked: n, note: this.init_note};
this.$emit('x_change',prm);
}
},
computed : {
__label () {
if (this.label)
return this.label;
return "";
},
__placeholder () {
if (this.placeholder)
return this.placeholder;
return "";
},
x_disabled () {
if (this.init_value === "true" || this.init_value === true)
return true;
return false;
},
x_note () {
if (this.note)
return this.note;
return "";
}
}
}
</script>

View File

@@ -0,0 +1,84 @@
<template>
<div>
<v-layout>
<v-checkbox
v-model="xcbx"
hide-details class="shrink mr-2"
></v-checkbox>
<v-text-field
:label="xlabel"
:disabled="xdisabled"
:error="xerror"
:error-messages="xerror ? xerrormessages : ''"
:error_count="xerror ? xerrorcount : 0 "
:hide-details=!xerror
placeholder="Alasan"
outline
v-model="xtxt"
></v-text-field>
</v-layout>
</div>
</template>
<script>
module.exports = {
props : ['xdatalabel','xdatacbx','xdatatxt'],
computed :{
xcbx: {
get() {
return this.xdatacbx
},
set(val) {
if(val == true && this.xdatatxt !== "")
this.$emit('update-data-txt', "")
this.$emit('update-data-cbx', val)
}
},
xtxt: {
get() {
return this.xdatatxt
},
set(val) {
this.$emit('update-data-txt', val)
}
},
xlabel(){
if (this.xdatalabel)
return this.xdatalabel;
return "";
},
xdisabled () {
if (this.xcbx === "true" || this.xcbx === true)
return true;
return false;
},
xerror () {
if ((this.xcbx === "false" || this.xcbx === false) && this.xtxt.length < 1)
return true;
else {
return false;
}
},
xerrormessages () {
if (this.xerror)
return ["Alasan harus diisi !"];
return [];
},
xerrorcount () {
if (this.xerror)
return 1;
return 0;
}
}
}
</script>

View File

@@ -0,0 +1,82 @@
<template>
<div>
<v-layout>
<v-checkbox
v-model="xcbx"
hide-details class="shrink mr-2"
></v-checkbox>
<v-text-field
:label="xlabel"
:disabled="xdisabled"
:error="xerror"
:error-messages="xerror ? xerrormessages : ''"
:error_count="xerror ? xerrorcount : 0 "
:hide-details=!xerror
placeholder="Alasan"
outline
v-model="xtxt"
></v-text-field>
</v-layout>
</div>
</template>
<script>
module.exports = {
props : ['xdatalabel','xdatacbx','xdatatxt'],
computed :{
xcbx: {
get() {
return this.xdatacbx
},
set(val) {
this.$emit('update-data-cbx', val)
}
},
xtxt: {
get() {
return this.xdatatxt
},
set(val) {
this.$emit('update-data-txt', val)
}
},
xlabel(){
if (this.xdatalabel)
return this.xdatalabel;
return "";
},
xdisabled () {
if (this.xcbx === "true" || this.xcbx === true)
return true;
return false;
},
xerror () {
if ((this.xcbx === "false" || this.xcbx === false) && this.xtxt.length < 1)
return true;
else {
return false;
}
},
xerrormessages () {
if (this.xerror)
return ["Alasan harus diisi !"];
return [];
},
xerrorcount () {
if (this.xerror)
return 1;
return 0;
}
}
}
</script>

View File

@@ -0,0 +1,31 @@
<template>
<v-layout>
<input type="text" v-model="xdata" />
</v-layout>
</template>
<script>
module.exports = {
props : ['textdata'],
methods: {
changeDataX(item) {
this.$emit('update-data-x', item)
}
},
computed :{
xdata: {
get() {
return this.textdata
},
set(val) {
this.$emit('update-data-x', val)
}
}
}
}
</script>

View File

@@ -0,0 +1,80 @@
<template>
<v-layout>
<v-checkbox
v-model="xcbx"
hide-details class="shrink mr-2"
></v-checkbox>
<v-text-field
:label="xlabel"
:disabled="xdisabled"
:error="xerror"
:error-messages="xerror ? xerrormessages : ''"
:error_count="xerror ? xerrorcount : 0 "
:hide-details=!xerror
placeholder="Alasan"
outline
v-model="xtxt"
></v-text-field>
</v-layout>
</template>
<script>
module.exports = {
props : ['xdatalabel','xdatacbx','xdatatxt'],
computed :{
xcbx: {
get() {
return this.xdatacbx
},
set(val) {
this.$emit('update-data-cbx', val)
}
},
xtxt: {
get() {
return this.xdatatxt
},
set(val) {
this.$emit('update-data-txt', val)
}
},
xlabel(){
if (this.xdatalabel)
return this.xdatalabel;
return "";
},
xdisabled () {
if (this.xcbx === "true" || this.xcbx === true)
return true;
return false;
},
xerror () {
if ((this.xcbx === "false" || this.xcbx === false) && this.xtxt.length < 1)
return true;
else {
return false;
}
},
xerrormessages () {
if (this.xerror)
return ["Alasan harus diisi !"];
return [];
},
xerrorcount () {
if (this.xerror)
return 1;
return 0;
}
}
}
</script>

Binary file not shown.

View File

@@ -0,0 +1,31 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank";
export async function searchBank(query, page, rowPerPage = 15) {
try {
var resp = await axios.post(URL, {
query: query,
page: page,
rowPerPage: rowPerPage
});
if (resp.status != 200) {
return {
status: "ERR",
query: query,
message: resp.statusText
};
}
let data = resp.data;
data.query = query;
return data;
} catch (e) {
return {
status: "ERR",
query: query,
message: e.message
};
}
}

View File

@@ -0,0 +1,92 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"/one-api/v1/clinic/fo/";
export async function search_province(search) {
try {
var resp = await axios.post(URL + 'area/search_province', {
search: search
});
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 search_city(province_id, search) {
try {
var resp = await axios.post(URL + 'area/search_city', {
search: search,
province_id: province_id
});
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 search_district(city_id, search) {
try {
var resp = await axios.post(URL + 'area/search_district', {
search: search,
city_id: city_id
});
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 search_kelurahan(district_id, search) {
try {
var resp = await axios.post(URL + 'area/search_kelurahan', {
search: search,
district_id: district_id
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,407 @@
const URL = "/one-api/v1/masterdata/";
export async function lookup(token, search,all ) {
try {
var resp = await axios.post(URL + 'companynewx/lookup', { token: token, search: search, all:all });
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 + 'companynewx/addnewcompany', 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 update(prm) {
try {
var resp = await axios.post(URL + 'companynewx/editcompany', 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(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/deletecompany', { id: id, 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 savecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companynewx/addnewcompanytype', 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 updatecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companynewx/editcompanytype', 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 deletecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companynewx/deletecompanytype', 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 selectcompanytype(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectcompanytype',{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 savecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companynewx/addnewcompanybusiness', 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 updatecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companynewx/editcompanybusiness', 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 deletecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companynewx/deletecompanybusiness', 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 selectcompanybusiness(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectcompanybusiness',{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 selecthierarchy(token) {
try {
var resp = await axios.post(URL + 'companynewx/selecthierarchy',{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 selectcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/selectcompanylevel',{token:token,id:prm.id});
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 + 'companynewx/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 searchdoctor(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/searchdoctor',{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 searchcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/searchcompanylevel',{token:token,name:prm.name,id:prm.id});
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 getstaff(token) {
try {
var resp = await axios.post(URL + 'companynewx/getstaff',{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 getprovince(token) {
try {
var resp = await axios.post(URL + 'companynewx/getprovince',{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 getcity(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/getcity',{id:prm.M_ProvinceID,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 getdistrict(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/getdistrict',{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 getkelurahan(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/getkelurahan',{token:token,id:prm.M_DistrictID});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,224 @@
const URL = "/one-api/v1/masterdata/";
export async function save(prm) {
try {
var resp = await axios.post(URL + 'companynewx/addnewmou', 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(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/deletemou', { id: id ,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 xconfirm(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/confirmmou', { id: id ,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 xverify(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/verifymou', { id: id ,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 xunverify(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/unverifymou', { id: id ,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 xrelease(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/releasemou', { id: id ,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 xunrelease(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/unreleasemou', { id: id ,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 lookup(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/lookupmou', { id: id, 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 selectbase(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectbase',{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 selectomzettype(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectomzettype',{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 selectmoutype(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectmoutype',{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 selectagingtype(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectagingtype',{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
};
}
}

View File

@@ -0,0 +1,757 @@
<template>
<v-layout>
<template>
<v-dialog v-model="dialogdeletealert" max-width="30%">
<v-card>
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pt-2 pr-2 xs12>
{{msgalert}}
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialogdeletealert = false">
Tutup
</v-btn>
<v-btn color="primary" flat @click="closeDeleteAlert()">
Yakin lah
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<v-flex xs12>
<v-card class="scroll-container" style="/*max-height:645px;overflow: auto;*/">
<v-toolbar color="blue lighten-3" dark height="50px">
<v-toolbar-title>PERUSAHAAN</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="openFormPerusahaan()" icon>
<v-icon>library_add</v-icon>
</v-btn>
</v-toolbar>
<v-snackbar v-model="snackbar" :color="color" :timeout="5000" :multi-line="false" :vertical="false" :top="true">
{{msgsnackbar}}
<v-btn flat @click="updateAlert_success(false)">
Tutup
</v-btn>
</v-snackbar>
<v-layout row style="background:#bbdefb;padding-top:5px;" justify-left>
<v-list-tile>
<input type="text" v-model="xsearch" class="textinput" placeholder="Cari ..." />
</v-list-tile-content>
</v-list-tile>
</v-layout>
<v-divider></v-divider>
<div v-for="(vs,index) in vcompanys">
<v-layout pa-2 v-if="isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxsolid" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxsolid text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:#ffffff" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:#ffffff" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-layout pa-2 v-if="!isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxoutline" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxoutline text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:red" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:red" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-divider></v-divider>
</div>
<v-layout row>
<v-flex class="text-xs-center" pt-3 xs12>
<p style="margin-bottom:2px;color: rgba(0,0,0,0.54);font-size:12px;">Menampilkan <span class="red--text">{{xtotalfiltercompanys}}</span> dari <span class="red--text">{{xtotalcompanys}}</span> total data</p>
<v-btn small v-if="xshowall === 'N'" flat @click="updateShowAll('Y')" color="primary" dark>Tampilkan Semua</v-btn>
<v-btn small v-if="xshowall === 'Y'" flat @click="updateShowAll('N')" color="primary" dark>Batasi data</v-btn>
</v-flex>
</v-layout>
<template>
<v-layout row justify-center>
<v-dialog v-model="dialogcompany" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Form Perusahaan</span>
</v-card-title>
<v-card-text class="pt-0 pb-0">
<v-form ref="formcompany" v-model="valid" lazy-validation>
<v-layout wrap>
<v-flex xs12>
<v-text-field v-model="companyname" label="Nama Perusahaan" :rules="nameRules" required></v-text-field>
</v-flex>
<v-flex xs12>
<v-layout>
<v-flex xs6 pa-1>
<v-select item-text="M_CompanyTypeName" :disabled="readonlytypecompany" return-object :items="xcompanytypes" v-model="xcompanytype"
label="Tipe Perusahaan"></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field :disabled="readonlytypecompanynew" v-model="companytypenew" label="Tipe Perusahaan Baru"></v-text-field>
</v-flex>
</v-layout>
</v-flex>
<v-flex xs6>
<v-autocomplete label="Dokter" v-model="doctor" :items="xdoctors" :search-input.sync="search_doctor" auto-select-first no-filter
item-text="M_DoctorNames" return-object :loading="isLoading" no-data-text="Pilih Dokter">
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.M_DoctorNames"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex xs6 pa-1>
<v-select item-text="M_StaffName" :disabled="readonlystaff" return-object :items="xstaffs" v-model="xstaff"
label="Makerting"></v-select>
</v-flex>
<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 :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>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_DistrictName"
return-object
:items="xdistricts"
v-model="districtaddress"
label="Kecamatan*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_KelurahanName"
return-object
:items="xkelurahans"
v-model="kelurahanaddress"
label="Kelurahan / Desa*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companypic" label="PIC Perusahaan"></v-text-field>
</v-flex>
<v-flex xs12>
<v-text-field v-model="companyaddress" label="Alamat Perusahaan" :rules="addressRules" required></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyphone" label="Telpon Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyemail" label="Email Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="isdefault" label="Default?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabfrom" label="Rekanan Yang Merujuk?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabto" label="Rekanan Tujuan ?"></v-checkbox>
</v-flex>
<v-flex>
<p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="updateDialogFormPerusahaan()">Tutup</v-btn>
<v-btn v-if="xact === 'new'" color="blue darken-1" flat @click="saveFormPerusahaan()">Simpan</v-btn>
<v-btn v-if="xact === 'edit'" color="blue darken-1" flat @click="updateFormPerusahaan()">Simpan Perubahan</v-btn>
</v-card-actions>
</v-form>
</v-card>
</v-dialog>
</v-layout>
</template>
</v-card>
</v-flex>
</v-layout>
</template>
<style scoped>
.textinput {
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
width: 100%;
padding: 8px 10px;
margin-bottom: 5px;
box-sizing: border-box;
border: 1px solid #607d8b;
}
.textinput:focus {
width: 100%;
}
.textinput:focus::-webkit-input-placeholder {
color: transparent;
}
.textinput:focus::-moz-placeholder {
color: transparent;
}
.textinput:-moz-placeholder {
color: transparent;
}
.boxoutline {
color: red;
border: 1px solid red;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #ffffff;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxoutline:hover {
background: rgba(0, 0, 0, 0.07) !important;
font-size: 15px;
font-weight: 700;
}
.boxsolid {
color: #ffffff;
border: 1px solid #ffffff;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #f44336;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxsolid:hover {
background: #f44336de;
font-size: 15px;
font-weight: 700;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
</style>
<script>
module.exports = {
data: () => ({
color: "success",
valid: false,
companyname: '',
companytypenew: '',
companyaddress: '',
companyphone: '',
companyemail: '',
companypic: '',
companymindp: '',
search_city: '',
search_doctor: '',
nameRules: [
v => !!v || 'Nama Perusahaan harus diisi'
],
addressRules: [
v => !!v || 'Alamat Perusahaan harus diisi'
],
dialogdeletealert: false,
msgalert: "",
xid: 0,
xsearch: "",
isdefault: "",
islabfrom: "",
islabto: "",
isnewcompanytype: false,
readonlytypecompany: false,
readonlystaff: false,
readonlytypecompanynew: false
}),
async mounted() {
await this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
await this.$store.dispatch("company/selectcompanytype")
await this.$store.dispatch("company/selectstaff")
},
computed: {
xact() {
return this.$store.state.company.act
},
xerrors() {
return this.$store.state.company.errors
},
xshowall() {
return this.$store.state.company.show_all
},
vcompanys() {
return this.$store.state.company.companys
},
xtotalcompanys() {
return this.$store.state.company.total_companys
},
xtotalfiltercompanys() {
return this.$store.state.company.total_filter_companys
},
dialogcompany() {
return this.$store.state.company.dialog_form_company
},
snackbar: {
get() {
return this.$store.state.company.alert_success
},
set(val) {
this.$store.commit("company/update_alert_success", val)
}
},
msgsnackbar() {
return this.$store.state.company.msg_success
},
lookupstatus() {
return this.$store.state.company.lookup_company
},
xcompanytypes() {
return this.$store.state.company.companytypes
},
xcompanytype: {
get() {
return this.$store.state.company.companytype
},
set(val) {
this.$store.commit("company/update_companytype", val)
}
},
xstaffs() {
return this.$store.state.company.staffs
},
xstaff: {
get() {
return this.$store.state.company.staff
},
set(val) {
this.$store.commit("company/update_staff", val)
}
},
isLoading() {
return this.$store.state.company.search_status == 1
},
xcities() {
return this.$store.state.company.cities
},
cityaddress: {
get() {
return this.$store.state.company.city_address
},
set(val) {
this.$store.commit("company/update_city_address", val)
this.$store.dispatch("company/getdistrict", this.$store.state.company.city_address)
}
},
xdoctors() {
return this.$store.state.company.doctors
},
doctor: {
get() {
return this.$store.state.company.doctor
},
set(val) {
this.$store.commit("company/update_doctor", val)
}
},
xdistricts(){
return this.$store.state.company.districts
},
districtaddress:{
get() {
return this.$store.state.company.district_address
},
set(val) {
this.$store.commit("company/update_district_address",val)
this.$store.dispatch("company/getkelurahan",this.$store.state.company.district_address)
}
},
xkelurahans(){
return this.$store.state.company.kelurahans
},
kelurahanaddress:{
get() {
return this.$store.state.company.kelurahan_address
},
set(val) {
this.$store.commit("company/update_kelurahan_address",val)
}
}
},
methods: {
updateShowAll(val) {
this.$store.commit("company/update_show_all", val)
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
},
isSelected(p) {
return p.id == this.$store.state.company.selected_company.id
},
subname(name) {
var xname = name
if (xname.length > 18) {
xname = xname.substring(0, 18) + '...'
}
return xname
},
async selectMe(sc) {
await this.$store.commit("company/update_selected_company", sc)
await this.$store.dispatch("mou/lookup", {
id: this.$store.state.company.selected_company.id
})
//set staff
let staff_id = 0
try {
staff_id = this.$store.state.company.selected_company.M_StaffID
for(let idx=0; idx < this.$store.state.company.staffs.length ; idx++) {
let stf = this.$store.state.company.staffs[idx]
if (stf.M_StaffID == staff_id ) {
this.$store.commit("company/update_staff",stf)
break;
}
}
} catch(e) {
}
},
updateDialogFormPerusahaan() {
this.$store.commit("company/update_dialog_form_company", false)
},
openFormPerusahaan() {
this.search_city = ''
this.$store.commit("company/update_cities", [])
this.cityaddress = {}
this.search_doctor = ''
this.$store.commit("company/update_doctors", [])
this.doctor = {}
this.$store.commit("company/update_districts",[])
this.districtaddress = {}
this.$store.commit("company/update_kelurahans",[])
this.kelurahanaddress = {}
this.companytypenew = ""
this.$refs.formcompany.reset()
this.$refs.formcompany.resetValidation()
this.$store.commit("company/update_act", 'new')
this.$store.commit("company/update_dialog_form_company", true)
},
thr_search_city: _.debounce(function () {
this.$store.dispatch("company/searchcity", this.search_city)
}, 2000),
thr_search_doctor: _.debounce(function () {
this.$store.dispatch("company/searchdoctor", this.search_doctor)
}, 2000),
saveFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if ((_.isEmpty(this.companytypenew))) {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if (newcompanytype == "") {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan: this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateAlert_success(val) {
this.$store.commit("company/update_alert_success", val)
},
editPerusahaan(data) {
this.xid = data.id
this.companyname = data.name
this.$store.commit("company/update_cities", [{
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}])
this.cityaddress = {
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}
this.$store.commit("company/update_doctors", [{
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}])
this.doctor = {
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}
this.$store.commit("company/update_districts", [{
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}])
this.districtaddress = {
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}
this.$store.commit("company/update_kelurahans", [{
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}])
this.kelurahanaddress = {
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}
this.companyaddress = data.address
this.companyphone = data.phone
this.companyemail = data.email
this.companypic = data.pic
this.companytypenew = ""
this.isdefault = data.isdefault === 'N' ? false : true
this.islabfrom = data.islabfrom === 'N' ? false : true
this.islabto = data.islabto === 'N' ? false : true
this.$store.commit("company/update_act", 'edit')
this.$store.commit("company/update_dialog_form_company", true)
var companytypes = this.$store.state.company.companytypes
var idx_companytype = _.findIndex(companytypes, function (o) {
return o.M_CompanyTypeID == data.companytypeid
})
var companytype = companytypes[idx_companytype]
this.$store.commit("company/update_companytype", companytype)
},
deletePerusahaan(data) {
this.xid = data.id
var xdata = {
id: data.id,
name: data.name,
mous: 'xxx'
}
this.$store.commit("company/update_selected_company", xdata)
this.msgalert = "Yakin, mau hapus company " + data.name + " ?"
this.dialogdeletealert = true
},
changeNewCompanyType(value) {
this.readonlytypecompany = value === true ? true : false
this.readonlytypecompanynew = value === true ? false : true
},
newCompanyType() {
readonlytypecompany: true
readonlytypecompanynew: false
},
closeDeleteAlert() {
this.$store.dispatch("company/delete", {
companyid: this.$store.state.company.selected_company.id,
companyname: this.$store.state.company.selected_company.name
})
this.dialogdeletealert = false
},
thr_search: _.debounce(function () {
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
}, 1000)
},
watch: {
xsearch(val, old) {
if (val !== old && this.lookupstatus !== 1) {
console.log(val)
this.xsearch = val
this.thr_search()
}
},
search_city(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_city()
},
search_doctor(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_doctor()
}
}
}
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<!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 class="blue lighten-5" >
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap >
<v-flex xs3 class="left" fill-height pa-1>
<!-- komponen kiri -->
<one-md-company-list></one-md-company-list>
</v-flex>
<v-flex xs9 class="right" fill-height pa-1>
<!-- komponen kanan -->
<one-md-mou-list></one-md-mou-list>
</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">
import { store } from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
components: {
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
'one-md-company-list': httpVueLoader('./components/oneMdCompanyList.vue'),
'one-md-mou-list' : httpVueLoader('./components/oneMdMouList.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,194 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/area.js"
window.api = api
export default {
namespaced: true,
state: {
search: '',
search_status:0,
search_error_message:'',
search_dialog_is_active: false,
provinces: [],
cities: [],
districts: [],
villages: [],
total_provinces: 0,
total_cities: 0,
total_districts: 0,
total_villages: 0,
total_display: 0,
selected_province: {},
selected_city: {},
selected_district: {},
selected_village: {}
},
mutations: {
update_search_dialog_is_active(state,status) {
state.search_dialog_is_active = status
},
update_search_error_message(state,status) {
state.search_error_message = status
},
update_search(state,val) {
state.search=val
},
update_search_status(state,status) {
state.search_status = status
},
update_area(state, data) {
state[data.type] = data.records
state['total_'+data.type] = data.total
state.total_display = data.total_display
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = null
else if (data.type == "cities")
state['selected_city'] = null
for (let i in data.records) {
if (data.records[i].is_default == "Y") {
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = data.records[i]
else if (data.type == "cities")
state['selected_city'] = data.records[i]
}
}
},
update_selected_area(state, val) {
state['selected_'+val.type] = val.val
}
},
actions: {
async search_province(context) {
context.commit("update_search_status", 1)
// context.commit("update_area", {records:[], total:0, total_display:0, type:'city'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
// context.commit("update_selected_area", {type:'city',val:null})
// context.commit("update_selected_area", {type:'district',val:null})
// context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_province(context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'provinces'
}
context.commit("update_area", data)
context.dispatch("search_city")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message",e.message )
}
},
async search_city(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'district',val:null})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_city(context.state.selected_province.M_ProvinceID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'cities'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_district")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_district(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_district(context.state.selected_city.M_CityID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'districts'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_kelurahan")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_kelurahan(context) {
// City
context.commit("update_search_status", 1)
try {
let resp = await api.search_kelurahan(context.state.selected_district.M_DistrictID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'villages'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
}
}
}

View File

@@ -0,0 +1,720 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/company.js"
export default {
namespaced: true,
state: {
act: 'new',
actcompanytype: 'new',
actcompanybusiness: 'new',
lookup_company: 0,
lookup_error_message: '',
companys: [],
total_companys: 0,
total_filter_companys: 0,
selected_company: {
name: "[ Belum memilih Kelompok Pelanggan ]"
},
save_status: 0,
save_error_message: '',
dialog_form_company: false,
dialog_form_companytype: false,
dialog_form_companybusiness: false,
dialog_edit_form_company: false,
alert_success: false,
msg_success: "",
show_all: 'N',
errors: [],
companytypes: [],
companytype: {},
staffs: [],
staff: {},
companylevels: [],
companylevel: {},
companybusinesss: [],
companybusiness: {},
hierarkis: [],
hierarki: {},
doctors: [],
doctor: {},
get_data_status: 0,
get_data_error_message: '',
cities: [],
cities_address: {},
autocomplete_status: 0,
search_status: 0,
provinces: [],
province_address: {},
citys: [],
city_address: {},
districts: [],
district_address: {},
kelurahans: [],
kelurahan_address: {}
},
mutations: {
update_act(state, val) {
state.act = val
},
update_errors(state, val) {
state.errors = val
},
update_show_all(state, val) {
state.show_all = val
},
update_lookup_error_message(state, status) {
state.lookup_error_message = status
},
update_lookup_company(state, status) {
state.lookup_company = status
},
update_companys(state, data) {
state.companys = data.records
state.total_companys = data.total
state.total_filter_companys = data.total_filter
},
update_selected_company(state, val) {
state.selected_company = val
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_company(state, val) {
state.dialog_form_company = val
},
update_dialog_form_companytype(state, val) {
state.dialog_form_companytype = val
},
update_dialog_form_companybusiness(state, val) {
state.dialog_form_companybusiness = val
},
update_dialog_edit_form_company(state, val) {
state.dialog_edit_form_company = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_companytypes(state, data) {
state.companytypes = data
},
update_companytype(state, val) {
state.companytype = val
},
update_staffs(state, data) {
state.staffs = data
},
update_staff(state, val) {
state.staff = val
},
update_companylevels(state, data) {
state.companylevels = data
},
update_companylevel(state, val) {
state.companylevel = val
},
update_companybusinesss(state, data) {
state.companybusinesss = data
},
update_companybusiness(state, val) {
state.companybusiness = val
},
update_hierarkis(state, data) {
state.hierarkis = data
},
update_hierarki(state, val) {
state.hierarki = val
},
update_doctors(state, data) {
state.doctors = data
},
update_doctor(state, val) {
state.doctor = val
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_get_data_error_message(state, val) {
state.get_data_error_message = val
},
update_cities(state, val) {
state.cities = val
},
update_cities_address(state, val) {
state.cities_address = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_provinces(state, val) {
state.provinces = val
},
update_province_address(state, val) {
state.province_address = val
},
update_citys(state, val) {
state.citys = val
},
update_city_address(state, val) {
state.city_address = val
},
update_districts(state, val) {
state.districts = val
},
update_district_address(state, val) {
state.district_address = val
},
update_kelurahans(state, val) {
state.kelurahans = val
},
update_kelurahan_address(state, val) {
state.kelurahan_address = val
}
},
actions: {
async lookup(context, prm) {
context.commit("update_lookup_company", 1)
try {
let resp = await api.lookup(one_token(), prm.search, prm.all)
if (resp.status != "OK") {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_company", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_filter: resp.data.total_filter
}
context.commit("update_companys", data)
}
} catch (e) {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", e.message)
}
},
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)
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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah tersimpan dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
} 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 update(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.update(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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah terupdate dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(), prm.companyid)
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_alert_success", true)
var msg = "Schedule " + prm.companyname + " sudah dihapus dong"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.commit("update_selected_company", {})
context.dispatch("lookup", {
search: ""
})
context.commit("sampletype/update_company_sampletype", [], {
root: true
})
}
} catch (e) {
context.commit("update_save_status", 3)
console.log(e)
}
},
async savecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanytype(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_companytypes", resp.data.records.companytypes)
} 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 updatecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanytype(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanytype(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companytypes", resp.data.records.companytypes)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async savecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
} 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 selectcompanylevel(context,prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanylevel(one_token(),prm)
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companylevels", resp.data.records.companylevels)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selecthierarchy(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selecthierarchy(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_hierarkis", resp.data.records.hierarchys)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async updatecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanybusiness(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanybusiness(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companybusinesss", resp.data.records.companybusinesss)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selectdoctor(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectdoctor(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_doctors", resp.data.records.doctors)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
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 searchdoctor(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchdoctor(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_doctors", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async searchcompanylevel(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchcompanylevel(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_companylevels", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async getprovince(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getprovince(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_provinces", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getcity(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getcity(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_citys", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getstaff(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getstaff(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_staffs", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getdistrict(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getdistrict(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_districts", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getkelurahan(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getkelurahan(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_kelurahans", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
}
}
}

View File

@@ -0,0 +1,436 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/mou.js"
export default {
namespaced: true,
state: {
mous: [],
save_status: 0,
save_error_message: '',
dialog_form_mou: false,
dialog_confirm_alert_mou: false,
dialog_status_order: false,
lookup_mou: 0,
search_status: 0,
errors:[],
startdate:moment(new Date()).format('DD-MM-YYYY'),
enddate:moment(new Date()).format('DD-MM-YYYY'),
bases: [],
base: {},
omzettypes: [],
omzettype: {},
moutypes: [],
moutype: {},
agingtypes: [],
agingtype: {},
statuss:[],
jpa1_name: '',
jpa2_name: '',
jpa3_name: '',
jpa4_name: '',
jpa1_percent: 0,
jpa2_percent: 0,
jpa3_percent: 0,
jpa4_percent: 0,
lastid: 0
},
mutations: {
update_lastid(state,val) {
state.lastid = val
},
update_jpa1_name(state,val) {
state.jpa1_name = val
},
update_jpa2_name(state,val) {
state.jpa2_name = val
},
update_jpa3_name(state,val) {
state.jpa3_name = val
},
update_jpa4_name(state,val) {
state.jpa4_name = val
},
update_jpa1_percent(state,val) {
state.jpa1_percent = val
},
update_jpa2_percent(state,val) {
state.jpa2_percent = val
},
update_jpa3_percent(state,val) {
state.jpa3_percent = val
},
update_jpa4_percent(state,val) {
state.jpa4_percent = val
},
update_errors(state, val) {
state.errors = val
},
update_mous(state, data) {
state.mous = data
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_mou(state, val) {
state.dialog_form_mou = val
},
update_dialog_confirm_alert_mou(state, val) {
state.dialog_confirm_alert_mou = val
},
update_lookup_mou(state, val) {
state.lookup_mou = val
},
update_startdate(state,val){
state.startdate = val
},
update_enddate(state,val){
state.enddate = val
},
update_bases(state, data) {
state.bases = data
},
update_base(state, val) {
state.base = val
},
update_omzettypes(state, data) {
state.omzettypes = data
},
update_omzettype(state, val) {
state.omzettype = val
},
update_moutypes(state, data) {
state.moutypes = data
},
update_moutype(state, val) {
state.moutype = val
},
update_agingtypes(state, data) {
state.agingtypes = data
},
update_agingtype(state, val) {
state.agingtype = val
},
update_search_status(state, val) {
state.search_status = val
},
update_statuss(state,data){
state.statuss = data
},
update_dialog_status_order(state, val) {
state.dialog_status_order = val
}
},
actions: {
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("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
var data = {
records: resp.data.records,
total: resp.data.total,
lastid: resp.data.lastid
}
if(data.total !== -1){
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.commit("update_dialog_form_mou", false)
var msg = "Agreement " + prm.companyname + " sudah update dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.commit("update_dialog_confirm_alert_mou", true)
context.commit("update_lastid", data.lastid)
context.dispatch("lookup", {
id: prm.companyid
})
}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 lookupx(context, prm) {
context.commit("update_lookup_mou", 1)
try {
let resp = await api.lookupx(one_token(),prm.id)
if (resp.status != "OK") {
context.commit("update_lookup_mou", 3)
} else {
context.commit("update_lookup_mou", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_mous", data.records)
}
} catch (e) {
context.commit("update_lookup_mou", 3)
}
},
async lookup(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.lookup(one_token(),prm.id)
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_mous", data.records)
console.log('status')
console.log(data.records.statuss)
context.commit("update_statuss", data.records.statuss)
}
} catch (e) {
context.commit("update_save_status", 3)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dihapus dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async confirm(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xconfirm(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dikonfirmasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async verify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah diverifikasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unverify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Verifikasi Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async release(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dirilis"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unrelease(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Rilis Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectbase(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectbase(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_bases", resp.data.records.bases)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectomzettype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectomzettype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_omzettypes", resp.data.records.omzettypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectmoutype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectmoutype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_moutypes", resp.data.records.moutypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectagingtype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectagingtype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_agingtypes", resp.data.records.agingtypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
}
}
}

View File

@@ -0,0 +1,27 @@
// State
// data ...
// Mutations
//
//
// Actions
import company from "./modules/company.js";
import mou from "./modules/mou.js";
import area from "./modules/area.js";
import system from "../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
company: company,
mou: mou,
area: area,
system:system
},
state: {
},
mutations: {
},
actions: {
}
});

View File

@@ -0,0 +1,31 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank";
export async function searchBank(query, page, rowPerPage = 15) {
try {
var resp = await axios.post(URL, {
query: query,
page: page,
rowPerPage: rowPerPage
});
if (resp.status != 200) {
return {
status: "ERR",
query: query,
message: resp.statusText
};
}
let data = resp.data;
data.query = query;
return data;
} catch (e) {
return {
status: "ERR",
query: query,
message: e.message
};
}
}

View File

@@ -0,0 +1,92 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"/one-api/v1/clinic/fo/";
export async function search_province(search) {
try {
var resp = await axios.post(URL + 'area/search_province', {
search: search
});
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 search_city(province_id, search) {
try {
var resp = await axios.post(URL + 'area/search_city', {
search: search,
province_id: province_id
});
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 search_district(city_id, search) {
try {
var resp = await axios.post(URL + 'area/search_district', {
search: search,
city_id: city_id
});
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 search_kelurahan(district_id, search) {
try {
var resp = await axios.post(URL + 'area/search_kelurahan', {
search: search,
district_id: district_id
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,407 @@
const URL = "/one-api/v1/masterdata/";
export async function lookup(token, search,all ) {
try {
var resp = await axios.post(URL + 'companynewx/lookup', { token: token, search: search, all:all });
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 + 'companynewx/addnewcompany', 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 update(prm) {
try {
var resp = await axios.post(URL + 'companynewx/editcompany', 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(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/deletecompany', { id: id, 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 savecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companynewx/addnewcompanytype', 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 updatecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companynewx/editcompanytype', 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 deletecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companynewx/deletecompanytype', 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 selectcompanytype(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectcompanytype',{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 savecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companynewx/addnewcompanybusiness', 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 updatecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companynewx/editcompanybusiness', 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 deletecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companynewx/deletecompanybusiness', 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 selectcompanybusiness(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectcompanybusiness',{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 selecthierarchy(token) {
try {
var resp = await axios.post(URL + 'companynewx/selecthierarchy',{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 selectcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/selectcompanylevel',{token:token,id:prm.id});
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 + 'companynewx/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 searchdoctor(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/searchdoctor',{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 searchcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/searchcompanylevel',{token:token,name:prm.name,id:prm.id});
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 getstaff(token) {
try {
var resp = await axios.post(URL + 'companynewx/getstaff',{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 getprovince(token) {
try {
var resp = await axios.post(URL + 'companynewx/getprovince',{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 getcity(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/getcity',{id:prm.M_ProvinceID,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 getdistrict(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/getdistrict',{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 getkelurahan(token,prm) {
try {
var resp = await axios.post(URL + 'companynewx/getkelurahan',{token:token,id:prm.M_DistrictID});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,224 @@
const URL = "/one-api/v1/masterdata/";
export async function save(prm) {
try {
var resp = await axios.post(URL + 'companynewx/addnewmou', 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(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/deletemou', { id: id ,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 xconfirm(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/confirmmou', { id: id ,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 xverify(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/verifymou', { id: id ,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 xunverify(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/unverifymou', { id: id ,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 xrelease(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/releasemou', { id: id ,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 xunrelease(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/unreleasemou', { id: id ,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 lookup(token,id) {
try {
var resp = await axios.post(URL + 'companynewx/lookupmou', { id: id, 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 selectbase(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectbase',{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 selectomzettype(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectomzettype',{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 selectmoutype(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectmoutype',{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 selectagingtype(token) {
try {
var resp = await axios.post(URL + 'companynewx/selectagingtype',{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
};
}
}

View File

@@ -0,0 +1,757 @@
<template>
<v-layout>
<template>
<v-dialog v-model="dialogdeletealert" max-width="30%">
<v-card>
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pt-2 pr-2 xs12>
{{msgalert}}
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialogdeletealert = false">
Tutup
</v-btn>
<v-btn color="primary" flat @click="closeDeleteAlert()">
Yakin lah
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<v-flex xs12>
<v-card class="scroll-container" style="/*max-height:645px;overflow: auto;*/">
<v-toolbar color="blue lighten-3" dark height="50px">
<v-toolbar-title>PERUSAHAAN</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="openFormPerusahaan()" icon>
<v-icon>library_add</v-icon>
</v-btn>
</v-toolbar>
<v-snackbar v-model="snackbar" :color="color" :timeout="5000" :multi-line="false" :vertical="false" :top="true">
{{msgsnackbar}}
<v-btn flat @click="updateAlert_success(false)">
Tutup
</v-btn>
</v-snackbar>
<v-layout row style="background:#bbdefb;padding-top:5px;" justify-left>
<v-list-tile>
<input type="text" v-model="xsearch" class="textinput" placeholder="Cari ..." />
</v-list-tile-content>
</v-list-tile>
</v-layout>
<v-divider></v-divider>
<div v-for="(vs,index) in vcompanys">
<v-layout pa-2 v-if="isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxsolid" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxsolid text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:#ffffff" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:#ffffff" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-layout pa-2 v-if="!isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxoutline" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxoutline text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:red" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:red" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-divider></v-divider>
</div>
<v-layout row>
<v-flex class="text-xs-center" pt-3 xs12>
<p style="margin-bottom:2px;color: rgba(0,0,0,0.54);font-size:12px;">Menampilkan <span class="red--text">{{xtotalfiltercompanys}}</span> dari <span class="red--text">{{xtotalcompanys}}</span> total data</p>
<v-btn small v-if="xshowall === 'N'" flat @click="updateShowAll('Y')" color="primary" dark>Tampilkan Semua</v-btn>
<v-btn small v-if="xshowall === 'Y'" flat @click="updateShowAll('N')" color="primary" dark>Batasi data</v-btn>
</v-flex>
</v-layout>
<template>
<v-layout row justify-center>
<v-dialog v-model="dialogcompany" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Form Perusahaan</span>
</v-card-title>
<v-card-text class="pt-0 pb-0">
<v-form ref="formcompany" v-model="valid" lazy-validation>
<v-layout wrap>
<v-flex xs12>
<v-text-field v-model="companyname" label="Nama Perusahaan" :rules="nameRules" required></v-text-field>
</v-flex>
<v-flex xs12>
<v-layout>
<v-flex xs6 pa-1>
<v-select item-text="M_CompanyTypeName" :disabled="readonlytypecompany" return-object :items="xcompanytypes" v-model="xcompanytype"
label="Tipe Perusahaan"></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field :disabled="readonlytypecompanynew" v-model="companytypenew" label="Tipe Perusahaan Baru"></v-text-field>
</v-flex>
</v-layout>
</v-flex>
<v-flex xs6>
<v-autocomplete label="Dokter" v-model="doctor" :items="xdoctors" :search-input.sync="search_doctor" auto-select-first no-filter
item-text="M_DoctorNames" return-object :loading="isLoading" no-data-text="Pilih Dokter">
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.M_DoctorNames"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex xs6 pa-1>
<v-select item-text="M_StaffName" :disabled="readonlystaff" return-object :items="xstaffs" v-model="xstaff"
label="Makerting"></v-select>
</v-flex>
<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 :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>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_DistrictName"
return-object
:items="xdistricts"
v-model="districtaddress"
label="Kecamatan*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_KelurahanName"
return-object
:items="xkelurahans"
v-model="kelurahanaddress"
label="Kelurahan / Desa*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companypic" label="PIC Perusahaan"></v-text-field>
</v-flex>
<v-flex xs12>
<v-text-field v-model="companyaddress" label="Alamat Perusahaan" :rules="addressRules" required></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyphone" label="Telpon Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyemail" label="Email Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="isdefault" label="Default?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabfrom" label="Rekanan Yang Merujuk?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabto" label="Rekanan Tujuan ?"></v-checkbox>
</v-flex>
<v-flex>
<p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="updateDialogFormPerusahaan()">Tutup</v-btn>
<v-btn v-if="xact === 'new'" color="blue darken-1" flat @click="saveFormPerusahaan()">Simpan</v-btn>
<v-btn v-if="xact === 'edit'" color="blue darken-1" flat @click="updateFormPerusahaan()">Simpan Perubahan</v-btn>
</v-card-actions>
</v-form>
</v-card>
</v-dialog>
</v-layout>
</template>
</v-card>
</v-flex>
</v-layout>
</template>
<style scoped>
.textinput {
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
width: 100%;
padding: 8px 10px;
margin-bottom: 5px;
box-sizing: border-box;
border: 1px solid #607d8b;
}
.textinput:focus {
width: 100%;
}
.textinput:focus::-webkit-input-placeholder {
color: transparent;
}
.textinput:focus::-moz-placeholder {
color: transparent;
}
.textinput:-moz-placeholder {
color: transparent;
}
.boxoutline {
color: red;
border: 1px solid red;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #ffffff;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxoutline:hover {
background: rgba(0, 0, 0, 0.07) !important;
font-size: 15px;
font-weight: 700;
}
.boxsolid {
color: #ffffff;
border: 1px solid #ffffff;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #f44336;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxsolid:hover {
background: #f44336de;
font-size: 15px;
font-weight: 700;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
</style>
<script>
module.exports = {
data: () => ({
color: "success",
valid: false,
companyname: '',
companytypenew: '',
companyaddress: '',
companyphone: '',
companyemail: '',
companypic: '',
companymindp: '',
search_city: '',
search_doctor: '',
nameRules: [
v => !!v || 'Nama Perusahaan harus diisi'
],
addressRules: [
v => !!v || 'Alamat Perusahaan harus diisi'
],
dialogdeletealert: false,
msgalert: "",
xid: 0,
xsearch: "",
isdefault: "",
islabfrom: "",
islabto: "",
isnewcompanytype: false,
readonlytypecompany: false,
readonlystaff: false,
readonlytypecompanynew: false
}),
async mounted() {
await this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
await this.$store.dispatch("company/selectcompanytype")
await this.$store.dispatch("company/selectstaff")
},
computed: {
xact() {
return this.$store.state.company.act
},
xerrors() {
return this.$store.state.company.errors
},
xshowall() {
return this.$store.state.company.show_all
},
vcompanys() {
return this.$store.state.company.companys
},
xtotalcompanys() {
return this.$store.state.company.total_companys
},
xtotalfiltercompanys() {
return this.$store.state.company.total_filter_companys
},
dialogcompany() {
return this.$store.state.company.dialog_form_company
},
snackbar: {
get() {
return this.$store.state.company.alert_success
},
set(val) {
this.$store.commit("company/update_alert_success", val)
}
},
msgsnackbar() {
return this.$store.state.company.msg_success
},
lookupstatus() {
return this.$store.state.company.lookup_company
},
xcompanytypes() {
return this.$store.state.company.companytypes
},
xcompanytype: {
get() {
return this.$store.state.company.companytype
},
set(val) {
this.$store.commit("company/update_companytype", val)
}
},
xstaffs() {
return this.$store.state.company.staffs
},
xstaff: {
get() {
return this.$store.state.company.staff
},
set(val) {
this.$store.commit("company/update_staff", val)
}
},
isLoading() {
return this.$store.state.company.search_status == 1
},
xcities() {
return this.$store.state.company.cities
},
cityaddress: {
get() {
return this.$store.state.company.city_address
},
set(val) {
this.$store.commit("company/update_city_address", val)
this.$store.dispatch("company/getdistrict", this.$store.state.company.city_address)
}
},
xdoctors() {
return this.$store.state.company.doctors
},
doctor: {
get() {
return this.$store.state.company.doctor
},
set(val) {
this.$store.commit("company/update_doctor", val)
}
},
xdistricts(){
return this.$store.state.company.districts
},
districtaddress:{
get() {
return this.$store.state.company.district_address
},
set(val) {
this.$store.commit("company/update_district_address",val)
this.$store.dispatch("company/getkelurahan",this.$store.state.company.district_address)
}
},
xkelurahans(){
return this.$store.state.company.kelurahans
},
kelurahanaddress:{
get() {
return this.$store.state.company.kelurahan_address
},
set(val) {
this.$store.commit("company/update_kelurahan_address",val)
}
}
},
methods: {
updateShowAll(val) {
this.$store.commit("company/update_show_all", val)
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
},
isSelected(p) {
return p.id == this.$store.state.company.selected_company.id
},
subname(name) {
var xname = name
if (xname.length > 18) {
xname = xname.substring(0, 18) + '...'
}
return xname
},
async selectMe(sc) {
await this.$store.commit("company/update_selected_company", sc)
await this.$store.dispatch("mou/lookup", {
id: this.$store.state.company.selected_company.id
})
//set staff
let staff_id = 0
try {
staff_id = this.$store.state.company.selected_company.M_StaffID
for(let idx=0; idx < this.$store.state.company.staffs.length ; idx++) {
let stf = this.$store.state.company.staffs[idx]
if (stf.M_StaffID == staff_id ) {
this.$store.commit("company/update_staff",stf)
break;
}
}
} catch(e) {
}
},
updateDialogFormPerusahaan() {
this.$store.commit("company/update_dialog_form_company", false)
},
openFormPerusahaan() {
this.search_city = ''
this.$store.commit("company/update_cities", [])
this.cityaddress = {}
this.search_doctor = ''
this.$store.commit("company/update_doctors", [])
this.doctor = {}
this.$store.commit("company/update_districts",[])
this.districtaddress = {}
this.$store.commit("company/update_kelurahans",[])
this.kelurahanaddress = {}
this.companytypenew = ""
this.$refs.formcompany.reset()
this.$refs.formcompany.resetValidation()
this.$store.commit("company/update_act", 'new')
this.$store.commit("company/update_dialog_form_company", true)
},
thr_search_city: _.debounce(function () {
this.$store.dispatch("company/searchcity", this.search_city)
}, 2000),
thr_search_doctor: _.debounce(function () {
this.$store.dispatch("company/searchdoctor", this.search_doctor)
}, 2000),
saveFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if ((_.isEmpty(this.companytypenew))) {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if (newcompanytype == "") {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan: this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateAlert_success(val) {
this.$store.commit("company/update_alert_success", val)
},
editPerusahaan(data) {
this.xid = data.id
this.companyname = data.name
this.$store.commit("company/update_cities", [{
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}])
this.cityaddress = {
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}
this.$store.commit("company/update_doctors", [{
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}])
this.doctor = {
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}
this.$store.commit("company/update_districts", [{
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}])
this.districtaddress = {
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}
this.$store.commit("company/update_kelurahans", [{
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}])
this.kelurahanaddress = {
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}
this.companyaddress = data.address
this.companyphone = data.phone
this.companyemail = data.email
this.companypic = data.pic
this.companytypenew = ""
this.isdefault = data.isdefault === 'N' ? false : true
this.islabfrom = data.islabfrom === 'N' ? false : true
this.islabto = data.islabto === 'N' ? false : true
this.$store.commit("company/update_act", 'edit')
this.$store.commit("company/update_dialog_form_company", true)
var companytypes = this.$store.state.company.companytypes
var idx_companytype = _.findIndex(companytypes, function (o) {
return o.M_CompanyTypeID == data.companytypeid
})
var companytype = companytypes[idx_companytype]
this.$store.commit("company/update_companytype", companytype)
},
deletePerusahaan(data) {
this.xid = data.id
var xdata = {
id: data.id,
name: data.name,
mous: 'xxx'
}
this.$store.commit("company/update_selected_company", xdata)
this.msgalert = "Yakin, mau hapus company " + data.name + " ?"
this.dialogdeletealert = true
},
changeNewCompanyType(value) {
this.readonlytypecompany = value === true ? true : false
this.readonlytypecompanynew = value === true ? false : true
},
newCompanyType() {
readonlytypecompany: true
readonlytypecompanynew: false
},
closeDeleteAlert() {
this.$store.dispatch("company/delete", {
companyid: this.$store.state.company.selected_company.id,
companyname: this.$store.state.company.selected_company.name
})
this.dialogdeletealert = false
},
thr_search: _.debounce(function () {
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
}, 1000)
},
watch: {
xsearch(val, old) {
if (val !== old && this.lookupstatus !== 1) {
console.log(val)
this.xsearch = val
this.thr_search()
}
},
search_city(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_city()
},
search_doctor(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_doctor()
}
}
}
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<!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 class="blue lighten-5" >
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap >
<v-flex xs3 class="left" fill-height pa-1>
<!-- komponen kiri -->
<one-md-company-list></one-md-company-list>
</v-flex>
<v-flex xs9 class="right" fill-height pa-1>
<!-- komponen kanan -->
<one-md-mou-list></one-md-mou-list>
</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">
import { store } from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
components: {
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
'one-md-company-list': httpVueLoader('./components/oneMdCompanyList.vue'),
'one-md-mou-list' : httpVueLoader('./components/oneMdMouList.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,194 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/area.js"
window.api = api
export default {
namespaced: true,
state: {
search: '',
search_status:0,
search_error_message:'',
search_dialog_is_active: false,
provinces: [],
cities: [],
districts: [],
villages: [],
total_provinces: 0,
total_cities: 0,
total_districts: 0,
total_villages: 0,
total_display: 0,
selected_province: {},
selected_city: {},
selected_district: {},
selected_village: {}
},
mutations: {
update_search_dialog_is_active(state,status) {
state.search_dialog_is_active = status
},
update_search_error_message(state,status) {
state.search_error_message = status
},
update_search(state,val) {
state.search=val
},
update_search_status(state,status) {
state.search_status = status
},
update_area(state, data) {
state[data.type] = data.records
state['total_'+data.type] = data.total
state.total_display = data.total_display
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = null
else if (data.type == "cities")
state['selected_city'] = null
for (let i in data.records) {
if (data.records[i].is_default == "Y") {
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = data.records[i]
else if (data.type == "cities")
state['selected_city'] = data.records[i]
}
}
},
update_selected_area(state, val) {
state['selected_'+val.type] = val.val
}
},
actions: {
async search_province(context) {
context.commit("update_search_status", 1)
// context.commit("update_area", {records:[], total:0, total_display:0, type:'city'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
// context.commit("update_selected_area", {type:'city',val:null})
// context.commit("update_selected_area", {type:'district',val:null})
// context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_province(context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'provinces'
}
context.commit("update_area", data)
context.dispatch("search_city")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message",e.message )
}
},
async search_city(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'district',val:null})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_city(context.state.selected_province.M_ProvinceID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'cities'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_district")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_district(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_district(context.state.selected_city.M_CityID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'districts'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_kelurahan")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_kelurahan(context) {
// City
context.commit("update_search_status", 1)
try {
let resp = await api.search_kelurahan(context.state.selected_district.M_DistrictID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'villages'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
}
}
}

View File

@@ -0,0 +1,720 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/company.js"
export default {
namespaced: true,
state: {
act: 'new',
actcompanytype: 'new',
actcompanybusiness: 'new',
lookup_company: 0,
lookup_error_message: '',
companys: [],
total_companys: 0,
total_filter_companys: 0,
selected_company: {
name: "[ Belum memilih Kelompok Pelanggan ]"
},
save_status: 0,
save_error_message: '',
dialog_form_company: false,
dialog_form_companytype: false,
dialog_form_companybusiness: false,
dialog_edit_form_company: false,
alert_success: false,
msg_success: "",
show_all: 'N',
errors: [],
companytypes: [],
companytype: {},
staffs: [],
staff: {},
companylevels: [],
companylevel: {},
companybusinesss: [],
companybusiness: {},
hierarkis: [],
hierarki: {},
doctors: [],
doctor: {},
get_data_status: 0,
get_data_error_message: '',
cities: [],
cities_address: {},
autocomplete_status: 0,
search_status: 0,
provinces: [],
province_address: {},
citys: [],
city_address: {},
districts: [],
district_address: {},
kelurahans: [],
kelurahan_address: {}
},
mutations: {
update_act(state, val) {
state.act = val
},
update_errors(state, val) {
state.errors = val
},
update_show_all(state, val) {
state.show_all = val
},
update_lookup_error_message(state, status) {
state.lookup_error_message = status
},
update_lookup_company(state, status) {
state.lookup_company = status
},
update_companys(state, data) {
state.companys = data.records
state.total_companys = data.total
state.total_filter_companys = data.total_filter
},
update_selected_company(state, val) {
state.selected_company = val
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_company(state, val) {
state.dialog_form_company = val
},
update_dialog_form_companytype(state, val) {
state.dialog_form_companytype = val
},
update_dialog_form_companybusiness(state, val) {
state.dialog_form_companybusiness = val
},
update_dialog_edit_form_company(state, val) {
state.dialog_edit_form_company = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_companytypes(state, data) {
state.companytypes = data
},
update_companytype(state, val) {
state.companytype = val
},
update_staffs(state, data) {
state.staffs = data
},
update_staff(state, val) {
state.staff = val
},
update_companylevels(state, data) {
state.companylevels = data
},
update_companylevel(state, val) {
state.companylevel = val
},
update_companybusinesss(state, data) {
state.companybusinesss = data
},
update_companybusiness(state, val) {
state.companybusiness = val
},
update_hierarkis(state, data) {
state.hierarkis = data
},
update_hierarki(state, val) {
state.hierarki = val
},
update_doctors(state, data) {
state.doctors = data
},
update_doctor(state, val) {
state.doctor = val
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_get_data_error_message(state, val) {
state.get_data_error_message = val
},
update_cities(state, val) {
state.cities = val
},
update_cities_address(state, val) {
state.cities_address = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_provinces(state, val) {
state.provinces = val
},
update_province_address(state, val) {
state.province_address = val
},
update_citys(state, val) {
state.citys = val
},
update_city_address(state, val) {
state.city_address = val
},
update_districts(state, val) {
state.districts = val
},
update_district_address(state, val) {
state.district_address = val
},
update_kelurahans(state, val) {
state.kelurahans = val
},
update_kelurahan_address(state, val) {
state.kelurahan_address = val
}
},
actions: {
async lookup(context, prm) {
context.commit("update_lookup_company", 1)
try {
let resp = await api.lookup(one_token(), prm.search, prm.all)
if (resp.status != "OK") {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_company", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_filter: resp.data.total_filter
}
context.commit("update_companys", data)
}
} catch (e) {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", e.message)
}
},
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)
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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah tersimpan dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
} 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 update(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.update(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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah terupdate dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(), prm.companyid)
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_alert_success", true)
var msg = "Schedule " + prm.companyname + " sudah dihapus dong"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.commit("update_selected_company", {})
context.dispatch("lookup", {
search: ""
})
context.commit("sampletype/update_company_sampletype", [], {
root: true
})
}
} catch (e) {
context.commit("update_save_status", 3)
console.log(e)
}
},
async savecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanytype(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_companytypes", resp.data.records.companytypes)
} 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 updatecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanytype(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanytype(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companytypes", resp.data.records.companytypes)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async savecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
} 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 selectcompanylevel(context,prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanylevel(one_token(),prm)
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companylevels", resp.data.records.companylevels)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selecthierarchy(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selecthierarchy(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_hierarkis", resp.data.records.hierarchys)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async updatecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanybusiness(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanybusiness(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companybusinesss", resp.data.records.companybusinesss)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selectdoctor(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectdoctor(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_doctors", resp.data.records.doctors)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
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 searchdoctor(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchdoctor(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_doctors", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async searchcompanylevel(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchcompanylevel(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_companylevels", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async getprovince(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getprovince(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_provinces", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getcity(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getcity(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_citys", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getstaff(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getstaff(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_staffs", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getdistrict(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getdistrict(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_districts", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getkelurahan(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getkelurahan(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_kelurahans", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
}
}
}

View File

@@ -0,0 +1,436 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/mou.js"
export default {
namespaced: true,
state: {
mous: [],
save_status: 0,
save_error_message: '',
dialog_form_mou: false,
dialog_confirm_alert_mou: false,
dialog_status_order: false,
lookup_mou: 0,
search_status: 0,
errors:[],
startdate:moment(new Date()).format('DD-MM-YYYY'),
enddate:moment(new Date()).format('DD-MM-YYYY'),
bases: [],
base: {},
omzettypes: [],
omzettype: {},
moutypes: [],
moutype: {},
agingtypes: [],
agingtype: {},
statuss:[],
jpa1_name: '',
jpa2_name: '',
jpa3_name: '',
jpa4_name: '',
jpa1_percent: 0,
jpa2_percent: 0,
jpa3_percent: 0,
jpa4_percent: 0,
lastid: 0
},
mutations: {
update_lastid(state,val) {
state.lastid = val
},
update_jpa1_name(state,val) {
state.jpa1_name = val
},
update_jpa2_name(state,val) {
state.jpa2_name = val
},
update_jpa3_name(state,val) {
state.jpa3_name = val
},
update_jpa4_name(state,val) {
state.jpa4_name = val
},
update_jpa1_percent(state,val) {
state.jpa1_percent = val
},
update_jpa2_percent(state,val) {
state.jpa2_percent = val
},
update_jpa3_percent(state,val) {
state.jpa3_percent = val
},
update_jpa4_percent(state,val) {
state.jpa4_percent = val
},
update_errors(state, val) {
state.errors = val
},
update_mous(state, data) {
state.mous = data
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_mou(state, val) {
state.dialog_form_mou = val
},
update_dialog_confirm_alert_mou(state, val) {
state.dialog_confirm_alert_mou = val
},
update_lookup_mou(state, val) {
state.lookup_mou = val
},
update_startdate(state,val){
state.startdate = val
},
update_enddate(state,val){
state.enddate = val
},
update_bases(state, data) {
state.bases = data
},
update_base(state, val) {
state.base = val
},
update_omzettypes(state, data) {
state.omzettypes = data
},
update_omzettype(state, val) {
state.omzettype = val
},
update_moutypes(state, data) {
state.moutypes = data
},
update_moutype(state, val) {
state.moutype = val
},
update_agingtypes(state, data) {
state.agingtypes = data
},
update_agingtype(state, val) {
state.agingtype = val
},
update_search_status(state, val) {
state.search_status = val
},
update_statuss(state,data){
state.statuss = data
},
update_dialog_status_order(state, val) {
state.dialog_status_order = val
}
},
actions: {
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("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
var data = {
records: resp.data.records,
total: resp.data.total,
lastid: resp.data.lastid
}
if(data.total !== -1){
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.commit("update_dialog_form_mou", false)
var msg = "Agreement " + prm.companyname + " sudah update dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.commit("update_dialog_confirm_alert_mou", true)
context.commit("update_lastid", data.lastid)
context.dispatch("lookup", {
id: prm.companyid
})
}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 lookupx(context, prm) {
context.commit("update_lookup_mou", 1)
try {
let resp = await api.lookupx(one_token(),prm.id)
if (resp.status != "OK") {
context.commit("update_lookup_mou", 3)
} else {
context.commit("update_lookup_mou", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_mous", data.records)
}
} catch (e) {
context.commit("update_lookup_mou", 3)
}
},
async lookup(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.lookup(one_token(),prm.id)
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_mous", data.records)
console.log('status')
console.log(data.records.statuss)
context.commit("update_statuss", data.records.statuss)
}
} catch (e) {
context.commit("update_save_status", 3)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dihapus dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async confirm(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xconfirm(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dikonfirmasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async verify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah diverifikasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unverify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Verifikasi Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async release(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dirilis"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unrelease(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Rilis Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectbase(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectbase(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_bases", resp.data.records.bases)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectomzettype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectomzettype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_omzettypes", resp.data.records.omzettypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectmoutype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectmoutype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_moutypes", resp.data.records.moutypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectagingtype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectagingtype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_agingtypes", resp.data.records.agingtypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
}
}
}

View File

@@ -0,0 +1,27 @@
// State
// data ...
// Mutations
//
//
// Actions
import company from "./modules/company.js";
import mou from "./modules/mou.js";
import area from "./modules/area.js";
import system from "../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
company: company,
mou: mou,
area: area,
system:system
},
state: {
},
mutations: {
},
actions: {
}
});

View File

@@ -0,0 +1,31 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank";
export async function searchBank(query, page, rowPerPage = 15) {
try {
var resp = await axios.post(URL, {
query: query,
page: page,
rowPerPage: rowPerPage
});
if (resp.status != 200) {
return {
status: "ERR",
query: query,
message: resp.statusText
};
}
let data = resp.data;
data.query = query;
return data;
} catch (e) {
return {
status: "ERR",
query: query,
message: e.message
};
}
}

View File

@@ -0,0 +1,92 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"/one-api/v1/clinic/fo/";
export async function search_province(search) {
try {
var resp = await axios.post(URL + 'area/search_province', {
search: search
});
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 search_city(province_id, search) {
try {
var resp = await axios.post(URL + 'area/search_city', {
search: search,
province_id: province_id
});
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 search_district(city_id, search) {
try {
var resp = await axios.post(URL + 'area/search_district', {
search: search,
city_id: city_id
});
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 search_kelurahan(district_id, search) {
try {
var resp = await axios.post(URL + 'area/search_kelurahan', {
search: search,
district_id: district_id
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,424 @@
const URL = "/one-api/v1/masterdata/";
export async function lookup(token, search,all ) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/lookup', { token: token, search: search, all:all });
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 + 'companyadmin_v10/addnewcompany', 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 update(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/editcompany', 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 updateafterrelease(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/editcompanyafterrelease', 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(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/deletecompany', { id: id, 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 savecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/addnewcompanytype', 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 updatecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/editcompanytype', 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 deletecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/deletecompanytype', 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 selectcompanytype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/selectcompanytype',{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 savecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/addnewcompanybusiness', 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 updatecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/editcompanybusiness', 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 deletecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/deletecompanybusiness', 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 selectcompanybusiness(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/selectcompanybusiness',{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 selecthierarchy(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/selecthierarchy',{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 selectcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/selectcompanylevel',{token:token,id:prm.id});
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 + 'companyadmin_v10/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 searchdoctor(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/searchdoctor',{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 searchcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/searchcompanylevel',{token:token,name:prm.name,id:prm.id});
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 getstaff(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/getstaff',{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 getprovince(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/getprovince',{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 getcity(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/getcity',{id:prm.M_ProvinceID,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 getdistrict(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/getdistrict',{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 getkelurahan(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/getkelurahan',{token:token,id:prm.M_DistrictID});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,241 @@
const URL = "/one-api/v1/masterdata/";
export async function save(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/addnewmou', 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 saveafterrelease(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/saveafterrelease', 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(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/deletemou', { id: id ,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 xconfirm(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/confirmmou', { id: id ,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 xverify(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/verifymou', { id: id ,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 xunverify(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/unverifymou', { id: id ,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 xrelease(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/releasemou', { id: id ,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 xunrelease(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/unreleasemou', { id: id ,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 lookup(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/lookupmou', { id: id, 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 selectbase(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/selectbase',{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 selectomzettype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/selectomzettype',{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 selectmoutype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/selectmoutype',{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 selectagingtype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v10/selectagingtype',{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
};
}
}

View File

@@ -0,0 +1,757 @@
<template>
<v-layout>
<template>
<v-dialog v-model="dialogdeletealert" max-width="30%">
<v-card>
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pt-2 pr-2 xs12>
{{msgalert}}
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialogdeletealert = false">
Tutup
</v-btn>
<v-btn color="primary" flat @click="closeDeleteAlert()">
Yakin lah
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<v-flex xs12>
<v-card class="scroll-container" style="/*max-height:645px;overflow: auto;*/">
<v-toolbar color="blue lighten-3" dark height="50px">
<v-toolbar-title>PERUSAHAAN</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="openFormPerusahaan()" icon>
<v-icon>library_add</v-icon>
</v-btn>
</v-toolbar>
<v-snackbar v-model="snackbar" :color="color" :timeout="5000" :multi-line="false" :vertical="false" :top="true">
{{msgsnackbar}}
<v-btn flat @click="updateAlert_success(false)">
Tutup
</v-btn>
</v-snackbar>
<v-layout row style="background:#bbdefb;padding-top:5px;" justify-left>
<v-list-tile>
<input type="text" v-model="xsearch" class="textinput" placeholder="Cari ..." />
</v-list-tile-content>
</v-list-tile>
</v-layout>
<v-divider></v-divider>
<div v-for="(vs,index) in vcompanys">
<v-layout pa-2 v-if="isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxsolid" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxsolid text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:#ffffff" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:#ffffff" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-layout pa-2 v-if="!isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxoutline" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxoutline text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:red" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:red" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-divider></v-divider>
</div>
<v-layout row>
<v-flex class="text-xs-center" pt-3 xs12>
<p style="margin-bottom:2px;color: rgba(0,0,0,0.54);font-size:12px;">Menampilkan <span class="red--text">{{xtotalfiltercompanys}}</span> dari <span class="red--text">{{xtotalcompanys}}</span> total data</p>
<v-btn small v-if="xshowall === 'N'" flat @click="updateShowAll('Y')" color="primary" dark>Tampilkan Semua</v-btn>
<v-btn small v-if="xshowall === 'Y'" flat @click="updateShowAll('N')" color="primary" dark>Batasi data</v-btn>
</v-flex>
</v-layout>
<template>
<v-layout row justify-center>
<v-dialog v-model="dialogcompany" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Form Perusahaan</span>
</v-card-title>
<v-card-text class="pt-0 pb-0">
<v-form ref="formcompany" v-model="valid" lazy-validation>
<v-layout wrap>
<v-flex xs12>
<v-text-field v-model="companyname" label="Nama Perusahaan" :rules="nameRules" required></v-text-field>
</v-flex>
<v-flex xs12>
<v-layout>
<v-flex xs6 pa-1>
<v-select item-text="M_CompanyTypeName" :disabled="readonlytypecompany" return-object :items="xcompanytypes" v-model="xcompanytype"
label="Tipe Perusahaan"></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field :disabled="readonlytypecompanynew" v-model="companytypenew" label="Tipe Perusahaan Baru"></v-text-field>
</v-flex>
</v-layout>
</v-flex>
<v-flex xs6>
<v-autocomplete label="Dokter" v-model="doctor" :items="xdoctors" :search-input.sync="search_doctor" auto-select-first no-filter
item-text="M_DoctorNames" return-object :loading="isLoading" no-data-text="Pilih Dokter">
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.M_DoctorNames"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex xs6 pa-1>
<v-select item-text="M_StaffName" :disabled="readonlystaff" return-object :items="xstaffs" v-model="xstaff"
label="Makerting"></v-select>
</v-flex>
<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 :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>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_DistrictName"
return-object
:items="xdistricts"
v-model="districtaddress"
label="Kecamatan*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_KelurahanName"
return-object
:items="xkelurahans"
v-model="kelurahanaddress"
label="Kelurahan / Desa*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companypic" label="PIC Perusahaan"></v-text-field>
</v-flex>
<v-flex xs12>
<v-text-field v-model="companyaddress" label="Alamat Perusahaan" :rules="addressRules" required></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyphone" label="Telpon Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyemail" label="Email Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="isdefault" label="Default?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabfrom" label="Rekanan Yang Merujuk?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabto" label="Rekanan Tujuan ?"></v-checkbox>
</v-flex>
<v-flex>
<p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="updateDialogFormPerusahaan()">Tutup</v-btn>
<v-btn v-if="xact === 'new'" color="blue darken-1" flat @click="saveFormPerusahaan()">Simpan</v-btn>
<v-btn v-if="xact === 'edit'" color="blue darken-1" flat @click="updateFormPerusahaan()">Simpan Perubahan</v-btn>
</v-card-actions>
</v-form>
</v-card>
</v-dialog>
</v-layout>
</template>
</v-card>
</v-flex>
</v-layout>
</template>
<style scoped>
.textinput {
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
width: 100%;
padding: 8px 10px;
margin-bottom: 5px;
box-sizing: border-box;
border: 1px solid #607d8b;
}
.textinput:focus {
width: 100%;
}
.textinput:focus::-webkit-input-placeholder {
color: transparent;
}
.textinput:focus::-moz-placeholder {
color: transparent;
}
.textinput:-moz-placeholder {
color: transparent;
}
.boxoutline {
color: red;
border: 1px solid red;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #ffffff;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxoutline:hover {
background: rgba(0, 0, 0, 0.07) !important;
font-size: 15px;
font-weight: 700;
}
.boxsolid {
color: #ffffff;
border: 1px solid #ffffff;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #f44336;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxsolid:hover {
background: #f44336de;
font-size: 15px;
font-weight: 700;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
</style>
<script>
module.exports = {
data: () => ({
color: "success",
valid: false,
companyname: '',
companytypenew: '',
companyaddress: '',
companyphone: '',
companyemail: '',
companypic: '',
companymindp: '',
search_city: '',
search_doctor: '',
nameRules: [
v => !!v || 'Nama Perusahaan harus diisi'
],
addressRules: [
v => !!v || 'Alamat Perusahaan harus diisi'
],
dialogdeletealert: false,
msgalert: "",
xid: 0,
xsearch: "",
isdefault: "",
islabfrom: "",
islabto: "",
isnewcompanytype: false,
readonlytypecompany: false,
readonlystaff: false,
readonlytypecompanynew: false
}),
async mounted() {
await this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
await this.$store.dispatch("company/selectcompanytype")
await this.$store.dispatch("company/selectstaff")
},
computed: {
xact() {
return this.$store.state.company.act
},
xerrors() {
return this.$store.state.company.errors
},
xshowall() {
return this.$store.state.company.show_all
},
vcompanys() {
return this.$store.state.company.companys
},
xtotalcompanys() {
return this.$store.state.company.total_companys
},
xtotalfiltercompanys() {
return this.$store.state.company.total_filter_companys
},
dialogcompany() {
return this.$store.state.company.dialog_form_company
},
snackbar: {
get() {
return this.$store.state.company.alert_success
},
set(val) {
this.$store.commit("company/update_alert_success", val)
}
},
msgsnackbar() {
return this.$store.state.company.msg_success
},
lookupstatus() {
return this.$store.state.company.lookup_company
},
xcompanytypes() {
return this.$store.state.company.companytypes
},
xcompanytype: {
get() {
return this.$store.state.company.companytype
},
set(val) {
this.$store.commit("company/update_companytype", val)
}
},
xstaffs() {
return this.$store.state.company.staffs
},
xstaff: {
get() {
return this.$store.state.company.staff
},
set(val) {
this.$store.commit("company/update_staff", val)
}
},
isLoading() {
return this.$store.state.company.search_status == 1
},
xcities() {
return this.$store.state.company.cities
},
cityaddress: {
get() {
return this.$store.state.company.city_address
},
set(val) {
this.$store.commit("company/update_city_address", val)
this.$store.dispatch("company/getdistrict", this.$store.state.company.city_address)
}
},
xdoctors() {
return this.$store.state.company.doctors
},
doctor: {
get() {
return this.$store.state.company.doctor
},
set(val) {
this.$store.commit("company/update_doctor", val)
}
},
xdistricts(){
return this.$store.state.company.districts
},
districtaddress:{
get() {
return this.$store.state.company.district_address
},
set(val) {
this.$store.commit("company/update_district_address",val)
this.$store.dispatch("company/getkelurahan",this.$store.state.company.district_address)
}
},
xkelurahans(){
return this.$store.state.company.kelurahans
},
kelurahanaddress:{
get() {
return this.$store.state.company.kelurahan_address
},
set(val) {
this.$store.commit("company/update_kelurahan_address",val)
}
}
},
methods: {
updateShowAll(val) {
this.$store.commit("company/update_show_all", val)
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
},
isSelected(p) {
return p.id == this.$store.state.company.selected_company.id
},
subname(name) {
var xname = name
if (xname.length > 18) {
xname = xname.substring(0, 18) + '...'
}
return xname
},
async selectMe(sc) {
await this.$store.commit("company/update_selected_company", sc)
await this.$store.dispatch("mou/lookup", {
id: this.$store.state.company.selected_company.id
})
//set staff
let staff_id = 0
try {
staff_id = this.$store.state.company.selected_company.M_StaffID
for(let idx=0; idx < this.$store.state.company.staffs.length ; idx++) {
let stf = this.$store.state.company.staffs[idx]
if (stf.M_StaffID == staff_id ) {
this.$store.commit("company/update_staff",stf)
break;
}
}
} catch(e) {
}
},
updateDialogFormPerusahaan() {
this.$store.commit("company/update_dialog_form_company", false)
},
openFormPerusahaan() {
this.search_city = ''
this.$store.commit("company/update_cities", [])
this.cityaddress = {}
this.search_doctor = ''
this.$store.commit("company/update_doctors", [])
this.doctor = {}
this.$store.commit("company/update_districts",[])
this.districtaddress = {}
this.$store.commit("company/update_kelurahans",[])
this.kelurahanaddress = {}
this.companytypenew = ""
this.$refs.formcompany.reset()
this.$refs.formcompany.resetValidation()
this.$store.commit("company/update_act", 'new')
this.$store.commit("company/update_dialog_form_company", true)
},
thr_search_city: _.debounce(function () {
this.$store.dispatch("company/searchcity", this.search_city)
}, 2000),
thr_search_doctor: _.debounce(function () {
this.$store.dispatch("company/searchdoctor", this.search_doctor)
}, 2000),
saveFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if ((_.isEmpty(this.companytypenew))) {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if (newcompanytype == "") {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan: this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateAlert_success(val) {
this.$store.commit("company/update_alert_success", val)
},
editPerusahaan(data) {
this.xid = data.id
this.companyname = data.name
this.$store.commit("company/update_cities", [{
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}])
this.cityaddress = {
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}
this.$store.commit("company/update_doctors", [{
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}])
this.doctor = {
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}
this.$store.commit("company/update_districts", [{
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}])
this.districtaddress = {
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}
this.$store.commit("company/update_kelurahans", [{
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}])
this.kelurahanaddress = {
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}
this.companyaddress = data.address
this.companyphone = data.phone
this.companyemail = data.email
this.companypic = data.pic
this.companytypenew = ""
this.isdefault = data.isdefault === 'N' ? false : true
this.islabfrom = data.islabfrom === 'N' ? false : true
this.islabto = data.islabto === 'N' ? false : true
this.$store.commit("company/update_act", 'edit')
this.$store.commit("company/update_dialog_form_company", true)
var companytypes = this.$store.state.company.companytypes
var idx_companytype = _.findIndex(companytypes, function (o) {
return o.M_CompanyTypeID == data.companytypeid
})
var companytype = companytypes[idx_companytype]
this.$store.commit("company/update_companytype", companytype)
},
deletePerusahaan(data) {
this.xid = data.id
var xdata = {
id: data.id,
name: data.name,
mous: 'xxx'
}
this.$store.commit("company/update_selected_company", xdata)
this.msgalert = "Yakin, mau hapus company " + data.name + " ?"
this.dialogdeletealert = true
},
changeNewCompanyType(value) {
this.readonlytypecompany = value === true ? true : false
this.readonlytypecompanynew = value === true ? false : true
},
newCompanyType() {
readonlytypecompany: true
readonlytypecompanynew: false
},
closeDeleteAlert() {
this.$store.dispatch("company/delete", {
companyid: this.$store.state.company.selected_company.id,
companyname: this.$store.state.company.selected_company.name
})
this.dialogdeletealert = false
},
thr_search: _.debounce(function () {
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
}, 1000)
},
watch: {
xsearch(val, old) {
if (val !== old && this.lookupstatus !== 1) {
console.log(val)
this.xsearch = val
this.thr_search()
}
},
search_city(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_city()
},
search_doctor(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_doctor()
}
}
}
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<!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 class="blue lighten-5" >
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap >
<v-flex xs3 class="left" fill-height pa-1>
<!-- komponen kiri -->
<one-md-company-list></one-md-company-list>
</v-flex>
<v-flex xs9 class="right" fill-height pa-1>
<!-- komponen kanan -->
<one-md-mou-list></one-md-mou-list>
</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">
import { store } from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
components: {
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
'one-md-company-list': httpVueLoader('./components/oneMdCompanyList.vue'),
'one-md-mou-list' : httpVueLoader('./components/oneMdMouList.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,194 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/area.js"
window.api = api
export default {
namespaced: true,
state: {
search: '',
search_status:0,
search_error_message:'',
search_dialog_is_active: false,
provinces: [],
cities: [],
districts: [],
villages: [],
total_provinces: 0,
total_cities: 0,
total_districts: 0,
total_villages: 0,
total_display: 0,
selected_province: {},
selected_city: {},
selected_district: {},
selected_village: {}
},
mutations: {
update_search_dialog_is_active(state,status) {
state.search_dialog_is_active = status
},
update_search_error_message(state,status) {
state.search_error_message = status
},
update_search(state,val) {
state.search=val
},
update_search_status(state,status) {
state.search_status = status
},
update_area(state, data) {
state[data.type] = data.records
state['total_'+data.type] = data.total
state.total_display = data.total_display
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = null
else if (data.type == "cities")
state['selected_city'] = null
for (let i in data.records) {
if (data.records[i].is_default == "Y") {
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = data.records[i]
else if (data.type == "cities")
state['selected_city'] = data.records[i]
}
}
},
update_selected_area(state, val) {
state['selected_'+val.type] = val.val
}
},
actions: {
async search_province(context) {
context.commit("update_search_status", 1)
// context.commit("update_area", {records:[], total:0, total_display:0, type:'city'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
// context.commit("update_selected_area", {type:'city',val:null})
// context.commit("update_selected_area", {type:'district',val:null})
// context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_province(context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'provinces'
}
context.commit("update_area", data)
context.dispatch("search_city")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message",e.message )
}
},
async search_city(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'district',val:null})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_city(context.state.selected_province.M_ProvinceID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'cities'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_district")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_district(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_district(context.state.selected_city.M_CityID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'districts'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_kelurahan")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_kelurahan(context) {
// City
context.commit("update_search_status", 1)
try {
let resp = await api.search_kelurahan(context.state.selected_district.M_DistrictID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'villages'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
}
}
}

View File

@@ -0,0 +1,761 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/company.js"
export default {
namespaced: true,
state: {
act: 'new',
actcompanytype: 'new',
actcompanybusiness: 'new',
lookup_company: 0,
lookup_error_message: '',
companys: [],
total_companys: 0,
total_filter_companys: 0,
selected_company: {
name: "[ Belum memilih Kelompok Pelanggan ]"
},
save_status: 0,
save_error_message: '',
dialog_form_company: false,
dialog_form_company_afterrelease: false,
dialog_form_companytype: false,
dialog_form_companybusiness: false,
dialog_edit_form_company: false,
alert_success: false,
msg_success: "",
show_all: 'N',
errors: [],
companytypes: [],
companytype: {},
staffs: [],
staff: {},
companylevels: [],
companylevel: {},
companybusinesss: [],
companybusiness: {},
hierarkis: [],
hierarki: {},
doctors: [],
doctor: {},
get_data_status: 0,
get_data_error_message: '',
cities: [],
cities_address: {},
autocomplete_status: 0,
search_status: 0,
provinces: [],
province_address: {},
citys: [],
city_address: {},
districts: [],
district_address: {},
kelurahans: [],
kelurahan_address: {}
},
mutations: {
update_act(state, val) {
state.act = val
},
update_errors(state, val) {
state.errors = val
},
update_show_all(state, val) {
state.show_all = val
},
update_lookup_error_message(state, status) {
state.lookup_error_message = status
},
update_lookup_company(state, status) {
state.lookup_company = status
},
update_companys(state, data) {
state.companys = data.records
state.total_companys = data.total
state.total_filter_companys = data.total_filter
},
update_selected_company(state, val) {
state.selected_company = val
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_company(state, val) {
state.dialog_form_company = val
},
update_dialog_form_company_afterrelease(state, val) {
state.dialog_form_company_afterrelease = val
},
update_dialog_form_companytype(state, val) {
state.dialog_form_companytype = val
},
update_dialog_form_companybusiness(state, val) {
state.dialog_form_companybusiness = val
},
update_dialog_edit_form_company(state, val) {
state.dialog_edit_form_company = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_companytypes(state, data) {
state.companytypes = data
},
update_companytype(state, val) {
state.companytype = val
},
update_staffs(state, data) {
state.staffs = data
},
update_staff(state, val) {
state.staff = val
},
update_companylevels(state, data) {
state.companylevels = data
},
update_companylevel(state, val) {
state.companylevel = val
},
update_companybusinesss(state, data) {
state.companybusinesss = data
},
update_companybusiness(state, val) {
state.companybusiness = val
},
update_hierarkis(state, data) {
state.hierarkis = data
},
update_hierarki(state, val) {
state.hierarki = val
},
update_doctors(state, data) {
state.doctors = data
},
update_doctor(state, val) {
state.doctor = val
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_get_data_error_message(state, val) {
state.get_data_error_message = val
},
update_cities(state, val) {
state.cities = val
},
update_cities_address(state, val) {
state.cities_address = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_provinces(state, val) {
state.provinces = val
},
update_province_address(state, val) {
state.province_address = val
},
update_citys(state, val) {
state.citys = val
},
update_city_address(state, val) {
state.city_address = val
},
update_districts(state, val) {
state.districts = val
},
update_district_address(state, val) {
state.district_address = val
},
update_kelurahans(state, val) {
state.kelurahans = val
},
update_kelurahan_address(state, val) {
state.kelurahan_address = val
}
},
actions: {
async lookup(context, prm) {
context.commit("update_lookup_company", 1)
try {
let resp = await api.lookup(one_token(), prm.search, prm.all)
if (resp.status != "OK") {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_company", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_filter: resp.data.total_filter
}
context.commit("update_companys", data)
}
} catch (e) {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", e.message)
}
},
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)
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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah tersimpan dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
} 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 update(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.update(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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah terupdate dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async updateafterrelease(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updateafterrelease(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_alert_success", true)
context.commit("update_dialog_form_company_afterrelease", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah terupdate dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(), prm.companyid)
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_alert_success", true)
var msg = "Schedule " + prm.companyname + " sudah dihapus dong"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.commit("update_selected_company", {})
context.dispatch("lookup", {
search: ""
})
context.commit("sampletype/update_company_sampletype", [], {
root: true
})
}
} catch (e) {
context.commit("update_save_status", 3)
console.log(e)
}
},
async savecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanytype(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_companytypes", resp.data.records.companytypes)
} 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 updatecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanytype(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanytype(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companytypes", resp.data.records.companytypes)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async savecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
} 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 selectcompanylevel(context,prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanylevel(one_token(),prm)
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companylevels", resp.data.records.companylevels)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selecthierarchy(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selecthierarchy(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_hierarkis", resp.data.records.hierarchys)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async updatecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanybusiness(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanybusiness(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companybusinesss", resp.data.records.companybusinesss)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selectdoctor(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectdoctor(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_doctors", resp.data.records.doctors)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
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 searchdoctor(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchdoctor(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_doctors", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async searchcompanylevel(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchcompanylevel(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_companylevels", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async getprovince(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getprovince(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_provinces", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getcity(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getcity(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_citys", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getstaff(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getstaff(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_staffs", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getdistrict(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getdistrict(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_districts", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getkelurahan(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getkelurahan(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_kelurahans", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
}
}
}

View File

@@ -0,0 +1,497 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/mou.js"
export default {
namespaced: true,
state: {
mous: [],
save_status: 0,
save_error_message: '',
dialog_form_mou: false,
dialog_confirm_alert_mou: false,
dialog_status_order: false,
lookup_mou: 0,
search_status: 0,
errors:[],
startdate:moment(new Date()).format('DD-MM-YYYY'),
enddate:moment(new Date()).format('DD-MM-YYYY'),
bases: [],
base: {},
omzettypes: [],
omzettype: {},
moutypes: [],
moutype: {},
agingtypes: [],
agingtype: {},
statuss:[],
jpa1_name: '',
jpa2_name: '',
jpa3_name: '',
jpa4_name: '',
jpa1_percent: 0,
jpa2_percent: 0,
jpa3_percent: 0,
jpa4_percent: 0,
lastid: 0
},
mutations: {
update_lastid(state,val) {
state.lastid = val
},
update_jpa1_name(state,val) {
state.jpa1_name = val
},
update_jpa2_name(state,val) {
state.jpa2_name = val
},
update_jpa3_name(state,val) {
state.jpa3_name = val
},
update_jpa4_name(state,val) {
state.jpa4_name = val
},
update_jpa1_percent(state,val) {
state.jpa1_percent = val
},
update_jpa2_percent(state,val) {
state.jpa2_percent = val
},
update_jpa3_percent(state,val) {
state.jpa3_percent = val
},
update_jpa4_percent(state,val) {
state.jpa4_percent = val
},
update_errors(state, val) {
state.errors = val
},
update_mous(state, data) {
state.mous = data
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_mou(state, val) {
state.dialog_form_mou = val
},
update_dialog_confirm_alert_mou(state, val) {
state.dialog_confirm_alert_mou = val
},
update_lookup_mou(state, val) {
state.lookup_mou = val
},
update_startdate(state,val){
state.startdate = val
},
update_enddate(state,val){
state.enddate = val
},
update_bases(state, data) {
state.bases = data
},
update_base(state, val) {
state.base = val
},
update_omzettypes(state, data) {
state.omzettypes = data
},
update_omzettype(state, val) {
state.omzettype = val
},
update_moutypes(state, data) {
state.moutypes = data
},
update_moutype(state, val) {
state.moutype = val
},
update_agingtypes(state, data) {
state.agingtypes = data
},
update_agingtype(state, val) {
state.agingtype = val
},
update_search_status(state, val) {
state.search_status = val
},
update_statuss(state,data){
state.statuss = data
},
update_dialog_status_order(state, val) {
state.dialog_status_order = val
}
},
actions: {
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("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
alert(resp.message)
} else {
var data = {
records: resp.data.records,
total: resp.data.total,
lastid: resp.data.lastid
}
if(data.total !== -1){
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.commit("update_dialog_form_mou", false)
var msg = "Agreement " + prm.companyname + " sudah update dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
if(prm.isconfirm === 'N'){
context.commit("update_dialog_confirm_alert_mou", true)
}
context.commit("update_lastid", data.lastid)
context.dispatch("lookup", {
id: prm.companyid
})
}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 saveafterrelease(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.saveafterrelease(prm)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, {
root: true
})
context.commit("company/update_save_error_message", resp.message, {
root: true
})
var msg = resp.message
var str = msg[1].split('[message] =>').splice(1).join('[message] =>')
var note = str.replace('\\n)\\n\"}"', '')
console.log(note)
context.commit("update_msgalertverif", msg)
context.commit("update_dialog_alert_verif", true)
context.dispatch("lookup", {
id: prm.companyid
})
} else {
var data = {
records: resp.data.records,
total: resp.data.total
}
if (data.total !== -1) {
context.commit("company/update_save_status", 2, {
root: true
})
context.commit("company/update_save_error_message", resp.message, {
root: true
})
context.commit("company/update_alert_success", true, {
root: true
})
context.commit("update_dialog_form_mou", false)
var msg = "Agreement " + prm.companyname + " sudah update dong"
context.commit("company/update_msg_success", msg, {
root: true
})
context.commit("company/update_alert_success", true, {
root: true
})
context.dispatch("lookup", {
id: prm.companyid
})
} 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 lookupx(context, prm) {
context.commit("update_lookup_mou", 1)
try {
let resp = await api.lookupx(one_token(),prm.id)
if (resp.status != "OK") {
context.commit("update_lookup_mou", 3)
} else {
context.commit("update_lookup_mou", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_mous", data.records)
}
} catch (e) {
context.commit("update_lookup_mou", 3)
}
},
async lookup(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.lookup(one_token(),prm.id)
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_mous", data.records)
console.log('status')
console.log(data.records.statuss)
context.commit("update_statuss", data.records.statuss)
}
} catch (e) {
context.commit("update_save_status", 3)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dihapus dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async confirm(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xconfirm(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dikonfirmasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async verify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah diverifikasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unverify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Verifikasi Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async release(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dirilis"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unrelease(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Rilis Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectbase(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectbase(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_bases", resp.data.records.bases)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectomzettype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectomzettype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_omzettypes", resp.data.records.omzettypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectmoutype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectmoutype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_moutypes", resp.data.records.moutypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectagingtype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectagingtype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_agingtypes", resp.data.records.agingtypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
}
}
}

View File

@@ -0,0 +1,27 @@
// State
// data ...
// Mutations
//
//
// Actions
import company from "./modules/company.js";
import mou from "./modules/mou.js";
import area from "./modules/area.js";
import system from "../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
company: company,
mou: mou,
area: area,
system:system
},
state: {
},
mutations: {
},
actions: {
}
});

View File

@@ -0,0 +1,31 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank";
export async function searchBank(query, page, rowPerPage = 15) {
try {
var resp = await axios.post(URL, {
query: query,
page: page,
rowPerPage: rowPerPage
});
if (resp.status != 200) {
return {
status: "ERR",
query: query,
message: resp.statusText
};
}
let data = resp.data;
data.query = query;
return data;
} catch (e) {
return {
status: "ERR",
query: query,
message: e.message
};
}
}

View File

@@ -0,0 +1,92 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"/one-api/v1/clinic/fo/";
export async function search_province(search) {
try {
var resp = await axios.post(URL + 'area/search_province', {
search: search
});
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 search_city(province_id, search) {
try {
var resp = await axios.post(URL + 'area/search_city', {
search: search,
province_id: province_id
});
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 search_district(city_id, search) {
try {
var resp = await axios.post(URL + 'area/search_district', {
search: search,
city_id: city_id
});
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 search_kelurahan(district_id, search) {
try {
var resp = await axios.post(URL + 'area/search_kelurahan', {
search: search,
district_id: district_id
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,424 @@
const URL = "/one-api/v1/masterdata/";
export async function lookup(token, search,all ) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/lookup', { token: token, search: search, all:all });
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 + 'companyadmin_v11/addnewcompany', 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 update(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/editcompany', 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 updateafterrelease(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/editcompanyafterrelease', 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(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/deletecompany', { id: id, 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 savecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/addnewcompanytype', 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 updatecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/editcompanytype', 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 deletecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/deletecompanytype', 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 selectcompanytype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/selectcompanytype',{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 savecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/addnewcompanybusiness', 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 updatecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/editcompanybusiness', 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 deletecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/deletecompanybusiness', 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 selectcompanybusiness(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/selectcompanybusiness',{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 selecthierarchy(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/selecthierarchy',{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 selectcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/selectcompanylevel',{token:token,id:prm.id});
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 + 'companyadmin_v11/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 searchdoctor(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/searchdoctor',{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 searchcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/searchcompanylevel',{token:token,name:prm.name,id:prm.id});
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 getstaff(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/getstaff',{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 getprovince(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/getprovince',{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 getcity(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/getcity',{id:prm.M_ProvinceID,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 getdistrict(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/getdistrict',{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 getkelurahan(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/getkelurahan',{token:token,id:prm.M_DistrictID});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,241 @@
const URL = "/one-api/v1/masterdata/";
export async function save(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/addnewmou', 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 saveafterrelease(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/saveafterrelease', 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(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/deletemou', { id: id ,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 xconfirm(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/confirmmou', { id: id ,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 xverify(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/verifymou', { id: id ,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 xunverify(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/unverifymou', { id: id ,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 xrelease(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/releasemou', { id: id ,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 xunrelease(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/unreleasemou', { id: id ,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 lookup(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/lookupmou', 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 selectbase(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/selectbase',{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 selectomzettype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/selectomzettype',{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 selectmoutype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/selectmoutype',{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 selectagingtype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v11/selectagingtype',{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
};
}
}

View File

@@ -0,0 +1,757 @@
<template>
<v-layout>
<template>
<v-dialog v-model="dialogdeletealert" max-width="30%">
<v-card>
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pt-2 pr-2 xs12>
{{msgalert}}
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialogdeletealert = false">
Tutup
</v-btn>
<v-btn color="primary" flat @click="closeDeleteAlert()">
Yakin lah
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<v-flex xs12>
<v-card class="scroll-container" style="/*max-height:645px;overflow: auto;*/">
<v-toolbar color="blue lighten-3" dark height="50px">
<v-toolbar-title>PERUSAHAAN</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="openFormPerusahaan()" icon>
<v-icon>library_add</v-icon>
</v-btn>
</v-toolbar>
<v-snackbar v-model="snackbar" :color="color" :timeout="5000" :multi-line="false" :vertical="false" :top="true">
{{msgsnackbar}}
<v-btn flat @click="updateAlert_success(false)">
Tutup
</v-btn>
</v-snackbar>
<v-layout row style="background:#bbdefb;padding-top:5px;" justify-left>
<v-list-tile>
<input type="text" v-model="xsearch" class="textinput" placeholder="Cari ..." />
</v-list-tile-content>
</v-list-tile>
</v-layout>
<v-divider></v-divider>
<div v-for="(vs,index) in vcompanys">
<v-layout pa-2 v-if="isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxsolid" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxsolid text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:#ffffff" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:#ffffff" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-layout pa-2 v-if="!isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxoutline" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxoutline text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:red" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:red" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-divider></v-divider>
</div>
<v-layout row>
<v-flex class="text-xs-center" pt-3 xs12>
<p style="margin-bottom:2px;color: rgba(0,0,0,0.54);font-size:12px;">Menampilkan <span class="red--text">{{xtotalfiltercompanys}}</span> dari <span class="red--text">{{xtotalcompanys}}</span> total data</p>
<v-btn small v-if="xshowall === 'N'" flat @click="updateShowAll('Y')" color="primary" dark>Tampilkan Semua</v-btn>
<v-btn small v-if="xshowall === 'Y'" flat @click="updateShowAll('N')" color="primary" dark>Batasi data</v-btn>
</v-flex>
</v-layout>
<template>
<v-layout row justify-center>
<v-dialog v-model="dialogcompany" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Form Perusahaan</span>
</v-card-title>
<v-card-text class="pt-0 pb-0">
<v-form ref="formcompany" v-model="valid" lazy-validation>
<v-layout wrap>
<v-flex xs12>
<v-text-field v-model="companyname" label="Nama Perusahaan" :rules="nameRules" required></v-text-field>
</v-flex>
<v-flex xs12>
<v-layout>
<v-flex xs6 pa-1>
<v-select item-text="M_CompanyTypeName" :disabled="readonlytypecompany" return-object :items="xcompanytypes" v-model="xcompanytype"
label="Tipe Perusahaan"></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field :disabled="readonlytypecompanynew" v-model="companytypenew" label="Tipe Perusahaan Baru"></v-text-field>
</v-flex>
</v-layout>
</v-flex>
<v-flex xs6>
<v-autocomplete label="Dokter" v-model="doctor" :items="xdoctors" :search-input.sync="search_doctor" auto-select-first no-filter
item-text="M_DoctorNames" return-object :loading="isLoading" no-data-text="Pilih Dokter">
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.M_DoctorNames"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex xs6 pa-1>
<v-select item-text="M_StaffName" :disabled="readonlystaff" return-object :items="xstaffs" v-model="xstaff"
label="Makerting"></v-select>
</v-flex>
<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 :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>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_DistrictName"
return-object
:items="xdistricts"
v-model="districtaddress"
label="Kecamatan*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_KelurahanName"
return-object
:items="xkelurahans"
v-model="kelurahanaddress"
label="Kelurahan / Desa*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companypic" label="PIC Perusahaan"></v-text-field>
</v-flex>
<v-flex xs12>
<v-text-field v-model="companyaddress" label="Alamat Perusahaan" :rules="addressRules" required></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyphone" label="Telpon Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyemail" label="Email Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="isdefault" label="Default?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabfrom" label="Rekanan Yang Merujuk?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabto" label="Rekanan Tujuan ?"></v-checkbox>
</v-flex>
<v-flex>
<p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="updateDialogFormPerusahaan()">Tutup</v-btn>
<v-btn v-if="xact === 'new'" color="blue darken-1" flat @click="saveFormPerusahaan()">Simpan</v-btn>
<v-btn v-if="xact === 'edit'" color="blue darken-1" flat @click="updateFormPerusahaan()">Simpan Perubahan</v-btn>
</v-card-actions>
</v-form>
</v-card>
</v-dialog>
</v-layout>
</template>
</v-card>
</v-flex>
</v-layout>
</template>
<style scoped>
.textinput {
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
width: 100%;
padding: 8px 10px;
margin-bottom: 5px;
box-sizing: border-box;
border: 1px solid #607d8b;
}
.textinput:focus {
width: 100%;
}
.textinput:focus::-webkit-input-placeholder {
color: transparent;
}
.textinput:focus::-moz-placeholder {
color: transparent;
}
.textinput:-moz-placeholder {
color: transparent;
}
.boxoutline {
color: red;
border: 1px solid red;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #ffffff;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxoutline:hover {
background: rgba(0, 0, 0, 0.07) !important;
font-size: 15px;
font-weight: 700;
}
.boxsolid {
color: #ffffff;
border: 1px solid #ffffff;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #f44336;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxsolid:hover {
background: #f44336de;
font-size: 15px;
font-weight: 700;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
</style>
<script>
module.exports = {
data: () => ({
color: "success",
valid: false,
companyname: '',
companytypenew: '',
companyaddress: '',
companyphone: '',
companyemail: '',
companypic: '',
companymindp: '',
search_city: '',
search_doctor: '',
nameRules: [
v => !!v || 'Nama Perusahaan harus diisi'
],
addressRules: [
v => !!v || 'Alamat Perusahaan harus diisi'
],
dialogdeletealert: false,
msgalert: "",
xid: 0,
xsearch: "",
isdefault: "",
islabfrom: "",
islabto: "",
isnewcompanytype: false,
readonlytypecompany: false,
readonlystaff: false,
readonlytypecompanynew: false
}),
async mounted() {
await this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
await this.$store.dispatch("company/selectcompanytype")
await this.$store.dispatch("company/selectstaff")
},
computed: {
xact() {
return this.$store.state.company.act
},
xerrors() {
return this.$store.state.company.errors
},
xshowall() {
return this.$store.state.company.show_all
},
vcompanys() {
return this.$store.state.company.companys
},
xtotalcompanys() {
return this.$store.state.company.total_companys
},
xtotalfiltercompanys() {
return this.$store.state.company.total_filter_companys
},
dialogcompany() {
return this.$store.state.company.dialog_form_company
},
snackbar: {
get() {
return this.$store.state.company.alert_success
},
set(val) {
this.$store.commit("company/update_alert_success", val)
}
},
msgsnackbar() {
return this.$store.state.company.msg_success
},
lookupstatus() {
return this.$store.state.company.lookup_company
},
xcompanytypes() {
return this.$store.state.company.companytypes
},
xcompanytype: {
get() {
return this.$store.state.company.companytype
},
set(val) {
this.$store.commit("company/update_companytype", val)
}
},
xstaffs() {
return this.$store.state.company.staffs
},
xstaff: {
get() {
return this.$store.state.company.staff
},
set(val) {
this.$store.commit("company/update_staff", val)
}
},
isLoading() {
return this.$store.state.company.search_status == 1
},
xcities() {
return this.$store.state.company.cities
},
cityaddress: {
get() {
return this.$store.state.company.city_address
},
set(val) {
this.$store.commit("company/update_city_address", val)
this.$store.dispatch("company/getdistrict", this.$store.state.company.city_address)
}
},
xdoctors() {
return this.$store.state.company.doctors
},
doctor: {
get() {
return this.$store.state.company.doctor
},
set(val) {
this.$store.commit("company/update_doctor", val)
}
},
xdistricts(){
return this.$store.state.company.districts
},
districtaddress:{
get() {
return this.$store.state.company.district_address
},
set(val) {
this.$store.commit("company/update_district_address",val)
this.$store.dispatch("company/getkelurahan",this.$store.state.company.district_address)
}
},
xkelurahans(){
return this.$store.state.company.kelurahans
},
kelurahanaddress:{
get() {
return this.$store.state.company.kelurahan_address
},
set(val) {
this.$store.commit("company/update_kelurahan_address",val)
}
}
},
methods: {
updateShowAll(val) {
this.$store.commit("company/update_show_all", val)
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
},
isSelected(p) {
return p.id == this.$store.state.company.selected_company.id
},
subname(name) {
var xname = name
if (xname.length > 18) {
xname = xname.substring(0, 18) + '...'
}
return xname
},
async selectMe(sc) {
await this.$store.commit("company/update_selected_company", sc)
await this.$store.dispatch("mou/lookup", {
id: this.$store.state.company.selected_company.id
})
//set staff
let staff_id = 0
try {
staff_id = this.$store.state.company.selected_company.M_StaffID
for(let idx=0; idx < this.$store.state.company.staffs.length ; idx++) {
let stf = this.$store.state.company.staffs[idx]
if (stf.M_StaffID == staff_id ) {
this.$store.commit("company/update_staff",stf)
break;
}
}
} catch(e) {
}
},
updateDialogFormPerusahaan() {
this.$store.commit("company/update_dialog_form_company", false)
},
openFormPerusahaan() {
this.search_city = ''
this.$store.commit("company/update_cities", [])
this.cityaddress = {}
this.search_doctor = ''
this.$store.commit("company/update_doctors", [])
this.doctor = {}
this.$store.commit("company/update_districts",[])
this.districtaddress = {}
this.$store.commit("company/update_kelurahans",[])
this.kelurahanaddress = {}
this.companytypenew = ""
this.$refs.formcompany.reset()
this.$refs.formcompany.resetValidation()
this.$store.commit("company/update_act", 'new')
this.$store.commit("company/update_dialog_form_company", true)
},
thr_search_city: _.debounce(function () {
this.$store.dispatch("company/searchcity", this.search_city)
}, 2000),
thr_search_doctor: _.debounce(function () {
this.$store.dispatch("company/searchdoctor", this.search_doctor)
}, 2000),
saveFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if ((_.isEmpty(this.companytypenew))) {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if (newcompanytype == "") {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan: this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateAlert_success(val) {
this.$store.commit("company/update_alert_success", val)
},
editPerusahaan(data) {
this.xid = data.id
this.companyname = data.name
this.$store.commit("company/update_cities", [{
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}])
this.cityaddress = {
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}
this.$store.commit("company/update_doctors", [{
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}])
this.doctor = {
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}
this.$store.commit("company/update_districts", [{
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}])
this.districtaddress = {
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}
this.$store.commit("company/update_kelurahans", [{
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}])
this.kelurahanaddress = {
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}
this.companyaddress = data.address
this.companyphone = data.phone
this.companyemail = data.email
this.companypic = data.pic
this.companytypenew = ""
this.isdefault = data.isdefault === 'N' ? false : true
this.islabfrom = data.islabfrom === 'N' ? false : true
this.islabto = data.islabto === 'N' ? false : true
this.$store.commit("company/update_act", 'edit')
this.$store.commit("company/update_dialog_form_company", true)
var companytypes = this.$store.state.company.companytypes
var idx_companytype = _.findIndex(companytypes, function (o) {
return o.M_CompanyTypeID == data.companytypeid
})
var companytype = companytypes[idx_companytype]
this.$store.commit("company/update_companytype", companytype)
},
deletePerusahaan(data) {
this.xid = data.id
var xdata = {
id: data.id,
name: data.name,
mous: 'xxx'
}
this.$store.commit("company/update_selected_company", xdata)
this.msgalert = "Yakin, mau hapus company " + data.name + " ?"
this.dialogdeletealert = true
},
changeNewCompanyType(value) {
this.readonlytypecompany = value === true ? true : false
this.readonlytypecompanynew = value === true ? false : true
},
newCompanyType() {
readonlytypecompany: true
readonlytypecompanynew: false
},
closeDeleteAlert() {
this.$store.dispatch("company/delete", {
companyid: this.$store.state.company.selected_company.id,
companyname: this.$store.state.company.selected_company.name
})
this.dialogdeletealert = false
},
thr_search: _.debounce(function () {
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
}, 1000)
},
watch: {
xsearch(val, old) {
if (val !== old && this.lookupstatus !== 1) {
console.log(val)
this.xsearch = val
this.thr_search()
}
},
search_city(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_city()
},
search_doctor(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_doctor()
}
}
}
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<!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 class="blue lighten-5" >
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap >
<v-flex xs3 class="left" fill-height pa-1>
<!-- komponen kiri -->
<one-md-company-list></one-md-company-list>
</v-flex>
<v-flex xs9 class="right" fill-height pa-1>
<!-- komponen kanan -->
<one-md-mou-list></one-md-mou-list>
</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">
import { store } from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
components: {
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
'one-md-company-list': httpVueLoader('./components/oneMdCompanyList.vue'),
'one-md-mou-list' : httpVueLoader('./components/oneMdMouList.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,194 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/area.js"
window.api = api
export default {
namespaced: true,
state: {
search: '',
search_status:0,
search_error_message:'',
search_dialog_is_active: false,
provinces: [],
cities: [],
districts: [],
villages: [],
total_provinces: 0,
total_cities: 0,
total_districts: 0,
total_villages: 0,
total_display: 0,
selected_province: {},
selected_city: {},
selected_district: {},
selected_village: {}
},
mutations: {
update_search_dialog_is_active(state,status) {
state.search_dialog_is_active = status
},
update_search_error_message(state,status) {
state.search_error_message = status
},
update_search(state,val) {
state.search=val
},
update_search_status(state,status) {
state.search_status = status
},
update_area(state, data) {
state[data.type] = data.records
state['total_'+data.type] = data.total
state.total_display = data.total_display
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = null
else if (data.type == "cities")
state['selected_city'] = null
for (let i in data.records) {
if (data.records[i].is_default == "Y") {
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = data.records[i]
else if (data.type == "cities")
state['selected_city'] = data.records[i]
}
}
},
update_selected_area(state, val) {
state['selected_'+val.type] = val.val
}
},
actions: {
async search_province(context) {
context.commit("update_search_status", 1)
// context.commit("update_area", {records:[], total:0, total_display:0, type:'city'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
// context.commit("update_selected_area", {type:'city',val:null})
// context.commit("update_selected_area", {type:'district',val:null})
// context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_province(context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'provinces'
}
context.commit("update_area", data)
context.dispatch("search_city")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message",e.message )
}
},
async search_city(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'district',val:null})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_city(context.state.selected_province.M_ProvinceID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'cities'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_district")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_district(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_district(context.state.selected_city.M_CityID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'districts'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_kelurahan")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_kelurahan(context) {
// City
context.commit("update_search_status", 1)
try {
let resp = await api.search_kelurahan(context.state.selected_district.M_DistrictID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'villages'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
}
}
}

View File

@@ -0,0 +1,761 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/company.js"
export default {
namespaced: true,
state: {
act: 'new',
actcompanytype: 'new',
actcompanybusiness: 'new',
lookup_company: 0,
lookup_error_message: '',
companys: [],
total_companys: 0,
total_filter_companys: 0,
selected_company: {
name: "[ Belum memilih Kelompok Pelanggan ]"
},
save_status: 0,
save_error_message: '',
dialog_form_company: false,
dialog_form_company_afterrelease: false,
dialog_form_companytype: false,
dialog_form_companybusiness: false,
dialog_edit_form_company: false,
alert_success: false,
msg_success: "",
show_all: 'N',
errors: [],
companytypes: [],
companytype: {},
staffs: [],
staff: {},
companylevels: [],
companylevel: {},
companybusinesss: [],
companybusiness: {},
hierarkis: [],
hierarki: {},
doctors: [],
doctor: {},
get_data_status: 0,
get_data_error_message: '',
cities: [],
cities_address: {},
autocomplete_status: 0,
search_status: 0,
provinces: [],
province_address: {},
citys: [],
city_address: {},
districts: [],
district_address: {},
kelurahans: [],
kelurahan_address: {}
},
mutations: {
update_act(state, val) {
state.act = val
},
update_errors(state, val) {
state.errors = val
},
update_show_all(state, val) {
state.show_all = val
},
update_lookup_error_message(state, status) {
state.lookup_error_message = status
},
update_lookup_company(state, status) {
state.lookup_company = status
},
update_companys(state, data) {
state.companys = data.records
state.total_companys = data.total
state.total_filter_companys = data.total_filter
},
update_selected_company(state, val) {
state.selected_company = val
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_company(state, val) {
state.dialog_form_company = val
},
update_dialog_form_company_afterrelease(state, val) {
state.dialog_form_company_afterrelease = val
},
update_dialog_form_companytype(state, val) {
state.dialog_form_companytype = val
},
update_dialog_form_companybusiness(state, val) {
state.dialog_form_companybusiness = val
},
update_dialog_edit_form_company(state, val) {
state.dialog_edit_form_company = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_companytypes(state, data) {
state.companytypes = data
},
update_companytype(state, val) {
state.companytype = val
},
update_staffs(state, data) {
state.staffs = data
},
update_staff(state, val) {
state.staff = val
},
update_companylevels(state, data) {
state.companylevels = data
},
update_companylevel(state, val) {
state.companylevel = val
},
update_companybusinesss(state, data) {
state.companybusinesss = data
},
update_companybusiness(state, val) {
state.companybusiness = val
},
update_hierarkis(state, data) {
state.hierarkis = data
},
update_hierarki(state, val) {
state.hierarki = val
},
update_doctors(state, data) {
state.doctors = data
},
update_doctor(state, val) {
state.doctor = val
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_get_data_error_message(state, val) {
state.get_data_error_message = val
},
update_cities(state, val) {
state.cities = val
},
update_cities_address(state, val) {
state.cities_address = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_provinces(state, val) {
state.provinces = val
},
update_province_address(state, val) {
state.province_address = val
},
update_citys(state, val) {
state.citys = val
},
update_city_address(state, val) {
state.city_address = val
},
update_districts(state, val) {
state.districts = val
},
update_district_address(state, val) {
state.district_address = val
},
update_kelurahans(state, val) {
state.kelurahans = val
},
update_kelurahan_address(state, val) {
state.kelurahan_address = val
}
},
actions: {
async lookup(context, prm) {
context.commit("update_lookup_company", 1)
try {
let resp = await api.lookup(one_token(), prm.search, prm.all)
if (resp.status != "OK") {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_company", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_filter: resp.data.total_filter
}
context.commit("update_companys", data)
}
} catch (e) {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", e.message)
}
},
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)
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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah tersimpan dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
} 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 update(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.update(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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah terupdate dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async updateafterrelease(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updateafterrelease(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_alert_success", true)
context.commit("update_dialog_form_company_afterrelease", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah terupdate dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(), prm.companyid)
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_alert_success", true)
var msg = "Schedule " + prm.companyname + " sudah dihapus dong"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.commit("update_selected_company", {})
context.dispatch("lookup", {
search: ""
})
context.commit("sampletype/update_company_sampletype", [], {
root: true
})
}
} catch (e) {
context.commit("update_save_status", 3)
console.log(e)
}
},
async savecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanytype(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_companytypes", resp.data.records.companytypes)
} 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 updatecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanytype(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanytype(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companytypes", resp.data.records.companytypes)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async savecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
} 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 selectcompanylevel(context,prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanylevel(one_token(),prm)
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companylevels", resp.data.records.companylevels)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selecthierarchy(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selecthierarchy(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_hierarkis", resp.data.records.hierarchys)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async updatecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanybusiness(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanybusiness(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companybusinesss", resp.data.records.companybusinesss)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selectdoctor(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectdoctor(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_doctors", resp.data.records.doctors)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
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 searchdoctor(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchdoctor(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_doctors", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async searchcompanylevel(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchcompanylevel(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_companylevels", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async getprovince(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getprovince(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_provinces", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getcity(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getcity(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_citys", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getstaff(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getstaff(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_staffs", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getdistrict(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getdistrict(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_districts", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getkelurahan(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getkelurahan(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_kelurahans", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
}
}
}

View File

@@ -0,0 +1,511 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/mou.js"
export default {
namespaced: true,
state: {
mous: [],
save_status: 0,
save_error_message: '',
dialog_form_mou: false,
dialog_confirm_alert_mou: false,
dialog_status_order: false,
lookup_mou: 0,
search_status: 0,
errors:[],
startdate:moment(new Date()).format('DD-MM-YYYY'),
enddate:moment(new Date()).format('DD-MM-YYYY'),
bases: [],
base: {},
omzettypes: [],
omzettype: {},
moutypes: [],
moutype: {},
agingtypes: [],
agingtype: {},
statuss:[],
jpa1_name: '',
jpa2_name: '',
jpa3_name: '',
jpa4_name: '',
jpa1_percent: 0,
jpa2_percent: 0,
jpa3_percent: 0,
jpa4_percent: 0,
lastid: 0,
xsearch: ''
},
mutations: {
update_xsearch(state,val) {
state.xsearch = val
},
update_lastid(state,val) {
state.lastid = val
},
update_jpa1_name(state,val) {
state.jpa1_name = val
},
update_jpa2_name(state,val) {
state.jpa2_name = val
},
update_jpa3_name(state,val) {
state.jpa3_name = val
},
update_jpa4_name(state,val) {
state.jpa4_name = val
},
update_jpa1_percent(state,val) {
state.jpa1_percent = val
},
update_jpa2_percent(state,val) {
state.jpa2_percent = val
},
update_jpa3_percent(state,val) {
state.jpa3_percent = val
},
update_jpa4_percent(state,val) {
state.jpa4_percent = val
},
update_errors(state, val) {
state.errors = val
},
update_mous(state, data) {
state.mous = data
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_mou(state, val) {
state.dialog_form_mou = val
},
update_dialog_confirm_alert_mou(state, val) {
state.dialog_confirm_alert_mou = val
},
update_lookup_mou(state, val) {
state.lookup_mou = val
},
update_startdate(state,val){
state.startdate = val
},
update_enddate(state,val){
state.enddate = val
},
update_bases(state, data) {
state.bases = data
},
update_base(state, val) {
state.base = val
},
update_omzettypes(state, data) {
state.omzettypes = data
},
update_omzettype(state, val) {
state.omzettype = val
},
update_moutypes(state, data) {
state.moutypes = data
},
update_moutype(state, val) {
state.moutype = val
},
update_agingtypes(state, data) {
state.agingtypes = data
},
update_agingtype(state, val) {
state.agingtype = val
},
update_search_status(state, val) {
state.search_status = val
},
update_statuss(state,data){
state.statuss = data
},
update_dialog_status_order(state, val) {
state.dialog_status_order = val
}
},
actions: {
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("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
alert(resp.message)
} else {
var data = {
records: resp.data.records,
total: resp.data.total,
lastid: resp.data.lastid
}
if(data.total !== -1){
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.commit("update_dialog_form_mou", false)
var msg = "Agreement " + prm.companyname + " sudah update dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
if(prm.isconfirm === 'N'){
context.commit("update_dialog_confirm_alert_mou", true)
}
context.commit("update_lastid", data.lastid)
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
}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 saveafterrelease(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.saveafterrelease(prm)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, {
root: true
})
context.commit("company/update_save_error_message", resp.message, {
root: true
})
var msg = resp.message
var str = msg[1].split('[message] =>').splice(1).join('[message] =>')
var note = str.replace('\\n)\\n\"}"', '')
console.log(note)
context.commit("update_msgalertverif", msg)
context.commit("update_dialog_alert_verif", true)
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
} else {
var data = {
records: resp.data.records,
total: resp.data.total
}
if (data.total !== -1) {
context.commit("company/update_save_status", 2, {
root: true
})
context.commit("company/update_save_error_message", resp.message, {
root: true
})
context.commit("company/update_alert_success", true, {
root: true
})
context.commit("update_dialog_form_mou", false)
var msg = "Agreement " + prm.companyname + " sudah update dong"
context.commit("company/update_msg_success", msg, {
root: true
})
context.commit("company/update_alert_success", true, {
root: true
})
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
} 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 lookupx(context, prm) {
context.commit("update_lookup_mou", 1)
try {
let resp = await api.lookupx(one_token(),prm.id)
if (resp.status != "OK") {
context.commit("update_lookup_mou", 3)
} else {
context.commit("update_lookup_mou", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_mous", data.records)
}
} catch (e) {
context.commit("update_lookup_mou", 3)
}
},
async lookup(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.lookup(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_mous", data.records)
console.log('status')
console.log(data.records.statuss)
context.commit("update_statuss", data.records.statuss)
}
} catch (e) {
context.commit("update_save_status", 3)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dihapus dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async confirm(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xconfirm(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dikonfirmasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async verify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah diverifikasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unverify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Verifikasi Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async release(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dirilis"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unrelease(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Rilis Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectbase(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectbase(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_bases", resp.data.records.bases)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectomzettype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectomzettype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_omzettypes", resp.data.records.omzettypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectmoutype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectmoutype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_moutypes", resp.data.records.moutypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectagingtype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectagingtype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_agingtypes", resp.data.records.agingtypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
}
}
}

View File

@@ -0,0 +1,27 @@
// State
// data ...
// Mutations
//
//
// Actions
import company from "./modules/company.js";
import mou from "./modules/mou.js";
import area from "./modules/area.js";
import system from "../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
company: company,
mou: mou,
area: area,
system:system
},
state: {
},
mutations: {
},
actions: {
}
});

View File

@@ -0,0 +1,31 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank";
export async function searchBank(query, page, rowPerPage = 15) {
try {
var resp = await axios.post(URL, {
query: query,
page: page,
rowPerPage: rowPerPage
});
if (resp.status != 200) {
return {
status: "ERR",
query: query,
message: resp.statusText
};
}
let data = resp.data;
data.query = query;
return data;
} catch (e) {
return {
status: "ERR",
query: query,
message: e.message
};
}
}

View File

@@ -0,0 +1,92 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"/one-api/v1/clinic/fo/";
export async function search_province(search) {
try {
var resp = await axios.post(URL + 'area/search_province', {
search: search
});
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 search_city(province_id, search) {
try {
var resp = await axios.post(URL + 'area/search_city', {
search: search,
province_id: province_id
});
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 search_district(city_id, search) {
try {
var resp = await axios.post(URL + 'area/search_district', {
search: search,
city_id: city_id
});
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 search_kelurahan(district_id, search) {
try {
var resp = await axios.post(URL + 'area/search_kelurahan', {
search: search,
district_id: district_id
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,424 @@
const URL = "/one-api/v1/masterdata/";
export async function lookup(token, search,all ) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/lookup', { token: token, search: search, all:all });
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 + 'companyadmin_v12/addnewcompany', 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 update(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/editcompany', 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 updateafterrelease(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/editcompanyafterrelease', 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(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/deletecompany', { id: id, 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 savecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/addnewcompanytype', 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 updatecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/editcompanytype', 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 deletecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/deletecompanytype', 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 selectcompanytype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/selectcompanytype',{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 savecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/addnewcompanybusiness', 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 updatecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/editcompanybusiness', 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 deletecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/deletecompanybusiness', 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 selectcompanybusiness(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/selectcompanybusiness',{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 selecthierarchy(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/selecthierarchy',{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 selectcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/selectcompanylevel',{token:token,id:prm.id});
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 + 'companyadmin_v12/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 searchdoctor(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/searchdoctor',{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 searchcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/searchcompanylevel',{token:token,name:prm.name,id:prm.id});
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 getstaff(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/getstaff',{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 getprovince(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/getprovince',{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 getcity(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/getcity',{id:prm.M_ProvinceID,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 getdistrict(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/getdistrict',{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 getkelurahan(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/getkelurahan',{token:token,id:prm.M_DistrictID});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,241 @@
const URL = "/one-api/v1/masterdata/";
export async function save(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/addnewmou', 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 saveafterrelease(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/saveafterrelease', 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(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/deletemou', { id: id ,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 xconfirm(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/confirmmou', { id: id ,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 xverify(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/verifymou', { id: id ,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 xunverify(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/unverifymou', { id: id ,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 xrelease(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/releasemou', { id: id ,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 xunrelease(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/unreleasemou', { id: id ,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 lookup(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/lookupmou', 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 selectbase(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/selectbase',{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 selectomzettype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/selectomzettype',{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 selectmoutype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/selectmoutype',{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 selectagingtype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v12/selectagingtype',{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
};
}
}

View File

@@ -0,0 +1,757 @@
<template>
<v-layout>
<template>
<v-dialog v-model="dialogdeletealert" max-width="30%">
<v-card>
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pt-2 pr-2 xs12>
{{msgalert}}
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialogdeletealert = false">
Tutup
</v-btn>
<v-btn color="primary" flat @click="closeDeleteAlert()">
Yakin lah
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<v-flex xs12>
<v-card class="scroll-container" style="/*max-height:645px;overflow: auto;*/">
<v-toolbar color="blue lighten-3" dark height="50px">
<v-toolbar-title>PERUSAHAAN</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="openFormPerusahaan()" icon>
<v-icon>library_add</v-icon>
</v-btn>
</v-toolbar>
<v-snackbar v-model="snackbar" :color="color" :timeout="5000" :multi-line="false" :vertical="false" :top="true">
{{msgsnackbar}}
<v-btn flat @click="updateAlert_success(false)">
Tutup
</v-btn>
</v-snackbar>
<v-layout row style="background:#bbdefb;padding-top:5px;" justify-left>
<v-list-tile>
<input type="text" v-model="xsearch" class="textinput" placeholder="Cari ..." />
</v-list-tile-content>
</v-list-tile>
</v-layout>
<v-divider></v-divider>
<div v-for="(vs,index) in vcompanys">
<v-layout pa-2 v-if="isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxsolid" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxsolid text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:#ffffff" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:#ffffff" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-layout pa-2 v-if="!isSelected(vs)" row>
<v-flex xs12 @click="selectMe(vs)">
<v-layout row>
<v-flex class="boxoutline" xs10>
<v-tooltip right>
<template v-slot:activator="{ on }">
<span v-html="vs.description" v-on="on"></span>
</template>
<span>{{vs.name}}</span>
</v-tooltip>
</v-flex>
<v-flex class="boxoutline text-center" style="padding-top:10px" pl-1 pb-1 pr-1 xs2>
<v-layout row align-center justify-space-between>
<v-icon style="color:red" @click="editPerusahaan(vs)">edit</v-icon>
<v-icon style="color:red" @click="deletePerusahaan(vs)">clear</v-icon>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
<v-divider></v-divider>
</div>
<v-layout row>
<v-flex class="text-xs-center" pt-3 xs12>
<p style="margin-bottom:2px;color: rgba(0,0,0,0.54);font-size:12px;">Menampilkan <span class="red--text">{{xtotalfiltercompanys}}</span> dari <span class="red--text">{{xtotalcompanys}}</span> total data</p>
<v-btn small v-if="xshowall === 'N'" flat @click="updateShowAll('Y')" color="primary" dark>Tampilkan Semua</v-btn>
<v-btn small v-if="xshowall === 'Y'" flat @click="updateShowAll('N')" color="primary" dark>Batasi data</v-btn>
</v-flex>
</v-layout>
<template>
<v-layout row justify-center>
<v-dialog v-model="dialogcompany" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Form Perusahaan</span>
</v-card-title>
<v-card-text class="pt-0 pb-0">
<v-form ref="formcompany" v-model="valid" lazy-validation>
<v-layout wrap>
<v-flex xs12>
<v-text-field v-model="companyname" label="Nama Perusahaan" :rules="nameRules" required></v-text-field>
</v-flex>
<v-flex xs12>
<v-layout>
<v-flex xs6 pa-1>
<v-select item-text="M_CompanyTypeName" :disabled="readonlytypecompany" return-object :items="xcompanytypes" v-model="xcompanytype"
label="Tipe Perusahaan"></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field :disabled="readonlytypecompanynew" v-model="companytypenew" label="Tipe Perusahaan Baru"></v-text-field>
</v-flex>
</v-layout>
</v-flex>
<v-flex xs6>
<v-autocomplete label="Dokter" v-model="doctor" :items="xdoctors" :search-input.sync="search_doctor" auto-select-first no-filter
item-text="M_DoctorNames" return-object :loading="isLoading" no-data-text="Pilih Dokter">
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.M_DoctorNames"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex xs6 pa-1>
<v-select item-text="M_StaffName" :disabled="readonlystaff" return-object :items="xstaffs" v-model="xstaff"
label="Makerting"></v-select>
</v-flex>
<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 :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>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_DistrictName"
return-object
:items="xdistricts"
v-model="districtaddress"
label="Kecamatan*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-select
item-text="M_KelurahanName"
return-object
:items="xkelurahans"
v-model="kelurahanaddress"
label="Kelurahan / Desa*"
></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companypic" label="PIC Perusahaan"></v-text-field>
</v-flex>
<v-flex xs12>
<v-text-field v-model="companyaddress" label="Alamat Perusahaan" :rules="addressRules" required></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyphone" label="Telpon Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="companyemail" label="Email Perusahaan"></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="isdefault" label="Default?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabfrom" label="Rekanan Yang Merujuk?"></v-checkbox>
</v-flex>
<v-flex xs6 pa-1>
<v-checkbox v-model="islabto" label="Rekanan Tujuan ?"></v-checkbox>
</v-flex>
<v-flex>
<p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="updateDialogFormPerusahaan()">Tutup</v-btn>
<v-btn v-if="xact === 'new'" color="blue darken-1" flat @click="saveFormPerusahaan()">Simpan</v-btn>
<v-btn v-if="xact === 'edit'" color="blue darken-1" flat @click="updateFormPerusahaan()">Simpan Perubahan</v-btn>
</v-card-actions>
</v-form>
</v-card>
</v-dialog>
</v-layout>
</template>
</v-card>
</v-flex>
</v-layout>
</template>
<style scoped>
.textinput {
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
width: 100%;
padding: 8px 10px;
margin-bottom: 5px;
box-sizing: border-box;
border: 1px solid #607d8b;
}
.textinput:focus {
width: 100%;
}
.textinput:focus::-webkit-input-placeholder {
color: transparent;
}
.textinput:focus::-moz-placeholder {
color: transparent;
}
.textinput:-moz-placeholder {
color: transparent;
}
.boxoutline {
color: red;
border: 1px solid red;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #ffffff;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxoutline:hover {
background: rgba(0, 0, 0, 0.07) !important;
font-size: 15px;
font-weight: 700;
}
.boxsolid {
color: #ffffff;
border: 1px solid #ffffff;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #f44336;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxsolid:hover {
background: #f44336de;
font-size: 15px;
font-weight: 700;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
</style>
<script>
module.exports = {
data: () => ({
color: "success",
valid: false,
companyname: '',
companytypenew: '',
companyaddress: '',
companyphone: '',
companyemail: '',
companypic: '',
companymindp: '',
search_city: '',
search_doctor: '',
nameRules: [
v => !!v || 'Nama Perusahaan harus diisi'
],
addressRules: [
v => !!v || 'Alamat Perusahaan harus diisi'
],
dialogdeletealert: false,
msgalert: "",
xid: 0,
xsearch: "",
isdefault: "",
islabfrom: "",
islabto: "",
isnewcompanytype: false,
readonlytypecompany: false,
readonlystaff: false,
readonlytypecompanynew: false
}),
async mounted() {
await this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
await this.$store.dispatch("company/selectcompanytype")
await this.$store.dispatch("company/selectstaff")
},
computed: {
xact() {
return this.$store.state.company.act
},
xerrors() {
return this.$store.state.company.errors
},
xshowall() {
return this.$store.state.company.show_all
},
vcompanys() {
return this.$store.state.company.companys
},
xtotalcompanys() {
return this.$store.state.company.total_companys
},
xtotalfiltercompanys() {
return this.$store.state.company.total_filter_companys
},
dialogcompany() {
return this.$store.state.company.dialog_form_company
},
snackbar: {
get() {
return this.$store.state.company.alert_success
},
set(val) {
this.$store.commit("company/update_alert_success", val)
}
},
msgsnackbar() {
return this.$store.state.company.msg_success
},
lookupstatus() {
return this.$store.state.company.lookup_company
},
xcompanytypes() {
return this.$store.state.company.companytypes
},
xcompanytype: {
get() {
return this.$store.state.company.companytype
},
set(val) {
this.$store.commit("company/update_companytype", val)
}
},
xstaffs() {
return this.$store.state.company.staffs
},
xstaff: {
get() {
return this.$store.state.company.staff
},
set(val) {
this.$store.commit("company/update_staff", val)
}
},
isLoading() {
return this.$store.state.company.search_status == 1
},
xcities() {
return this.$store.state.company.cities
},
cityaddress: {
get() {
return this.$store.state.company.city_address
},
set(val) {
this.$store.commit("company/update_city_address", val)
this.$store.dispatch("company/getdistrict", this.$store.state.company.city_address)
}
},
xdoctors() {
return this.$store.state.company.doctors
},
doctor: {
get() {
return this.$store.state.company.doctor
},
set(val) {
this.$store.commit("company/update_doctor", val)
}
},
xdistricts(){
return this.$store.state.company.districts
},
districtaddress:{
get() {
return this.$store.state.company.district_address
},
set(val) {
this.$store.commit("company/update_district_address",val)
this.$store.dispatch("company/getkelurahan",this.$store.state.company.district_address)
}
},
xkelurahans(){
return this.$store.state.company.kelurahans
},
kelurahanaddress:{
get() {
return this.$store.state.company.kelurahan_address
},
set(val) {
this.$store.commit("company/update_kelurahan_address",val)
}
}
},
methods: {
updateShowAll(val) {
this.$store.commit("company/update_show_all", val)
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
},
isSelected(p) {
return p.id == this.$store.state.company.selected_company.id
},
subname(name) {
var xname = name
if (xname.length > 18) {
xname = xname.substring(0, 18) + '...'
}
return xname
},
async selectMe(sc) {
await this.$store.commit("company/update_selected_company", sc)
await this.$store.dispatch("mou/lookup", {
id: this.$store.state.company.selected_company.id
})
//set staff
let staff_id = 0
try {
staff_id = this.$store.state.company.selected_company.M_StaffID
for(let idx=0; idx < this.$store.state.company.staffs.length ; idx++) {
let stf = this.$store.state.company.staffs[idx]
if (stf.M_StaffID == staff_id ) {
this.$store.commit("company/update_staff",stf)
break;
}
}
} catch(e) {
}
},
updateDialogFormPerusahaan() {
this.$store.commit("company/update_dialog_form_company", false)
},
openFormPerusahaan() {
this.search_city = ''
this.$store.commit("company/update_cities", [])
this.cityaddress = {}
this.search_doctor = ''
this.$store.commit("company/update_doctors", [])
this.doctor = {}
this.$store.commit("company/update_districts",[])
this.districtaddress = {}
this.$store.commit("company/update_kelurahans",[])
this.kelurahanaddress = {}
this.companytypenew = ""
this.$refs.formcompany.reset()
this.$refs.formcompany.resetValidation()
this.$store.commit("company/update_act", 'new')
this.$store.commit("company/update_dialog_form_company", true)
},
thr_search_city: _.debounce(function () {
this.$store.dispatch("company/searchcity", this.search_city)
}, 2000),
thr_search_doctor: _.debounce(function () {
this.$store.dispatch("company/searchdoctor", this.search_doctor)
}, 2000),
saveFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if ((_.isEmpty(this.companytypenew))) {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/save", {
name: this.companyname,
address: this.companyaddress,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateFormPerusahaan() {
if (this.$refs.formcompany.validate()) {
var newcompanytype = this.companytypenew
if (newcompanytype == "") {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan : this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: this.xcompanytype.M_CompanyTypeID,
staff: this.xstaff.M_StaffID,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
} else {
this.$store.dispatch("company/update", {
id: this.xid,
name: this.companyname,
city: this.cityaddress.M_CityID,
doctor: this.doctor.M_DoctorID,
district: this.districtaddress.M_DistrictID,
kelurahan: this.kelurahanaddress.M_KelurahanID,
address: this.companyaddress,
phone: this.companyphone,
email: this.companyemail,
pic: this.companypic,
companytypenew: this.companytypenew,
companytype: 0,
staff: 0,
isdefault: this.isdefault === true ? "Y" : "N",
islabfrom: this.islabfrom === true ? "Y" : "N",
islabto: this.islabto === true ? "Y" : "N"
})
}
}
},
updateAlert_success(val) {
this.$store.commit("company/update_alert_success", val)
},
editPerusahaan(data) {
this.xid = data.id
this.companyname = data.name
this.$store.commit("company/update_cities", [{
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}])
this.cityaddress = {
M_CityID: data.M_CityID,
M_CityName: data.M_CityName
}
this.$store.commit("company/update_doctors", [{
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}])
this.doctor = {
M_DoctorID: data.M_DoctorID,
M_DoctorNames: data.M_DoctorNames
}
this.$store.commit("company/update_districts", [{
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}])
this.districtaddress = {
M_DistrictID: data.M_DistrictID,
M_DistrictName: data.M_DistrictName
}
this.$store.commit("company/update_kelurahans", [{
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}])
this.kelurahanaddress = {
M_KelurahanID: data.M_KelurahanID,
M_KelurahanName: data.M_KelurahanName
}
this.companyaddress = data.address
this.companyphone = data.phone
this.companyemail = data.email
this.companypic = data.pic
this.companytypenew = ""
this.isdefault = data.isdefault === 'N' ? false : true
this.islabfrom = data.islabfrom === 'N' ? false : true
this.islabto = data.islabto === 'N' ? false : true
this.$store.commit("company/update_act", 'edit')
this.$store.commit("company/update_dialog_form_company", true)
var companytypes = this.$store.state.company.companytypes
var idx_companytype = _.findIndex(companytypes, function (o) {
return o.M_CompanyTypeID == data.companytypeid
})
var companytype = companytypes[idx_companytype]
this.$store.commit("company/update_companytype", companytype)
},
deletePerusahaan(data) {
this.xid = data.id
var xdata = {
id: data.id,
name: data.name,
mous: 'xxx'
}
this.$store.commit("company/update_selected_company", xdata)
this.msgalert = "Yakin, mau hapus company " + data.name + " ?"
this.dialogdeletealert = true
},
changeNewCompanyType(value) {
this.readonlytypecompany = value === true ? true : false
this.readonlytypecompanynew = value === true ? false : true
},
newCompanyType() {
readonlytypecompany: true
readonlytypecompanynew: false
},
closeDeleteAlert() {
this.$store.dispatch("company/delete", {
companyid: this.$store.state.company.selected_company.id,
companyname: this.$store.state.company.selected_company.name
})
this.dialogdeletealert = false
},
thr_search: _.debounce(function () {
this.$store.dispatch("company/lookup", {
search: this.xsearch,
all: this.xshowall
})
}, 1000)
},
watch: {
xsearch(val, old) {
if (val !== old && this.lookupstatus !== 1) {
console.log(val)
this.xsearch = val
this.thr_search()
}
},
search_city(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_city()
},
search_doctor(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.company.update_autocomplete_status == 1) return
this.thr_search_doctor()
}
}
}
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<!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 class="blue lighten-5" >
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap >
<v-flex xs3 class="left" fill-height pa-1>
<!-- komponen kiri -->
<one-md-company-list></one-md-company-list>
</v-flex>
<v-flex xs9 class="right" fill-height pa-1>
<!-- komponen kanan -->
<one-md-mou-list></one-md-mou-list>
</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">
import { store } from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
components: {
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
'one-md-company-list': httpVueLoader('./components/oneMdCompanyList.vue'),
'one-md-mou-list' : httpVueLoader('./components/oneMdMouList.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,194 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/area.js"
window.api = api
export default {
namespaced: true,
state: {
search: '',
search_status:0,
search_error_message:'',
search_dialog_is_active: false,
provinces: [],
cities: [],
districts: [],
villages: [],
total_provinces: 0,
total_cities: 0,
total_districts: 0,
total_villages: 0,
total_display: 0,
selected_province: {},
selected_city: {},
selected_district: {},
selected_village: {}
},
mutations: {
update_search_dialog_is_active(state,status) {
state.search_dialog_is_active = status
},
update_search_error_message(state,status) {
state.search_error_message = status
},
update_search(state,val) {
state.search=val
},
update_search_status(state,status) {
state.search_status = status
},
update_area(state, data) {
state[data.type] = data.records
state['total_'+data.type] = data.total
state.total_display = data.total_display
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = null
else if (data.type == "cities")
state['selected_city'] = null
for (let i in data.records) {
if (data.records[i].is_default == "Y") {
if (["provinces", "districts", "villages"].indexOf(data.type) > -1)
state['selected_'+ data.type.substring(0, data.type.length-1) ] = data.records[i]
else if (data.type == "cities")
state['selected_city'] = data.records[i]
}
}
},
update_selected_area(state, val) {
state['selected_'+val.type] = val.val
}
},
actions: {
async search_province(context) {
context.commit("update_search_status", 1)
// context.commit("update_area", {records:[], total:0, total_display:0, type:'city'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
// context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
// context.commit("update_selected_area", {type:'city',val:null})
// context.commit("update_selected_area", {type:'district',val:null})
// context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_province(context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'provinces'
}
context.commit("update_area", data)
context.dispatch("search_city")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message",e.message )
}
},
async search_city(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'district'})
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'district',val:null})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_city(context.state.selected_province.M_ProvinceID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'cities'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_district")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_district(context) {
// City
context.commit("update_search_status", 1)
context.commit("update_area", {records:[], total:0, total_display:0, type:'village'})
context.commit("update_selected_area", {type:'village',val:null})
try {
let resp = await api.search_district(context.state.selected_city.M_CityID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'districts'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
context.dispatch("search_kelurahan")
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
},
async search_kelurahan(context) {
// City
context.commit("update_search_status", 1)
try {
let resp = await api.search_kelurahan(context.state.selected_district.M_DistrictID, context.state.search)
if (resp.status != "OK") {
context.commit("update_search_status",3)
context.commit("update_search_error_message",resp.message)
} else {
context.commit("update_search_status",2)
context.commit("update_search_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total,
total_display: resp.data.total_display,
type: 'villages'
}
context.commit("update_area", data)
context.commit("update_search_status", 1)
}
} catch(e) {
context.commit("update_search_status",3)
context.commit("update_search_error_message", e.message )
}
}
}
}

View File

@@ -0,0 +1,761 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/company.js"
export default {
namespaced: true,
state: {
act: 'new',
actcompanytype: 'new',
actcompanybusiness: 'new',
lookup_company: 0,
lookup_error_message: '',
companys: [],
total_companys: 0,
total_filter_companys: 0,
selected_company: {
name: "[ Belum memilih Kelompok Pelanggan ]"
},
save_status: 0,
save_error_message: '',
dialog_form_company: false,
dialog_form_company_afterrelease: false,
dialog_form_companytype: false,
dialog_form_companybusiness: false,
dialog_edit_form_company: false,
alert_success: false,
msg_success: "",
show_all: 'N',
errors: [],
companytypes: [],
companytype: {},
staffs: [],
staff: {},
companylevels: [],
companylevel: {},
companybusinesss: [],
companybusiness: {},
hierarkis: [],
hierarki: {},
doctors: [],
doctor: {},
get_data_status: 0,
get_data_error_message: '',
cities: [],
cities_address: {},
autocomplete_status: 0,
search_status: 0,
provinces: [],
province_address: {},
citys: [],
city_address: {},
districts: [],
district_address: {},
kelurahans: [],
kelurahan_address: {}
},
mutations: {
update_act(state, val) {
state.act = val
},
update_errors(state, val) {
state.errors = val
},
update_show_all(state, val) {
state.show_all = val
},
update_lookup_error_message(state, status) {
state.lookup_error_message = status
},
update_lookup_company(state, status) {
state.lookup_company = status
},
update_companys(state, data) {
state.companys = data.records
state.total_companys = data.total
state.total_filter_companys = data.total_filter
},
update_selected_company(state, val) {
state.selected_company = val
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_company(state, val) {
state.dialog_form_company = val
},
update_dialog_form_company_afterrelease(state, val) {
state.dialog_form_company_afterrelease = val
},
update_dialog_form_companytype(state, val) {
state.dialog_form_companytype = val
},
update_dialog_form_companybusiness(state, val) {
state.dialog_form_companybusiness = val
},
update_dialog_edit_form_company(state, val) {
state.dialog_edit_form_company = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_companytypes(state, data) {
state.companytypes = data
},
update_companytype(state, val) {
state.companytype = val
},
update_staffs(state, data) {
state.staffs = data
},
update_staff(state, val) {
state.staff = val
},
update_companylevels(state, data) {
state.companylevels = data
},
update_companylevel(state, val) {
state.companylevel = val
},
update_companybusinesss(state, data) {
state.companybusinesss = data
},
update_companybusiness(state, val) {
state.companybusiness = val
},
update_hierarkis(state, data) {
state.hierarkis = data
},
update_hierarki(state, val) {
state.hierarki = val
},
update_doctors(state, data) {
state.doctors = data
},
update_doctor(state, val) {
state.doctor = val
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_get_data_error_message(state, val) {
state.get_data_error_message = val
},
update_cities(state, val) {
state.cities = val
},
update_cities_address(state, val) {
state.cities_address = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_provinces(state, val) {
state.provinces = val
},
update_province_address(state, val) {
state.province_address = val
},
update_citys(state, val) {
state.citys = val
},
update_city_address(state, val) {
state.city_address = val
},
update_districts(state, val) {
state.districts = val
},
update_district_address(state, val) {
state.district_address = val
},
update_kelurahans(state, val) {
state.kelurahans = val
},
update_kelurahan_address(state, val) {
state.kelurahan_address = val
}
},
actions: {
async lookup(context, prm) {
context.commit("update_lookup_company", 1)
try {
let resp = await api.lookup(one_token(), prm.search, prm.all)
if (resp.status != "OK") {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_company", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_filter: resp.data.total_filter
}
context.commit("update_companys", data)
}
} catch (e) {
context.commit("update_lookup_company", 3)
context.commit("update_lookup_error_message", e.message)
}
},
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)
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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah tersimpan dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
} 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 update(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.update(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_alert_success", true)
context.commit("update_dialog_form_company", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah terupdate dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async updateafterrelease(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updateafterrelease(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_alert_success", true)
context.commit("update_dialog_form_company_afterrelease", false)
context.commit("update_dialog_form_companytype", false)
context.commit("update_dialog_form_companybusiness", false)
var msg = "Kelompok Pelanggan " + prm.name + " sudah terupdate dong ..."
context.commit("update_msg_success", msg)
context.dispatch("lookup", {
search: "",
all: context.show_all
})
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(), prm.companyid)
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_alert_success", true)
var msg = "Schedule " + prm.companyname + " sudah dihapus dong"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.commit("update_selected_company", {})
context.dispatch("lookup", {
search: ""
})
context.commit("sampletype/update_company_sampletype", [], {
root: true
})
}
} catch (e) {
context.commit("update_save_status", 3)
console.log(e)
}
},
async savecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanytype(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_companytypes", resp.data.records.companytypes)
} 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 updatecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanytype(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanytype(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_companytypes", resp.data.records.companytypes)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanytype(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanytype(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companytypes", resp.data.records.companytypes)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async savecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
} 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 selectcompanylevel(context,prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanylevel(one_token(),prm)
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companylevels", resp.data.records.companylevels)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selecthierarchy(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selecthierarchy(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_hierarkis", resp.data.records.hierarchys)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async updatecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.updatecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async deletecompanybusiness(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.deletecompanybusiness(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_companybusinesss", resp.data.records.companybusinesss)
}
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectcompanybusiness(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectcompanybusiness(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_companybusinesss", resp.data.records.companybusinesss)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
async selectdoctor(context) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.selectdoctor(one_token())
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", resp.message)
} else {
context.commit("update_get_data_status", 2)
context.commit("update_get_data_error_message", "")
context.commit("update_doctors", resp.data.records.doctors)
}
} catch (e) {
context.commit("update_get_data_status", 3)
context.commit("update_get_data_error_message", e.message)
console.log(e)
}
},
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 searchdoctor(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchdoctor(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_doctors", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async searchcompanylevel(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchcompanylevel(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_companylevels", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async getprovince(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getprovince(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_provinces", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getcity(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getcity(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_citys", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getstaff(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getstaff(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_staffs", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getdistrict(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getdistrict(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_districts", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
},
async getkelurahan(context, prm) {
context.commit("update_get_data_status", 1)
try {
let resp = await api.getkelurahan(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_kelurahans", resp.data.records)
}
} catch (e) {
context.commit("update_get_data_status", 3)
}
}
}
}

View File

@@ -0,0 +1,525 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/mou.js"
export default {
namespaced: true,
state: {
mous: [],
save_status: 0,
save_error_message: '',
dialog_form_mou: false,
dialog_confirm_alert_mou: false,
dialog_status_order: false,
lookup_mou: 0,
search_status: 0,
errors:[],
startdate:moment(new Date()).format('DD-MM-YYYY'),
enddate:moment(new Date()).format('DD-MM-YYYY'),
bases: [],
base: {},
omzettypes: [],
omzettype: {},
moutypes: [],
moutype: {},
agingtypes: [],
agingtype: {},
statuss:[],
jpa1_name: '',
jpa2_name: '',
jpa3_name: '',
jpa4_name: '',
jpa1_percent: 0,
jpa2_percent: 0,
jpa3_percent: 0,
jpa4_percent: 0,
lastid: 0,
xsearch: '',
statuses:[{label:'Semua', value:'A'},{label:'Baru', value:'N'},{label:'Baru (Konfirmasi)', value:'C'},{label:'Verified', value:'V'},{label:'Unverified', value:'UV'},{label:'Released', value:'R'},{label:'Unreleased', value:'UR'}],
selected_status:{label:'Semua', value:'A'},
},
mutations: {
update_selected_status(state, val) {
state.selected_status = val
},
update_xsearch(state,val) {
state.xsearch = val
},
update_lastid(state,val) {
state.lastid = val
},
update_jpa1_name(state,val) {
state.jpa1_name = val
},
update_jpa2_name(state,val) {
state.jpa2_name = val
},
update_jpa3_name(state,val) {
state.jpa3_name = val
},
update_jpa4_name(state,val) {
state.jpa4_name = val
},
update_jpa1_percent(state,val) {
state.jpa1_percent = val
},
update_jpa2_percent(state,val) {
state.jpa2_percent = val
},
update_jpa3_percent(state,val) {
state.jpa3_percent = val
},
update_jpa4_percent(state,val) {
state.jpa4_percent = val
},
update_errors(state, val) {
state.errors = val
},
update_mous(state, data) {
state.mous = data
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_dialog_form_mou(state, val) {
state.dialog_form_mou = val
},
update_dialog_confirm_alert_mou(state, val) {
state.dialog_confirm_alert_mou = val
},
update_lookup_mou(state, val) {
state.lookup_mou = val
},
update_startdate(state,val){
state.startdate = val
},
update_enddate(state,val){
state.enddate = val
},
update_bases(state, data) {
state.bases = data
},
update_base(state, val) {
state.base = val
},
update_omzettypes(state, data) {
state.omzettypes = data
},
update_omzettype(state, val) {
state.omzettype = val
},
update_moutypes(state, data) {
state.moutypes = data
},
update_moutype(state, val) {
state.moutype = val
},
update_agingtypes(state, data) {
state.agingtypes = data
},
update_agingtype(state, val) {
state.agingtype = val
},
update_search_status(state, val) {
state.search_status = val
},
update_statuss(state,data){
state.statuss = data
},
update_dialog_status_order(state, val) {
state.dialog_status_order = val
}
},
actions: {
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("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
alert(resp.message)
} else {
var data = {
records: resp.data.records,
total: resp.data.total,
lastid: resp.data.lastid
}
if(data.total !== -1){
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.commit("update_dialog_form_mou", false)
var msg = "Agreement " + prm.companyname + " sudah update dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
if(prm.isconfirm === 'N'){
context.commit("update_dialog_confirm_alert_mou", true)
}
context.commit("update_lastid", data.lastid)
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
}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 saveafterrelease(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.saveafterrelease(prm)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, {
root: true
})
context.commit("company/update_save_error_message", resp.message, {
root: true
})
var msg = resp.message
var str = msg[1].split('[message] =>').splice(1).join('[message] =>')
var note = str.replace('\\n)\\n\"}"', '')
console.log(note)
context.commit("update_msgalertverif", msg)
context.commit("update_dialog_alert_verif", true)
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
} else {
var data = {
records: resp.data.records,
total: resp.data.total
}
if (data.total !== -1) {
context.commit("company/update_save_status", 2, {
root: true
})
context.commit("company/update_save_error_message", resp.message, {
root: true
})
context.commit("company/update_alert_success", true, {
root: true
})
context.commit("update_dialog_form_mou", false)
var msg = "Agreement " + prm.companyname + " sudah update dong"
context.commit("company/update_msg_success", msg, {
root: true
})
context.commit("company/update_alert_success", true, {
root: true
})
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
} 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 lookupx(context, prm) {
context.commit("update_lookup_mou", 1)
try {
let resp = await api.lookupx(one_token(),prm.id)
if (resp.status != "OK") {
context.commit("update_lookup_mou", 3)
} else {
context.commit("update_lookup_mou", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_mous", data.records)
}
} catch (e) {
context.commit("update_lookup_mou", 3)
}
},
async lookup(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.lookup(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_mous", data.records)
console.log('status')
console.log(data.records.statuss)
context.commit("update_statuss", data.records.statuss)
}
} catch (e) {
context.commit("update_save_status", 3)
}
},
async delete(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xdelete(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dihapus dong"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async confirm(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xconfirm(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dikonfirmasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async verify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah diverifikasi"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unverify(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunverify(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Verifikasi Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async release(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Agreement "+prm.name+" dari company " + prm.companyname + " sudah dirilis"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async unrelease(context, prm) {
context.commit("update_save_status", 1)
try {
let resp = await api.xunrelease(one_token(),prm.xid)
if (resp.status != "OK") {
context.commit("company/update_save_status", 3, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
} else {
context.commit("company/update_save_status", 2, { root: true })
context.commit("company/update_save_error_message", resp.message, { root: true })
context.commit("company/update_alert_success", true, { root: true })
//context.commit("update_dialog_form_schedule_promise", false)
var msg = "Rilis Agreement "+prm.name+" dari company " + prm.companyname + " sudah dibatalkan"
context.commit("company/update_msg_success", msg, { root: true })
context.commit("company/update_alert_success", true, { root: true })
context.dispatch("lookup", {
id: prm.companyid,
search: prm.search,
status:prm.status
})
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async selectbase(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectbase(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_bases", resp.data.records.bases)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectomzettype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectomzettype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_omzettypes", resp.data.records.omzettypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectmoutype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectmoutype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_moutypes", resp.data.records.moutypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
},
async selectagingtype(context) {
context.commit("company/update_get_data_status", 1, { root: true })
try {
let resp = await api.selectagingtype(one_token())
if (resp.status != "OK") {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", resp.message, { root: true })
} else {
context.commit("company/update_get_data_status", 2, { root: true })
context.commit("company/update_get_data_error_message", "", { root: true })
context.commit("update_agingtypes", resp.data.records.agingtypes)
}
} catch (e) {
context.commit("company/update_get_data_status", 3, { root: true })
context.commit("company/update_get_data_error_message", e.message, { root: true })
console.log(e)
}
}
}
}

View File

@@ -0,0 +1,27 @@
// State
// data ...
// Mutations
//
//
// Actions
import company from "./modules/company.js";
import mou from "./modules/mou.js";
import area from "./modules/area.js";
import system from "../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
company: company,
mou: mou,
area: area,
system:system
},
state: {
},
mutations: {
},
actions: {
}
});

View File

@@ -0,0 +1,31 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank";
export async function searchBank(query, page, rowPerPage = 15) {
try {
var resp = await axios.post(URL, {
query: query,
page: page,
rowPerPage: rowPerPage
});
if (resp.status != 200) {
return {
status: "ERR",
query: query,
message: resp.statusText
};
}
let data = resp.data;
data.query = query;
return data;
} catch (e) {
return {
status: "ERR",
query: query,
message: e.message
};
}
}

View File

@@ -0,0 +1,92 @@
// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"/one-api/v1/clinic/fo/";
export async function search_province(search) {
try {
var resp = await axios.post(URL + 'area/search_province', {
search: search
});
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 search_city(province_id, search) {
try {
var resp = await axios.post(URL + 'area/search_city', {
search: search,
province_id: province_id
});
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 search_district(city_id, search) {
try {
var resp = await axios.post(URL + 'area/search_district', {
search: search,
city_id: city_id
});
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 search_kelurahan(district_id, search) {
try {
var resp = await axios.post(URL + 'area/search_kelurahan', {
search: search,
district_id: district_id
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,424 @@
const URL = "/one-api/v1/masterdata/";
export async function lookup(token, search,all ) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/lookup', { token: token, search: search, all:all });
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 + 'companyadmin_v13/addnewcompany', 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 update(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/editcompany', 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 updateafterrelease(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/editcompanyafterrelease', 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(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/deletecompany', { id: id, 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 savecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/addnewcompanytype', 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 updatecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/editcompanytype', 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 deletecompanytype(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/deletecompanytype', 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 selectcompanytype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectcompanytype',{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 savecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/addnewcompanybusiness', 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 updatecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/editcompanybusiness', 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 deletecompanybusiness(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/deletecompanybusiness', 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 selectcompanybusiness(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectcompanybusiness',{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 selecthierarchy(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selecthierarchy',{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 selectcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectcompanylevel',{token:token,id:prm.id});
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 + 'companyadmin_v13/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 searchdoctor(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/searchdoctor',{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 searchcompanylevel(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/searchcompanylevel',{token:token,name:prm.name,id:prm.id});
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 getstaff(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/getstaff',{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 getprovince(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/getprovince',{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 getcity(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/getcity',{id:prm.M_ProvinceID,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 getdistrict(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/getdistrict',{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 getkelurahan(token,prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/getkelurahan',{token:token,id:prm.M_DistrictID});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,276 @@
const URL = "/one-api/v1/masterdata/";
export async function save(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/addnewmou', 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 saveafterrelease(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/saveafterrelease', 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(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/deletemou', { id: id ,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 xconfirm(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/confirmmou', { id: id ,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 xverify(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/verifymou', { id: id ,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 xunverify(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/unverifymou', { id: id ,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 xrelease(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/releasemou', { id: id ,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 xunrelease(token,id) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/unreleasemou', { id: id ,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 lookup(prm) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/lookupmou', 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 selectbase(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectbase',{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 selectomzettype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectomzettype',{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 selectbilltype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectbilltype',{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 selectbranch(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectbranch',{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 selectmoutype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectmoutype',{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 selectagingtype(token) {
try {
var resp = await axios.post(URL + 'companyadmin_v13/selectagingtype',{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
};
}
}

Some files were not shown because too many files have changed in this diff Show More