Commit 2ef279e1 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'riri' into 'master'

forgot password

See merge request !53
parents df021479 6b5fe381
......@@ -23,9 +23,18 @@ class ForgotPassword extends Component {
}
}
isEmail(email) {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
validateEmail() {
var isEmail = this.isEmail(this.state.email)
if (this.state.email.trim() == "") {
this.setState({ errorEmail: true, msgEmail: 'Email harus diisi!' })
} else if (!isEmail) {
this.setState({ errorEmail: true, msgEmail: 'Format email tidak sesuai!' })
} else {
this.verification()
}
......@@ -40,9 +49,7 @@ class ForgotPassword extends Component {
if(response.data.status === 'success') {
this.props.history.push('/email-verification')
} else {
if (response.data.message == 'Akun Tidak Ditemukan!') {
this.setState({ errorEmail: true, msgEmail: response.data.message })
}
}
})
}
......
import React, { Component } from 'react';
import { Typography, InputAdornment, IconButton } from '@material-ui/core';
import TextField from "@material-ui/core/TextField";
import Images from '../assets/Images';
import MUIDataTable from "mui-datatables";
import SearchIcon from '@material-ui/icons/Search';
class ItemLaporan extends Component {
render() {
const columns = [{
name: "Action",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => null}
>
<img src={Images.editCopy} />
</button>
</div >
);
}
}
}, "ID", "Tipe Persetujuan", "Order", "Nama Pemberi Persetujuan", "Operator", "Status"]
const data = [
["", "1", "Yearly", "1", "John Doe", "-", "Aktif"],
["", "2", "Yearly", "2", "John Doe", "-", "Aktif"],
["", "3", "Yearly", "2", "John Doe", "AND", "Aktif"],
["", "4", "Yearly", "2", "John Doe", "AND", "Non Aktif"],
["", "5", "Yearly", "3", "John Doe", "-", "Non Aktif"],
]
const options = {
filter: false,
sort: false,
responsive: "scroll",
print: false,
download: false,
selectableRows: false,
viewColumns: false,
rowsPerPage: 5,
search: false
}
return (
<div style={{ flex: 1 }}>
<div style={{ height: 150, width: '100%', backgroundColor: '#354960', padding: 24, paddingTop: 30 }}>
<div style={{ display: 'flex' }}>
<Typography style={{ paddingTop: 8, paddingBottom: 7, fontSize: '16px', color: 'white' }}>Master Data - Approval Matrix</Typography>
<form style={{ marginLeft: 110}}>
<TextField
id="search"
label=""
variant="outlined"
size="small"
placeholder="Search"
style={{ width: 423, backgroundColor: 'white', borderRadius: 6 }}
InputProps={{
startAdornment: <InputAdornment position="start"><img src={Images.searchBlack} style={{marginRight: 6}} /></InputAdornment>,
}}
/>
</form>
<div style={{ display: 'flex' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 82,
padding: 0
}}
onClick={() => null}
>
<img src={Images.template} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
onClick={() => null}
>
<img src={Images.upload} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
onClick={() => null}
>
<img src={Images.download} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
onClick={() => null}
>
<img src={Images.visualisasi} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
onClick={() => null}
>
<img src={Images.add} />
</button>
</div >
</div>
</div>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<div>
<MUIDataTable
data={data}
columns={columns}
options={options}
/>
</div>
</div>
</div>
);
}
}
export default ItemLaporan;
\ No newline at end of file
import React, { Component } from "react";
import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import SearchIcon from '@material-ui/icons/Search';
import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables";
import { TextField, InputBase } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer';
import CreateItemLaporan from "./formItemLaporan/CreateItemLaporan";
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions();
const options2 = ct.customOptions2();
export default class ItemLaporan extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: [],
listData: [],
data: [],
add: false,
edit: false
}
}
closeEdit() {
this.setState({edit: false})
}
closeAdd() {
this.setState({add: false})
}
render() {
const columns = [{
name: "Action",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => null}
>
<img src={Images.editCopy} />
</button>
</div >
);
}
}
}, "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"],
["", "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"],
["", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-"],
]
const options = {
filter: false,
sort: false,
responsive: "scroll",
print: false,
download: false,
selectableRows: false,
viewColumns: false,
rowsPerPage: 5,
search: false
}
return (
<div style={{ height: this.props.height }}>
{/* <Row> */}
<div style={{ height: 199, backgroundColor: '#354960', width: '100%' }} />
<div>
<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 Laporan</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5 }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase
style={{ width: '100%' }}
placeholder="Search"
value={""}
onChange={(e) => this.handleInputChange(e)}
inputProps={{ 'aria-label': 'naked' }}
/>
</div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex' }}>
<img src={Images.template} />
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
<img src={Images.download} />
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
>
<img src={Images.visualisasi} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.setState({ add: true })}
>
<img src={Images.add} />
</button>
</div>
</div>
<div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
theme={getMuiTheme()}
data={data}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
</div>
{this.state.add && (
<CreateItemLaporan
onClickClose={this.closeAdd.bind(this)}
data={this.state.indexData}
/>
)}
</div>
);
}
}
This diff is collapsed.
......@@ -16,8 +16,8 @@ class ResetPassword extends Component {
showPass2: false,
errorPassword: false,
errorConfirmPassword: false,
msgPassword: '',
msgConfirmPassword: '',
msgPassword: 'Terdiri 8 karakter dengan kombinasi angka.',
msgConfirmPassword: 'Terdiri 8 karakter dengan kombinasi angka.',
userId: 0
}
}
......@@ -29,13 +29,27 @@ class ResetPassword extends Component {
// console.log(this.props)
}
validateReset() {
if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'Password harus diisi!' })
} else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'Password minimal 8 karakter!' })
} else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Konfirmasi Password harus diisi!' })
} else if (this.state.confirmPassword.length < 8) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Konfirmasi Password minimal 8 karakter!' })
} else {
this.confirmPassword()
}
}
confirmPassword() {
let payload = {
"password": this.state.password,
"confirmPassword": this.state.confirmPassword,
"userId": this.state.userId
"confirm_password": this.state.confirmPassword,
"user_id": this.state.userId
}
api.create().confirmPassword(payload).then((response) => {
api.create().resetPassword(payload).then((response) => {
if(response.data.status === 'success') {
alert('success')
this.props.history.push('/login')
......@@ -49,9 +63,9 @@ class ResetPassword extends Component {
let data = this.state
this.setState({...data, [e.target.name] : e.target.value})
if (e.target.name == "password") {
this.setState({ errorPassword: false, msgPassword: '' })
} else if (e.target.name) {
this.setState({ errorConfirmPassword: false, msgConfirmPassword: '' })
this.setState({ errorPassword: false, msgPassword: 'Terdiri 8 karakter dengan kombinasi angka.' })
} else if (e.target.name == "confirmPassword") {
this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Terdiri 8 karakter dengan kombinasi angka.' })
}
}
......@@ -73,7 +87,7 @@ class ResetPassword extends Component {
variant="outlined"
error={this.state.errorPassword}
style={{ width: 250, height: 51, marginTop: 32 }}
helperText={<Typography style={{fontSize: 9, marginTop: 4, fontFamily: 'Nunito Sans, sans-serif'}}>Terdiri 8 karakter dengan kombinasi angka.</Typography>}
helperText={<Typography style={{fontSize: 9, marginTop: 4, fontFamily: 'Nunito Sans, sans-serif'}}>{this.state.msgPassword}</Typography>}
InputProps={{
endAdornment: <InputAdornment position="end">
<IconButton
......@@ -99,8 +113,8 @@ class ResetPassword extends Component {
}}
variant="outlined"
error={this.state.errorConfirmPassword}
style={{ width: 250, height: 51, marginTop: 30 }}
helperText={<Typography style={{fontSize: 9, marginTop: 4, fontFamily: 'Nunito Sans, sans-serif'}}>Terdiri 8 karakter dengan kombinasi angka.</Typography>}
style={{ width: 250, height: 51, marginTop: 40 }}
helperText={<Typography style={{fontSize: 9, marginTop: 4, fontFamily: 'Nunito Sans, sans-serif'}}>{this.state.msgConfirmPassword}</Typography>}
InputProps={{
endAdornment: <InputAdornment position="end">
<IconButton
......@@ -115,7 +129,7 @@ class ResetPassword extends Component {
}}
/>
<Button name="submit" variant="contained" disabled={this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? true : false} onClick={() => this.confirmPassword()} style={{ marginTop: 30, width: '100%', height: 35, borderRadius: 4, color: this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? '#d8d8d8' : '#51c6ea' }}>
<Button name="submit" variant="contained" disabled={this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? true : false} onClick={() => this.validateReset()} style={{ marginTop: 40, width: '100%', height: 35, borderRadius: 4, color: this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? '#d8d8d8' : '#51c6ea' }}>
<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Lanjut</Typography>
</Button>
</div>
......
......@@ -7,9 +7,9 @@ import BudgetTahunan from '../container/BudgetTahunan';
import HomePage from '../container/HomePage';
import BalanceSheet from '../container/BudgetTahunan/BalanceSheet';
import Profile from '../container/Profile';
import ItemLaporan from '../container/ItemLaporan';
import Perusahaan from '../container/MasterData/Perusahaan/Perusahaan'
import Perusahaan from '../container/MasterData/Perusahaan/Perusahaan';
import UnitBisnis from '../container/MasterData/UnitBisnis'
import ItemLaporan from '../container/MasterData/ItemLaporan'
import Parameter from '../container/MasterData/Parameter/Parameter'
const routes = [
......
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