add modules folder based on s_menu
This commit is contained in:
261
test/vuex/acc-one-surat-jalan/api/api.js
Normal file
261
test/vuex/acc-one-surat-jalan/api/api.js
Normal file
@@ -0,0 +1,261 @@
|
||||
const URL = "/one-api/mockup/purchase/suratjalan/SuratJalan/";
|
||||
|
||||
/* QUERY */
|
||||
|
||||
export async function lookupEkpedisi(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'LookupEkspedisi', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookupEkpedisiStaff(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'LookupEkspedisiStaff', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function GetTFDataDetail(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'LookupSuratJalanDetail', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function ListingSuratJalan(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'LookupListSuratJalan', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function ListingBranch(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'LookupListBranch', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function CheckPeriode(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'CheckPeriode', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookupTransferRequest(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'LookupTransferRequest', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookupTransferRequestDetail(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'LookupTransferRequestDetail', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* MUTATIONS */
|
||||
|
||||
export async function createSuratJalan(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'CreateSuratJalan', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateSuratJalan(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'UpdateSuratJalan', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function konfirmSuratJalan(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'KonfirmSuratJalan', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteSuratJalan(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'DeleteSuratJalan', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function GenerateJurnal(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + 'GenerateJurnal', params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
349
test/vuex/acc-one-surat-jalan/components/form.vue
Normal file
349
test/vuex/acc-one-surat-jalan/components/form.vue
Normal file
@@ -0,0 +1,349 @@
|
||||
<template>
|
||||
<v-card class="pa-2">
|
||||
<v-snackbar
|
||||
v-model="snackbar.isOpen" :timeout="3000" :multi-line="false"
|
||||
:vertical="false" :top="true" :color="snackbar.color"
|
||||
>
|
||||
{{ snackbar.message }}
|
||||
<v-btn flat @click="closeSnackbar()">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
<h3>NOMOR : {{ this.s_suratjalan.SuratJalanNumber ?? '-' }}</h3>
|
||||
<h3>STATUS : {{ this.s_suratjalan.i_status }}</h3>
|
||||
<v-layout row wrap class="mt-2">
|
||||
<v-flex xs6 class="pr-1">
|
||||
<v-autocomplete
|
||||
v-model="s_suratjalan.i_tftype" label="Jenis Transfer" outline @input="getTFReq"
|
||||
hide-details :disabled="isDraft()" :items="['Persediaan', 'Non Persediaan']"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="pl-1">
|
||||
<v-autocomplete
|
||||
v-model="s_suratjalan.i_tfrequest" label="Transfer Request Number" return-object
|
||||
outline hide-details :disabled="isDraft()" @input="getTFDetail"
|
||||
:items="l_tfrequest" item-text="T_GoodsTransferNum"
|
||||
>
|
||||
<template v-slot:item="data">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>
|
||||
{{ data.item.T_GoodsTransferNum }}
|
||||
</v-list-tile-title>
|
||||
<v-list-tile-sub-title>
|
||||
Type: {{ data.item.T_GoodsTransferType == 'P' ? 'Persediaan' : 'Non Persediaan'}},
|
||||
Tanggal: {{ data.item.T_GoodsTransferDate }}
|
||||
</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs6 class="pr-1 pt-2">
|
||||
<v-text-field
|
||||
v-model="sjDateFormated" label="Tanggal"
|
||||
readonly outline hide-details :disabled="isDraft()"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="pl-1 pt-2">
|
||||
<v-autocomplete
|
||||
v-model="s_suratjalan.i_isInternal" :items="['Internal', 'Eksternal']" :disabled="isDraft()"
|
||||
outline hide-details label="Jenis Kurir" @input="getEkspedisi"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs4 class="pr-1 pt-2">
|
||||
<v-autocomplete
|
||||
v-model="s_suratjalan.i_ekspedisi" :items="l_ekspedisi" label="Ekspedisi" :disabled="isDraft()"
|
||||
outline hide-details return-object item-text="ExpeditionName" @input="getStaff"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs4 class="px-1 pt-2">
|
||||
<v-autocomplete
|
||||
v-model="s_suratjalan.i_staff" :items="l_staff" label="Staff" @input="setPhone" :disabled="isDraft()"
|
||||
outline hide-details return-object item-text="ExpeditionStaffName"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs4 class="pl-1 pt-2">
|
||||
<v-text-field
|
||||
v-model="s_suratjalan.i_phone" label="Nomor HP"
|
||||
outline hide-details :disabled="isDraft()"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs12 class="pt-2">
|
||||
<v-textarea
|
||||
v-model="s_suratjalan.i_notes" label="Catatan"
|
||||
outline hide-details :disabled="isDraft()"
|
||||
></v-textarea>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<div>
|
||||
<v-data-table
|
||||
:headers="header" :items="s_suratjalan.detail" :loading="false"
|
||||
hide-actions class="elevation-1 mb-2 mt-4"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ (props.index + 1) }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.Quantity }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.ItemUnitName ?? '-' }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-divider></v-divider>
|
||||
<div class="mt-2 pa-2 text-xs-center">
|
||||
<v-pagination v-model="d_page" :length="detpage_len" :total-visible="5"></v-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<v-layout row wrap>
|
||||
<v-flex grow class="pr-1 mt-2">
|
||||
<v-btn outline color="primary" class="white--text" @click="kirimSJ()" :disabled="isDraft()">
|
||||
Simpan & Kirim
|
||||
<v-icon v-show="isDraft()" right>check_circle</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
<v-flex shrink class="pl-1 mt-2">
|
||||
<v-btn outline color="primary" class="white--text" @click="cancelSJ()" :disabled="isDraft()">Batal</v-btn>
|
||||
<v-btn color="primary" class="white--text" @click="simpanSJ()" :disabled="isDraft()">Simpan</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
component: {},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
header: [
|
||||
{
|
||||
text: "No.", align: "center", sortable: false,
|
||||
value: "requestDate", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM", align: "center", sortable: false,
|
||||
value: "requestDate", width: "30%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "KUANTITAS", align: "center", sortable: false,
|
||||
value: "requestDate", width: "20%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "SATUAN", align: "center", sortable: false,
|
||||
value: "requestDate", width: "20%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
i_tftype: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.i_tftype
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_i_tftype", val);
|
||||
}
|
||||
},
|
||||
i_tfrequest: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.i_tfrequest
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_i_tfrequest", val);
|
||||
}
|
||||
},
|
||||
i_isInternal: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.i_isInternal
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_i_isInternal", val)
|
||||
}
|
||||
},
|
||||
i_ekspedisi: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.i_ekspedisi
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_i_ekspedisi", val)
|
||||
}
|
||||
},
|
||||
i_staff: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.i_staff
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_i_staff", val)
|
||||
}
|
||||
},
|
||||
i_phone: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.i_phone
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_i_phone", val)
|
||||
}
|
||||
},
|
||||
i_notes: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.i_notes
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_i_notes", val)
|
||||
}
|
||||
},
|
||||
i_date: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.i_date
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_i_date", val)
|
||||
}
|
||||
},
|
||||
sjDateFormated() {
|
||||
return this.formatDate(this.s_suratjalan.i_date)
|
||||
},
|
||||
l_ekspedisi() {
|
||||
return this.$store.state.suratjalan.l_ekspedisi
|
||||
},
|
||||
l_staff() {
|
||||
return this.$store.state.suratjalan.l_staff
|
||||
},
|
||||
l_tfrequest() {
|
||||
return this.$store.state.suratjalan.l_tfrequest
|
||||
},
|
||||
s_suratjalan: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.s_suratjalan;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_s_suratjalan", val);
|
||||
}
|
||||
},
|
||||
detpage_len() {
|
||||
let total = parseInt(this.s_suratjalan.detailtotal)
|
||||
if (!total || total == 0) {
|
||||
return 1
|
||||
}
|
||||
return Math.ceil(total/5)
|
||||
},
|
||||
d_page: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.d_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_d_page", val)
|
||||
this.$store.dispatch("suratjalan/detailSuratJalan", {
|
||||
SuratJalanID: this.s_suratjalan.SuratJalanID,
|
||||
page: this.d_page}
|
||||
)
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_snackbar", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
const [year, month, day] = date.split("-")
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
async getTFReq() {
|
||||
this.$store.dispatch("suratjalan/listingTransferRequest");
|
||||
},
|
||||
async getTFDetail() {
|
||||
this.$store.dispatch("suratjalan/listingTFdetail");
|
||||
},
|
||||
async getEkspedisi() {
|
||||
this.$store.dispatch("suratjalan/listingEkspedisi");
|
||||
this.s_suratjalan.i_ekspedisi = {}
|
||||
this.s_suratjalan.i_staff = {}
|
||||
this.s_suratjalan.i_phone = ""
|
||||
},
|
||||
async getStaff() {
|
||||
this.$store.dispatch("suratjalan/listingEkspedisiStaff");
|
||||
this.s_suratjalan.i_staff = {}
|
||||
this.s_suratjalan.i_phone = ""
|
||||
},
|
||||
async setPhone() {
|
||||
this.s_suratjalan.i_phone = this.s_suratjalan.i_staff.ExpeditionStaffMobile
|
||||
},
|
||||
async simpanSJ() {
|
||||
const sj = this.s_suratjalan
|
||||
let kurir = Object.keys(sj.i_ekspedisi).length
|
||||
let staff = Object.keys(sj.i_staff).length
|
||||
let tfreq = Object.keys(sj.i_tfrequest).length
|
||||
let nohpn = sj.i_phone
|
||||
let typet = sj.i_tftype
|
||||
if (kurir <= 0 || staff <= 0 || tfreq <= 0 || nohpn == "" || typet == "") {
|
||||
let x = {isOpen: true, color: "error", message: "form belum lengkap"}
|
||||
this.snackbar = x
|
||||
return
|
||||
}
|
||||
|
||||
if (this.s_suratjalan.i_status == 'BARU') {
|
||||
this.$store.dispatch("suratjalan/createSuratJalan")
|
||||
} else {
|
||||
this.$store.dispatch("suratjalan/updateSuratJalan")
|
||||
}
|
||||
},
|
||||
cancelSJ() {
|
||||
this.$store.dispatch("suratjalan/newForm")
|
||||
this.$store.dispatch("suratjalan/listingSuratJalan")
|
||||
// let id = this.s_suratjalan.SuratJalanID
|
||||
// this.$store.dispatch("suratjalan/detailSuratJalan", {SuratJalanID: id, page: this.d_page})
|
||||
},
|
||||
closeSnackbar() {
|
||||
let x = {isOpen: false, color: "", message: ""}
|
||||
this.snackbar = x
|
||||
},
|
||||
isDraft() {
|
||||
let status = this.s_suratjalan.i_status
|
||||
if (status === 'Draft' || status === 'BARU') {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
async kirimSJ() {
|
||||
let sj = this.s_suratjalan
|
||||
let kurir = Object.keys(sj.i_ekspedisi).length
|
||||
let staff = Object.keys(sj.i_staff).length
|
||||
let tfreq = Object.keys(sj.i_tfrequest).length
|
||||
let nohpn = sj.i_phone
|
||||
let typet = sj.i_tftype
|
||||
|
||||
if (kurir <= 0 || staff <= 0 || tfreq <= 0 || nohpn == "" || typet == "") {
|
||||
let x = { isOpen: true, color: "error", message: "Tedapat form yang masih kosong"}
|
||||
this.$store.commit("suratjalan/update_snackbar", x)
|
||||
return
|
||||
}
|
||||
|
||||
if (sj.i_status == 'BARU') {
|
||||
sj.i_status = 'Process'
|
||||
await this.$store.commit("suratjalan/update_s_suratjalan", sj)
|
||||
await this.$store.dispatch("suratjalan/createSuratJalan")
|
||||
}
|
||||
if (sj.i_status == 'Draft') {
|
||||
sj.i_status = 'Process'
|
||||
await this.$store.commit("suratjalan/update_s_suratjalan", sj)
|
||||
await this.$store.dispatch("suratjalan/updateSuratJalan")
|
||||
}
|
||||
|
||||
// await this.$store.dispatch("suratjalan/updateSuratJalan")
|
||||
// await this.$store.dispatch("suratjalan/generateJurnal", this.s_suratjalan)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
296
test/vuex/acc-one-surat-jalan/components/listing.vue
Normal file
296
test/vuex/acc-one-surat-jalan/components/listing.vue
Normal file
@@ -0,0 +1,296 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">LISTING SURAT JALAN</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn icon @click="newForm()">
|
||||
<v-icon>add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card class="pa-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs2 class="pr-1">
|
||||
<v-menu
|
||||
v-model="menuStartDate" lazy offset-y full-width
|
||||
:close-on-content-click="false" :nudge-right="40"
|
||||
transition="scale-transition" max-width="290px" min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
v-model="startDateFormated" label="Tanggal Awal"
|
||||
readonly outline hide-details v-on="on"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title v-model="f_startdate" @input="menuStartDate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-menu
|
||||
v-model="menuEndDate" lazy offset-y full-width
|
||||
:close-on-content-click="false" :nudge-right="40"
|
||||
transition="scale-transition" max-width="290px" min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
v-model="endDateFormated" label="Tanggal Akhir"
|
||||
readonly outline hide-details v-on="on"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title v-model="f_enddate" @input="menuEndDate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs3 class="px-1">
|
||||
<v-autocomplete
|
||||
v-model="f_cabang" :items="l_cabang" label="Cabang"
|
||||
outline hide-details return-object item-text="M_BranchName"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-autocomplete
|
||||
v-model="f_status" :items="l_status"
|
||||
outline hide-details label="status"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-text-field
|
||||
v-model="f_search" label="No Surat Jalan"
|
||||
outline hide-details
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs1 class="pl-1">
|
||||
<v-btn
|
||||
dark color="primary" @click="searchSuratJalan()"
|
||||
style="min-width: 50px; height: 100%; margin: 0;"
|
||||
>
|
||||
<v-icon>search</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
<v-card class="pa-2 mt-2">
|
||||
<v-data-table
|
||||
:headers="headers" :items="l_suratjalan.records" :loading="false"
|
||||
hide-actions class="elevation-1 mb-2"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr @click="selectSuratJalan(props.item)" :class="{'yellow lighten-4':isSelected(props.item)}">
|
||||
<td class="text-xs-center pa-2">{{ props.item.SuratJalanNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_BranchName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.ExpeditionStaffName }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-chip small :color="checkColor(props.item.SuratJalanStatus)">
|
||||
{{ props.item.SuratJalanStatus }}
|
||||
</v-chip>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon
|
||||
small @click="deleteSJ(props.item)" color="red"
|
||||
:disabled="props.item.SuratJalanStatus != 'Draft'"
|
||||
>
|
||||
delete
|
||||
</v-icon>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-divider></v-divider>
|
||||
<div class="pa-2 mt-2 text-xs-center">
|
||||
<v-pagination v-model="paginat" :length="paginat_len" :total-visible="5"></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {},
|
||||
mounted() {
|
||||
this.$store.dispatch("suratjalan/getBranches");
|
||||
this.$store.dispatch("suratjalan/listingSuratJalan");
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuStartDate: false,
|
||||
menuEndDate: false,
|
||||
headers: [
|
||||
{
|
||||
text: "SURAT JALAN",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "CABANG",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "PETUGAS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
f_startdate: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.f_startdate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_f_startdate", val)
|
||||
}
|
||||
},
|
||||
startDateFormated() {
|
||||
return this.formatDate(this.f_startdate)
|
||||
},
|
||||
f_enddate: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.f_enddate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_f_enddate", val)
|
||||
}
|
||||
},
|
||||
endDateFormated() {
|
||||
return this.formatDate(this.f_enddate)
|
||||
},
|
||||
f_cabang: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.f_cabang
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_f_cabang", val)
|
||||
}
|
||||
},
|
||||
f_status: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.f_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_f_status", val)
|
||||
}
|
||||
},
|
||||
f_search: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.f_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_f_search", val)
|
||||
}
|
||||
},
|
||||
l_suratjalan() {
|
||||
return this.$store.state.suratjalan.l_suratjalan
|
||||
},
|
||||
l_cabang() {
|
||||
return this.$store.state.suratjalan.l_cabang
|
||||
},
|
||||
l_status() {
|
||||
return this.$store.state.suratjalan.l_status
|
||||
},
|
||||
paginat: {
|
||||
get() {
|
||||
return this.$store.state.suratjalan.paginat
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suratjalan/update_paginat", val)
|
||||
this.$store.dispatch("suratjalan/listingSuratJalan");
|
||||
}
|
||||
},
|
||||
paginat_len() {
|
||||
let total = this.l_suratjalan.total
|
||||
if (total == undefined || total == 0) {
|
||||
return 1
|
||||
}
|
||||
return Math.ceil(total/10)
|
||||
},
|
||||
i_phone() {
|
||||
return this.$store.state.suratjalan.i_phone
|
||||
},
|
||||
s_suratjalan() {
|
||||
return this.$store.state.suratjalan.s_suratjalan
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
const [year, month, day] = date.split("-")
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
searchSuratJalan() {
|
||||
this.$store.dispatch("suratjalan/listingSuratJalan");
|
||||
},
|
||||
selectSuratJalan(item) {
|
||||
this.$store.dispatch("suratjalan/mapDetailSuratJalan", {SuratJalanID: item.SuratJalanID, page: 1})
|
||||
},
|
||||
isSelected(item) {
|
||||
return item.SuratJalanID === this.s_suratjalan.SuratJalanID
|
||||
},
|
||||
confirmSJ(item) {
|
||||
if (item.SuratJalanID == '' || item.SuratJalanID == null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.i_phone || !item.SuratJalanEkspedisiID || !item.SuratJalanEkspedisiStaffID) {
|
||||
let x = { isOpen: true, color: "error", message: "Ekpedisi/Staff/No Hp Masih kosong"}
|
||||
this.$store.commit("suratjalan/update_snackbar", x)
|
||||
return
|
||||
}
|
||||
|
||||
this.$store.dispatch("suratjalan/generateJurnal", item)
|
||||
},
|
||||
deleteSJ(item) {
|
||||
if (item.SuratJalanID == '' || item.SuratJalanID == null) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$store.dispatch("suratjalan/deleteSuratJalan", {
|
||||
SJalanID: item.SuratJalanID,
|
||||
TGoodID: item.SuratJalanT_GoodsTransferID
|
||||
})
|
||||
},
|
||||
checkColor(status) {
|
||||
switch (status) {
|
||||
case 'Process':
|
||||
return 'orange'
|
||||
case 'Completed':
|
||||
return 'green'
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
},
|
||||
newForm() {
|
||||
this.$store.dispatch("suratjalan/newForm")
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
65
test/vuex/acc-one-surat-jalan/index.php
Normal file
65
test/vuex/acc-one-surat-jalan/index.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<!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">
|
||||
<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">
|
||||
<title>ACCONE | SURAT JALAN</title>
|
||||
</head>
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp">
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background: #F5E8DF!important">
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs6 class="left" fill-height pa-1>
|
||||
<one-listing></one-listing>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="right" fill-height pa-1>
|
||||
<one-form></one-form>
|
||||
</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>
|
||||
|
||||
<script type="module">
|
||||
import { store } from './store.js';
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: "#app",
|
||||
methods: {},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-listing': httpVueLoader('./components/listing.vue'),
|
||||
'one-form':httpVueLoader('./components/form.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
471
test/vuex/acc-one-surat-jalan/modules/suratjalan.js
Normal file
471
test/vuex/acc-one-surat-jalan/modules/suratjalan.js
Normal file
@@ -0,0 +1,471 @@
|
||||
import * as api from "../api/api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
user: one_user(),
|
||||
f_startdate: new Date().toISOString().substr(0, 10),
|
||||
f_enddate: new Date().toISOString().substr(0, 10),
|
||||
f_cabang: { M_BranchCode: "ALL", M_BranchName: "SEMUA" },
|
||||
f_status: "All",
|
||||
f_search: "",
|
||||
|
||||
l_suratjalan: {},
|
||||
l_cabang: [],
|
||||
l_status: ["All", "Draft", "Process", "Completed"],
|
||||
paginat: 1,
|
||||
|
||||
l_tfrequest: [],
|
||||
l_ekspedisi: [],
|
||||
l_staff: [],
|
||||
|
||||
s_suratjalan: {
|
||||
SuratJalanID: 0,
|
||||
i_tftype: "",
|
||||
i_tfrequest: {},
|
||||
i_isInternal: "",
|
||||
i_ekspedisi: {},
|
||||
i_staff: {},
|
||||
i_phone: "",
|
||||
i_notes: "",
|
||||
i_status: "BARU",
|
||||
i_date: new Date().toISOString().substr(0, 10),
|
||||
detail: []
|
||||
},
|
||||
d_page: 1,
|
||||
|
||||
snackbar: {
|
||||
isOpen: false,
|
||||
color: "error",
|
||||
message: ""
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
update_f_startdate(state, data) {
|
||||
state.f_startdate = data
|
||||
},
|
||||
update_f_enddate(state, data) {
|
||||
state.f_enddate = data
|
||||
},
|
||||
update_f_cabang(state, data) {
|
||||
state.f_cabang = data
|
||||
},
|
||||
update_f_status(state, data) {
|
||||
state.f_status = data
|
||||
},
|
||||
update_f_search(state, data) {
|
||||
state.f_search = data
|
||||
},
|
||||
update_l_suratjalan(state, data) {
|
||||
state.l_suratjalan = data
|
||||
},
|
||||
update_l_cabang(state, data) {
|
||||
state.l_cabang = data
|
||||
},
|
||||
update_l_tfrequest(state, data) {
|
||||
state.l_tfrequest = data
|
||||
},
|
||||
update_l_ekspedisi(state, data) {
|
||||
state.l_ekspedisi = data
|
||||
},
|
||||
update_l_staff(state, data) {
|
||||
state.l_staff = data
|
||||
},
|
||||
update_paginat(state, data) {
|
||||
state.paginat = data
|
||||
},
|
||||
update_s_suratjalan(state, data) {
|
||||
state.s_suratjalan = data
|
||||
},
|
||||
update_d_page(state, data) {
|
||||
state.d_page = data
|
||||
},
|
||||
update_snackbar(state, data) {
|
||||
state.snackbar = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
/* QUERY */
|
||||
async getBranches(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID
|
||||
}
|
||||
let resp = await api.ListingBranch(params)
|
||||
if (resp.status != "OK") {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
let data = resp.data.records
|
||||
let all = {
|
||||
M_BranchCode: "ALL",
|
||||
M_BranchName: "SEMUA"
|
||||
}
|
||||
data.unshift(all)
|
||||
|
||||
context.commit("update_l_cabang", data)
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async listingSuratJalan(context) {
|
||||
try {
|
||||
let param = {
|
||||
token: one_token(),
|
||||
startdate: context.state.f_startdate,
|
||||
enddate: context.state.f_enddate,
|
||||
branchcode: context.state.f_cabang.M_BranchCode,
|
||||
status: context.state.f_status,
|
||||
currpage: context.state.paginat
|
||||
}
|
||||
let resp = await api.ListingSuratJalan(param)
|
||||
if (resp.status != 'OK') {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
let suratjalan = {
|
||||
records: resp.data.records,
|
||||
total: parseInt(resp.data.total)
|
||||
}
|
||||
context.commit("update_l_suratjalan", suratjalan);
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async listingEkspedisi(context) {
|
||||
try {
|
||||
let param = {
|
||||
expdName: "",
|
||||
isInternal: context.state.s_suratjalan.i_isInternal == 'Internal' ? "Y" : "N",
|
||||
token: one_token()
|
||||
}
|
||||
let resp = await api.lookupEkpedisi(param)
|
||||
if (resp.status != "OK") {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
context.commit("update_l_ekspedisi", resp.data.records)
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async listingEkspedisiStaff(context) {
|
||||
try {
|
||||
let param = {
|
||||
expID: context.state.s_suratjalan.i_ekspedisi.ExpeditionID,
|
||||
staffName: "",
|
||||
token: one_token()
|
||||
}
|
||||
let resp = await api.lookupEkpedisiStaff(param)
|
||||
if (resp.status != "OK") {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
context.commit("update_l_staff", resp.data.records)
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async listingTransferRequest(context) {
|
||||
try {
|
||||
let param = {
|
||||
type: context.state.s_suratjalan.i_tftype,
|
||||
TFnum: "",
|
||||
token: one_token()
|
||||
}
|
||||
const resp = await api.lookupTransferRequest(param)
|
||||
if (resp.status != 'OK') {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
context.commit("update_l_tfrequest", resp.data.records)
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async listingTFdetail(context) {
|
||||
try {
|
||||
let param = {
|
||||
TGoodID: context.state.s_suratjalan.i_tfrequest.T_GoodsTransferID,
|
||||
token: one_token()
|
||||
}
|
||||
const resp = await api.lookupTransferRequestDetail(param)
|
||||
if (resp.status != 'OK') {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
let data = context.state.s_suratjalan
|
||||
data.detail = resp.data.records
|
||||
context.commit("update_s_suratjalan", data)
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async mapDetailSuratJalan(context, param) {
|
||||
try {
|
||||
param.token = one_token()
|
||||
|
||||
const resp = await api.GetTFDataDetail(param)
|
||||
if (resp.status != 'OK') {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
const data = resp.data.records
|
||||
let suratjalan = context.state.s_suratjalan
|
||||
|
||||
suratjalan.i_isInternal = "Internal"
|
||||
if (data.ExpeditionIsInternal != 'Y') {
|
||||
suratjalan.i_isInternal = "Eksternal"
|
||||
}
|
||||
|
||||
let ekspedisi = {
|
||||
ExpeditionID: data.ExpeditionID,
|
||||
ExpeditionIsInternal: data.ExpeditionIsInternal,
|
||||
ExpeditionName: data.ExpeditionName
|
||||
}
|
||||
suratjalan.i_ekspedisi = ekspedisi
|
||||
|
||||
let staff = {
|
||||
ExpeditionStaffID: data.ExpeditionStaffID,
|
||||
ExpeditionStaffMobile: data.ExpeditionStaffMobile,
|
||||
ExpeditionStaffName: data.ExpeditionStaffName
|
||||
}
|
||||
suratjalan.i_staff = staff
|
||||
|
||||
let transfereq = {
|
||||
T_GoodsTransferID: data.T_GoodsTransferID,
|
||||
T_GoodsTransferNum: data.T_GoodsTransferNum,
|
||||
T_GoodsTransferType: data.T_GoodsTransferType,
|
||||
T_GoodsTransferDate: data.T_GoodsTransferDate
|
||||
}
|
||||
suratjalan.i_tfrequest = transfereq
|
||||
|
||||
suratjalan.i_tftype = data.T_GoodsTransferType == 'P' ? 'Persediaan' : 'Non Persediaan'
|
||||
suratjalan.i_phone = data.ExpeditionStaffMobile
|
||||
suratjalan.i_notes = data.SuratJalanNote
|
||||
suratjalan.i_date = data.SuratJalanDate
|
||||
suratjalan.i_status = data.SuratJalanStatus
|
||||
suratjalan.detail = data.detail
|
||||
suratjalan.SuratJalanID = data.SuratJalanID
|
||||
suratjalan.SuratJalanNumber = data.SuratJalanNumber
|
||||
|
||||
await context.commit("update_s_suratjalan", suratjalan)
|
||||
await context.dispatch("listingEkspedisi")
|
||||
await context.dispatch("listingEkspedisiStaff")
|
||||
await context.dispatch("listingTransferRequest")
|
||||
let tfreq = context.state.l_tfrequest
|
||||
tfreq.push(transfereq)
|
||||
context.commit("update_l_tfrequest", tfreq)
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async newForm(context) {
|
||||
try {
|
||||
let param = {
|
||||
SuratJalanID: 0,
|
||||
i_tftype: "",
|
||||
i_tfrequest: {},
|
||||
i_isInternal: "",
|
||||
i_ekspedisi: {},
|
||||
i_staff: {},
|
||||
i_phone: "",
|
||||
i_notes: "",
|
||||
i_status: "BARU",
|
||||
i_date: new Date().toISOString().substr(0, 10),
|
||||
detail: []
|
||||
}
|
||||
|
||||
context.commit("update_s_suratjalan", param)
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, Reset Form"}
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
|
||||
/* MUTATIONS */
|
||||
async createSuratJalan(context) {
|
||||
try {
|
||||
const suratjalan = context.state.s_suratjalan
|
||||
let sjdetail = []
|
||||
suratjalan.detail.forEach(element => {
|
||||
let sjd = {
|
||||
PRFlagID: element.PRFlagID,
|
||||
TGDetailID: element.TGDetailID,
|
||||
ItemID: element.M_ItemID,
|
||||
Qty: element.Quantity,
|
||||
ItemUnitID: element.ItemUnitID
|
||||
}
|
||||
sjdetail.push(sjd)
|
||||
});
|
||||
|
||||
let param = {
|
||||
SJdate: suratjalan.i_date,
|
||||
SJnote: suratjalan.i_notes,
|
||||
TFtype: suratjalan.i_tftype,
|
||||
TGoodID: suratjalan.i_tfrequest.T_GoodsTransferID,
|
||||
TGoodNum: suratjalan.i_tfrequest.T_GoodsTransferNum,
|
||||
EkspedisiID: suratjalan.i_ekspedisi.ExpeditionID,
|
||||
EkspedisiStaffID: suratjalan.i_staff.ExpeditionStaffID,
|
||||
EkspedisiStaffHP: suratjalan.i_phone,
|
||||
SJstatus: suratjalan.i_status == 'BARU' ? 'Draft' : suratjalan.i_status,
|
||||
detail: sjdetail,
|
||||
token: one_token()
|
||||
}
|
||||
|
||||
const resp = await api.createSuratJalan(param)
|
||||
if (resp.status != 'OK') {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
await context.dispatch("newForm")
|
||||
await context.dispatch("listingSuratJalan")
|
||||
|
||||
let x = { isOpen: true, color: "success", message: "Success" }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async updateSuratJalan(context) {
|
||||
try {
|
||||
const suratjalan = context.state.s_suratjalan
|
||||
let sjdetail = []
|
||||
|
||||
suratjalan.detail.forEach(element => {
|
||||
let sjd = {
|
||||
PRFlagID: element.PRFlagID,
|
||||
TGDetailID: element.TGDetailID,
|
||||
ItemID: element.M_ItemID,
|
||||
Qty: element.Quantity,
|
||||
ItemUnitID: element.ItemUnitID
|
||||
}
|
||||
sjdetail.push(sjd)
|
||||
});
|
||||
|
||||
let param = {
|
||||
SJID: suratjalan.SuratJalanID,
|
||||
SJdate: suratjalan.i_date,
|
||||
SJnote: suratjalan.i_notes,
|
||||
TFtype: suratjalan.i_tftype,
|
||||
TGoodID: suratjalan.i_tfrequest.T_GoodsTransferID,
|
||||
TGoodNum: suratjalan.i_tfrequest.T_GoodsTransferNum,
|
||||
EkspedisiID: suratjalan.i_ekspedisi.ExpeditionID,
|
||||
EkspedisiStaffID: suratjalan.i_staff.ExpeditionStaffID,
|
||||
EkspedisiStaffHP: suratjalan.i_phone,
|
||||
SJstatus: suratjalan.i_status == 'BARU' ? 'Draft' : suratjalan.i_status,
|
||||
detail: sjdetail,
|
||||
token: one_token()
|
||||
}
|
||||
|
||||
const resp = await api.updateSuratJalan(param)
|
||||
if (resp.status != "OK") {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
await context.dispatch("newForm")
|
||||
await context.dispatch("listingSuratJalan")
|
||||
|
||||
let x = { isOpen: true, color: "success", message: "Success" }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
async deleteSuratJalan(context, param) {
|
||||
try {
|
||||
param.token = one_token()
|
||||
let resp = await api.deleteSuratJalan(param)
|
||||
if (resp.status != "OK") {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", x)
|
||||
} else {
|
||||
await context.dispatch("newForm")
|
||||
await context.dispatch("listingSuratJalan")
|
||||
|
||||
let x = { isOpen: true, color: "success", message: "Success" }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
} catch (error) {
|
||||
let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", x)
|
||||
}
|
||||
},
|
||||
// async generateJurnal(context, param) {
|
||||
// try {
|
||||
// let listsj = context.state.l_suratjalan.records
|
||||
// let selec = listsj.filter( sj => sj.SuratJalanNumber === param.SuratJalanNumber)[0]
|
||||
|
||||
// let per = {
|
||||
// date: param.SuratJalanDate,
|
||||
// token: one_token()
|
||||
// }
|
||||
|
||||
// let resp = await api.CheckPeriode(per)
|
||||
// if (resp.status != "OK") {
|
||||
// let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
// context.commit("update_snackbar", x)
|
||||
// } else {
|
||||
// let paar = {
|
||||
// M_BranchCode: selec.M_BranchCode,
|
||||
// SuratJalanDate: param.SuratJalanDate,
|
||||
// SuratJalanID: param.SuratJalanID,
|
||||
// token: one_token()
|
||||
// }
|
||||
// let generate = await api.GenerateJurnal(paar)
|
||||
// if (generate.status != "OK") {
|
||||
// let x = { isOpen: true, color: "error", message: "Gagal, " + generate.message }
|
||||
// context.commit("update_snackbar", x)
|
||||
// } else {
|
||||
// context.dispatch("konfirmasiSuratJalan", {
|
||||
// SJalanID: param.SuratJalanID,
|
||||
// TGoodID: selec.SuratJalanT_GoodsTransferID,
|
||||
// detail: param.detail
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// } catch (error) {
|
||||
// let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
// context.commit("update_snackbar", x)
|
||||
// }
|
||||
// },
|
||||
// async konfirmasiSuratJalan(context, param) {
|
||||
// try {
|
||||
// param.token = one_token()
|
||||
// let resp = await api.konfirmSuratJalan(param)
|
||||
// if (resp.status != "OK") {
|
||||
// let x = { isOpen: true, color: "error", message: "Gagal, " + resp.message }
|
||||
// context.commit("update_snackbar", x)
|
||||
// } else {
|
||||
// await context.dispatch("listingSuratJalan")
|
||||
|
||||
// let x = { isOpen: true, color: "success", message: "Success" }
|
||||
// context.commit("update_snackbar", x)
|
||||
// }
|
||||
// } catch (error) {
|
||||
// let x = { isOpen: true, color: "error", message: "Gagal, " + error.message }
|
||||
// context.commit("update_snackbar", x)
|
||||
// }
|
||||
// },
|
||||
}
|
||||
}
|
||||
11
test/vuex/acc-one-surat-jalan/store.js
Normal file
11
test/vuex/acc-one-surat-jalan/store.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import system from "../../../apps/modules/system/system.js"
|
||||
import suratjalan from "./modules/suratjalan.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
system: system,
|
||||
suratjalan: suratjalan
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {}
|
||||
});
|
||||
Reference in New Issue
Block a user