Commit 75f870df authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

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

parents 14142c03 64ef8ee2
...@@ -41,7 +41,7 @@ class ForgotPassword extends Component { ...@@ -41,7 +41,7 @@ class ForgotPassword extends Component {
if (this.state.email.trim() == "") { if (this.state.email.trim() == "") {
this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' }) this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgEmail: 'Email format is not correct.' }) this.setState({ errorEmail: true, msgEmail: 'Email Format is Not Correct.' })
} else { } else {
this.verification() this.verification()
} }
......
...@@ -77,7 +77,7 @@ class Login extends Component { ...@@ -77,7 +77,7 @@ class Login extends Component {
if (this.state.email.trim() == "") { if (this.state.email.trim() == "") {
this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' }) this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgEmail: 'Email format is not correct.' }) this.setState({ errorEmail: true, msgEmail: 'Email Format is Not Correct.' })
} else if (this.state.password.trim() == "") { } else if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'Password Cannot be Empty.' }) this.setState({ errorPassword: true, msgPassword: 'Password Cannot be Empty.' })
} else { } else {
......
...@@ -136,7 +136,7 @@ export default class CreateParameter extends Component { ...@@ -136,7 +136,7 @@ export default class CreateParameter extends Component {
options: perusahaanData, options: perusahaanData,
getOptionLabel: (option) => option.company_name, 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: index === -1 ? 'Company has been inactive' : "", errorPerusahaan: index === -1 ? true : false })
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
...@@ -698,14 +698,15 @@ export default class CreateParameter extends Component { ...@@ -698,14 +698,15 @@ export default class CreateParameter extends Component {
}} }}
name="order" name="order"
onChange={(e) => { onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,''); let coba = String(e.target.value).replace(/[^\d]/g, '');
this.setState({ this.setState({
tempData: { tempData: {
...this.state.tempData, ...this.state.tempData,
order: coba order: coba
} }
}) })
this.clearMessage()} this.clearMessage()
}
// this.handleChange(coba, 'value')} // this.handleChange(coba, 'value')}
} }
// error={this.state.errorOrder} // error={this.state.errorOrder}
...@@ -914,11 +915,12 @@ export default class CreateParameter extends Component { ...@@ -914,11 +915,12 @@ export default class CreateParameter extends Component {
}} }}
name="value" name="value"
onChange={(e) => { onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,''); let coba = String(e.target.value).replace(/[^\d]/g, '');
this.setState({ this.setState({
value: coba value: coba
}) })
this.clearMessage()} this.clearMessage()
}
// this.handleChange(coba, 'value')} // this.handleChange(coba, 'value')}
} }
// error={this.state.errorValue} // error={this.state.errorValue}
...@@ -946,11 +948,12 @@ export default class CreateParameter extends Component { ...@@ -946,11 +948,12 @@ export default class CreateParameter extends Component {
}} }}
name="minValue" name="minValue"
onChange={(e) => { onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,''); let coba = String(e.target.value).replace(/[^\d]/g, '');
this.setState({ this.setState({
minValue: coba minValue: coba
}) })
this.clearMessage()} this.clearMessage()
}
// this.handleChange(coba, 'value')} // this.handleChange(coba, 'value')}
} }
error={this.state.errorMinValue} error={this.state.errorMinValue}
...@@ -1071,11 +1074,12 @@ export default class CreateParameter extends Component { ...@@ -1071,11 +1074,12 @@ export default class CreateParameter extends Component {
}} }}
name="order" name="order"
onChange={(e) => { onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,''); let coba = String(e.target.value).replace(/[^\d]/g, '');
this.setState({ this.setState({
order: coba order: coba
}) })
this.clearMessage()} this.clearMessage()
}
// this.handleChange(coba, 'value')} // this.handleChange(coba, 'value')}
} }
// error={this.state.errorOrder} // error={this.state.errorOrder}
...@@ -1103,11 +1107,12 @@ export default class CreateParameter extends Component { ...@@ -1103,11 +1107,12 @@ export default class CreateParameter extends Component {
}} }}
name="maxValue" name="maxValue"
onChange={(e) => { onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,''); let coba = String(e.target.value).replace(/[^\d]/g, '');
this.setState({ this.setState({
maxValue: coba maxValue: coba
}) })
this.clearMessage()} this.clearMessage()
}
// this.handleChange(coba, 'value')} // this.handleChange(coba, 'value')}
} }
error={this.state.errorMaxValue} error={this.state.errorMaxValue}
......
...@@ -214,13 +214,13 @@ export default class CreatePerusahaan extends Component { ...@@ -214,13 +214,13 @@ export default class CreatePerusahaan extends Component {
validasiEdit() { validasiEdit() {
if (R.isEmpty(this.state.company)) { 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)) { } 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)) { } 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)) { } 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 { } else {
let payload = { let payload = {
"company_id": this.state.companyID, "company_id": this.state.companyID,
...@@ -236,13 +236,13 @@ export default class CreatePerusahaan extends Component { ...@@ -236,13 +236,13 @@ export default class CreatePerusahaan extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.company)) { 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)) { } 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)) { } 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)) { } 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 { else {
let payload = { let payload = {
......
...@@ -65,7 +65,7 @@ export default class Perusahaan extends Component { ...@@ -65,7 +65,7 @@ export default class Perusahaan extends Component {
payload.push({ payload.push({
"id": index + 1, "id": index + 1,
"company_name": item[0], "company_name": item[0],
"company_parent": item[1], "company_parent": item[1] === undefined ? null : item[1],
"unit_bisnis": item[2], "unit_bisnis": item[2],
"startDate": item[3], "startDate": item[3],
"endDate": item[4], "endDate": item[4],
......
...@@ -147,32 +147,32 @@ export default class CreateReportItems extends Component { ...@@ -147,32 +147,32 @@ export default class CreateReportItems extends Component {
validasi() { validasi() {
// alert('coba ya') // alert('coba ya')
if (R.isNil(this.state.reportType)) { if (R.isNil(this.state.reportType)) {
this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type cannot be empty.'}) this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report Type Cannot be Empty.'})
} else if (R.isNil(this.state.company)){ } else if (R.isNil(this.state.company)){
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company name cannot be empty.'}) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Name Cannot be Empty.'})
} else if (R.isEmpty(this.state.order)) { } else if (R.isEmpty(this.state.order)) {
this.setState({ errorOrder: true, msgErrorOrder: 'Order cannot be empty.' }) this.setState({ errorOrder: true, msgErrorOrder: 'Order Cannot be Empty.' })
} }
else if (R.isEmpty(this.state.description)) { else if (R.isEmpty(this.state.description)) {
this.setState({ errorDesc: true, msgErrorDesc: 'Description cannot be empty.' }) this.setState({ errorDesc: true, msgErrorDesc: 'Description Cannot be Empty.' })
} }
else if (R.isNil(this.state.InputType)) { else if (R.isNil(this.state.InputType)) {
this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type cannot be empty.' }) this.setState({ errorTipeData: true, msgErrorTipeData: 'Data Type Cannot be Empty.' })
} }
else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) { else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) {
this.setState({ errorFormula: true, msgErrorFormula: 'Formula cannot be empty.' }) this.setState({ errorFormula: true, msgErrorFormula: 'Formula Cannot be Empty.' })
} }
else if (this.state.disabledValue === false && R.isEmpty(this.state.realVal)) { else if (this.state.disabledValue === false && R.isEmpty(this.state.realVal)) {
this.setState({ errorRV: true, msgErrorRV: 'True value cannot be empty.' }) this.setState({ errorRV: true, msgErrorRV: 'True Value Cannot be Empty.' })
} }
else if (this.state.disabledCondt === false && R.isEmpty(this.state.condition)) { else if (this.state.disabledCondt === false && R.isEmpty(this.state.condition)) {
this.setState({ errorCondition: true, msgErrorCondition: 'False condition cannot be empty.' }) this.setState({ errorCondition: true, msgErrorCondition: 'False Condition Cannot be Empty.' })
} }
else if (R.isNil(this.state.startDate)) { 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)) { 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 { else {
this.addReportItems() this.addReportItems()
......
...@@ -128,25 +128,25 @@ export default class EditReportItems extends Component { ...@@ -128,25 +128,25 @@ export default class EditReportItems extends Component {
validasi() { validasi() {
// alert('coba ya') // alert('coba ya')
if (R.isNil(this.state.reportType)){ if (R.isNil(this.state.reportType)){
this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type cannot be empty.'}) this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report Type Cannot be Empty.'})
} else if (R.isNil(this.state.company)){ } else if (R.isNil(this.state.company)){
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company name cannot be empty.'}) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Name Cannot be Empty.'})
} else if (R.isEmpty(this.state.tempData.order)) { } else if (R.isEmpty(this.state.tempData.order)) {
this.setState({ errorOrder: true, msgErrorOrder: 'Order cannot be empty.' }) this.setState({ errorOrder: true, msgErrorOrder: 'Order Cannot be Empty.' })
} else if (R.isEmpty(this.state.tempData.description)) { } else if (R.isEmpty(this.state.tempData.description)) {
this.setState({ errorDesc: true, msgErrorDesc: 'Description cannot be empty.' }) this.setState({ errorDesc: true, msgErrorDesc: 'Description Cannot be Empty.' })
} else if (R.isNil(this.state.InputType)) { } else if (R.isNil(this.state.InputType)) {
this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type cannot be empty.' }) this.setState({ errorTipeData: true, msgErrorTipeData: 'Data Type Cannot be Empty.' })
} else if ((this.state.InputType.type_item_report_name === 'Formula' && R.isEmpty(this.state.tempData.formula)) || (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula))) { } else if ((this.state.InputType.type_item_report_name === 'Formula' && R.isEmpty(this.state.tempData.formula)) || (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula))) {
this.setState({ errorFormula: true, msgErrorFormula: 'Formula cannot be empty.' }) this.setState({ errorFormula: true, msgErrorFormula: 'Formula Cannot be Empty.' })
} else if (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.condition_it_should_be)) { } else if (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.condition_it_should_be)) {
this.setState({ errorRV: true, msgErrorRV: 'True value cannot be empty.' }) this.setState({ errorRV: true, msgErrorRV: 'True Value Cannot be Empty.' })
} else if (this.state.InputType.type_item_report_name === 'Validation' && R.isNil(this.state.tempData.condition_if_wrong)) { } else if (this.state.InputType.type_item_report_name === 'Validation' && R.isNil(this.state.tempData.condition_if_wrong)) {
this.setState({ errorCondition: true, msgErrorCondition: 'False condition cannot be empty.' }) this.setState({ errorCondition: true, msgErrorCondition: 'False Condition 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: 'Valid From cannot be empty.' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From 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: 'Valid To cannot be empty.' }) this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty.' })
} else { } else {
this.updateReportItems() this.updateReportItems()
} }
...@@ -246,7 +246,7 @@ export default class EditReportItems extends Component { ...@@ -246,7 +246,7 @@ export default class EditReportItems extends Component {
getOptionLabel: (option) => option.company_name, getOptionLabel: (option) => option.company_name,
}; };
// let index = companyData.findIndex((val) => val.company_id === this.state.tempData.company_id) // let index = companyData.findIndex((val) => val.company_id === this.state.tempData.company_id)
this.setState({ listCompany: defaultProps, companyData: response.data.data, company: index === -1 ? null : companyData[index] }, () => this.getParent()) this.setState({ listCompany: defaultProps, companyData: response.data.data, company: index === -1 ? null : companyData[index], msgErrorPerusahaan: index === -1 ? 'Company has been Inactive.' : "", errorPerusahaan: index === -1 ? true : false }, () => this.getParent())
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
......
...@@ -112,7 +112,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -112,7 +112,7 @@ export default class CreateUnitBisnis extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.name)) { 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)) { } else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
} else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) { } else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) {
...@@ -130,7 +130,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -130,7 +130,7 @@ export default class CreateUnitBisnis extends Component {
validasiCreate() { validasiCreate() {
if (R.isEmpty(this.state.name)) { 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)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
......
...@@ -171,7 +171,7 @@ export default class UserRole extends Component { ...@@ -171,7 +171,7 @@ export default class UserRole extends Component {
name: "Email", name: "Email",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
console.log(tableMeta) // console.log(tableMeta)
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('email')) check = tableMeta.rowData[6].findIndex((val) => val.field.includes('email'))
...@@ -324,6 +324,7 @@ export default class UserRole extends Component { ...@@ -324,6 +324,7 @@ export default class UserRole extends Component {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.getUser()
this.closeEdit() this.closeEdit()
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
......
...@@ -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 Cannot be Empty' }) 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 Cannot be Empty' }) 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 Cannot be Empty' }) 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: 'Valid From Cannot be Empty' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) { } 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) { // else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!') // alert('Hak Akses belum di pilih !!')
...@@ -724,7 +724,7 @@ export default class AddUser extends Component { ...@@ -724,7 +724,7 @@ export default class AddUser extends Component {
{/* <ul> {/* <ul>
<li> */} <li> */}
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}> <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'} />} {item.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>} </span>}
<span> <span>
......
...@@ -138,11 +138,11 @@ export default class EditUser extends Component { ...@@ -138,11 +138,11 @@ export default class EditUser extends Component {
getDetailUser() { getDetailUser() {
api.create().getDetailUser(this.state.paramsId).then((response) => { api.create().getDetailUser(this.state.paramsId).then((response) => {
this.getRole()
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { 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) console.log(response.data.data)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
...@@ -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 Cannot be Empty' }) 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 Cannot be Empty' }) 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 Cannot be Empty' }) 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: 'Valid From Cannot be Empty' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From 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: 'Valid To Cannot be Empty' }) this.setState({ errorEndDate: true, msgErrorED: 'Valid To 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 !!')
...@@ -199,7 +199,7 @@ export default class EditUser extends Component { ...@@ -199,7 +199,7 @@ export default class EditUser extends Component {
this.props.updateUser(payload) this.props.updateUser(payload)
} }
getRole() { getRole(id) {
api.create().getRoleActive().then((response) => { api.create().getRoleActive().then((response) => {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
...@@ -216,8 +216,9 @@ export default class EditUser extends Component { ...@@ -216,8 +216,9 @@ export default class EditUser extends Component {
getOptionLabel: (option) => titleCase(option.role_name), getOptionLabel: (option) => titleCase(option.role_name),
}; };
let index = roleData.findIndex((val) => val.role_id === this.state.tempData.role_id) let index = roleData.findIndex((val) => val.role_id === id)
this.setState({ listRole: defaultProps, role: index === -1 ? roleData[0] : roleData[index] }) 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 { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
......
...@@ -151,7 +151,7 @@ class UserRole extends Component { ...@@ -151,7 +151,7 @@ class UserRole extends Component {
name: "Action", name: "Action",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
console.log(tableMeta); // console.log(tableMeta);
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.buttonEdit && ( {this.state.buttonEdit && (
......
...@@ -110,13 +110,13 @@ export default class AddRole extends Component { ...@@ -110,13 +110,13 @@ 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 Cannot be Empty' }) 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: 'Valid From Cannot be Empty' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) { } 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) { } 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 {
this.addRole() this.addRole()
} }
......
...@@ -116,13 +116,13 @@ export default class EditRole extends Component { ...@@ -116,13 +116,13 @@ 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 Cannot be Empty' }) 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: 'Valid From Cannot be Empty' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From 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: 'Valid To Cannot be Empty' }) this.setState({ errorEndDate: true, msgErrorED: 'Valid To 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 {
this.updateRole() this.updateRole()
} }
......
...@@ -36,9 +36,9 @@ export default class Profile extends Component { ...@@ -36,9 +36,9 @@ export default class Profile extends Component {
errorOldPassword: false, errorOldPassword: false,
errorPassword: false, errorPassword: false,
errorConfirmPassword: false, errorConfirmPassword: false,
msgOldPassword: 'Consists of 8 characters with a combination of numbers.', msgOldPassword: 'Consists of 8 Characters with a Combination of Numbers.',
msgPassword: 'Consists of 8 characters with a combination of numbers.', msgPassword: 'Consists of 8 Characters with a Combination of Numbers.',
msgConfirmPassword: 'Consists of 8 characters with a combination of numbers.', msgConfirmPassword: 'Consists of 8 Characters with a Combination of Numbers.',
company: [], company: [],
listCompany: [], listCompany: [],
selectedIndex: 0, selectedIndex: 0,
...@@ -68,41 +68,35 @@ export default class Profile extends Component { ...@@ -68,41 +68,35 @@ export default class Profile extends Component {
this.setState({ ...data, [e.target.name]: e.target.value }) this.setState({ ...data, [e.target.name]: e.target.value })
console.log(e.target.name); console.log(e.target.name);
if (e.target.name == "password") { if (e.target.name == "password") {
this.setState({ errorPassword: false, msgPassword: 'Consists of 8 characters with a combination of numbers.' }) this.setState({ errorPassword: false, msgPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} else if (e.target.name == "confirmPassword") { } else if (e.target.name == "confirmPassword") {
this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Consists of 8 characters with a combination of numbers.' }) this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} else if (e.target.name == "oldPassword") { } else if (e.target.name == "oldPassword") {
this.setState({ errorOldPassword: false, msgOldPassword: 'Consists of 8 characters with a combination of numbers.' }) this.setState({ errorOldPassword: false, msgOldPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} }
} }
validasi() { validasi() {
if (this.state.oldPassword == "") { if (this.state.oldPassword == "") {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password Cannot be Empty.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Cannot be Empty.' })
} else if (this.state.oldPassword.length < 8) { } else if (this.state.oldPassword.length < 8) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password minimum 8 characters.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Minimum 8 Characters.' })
} else if (this.isEmail(this.state.oldPassword)) { } else if (this.isEmail(this.state.oldPassword)) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password format should not use email.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Format Should Not Use Email.' })
} else if (!this.isRegex(this.state.oldPassword)) { } else if (!this.isRegex(this.state.oldPassword)) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password must be a combination of characters, letters and numbers.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Must be a Combination of Characters, Letters and Numbers.' })
} else if (this.state.password.trim() == "") { } else if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'Password Cannot be Empty.' }) this.setState({ errorPassword: true, msgPassword: 'Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'Password minimum 8 characters.' }) this.setState({ errorPassword: true, msgPassword: 'Password Minimum 8 Characters.' })
} else if (this.isEmail(this.state.password)) { } else if (this.isEmail(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password format should not use email.' }) this.setState({ errorPassword: true, msgPassword: 'Password Format Should Not Use Email.' })
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password must be a combination of characters, letters and numbers.' }) this.setState({ errorPassword: true, msgPassword: 'Password Must be a Combination of Characters, Letters and Numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation Cannot be Empty.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' })
} else if (this.state.confirmPassword.length < 8) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation of at least 8 characters.' })
} else if (this.isEmail(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation format should not use email.' })
} else if (!this.isRegex(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation must be a combination of characters, letters and numbers.' })
} else if (this.state.password !== this.state.confirmPassword) { } else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirmation password must match the password.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' })
} else { } else {
this.confirmPassword() this.confirmPassword()
} }
......
...@@ -20,8 +20,8 @@ class ResetPassword extends Component { ...@@ -20,8 +20,8 @@ class ResetPassword extends Component {
showPass2: false, showPass2: false,
errorPassword: false, errorPassword: false,
errorConfirmPassword: false, errorConfirmPassword: false,
msgPassword: 'Consists of 8 characters with a combination of numbers.', msgPassword: 'Consists of 8 Characters with a Combination of Numbers.',
msgConfirmPassword: 'Consists of 8 characters with a combination of numbers.', msgConfirmPassword: 'Consists of 8 Characters with a Combination of Numbers.',
userId: 0, userId: 0,
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
...@@ -70,19 +70,13 @@ class ResetPassword extends Component { ...@@ -70,19 +70,13 @@ class ResetPassword extends Component {
if (this.state.password.trim() == "") { if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'New Password minimum 8 characters.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Minimum 8 Characters.' })
} else if (this.isEmail(this.state.password)) { } else if (this.isEmail(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'New Password format should not use email.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Format Should Not Use Email.' })
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'New Password must be a combination of characters, letters and numbers.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Must be a Combination of Characters, Letters and Numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' })
} else if (this.state.confirmPassword.length < 8) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation minimum 8 characters.' })
} else if (this.isEmail(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation format should not use email.' })
} else if (!this.isRegex(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation must be a combination of characters, letters and numbers.' })
} else if (this.state.password !== this.state.confirmPassword) { } else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' })
} else { } else {
...@@ -125,9 +119,9 @@ class ResetPassword extends Component { ...@@ -125,9 +119,9 @@ class ResetPassword extends Component {
let data = this.state let data = this.state
this.setState({ ...data, [e.target.name]: e.target.value }) this.setState({ ...data, [e.target.name]: e.target.value })
if (e.target.name == "password") { if (e.target.name == "password") {
this.setState({ errorPassword: false, msgPassword: 'Password consists of 8 characters with a combination of numbers.' }) this.setState({ errorPassword: false, msgPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} else if (e.target.name == "confirmPassword") { } else if (e.target.name == "confirmPassword") {
this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Password Confirmation consists of 8 characters with a combination of numbers.' }) this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} }
} }
......
...@@ -20,8 +20,8 @@ class SetPassword extends Component { ...@@ -20,8 +20,8 @@ class SetPassword extends Component {
showPass2: false, showPass2: false,
errorPassword: false, errorPassword: false,
errorConfirmPassword: false, errorConfirmPassword: false,
msgPassword: 'Consists of 8 characters with a combination of numbers.', msgPassword: 'Consists of 8 Characters with a Combination of Numbers.',
msgConfirmPassword: 'Consists of 8 characters with a combination of numbers.', msgConfirmPassword: 'Consists of 8 Characters with a Combination of Numbers.',
userId: 0, userId: 0,
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
...@@ -70,19 +70,13 @@ class SetPassword extends Component { ...@@ -70,19 +70,13 @@ class SetPassword extends Component {
if (this.state.password.trim() == "") { if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'New Password minimum 8 characters.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Minimum 8 Characters.' })
} else if (this.isEmail(this.state.password)) { } else if (this.isEmail(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'New Password format should not use email.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Format Should Not Use Email.' })
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'New Password must be a combination of characters, letters and numbers.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Must be a Combination of Characters, Letters and Numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' })
} else if (this.state.confirmPassword.length < 8) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation minimum 8 characters.' })
} else if (this.isEmail(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation format should not use email.' })
} else if (!this.isRegex(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation must be a combination of characters, letters and numbers.' })
} else if (this.state.password !== this.state.confirmPassword) { } else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' })
} else { } else {
...@@ -125,9 +119,9 @@ class SetPassword extends Component { ...@@ -125,9 +119,9 @@ class SetPassword extends Component {
let data = this.state let data = this.state
this.setState({ ...data, [e.target.name]: e.target.value }) this.setState({ ...data, [e.target.name]: e.target.value })
if (e.target.name == "password") { if (e.target.name == "password") {
this.setState({ errorPassword: false, msgPassword: 'Password consists of 8 characters with a combination of numbers.' }) this.setState({ errorPassword: false, msgPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} else if (e.target.name == "confirmPassword") { } else if (e.target.name == "confirmPassword") {
this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Password Confirmation consists of 8 characters with a combination of numbers.' }) this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} }
} }
......
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