Commit 3d5668fc authored by Deni Rinaldi's avatar Deni Rinaldi

balance sheet ++

parent ef8c2ffd
...@@ -132,6 +132,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -132,6 +132,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const getReportItems = () => api.get('item_report/get_all_item_report') const getReportItems = () => api.get('item_report/get_all_item_report')
const getInputType = () => api.get('type_report/get_all_type_report') const getInputType = () => api.get('type_report/get_all_type_report')
const getReportType = () => api.get('report/get_all_report') const getReportType = () => api.get('report/get_all_report')
const getReportTypeBody = (body) => api.post('report/get_all_report', body)
const getDetailReportItems = (userId) => api.get(`item_report/get_item_report_by_id/${userId}`) const getDetailReportItems = (userId) => api.get(`item_report/get_item_report_by_id/${userId}`)
const searchReportItems = (body) => api.post('/item_report/search_item_report', body) const searchReportItems = (body) => api.post('/item_report/search_item_report', body)
const createReportItems = (body) => api.post('/item_report/create_item_report', body) const createReportItems = (body) => api.post('/item_report/create_item_report', body)
...@@ -248,7 +249,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -248,7 +249,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getUnitBisnisActive, getUnitBisnisActive,
getMenuByUser, getMenuByUser,
getDetailUnitBisnis, getDetailUnitBisnis,
uploadFoto uploadFoto,
getReportTypeBody
} }
} }
......
...@@ -45,7 +45,8 @@ const Images = { ...@@ -45,7 +45,8 @@ const Images = {
setting: require('./logout.png'), setting: require('./logout.png'),
failedCopy: require('./failed-copy.svg'), failedCopy: require('./failed-copy.svg'),
triputraLogo: require('./triputra-logo.png'), triputraLogo: require('./triputra-logo.png'),
photo: require('./photo.svg') photo: require('./photo.svg'),
camera: require('./camera.svg')
} }
......
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13">
<g fill="none" fill-rule="evenodd">
<path d="M0 0H24V24H0z" transform="translate(-5 -6)"/>
<g transform="translate(-5 -6) translate(5 6)">
<path fill="#FFF" d="M7.664 0c1.086 0 2 .743 2.259 1.749L11 1.75c1.657 0 3 1.343 3 3v4.5c0 1.657-1.343 3-3 3H3c-1.657 0-3-1.343-3-3v-4.5c0-1.657 1.343-3 3-3l1.074-.001C4.334.743 5.247 0 6.334 0h1.33z"/>
<circle cx="7" cy="7" r="3" fill="#019CE5"/>
</g>
</g>
</svg>
...@@ -29,11 +29,15 @@ export default class BudgetTahunan extends Component { ...@@ -29,11 +29,15 @@ export default class BudgetTahunan extends Component {
componentDidMount() { componentDidMount() {
this.getCompanyActive() this.getCompanyActive()
this.getReport()
} }
getReport() { getReport() {
api.create().getReportType().then(response => { let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode,
"revisi": this.state.periode
}
api.create().getReportTypeBody(payload).then(response => {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -65,7 +69,7 @@ export default class BudgetTahunan extends Component { ...@@ -65,7 +69,7 @@ export default class BudgetTahunan extends Component {
options: companyData, options: companyData,
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; };
this.setState({ listCompany: defaultProps, company: companyData[0] }) this.setState({ listCompany: defaultProps, company: companyData[0] }, ()=> this.getReport())
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
...@@ -297,7 +301,7 @@ export default class BudgetTahunan extends Component { ...@@ -297,7 +301,7 @@ export default class BudgetTahunan extends Component {
{this.state.visibleBS && ( {this.state.visibleBS && (
<BalanceSheet <BalanceSheet
report_id={this.state.report_id} report_id={this.state.report_id}
company_id={this.state.company.company_id} company={this.state.company}
onClickClose={()=> this.setState({ visibleBS: false, visibleBudgetTahunan: true})} onClickClose={()=> this.setState({ visibleBS: false, visibleBudgetTahunan: true})}
/> />
)} )}
......
...@@ -26,16 +26,16 @@ export default class BalanceSheet extends Component { ...@@ -26,16 +26,16 @@ export default class BalanceSheet extends Component {
super(props) super(props)
this.state = { this.state = {
dataTable: [ dataTable: [
["TOTAL ASSETS", "11,247,249", "10,702,196"], // ["TOTAL ASSETS", "11,247,249", "10,702,196"],
["TOTAL CURRENT ASSETS", "2,647,647", "2,058,898"], // ["TOTAL CURRENT ASSETS", "2,647,647", "2,058,898"],
["Cash & Cash Equivalent", "1,464,571", "729,743"], // ["Cash & Cash Equivalent", "1,464,571", "729,743"],
["Cash & Bank Balance", "938,707", "265,584"], // ["Cash & Bank Balance", "938,707", "265,584"],
["Time & Call Deposit", "525,864", "464,159"], // ["Time & Call Deposit", "525,864", "464,159"],
["BI Deposit", "", ""], // ["BI Deposit", "", ""],
["Marketable Securities", "150,250", "154,500"], // ["Marketable Securities", "150,250", "154,500"],
["Notes Receivable", "", ""], // ["Notes Receivable", "", ""],
["Accounts Receivable", "172,031", "97,112"], // ["Accounts Receivable", "172,031", "97,112"],
["Trade Receivables - Third Party", "142,668", "77,480"], // ["Trade Receivables - Third Party", "142,668", "77,480"],
] ]
} }
} }
...@@ -48,10 +48,56 @@ export default class BalanceSheet extends Component { ...@@ -48,10 +48,56 @@ export default class BalanceSheet extends Component {
getItemHierarki() { getItemHierarki() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
"company_id": this.props.company_id "company_id": this.props.company.company_id
} }
api.create().getItemReportHierarki(payload).then(response => { api.create().getItemReportHierarki(payload).then(response => {
console.log(response); console.log(response);
if (response.data) {
if (response.data.status === "success") {
let dataTable = []
response.data.data.map((item, index) => {
if (item.children.length > 0) {
dataTable.push([
item.level,
item.description
])
item.children.map(i => {
if (i.children) {
if (i.children.length > 0) {
dataTable.push([
i.level,
i.description
])
i.children.map(val => {
dataTable.push([
val.level,
val.description
])
})
} else {
dataTable.push([
i.level,
i.description
])
}
} else {
dataTable.push([
i.level,
i.description
])
}
})
} else {
dataTable.push([
item.level,
item.description
])
}
})
console.log(dataTable);
this.setState({ dataTable })
}
}
}) })
} }
...@@ -67,6 +113,11 @@ export default class BalanceSheet extends Component { ...@@ -67,6 +113,11 @@ export default class BalanceSheet extends Component {
render() { render() {
const columns = [{ const columns = [{
name: "",
options: {
display: false
}
}, {
name: "Account", name: "Account",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
...@@ -78,12 +129,12 @@ export default class BalanceSheet extends Component { ...@@ -78,12 +129,12 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 388 }}> <div style={{ width: 388 }}>
{tableMeta.rowIndex == 0 || tableMeta.rowIndex == 1 ? {tableMeta.rowData[0] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{val}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
: :
tableMeta.rowIndex == 2 || tableMeta.rowIndex == 6 || tableMeta.rowIndex == 7 || tableMeta.rowIndex == 8 ? tableMeta.rowData[0] === 1?
<span style={{ fontSize: 12, marginLeft: 10 }}>{val}</span> : <span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> <span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span>
} }
</div> </div>
) )
...@@ -299,7 +350,7 @@ export default class BalanceSheet extends Component { ...@@ -299,7 +350,7 @@ export default class BalanceSheet extends Component {
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PT. XYZ</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : 2021</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : 2021</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
...@@ -316,8 +367,8 @@ export default class BalanceSheet extends Component { ...@@ -316,8 +367,8 @@ export default class BalanceSheet extends Component {
</div> </div>
<div className="grid grid-2x"> <div className="grid grid-2x">
<div className="col-1"> <div className="col-1">
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<button <button
className="button"
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -326,9 +377,10 @@ export default class BalanceSheet extends Component { ...@@ -326,9 +377,10 @@ export default class BalanceSheet extends Component {
}} }}
onClick={() => this.props.onClickClose()} onClick={() => this.props.onClickClose()}
> >
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Kembali</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Kembali</Typography>
</button>
</div> </div>
</button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}>
......
...@@ -347,7 +347,7 @@ export default function MiniDrawer() { ...@@ -347,7 +347,7 @@ export default function MiniDrawer() {
}) })
setApplication(app) setApplication(app)
setSetting(set) setSetting(set)
console.log(app); console.log(set);
} else { } else {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -491,7 +491,7 @@ export default function MiniDrawer() { ...@@ -491,7 +491,7 @@ export default function MiniDrawer() {
</div> </div>
</div> </div>
} }
{open && {open && application.length > 0 &&
<div style={{ marginLeft: 20, marginTop: 10 }}> <div style={{ marginLeft: 20, marginTop: 10 }}>
<Typography style={{ color: '#525355', fontSize: 14, fontFamily: 'Nunito Sans, sans-serif' }}>Application</Typography> <Typography style={{ color: '#525355', fontSize: 14, fontFamily: 'Nunito Sans, sans-serif' }}>Application</Typography>
</div> </div>
...@@ -539,7 +539,7 @@ export default function MiniDrawer() { ...@@ -539,7 +539,7 @@ export default function MiniDrawer() {
</div> </div>
))} ))}
</List> </List>
{open && {open && setting.length > 0 &&
<div style={{ marginLeft: 20 }}> <div style={{ marginLeft: 20 }}>
<Typography style={{ color: '#525355', fontSize: 14, fontFamily: 'Nunito Sans, sans-serif' }}>Setting</Typography> <Typography style={{ color: '#525355', fontSize: 14, fontFamily: 'Nunito Sans, sans-serif' }}>Setting</Typography>
</div> </div>
......
...@@ -334,25 +334,25 @@ export default class CreateParameter extends Component { ...@@ -334,25 +334,25 @@ export default class CreateParameter extends Component {
validasi() { validasi() {
if (R.isNil(this.state.getTypes)) { if (R.isNil(this.state.getTypes)) {
this.setState({ errorGroup: true, msgErrorGroup: 'Group is required' }) this.setState({ errorGroup: true, msgErrorGroup: 'Group is required.' })
} else if (R.isNil(this.state.getParameter)) { } else if (R.isNil(this.state.getParameter)) {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter is required' }) this.setState({ errorParameter: true, msgErrorParameter: 'Parameter is required.' })
} else if (R.isNil(this.state.getPerusahaan)) { } else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company is required' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company is required.' })
// } else if (R.isEmpty(this.state.tempData.description)) { // } else if (R.isEmpty(this.state.tempData.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' }) // this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isEmpty(this.state.tempData.value)) { // } else if (R.isEmpty(this.state.tempData.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' }) // this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
} else if ((!R.isNil(this.state.tempData.max_value) && R.isNil(this.state.tempData.min_value)) || (!R.isNil(this.state.tempData.max_value) && R.isEmpty(this.state.tempData.min_value))) { } else if ((!R.isNil(this.state.tempData.max_value) && R.isNil(this.state.tempData.min_value)) || (!R.isNil(this.state.tempData.max_value) && R.isEmpty(this.state.tempData.min_value))) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value is required' }) this.setState({ errorMinValue: true, msgErrorMinValue: 'Min value is required.' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start Date is required' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date is required.' })
// } else if (R.isNil(this.state.tempData.order)) { // } else if (R.isNil(this.state.tempData.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' }) // this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
} else if (!R.isNil(this.state.tempData.min_value) && R.isNil(this.state.tempData.max_value)) { } else if (!R.isNil(this.state.tempData.min_value) && R.isNil(this.state.tempData.max_value)) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value is required' }) this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max value is required.' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End Date is required' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required.' })
} else { } else {
this.updateParameter() this.updateParameter()
} }
...@@ -360,25 +360,25 @@ export default class CreateParameter extends Component { ...@@ -360,25 +360,25 @@ export default class CreateParameter extends Component {
validasiCreate() { validasiCreate() {
if (R.isNil(this.state.getTypes)) { if (R.isNil(this.state.getTypes)) {
this.setState({ errorGroup: true, msgErrorGroup: 'Group is required' }) this.setState({ errorGroup: true, msgErrorGroup: 'Group is required.' })
} else if (R.isNil(this.state.getParameter)) { } else if (R.isNil(this.state.getParameter)) {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter is required' }) this.setState({ errorParameter: true, msgErrorParameter: 'Parameter is required.' })
} else if (R.isNil(this.state.getPerusahaan)) { } else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Perusahaan is required' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Perusahaan is required.' })
// } else if (R.isEmpty(this.state.description)) { // } else if (R.isEmpty(this.state.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' }) // this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isNil(this.state.value)) { // } else if (R.isNil(this.state.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' }) // this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
} else if (!R.isNil(this.state.maxValue) && R.isNil(this.state.minValue)) { } else if (!R.isNil(this.state.maxValue) && R.isNil(this.state.minValue)) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value is required' }) this.setState({ errorMinValue: true, msgErrorMinValue: 'Min value is required.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start Date is required' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date is required.' })
// } else if (R.isNil(this.state.order)) { // } else if (R.isNil(this.state.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' }) // this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
} else if (!R.isNil(this.state.minValue) && R.isNil(this.state.maxValue)) { } else if (!R.isNil(this.state.minValue) && R.isNil(this.state.maxValue)) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value is required' }) this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max value is required.' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End Date tidak boleh kosong' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required' })
} else { } else {
this.createParameter() this.createParameter()
} }
...@@ -614,11 +614,11 @@ export default class CreateParameter extends Component { ...@@ -614,11 +614,11 @@ export default class CreateParameter extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Created</Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Created By</Typography>
<Typography style={{ fontSize: 11 }}>: {this.state.tempData === null ? "" : this.state.tempData.created}</Typography> <Typography style={{ fontSize: 11 }}>: {this.state.tempData === null ? "" : this.state.tempData.created}</Typography>
</div> </div>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Updated</Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Updated By</Typography>
<Typography style={{ fontSize: 11 }}>: {this.state.tempData === null ? "" : this.state.tempData.updated === null ? "" : this.state.tempData.updated}</Typography> <Typography style={{ fontSize: 11 }}>: {this.state.tempData === null ? "" : this.state.tempData.updated === null ? "" : this.state.tempData.updated}</Typography>
</div> </div>
</div> </div>
...@@ -958,8 +958,8 @@ export default class CreateParameter extends Component { ...@@ -958,8 +958,8 @@ export default class CreateParameter extends Component {
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Typography style={{ fontSize: 11 }}>Created : </Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Created by : </Typography>
<Typography style={{ fontSize: 11 }}>Updated : </Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Updated by : </Typography>
</div> </div>
</div> </div>
...@@ -1101,7 +1101,7 @@ export default class CreateParameter extends Component { ...@@ -1101,7 +1101,7 @@ export default class CreateParameter extends Component {
onClick={() => this.validasiCreate()} onClick={() => this.validasiCreate()}
> >
<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' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
</div> </div>
</button> </button>
</div> </div>
......
...@@ -100,11 +100,11 @@ export default class CreateUnitBisnis extends Component { ...@@ -100,11 +100,11 @@ 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 is required' }) this.setState({ errorName: true, msgErrorName: 'Business unit is required.' })
} else if (R.isEmpty(this.state.startDate)) { } else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start Date is required' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date is required.' })
} else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) { } else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End Date is required' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required.' })
} else { } else {
let payload = { let payload = {
"business_unit_id": this.state.id, "business_unit_id": this.state.id,
...@@ -118,11 +118,11 @@ export default class CreateUnitBisnis extends Component { ...@@ -118,11 +118,11 @@ 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 is required' }) this.setState({ errorName: true, msgErrorName: 'Business unit is required.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start Date is required' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date is required.' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End Date is required'}) this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required.'})
} else { } else {
let payload = { let payload = {
"business_unit_name": this.state.name, "business_unit_name": this.state.name,
...@@ -228,11 +228,11 @@ export default class CreateUnitBisnis extends Component { ...@@ -228,11 +228,11 @@ export default class CreateUnitBisnis extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Created</Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Created By</Typography>
<Typography style={{ fontSize: 11 }}>: {this.state.created}</Typography> <Typography style={{ fontSize: 11 }}>: {this.state.created}</Typography>
</div> </div>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Updated</Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Updated By</Typography>
<Typography style={{ fontSize: 11 }}>: {this.state.updated}</Typography> <Typography style={{ fontSize: 11 }}>: {this.state.updated}</Typography>
</div> </div>
</div> </div>
...@@ -311,7 +311,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -311,7 +311,7 @@ export default class CreateUnitBisnis extends Component {
onClick={() => this.validasi()} onClick={() => this.validasi()}
> >
<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' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
</div> </div>
</button> </button>
</div> </div>
...@@ -415,8 +415,8 @@ export default class CreateUnitBisnis extends Component { ...@@ -415,8 +415,8 @@ export default class CreateUnitBisnis extends Component {
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Typography style={{ fontSize: 11 }}>Created : </Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Created By : </Typography>
<Typography style={{ fontSize: 11 }}>Updated : </Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Updated By : </Typography>
</div> </div>
</div> </div>
...@@ -494,7 +494,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -494,7 +494,7 @@ export default class CreateUnitBisnis extends Component {
onClick={() => this.validasiCreate()} onClick={() => this.validasiCreate()}
> >
<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' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
</div> </div>
</button> </button>
</div> </div>
......
...@@ -68,41 +68,41 @@ export default class Profile extends Component { ...@@ -68,41 +68,41 @@ 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: 'Terdiri 8 karakter dengan kombinasi angka.' }) this.setState({ errorPassword: false, msgPassword: 'Password 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: 'Terdiri 8 karakter dengan kombinasi angka.' }) this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Password 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: 'Terdiri 8 karakter dengan kombinasi angka.' }) this.setState({ errorOldPassword: false, msgOldPassword: 'Password consists of 8 characters with a combination of numbers.' })
} }
} }
validasi() { validasi() {
if (this.state.oldPassword == "") { if (this.state.oldPassword == "") {
this.setState({ errorOldPassword: true, msgOldPassword: 'Kata sandi lama harus diisi!' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password is required.' })
} else if (this.state.oldPassword.length < 8) { } else if (this.state.oldPassword.length < 8) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Kata sandi lama minimal 8 karakter!' }) 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: 'Format kata sandi lama tidak boleh menggunakan 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: 'Kata sandi lama harus berupa kombinasi karakter, huruf dan angka!' }) 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: 'Kata sandi baru harus diisi!' }) this.setState({ errorPassword: true, msgPassword: 'Password is required.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'Kata sandi baru minimal 8 karakter!' }) 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: 'Format kata sandi baru tidak boleh menggunakan 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: 'Kata sandi baru harus berupa kombinasi karakter, huruf dan angka!' }) 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: 'Konfirmasi kata sandi harus diisi!' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirm Password is required.' })
} else if (this.state.confirmPassword.length < 8) { } else if (this.state.confirmPassword.length < 8) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Konfirmasi kata sandi minimal 8 karakter!' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirm password of at least 8 characters.' })
} else if (this.isEmail(this.state.confirmPassword)) { } else if (this.isEmail(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Format konfirmasi kata sandi tidak boleh menggunakan email!' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation format may not use email.' })
} else if (!this.isRegex(this.state.confirmPassword)) { } else if (!this.isRegex(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Konfirmasi kata sandi harus berupa kombinasi karakter, huruf dan angka!' }) 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: 'Konfirmasi kata sandi harus sama dengan kata sandi baru!' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirmation password must match the password.' })
} else { } else {
this.confirmPassword() this.confirmPassword()
} }
...@@ -300,13 +300,13 @@ export default class Profile extends Component { ...@@ -300,13 +300,13 @@ export default class Profile extends Component {
// }); // });
} }
async uploadFoto(){ async uploadFoto() {
let formData = new FormData() let formData = new FormData()
formData.append('file', this.state.pictures[0]) formData.append('file', this.state.pictures[0])
api.create().uploadFoto(formData).then(response => { api.create().uploadFoto(formData).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.ok){ if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ uploadVisible: false }, () => { this.setState({ uploadVisible: false }, () => {
this.getUser() this.getUser()
...@@ -358,7 +358,11 @@ export default class Profile extends Component { ...@@ -358,7 +358,11 @@ export default class Profile extends Component {
// onClick={() => console.log(tableMeta)} // onClick={() => console.log(tableMeta)}
onClick={() => this.setState({ uploadVisible: true })} onClick={() => this.setState({ uploadVisible: true })}
> >
<img src={Images.photo} /> {/* <img src={Images.photo} /> */}
<div style={{ width: 93, height: 30, objectFit: 'contain', backgroundColor: '#019ce5', borderRadius: 4, display: 'flex', alignContent: 'center', justifyContent: 'center' }}>
<img src={Images.camera} />
<Typography style={{ color: '#ffffff', fontSize: 11, fontFamily: 'Nunito Sans, sans-serif', alignSelf: 'center', marginLeft: 5 }}>Ganti Foto</Typography>
</div>
</button> </button>
</div> </div>
</div> </div>
...@@ -367,8 +371,8 @@ export default class Profile extends Component { ...@@ -367,8 +371,8 @@ export default class Profile extends Component {
<div> <div>
<AppBar position="static"> <AppBar position="static">
<Tabs indicatorColor="primary" value={this.state.tab} onChange={this.selectTab} aria-label="simple tabs example" style={{ backgroundColor: '#f8f8f8', borderColor: 'transparent' }}> <Tabs indicatorColor="primary" value={this.state.tab} onChange={this.selectTab} aria-label="simple tabs example" style={{ backgroundColor: '#f8f8f8', borderColor: 'transparent' }}>
<Tab label="KATA SANDI" style={{ color: '#4b4b4b', fontSize: 11 }} /> <Tab label="PASSWORD" style={{ color: '#4b4b4b', fontSize: 11 }} />
<Tab label="OTORISASI PERUSAHAAN" style={{ color: '#4b4b4b', fontSize: 11 }} /> <Tab label="AUTHORIZATION" style={{ color: '#4b4b4b', fontSize: 11 }} />
</Tabs> </Tabs>
</AppBar> </AppBar>
{this.state.tab == 0 ? {this.state.tab == 0 ?
...@@ -379,16 +383,26 @@ export default class Profile extends Component { ...@@ -379,16 +383,26 @@ export default class Profile extends Component {
<div style={{ padding: 20, marginTop: 10, marginBottom: 100 }}> <div style={{ padding: 20, marginTop: 10, marginBottom: 100 }}>
<div style={{ width: 432, borderRadius: 6, boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.25)' }}> <div style={{ width: 432, borderRadius: 6, boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.25)' }}>
<div style={{ width: '100%', height: 64, backgroundColor: '#354960', display: 'flex', paddingLeft: 20, borderTopLeftRadius: 6, borderTopRightRadius: 6, alignItems: 'center' }}> <div style={{ width: '100%', height: 64, backgroundColor: '#354960', display: 'flex', paddingLeft: 20, borderTopLeftRadius: 6, borderTopRightRadius: 6, alignItems: 'center' }}>
<Typography style={{ fontSize: '13px', color: 'white', fontWeight: 'bold' }}>Kata Sandi</Typography> <Typography style={{ fontSize: '13px', color: 'white', fontWeight: 'bold' }}>Password</Typography>
</div> </div>
<div style={{ padding: 20, justifyContent: 'space-between' }}> <div style={{ padding: 20, justifyContent: 'space-between' }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
inputProps={{ style: { fontSize: 11 } }} inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
id="filled-required" id="filled-required"
name={"oldPassword"} name={"oldPassword"}
type={this.state.showPass ? 'text' : 'password'} type={this.state.showPass ? 'text' : 'password'}
label="Kata Sandi Saat Ini" label="Old Password"
value={this.state.oldPassword} value={this.state.oldPassword}
variant="outlined" variant="outlined"
onChange={(password) => { onChange={(password) => {
...@@ -411,9 +425,19 @@ export default class Profile extends Component { ...@@ -411,9 +425,19 @@ export default class Profile extends Component {
/> />
<TextField <TextField
style={{ width: '100%', marginTop: 20 }} style={{ width: '100%', marginTop: 20 }}
inputProps={{ style: { fontSize: 11 } }} inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
id="filled-required" id="filled-required"
label="Kata Sandi Baru" label="New Password"
name={"password"} name={"password"}
type={this.state.showPass2 ? 'text' : 'password'} type={this.state.showPass2 ? 'text' : 'password'}
value={this.state.password} value={this.state.password}
...@@ -438,9 +462,19 @@ export default class Profile extends Component { ...@@ -438,9 +462,19 @@ export default class Profile extends Component {
/> />
<TextField <TextField
style={{ width: '100%', marginTop: 20 }} style={{ width: '100%', marginTop: 20 }}
inputProps={{ style: { fontSize: 11 } }} inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
id="filled-required" id="filled-required"
label="Konfirmasi Kata Sandi Baru" label="Confirm Password"
name={"confirmPassword"} name={"confirmPassword"}
type={this.state.showPass3 ? 'text' : 'password'} type={this.state.showPass3 ? 'text' : 'password'}
value={this.state.confirmPassword} value={this.state.confirmPassword}
...@@ -483,7 +517,7 @@ export default class Profile extends Component { ...@@ -483,7 +517,7 @@ export default class Profile extends Component {
<div style={{ padding: 20, marginTop: 10, marginBottom: 100 }}> <div style={{ padding: 20, marginTop: 10, marginBottom: 100 }}>
<div style={{ width: 432, borderRadius: 6, boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.25)' }}> <div style={{ width: 432, borderRadius: 6, boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.25)' }}>
<div style={{ width: '100%', height: 64, backgroundColor: '#354960', display: 'flex', paddingLeft: 20, borderTopLeftRadius: 6, borderTopRightRadius: 6, alignItems: 'center' }}> <div style={{ width: '100%', height: 64, backgroundColor: '#354960', display: 'flex', paddingLeft: 20, borderTopLeftRadius: 6, borderTopRightRadius: 6, alignItems: 'center' }}>
<Typography style={{ fontSize: '13px', color: 'white', fontWeight: 'bold' }}>Otorisasi Perusahaan</Typography> <Typography style={{ fontSize: '13px', color: 'white', fontWeight: 'bold' }}>Authorization</Typography>
</div> </div>
<div style={{ padding: 20, overflow: 'scroll', height: '40vh' }}> <div style={{ padding: 20, overflow: 'scroll', height: '40vh' }}>
{/* <div style={{ display: 'flex' }}> {/* <div style={{ display: 'flex' }}>
......
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