Commit da640e9d authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

update dikit

See merge request !694
parents d40354e1 12acda4b
......@@ -5,6 +5,7 @@ import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import NumberFormat from 'react-number-format';
import { PropagateLoader } from 'react-spinners';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -259,7 +260,7 @@ export default class FixedAssetsMovementMR extends Component {
</TableCell>
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 300 }}>
{console.log(tableMeta)}
......@@ -267,22 +268,22 @@ export default class FixedAssetsMovementMR extends Component {
tableMeta.rowData[24].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : value}</span>
</LightTooltip>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
tableMeta.rowData[4] === 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : value).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : value}</span>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
tableMeta.rowData[4] === 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : value).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : value}</span>
</div>
}
</div>
......@@ -318,8 +319,20 @@ export default class FixedAssetsMovementMR extends Component {
<div className="grid grid-3x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -332,56 +345,86 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)}
value={Number(tableMeta.rowData[6]).toFixed(1)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 5 ?
null
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
value={Number(tableMeta.rowData[7]).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
null
:
null
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[7]
/>
</div> :
null
}
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[8]
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[8]).toFixed(1)}
/>
}
/>
</div> :
null
}
</div>
</div>
......@@ -399,13 +442,40 @@ export default class FixedAssetsMovementMR extends Component {
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 6 ?
tableMeta.rowData[9] :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[9]).toFixed(1)}
/>
}
/>
</div> :
null
}
</div>
......@@ -462,7 +532,7 @@ export default class FixedAssetsMovementMR extends Component {
</th>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div>
<div className="grid grid-3x content-center">
......@@ -470,17 +540,75 @@ export default class FixedAssetsMovementMR extends Component {
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[10]
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[10]).toFixed(1)}
/>
}
/>
</div> :
null
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[11]
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[11]).toFixed(1)}
/>
}
/>
</div> :
null
}
</div>
</div>
......@@ -490,17 +618,75 @@ export default class FixedAssetsMovementMR extends Component {
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[12]
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[12]).toFixed(1)}
/>
}
/>
</div> :
null
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[13]
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[13]).toFixed(1)}
/>
}
/>
</div> :
null
}
</div>
</div>
......@@ -510,17 +696,75 @@ export default class FixedAssetsMovementMR extends Component {
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[14]
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[14]).toFixed(1)}
/>
}
/>
</div> :
null
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 1 ?
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[15]
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[15]).toFixed(1)}
/>
}
/>
</div> :
null
}
</div>
</div>
......@@ -573,6 +817,17 @@ export default class FixedAssetsMovementMR extends Component {
}
}]
const loadingComponent = (
<div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
......@@ -644,14 +899,16 @@ export default class FixedAssetsMovementMR extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTable}
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
{/* <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography> */}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
......@@ -674,6 +931,79 @@ export default class FixedAssetsMovementMR extends Component {
</div>
</button>
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ? */}
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
{/* : null
} */}
</div>
</Paper>
</div>
......
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