add modules folder based on s_menu

This commit is contained in:
2026-06-30 10:16:11 +07:00
parent 315b657ee3
commit a1aab09ac9
625 changed files with 192283 additions and 794 deletions

View File

@@ -0,0 +1,115 @@
const URL = "/one-api/mockup/purchase/listing/PurchaseRequestListing/";
export async function listing_regional(params) {
try {
var resp = await axios.post(URL + 'listing_regional', params)
if (resp.status != 200) {
return {
status: "ERR",
message: resp.message
}
}
let data = resp.data
return data
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function listing_branch(params) {
try {
var resp = await axios.post(URL + 'listing_branch', params)
if (resp.status != 200) {
return {
status: "ERR",
message: resp.message
}
}
let data = resp.data
return data
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
// export async function listing_purchase_req(params) {
// try {
// var resp = await axios.post(URL + 'listing_pr', params)
// if (resp.status != 200) {
// return {
// status: "ERR",
// message: resp.message
// }
// }
// let data = resp.data
// return data
// } catch (error) {
// return {
// status: "ERR",
// message: error.message
// }
// }
// }
export async function listing_purchase_req(params) {
try {
var resp = await axios.post(URL + 'list_purchaserequest', params)
if (resp.status != 200) {
return {
status: "ERR",
message: resp.message
}
}
let data = resp.data
return data
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function add_flag_status(params) {
try {
var resp = await axios.post(URL + 'insertstatus', params)
if (resp.status != 200) {
return {
status: "ERR",
message: resp.message
}
}
let data = resp.data
return data
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function edit_flag_status(params) {
try {
var resp = await axios.post(URL + 'changestatus', params)
if (resp.status != 200) {
return {
status: "ERR",
message: resp.message
}
}
let data = resp.data
return data
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}

View 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>

View 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>

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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>List PR</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">
<one-listing-pr></one-listing-pr>
</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 -->
<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-pr': httpVueLoader('./components/listing-pr.vue')
}
})
</script>
<style>
[v-cloak] {
display: none;
}
</style>
</body>
</html>

View File

@@ -0,0 +1,197 @@
import * as api from "../api/api.js"
export default {
namespaced: true,
state: {
user: one_user(),
api_status: 1,
detaildialog: false,
err_msg: "",
err_val: 0,
regional: [],
selected_regional: {
S_RegionalID: one_user()['S_RegionalID'],
S_RegionalName: one_user()['S_RegionalName']
},
branch: [],
selected_branch: {},
selected_status: "SEMUA",
startdate: new Date().toISOString().substr(0, 10),
enddate: new Date().toISOString().substr(0, 10),
list_pr: {},
pagination: 1
},
mutations: {
update_err_msg(state, data) {
state.err_msg = data
},
update_err_val(state, data) {
state.err_val = data
},
update_startdate(state, data) {
state.startdate = data
},
update_enddate(state, data) {
state.enddate = data
},
update_regional(state, data) {
state.regional = data
},
update_selected_regional(state, data) {
state.selected_regional = data
},
update_branch(state, data) {
state.branch = data
},
update_selected_branch(state, data) {
state.selected_branch = data
},
update_selected_status(state, data) {
state.selected_status = data
},
update_list_pr(state, data) {
state.list_pr = data
},
update_pagination(state, data) {
state.pagination = data
},
update_api_status(state, data) {
state.api_status = data
},
update_detaildialog(state, data) {
state.detaildialog = data
}
},
actions: {
async getregional(context, params) {
context.commit("update_err_val", 0)
try {
params.token = one_token()
let response = await api.listing_regional(params)
if (response.status != "OK") {
context.commit("update_err_val", 1)
} else {
let data = response.data.records
context.commit("update_regional", data)
}
} catch (error) {
context.commit("update_err_val", 1)
}
},
async getbranch(context, params) {
context.commit("update_err_val", 0)
try {
params.token = one_token()
let response = await api.listing_branch(params)
if (response.status != "OK") {
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error get listing branch: ", response.message)
} else {
let data = [
{
M_BranchCode: "ALL",
M_BranchName: "SEMUA"
},
...response.data.result
]
context.commit("update_branch", data)
}
} catch (error) {
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error get listing branch: ", error.message)
}
},
async getlistingpurchase(context, params) {
context.commit("update_err_val", 0)
try {
params.token = one_token()
let resp = await api.listing_purchase_req(params)
if (resp.status != "OK") {
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error get listing branch: ", response.message)
} else {
let data = {
records: resp.data.records,
total: parseInt(resp.data.total)
}
context.commit("update_list_pr", data)
}
} catch (error) {
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error get listing request: ", error.message)
}
},
async addflagstatus(context, params) {
context.commit("update_err_val", 0)
context.commit("update_api_status", 1)
try {
params.token = one_token()
let resp = await api.add_flag_status(params)
if (resp.status != "OK") {
context.commit("update_api_status", 3)
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error add flag request: ", resp.message)
} else {
context.dispatch("refresh_list")
context.commit("update_api_status", 2)
}
} catch (error) {
context.commit("update_api_status", 3)
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error add flag request: ", error.message)
}
},
async editflagstatus(context, params) {
context.commit("update_api_status", 1)
context.commit("update_err_val", 0)
try {
params.token = one_token()
let resp = await api.edit_flag_status(params)
if (resp.status != "OK") {
context.commit("update_api_status", 3)
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error edit flag request: ", resp.message)
} else {
context.dispatch("refresh_list")
context.commit("update_api_status", 2)
}
} catch (error) {
context.commit("update_api_status", 3)
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error edit flag request: ", error.message)
}
},
async refresh_list(context) {
context.commit("update_err_val", 0)
try {
let params = {
token: one_token(),
currpage: context.state.pagination,
startdate: context.state.startdate,
enddate: context.state.enddate,
regional: context.state.selected_regional.S_RegionalID,
branch: !context.state.selected_branch ? "" : context.state.selected_branch.M_BranchCode,
status: context.state.selected_status
}
let resp = await api.listing_purchase_req(params)
if (resp.status != "OK") {
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error refresh request: ", resp.message)
} else {
let data = {
records: resp.data.records,
total: parseInt(resp.data.total)
}
context.commit("update_list_pr", data)
}
} catch (error) {
context.commit("update_err_val", 1)
context.commit("update_err_msg", "error refresh request: ", error.message)
}
}
}
}

View File

@@ -0,0 +1,11 @@
import system from "../../../apps/modules/system/system.js";
import listingpr from "./modules/listingpr.js";
export const store = new Vuex.Store({
modules: {
system: system,
listingpr: listingpr,
},
state: {},
mutations: {},
actions: {}
})