Commit a89c3ee9 authored by EKSAD's avatar EKSAD

Item Laporan

parent 3ea10554
...@@ -112,6 +112,10 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -112,6 +112,10 @@ 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 searchReportItems = (body) => api.post('/item_report/search_item_report', body)
//Template //Template
const downloadTemplate = (fileName,fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName,fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
...@@ -167,7 +171,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -167,7 +171,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
changePassword, changePassword,
getPerusahaanHierarki, getPerusahaanHierarki,
checkUploadUser, checkUploadUser,
uploadUser uploadUser,
getReportItems,
searchReportItems
} }
} }
......
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,24 @@ export default class ReportItems extends Component { ...@@ -60,12 +52,24 @@ export default class ReportItems extends Component {
}); });
} }
closeEdit() { componentDidMount() {
this.setState({edit: false}) this.getData()
console.log(this.props.height)
} }
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)
// }
})
} }
render() { render() {
...@@ -238,13 +242,13 @@ export default class ReportItems extends Component { ...@@ -238,13 +242,13 @@ 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.indexData}
/> />
)} )}
{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.indexData}
/> />
)} )}
......
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