Commit 867ddf10 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

parents 02873894 90ca8295
......@@ -483,7 +483,7 @@ export default function MiniDrawer() {
<div style={{ width: '100%', textAlign: '-webkit-center', marginTop: -45, display: 'flex', justifyContent: 'center' }}>
<div className={"sub-color"} style={{ width: 90, height: 90, borderRadius: 50, display: 'flex', justifyContent: 'center' }}>
<div style={{ width: 72, height: 72, backgroundColor: '#838383', borderRadius: 50, alignSelf: 'center' }}>
<img src={userPhoto} style={{ width: 72, height: 72, borderRadius: 50 }} />
{userPhoto === "" ? null : <img src={userPhoto} style={{ width: 72, height: 72, borderRadius: 50 }} />}
</div>
</div>
......
......@@ -75,25 +75,29 @@ class Login extends Component {
"password": this.state.password
}
api.create().login(payload).then((response) => {
if (response.data.status === 'success') {
console.log(response.data.data)
localStorage.setItem(Constant.TOKEN, response.data.data.token)
localStorage.setItem(Constant.USER, response.data.data.user_id)
if (this.state.rememberMe) {
localStorage.setItem(Constant.EMAIL, this.state.email)
localStorage.setItem(Constant.PASSWORD, this.state.password)
// console.log(this.state.email, this.state.password)
if (response.data) {
if (response.data.status === 'success') {
console.log(response.data.data)
localStorage.setItem(Constant.TOKEN, response.data.data.token)
localStorage.setItem(Constant.USER, response.data.data.user_id)
if (this.state.rememberMe) {
localStorage.setItem(Constant.EMAIL, this.state.email)
localStorage.setItem(Constant.PASSWORD, this.state.password)
// console.log(this.state.email, this.state.password)
} else {
localStorage.setItem(Constant.EMAIL, '')
localStorage.setItem(Constant.PASSWORD, '')
}
this.props.history.push('/home/beranda')
} else {
localStorage.setItem(Constant.EMAIL, '')
localStorage.setItem(Constant.PASSWORD, '')
if (response.data.message == 'Kata sandi tidak sesuai.') {
this.setState({ errorPassword: true, msgPassword: response.data.message })
} else {
this.setState({ errorEmail: true, msgEmail: response.data.message })
}
}
this.props.history.push('/home/beranda')
} else {
if (response.data.message == 'Kata sandi tidak sesuai.') {
this.setState({ errorPassword: true, msgPassword: response.data.message })
} else {
this.setState({ errorEmail: true, msgEmail: response.data.message })
}
alert(response.problem)
}
})
}
......@@ -185,7 +189,7 @@ class Login extends Component {
borderColor: 'transparent',
}}
disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false}
// onClick={() => this.validateLogin()}
// onClick={() => this.validateLogin()}
>
<Button name="submit" variant="contained" disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false} style={{ marginTop: 23, width: '100%', height: 35, borderRadius: 4, color: this.state.email.trim() == '' && this.state.password.trim() == '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.email.trim() == '' && this.state.password.trim() == '' ? '#d8d8d8' : '#51c6ea' }}>
<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Login</Typography>
......
......@@ -54,18 +54,22 @@ export default class CreateParameter extends Component {
componentDidMount() {
if (this.props.type === 'edit') {
this.setState({
getSettingTypeID: this.props.data.setting_type_id,
getSettingTypeID: this.props.data[0],
})
this.getDetailParameter()
this.getParameterByGroup(this.props.data.setting_group_id)
} else {
let date = format(new Date, 'yyyy-MM-dd')
this.setState({
startDate: date,
endDate: date
})
this.getDataGroup()
this.getDataPerusahaan()
}
}
getDetailParameter() {
api.create().getDetailParameter(this.props.data.setting_id).then((response) => {
api.create().getDetailParameter(this.props.data[0]).then((response) => {
console.log(response);
if (response.data.status === 'success') {
let data = response.data.data
......@@ -74,7 +78,7 @@ export default class CreateParameter extends Component {
getSettingGroupID: data.setting_group_id,
getCompanyID: data.company_id,
settingType: data.setting_type,
}, () => this.getAllGroup(), this.getPerusahaan())
}, () => this.getAllGroup(), this.getPerusahaan(), this.getParameterByGroup(data.setting_group_id))
} else {
alert(response.data.message)
}
......
......@@ -36,10 +36,11 @@ export default class Parameter extends Component {
getAllParameter() {
api.create().getAllParameter().then(response => {
if (response.data.status === "success") {
console.log(response);
let data = response.data.data
let listData = data.map((item, index) => {
return [
index,
item.setting_id,
item.setting_group,
item.setting_type,
item.company_name,
......@@ -58,15 +59,15 @@ export default class Parameter extends Component {
})
}
openPopUp(index, type) {
openPopUp(rowData, type) {
if (type === 'edit') {
this.setState({
selectIndex: index,
rowData: rowData,
visibleEdit: true
})
} else {
this.setState({
data: this.state.data[index],
rowData: rowData,
visibleCreate: true
})
}
......@@ -510,6 +511,7 @@ export default class Parameter extends Component {
const columns = [{
name: "Action",
options: {
sort: false,
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
......@@ -519,7 +521,8 @@ export default class Parameter extends Component {
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.openPopUp(tableMeta.rowIndex, 'edit')}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
// onClick={()=> console.log(tableMeta)}
>
<img src={Images.editCopy} />
</button>
......@@ -641,8 +644,8 @@ export default class Parameter extends Component {
{this.state.visibleParameter === true ?
<div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center' }}>Parameter</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Parameter</label>
<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 }} />
<InputBase
style={{ width: '100%' }}
......@@ -652,7 +655,7 @@ export default class Parameter extends Component {
inputProps={{ 'aria-label': 'naked' }}
/>
</div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex' }}>
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
......@@ -773,7 +776,7 @@ export default class Parameter extends Component {
<CreateParameter
type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.data[this.state.selectIndex]}
data={this.state.rowData}
updateParameter={this.updateParameter.bind(this)}
/>
)}
......
......@@ -112,7 +112,7 @@ export default class CreatePerusahaan extends Component {
return (
<div className="test app-popup-show" style={{ paddingTop: 100 }}>
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x" style={{ backgroundColor: '#51c6ea', height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Create Data</span>
......@@ -230,8 +230,8 @@ export default class CreatePerusahaan extends Component {
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Typography style={{ fontSize: 11 }}>Dibuat : Admin - 21 Jul 2020, 18:45</Typography>
<Typography style={{ fontSize: 11 }}>Diubah : Admin - 21 Jul 2020, 18:45</Typography>
<Typography style={{ fontSize: 11 }}>Dibuat : </Typography>
<Typography style={{ fontSize: 11 }}>Diubah : </Typography>
</div>
</div>
......
......@@ -13,11 +13,13 @@ export default class EditPerusahaan extends Component {
this.state = {
id: '',
company: '',
companyID: '',
parent: '',
unitBisnis: '',
totalReport: '',
startDate: '',
endDate: '',
status: '',
types: null,
getTypes: null,
perusahaan: null,
......@@ -166,7 +168,7 @@ export default class EditPerusahaan extends Component {
return (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x" style={{ backgroundColor: '#51c6ea', height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Ubah Data</span>
......@@ -189,7 +191,7 @@ export default class EditPerusahaan extends Component {
<div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
value={this.state.businessID}
value={this.state.companyID}
id="id"
label="ID"
disabled
......
This diff is collapsed.
......@@ -143,8 +143,10 @@ export default class VisualReportItems extends Component {
}
api.create().getItemReportHierarki(payload).then((response) => {
console.log(response.data)
if (response.data.status == 'success') {
this.setState({ items: response.data.data })
if (response.data) {
if (response.data.status == 'success') {
this.setState({ items: response.data.data })
}
}
})
}
......@@ -219,7 +221,7 @@ export default class VisualReportItems extends Component {
id="report"
onChange={(event, newInputValue) => this.setState({ report: newInputValue }, () => this.getItemHierarki())}
debug
disableClearable
renderInput={(params) => <TextField {...params} label="Jenis Laporan" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.report}
/>
......@@ -230,8 +232,8 @@ export default class VisualReportItems extends Component {
id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => this.getItemHierarki())}
debug
renderInput={(params) => <TextField {...params} label="Compan" margin="normal" style={{ marginTop: 7 }} />}
disableClearable
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company}
/>
</div>
......
......@@ -119,9 +119,9 @@ export default class CreateUnitBisnis extends Component {
validasiCreate() {
if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Unit Bisnis tidak boleh kosong' })
} else if (R.isEmpty(this.state.startDate)) {
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Berlaku Mulai tidak boleh kosong' })
} else if (R.isEmpty(this.state.endDate)) {
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Berkahir Hingga tidak boleh kosong' })
} else {
let payload = {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -100,6 +100,7 @@ class UserRole extends Component {
name: "Action",
options: {
customBodyRender: (val, tableMeta) => {
console.log(tableMeta);
return (
<div style={{ display: 'flex' }}>
<button
......@@ -112,7 +113,7 @@ class UserRole extends Component {
onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })}
>
<div style={{ display: 'flex' }}>
{tableMeta.rowData[4] === "Aktif" ?
{tableMeta.rowData[2] !== "superadmin" && tableMeta.rowData[4] === "Aktif" ?
<img src={Images.editCopy} /> :
null
}
......
......@@ -52,6 +52,16 @@ export default class AddRole extends Component {
componentDidMount() {
this.getMenu()
if (this.props.type === 'edit') {
//
} else {
let date = format(new Date, 'yyyy-MM-dd')
console.log(date);
this.setState({
startDate: date,
endDate: date
})
}
}
handleChange(e, type) {
......@@ -266,6 +276,19 @@ export default class AddRole extends Component {
variant="filled"
value={'-'}
onChange={(e) => null}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -287,6 +310,19 @@ export default class AddRole extends Component {
error={this.state.errorRoleName}
helperText={this.state.msgErrorRN}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
// defaultValue="Default Value"
// helperText="Some important text"
/>
......@@ -309,6 +345,19 @@ export default class AddRole extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -330,6 +379,19 @@ export default class AddRole extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -348,6 +410,20 @@ export default class AddRole extends Component {
// id="outlined-read-only-input"
variant="filled"
value={'Aktif'}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......
......@@ -274,6 +274,19 @@ export default class EditRole extends Component {
variant="filled"
value={this.state.tempData === null ? '' : this.state.tempData.role_id}
onChange={(e) => null}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -295,6 +308,19 @@ export default class EditRole extends Component {
error={this.state.errorRoleName}
helperText={this.state.msgErrorRN}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
// defaultValue="Default Value"
// helperText="Some important text"
/>
......@@ -317,6 +343,19 @@ export default class EditRole extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -338,6 +377,19 @@ export default class EditRole extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -356,6 +408,19 @@ export default class EditRole extends Component {
// id="outlined-read-only-input"
variant="filled"
value={this.state.tempData === null ? '' : this.state.tempData.status}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......
......@@ -253,18 +253,8 @@ export default class Profile extends Component {
};
async onDrop(pictureFiles) {
let formData = new FormData()
formData.append('file', pictureFiles[0])
let response = await api.create().uploadFoto(formData)
if (response.data) {
if (response.data.status === "success") {
this.setState({ uploadVisible: false }, () => {
alert(response.data.message)
this.getUser()
window.location.reload()
})
}
}
console.log(pictureFiles);
this.setState({ pictures: pictureFiles })
// console.log(response);
// console.log(pictureFiles);
// console.log(pictureDataURLs);
......@@ -273,6 +263,23 @@ export default class Profile extends Component {
// });
}
async uploadFoto(){
let formData = new FormData()
formData.append('file', this.state.pictures[0])
api.create().uploadFoto(formData).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({ uploadVisible: false }, () => {
alert(response.data.message)
this.getUser()
window.location.reload()
})
}
}
})
}
render() {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
......@@ -487,11 +494,21 @@ export default class Profile extends Component {
</div>
<ImageUploader
withIcon={true}
buttonText='Choose images'
withPreview
buttonText='Pilih Gambar'
onChange={this.onDrop}
imgExtension={['.jpg', '.gif', '.png', '.gif', '.jpeg']}
maxFileSize={5242880}
maxFileSize={1000000}
label={"Max file size: 1 Mb, accepted: jpg or png"}
/>
{this.state.pictures.length > 0 ?
<div style={{ display: 'grid', margin: 20 }}>
<div style={{ justifySelf: 'center' }}>
<span className="main-color" style={{ color: '#fff', padding: 20, paddingBottom: 10, paddingTop: 10, borderRadius: 15, cursor: 'pointer' }} onClick={() => this.uploadFoto()}>Upload Foto</span>
</div>
</div> : null
}
</div>
</div>
)}
......
......@@ -124,7 +124,7 @@ class Upload extends Component {
onClick={this.state.uploadProgress === true ? null : this.onRemove}
className="btn btn-small-circle btn-black"
type="button">
<i className="fa fa-1x fa-times" />
<img src={Images.close} />
</button>
</div>
<div className="width width-full margin-left-10px">
......
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