Commit 41083315 authored by Deni Rinaldi's avatar Deni Rinaldi

push banyak banget pokonya ampe puyeng

parent 8115bdd0
......@@ -79,6 +79,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
//Menu
const getMenu = () => api.get('menu/get_menu_hierarki')
const getMenuByRole = () => api.get('menu/get_menu_hierarki_by_role')
const getMenuByUser = () => api.get('menu/get_menu')
//UNIT BISNIS
const getUnitBisnis = () => api.get('business_unit/get_all_business_unit')
......@@ -87,6 +88,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const searchUnitBisnis = (body) => api.post('/business_unit/search_business_unit', body)
const checkUploadUnitBisnis = (body) => api.post('/business_unit/check_import', body)
const uploadUnitBisnis = (body) => api.post('/business_unit/import_business_unit', body)
const getUnitBisnisActive = () => api.get('business_unit/get_all_business_unit_active')
// Perusahaan
const getPerusahaan = () => api.get('company/get_all_company')
......@@ -95,6 +97,10 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const updatePerusahaan = (body) => api.post('/company/update_company', body)
const getPerusahaanHierarki = () => api.get('company/get_company_hierarki')
const saveVisualisasiPerusahaan = (body) => api.post('company/save_visualization', body)
const checkUploadPerusahaan = (body) => api.post('company/check_import', body)
const getDetailPerusahaan = (id) => api.get(`company/get_company_by_id/${id}`)
const uploadPerusahaan = (body) => api.post('company/import_company', body)
const searchPerusahaan = (body) => api.post('company/search_company', body)
// APPROVAL MATRIX
const getAM = () => api.get('approval_matrix/get_all_approval_matrix')
......@@ -138,6 +144,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const updateParameter = (body) => api.post('setting/update_setting', body)
const checkUploadParameter = (body) => api.post('setting/check_import', body)
const uploadParameter = (body) => api.post('/setting/import_setting', body)
const searchParameter = (body) => api.post('setting/search_setting', body)
//Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......@@ -216,7 +223,14 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getItemReportHierarki,
getMenuByRole,
saveVisualisasiReport,
saveVisualisasiPerusahaan
saveVisualisasiPerusahaan,
searchParameter,
checkUploadPerusahaan,
getDetailPerusahaan,
uploadPerusahaan,
searchPerusahaan,
getUnitBisnisActive,
getMenuByUser
}
}
......
This diff is collapsed.
......@@ -124,6 +124,36 @@ export default class Parameter extends Component {
}
}
handleInputChange(e) {
this.setState({ search: e })
let body = {
"keyword": e
}
api.create().searchParameter(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.setting_group,
item.setting_type,
item.company_name,
item.description,
item.order,
item.value,
item.min_value,
item.max_value,
item.status
]
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
}
})
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
......@@ -612,6 +642,8 @@ export default class Parameter extends Component {
<InputBase
style={{ width: '100%' }}
placeholder="Search"
value={this.state.search}
onChange={(e) => this.handleInputChange(e.target.value)}
inputProps={{ 'aria-label': 'naked' }}
/>
</div>
......
This diff is collapsed.
......@@ -11,8 +11,13 @@ export default class CreateUnitBisnis extends Component {
id: '',
name: '',
startDate: '',
endDate: ''
endDate: '',
errorName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorName: "",
msgErrorStartDate: "",
msgErrorEndDate: ""
}
}
render() {
......@@ -36,11 +41,13 @@ export default class CreateUnitBisnis extends Component {
let data = this.state
let isDate = type !== '' ? true : false
if (isDate && type == 'start_date') {
this.setState({ startDate: format(e, 'yyyy-MM-dd') }, () => {
this.setState({ startDate: format(e, 'yyyy-MM-dd'), endDate: null }, () => {
this.clearError()
console.log(this.state.startDate)
})
} else if (isDate && type == 'end_date') {
this.setState({ endDate: format(e, 'yyyy-MM-dd') }, () => {
this.clearError()
console.log(this.state.endDate)
})
} else {
......@@ -49,13 +56,25 @@ export default class CreateUnitBisnis extends Component {
}
clearError() {
this.setState({
errorName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorName: "",
msgErrorStartDate: "",
msgErrorEndDate: ""
})
}
validasi() {
if (R.isEmpty(this.state.name)) return alert("Unit Bisnis Name is Required.");
if (!R.isEmpty(this.state.startDate) && !R.isEmpty(this.state.endDate) && (this.state.startDate > this.state.endDate)) return alert("Masa Berlaku Tidak Boleh Kurang Dari Tanggal Mulai");
if (R.isEmpty(this.state.startDate)) return alert("Tanggal Mulai is Required.");
if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required.");
console.log('masuk');
if (this.props.type == 'edit') {
if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Unit Bisnis tidak boleh kosong' })
} else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Tanggal Mulai tidak boleh kosong' })
} else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Tanggal Berakhir tidak boleh kosong' })
} else {
let payload = {
"business_unit_id": this.state.id,
"business_unit_name": this.state.name,
......@@ -63,7 +82,17 @@ export default class CreateUnitBisnis extends Component {
"end_date": this.state.endDate
}
this.props.updateUnitBisnis(payload)
} else if (this.props.type == 'create') {
}
}
validasiCreate() {
if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Unit Bisnis tidak boleh kosong' })
} else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Tanggal Mulai tidak boleh kosong' })
} else if (R.isEmpty(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Tanggal Berakhir tidak boleh kosong' })
} else {
let payload = {
"business_unit_name": this.state.name,
"start_date": this.state.startDate,
......@@ -71,7 +100,6 @@ export default class CreateUnitBisnis extends Component {
}
this.props.createUnitBisnis(payload)
}
}
renderEdit() {
......@@ -140,7 +168,8 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
error={this.state.errorStartDate}
helperText={this.state.msgErrorStartDate}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
......@@ -196,7 +225,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
onChange={(e) => this.setState({ name: e.target.value })}
error={this.state.errorName}
helperText={this.state.msgErrorName}
onChange={(e) => this.setState({ name: e.target.value }, () => this.clearError())}
>
</TextField>
</div>
......@@ -206,6 +237,9 @@ export default class CreateUnitBisnis extends Component {
id="startDate"
label="Berakhir Hingga"
format="dd MMMM yyyy"
error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate}
minDate={this.state.startDate}
value={this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
......@@ -222,7 +256,6 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
......@@ -323,7 +356,8 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
error={this.state.errorStartDate}
helperText={this.state.msgErrorStartDate}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
......@@ -373,7 +407,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
onChange={(e) => this.setState({ name: e.target.value })}
error={this.state.errorName}
helperText={this.state.msgErrorName}
onChange={(e) => this.setState({ name: e.target.value }, () => this.clearError())}
>
</TextField>
</div>
......@@ -383,6 +419,9 @@ export default class CreateUnitBisnis extends Component {
id="endDate"
label="Berakhir Hingga"
format="dd MMMM yyyy"
error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate}
minDate={this.state.startDate}
value={this.state.endDate == "" ? null : this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
......@@ -421,7 +460,7 @@ export default class CreateUnitBisnis extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
onClick={() => this.validasi()}
onClick={() => this.validasiCreate()}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
......
......@@ -17,7 +17,7 @@ const routes = [
main: HomePage
},
{
path: "/home/userrole",
path: "/home/user-role",
main: UserRole
},
{
......@@ -29,7 +29,7 @@ const routes = [
main: ReportItems
},
{
path: "/home/budget-tahunan",
path: "/home/master-budget",
main: BalanceSheet
},
{
......@@ -37,7 +37,7 @@ const routes = [
main: Profile
},
{
path: "/home/perusahaan",
path: "/home/company",
main: Perusahaan
},
{
......@@ -45,15 +45,15 @@ const routes = [
main: User
},
{
path: "/home/unit-bisnis",
path: "/home/business-unit",
main: UnitBisnis
},
{
path: "/home/parameter",
path: "/home/parameters",
main: Parameter
},
{
path: "/home/dashboard-cat",
path: "/home/cat-dashboard",
main: DashboardCAT
},
{
......
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