Commit 431f19be authored by fahrur huzain's avatar fahrur huzain

Merge branch 'ENV-DEV' of http://103.44.149.204/d.arizona/tia-dev into dev/fahrur-new

parents d50c5731 5fa5c244
// contents of .env
REACT_APP_URL_MAIN_BE=https://tia.eksad.com/tia-reporting-staging
REACT_APP_URL_MAIN_FE=/web
\ No newline at end of file
REACT_APP_URL_MAIN_FE=/web-staging
\ No newline at end of file
{
"name": "my-app",
"version": "0.1.0",
"homepage": "http://localhost:8080/web/",
"homepage": "http://localhost:8080/web/",
"private": true,
"dependencies": {
"@date-io/date-fns": "^1.3.13",
......
......@@ -2,6 +2,11 @@
background-color: #273b80 !important;
}
/* for staging */
/* .main-color{
background-color: #0b6b24 !important;
} */
/* .main-color{
background-color: #1474CA !important;
} */
......@@ -60,14 +60,27 @@ export default class AddUser extends Component {
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
alert: false,
tipeAlert: '',
messageAlert: ''
messageAlert: '',
notification: null,
listNotification: [
{
"id": 0,
"value": "No"
},
{
"id": 1,
"value": "Yes"
}
],
}
}
......@@ -101,11 +114,13 @@ export default class AddUser extends Component {
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
})
} else if (isDate && type === 'end_date') {
this.setState({
......@@ -115,11 +130,13 @@ export default class AddUser extends Component {
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
})
} else {
this.setState({
......@@ -129,11 +146,13 @@ export default class AddUser extends Component {
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
})
}
}
......@@ -148,7 +167,7 @@ export default class AddUser extends Component {
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
......@@ -161,22 +180,24 @@ export default class AddUser extends Component {
})
let uniqueCompany = company.filter((val, id, array) => {
return array.indexOf(val) == id;
return array.indexOf(val) == id;
});
company = this.state.role == null? [] : this.state.role.role_id === 1? uniqueCompany : []
company = this.state.role == null ? [] : this.state.role.role_id === 1 ? uniqueCompany : []
// console.log(uniqueCompany)
this.setState({
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
company
}, () => {
// console.log(this.state.company)
......@@ -205,6 +226,8 @@ export default class AddUser extends Component {
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty' })
} else if (this.state.company.length < 1) {
this.setState({ alert: true, messageAlert: 'Authorization company cannot be empty', tipeAlert: 'warning' })
} else if (R.isNil(this.state.notification)) {
this.setState({ errorNotification: true, msgErrorNotification: 'Email Notification Maintenance Cannot be Empty' })
}
// else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!')
......@@ -217,8 +240,10 @@ export default class AddUser extends Component {
"password": this.state.fullname,
"company": this.state.company,
"start_date": this.state.startDate,
"end_date": this.state.endDate
"end_date": this.state.endDate,
"mail_notif": this.state.notification.id
}
// console.log(payload);
this.props.createUser(payload)
}
}
......@@ -300,7 +325,7 @@ export default class AddUser extends Component {
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
......@@ -314,7 +339,7 @@ export default class AddUser extends Component {
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handleSpliceChild(items)
})
}
......@@ -325,7 +350,7 @@ export default class AddUser extends Component {
company.push(item.id)
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
......@@ -335,15 +360,15 @@ export default class AddUser extends Component {
company.splice(indexID, 1)
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handleSpliceChild(items)
})
}
}
}
// console.log(company)
this.setState({ company})
this.setState({ company })
}
renderChildren = (item, pad) => {
......@@ -679,6 +704,37 @@ export default class AddUser extends Component {
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-bottom-20px">
<Autocomplete
debug
id="tipe"
options={this.state.listNotification}
getOptionLabel={(option) => option.value}
onChange={(event, newInputValue) => this.setState({ notification: newInputValue }, () => this.clearError())}
renderInput={(params) =>
<TextField
{...params}
label="Email Notification Maintenance"
margin="normal"
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
error={this.state.errorNotification}
helperText={this.state.msgErrorNotification}
/>
}
/>
</div>
</div>
<div className="column-2">
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-bottom-20px">
......
......@@ -54,14 +54,27 @@ export default class EditUser extends Component {
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
alert: false,
tipeAlert: '',
messageAlert: ''
messageAlert: '',
notification: null,
listNotification: [
{
"id": 0,
"value": "No"
},
{
"id": 1,
"value": "Yes"
}
],
}
}
......@@ -85,11 +98,13 @@ export default class EditUser extends Component {
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
})
} else if (isDate && type === 'end_date') {
this.setState({
......@@ -99,11 +114,13 @@ export default class EditUser extends Component {
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
})
} else {
this.setState({
......@@ -113,11 +130,13 @@ export default class EditUser extends Component {
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
})
}
}
......@@ -132,7 +151,7 @@ export default class EditUser extends Component {
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
......@@ -145,34 +164,37 @@ export default class EditUser extends Component {
})
let uniqueCompany = company.filter((val, id, array) => {
return array.indexOf(val) == id;
return array.indexOf(val) == id;
});
company = this.state.role == null? [] : this.state.role.role_id === 1? uniqueCompany : []
company = this.state.role == null ? [] : this.state.role.role_id === 1 ? uniqueCompany : []
// console.log(uniqueCompany)
this.setState({
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
errorNotification: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorNotification: '',
company
})
}
getDetailUser() {
api.create().getDetailUser(this.state.paramsId).then((response) => {
// console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ tempData: response.data.data, company: response.data.data.company }, ()=>
this.getRole(response.data.data.role_id))
// console.log(response.data.data)
let index = this.state.listNotification.findIndex((val) => val.id === response.data.data.mail_notif)
this.setState({ tempData: response.data.data, company: response.data.data.company, notification: index === -1 ? null : this.state.listNotification[index] }, () =>
this.getRole(response.data.data.role_id))
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -215,6 +237,8 @@ export default class EditUser extends Component {
this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty' })
} else if (this.state.company.length < 1) {
this.setState({ alert: true, messageAlert: 'Authorization company cannot be empty', tipeAlert: 'warning' })
} else if (R.isNil(this.state.notification)) {
this.setState({ errorNotification: true, msgErrorNotification: 'Email Notification Maintenance Cannot be Empty' })
}
// else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!')
......@@ -224,7 +248,7 @@ export default class EditUser extends Component {
}
}
updateUser(){
updateUser() {
let payload = {
"user_id": this.state.tempData.user_id,
"role_id": this.state.role.role_id,
......@@ -232,7 +256,8 @@ export default class EditUser extends Component {
"fullname": this.state.tempData.fullname,
"company": this.state.company,
"start_date": this.state.tempData.start_date,
"end_date": this.state.tempData.end_date
"end_date": this.state.tempData.end_date,
"mail_notif": this.state.notification.id
}
this.props.updateUser(payload)
}
......@@ -281,8 +306,8 @@ export default class EditUser extends Component {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let dataBaru = response.data.data.map((item,index) => {
return {...item, check: false}
let dataBaru = response.data.data.map((item, index) => {
return { ...item, check: false }
})
this.setState({ listCompany: dataBaru })
} else {
......@@ -319,7 +344,7 @@ export default class EditUser extends Component {
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
......@@ -333,7 +358,7 @@ export default class EditUser extends Component {
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handleSpliceChild(items)
})
}
......@@ -344,7 +369,7 @@ export default class EditUser extends Component {
company.push(item.id)
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
......@@ -354,15 +379,15 @@ export default class EditUser extends Component {
company.splice(indexID, 1)
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handleSpliceChild(items)
})
}
}
}
// console.log(company)
this.setState({ company})
this.setState({ company })
}
renderChildren = (item, pad) => {
......@@ -380,7 +405,7 @@ export default class EditUser extends Component {
return (
// <li>
<Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}>
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: !R.isNil(data.children)? (data.children.length > 0? padding : padding + 30) : padding + 30}}>
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: !R.isNil(data.children) ? (data.children.length > 0 ? padding : padding + 30) : padding + 30 }}>
{R.isNil(data.children) ?
null
:
......@@ -472,7 +497,7 @@ export default class EditUser extends Component {
};
closeAlert() {
this.setState({ alert: false })
this.setState({ alert: false })
}
render() {
......@@ -600,14 +625,14 @@ export default class EditUser extends Component {
<Autocomplete
{...this.state.listRole}
id="role"
onChange={(event, newInputValue) => this.setState({ role: newInputValue }, ()=> this.clearError())}
onChange={(event, newInputValue) => this.setState({ role: newInputValue }, () => this.clearError())}
debug
renderInput={(params) => <TextField
{...params}
label="Role"
margin="normal"
style={{ marginTop: 7 }}
renderInput={(params) => <TextField
{...params}
label="Role"
margin="normal"
style={{ marginTop: 7 }}
onChange={(e) => this.handleChange(e, '')}
error={this.state.errorRoleName}
helperText={this.state.msgErrorRN}
......@@ -619,7 +644,7 @@ export default class EditUser extends Component {
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
/>}
value={this.state.role}
/>
</div>
......@@ -693,6 +718,38 @@ export default class EditUser extends Component {
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
debug
id="tipe"
options={this.state.listNotification}
getOptionLabel={(option) => option.value}
value={this.state.notification}
onChange={(event, newInputValue) => this.setState({ notification: newInputValue }, () => this.clearError())}
renderInput={(params) =>
<TextField
{...params}
label="Email Notification Maintenance"
margin="normal"
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
error={this.state.errorNotification}
helperText={this.state.msgErrorNotification}
/>
}
/>
</div>
</div>
<div className="column-2">
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-bottom-20px">
......
......@@ -219,7 +219,7 @@ export default class CorporateAnnualTarget extends Component {
item.level,
"",
item.description,
item.type_report_id == 1 ? (`${String(item.weight).includes('%') ? String(item.weight) : String((fixNumber(Number(item.weight) * 100)) + '% ')}`) : (String(Number(String(item.cat.weight).substr(0, String(item.cat.weight).length - 1))) + '%'),
item.type_report_id == 1 ? (`${String(item.weight).includes('%') ? String(item.weight) : String(fixNumber((Number(item.weight) * 100)) + '% ')}`) : (String(Number(String(item.cat.weight).substr(0, String(item.cat.weight).length - 1))) + '%'),
item.cat.uom,
item.kpi_type == "" ? null : { value: item.kpi_type },
item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
......
......@@ -89,6 +89,7 @@ class MaintenanceMode extends Component {
maintenanceStatus: 0,
mailStatusActive: 0,
mailStatusNonActive: 0,
visibleAlertSave: false
}
......@@ -203,6 +204,7 @@ class MaintenanceMode extends Component {
// ]
}
console.log(payload);
this.setState({ visibleAlertSave: true })
api.create().createMaintenanceMode(payload).then((response) => {
console.log(response)
this.setState({ loading: true })
......@@ -271,6 +273,7 @@ class MaintenanceMode extends Component {
// ]
}
console.log(payload);
this.setState({ visibleAlertSave: true })
api.create().updateMaintenanceMode(payload).then((response) => {
console.log(response)
this.setState({ loading: true })
......@@ -846,6 +849,43 @@ class MaintenanceMode extends Component {
</Paper>
</div>
</div>
{this.state.visibleAlertSave && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 561, height: 233 }}>
<div style={{ margin: 25 }}>
<div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
<div style={{ alignSelf: 'center', marginRight: 25 }}>
<img src={Images.berhasil} />
</div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
Maintenance mode deactivated successfully!
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)
}
</div>
);
......
......@@ -350,6 +350,8 @@ export default class LOCF extends Component {
}
})
console.log(dataTable)
// let sortingTable = dataTable.sort((a, b) => a[6].value - b[6].value)
// console.log(sortingTable);
let lastArray = dataTable[res.length - 1]
this.setState({ dataTable, diff: lastArray[47], loanTotal: lastArray[48], perBS: lastArray[49], loading: false, visibleLOCFMR: true }, () => {
this.props.sendToParent(dataTable, lastArray, 'LOCF')
......@@ -1522,7 +1524,7 @@ export default class LOCF extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.get_for == 'view' ? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, height: 34, backgroundColor: (tableMeta.rowData[11] == '0.00' || tableMeta.rowData[11] == '') && this.props.get_for == 'edit' ? '#ffac99' : 'transparent' }}
style={{ color: this.props.get_for == 'view' ? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, height: 34, backgroundColor: (this.props.get_for == 'edit' && tableMeta.rowData[11] == 0.00) || (this.props.get_for == 'edit' && tableMeta.rowData[11] == '') ? '#ffac99' : 'transparent' }}
type="text"
placeholder=""
value={this.props.get_for == 'view' ? fixNumber(Number(value), 2) : this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 2) : Number(value) == 0 ? "0.00" : Number(value)}
......
......@@ -41,6 +41,16 @@ const LightTooltip = withStyles((theme) => ({
fontSize: 11,
},
}))(Tooltip);
const LightTooltipError = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(255, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
},
}))(Tooltip);
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
const options = ct.customOptionsFixedColumn();
......@@ -1234,42 +1244,6 @@ export default class LOV extends Component {
<textarea disabled={this.props.get_for == 'view'} style={{ borderColor: 'white', width: 96, textAlign: 'center', justifyContent: 'center', padding: 0, margin: 0, color: this.props.get_for == 'view' ? "black" : "#5198ea", backgroundColor: this.props.get_for == 'view' ? 'white' : tableMeta.rowData[8] !== '' ? 'white' : tableMeta.rowData[7] == null ? '#ffac99' : (tableMeta.rowData[8] == '' && tableMeta.rowData[7].value == 'Time deposit' || tableMeta.rowData[7].value == 'N/A') ? 'white' : '#ffac99' }} type="text" defaultValue={tableMeta.rowData[8]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} />
</div>
// <Input
// disableUnderline={true}
// style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9 || this.props.get_for == 'view'? true : false}
// defaultValue={tableMeta.rowData[8]}
// // disabled={false}
// multiline={true}
// inputProps={{
// style: {
// color: this.props.get_for == 'view'? "black" : "#5198ea",
// textAlign: 'center',
// backgroundColor: 'white'
// }
// }}
// />
// <ThemeProvider theme={theme}>
// <Input
// disableUnderline={true}
// style={{color: this.props.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -105 }}
// type="text"
// placeholder=""
// disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9? true : false}
// defaultValue={tableMeta.rowData[8]}
// multiline
// rowsMax={3}
// onBlur={(event) => {
// // // // console.log(event.target.value)
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta, tableMeta.columnIndex)
// // // // console.log(dataTable2)
// }}
// />
// </ThemeProvider>
}
</div>
......@@ -1344,45 +1318,16 @@ export default class LOV extends Component {
{tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9 ?
null :
<div style={{ padding: 0, margin: 0 }}>
<textarea disabled={this.props.get_for == 'view'} style={{ fontSize: 12, borderColor: 'white', width: 96, textAlign: 'center', justifyContent: 'center', padding: 0, margin: 0, color: this.props.get_for == 'view' ? "black" : "#5198ea", backgroundColor: tableMeta.rowData[10] == '' && this.props.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[10]}
{/* {tableMeta.rowData[10] == '' || tableMeta.rowData[10] == 0.0 || tableMeta.rowData[10] == 0 && this.props.get_for == 'edit' ?
<LightTooltipError title={"Data belum sesuai"} arrow>
<textarea disabled={this.props.get_for == 'view'} style={{ fontSize: 12, borderColor: 'white', width: 96, textAlign: 'center', justifyContent: 'center', padding: 0, margin: 0, color: this.props.get_for == 'view' ? "black" : "#5198ea", backgroundColor: tableMeta.rowData[10] == '' || tableMeta.rowData[10] == 0.0 || tableMeta.rowData[10] == 0 && this.props.get_for == 'edit' ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[10]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} />
</LightTooltipError>
: */}
<textarea disabled={this.props.get_for == 'view'} style={{ fontSize: 12, borderColor: 'white', width: 96, textAlign: 'center', justifyContent: 'center', padding: 0, margin: 0, color: this.props.get_for == 'view' ? "black" : "#5198ea", backgroundColor: (this.props.get_for == 'edit' && tableMeta.rowData[10] == '' )|| (this.props.get_for == 'edit' && tableMeta.rowData[10] == 0.0) || (this.props.get_for == 'edit' && tableMeta.rowData[10] == 0) ? '#ffac99' : 'white' }} type="text" defaultValue={tableMeta.rowData[10]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} />
{/* } */}
</div>
// <Input
// disableUnderline={true}
// style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9 || this.props.get_for == 'view'? true : false}
// defaultValue={tableMeta.rowData[8]}
// // disabled={false}
// multiline={true}
// inputProps={{
// style: {
// color: this.props.get_for == 'view'? "black" : "#5198ea",
// textAlign: 'center',
// backgroundColor: 'white'
// }
// }}
// />
// <ThemeProvider theme={theme}>
// <Input
// disableUnderline={true}
// style={{color: this.props.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -105 }}
// type="text"
// placeholder=""
// disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9? true : false}
// defaultValue={tableMeta.rowData[8]}
// multiline
// rowsMax={3}
// onBlur={(event) => {
// // // // console.log(event.target.value)
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta, tableMeta.columnIndex)
// // // // console.log(dataTable2)
// }}
// />
// </ThemeProvider>
}
</div>
......@@ -1409,7 +1354,7 @@ export default class LOV extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.get_for == 'view' ? "black" : "#5198ea", fontSize: 13, textAlign: 'center', paddingBottom: 18, borderColor: 'transparent', margin: 0, width: 96, height: 30, backgroundColor: (tableMeta.rowData[11] == '0.00' || tableMeta.rowData[11] == '') && this.props.get_for == 'edit' ? '#ffac99' : 'transparent' }}
style={{ color: this.props.get_for == 'view' ? "black" : "#5198ea", fontSize: 13, textAlign: 'center', paddingBottom: 18, borderColor: 'transparent', margin: 0, width: 96, backgroundColor: (this.props.get_for == 'edit' && tableMeta.rowData[11] == 0.00) || (this.props.get_for == 'edit' && tableMeta.rowData[11] == '') ? '#ffac99' : 'transparent' }}
type="text"
placeholder=""
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
......@@ -1422,34 +1367,12 @@ export default class LOV extends Component {
/>
}
/>
// <FormControlLabel
// style={{ margin: 0 }}
// // value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: this.props.get_for == 'view' ? "black" : "#5198ea", fontSize: 12, textAlign: 'center', paddingBottom: 18, borderColor: 'transparent', margin: 0, width: 96, height: 30, backgroundColor: (tableMeta.rowData[11] == '0.00' || tableMeta.rowData[11] == '') && this.props.get_for == 'edit' ? '#ffac99' : 'transparent' }}
// type="text"
// placeholder=""
// // value={this.props.get_for == 'view' ? fixNumber(Number(value), 2) : this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 2) : Number(value) == 0 || Number(value) == "0.0" ? "0.00" : Number(value)}
// value={value}
// disabled={this.props.get_for == 'view'}
// // disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// // decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
// onBlur={(event) => {
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta, tableMeta.columnIndex)
// // // // // console.log(tableMeta.rowData[0])
// }}
// />
// }
// />
}
</div>
)
}
}
},
},
// {
// name: "Currency",
// options: {
......
......@@ -22,9 +22,12 @@ import { fixNumber, roundMath } from "../../library/Utils";
import LOCF from './LOCFMR';
import LOV from './LOVMR';
function Alert(props) {
return <MuiAlert elevation={6} variant="filled" {...props} />;
}
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
// function Alert(props) {
// return <MuiAlert elevation={6} variant="filled" {...props} />;
// }
const useStyles = makeStyles((theme) => ({
root: {
......@@ -136,6 +139,9 @@ export default class ListOfCreditFacilities extends Component {
saveTambahan: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false,
alert: false,
tipeAlert: '',
messageAlert: '',
}
}
......@@ -415,7 +421,7 @@ export default class ListOfCreditFacilities extends Component {
console.log(body);
console.log(error);
if (error && type == 'submitted') {
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loadingChild: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
} else {
api.create('UPLOAD').createMonthlyReportLOCF(body).then(response => {
console.log(response);
......@@ -456,17 +462,13 @@ export default class ListOfCreditFacilities extends Component {
let error = false
// this.deleteReport()
if (this.state.dataTablelov !== undefined && this.state.tambahLOV == undefined) {
console.log('1');
dataTable2 = this.state.dataTablelov
} else {
console.log('2');
dataTable2 = this.state.dataTableLOV
this.setState({ updateTambah: true, updateData: false })
if (this.state.tambahLOV = 'tambah' && this.state.updateData == false) {
console.log('3');
dataTable2 = this.state.dataTablelov
} else {
console.log('4')
dataTable2 = this.state.dataTableLOV
}
......@@ -474,12 +476,16 @@ export default class ListOfCreditFacilities extends Component {
console.log(dataTable2);
dataTable2.map(i => {
if (i[0] == 3) {
if (i[6] == null || i[7] == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "" || i[12] == "") {
if (i[6] == null || i[7] == null || i[9] == "" || i[10] == "" || i[11] == "" || i[12] == "") {
console.log('masuk sini');
error = true
}
console.log(i[7]?.value);
if (i[8] == '' && i[7]?.value == 'Time deposit' || i[7]?.value == 'N/A') {
if ((i[7].value == 'Government bonds' && i[8] == '') || (i[7].value == 'Stocks' && i[8] == '') || (i[7].value == 'Mutual funds' && i[8] == '') || (i[7].value == 'Investment in associate' && i[8] == '') || (i[7].value == 'Investment in joint venture' && i[8] == '') || (i[7].value == 'Investment in subsidiary' && i[8] == '') || (i[7].value == 'Corporate bonds' && i[8] == '') || (i[7].value == 'Others' && i[8] == '')) {
error = true
} else {
error = false
}
let tgl = String(i[9]).split('-')
let checkUndifined = tgl.findIndex((val) => val == undefined)
......@@ -535,7 +541,7 @@ export default class ListOfCreditFacilities extends Component {
console.log(body);
console.log(error);
if (error && type == 'submitted') {
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loadingChild: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
} else {
api.create('UPLOAD').createMonthlyReportLOV(body).then(response => {
console.log(response);
......@@ -548,7 +554,7 @@ export default class ListOfCreditFacilities extends Component {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loadingChild: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -560,10 +566,11 @@ export default class ListOfCreditFacilities extends Component {
// alert(response.data.status)
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loadingChild: false, handleDoubleClick: 0 })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
console.log(response.problem);
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loadingChild: false, handleDoubleClick: 0 })
}
this.setState({ handleDoubleClick: 0 })
})
......@@ -929,13 +936,19 @@ export default class ListOfCreditFacilities extends Component {
bankNameEmpty = true
}
if (i[0] == 3) {
if (i[6] == null || i[7] == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "" || i[12] == "") {
if (i[6] == null || i[7] == null || i[9] == "" || i[10] == "" || i[11] == "" || i[12] == "") {
error = true
}
if (i[8] == '' && i[7]?.value == 'Time deposit' || i[7]?.value == 'N/A') {
if ((i[7].value == 'Government bonds' && i[8] == '') || (i[7].value == 'Stocks' && i[8] == '') || (i[7].value == 'Mutual funds' && i[8] == '') || (i[7].value == 'Investment in associate' && i[8] == '') || (i[7].value == 'Investment in joint venture' && i[8] == '') || (i[7].value == 'Investment in subsidiary' && i[8] == '') || (i[7].value == 'Corporate bonds' && i[8] == '') || (i[7].value == 'Others' && i[8] == '')) {
error = true
} else {
error = false
}
// if (i[7].value == 'Government bonds' || i[7].value == 'Stocks' || i[7].value == 'Mutual funds' || i[7].value == 'Investment in associate' || i[7].value == 'Investment in joint venture' || i[7].value == 'Investment in subsidiary' || i[7].value == 'Corporate bonds' || i[7].value == 'Others' && i[8] == '' ) {
// error = true
// }
let tgl = String(i[9]).split('-')
let checkUndifined = tgl.findIndex((val) => val == undefined)
if (this.props.defaultCurrency.id == 2) {
......@@ -988,6 +1001,7 @@ export default class ListOfCreditFacilities extends Component {
"total_loan": this.state.totalLoanLOV
}
console.log(body);
console.log(error);
api.create().validateSaveLOV(body).then((response) => {
console.log(response);
let dataTablelov = []
......@@ -1221,7 +1235,7 @@ export default class ListOfCreditFacilities extends Component {
}
console.log(body);
if (error && type == 'submitted') {
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loadingChild: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
} else {
api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => {
console.log(response);
......@@ -1297,8 +1311,10 @@ export default class ListOfCreditFacilities extends Component {
error = true
}
if (i[8] == '' && i[7]?.value == 'Time deposit' || i[7]?.value == 'N/A') {
if ((i[7].value == 'Government bonds' && i[8] == '') || (i[7].value == 'Stocks' && i[8] == '') || (i[7].value == 'Mutual funds' && i[8] == '') || (i[7].value == 'Investment in associate' && i[8] == '') || (i[7].value == 'Investment in joint venture' && i[8] == '') || (i[7].value == 'Investment in subsidiary' && i[8] == '') || (i[7].value == 'Corporate bonds' && i[8] == '') || (i[7].value == 'Others' && i[8] == '')) {
error = true
} else {
error = false
}
let tgl = String(i[9]).split('-')
let checkUndifined = tgl.findIndex((val) => val == undefined)
......@@ -1353,7 +1369,7 @@ export default class ListOfCreditFacilities extends Component {
}
console.log(body);
if (error && type == 'submitted') {
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loadingChild: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
} else {
api.create('UPLOAD').createMonthlyReportLOV(body).then(response => {
console.log(response);
......@@ -1390,6 +1406,10 @@ export default class ListOfCreditFacilities extends Component {
}
}
closeAlert() {
this.setState({ alert: false })
}
render() {
let dataTable2 = this.state.dataTable
let loading = this.state.loading
......@@ -1424,9 +1444,9 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleParent ?
< Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<Snackbar open={this.state.snekbar} autoHideDuration={3000} onClose={handleClose}>
<Alert onClose={handleClose} severity="error">
{this.state.snekbarMsg}
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
......
......@@ -4326,6 +4326,12 @@ export default class SubHolding extends Component {
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true, previewTable: false }, () => {
let tahun = Number(this.state.periode.periode)
let bizpar = tahun >= 2024 && defaultCurrencyID == 2 && newInputValue.id == 1 ? defaultReport.filter(e => e.report === 2) : defaultReport
console.log(bizpar);
console.log(defaultReport);
this.setState({ report: this.state.report, reportType: bizpar })
this.getCurrency(this.state.company.company_id)
this.getReportType()
})}
disabled={this.state.intent === 'Home' ? true : false}
......@@ -4345,8 +4351,11 @@ export default class SubHolding extends Component {
onChange={(event, newInputValue) => this.setState({ company: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
this.getCurrency(newInputValue.company_id)
let bizpar = this.state.usdBefore2024 == false && defaultCurrencyID == 2 && newInputValue.id == 1 ? defaultReport.filter(e => e.report === 2) : defaultReport
this.setState({ report: bizpar[0], reportType: bizpar })
let tahun = Number(this.state.periode.periode)
let bizpar = tahun >= 2024 && defaultCurrencyID == 2 && newInputValue.id == 1 ? defaultReport.filter(e => e.report === 2) : defaultReport
console.log(bizpar);
console.log(defaultReport);
this.setState({ report: this.state.report, reportType: bizpar })
})}
disableClearable
style={{ width: 250 }}
......@@ -4385,8 +4394,10 @@ export default class SubHolding extends Component {
// })
// console.log("report 2");
// }
let bizpar = this.state.usdBefore2024 == false && defaultCurrencyID == 2 && newInputValue.id == 1 ? defaultReport.filter(e => e.report === 2) : defaultReport
this.setState({ report: bizpar[0], reportType: bizpar })
let tahun = Number(this.state.periode.periode)
let bizpar = tahun >= 2024 && defaultCurrencyID == 2 && newInputValue.id == 1 ? defaultReport.filter(e => e.report === 2) : defaultReport
let indexID = bizpar.findIndex((val) => val.value == this.state.report.value)
this.setState({ report: indexID == -1 ? bizpar[0] : this.state.report, reportType: bizpar })
this.getReportType()
})}
......
......@@ -2192,7 +2192,10 @@ export default class RollingOutlook extends Component {
</div>
)}
{this.state.checkApprover === true ?
this.state.lastStatus === 'WAITING FOR REVIEW' ?
this.state.lastStatus === 'SUBMITTED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.lastStatus}</span>
</div> : this.state.lastStatus === 'WAITING FOR REVIEW' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.lastStatus}</span>
</div> : this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' ?
......@@ -2213,18 +2216,26 @@ export default class RollingOutlook extends Component {
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.lastStatus}</span>
</div> :
this.state.lastStatus === 'WAITING FOR APPROVAL' ?
this.state.lastStatus === 'WAITING FOR REVIEW' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> :
this.state.lastStatus === 'REVISION' ?
this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>NEED REVISION</span>
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> :
this.state.lastStatus === 'APPROVED' ?
this.state.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>APPROVED</span>
</div> : null
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> :
this.state.lastStatus === 'REVISION' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>NEED REVISION</span>
</div> :
this.state.lastStatus === 'APPROVED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>APPROVED</span>
</div> : null
}
{this.state.visibleTableHistory && (
<div style={{ marginTop: 20 }}>
......
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