Commit 65a675de authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

1

See merge request !68
parents 436844fb 0c16c603
...@@ -83,6 +83,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -83,6 +83,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
const createUnitBisnis = (body) => api.post('/business_unit/create_business_unit', body) const createUnitBisnis = (body) => api.post('/business_unit/create_business_unit', body)
const updateUnitBisnis = (body) => api.post('/business_unit/update_business_unit', body) const updateUnitBisnis = (body) => api.post('/business_unit/update_business_unit', body)
const searchUnitBisnis = (body) => api.post('/business_unit/search_business_unit', body) const searchUnitBisnis = (body) => api.post('/business_unit/search_business_unit', body)
const checkUploadUnitBisnis = (body) => api.post('/business_unit/check_import', body)
// Perusahaan // Perusahaan
const getPerusahaan = () => api.get('company/get_all_company') const getPerusahaan = () => api.get('company/get_all_company')
...@@ -148,7 +149,8 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -148,7 +149,8 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
createUser, createUser,
updateUser, updateUser,
deleteUser, deleteUser,
downloadTemplate downloadTemplate,
checkUploadUnitBisnis
} }
} }
......
...@@ -37,18 +37,40 @@ export default class UnitBisnis extends Component { ...@@ -37,18 +37,40 @@ export default class UnitBisnis extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
console.log(resp)
if (err) { if (err) {
console.log(err); console.log(err);
} }
else { else {
let judul = resp.rows[0]
let isi = resp.rows.slice(1) let judul = resp.rows[2]
// let body = isi.map((item) => { let isi = resp.rows.slice(3)
// return { let payload = []
// item isi.map((item, index) => {
// ] payload.push({
// }) id: index + 1,
console.log(JSON.stringify(isi)); business_unit_name: item[0],
start_date: item[1],
end_date: item[2],
})
})
let body = {
business_unit: payload
}
api.create().checkUploadUnitBisnis(body).then(response => {
console.log(response);
let dataRow = response.data.data.map((item, index) => {
return [
index+1,
item.business_unit_name,
item.start_date,
item.end_date,
item.error
]
})
})
// console.log(JSON.stringify(payload));
this.setState({ this.setState({
dataLoaded: true, dataLoaded: true,
cols: judul, cols: judul,
......
...@@ -204,7 +204,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -204,7 +204,7 @@ export default class CreateUnitBisnis extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Berlaku Hingga" label="Berakhir Hingga"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.endDate} value={this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')} onChange={(e) => this.handleChange(e, 'end_date')}
...@@ -381,7 +381,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -381,7 +381,7 @@ export default class CreateUnitBisnis extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="endDate" id="endDate"
label="Berlaku Hingga" label="Berakhir Hingga"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.endDate == "" ? null : this.state.endDate} value={this.state.endDate == "" ? null : this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')} onChange={(e) => this.handleChange(e, 'end_date')}
......
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