<template>
<div>
<b-breadcrumb :items="breadcrumbItems">b-breadcrumb>
<div id="vp">
<div class="col-lg-12 control-section">
<div class="row">
<EvoPanel title="Prospect">
<div class="col-md-6">
<EvoTextField
placeholder="Prospect.No"
v-model="Pros.CIFNo"
:readonly="true"
>EvoTextField>
<EvoDatePicker
placeholder="Application Date"
name="CreatedDate"
v-model="Pros.CreatedDate"
:readonly="true"
/>
<EvoComboBox
placeholder="Branch"
:datareff="Branch"
:fields="{
text: 'AccessDesc',
value: 'AccessId',
groupBy: 'Parent1',
}"
v-model="Pros.BranchId"
>EvoComboBox>
<EvoTextField
placeholder="Full Name"
:required="true"
v-model="Pros.CustName"
:readonly="false"
name="FullName"
@change="onChange"
>EvoTextField>
<EvoTextField
placeholder="Place of Birth"
:required="true"
v-model="Pros.POB"
:readonly="false"
name="POB"
@change="onChange"
>EvoTextField>
<EvoRadio
ref="Gender"
label="Gender"
:RadioList="GenderList"
name="Gender"
v-model="Pros.Gender"
/>
div>
<div class="col-md-6">
<EvoRadio
label="Customer Type"
:RadioList="CustTypeList"
name="CustType"
:required="true"
v-model="Pros.CustExists"
/>
<EvoDatePicker
placeholder="Date of Birth"
v-model="Pros.DOB"
:readonly="false"
:required="true"
name="DOB"
/>
<EvoComboBox
placeholder="Nationality"
:datareff="NationalityList"
v-model="Pros.Nationality"
>EvoComboBox>
<EvoComboBox
placeholder="Product Type"
:datareff="ProductType"
:fields="{ text: 'PTDesc', value: 'PTCode' }"
v-model="Pros.PTCode "
:readonly="false"
>EvoComboBox>
<EvoComboBox
placeholder="Purpose Of Use"
:datareff="Purpose"
v-model="Pros.PurposeOfUseId"
:readonly="false"
>EvoComboBox>
<EvoTextField
placeholder="Sales Name"
:required="true"
v-model="Pros.CreatedBy"
:readonly="false"
>EvoTextField>
div>
EvoPanel>
div>
div>
<div class="card-footer text-center">
<ejs-button cssClass="e-success" v-on:click.native="autosave"
>Saveejs-button
>
<ejs-button cssClass="e-success" v-on:click.native="setRadio"
>Update RadioGroupejs-button
>
div>
div>
div>
template>
<script>
import Vue from "vue";
import { GET_DATA } from "@/store/constants";
import loginInfo from "@/store/modules/auth/state";
import EvoComboBox from "@/components/Common/ComboBoxComponent";
import EvoCheck from "@/components/Common/CheckBoxComponent";
import EvoPanel from "@/components/Common/AccordionComponent.vue";
import EvoRadio from "@/components/Common/RadioGroupComponent.vue";
import EvoNumberField from "@/components/Common/NumericTextBoxComponent.vue";
import EvoMask from "@/components/Common/MaskedTextBoxComponent.vue";
import EvoTextField from "@/components/Common/TextBoxComponent.vue";
import EvoDatePicker from "@/components/Common/DatePickerComponent.vue";
export default Vue.extend({
props: [],
components: {
EvoComboBox,
EvoCheck,
EvoPanel,
EvoRadio,
EvoNumberField,
EvoMask,
EvoTextField,
EvoDatePicker,
},
data: function () {
return {
breadcrumbItems: [
{
text: "Main",
to: { name: "MainMenu" },
},
{
text: "Pipeline",
rel='nofollow' href: "#",
active: true,
},
],
Pros: {},
session: {},
Branch: [],
ProductType: [],
Purpose: [],
NationalityList: [],
GenderList: [],
CustTypeList: [],
};
},
mounted: function () {
const param = [
this.JParam(
"V",
"1",
"",
"AccessId,AccessDesc,Parent1",
"VW_BRANCH",
null,
null,
null
),
this.JParam(
"V",
"1",
"",
"PTCode,PTDesc",
"rfProductType",
"Active=1",
"",
null,
null
),
this.JParam(
"V",
"1",
"",
"Code,Descr",
"rfPurposeOfUse",
"Active=1",
"",
null,
null
),
this.JParam(
"V",
"1",
"",
"Code,Descr",
"rfNationality",
"Active=1",
"",
null,
null
),
this.JParam(
"V",
"1",
"",
"Code,Descr",
"rfJenisKelamin",
"Active=1",
"",
null,
null
),
this.JParam(
"V",
"1",
"",
"Code,Descr",
"rfCustExists",
"Active=1",
"",
null,
null
),
];
this.$store
.dispatch(GET_DATA, param)
.then((data) => {
console.log(data);
if (data[0].length > 0) this.Branch = data[0];
//rfProductType
if (data[1].length > 0) this.ProductType = data[1];
//rfPurpose
if (data[2].length > 0) this.Purpose = data[2];
//rfIDType
//rfNationality
if (data[3].length > 0) this.NationalityList = data[3];
//rfJenisKelamin
if (data[4].length > 0) this.GenderList = data[4];
//rfCustType
if (data[5].length > 0) this.CustTypeList = data[5];
//rfReligion
//Assign default value if null
this.session = loginInfo.loginInfo;
if (this.Pros.CreatedDate == null) {
this.Pros.CreatedDate = new Date();
}
if (this.Pros.CreatedBy == null) {
this.Pros.CreatedBy = this.session.UserName;
}
if (this.Pros.CIFNo == null) {
this.Pros.CIFNo =
"PROSPECT" +
Math.floor(10000000 + Math.random() * 90000000).toString();
}
})
.catch((err) => {
console.log("Error" + err);
});
},
methods: {
onChange(args) {
console.log("Parent Change");
console.log(this);
},
setRadio: function () {
// this.$refs.Gender.setRadioValue("Male");
this.Pros.Gender = null;
},
autosave: function () {
if (this.validateComponent("#vp")) {
const saveparam = [
this.JNew(
"N",
"1",
this.Pros.BranchId,
[this.Pros],
"App"
)
];
console.log(this.Pros.ProspectNo);
console.log(saveparam);
this.$store
.dispatch(GET_DATA, saveparam)
.then((data) => {
console.log(data);
this.$swal({
icon: "success",
title: "Saving Success",
showConfirmButton: false,
timer: 1500,
});
})
.catch((err) => {
console.log("Error " + err);
});
}
},
handleChange: function (args) {
//this.f1.BranchId = args.value;
},
},
});
script>
<style>
style>
from the screenshot , my local time and date time should be
but the value 7/4/2021 ,
this will misleading saving value to database as 7/4/2021
how to set server timezone offset to UTC+7 or server timezone , in custom component of datepicker?