Commit 5f095c76 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'riri' into 'master'

update login & create report items

See merge request !98
parents e4f23628 e6b8cb2c
...@@ -114,6 +114,13 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -114,6 +114,13 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const checkUploadUser = (body) => api.post('/user/check_import', body) const checkUploadUser = (body) => api.post('/user/check_import', body)
const uploadUser = (body) => api.post('/user/import_user', body) const uploadUser = (body) => api.post('/user/import_user', body)
//Report Items
const getReportItems = () => api.get('item_report/get_all_item_report')
const getInputType = () => api.get('type_report/get_all_type_report')
const getReportType = () => api.get('report/get_all_report')
const searchReportItems = (body) => api.post('/item_report/search_item_report', body)
const createReportItems = (body) => api.post('/item_report/create_item_report', body)
//PARAMETER //PARAMETER
const getAllParameter = () => api.get('/setting/get_all_setting') const getAllParameter = () => api.get('/setting/get_all_setting')
const getDetailParameter = (id) => api.get(`setting/get_setting_by_id/${id}`) const getDetailParameter = (id) => api.get(`setting/get_setting_by_id/${id}`)
...@@ -177,6 +184,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -177,6 +184,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getPerusahaanHierarki, getPerusahaanHierarki,
checkUploadUser, checkUploadUser,
uploadUser, uploadUser,
getReportItems,
searchReportItems,
createReportItems,
getInputType,
getReportType,
getAllParameter, getAllParameter,
getAllGroup, getAllGroup,
getParameterByGroup, getParameterByGroup,
......
...@@ -18,7 +18,7 @@ class EmailVerification extends Component { ...@@ -18,7 +18,7 @@ class EmailVerification extends Component {
} }
render() { render() {
return ( return (
<div style={{ flex: 1, display: 'flex', backgroundColor: '#51c6ea', height: '100vh', justifyContent: 'center', alignItems: 'center' }}> <div style={{ flex: 1, display: 'flex', backgroundColor: '#152d40', height: '100vh', justifyContent: 'center', alignItems: 'center' }}>
<div style={{paddingTop: 20, paddingRight: 24, paddingLeft: 24, display: 'flex', flexDirection: 'column', width: 378, height: 300, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff', justifyContent: 'center', alignItems: 'center' }}> <div style={{paddingTop: 20, paddingRight: 24, paddingLeft: 24, display: 'flex', flexDirection: 'column', width: 378, height: 300, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff', justifyContent: 'center', alignItems: 'center' }}>
<img src={Images.berhasil} /> <img src={Images.berhasil} />
......
...@@ -56,7 +56,7 @@ class ForgotPassword extends Component { ...@@ -56,7 +56,7 @@ class ForgotPassword extends Component {
render() { render() {
return ( return (
<div style={{ flex: 1, display: 'flex', backgroundColor: '#51c6ea', height: '100vh', justifyContent: 'center', alignItems: 'center' }}> <div style={{ flex: 1, display: 'flex', backgroundColor: '#152d40', height: '100vh', justifyContent: 'center', alignItems: 'center' }}>
<div style={{padding: 60, display: 'flex', flexDirection: 'column', width: 378, height: 351, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff', justifyContent: 'center', alignItems: 'center' }}> <div style={{padding: 60, display: 'flex', flexDirection: 'column', width: 378, height: 351, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff', justifyContent: 'center', alignItems: 'center' }}>
<img src={Images.tia} /> <img src={Images.tia} />
......
...@@ -115,7 +115,7 @@ class Login extends Component { ...@@ -115,7 +115,7 @@ class Login extends Component {
<img src={Images.tia} /> <img src={Images.tia} />
<img src={Images.imageLogin} style={{ marginTop: 30 }} /> <img src={Images.imageLogin} style={{ marginTop: 30 }} />
</div> </div>
<div style={{ width: '50%', height: '100vh', backgroundColor: '#51c6ea', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}> <div style={{ width: '50%', height: '100vh', backgroundColor: '#152d40', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}>
<div style={{ paddingTop: 56, paddingLeft: 54, paddingRight: 54, display: 'flex', flexDirection: 'column', width: 388, height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}> <div style={{ paddingTop: 56, paddingLeft: 54, paddingRight: 54, display: 'flex', flexDirection: 'column', width: 388, height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<img src={Images.tia} /> <img src={Images.tia} />
......
import React, { Component } from "react"; import React, { Component } from "react";
import { Container, Row, Col } from "react-bootstrap"; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import SearchIcon from '@material-ui/icons/Search';
import Images from "../../assets/Images"; import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import { TextField, InputBase } from "@material-ui/core"; import { InputBase } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import CreateReportItems from "./formReportItems/CreateReportItems"; import CreateReportItems from "./formReportItems/CreateReportItems";
import EditReportItems from "./formReportItems/EditReportItems"; import EditReportItems from "./formReportItems/EditReportItems";
import VisualReportItems from "./formReportItems/VisualReportItems"; import VisualReportItems from "./formReportItems/VisualReportItems";
import api from "../../api";
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -40,17 +39,10 @@ export default class ReportItems extends Component { ...@@ -40,17 +39,10 @@ export default class ReportItems extends Component {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
if (err) { if (err) {
// console.log(err);
} }
else { else {
let judul = resp.rows[0] let judul = resp.rows[0]
let isi = resp.rows.slice(1) let isi = resp.rows.slice(1)
// let body = isi.map((item) => {
// return {
// item
// ]
// })
// console.log(JSON.stringify(isi));
this.setState({ this.setState({
dataLoaded: true, dataLoaded: true,
cols: judul, cols: judul,
...@@ -60,12 +52,78 @@ export default class ReportItems extends Component { ...@@ -60,12 +52,78 @@ export default class ReportItems extends Component {
}); });
} }
closeEdit() { componentDidMount() {
this.setState({edit: false}) this.getData()
} }
closeAdd() { getData() {
this.setState({add: false}) api.create().getReportItems().then((response) => {
console.log(response)
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
return [index, item.item_report_id, item.report_name, item.company_name, item.order, item.description, item.parent, item.uom, item.weight, item.type_report_name, item.status ]
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
}
})
}
openPopUp(index, type) {
if (type === 'edit') {
this.setState({
selectIndex: index,
edit: true
})
} else {
this.setState({
data: this.state.listData[index],
add: true
})
}
}
handleInputChange(e) {
this.setState({ search: e })
let body = {
"keyword": e
}
api.create().searchReportItems(body).then(response => {
// console.log(response.data);
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
return [index, item.item_report_id, item.report_name, item.company_name, item.order, item.description, item.parent, item.uom, item.weight, item.type_report_name, item.status ]
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
}
})
}
createReportItems = (payload) => {
this.setState({ add: false })
api.create().createReportItems(payload).then(response => {
if (response.data.status == 'success') {
this.getData()
} else {
alert(response.data.message)
}
})
}
updateReportItems = (payload) => {
this.setState({ edit: false })
api.create().updateReportItems(payload).then(response => {
if (response.data.status == 'success') {
this.getData()
} else {
alert(response.data.message)
}
})
} }
render() { render() {
...@@ -81,6 +139,7 @@ export default class ReportItems extends Component { ...@@ -81,6 +139,7 @@ export default class ReportItems extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => this.openPopUp(tableMeta.rowIndex, 'edit')}
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
...@@ -89,26 +148,136 @@ export default class ReportItems extends Component { ...@@ -89,26 +148,136 @@ export default class ReportItems extends Component {
); );
} }
} }
}, "ID", "Jenis Laporan", "Perusahaan", "Order", "Deskripsi", "Parent ID", "UOM", "Weight", "Tipe Data", "Status"] },
const data = [ {
["", "1", "KPI", "TIA", "1", "Financial Perspective", "0", "-", "35%", "Formula", "Aktif"], name: "ID",
["", "2", "KPI", "TIA", "2", "Trading Profit", "1", "Rp Bio", "35%", "Formula", "Aktif"], options: {
["", "3", "KPI", "TIA", "3", "Revenue", "1", "Rp Bio", "0%", "Formula", "Aktif"], customBodyRender: (val, tableMeta) => {
["", "4", "KPI", "TIA", "4", "EBITDA", "1", "Rp Bio", "0%", "Formula", "Non Aktif"], return (
["", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-"], <div style={{ display: 'flex' }}>
] <span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
const options = { </div >
filter: false, );
sort: false, }
responsive: "scroll", }
print: false, },
download: false, {
selectableRows: false, name: "Jenis Laporan",
viewColumns: false, options: {
rowsPerPage: 5, customBodyRender: (val, tableMeta) => {
search: false return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Perusahaan",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Order",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Deskripsi",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Parent ID",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "UOM",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Weight",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Tipe Data",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Status",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[10] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
} }
]
const data = [
["", "1", "KPI", "TIA", "1", "Financial Perspective", "0", "-", "35%", "Formula", "Aktif"],
["", "2", "KPI", "TIA", "2", "Trading Profit", "1", "Rp Bio", "35%", "Formula", "Aktif"],
["", "3", "KPI", "TIA", "3", "Revenue", "1", "Rp Bio", "0%", "Formula", "Aktif"],
["", "4", "KPI", "TIA", "4", "EBITDA", "1", "Rp Bio", "0%", "Formula", "Non Aktif"],
["", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-"],
]
return ( return (
<div> <div>
{this.state.itemReport === true ? {this.state.itemReport === true ?
...@@ -116,24 +285,25 @@ export default class ReportItems extends Component { ...@@ -116,24 +285,25 @@ export default class ReportItems extends Component {
<div className={"main-color"} style={{ height: 199, width: '100%' }} /> <div className={"main-color"} style={{ height: 199, width: '100%' }} />
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center' }}>Master Data - Item Report</label> <label style={{ width: '20%', color: 'white', fontSize: 16, alignSelf: 'center', paddingTop: 8 }}>Master Data - Item Report</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5 }}> <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase <InputBase
style={{ width: '100%' }} style={{ width: '100%' }}
placeholder="Search" placeholder="Search"
value={""} value={this.state.search}
onChange={(e) => this.handleInputChange(e)} onChange={(e) => this.handleInputChange(e.target.value)}
inputProps={{ 'aria-label': 'naked' }} inputProps={{ 'aria-label': 'naked' }}
/> />
</div> </div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex' }}> <div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
padding: 0 padding: 0,
margin: 5
}} }}
onClick={() => null} onClick={() => null}
> >
...@@ -143,7 +313,8 @@ export default class ReportItems extends Component { ...@@ -143,7 +313,8 @@ export default class ReportItems extends Component {
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent' borderColor: 'transparent',
margin: 5
}} }}
onClick={() => null} onClick={() => null}
> >
...@@ -153,7 +324,8 @@ export default class ReportItems extends Component { ...@@ -153,7 +324,8 @@ export default class ReportItems extends Component {
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent' borderColor: 'transparent',
margin: 5
}} }}
onClick={() => null} onClick={() => null}
> >
...@@ -163,7 +335,8 @@ export default class ReportItems extends Component { ...@@ -163,7 +335,8 @@ export default class ReportItems extends Component {
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent' borderColor: 'transparent',
margin: 5
}} }}
onClick={() => null} onClick={() => null}
> >
...@@ -173,7 +346,8 @@ export default class ReportItems extends Component { ...@@ -173,7 +346,8 @@ export default class ReportItems extends Component {
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent' borderColor: 'transparent',
margin: 5
}} }}
> >
<img src={Images.add} onClick={() => this.setState({ add: true })} /> <img src={Images.add} onClick={() => this.setState({ add: true })} />
...@@ -184,7 +358,7 @@ export default class ReportItems extends Component { ...@@ -184,7 +358,7 @@ export default class ReportItems extends Component {
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
theme={getMuiTheme()} theme={getMuiTheme()}
data={data} data={this.state.dataTable}
columns={columns} columns={columns}
options={options} options={options}
/> />
...@@ -238,14 +412,16 @@ export default class ReportItems extends Component { ...@@ -238,14 +412,16 @@ export default class ReportItems extends Component {
} }
{this.state.add && ( {this.state.add && (
<CreateReportItems <CreateReportItems
onClickClose={this.closeAdd.bind(this)} onClickClose={() => this.setState({ add: false })}
data={this.state.indexData} data={this.state.listData}
createReportItems={this.createReportItems.bind(this)}
/> />
)} )}
{this.state.edit && ( {this.state.edit && (
<EditReportItems <EditReportItems
onClickClose={this.closeEdit.bind(this)} onClickClose={() => this.setState({ edit: false })}
data={this.state.indexData} data={this.state.listData[this.state.selectIndex]}
updateReportItems={this.updateReportItems.bind(this)}
/> />
)} )}
{this.state.visibleUpload && ( {this.state.visibleUpload && (
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { TextField, Typography } from '@material-ui/core'; import { TextField, Typography } from '@material-ui/core';
import * as R from 'ramda';
import api from '../../../api';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { titleCase } from '../../../library/Utils';
import format from "date-fns/format";
import { DatePicker } from '@material-ui/pickers'; import { DatePicker } from '@material-ui/pickers';
const companies = [
{
value: '',
label: '',
},
{
value: '1',
label: 'TIA',
},
{
value: '2',
label: 'TIA',
},
];
const dataTypes = [
{
value: '',
label: '',
},
{
value: '1',
label: 'Formula',
},
{
value: '2',
label: 'Formula',
},
];
const reportTypes = [
{
value: '',
label: '',
},
{
value: '1',
label: 'KPI',
},
{
value: '2',
label: 'KPI',
},
];
const parents = [
{
value: '-',
label: '-',
},
{
value: '1',
label: '1',
},
{
value: '2',
label: '2',
},
];
export default class CreateReportItems extends Component { export default class CreateReportItems extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
startDate: new Date(), InputType: null,
endDate: new Date(), company: null,
parent: null,
reportType: null,
startDate: null,
endDate: null,
order: '',
description: '',
uom: '',
weight: '',
formula: '',
realVal: '',
condition: '',
date: new Date(),
listInputType: null,
listCompany: null,
listReportType: null,
listParent: null,
errorOrder: false,
errorDesc: false,
errorFormula: false,
errorRV: false,
errorCF: false,
errorStartDate: false,
errorEndDate: false,
msgErrorOrder: '',
msgErrorDesc: '',
msgErrorFormula: '',
masgErrorRV: '',
msgErrorCF: '',
msgErrorSD: '',
msgErrorED: '',
} }
} }
handleStartDate = (date) => {
this.setState({
startDate: date
});
};
handleEndDate = (date) => {
this.setState({
endDate: date
});
};
componentDidMount() { componentDidMount() {
console.log(this.props.data); this.getInputType()
this.getPerusahaan()
this.getReportType()
this.getParent()
}
handleChange(e, type) {
let data = this.state
let isDate = type !== ''? true : false
if (isDate && type === 'start_date') {
this.setState({...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null,
errorOrder: false,
errorStartDate: false,
errorEndDate: false,
msgErrorOrder: '',
msgErrorSD: '',
msgErrorED: '',
})
} else if (isDate && type === 'end_date') {
this.setState({...data, endDate : format(e, 'yyyy-MM-dd'),
errorOrder: false,
errorStartDate: false,
errorEndDate: false,
msgErrorOrder: '',
msgErrorSD: '',
msgErrorED: '',
})
} else {
this.setState({...data, [e.target.name]: e.target.value,
errorOrder: false,
errorStartDate: false,
errorEndDate: false,
msgErrorOrder: '',
msgErrorSD: '',
msgErrorED: '',
})
}
}
validasi() {
// alert('coba ya')
if (R.isEmpty(this.state.order)) {
this.setState({errorOrder: true, msgErrorOrder: 'Order Harus Diisi'})
} else if (R.isNil(this.state.startDate)) {
this.setState({errorStartDate: true, msgErrorSD: 'Start Date tidak boleh kosong'})
} else if (R.isNil(this.state.endDate)) {
this.setState({errorEndDate: true, msgErrorED: 'End Date tidak boleh kosong'})
} else {
this.addReportItems()
}
}
addReportItems() {
alert("test")
// let payload = {
// "role_name": this.state.roleName,
// "start_date": this.state.startDate,
// "end_date": this.state.endDate,
// "privileges": this.state.privileges
// }
// // console.log(payload)
// api.create().addRole(payload).then((response) => {
// console.log(response)
// if (response.data.status === 'success') {
// this.props.refresh()
// this.props.onClickClose()
// } else {
// alert(response.data.message)
// }
// })
}
getInputType() {
api.create().getInputType().then((response) => {
// console.log(response)
if(response.data.status === 'success') {
let data = response.data.data
let inputData = data.map((item) => {
return {
type_report_id: item.type_report_id,
type_report_name: item.type_report_name
}
})
let defaultProps = {
options: inputData,
getOptionLabel: (option) => titleCase(option.type_report_name),
};
this.setState({listInputType: defaultProps, inputData: response.data.data})
} else {
alert(response.data.message)
}
})
}
getPerusahaan() {
api.create().getPerusahaanActive().then((response) => {
// console.log(response)
if(response.data.status === 'success') {
let data = response.data.data
let companyData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name
}
})
let defaultProps = {
options: companyData,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({listCompany: defaultProps, companyData: response.data.data})
} else {
alert(response.data.message)
}
})
}
getReportType() {
api.create().getReportType().then((response) => {
// console.log(response)
if(response.data.status === 'success') {
let data = response.data.data
let reportTypeData = data.map((item) => {
return {
report_id: item.report_id,
report_name: item.report_name,
}
})
let defaultProps = {
options: reportTypeData,
getOptionLabel: (option) => titleCase(option.report_name),
};
this.setState({listReportType: defaultProps, reportTypeData: response.data.data})
} else {
alert(response.data.message)
}
})
}
getParent() {
api.create().getReportItems().then((response) => {
// console.log(response)
if(response.data.status === 'success') {
let data = response.data.data
let parentData = data.map((item) => {
return {
item_report_id: item.item_report_id
}
})
let defaultProps = {
options: parentData,
getOptionLabel: (option) => titleCase(option.item_report_id),
};
this.setState({listParent: defaultProps, parentData: response.data.data})
} else {
alert(response.data.message)
}
})
} }
render() { render() {
...@@ -114,7 +234,7 @@ export default class CreateReportItems extends Component { ...@@ -114,7 +234,7 @@ export default class CreateReportItems extends Component {
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}> <div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="column-1"> <div className="column-1">
<div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
value={1} value={1}
...@@ -126,7 +246,6 @@ export default class CreateReportItems extends Component { ...@@ -126,7 +246,6 @@ export default class CreateReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -135,46 +254,31 @@ export default class CreateReportItems extends Component { ...@@ -135,46 +254,31 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
/> />
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{padding: 10}} >
<TextField <Autocomplete
{...this.state.listCompany}
id="company" id="company"
style={{ width: '100%' }} onChange={(event, newInputValue) => this.setState({company: newInputValue})}
select debug
label="Perusahaan" renderInput={(params) =>
// onChange={handleChange} <TextField {...params}
helperText="" label="Perusahaan"
SelectProps={{ InputLabelProps={{
native: true, style: {
}} fontSize: 11,
InputLabelProps={{ fontWeight: 600,
style: { fontFamily: 'Nunito Sans, sans-serif',
fontSize: 11, color: '#7e8085'
fontWeight: 600, }
fontFamily: 'Nunito Sans, sans-serif', }}
color: '#7e8085', InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
paddingLeft: 10 />}
} value={this.state.company}
}} />
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
}
}}
>
{companies.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</TextField>
</div> </div>
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
...@@ -187,7 +291,6 @@ export default class CreateReportItems extends Component { ...@@ -187,7 +291,6 @@ export default class CreateReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -196,7 +299,6 @@ export default class CreateReportItems extends Component { ...@@ -196,7 +299,6 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
> >
...@@ -213,7 +315,6 @@ export default class CreateReportItems extends Component { ...@@ -213,7 +315,6 @@ export default class CreateReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -222,47 +323,32 @@ export default class CreateReportItems extends Component { ...@@ -222,47 +323,32 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
> >
</TextField> </TextField>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{padding: 10}}>
<TextField <Autocomplete
id="dataType" {...this.state.listInputType}
style={{ width: '100%' }} id="inputType"
select onChange={(event, newInputValue) => this.setState({InputType: newInputValue})}
label="Tipe Data" debug
// onChange={handleChange} renderInput={(params) =>
helperText="" <TextField {...params}
SelectProps={{ label="Tipe Data"
native: true, InputLabelProps={{
}} style: {
InputLabelProps={{ fontSize: 11,
style: { fontWeight: 600,
fontSize: 11, fontFamily: 'Nunito Sans, sans-serif',
fontWeight: 600, color: '#7e8085'
fontFamily: 'Nunito Sans, sans-serif', }
color: '#7e8085', }}
paddingLeft: 10 InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
} />}
}} value={this.state.InputType}
inputProps={{ />
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
}
}}
>
{dataTypes.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</TextField>
</div> </div>
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
...@@ -278,7 +364,6 @@ export default class CreateReportItems extends Component { ...@@ -278,7 +364,6 @@ export default class CreateReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -287,41 +372,40 @@ export default class CreateReportItems extends Component { ...@@ -287,41 +372,40 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
/> />
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
value={startDate} label="Berlaku Mulai"
onChange={this.handleStartDate} format="dd MMMM yyyy"
label="Berlaku Mulai" value={this.state.startDate}
format="dd MMMM yyyy" error={this.state.errorStartDate}
KeyboardButtonProps={{ helperText={this.state.msgErrorSD}
'aria-label': 'change date', onChange={(e) => this.handleChange(e, 'start_date')}
}} KeyboardButtonProps={{
inputProps={{ 'aria-label': 'change date',
style: { }}
fontSize: 11, inputProps={{
fontWeight: 600, style: {
fontFamily: 'Nunito Sans, sans-serif', fontSize: 11,
paddingLeft: 10 fontWeight: 600,
} fontFamily: 'Nunito Sans, sans-serif',
}} }
InputLabelProps={{ }}
style: { InputLabelProps={{
fontSize: 11, style: {
color: '#7e8085', fontSize: 11,
fontWeight: 600, color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif', fontWeight: 600,
paddingLeft: 10 fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
style={{ padding: 0, margin: 0, width: '100%' }} style={{padding: 0, margin: 0, width: '100%'}}
/> />
</div> </div>
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
...@@ -336,7 +420,6 @@ export default class CreateReportItems extends Component { ...@@ -336,7 +420,6 @@ export default class CreateReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -345,7 +428,6 @@ export default class CreateReportItems extends Component { ...@@ -345,7 +428,6 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
/> />
...@@ -364,54 +446,43 @@ export default class CreateReportItems extends Component { ...@@ -364,54 +446,43 @@ export default class CreateReportItems extends Component {
</div> </div>
<div className="column-2"> <div className="column-2">
<div style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{padding: 10}}>
<TextField <Autocomplete
{...this.state.listReportType}
id="reportType" id="reportType"
style={{ width: '100%' }} onChange={(event, newInputValue) => this.setState({reportType: newInputValue})}
select debug
label="Jenis Laporan" renderInput={(params) =>
// onChange={handleChange} <TextField {...params}
helperText="" label="Jenis Laporan"
SelectProps={{ InputLabelProps={{
native: true, style: {
}} fontSize: 11,
InputLabelProps={{ fontWeight: 600,
style: { fontFamily: 'Nunito Sans, sans-serif',
fontSize: 11, color: '#7e8085'
fontWeight: 600, }
fontFamily: 'Nunito Sans, sans-serif', }}
color: '#7e8085', InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
paddingLeft: 10 />}
} value={this.state.reportType}
}} />
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
}
}}
>
{reportTypes.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</TextField>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="order" id="orders"
name="order"
label="Order" label="Order"
// value="" value={this.state.order}
error={this.state.errorOrder}
helperText={this.state.msgErrorOrder}
onChange={(e) => this.handleChange(e, '')}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -420,47 +491,32 @@ export default class CreateReportItems extends Component { ...@@ -420,47 +491,32 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
> >
</TextField> </TextField>
</div> </div>
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{padding: 10}} >
<TextField <Autocomplete
id="parent" {...this.state.listParent}
style={{ width: '100%' }} id="parentId"
select onChange={(event, newInputValue) => this.setState({parent: newInputValue})}
label="Parent" debug
// onChange={handleChange} renderInput={(params) =>
helperText="" <TextField {...params}
SelectProps={{ label="Parent ID"
native: true, InputLabelProps={{
}} style: {
InputLabelProps={{ fontSize: 11,
style: { fontWeight: 600,
fontSize: 11, fontFamily: 'Nunito Sans, sans-serif',
fontWeight: 600, color: '#7e8085'
fontFamily: 'Nunito Sans, sans-serif', }
color: '#7e8085', }}
paddingLeft: 10 InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
} />}
}} value={this.state.parent}
inputProps={{ />
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
}
}}
>
{parents.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</TextField>
</div> </div>
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
...@@ -473,7 +529,6 @@ export default class CreateReportItems extends Component { ...@@ -473,7 +529,6 @@ export default class CreateReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -482,7 +537,6 @@ export default class CreateReportItems extends Component { ...@@ -482,7 +537,6 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
> >
...@@ -499,7 +553,6 @@ export default class CreateReportItems extends Component { ...@@ -499,7 +553,6 @@ export default class CreateReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -508,7 +561,6 @@ export default class CreateReportItems extends Component { ...@@ -508,7 +561,6 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
> >
...@@ -526,7 +578,6 @@ export default class CreateReportItems extends Component { ...@@ -526,7 +578,6 @@ export default class CreateReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -535,41 +586,41 @@ export default class CreateReportItems extends Component { ...@@ -535,41 +586,41 @@ export default class CreateReportItems extends Component {
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
paddingLeft: 10
} }
}} }}
/> />
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker <DatePicker
margin="normal" margin="normal"
id="endDate" id="endDate"
value={endDate} label="Berlaku Hingga"
onChange={this.handleEndDate} format="dd MMMM yyyy"
label="Berlaku Hingga" value={this.state.endDate}
format="dd MMMM yyyy" error={this.state.errorEndDate}
KeyboardButtonProps={{ helperText={this.state.msgErrorED}
'aria-label': 'change date', onChange={(e) => this.handleChange(e, 'end_date')}
}} minDate={this.state.startDate}
inputProps={{ KeyboardButtonProps={{
style: { 'aria-label': 'change date',
fontSize: 11, }}
fontWeight: 600, inputProps={{
fontFamily: 'Nunito Sans, sans-serif', style: {
paddingLeft: 10 fontSize: 11,
} fontWeight: 600,
}} fontFamily: 'Nunito Sans, sans-serif',
InputLabelProps={{ }
style: { }}
fontSize: 11, InputLabelProps={{
color: '#7e8085', style: {
fontWeight: 600, fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif', color: '#7e8085',
paddingLeft: 10 fontWeight: 600,
} fontFamily: 'Nunito Sans, sans-serif',
}} }
}}
style={{ padding: 0, margin: 0, width: '100%' }}
style={{padding: 0, margin: 0, width: '100%'}}
/> />
</div> </div>
</div> </div>
...@@ -587,10 +638,10 @@ export default class CreateReportItems extends Component { ...@@ -587,10 +638,10 @@ export default class CreateReportItems extends Component {
</div> </div>
</button> </button>
</div> </div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}> <div className="column-2" style={{display: 'flex', justifyContent: 'flex-end', alignItems: 'center'}}>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div onClick={() => this.validasi()} 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 }}>Simpan</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -104,7 +104,7 @@ class ResetPassword extends Component { ...@@ -104,7 +104,7 @@ class ResetPassword extends Component {
render() { render() {
return ( return (
<div style={{ flex: 1, display: 'flex', backgroundColor: '#51c6ea', height: '100vh', justifyContent: 'center', alignItems: 'center' }}> <div style={{ flex: 1, display: 'flex', backgroundColor: '#152d40', height: '100vh', justifyContent: 'center', alignItems: 'center' }}>
<div style={{padding: 56, display: 'flex', flexDirection: 'column', width: 378, height: 415, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff', justifyContent: 'center', alignItems: 'center' }}> <div style={{padding: 56, display: 'flex', flexDirection: 'column', width: 378, height: 415, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff', justifyContent: 'center', alignItems: 'center' }}>
<img src={Images.tia}/> <img src={Images.tia}/>
......
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