Commit f8f7121f authored by EKSAD's avatar EKSAD

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents bca2fa8d 3c9d73d1
...@@ -133,7 +133,6 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -133,7 +133,6 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const getReportItems = () => api.get('item_report/get_all_item_report') const getReportItems = () => api.get('item_report/get_all_item_report')
const getInputType = () => api.get('type_item_report/get_all_type_item_report') const getInputType = () => api.get('type_item_report/get_all_type_item_report')
const getReportType = () => api.get('report/get_all_report') const getReportType = () => api.get('report/get_all_report')
const getReportTypeBody = (body) => api.post('report/get_all_report', body)
const getDetailReportItems = (userId) => api.get(`item_report/get_item_report_by_id/${userId}`) const getDetailReportItems = (userId) => api.get(`item_report/get_item_report_by_id/${userId}`)
const searchReportItems = (body) => api.post('/item_report/search_item_report', body) const searchReportItems = (body) => api.post('/item_report/search_item_report', body)
const createReportItems = (body) => api.post('/item_report/create_item_report', body) const createReportItems = (body) => api.post('/item_report/create_item_report', body)
...@@ -155,6 +154,13 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -155,6 +154,13 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const uploadParameter = (body) => api.post('/setting/import_setting', body) const uploadParameter = (body) => api.post('/setting/import_setting', body)
const searchParameter = (body) => api.post('setting/search_setting', body) const searchParameter = (body) => api.post('setting/search_setting', body)
//Transaction
const getReportTypeBody = (body) => api.post('transaction/get_all_report', body)
const getMasterBudgetAtt = (body) => api.post('transaction/get_report_attachment', body)
const uploadAttachment = (body) => api.post('transaction/upload_attachment', body)
const getRevision = (body) => api.post('transaction/get_revision', body)
const getPeriodeTransaction = () => api.get('transaction/get_periode')
//Template //Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
...@@ -252,7 +258,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -252,7 +258,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getDetailUnitBisnis, getDetailUnitBisnis,
uploadFoto, uploadFoto,
getReportTypeBody, getReportTypeBody,
getPermission getPermission,
getMasterBudgetAtt,
uploadAttachment,
getPeriodeTransaction,
getRevision
} }
} }
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem } from '@material-ui/core'; import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } from '@material-ui/core';
import MUIDataTable from 'mui-datatables'; import MUIDataTable from 'mui-datatables';
import Images from '../assets/Images'; import Images from '../assets/Images';
import BalanceSheet from './BudgetTahunan/BalanceSheet'; import BalanceSheet from './BudgetTahunan/BalanceSheet';
...@@ -10,47 +10,75 @@ import ProfitLoss from './BudgetTahunan/ProfitLoss'; ...@@ -10,47 +10,75 @@ import ProfitLoss from './BudgetTahunan/ProfitLoss';
import TaxPlanning from './BudgetTahunan/TaxPlanning'; import TaxPlanning from './BudgetTahunan/TaxPlanning';
import FixedAssetsMovement from './BudgetTahunan/FixedAssetsMovement'; import FixedAssetsMovement from './BudgetTahunan/FixedAssetsMovement';
import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget'; import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget';
import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../library/Upload";
import { format } from 'date-fns';
export default class BudgetTahunan extends Component { export default class BudgetTahunan extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
periode: '2020',
perusahaan: 'TAP Group', perusahaan: 'TAP Group',
revisi: '0', listRevision: null,
revision: null,
visibleBudgetTahunan: true, visibleBudgetTahunan: true,
visibleBS: false, visibleBS: false,
listPeriode: null,
periode: null,
listCompany: null, listCompany: null,
company: null, company: null,
report_id: null, report_id: null,
visiblePL: false, visiblePL: false,
visibleFAM: false, visibleFAM: false,
visibleCAT: false visibleCAT: false,
listAttachment: [],
visibleUpload: false
} }
this.fileHandler = this.fileHandler.bind(this);
} }
componentDidMount() { componentDidMount() {
this.getCompanyActive() this.getCompanyActive()
} }
getReportAttachment() {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"revision": this.state.revision.revision,
}
api.create().getMasterBudgetAtt(payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.setState({ listAttachment: response.data.data })
}
}
// console.log(response);
})
}
getReport() { getReport() {
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode, "periode": this.state.periode.periode,
"report_type": "Master Budget", "report_type": "Master Budget",
} }
api.create().getReportTypeBody(payload).then(response => { api.create().getReportTypeBody(payload).then(response => {
// console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
index + 1, item.number,
item.report_name, item.report_name,
"", item.revision,
item.report_id item.current_status,
item.report_id,
item.is_can_upload,
item.revision
] ]
}) })
// console.log(dataTable);
this.setState({ dataTable }) this.setState({ dataTable })
} }
} }
...@@ -71,13 +99,68 @@ export default class BudgetTahunan extends Component { ...@@ -71,13 +99,68 @@ export default class BudgetTahunan extends Component {
options: companyData, options: companyData,
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; };
this.setState({ listCompany: defaultProps, company: companyData[0] }, ()=> this.getReport()) this.setState({ listCompany: defaultProps, company: companyData[0] }, () => {
this.getPeriode()
})
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
}) })
} }
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date
let year = format(dateNow, 'yyyy')
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let periodeData = data.map((item) => {
return {
periode: item,
}
})
let defaultProps = {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let index = data.sort((a, b) => a - b).findIndex((val) => val == year)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
this.getRevision()
})
}
}
})
}
getRevision() {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode
}
api.create().getRevision(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let revisionData = data.map((item) => {
return {
revision: item,
}
})
let defaultProps = {
options: revisionData,
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getReport()
this.getReportAttachment()
})
}
}
})
}
clickDetail(item, id) { clickDetail(item, id) {
this.setState({ report_id: id }) this.setState({ report_id: id })
if (item === 'Balance Sheet') { if (item === 'Balance Sheet') {
...@@ -128,17 +211,88 @@ export default class BudgetTahunan extends Component { ...@@ -128,17 +211,88 @@ export default class BudgetTahunan extends Component {
} }
} }
handleChange(value, tableMeta) {
let data = this.state.dataTable
data[tableMeta.rowIndex][tableMeta.columnIndex] = value
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
if (err) {
console.log(err);
}
else {
const formData = new FormData();
formData.append("revision", Number(this.state.revisi));
formData.append("companyId", this.state.company.company_id);
formData.append("periode", Number(this.state.periode.periode));
formData.append("file", event);
this.setState({ formData })
}
})
}
uploadAttachment(formData) {
api.create().uploadAttachment(formData).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.setState({ visibleUpload: false }, () => {
this.getReport()
this.getReportAttachment()
})
}
}
// console.log(response)
})
}
render() { render() {
const columns = ["#", "Jenis Laporan", const columns = ["#", "Jenis Laporan",
{ {
name: "Revision",
options: {
customBodyRender: (val, tableMeta, updateValue) => {
var list = [];
for (var i = 0; i <= tableMeta.rowData[6]; i++) {
list.push(i);
}
return (
<div style={{ display: 'flex' }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<Select
value={val}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
autoWidth
>
{list.map((item, index) =>
<MenuItem key={index} value={item}>{item}</MenuItem>
)}
</Select>
}
/>
</div >
);
}
}
}, {
name: "Status", name: "Status",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{val === "acc" ? {val === "submitted" || val === "approved" ?
<img src={Images.ceklis} style={{ width: 31, height: 24 }} /> : <img src={Images.ceklis} style={{ width: 31, height: 24 }} /> :
val === "revision" ?
<span>Revisi</span> :
null null
} }
</div > </div >
...@@ -155,17 +309,25 @@ export default class BudgetTahunan extends Component { ...@@ -155,17 +309,25 @@ export default class BudgetTahunan extends Component {
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: tableMeta.rowData[5] ? 'pointer' : null,
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[3])} onClick={() =>
tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4]) : null
}
> >
<Typography style={{ color: '#5198ea', fontSize: 12, }}>Detail</Typography> <Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
</button> </button>
</div > </div >
); );
} }
} }
}, {
name: "",
options: { display: false }
}, {
name: "",
options: { display: false }
}] }]
const dataTable = [ const dataTable = [
["1", "Balance Sheet", "done"], ["1", "Balance Sheet", "done"],
...@@ -197,6 +359,7 @@ export default class BudgetTahunan extends Component { ...@@ -197,6 +359,7 @@ export default class BudgetTahunan extends Component {
search: false search: false
} }
const periode = [ const periode = [
{ value: '2021', label: '2021' },
{ value: '2020', label: '2020' }, { value: '2020', label: '2020' },
{ value: '2019', label: '2019' }, { value: '2019', label: '2019' },
{ value: '2018', label: '2018' }, { value: '2018', label: '2018' },
...@@ -228,26 +391,28 @@ export default class BudgetTahunan extends Component { ...@@ -228,26 +391,28 @@ export default class BudgetTahunan extends Component {
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div> <div>
<TextField <Autocomplete
style={{ width: 250, }} {...this.state.listPeriode}
id="periode" id="periode"
select onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
label="Periode" this.getReport()
this.getReportAttachment()
})}
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.periode} value={this.state.periode}
onChange={(e) => this.setState({ periode: e.target.value })} />
>
{periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.label}
</MenuItem>
))}
</TextField>
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<Autocomplete <Autocomplete
{...this.state.listCompany} {...this.state.listCompany}
id="company" id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue })} onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.getReport()
this.getReportAttachment()
})}
debug debug
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
...@@ -256,20 +421,19 @@ export default class BudgetTahunan extends Component { ...@@ -256,20 +421,19 @@ export default class BudgetTahunan extends Component {
/> />
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<TextField <Autocomplete
style={{ width: 250, }} {...this.state.listRevision}
id="reivisi" id="revision"
select onChange={(event, newInputValue) => this.setState({ revision: newInputValue }, () => {
label="Revisi" this.getReport()
value={this.state.revisi} this.getReportAttachment()
onChange={(e) => this.setState({ revisi: e.target.value })} })}
> debug
{revisi.map((option) => ( disableClearable
<MenuItem key={option.value} value={option.value}> style={{ width: 250 }}
{option.label} renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
</MenuItem> value={this.state.revision}
))} />
</TextField>
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
...@@ -284,17 +448,39 @@ export default class BudgetTahunan extends Component { ...@@ -284,17 +448,39 @@ export default class BudgetTahunan extends Component {
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography> <Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography> <Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography>
</button>
</div> </div>
</div> </div>
<div style={{ display: 'flex', marginTop: 10 }}> <div style={{ display: 'flex', marginTop: 10 }}>
<div style={{ width: '50%', paddingLeft: 20 }}> <div style={{ width: '50%', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>File 1.xls </Typography> {this.state.listAttachment.length > 0 ?
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>File 2.xls </Typography> this.state.listAttachment.map((item) => {
return (
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>{item.attachment_name}</Typography>
)
})
: null
}
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
{this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
return (
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography> <Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography>
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography> )
})
: null
}
</div> </div>
</div> </div>
</div> </div>
...@@ -309,18 +495,52 @@ export default class BudgetTahunan extends Component { ...@@ -309,18 +495,52 @@ export default class BudgetTahunan extends Component {
</div> </div>
)} )}
{this.state.visibleUpload && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => this.uploadAttachment(this.state.formData)}
/>
</div>
</div>
)}
{this.state.visibleBS && ( {this.state.visibleBS && (
<BalanceSheet <BalanceSheet
report_id={this.state.report_id} report_id={this.state.report_id}
company={this.state.company} company={this.state.company}
onClickClose={()=> this.setState({ visibleBS: false, visibleBudgetTahunan: true})} onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
/> />
)} )}
{this.state.visiblePL && ( {this.state.visiblePL && (
<ProfitLoss <ProfitLoss
report_id={this.state.report_id} report_id={this.state.report_id}
company={this.state.company} company={this.state.company}
onClickClose={()=> this.setState({ visiblePL: false, visibleBudgetTahunan: true})} onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
/> />
)} )}
......
...@@ -158,17 +158,17 @@ export default class AddUser extends Component { ...@@ -158,17 +158,17 @@ export default class AddUser extends Component {
var isEmail = this.isEmail(this.state.email) var isEmail = this.isEmail(this.state.email)
if (R.isEmpty(this.state.fullname)) { if (R.isEmpty(this.state.fullname)) {
this.setState({ errorFullname: true, msgErrorFN: 'Fullname is required' }) this.setState({ errorFullname: true, msgErrorFN: 'Fullname Cannot be Empty' })
} else if (R.isEmpty(this.state.email)) { } else if (R.isEmpty(this.state.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email is required' }) this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgErrorEM: 'Email format not recognized!' }) this.setState({ errorEmail: true, msgErrorEM: 'Email format not recognized!' })
} else if (R.isNil(this.state.role)) { } else if (R.isNil(this.state.role)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name is required' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required' }) this.setState({ errorStartDate: true, msgErrorSD: 'Start date Cannot be Empty' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required' }) this.setState({ errorEndDate: true, msgErrorED: 'End date Cannot be Empty' })
} }
// else if (this.state.privileges.length < 1) { // else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!') // alert('Hak Akses belum di pilih !!')
......
...@@ -166,17 +166,17 @@ export default class EditUser extends Component { ...@@ -166,17 +166,17 @@ export default class EditUser extends Component {
// console.log(this.state.tempData) // console.log(this.state.tempData)
if (R.isEmpty(this.state.tempData.fullname)) { if (R.isEmpty(this.state.tempData.fullname)) {
this.setState({ errorFullname: true, msgErrorFN: 'Full Name is Required' }) this.setState({ errorFullname: true, msgErrorFN: 'Full Name Cannot be Empty' })
} else if (R.isEmpty(this.state.tempData.email)) { } else if (R.isEmpty(this.state.tempData.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email is Required' }) this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgErrorEM: 'Email format not recognized!' }) this.setState({ errorEmail: true, msgErrorEM: 'Email format not recognized!' })
} else if (R.isNil(this.state.role)) { } else if (R.isNil(this.state.role)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name is Required' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start Date is Required' }) this.setState({ errorStartDate: true, msgErrorSD: 'Start Date Cannot be Empty' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'End Date is Required' }) this.setState({ errorEndDate: true, msgErrorED: 'End Date Cannot be Empty' })
} }
// else if (this.state.privileges.length < 1) { // else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!') // alert('Hak Akses belum di pilih !!')
......
...@@ -110,11 +110,11 @@ export default class AddRole extends Component { ...@@ -110,11 +110,11 @@ export default class AddRole extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.roleName)) { if (R.isEmpty(this.state.roleName)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name is required' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required' }) this.setState({ errorStartDate: true, msgErrorSD: 'Start date Cannot be Empty' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required' }) this.setState({ errorEndDate: true, msgErrorED: 'End date Cannot be Empty' })
} else if (this.state.privileges.length < 1) { } else if (this.state.privileges.length < 1) {
this.setState({ alert: true, messageAlert: 'You must choose the Access Rights!!', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'You must choose the Access Rights!!', tipeAlert: 'warning' })
} else { } else {
......
...@@ -116,11 +116,11 @@ export default class EditRole extends Component { ...@@ -116,11 +116,11 @@ export default class EditRole extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.tempData.role_name)) { if (R.isEmpty(this.state.tempData.role_name)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name is required' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required' }) this.setState({ errorStartDate: true, msgErrorSD: 'Start date Cannot be Empty' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required' }) this.setState({ errorEndDate: true, msgErrorED: 'End date Cannot be Empty' })
} else if (this.state.privileges.length < 1) { } else if (this.state.privileges.length < 1) {
this.setState({ alert: true, messageAlert: 'You must choose the Access Rights', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'You must choose the Access Rights', tipeAlert: 'warning' })
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment