Commit 66044314 authored by faisalhamdi's avatar faisalhamdi

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

parents f406b3cb 06654911
...@@ -39,6 +39,9 @@ export default class ApprovalMatrix extends Component { ...@@ -39,6 +39,9 @@ export default class ApprovalMatrix extends Component {
rows: null, rows: null,
dataLoaded: false, dataLoaded: false,
popupError: false, popupError: false,
alert: false,
tipeAlert: '',
messageAlert: '',
btncreate: false, btncreate: false,
btnedit: false, btnedit: false,
load: false, load: false,
...@@ -75,10 +78,11 @@ export default class ApprovalMatrix extends Component { ...@@ -75,10 +78,11 @@ export default class ApprovalMatrix extends Component {
this.setState({ payload: body, buttonError: false }) this.setState({ payload: body, buttonError: false })
api.create().checkUploadAM(body).then(response => { api.create().checkUploadAM(body).then(response => {
// console.log(response.data) // console.log(response.data)
let dataRow = []
if(response.data){ if(response.data){
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataRow = response.data.data.map((item, index) => { dataRow = response.data.data.map((item, index) => {
return [ return [
index + 1, index + 1,
item.approval_type_name, item.approval_type_name,
...@@ -91,7 +95,7 @@ export default class ApprovalMatrix extends Component { ...@@ -91,7 +95,7 @@ export default class ApprovalMatrix extends Component {
] ]
}) })
let columns = [ let columns = [
"ID", "Data",
{ {
name: "Approval Type", name: "Approval Type",
options: { options: {
...@@ -257,7 +261,7 @@ export default class ApprovalMatrix extends Component { ...@@ -257,7 +261,7 @@ export default class ApprovalMatrix extends Component {
rows: dataRow rows: dataRow
}); });
} else { } else {
this.setState({ dataLoaded: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Token")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -267,7 +271,7 @@ export default class ApprovalMatrix extends Component { ...@@ -267,7 +271,7 @@ export default class ApprovalMatrix extends Component {
}) })
} }
} else { } else {
this.setState({ dataLoaded: false, alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ this.setState({
...@@ -303,6 +307,8 @@ export default class ApprovalMatrix extends Component { ...@@ -303,6 +307,8 @@ export default class ApprovalMatrix extends Component {
load: true load: true
}) })
} }
} else {
this.setState({ load: true })
} }
}) })
} }
...@@ -820,7 +826,7 @@ export default class ApprovalMatrix extends Component { ...@@ -820,7 +826,7 @@ export default class ApprovalMatrix extends Component {
{this.state.visibleUpload && ( {this.state.visibleUpload && (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x" style={{ backgroundColor: '#51c6ea', height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 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="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title"> <div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span> <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
......
...@@ -215,7 +215,6 @@ export default class CreateApprovalMatrix extends Component { ...@@ -215,7 +215,6 @@ export default class CreateApprovalMatrix extends Component {
this.setState({ errorOrder: true, msgErrOrder: 'Order Cannot be Empty.'}) this.setState({ errorOrder: true, msgErrOrder: 'Order Cannot be Empty.'})
} }
else if (R.isNil(this.state.userId)) { else if (R.isNil(this.state.userId)) {
// return alert("Pemberi Persetujuan tidak boleh kosong");
this.setState({ errorApproved: true, msgErrApproved: 'Approver Name Cannot be Empty.' }) this.setState({ errorApproved: true, msgErrApproved: 'Approver Name Cannot be Empty.' })
} }
else if (R.isNil(this.state.operatorId)) { else if (R.isNil(this.state.operatorId)) {
......
This diff is collapsed.
...@@ -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: 'Please enter a valid email address.' })
} 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: 'Please enter a valid email address.' })
} 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 {
......
...@@ -43,7 +43,8 @@ export default class UnitBisnis extends Component { ...@@ -43,7 +43,8 @@ export default class UnitBisnis extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
load: false load: false,
judul: ''
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -56,8 +57,6 @@ export default class UnitBisnis extends Component { ...@@ -56,8 +57,6 @@ export default class UnitBisnis extends Component {
console.log(err); console.log(err);
} }
else { else {
let judul = resp.rows[2]
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
...@@ -73,7 +72,8 @@ export default class UnitBisnis extends Component { ...@@ -73,7 +72,8 @@ export default class UnitBisnis extends Component {
let body = { let body = {
business_unit: payload business_unit: payload
} }
this.setState({ payload: body, buttonError: false }) console.log(resp.rows[1])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
api.create().checkUploadUnitBisnis(body).then(response => { api.create().checkUploadUnitBisnis(body).then(response => {
console.log(response) console.log(response)
let dataRow = [] let dataRow = []
...@@ -174,7 +174,7 @@ export default class UnitBisnis extends Component { ...@@ -174,7 +174,7 @@ export default class UnitBisnis extends Component {
} }
] ]
console.log(dataRow); // console.log(dataRow);
this.setState({ this.setState({
dataLoaded: true, dataLoaded: true,
cols: columns, cols: columns,
...@@ -623,7 +623,8 @@ export default class UnitBisnis extends Component { ...@@ -623,7 +623,8 @@ export default class UnitBisnis extends Component {
</button> </button>
<button <button
type="button" type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadUnitBisnis()} disabled={this.state.buttonError == true ? true : false}
onClick={() => this.uploadUnitBisnis()}
style={{}} style={{}}
> >
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
...@@ -682,7 +683,11 @@ export default class UnitBisnis extends Component { ...@@ -682,7 +683,11 @@ export default class UnitBisnis extends Component {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => this.setState({ visibleUpload: false, visibleUnitBisnis: false })} onUpload={() => {
this.state.judul === "MASTER DATA - BUSINESS UNIT" ?
this.setState({ visibleUpload: false, visibleUnitBisnis: false }) :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning'})
}}
/> />
</div> </div>
</div> </div>
......
This diff is collapsed.
This diff is collapsed.
...@@ -178,9 +178,9 @@ export default class EditUser extends Component { ...@@ -178,9 +178,9 @@ export default class EditUser extends Component {
} 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: 'Please enter a valid email address.' })
} 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 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)) {
......
...@@ -70,15 +70,15 @@ class ResetPassword extends Component { ...@@ -70,15 +70,15 @@ 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: 'Invalid password. Minimum length : 8.' })
} 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: 'Invalid password. Should not be same as Email Address.' })
} 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: 'Invalid password. Must using 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.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: 'The password and password confirmation do not match.' })
} else { } else {
this.confirmPassword() this.confirmPassword()
} }
......
...@@ -70,15 +70,15 @@ class SetPassword extends Component { ...@@ -70,15 +70,15 @@ 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: 'Invalid password. Minimum length : 8.' })
} 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: 'Invalid password. Should not be same as Email Address.' })
} 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: 'Invalid password. Must using 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.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: 'The password and password confirmation do not match.' })
} else { } else {
this.confirmPassword() this.confirmPassword()
} }
......
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