add modules folder based on s_menu
This commit is contained in:
169
test/vuex/acc-one-listing-pr/components/filter-pr.vue
Normal file
169
test/vuex/acc-one-listing-pr/components/filter-pr.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<v-card class="pa-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs class="px-1">
|
||||
<v-menu
|
||||
v-model="menuStartDate"
|
||||
lazy offset-y full-width
|
||||
max-width="290px" min-width="290px"
|
||||
transition="scale-transition"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="40"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="computedStartDate" label="Start Date"
|
||||
readonly v-on="on" outline hide-details
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="startdate" @input="menuStartDate = false" no-title></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs class="px-1">
|
||||
<v-menu
|
||||
v-model="menuEndDate"
|
||||
lazy offset-y full-width
|
||||
max-width="290px" min-width="290px"
|
||||
transition="scale-transition"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="40"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="computedEndDate" label="End Date"
|
||||
readonly v-on="on" outline hide-details
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="enddate" @input="menuEndDate = false" no-title></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs class="px-1">
|
||||
<v-autocomplete
|
||||
outline v-model="selected_regional"
|
||||
:items="regional" label="Regional" hide-details
|
||||
item-text="S_RegionalName" return-object @input="changeRegional"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs class="px-1">
|
||||
<v-autocomplete
|
||||
outline v-model="selected_branch"
|
||||
:items="branch" label="Cabang" hide-details
|
||||
item-text="M_BranchName" return-object :clearable="true"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs class="px-1">
|
||||
<v-autocomplete
|
||||
outline v-model="selected_status"
|
||||
:items="l_status" label="Status"
|
||||
:clearable="true" hide-details
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs>
|
||||
<v-btn color="primary" class="white--text" @click="search_pr()">CARI</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
mounted() {
|
||||
this.$store.dispatch("listingpr/getregional", {search: ""})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuStartDate: false,
|
||||
menuEndDate: false,
|
||||
l_status: ["SEMUA", "NEW", "READ"]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
startdate: {
|
||||
get() {
|
||||
return this.$store.state.listingpr.startdate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("listingpr/update_startdate", val)
|
||||
}
|
||||
},
|
||||
computedStartDate() {
|
||||
return this.formatDate(this.startdate)
|
||||
},
|
||||
enddate: {
|
||||
get() {
|
||||
return this.$store.state.listingpr.enddate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("listingpr/update_enddate", val)
|
||||
}
|
||||
},
|
||||
computedEndDate() {
|
||||
return this.formatDate(this.enddate)
|
||||
},
|
||||
regional() {
|
||||
return this.$store.state.listingpr.regional
|
||||
},
|
||||
selected_regional: {
|
||||
get() {
|
||||
return this.$store.state.listingpr.selected_regional
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("listingpr/update_selected_regional", val)
|
||||
}
|
||||
},
|
||||
branch() {
|
||||
return this.$store.state.listingpr.branch
|
||||
},
|
||||
selected_branch: {
|
||||
get() {
|
||||
return this.$store.state.listingpr.selected_branch
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("listingpr/update_selected_branch", val)
|
||||
}
|
||||
},
|
||||
selected_status: {
|
||||
get() {
|
||||
return this.$store.state.listingpr.selected_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("listingpr/update_selected_status", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
async search_pr() {
|
||||
if (Object.keys(this.selected_regional).length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
let params = {
|
||||
currpage: 1,
|
||||
startdate: this.startdate,
|
||||
enddate: this.enddate,
|
||||
regional: this.selected_regional.S_RegionalID,
|
||||
branch: !this.selected_branch ? "" : this.selected_branch.M_BranchCode,
|
||||
status: this.selected_status
|
||||
}
|
||||
this.$store.dispatch("listingpr/getlistingpurchase", params)
|
||||
},
|
||||
async changeRegional(item) {
|
||||
this.selected_branch = {}
|
||||
let params = {regionalID: item.S_RegionalID}
|
||||
await this.$store.dispatch("listingpr/getbranch", params)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
271
test/vuex/acc-one-listing-pr/components/listing-pr.vue
Normal file
271
test/vuex/acc-one-listing-pr/components/listing-pr.vue
Normal file
@@ -0,0 +1,271 @@
|
||||
<template>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 class="left" fill-height pa-1>
|
||||
<filter-pr></filter-pr>
|
||||
<v-card class="mt-2">
|
||||
<v-data-table
|
||||
class="elevation-1"
|
||||
hide-actions xs12
|
||||
:headers="headers"
|
||||
:loading="false"
|
||||
:items="list_pr.records"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestDate }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.S_RegionalName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_BranchName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">{{ `${props.item.PurchaseRequestDetailQty} ${props.item.UnitRequest || ''}` }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<template v-if="Array.isArray(props.item.StockQtyArray)">
|
||||
<div v-for="(stock, index) in props.item.StockQtyArray" :key="index">
|
||||
<span class="grey lighten-3 rounded pa-1 caption">
|
||||
{{ `${stock.QtyTotal} ${stock.ItemUnitName || ''}` }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
0 (No Data)
|
||||
</template>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestDetailIsCito }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestDetailStatus }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-btn
|
||||
small round
|
||||
color="primary"
|
||||
:outline="isInList(props.item.PurchaseRequestFlagStatus, 'TF')"
|
||||
:disabled="props.item.M_BranchCode == ''"
|
||||
@click="changeFlag(props.item, 'TF')"
|
||||
>TF</v-btn>
|
||||
<v-btn
|
||||
small round
|
||||
color="primary"
|
||||
:outline="isInList(props.item.PurchaseRequestFlagStatus, 'PO')"
|
||||
@click="changeFlag(props.item, 'PO')"
|
||||
>PO</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<div class="text-xs-center pt-2">
|
||||
<v-pagination v-model="pagination" :length="length_page" :total-visible="7"></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.stock-item {
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.2;
|
||||
margin: 2px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
"filter-pr": httpVueLoader("./filter-pr.vue")
|
||||
},
|
||||
mounted() {
|
||||
let params = {
|
||||
currpage: this.pagination,
|
||||
startdate: this.startdate,
|
||||
enddate: this.enddate,
|
||||
regional: this.selected_regional.S_RegionalID,
|
||||
branch: !this.selected_branch ? "" : this.selected_branch.M_BranchCode,
|
||||
}
|
||||
this.$store.dispatch("listingpr/getlistingpurchase", params)
|
||||
this.$store.dispatch("listingpr/getbranch", { regionalID: this.selected_regional.S_RegionalID })
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "Tanggal Request",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "8%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Nomor Request",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "8%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Regional",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Cabang",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Item",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Request",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "6%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Stok Gdg Reg",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "6%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Cito",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "4%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Status",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "8%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "Flag",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
list_pr() {
|
||||
return this.$store.state.listingpr.list_pr
|
||||
},
|
||||
length_page() {
|
||||
let total = this.list_pr.total;
|
||||
if (total == undefined || total == 0) {
|
||||
return 1
|
||||
}
|
||||
|
||||
return Math.ceil(total/ 10)
|
||||
},
|
||||
selected_regional() {
|
||||
return this.$store.state.listingpr.selected_regional
|
||||
},
|
||||
selected_branch() {
|
||||
return this.$store.state.listingpr.selected_branch
|
||||
},
|
||||
startdate() {
|
||||
return this.$store.state.listingpr.startdate
|
||||
},
|
||||
enddate() {
|
||||
return this.$store.state.listingpr.enddate
|
||||
},
|
||||
pagination: {
|
||||
get() {
|
||||
return this.$store.state.listingpr.pagination
|
||||
},
|
||||
set(data) {
|
||||
let params = {
|
||||
currpage: data,
|
||||
startdate: this.startdate,
|
||||
enddate: this.enddate,
|
||||
regional: this.selected_regional.S_RegionalID,
|
||||
branch: !this.selected_branch ? "" : this.selected_branch.M_BranchCode,
|
||||
}
|
||||
|
||||
this.$store.commit("listingpr/update_pagination", data)
|
||||
this.$store.dispatch("listingpr/getlistingpurchase", params)
|
||||
}
|
||||
},
|
||||
detaildialog: {
|
||||
get() {
|
||||
return this.$store.state.listingpr.detaildialog
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("listingpr/update_detaildialog", data)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isInList(status, val) {
|
||||
if (status == "") {
|
||||
return true
|
||||
}
|
||||
|
||||
let li = status.split(",")
|
||||
if (li.includes(val)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
async changeFlag(item, status) {
|
||||
let flag = ""
|
||||
let li = item.PurchaseRequestFlagStatus.split(",")
|
||||
if (li.includes(status)) {
|
||||
// const updated = li.filter(item => item !== status)
|
||||
// flag = updated.join(",")
|
||||
// console.log("already on read: ", status)
|
||||
return
|
||||
} else {
|
||||
li.push(status)
|
||||
flag = li.join(",")
|
||||
}
|
||||
|
||||
let params = {
|
||||
reqnumber: item.PurchaseRequestNumber,
|
||||
requestflagid: item.PurchaseRequestFlagID,
|
||||
reqdetailid: item.PurchaseRequestDetailID,
|
||||
regionalid: item.S_RegionalID,
|
||||
branchcode: item.M_BranchCode,
|
||||
qty: item.PurchaseRequestDetailQty,
|
||||
UnitIDRequest: item.UnitIDRequest,
|
||||
// stock: item.StockQty,
|
||||
stock: item.StockQtyArray,
|
||||
status: flag
|
||||
}
|
||||
if (item.PurchaseRequestFlagID == "new") {
|
||||
// console.log("new : ", params)
|
||||
this.$store.dispatch("listingpr/addflagstatus", params)
|
||||
} else {
|
||||
// console.log("edit : ", params)
|
||||
this.$store.dispatch("listingpr/editflagstatus", params)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user