FHM28052601 - clone one-md-email-config ke one-md-email-notification-config dengan endpoint email_notification/Config_email
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
39
test/vuex/one-md-email-notification-config/api/form.js
Normal file
39
test/vuex/one-md-email-notification-config/api/form.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const URL = "/one-api/mockup/email_notification/Config_email/";
|
||||
|
||||
export async function getdata(token,id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'getdata', { token:token });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function save(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'save', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
78
test/vuex/one-md-email-notification-config/api/listing.js
Normal file
78
test/vuex/one-md-email-notification-config/api/listing.js
Normal file
@@ -0,0 +1,78 @@
|
||||
const URL = "/one-api/mockup/email_notification/Config_email/";
|
||||
|
||||
export async function lookup(token, search,all ) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '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 + 'save', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function update(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'update', 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 + 'delete', { 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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<v-layout row>
|
||||
<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-flex xs6 mr-1>
|
||||
<v-card>
|
||||
<v-card-title class="headline grey darken-1 pt-2 pb-2" primary-title style="color:white">
|
||||
<h4>Email Notification Konfigurasi</h4>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout row>
|
||||
<v-flex xs6 pa-2 d-flex>
|
||||
<v-text-field v-model="server" label="Server"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 pa-2 d-flex>
|
||||
<v-text-field v-model="sender" label="Pengirim"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs6 pa-2 d-flex>
|
||||
<v-text-field v-model="emailcc" label="Email CC"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 pa-2>
|
||||
<v-text-field v-model="maxretry" label="Maksimal Pengulangan Pengiriman Otomatis"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row>
|
||||
<v-flex xs12 class="text-md-center" pa-2 d-flex>
|
||||
<h4>FORMAT EMAIL APS</h4>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-2 d-flex>
|
||||
<v-textarea filled solo background-color="amber lighten-4" color="orange orange-darken-4" label="Format Email" v-model="formatemailaps"
|
||||
rows="14"></v-textarea>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn @click="doSave()" color="primary">SIMPAN</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
<v-flex xs6 ml-1>
|
||||
<v-card>
|
||||
<v-card-title class="headline grey darken-1 pt-2 pb-2" primary-title style="color:white">
|
||||
<h4>Tampilan Email</h4>
|
||||
</v-card-title>
|
||||
<v-flex xs12 class="text-md-center" pa-2 d-flex>
|
||||
<h4>FORMAT EMAIL APD</h4>
|
||||
</v-flex>
|
||||
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-2 v-html="formatemail">
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<v-flex xs12 class="text-md-center" pa-2 d-flex>
|
||||
<h4>FORMAT EMAIL APS</h4>
|
||||
</v-flex>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-2 v-html="formatemailaps">
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<v-flex xs12 class="text-md-center" pa-2 d-flex>
|
||||
<h4>FORMAT EMAIL REKANAN</h4>
|
||||
</v-flex>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-2 v-html="formatemailrk">
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.scroll-container {
|
||||
scroll-padding: 50px 0 0 50px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: #73baf3;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: #2196f3;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-button {
|
||||
background-color: #0079da;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background-color: black;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data: () => ({
|
||||
color: "success"
|
||||
}),
|
||||
mounted() {
|
||||
this.$store.dispatch("form/getdata")
|
||||
},
|
||||
computed: {
|
||||
sender: {
|
||||
get() {
|
||||
return this.$store.state.form.sender
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_sender", val)
|
||||
}
|
||||
},
|
||||
server: {
|
||||
get() {
|
||||
return this.$store.state.form.server
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_server", val)
|
||||
}
|
||||
},
|
||||
username: {
|
||||
get() {
|
||||
return this.$store.state.form.username
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_username", val)
|
||||
}
|
||||
},
|
||||
password: {
|
||||
get() {
|
||||
return this.$store.state.form.password
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_password", val)
|
||||
}
|
||||
},
|
||||
maxretry: {
|
||||
get() {
|
||||
return this.$store.state.form.maxretry
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_maxretry", val)
|
||||
}
|
||||
},
|
||||
emailcc: {
|
||||
get() {
|
||||
return this.$store.state.form.emailcc
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_emailcc", val)
|
||||
}
|
||||
},
|
||||
formatemail: {
|
||||
get() {
|
||||
return this.$store.state.form.formatemail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_formatemail", val)
|
||||
}
|
||||
},
|
||||
|
||||
formatemailaps: {
|
||||
get() {
|
||||
return this.$store.state.form.formatemailaps
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_formatemailaps", val)
|
||||
}
|
||||
},
|
||||
|
||||
formatemailrk: {
|
||||
get() {
|
||||
return this.$store.state.form.formatemailrk
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_formatemailrk", val)
|
||||
}
|
||||
},
|
||||
formatemailwaaps: {
|
||||
get() {
|
||||
return this.$store.state.form.formatemailwaaps
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_formatemailwaaps", val)
|
||||
}
|
||||
},
|
||||
formatemailwagreetingaps: {
|
||||
get() {
|
||||
return this.$store.state.form.formatemailwagreetingaps
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_formatemailwagreetingaps", val)
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.form.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("form/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
msgsnackbar() {
|
||||
return this.$store.state.form.msg_success
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
doSave() {
|
||||
var prm = {
|
||||
M_EmailConfigSender: this.sender,
|
||||
M_EmailConfigUsername: this.username,
|
||||
M_EmailConfigPassword: this.password,
|
||||
M_EmailConfigServer: this.server,
|
||||
M_EmailConfigMaxRetry: this.maxretry,
|
||||
M_EmailConfigResultFormatAPS: this.formatemailaps,
|
||||
M_EmailConfigCc: this.emailcc,
|
||||
M_EmailConfigID: this.$store.state.form.xid
|
||||
}
|
||||
this.$store.dispatch("form/save", prm)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
72
test/vuex/one-md-email-notification-config/index.php
Normal file
72
test/vuex/one-md-email-notification-config/index.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<!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/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 xs12 class="left" fill-height pa-1>
|
||||
<!-- komponen kiri -->
|
||||
<one-md-email-notification-config></one-md-email-notification-config>
|
||||
</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-email-notification-config' : httpVueLoader('./components/oneMdEmailNotificationConfig.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
139
test/vuex/one-md-email-notification-config/modules/form.js
Normal file
139
test/vuex/one-md-email-notification-config/modules/form.js
Normal file
@@ -0,0 +1,139 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/form.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
errors:[],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
get_data_status: 0,
|
||||
get_data_error_message: '',
|
||||
xid:0,
|
||||
sender:'',
|
||||
server:'',
|
||||
username:'',
|
||||
password:'',
|
||||
maxretry:0,
|
||||
emailcc:'',
|
||||
formatemail:'',
|
||||
formatemailaps:'',
|
||||
formatemailrk:'',
|
||||
formatemailwaaps: '',
|
||||
formatemailwagreetingaps: '',
|
||||
alert_success:false,
|
||||
msg_success: "",
|
||||
},
|
||||
mutations: {
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = 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_xid(state, val) {
|
||||
state.xid = val
|
||||
},
|
||||
update_sender(state, val) {
|
||||
state.sender = val
|
||||
},
|
||||
update_server(state, val) {
|
||||
state.server = val
|
||||
},
|
||||
update_username(state, val) {
|
||||
state.username = val
|
||||
},
|
||||
update_password(state, val) {
|
||||
state.password = val
|
||||
},
|
||||
update_maxretry(state, val) {
|
||||
state.maxretry = val
|
||||
},
|
||||
update_emailcc(state, val) {
|
||||
state.emailcc = val
|
||||
},
|
||||
update_formatemail(state, val) {
|
||||
state.formatemail = val
|
||||
},
|
||||
update_formatemailaps(state, val) {
|
||||
state.formatemailaps = val
|
||||
},
|
||||
update_formatemailrk(state, val) {
|
||||
state.formatemailrk = val
|
||||
},
|
||||
update_formatemailwaaps(state, val) {
|
||||
state.formatemailwaaps = val
|
||||
},
|
||||
update_formatemailwagreetingaps(state, val) {
|
||||
state.formatemailwagreetingaps = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async getdata(context) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.getdata(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_save_status",2)
|
||||
context.commit("update_xid", data.records.M_EmailConfigID)
|
||||
context.commit("update_sender", data.records.M_EmailConfigSender)
|
||||
context.commit("update_server", data.records.M_EmailConfigServer)
|
||||
context.commit("update_username", data.records.M_EmailConfigUsername)
|
||||
context.commit("update_password", data.records.M_EmailConfigPassword)
|
||||
context.commit("update_maxretry", data.records.M_EmailConfigMaxRetry)
|
||||
context.commit("update_emailcc", data.records.M_EmailConfigCc)
|
||||
context.commit("update_formatemail", data.records.M_EmailConfigResultFormatAPD)
|
||||
context.commit("update_formatemailaps", data.records.M_EmailConfigResultFormatAPS)
|
||||
context.commit("update_formatemailrk", data.records.M_EmailConfigResultFormatRK)
|
||||
context.commit("update_formatemailwaaps", data.records.M_EmailConfigWaAPS)
|
||||
context.commit("update_formatemailwagreetingaps", data.records.M_EmailConfigWaGreetingAPS)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async save(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
|
||||
var msg = "Email Konfigurasi sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.dispatch("getdata")
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
198
test/vuex/one-md-email-notification-config/modules/listing.js
Normal file
198
test/vuex/one-md-email-notification-config/modules/listing.js
Normal file
@@ -0,0 +1,198 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/listing.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
act:'new',
|
||||
lookup_bahan: 0,
|
||||
lookup_error_message: '',
|
||||
bahans: [],
|
||||
total_bahans: 0,
|
||||
total_filter_bahans: 0,
|
||||
selected_bahan: { name: "[ Belum memilih Bahan ]" },
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_bahan: false,
|
||||
dialog_edit_form_bahan:false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
show_all:'N',
|
||||
errors:[]
|
||||
},
|
||||
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_bahan(state, status) {
|
||||
state.lookup_bahan = status
|
||||
},
|
||||
update_bahans(state, data) {
|
||||
state.bahans = data.records
|
||||
state.total_bahans = data.total
|
||||
state.total_filter_bahans = data.total_filter
|
||||
},
|
||||
update_selected_bahan(state, val) {
|
||||
state.selected_bahan = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_bahan(state, val) {
|
||||
state.dialog_form_bahan = val
|
||||
},
|
||||
update_dialog_edit_form_bahan(state, val) {
|
||||
state.dialog_edit_form_bahan = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
}
|
||||
|
||||
},
|
||||
actions: {
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_lookup_bahan", 1)
|
||||
try {
|
||||
let resp = await api.lookup(one_token(), prm.search, prm.all)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_bahan", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_bahan", 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_bahans", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_bahan", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("update_error_name", false)
|
||||
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_bahan", false)
|
||||
var msg = "Bahan " + 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)
|
||||
context.commit("update_error_code", false)
|
||||
context.commit("update_error_name", false)
|
||||
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_error_code", false)
|
||||
context.commit("update_error_name", false)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_bahan", false)
|
||||
var msg = "Bahan " + prm.name + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookup", { search: "" , all:context.show_all})
|
||||
}else{
|
||||
if(resp.data.errorcode === 'Y'){
|
||||
context.commit("update_error_code", true)
|
||||
}
|
||||
if(resp.data.errorname === 'Y'){
|
||||
context.commit("update_error_name", true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} 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.bahanid)
|
||||
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.bahanname + " sudah dihapus dong"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_selected_bahan", {})
|
||||
context.dispatch("lookup", { search: "" })
|
||||
context.commit("sampletype/update_bahan_sampletype", [], { root: true })
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
test/vuex/one-md-email-notification-config/store.js
Normal file
23
test/vuex/one-md-email-notification-config/store.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import form from "./modules/form.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
form: form,
|
||||
system:system
|
||||
},
|
||||
state: {
|
||||
|
||||
},
|
||||
mutations: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user