FHM28052601 - update field mapping sesuai response API email_notification/Config_email

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sas.fajri
2026-05-28 11:24:50 +07:00
parent 93f5a3a815
commit d61f1d145a
2 changed files with 161 additions and 278 deletions

View File

@@ -2,7 +2,7 @@
<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)">
<v-btn flat @click="snackbar = false">
Tutup
</v-btn>
</v-snackbar>
@@ -22,25 +22,31 @@
</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-text-field v-model="username" label="Username"></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 xs6 pa-2 d-flex>
<v-text-field v-model="password" label="Password" type="password"></v-text-field>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs6 pa-2 d-flex>
<v-text-field v-model="sendtime" label="Waktu Kirim"></v-text-field>
</v-flex>
<v-flex xs6 pa-2 d-flex>
<v-select v-model="isactive" :items="['Y','N']" label="Aktif"></v-select>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12 class="text-md-center" pa-2 d-flex>
<h4>FORMAT EMAIL APS</h4>
<h4>TEMPLATE EMAIL NOTIFIKASI</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"
<v-textarea filled solo background-color="amber lighten-4" color="orange orange-darken-4" label="Template Email" v-model="template"
rows="14"></v-textarea>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
@@ -52,65 +58,32 @@
<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>
<h4>Preview Template 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 xs12 pa-2 v-html="template">
</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-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;
}
@@ -126,102 +99,36 @@
},
computed: {
sender: {
get() {
return this.$store.state.form.sender
},
set(val) {
this.$store.commit("form/update_sender", val)
}
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)
}
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)
}
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)
}
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)
}
sendtime: {
get() { return this.$store.state.form.sendtime },
set(val) { this.$store.commit("form/update_sendtime", val) }
},
emailcc: {
get() {
return this.$store.state.form.emailcc
},
set(val) {
this.$store.commit("form/update_emailcc", val)
}
template: {
get() { return this.$store.state.form.template },
set(val) { this.$store.commit("form/update_template", 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)
}
isactive: {
get() { return this.$store.state.form.isactive },
set(val) { this.$store.commit("form/update_isactive", val) }
},
snackbar: {
get() {
return this.$store.state.form.alert_success
},
set(val) {
this.$store.commit("form/update_alert_success", val)
}
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
@@ -230,14 +137,14 @@
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
Email_ConfigNofificationID: this.$store.state.form.xid,
Email_ConfigNofificationSender: this.sender,
Email_ConfigNofificationUsername: this.username,
Email_ConfigNofificationPassword: this.password,
Email_ConfigNofificationServer: this.server,
Email_ConfigNofificationSendTime: this.sendtime,
Email_ConfigNofificationTemplate: this.template,
Email_ConfigNofificationIsActive: this.isactive,
}
this.$store.dispatch("form/save", prm)
}

View File

@@ -1,139 +1,115 @@
// 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)
}
}
}
}
// 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: '',
sendtime: '',
template: '',
isactive: 'Y',
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_sendtime(state, val) {
state.sendtime = val
},
update_template(state, val) {
state.template = val
},
update_isactive(state, val) {
state.isactive = 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 rec = resp.data.records
context.commit("update_save_status", 2)
context.commit("update_xid", rec.Email_ConfigNofificationID)
context.commit("update_sender", rec.Email_ConfigNofificationSender)
context.commit("update_server", rec.Email_ConfigNofificationServer)
context.commit("update_username", rec.Email_ConfigNofificationUsername)
context.commit("update_password", rec.Email_ConfigNofificationPassword)
context.commit("update_sendtime", rec.Email_ConfigNofificationSendTime)
context.commit("update_template", rec.Email_ConfigNofificationTemplate)
context.commit("update_isactive", rec.Email_ConfigNofificationIsActive)
}
} 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 Notification 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)
}
}
}
}