Commit bb161db2 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

Deni dev(pc)

See merge request !207
parents 09451156 eea62381
......@@ -136,7 +136,7 @@ export default class CreateParameter extends Component {
options: perusahaanData,
getOptionLabel: (option) => option.company_name,
};
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? perusahaanData[0] : perusahaanData[index] })
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPerusahaan: 'Company has been inactive', errorPerusahaan: true })
} else {
alert(response.data.message)
}
......
......@@ -214,13 +214,13 @@ export default class CreatePerusahaan extends Component {
validasiEdit() {
if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty' })
this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty.' })
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty' })
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Valid From Cannot be Empty' })
this.setState({ errorSD: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorED: true, msgErrorED: 'Valid To Cannot be Empty' })
this.setState({ errorED: true, msgErrorED: 'Valid To Cannot be Empty.' })
} else {
let payload = {
"company_id": this.state.companyID,
......@@ -236,13 +236,13 @@ export default class CreatePerusahaan extends Component {
validasi() {
if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty' })
this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty.' })
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty' })
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Valid From Cannot be Empty' })
this.setState({ errorSD: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorED: true, msgErrorED: 'Valid To Cannot be Empty' })
this.setState({ errorED: true, msgErrorED: 'Valid To Cannot be Empty.' })
}
else {
let payload = {
......
......@@ -65,7 +65,7 @@ export default class Perusahaan extends Component {
payload.push({
"id": index + 1,
"company_name": item[0],
"company_parent": item[1],
"company_parent": item[1] === undefined ? null : item[1],
"unit_bisnis": item[2],
"startDate": item[3],
"endDate": item[4],
......
......@@ -112,7 +112,7 @@ export default class CreateUnitBisnis extends Component {
validasi() {
if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Business unit Cannot be Empty.' })
this.setState({ errorName: true, msgErrorName: 'Business Unit Cannot be Empty.' })
} else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
} else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) {
......@@ -130,7 +130,7 @@ export default class CreateUnitBisnis extends Component {
validasiCreate() {
if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Business unit Cannot be Empty.' })
this.setState({ errorName: true, msgErrorName: 'Business Unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) {
......
......@@ -171,7 +171,7 @@ export default class UserRole extends Component {
name: "Email",
options: {
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
// console.log(tableMeta)
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('email'))
......
......@@ -158,17 +158,17 @@ export default class AddUser extends Component {
var isEmail = this.isEmail(this.state.email)
if (R.isEmpty(this.state.fullname)) {
this.setState({ errorFullname: true, msgErrorFN: 'Fullname Cannot be Empty' })
this.setState({ errorFullname: true, msgErrorFN: 'Fullname Cannot be Empty.' })
} else if (R.isEmpty(this.state.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty' })
this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty.' })
} 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)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty' })
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty' })
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty.' })
}
// else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!')
......@@ -724,7 +724,7 @@ export default class AddUser extends Component {
{/* <ul>
<li> */}
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
{item.children.length > 0 && <span onClick={() => this.handleCollapse(item)} style={{ marginLeft: 7, marginRight: 2 }}>
{item.children && item.children.length > 0 && <span onClick={() => this.handleCollapse(item)} style={{ marginLeft: 7, marginRight: 2 }}>
{item.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>}
<span>
......
......@@ -138,11 +138,11 @@ export default class EditUser extends Component {
getDetailUser() {
api.create().getDetailUser(this.state.paramsId).then((response) => {
this.getRole()
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ tempData: response.data.data, company: response.data.data.company })
this.setState({ tempData: response.data.data, company: response.data.data.company }, ()=>
this.getRole(response.data.data.role_id))
console.log(response.data.data)
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
......@@ -166,17 +166,17 @@ export default class EditUser extends Component {
// console.log(this.state.tempData)
if (R.isEmpty(this.state.tempData.fullname)) {
this.setState({ errorFullname: true, msgErrorFN: 'Full Name Cannot be Empty' })
this.setState({ errorFullname: true, msgErrorFN: 'Full Name Cannot be Empty.' })
} else if (R.isEmpty(this.state.tempData.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty' })
this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty.' })
} 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)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty' })
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty' })
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty' })
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty.' })
}
// else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!')
......@@ -199,7 +199,7 @@ export default class EditUser extends Component {
this.props.updateUser(payload)
}
getRole() {
getRole(id) {
api.create().getRoleActive().then((response) => {
if (response.data) {
if (response.ok) {
......@@ -216,8 +216,9 @@ export default class EditUser extends Component {
getOptionLabel: (option) => titleCase(option.role_name),
};
let index = roleData.findIndex((val) => val.role_id === this.state.tempData.role_id)
this.setState({ listRole: defaultProps, role: index === -1 ? roleData[0] : roleData[index] })
let index = roleData.findIndex((val) => val.role_id === id)
console.log(index)
this.setState({ listRole: defaultProps, role: index === -1 ? null : roleData[index], msgErrorRN: index === -1 ? 'Role has been inactive' : '', errorRoleName: index === -1 ? true : false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
......
......@@ -151,7 +151,7 @@ class UserRole extends Component {
name: "Action",
options: {
customBodyRender: (val, tableMeta) => {
console.log(tableMeta);
// console.log(tableMeta);
return (
<div style={{ display: 'flex' }}>
{this.state.buttonEdit && (
......
......@@ -110,13 +110,13 @@ export default class AddRole extends Component {
validasi() {
if (R.isEmpty(this.state.roleName)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty' })
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty' })
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty.' })
} 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 {
this.addRole()
}
......
......@@ -116,13 +116,13 @@ export default class EditRole extends Component {
validasi() {
if (R.isEmpty(this.state.tempData.role_name)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty' })
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty' })
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty.' })
} 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 {
this.updateRole()
}
......
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