Browse Source

update cluster directory

pull/1/head
wahyun 8 months ago
parent
commit
a06e4d2f22
  1. 8
      src/views/MapMonitoring/index.js
  2. 170
      src/views/Report/k3/DialogForm.js
  3. 7
      src/views/Report/k3/index.js
  4. 9
      src/views/SimproV2/CreatedProyek/ImportActivity/index.js
  5. 123
      src/views/SimproV2/Presence/DialogFoto.js
  6. 8
      src/views/SimproV2/Presence/index.js

8
src/views/MapMonitoring/index.js

@ -15,7 +15,7 @@ import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
import { ToastContainer, toast } from "react-toastify"; import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css"; import "react-toastify/dist/ReactToastify.css";
import './MapMonitoring.css'; import './MapMonitoring.css';
import { BASE_SIMPRO_LUMEN_IMAGE, PROYEK_SEARCH } from '../../const/ApiConst'; import { BASE_SIMPRO_LUMEN_IMAGE_COMPANY } from '../../const/ApiConst';
import DEFAULT_USER_ICON from '../../assets/img/avatars/user.png'; import DEFAULT_USER_ICON from '../../assets/img/avatars/user.png';
import pinRouteStart from '../../assets/img/map/pin_route_green.png'; import pinRouteStart from '../../assets/img/map/pin_route_green.png';
import pinRouteEnd from '../../assets/img/map/pin_route_red.png'; import pinRouteEnd from '../../assets/img/map/pin_route_red.png';
@ -27,8 +27,9 @@ import 'leaflet-control-geocoder/dist/Control.Geocoder.css'
import 'leaflet-control-geocoder/dist/Control.Geocoder.js' import 'leaflet-control-geocoder/dist/Control.Geocoder.js'
import moment from 'moment'; import moment from 'moment';
import axios from "../../const/interceptorApi"; import axios from "../../const/interceptorApi";
const MapMonitoring = ({ ...props }) => { const MapMonitoring = ({ ...props }) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name=''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='', configApp={};
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
@ -40,6 +41,7 @@ const MapMonitoring = ({ ...props }) => {
isLogin = props.isLogin; isLogin = props.isLogin;
hierarchy = props.hierarchy; hierarchy = props.hierarchy;
user_name = props.user_name; user_name = props.user_name;
configApp = props.configApp;
} }
const HEADER = { const HEADER = {
headers: { headers: {
@ -223,7 +225,7 @@ const MapMonitoring = ({ ...props }) => {
const pointToLayerUserPoints = (feature, latlng) => { const pointToLayerUserPoints = (feature, latlng) => {
let imgSrc = DEFAULT_USER_ICON; let imgSrc = DEFAULT_USER_ICON;
if (feature && feature.properties && feature.properties.image && feature.properties.image !== '') { if (feature && feature.properties && feature.properties.image && feature.properties.image !== '') {
imgSrc = `${BASE_SIMPRO_LUMEN_IMAGE}/${feature.properties.image}` imgSrc = `${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(feature.properties.image, JSON.parse(configApp).company_name, moment(feature.properties.created_at).format('YYYY-MM'))}`
} }
let img = `<img src="${imgSrc}" />` let img = `<img src="${imgSrc}" />`
let logoMarker = L.divIcon({ let logoMarker = L.divIcon({

170
src/views/Report/k3/DialogForm.js

@ -1,84 +1,86 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form, FormGroup, Label, Input } from 'reactstrap'; import { Button, Form, FormGroup, Label, Input } from 'reactstrap';
import { Image, Col, Row } from 'antd'; import { Image, Col, Row } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { BASE_SIMPRO_LUMEN_IMAGE } from '../../../const/ApiConst.js'; import { BASE_SIMPRO_LUMEN_IMAGE_COMPANY } from '../../../const/ApiConst.js';
export default class DialogForm extends Component { import moment from 'moment';
constructor(props) {
super(props) export default class DialogForm extends Component {
this.state = { constructor(props) {
id: 0, super(props)
url:"", this.state = {
ready:false, id: 0,
isParentClick: false, url:"",
} ready:false,
} isParentClick: false,
}
async componentDidMount(){ }
this.props.showDialog(this.showDialog);
} async componentDidMount(){
this.props.showDialog(this.showDialog);
async componentDidUpdate (){ }
if(this.state.isParentClick===true){
this.setState({ready:false}) async componentDidUpdate (){
const { dataImage } = this.props if(this.state.isParentClick===true){
this.setState({ this.setState({ready:false})
url:dataImage, const { dataImage } = this.props
},() => { this.setState({
this.setState({ready:true}); url:dataImage,
}); },() => {
this.setState({isParentClick:false}); this.setState({ready:true});
} });
} this.setState({isParentClick:false});
}
}
showDialog = () => {
this.setState({ isParentClick : true });
} showDialog = () => {
this.setState({ isParentClick : true });
handleCancel = () => { }
this.setState({ready:false})
this.props.closeDialog('cancel', 'none') handleCancel = () => {
} this.setState({ready:false})
this.props.closeDialog('cancel', 'none')
renderForm = () => { }
const { dataImage } = this.props;
return( renderForm = () => {
<div style={{justifyContent:'center'}}> const { dataImage, companyName } = this.props;
<Row gutter={[16, 16]}> return(
<Image.PreviewGroup> <div style={{justifyContent:'center'}}>
{ <Row gutter={[16, 16]}>
dataImage && dataImage.length > 0 && dataImage.map((item, idx) => <Image.PreviewGroup>
<Col span={8}> {
<Image dataImage && dataImage.length > 0 && dataImage.map((item, idx) =>
style={{width: 150, height: 200}} <Col span={8}>
src={`${BASE_SIMPRO_LUMEN_IMAGE}/${item.image}`} <Image
/> style={{width: 150, height: 200}}
</Col> src={`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(item?.image, companyName, moment(item?.created_at).format('YYYY-MM'))}`}
) />
} </Col>
</Image.PreviewGroup> )
}
{ !dataImage || (dataImage && dataImage.length < 1) && <div style={{textAlign: 'center', color: 'red', flex: 1, padding: 20}}>No image available</div> } </Image.PreviewGroup>
</Row>
</div> { !dataImage || (dataImage && dataImage.length < 1) && <div style={{textAlign: 'center', color: 'red', flex: 1, padding: 20}}>No image available</div> }
) </Row>
} </div>
)
render() { }
return (
<Modal isOpen={this.props.openDialog} toggle={this.props.toggleDialog}> render() {
<ModalHeader toggle={this.props.closeDialog}>Lihat Foto Laporan K3</ModalHeader> return (
<ModalBody> <Modal isOpen={this.props.openDialog} toggle={this.props.toggleDialog}>
{this.state.ready ? <ModalHeader toggle={this.props.closeDialog}>Lihat Foto Laporan K3</ModalHeader>
this.renderForm() <ModalBody>
: null} {this.state.ready ?
</ModalBody> this.renderForm()
<ModalFooter> : null}
</ModalBody>
</ModalFooter> <ModalFooter>
</Modal>
) </ModalFooter>
} </Modal>
} )
}
}

7
src/views/Report/k3/index.js

@ -9,7 +9,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { Pagination, Tooltip } from 'antd'; import { Pagination, Tooltip } from 'antd';
import { DatePicker, Select } from 'antd'; import { DatePicker, Select } from 'antd';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { PRESENSI_SEARCH, PROYEK_SEARCH, USERPROYEK_SEARCH, K3_SEARCH, SIMPRO_BASE_IMAGE } from '../../../const/ApiConst.js'; import { PROYEK_SEARCH, K3_SEARCH } from '../../../const/ApiConst.js';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const { Option } = Select const { Option } = Select
@ -26,7 +26,7 @@ const LENGTH_DATA = 10
class index extends Component { class index extends Component {
constructor(props) { constructor(props) {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '', configApp={};
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
@ -38,6 +38,7 @@ class index extends Component {
isLogin = props.isLogin; isLogin = props.isLogin;
hierarchy = props.hierarchy; hierarchy = props.hierarchy;
user_name = props.user_name; user_name = props.user_name;
configApp = props.configApp;
} }
super(props) super(props)
this.config = { this.config = {
@ -77,6 +78,7 @@ class index extends Component {
finishSetupOption: false, finishSetupOption: false,
company_id: company_id, company_id: company_id,
role_name: role_name, role_name: role_name,
companyName: JSON.parse(configApp).company_name,
role_id: role_id, role_id: role_id,
hierarchy: hierarchy hierarchy: hierarchy
} }
@ -583,6 +585,7 @@ class index extends Component {
closeDialog={this.handleCloseDialog} closeDialog={this.handleCloseDialog}
toggleDialog={() => this.toggleAddDialog} toggleDialog={() => this.toggleAddDialog}
dataImage={this.state.dataImage} dataImage={this.state.dataImage}
companyName={this.state.companyName}
showDialog={showDialog => this.showChildDialog = showDialog} showDialog={showDialog => this.showChildDialog = showDialog}
/> />
<Card> <Card>

9
src/views/SimproV2/CreatedProyek/ImportActivity/index.js

@ -150,9 +150,6 @@ const ImportActivity = ({ params }) => {
setLoading(false) setLoading(false)
NotificationManager.error('file harus dalam format .xlsx', 'Failed'); NotificationManager.error('file harus dalam format .xlsx', 'Failed');
} }
// else{
// errorHandler()
// }
return false return false
} }
@ -234,7 +231,7 @@ const ImportActivity = ({ params }) => {
const saveHandler = async (e) => { const saveHandler = async (e) => {
setIsMovePage(true); setIsMovePage(true);
setLoading(true);
let url = window.location.href; let url = window.location.href;
let urlSplitted = url.split('/') let urlSplitted = url.split('/')
const ganttId = urlSplitted[5] const ganttId = urlSplitted[5]
@ -254,9 +251,9 @@ const ImportActivity = ({ params }) => {
if (result.data.code == 200) { if (result.data.code == 200) {
const timestamp = Date.now(); const timestamp = Date.now();
const newTimestamp = timestamp + 60000; const newTimestamp = timestamp + 60000;
window.location = urlSplitted[0] + '//' + urlSplitted[2] + `/#/projects/` + ganttId + '/' + result.data.projectId + '/' + newTimestamp + '/gantt'
setLoading(false) setLoading(false)
}else{ window.location = urlSplitted[0] + '//' + urlSplitted[2] + `/#/projects/` + ganttId + '/' + result.data.projectId + '/' + newTimestamp + '/gantt'
} else {
setLoading(false) setLoading(false)
} }
setLoading(false) setLoading(false)

123
src/views/SimproV2/Presence/DialogFoto.js

@ -1,59 +1,64 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button } from 'reactstrap'; import { Button } from 'reactstrap';
import { Image } from 'antd' import { Image } from 'antd'
import { BASE_SIMPRO_LUMEN_IMAGE } from '../../../const/ApiConst'; import { BASE_SIMPRO_LUMEN_IMAGE_COMPANY } from '../../../const/ApiConst';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import moment from 'moment';
const DialogFoto = ({ openDialog, closeDialog, toggleDialog, dataImage }) => { const DialogFoto = ({ openDialog, closeDialog, toggleDialog, dataImage, configApp, role_name }) => {
const [urlImage, setUrlImage] = useState("") const [urlImage, setUrlImage] = useState("")
const [dataReady, setDataReady] = useState(false) const [dateImage, setDateImage] = useState("")
const [hrName, setHrName] = useState(false) const [companyName, setCompanyName] = useState("")
const { t } = useTranslation() const [dataReady, setDataReady] = useState(false)
useEffect(() => { const [hrName, setHrName] = useState(false)
if (dataImage && dataImage != null) { const { t } = useTranslation()
setUrlImage(dataImage.url);
setHrName(dataImage.name); useEffect(() => {
setDataReady(true) if (dataImage && dataImage != null) {
} setCompanyName(role_name !== "Super Admin" ? JSON.parse(configApp).company_name : "undifined");
}, [dataImage]) setUrlImage(dataImage.url);
setDateImage(dataImage.date);
useEffect(() => { setHrName(dataImage.name);
if (!openDialog) { setDataReady(true)
setUrlImage("") }
setHrName("") }, [dataImage])
setDataReady(false)
} useEffect(() => {
}, [openDialog]) if (!openDialog) {
setUrlImage("")
const renderModalBody = () => { setHrName("")
return ( setDataReady(false)
<div style={{ width: '100%', display: 'flex', justifyContent: 'center', flexDirection: 'column', alignItems: 'flex-start' }}> }
<div style={{ width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}> }, [openDialog])
<Image
width={200} const renderModalBody = () => {
src={`${BASE_SIMPRO_LUMEN_IMAGE}/${urlImage}`} return (
/> <div style={{ width: '100%', display: 'flex', justifyContent: 'center', flexDirection: 'column', alignItems: 'flex-start' }}>
</div> <div style={{ width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
</div> <Image
) width={200}
} src={`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(urlImage, companyName, moment(dateImage).format('YYYY-MM'))}`}
/>
return ( </div>
<Modal isOpen={openDialog} toggle={toggleDialog}> </div>
<ModalHeader className="capitalize" toggle={closeDialog}>{t('imageCheck')} | {t('nameHR')} {hrName}</ModalHeader> )
<ModalBody> }
{dataReady ? renderModalBody() : null}
</ModalBody> return (
<ModalFooter> <Modal isOpen={openDialog} toggle={toggleDialog}>
<Button className="capitalize" color="secondary" onClick={closeDialog}>{t('close')}</Button> <ModalHeader className="capitalize" toggle={closeDialog}>{t('imageCheck')} | {t('nameHR')} {hrName}</ModalHeader>
</ModalFooter> <ModalBody>
</Modal> {dataReady ? renderModalBody() : null}
) </ModalBody>
<ModalFooter>
} <Button className="capitalize" color="secondary" onClick={closeDialog}>{t('close')}</Button>
</ModalFooter>
export default DialogFoto; </Modal>
)
}
export default DialogFoto;

8
src/views/SimproV2/Presence/index.js

@ -12,7 +12,7 @@ import { useTranslation } from 'react-i18next';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const Index = ({ params, ...props }) => { const Index = ({ params, ...props }) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '', configApp = {};
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
@ -24,6 +24,7 @@ const Index = ({ params, ...props }) => {
isLogin = props.isLogin; isLogin = props.isLogin;
hierarchy = props.hierarchy; hierarchy = props.hierarchy;
user_name = props.user_name; user_name = props.user_name;
configApp = props.configApp;
} }
const [dataTable, setDatatable] = useState([]) const [dataTable, setDatatable] = useState([])
@ -129,7 +130,8 @@ const Index = ({ params, ...props }) => {
let dataRes = result.data.data let dataRes = result.data.data
let dataImage = { let dataImage = {
name, name,
url: dataRes.image url: dataRes.image,
date: dataRes.created_at
} }
await setDataImage(dataImage) await setDataImage(dataImage)
setOpenImage(true) setOpenImage(true)
@ -321,6 +323,8 @@ const Index = ({ params, ...props }) => {
closeDialog={closeDialogImage} closeDialog={closeDialogImage}
toggleDialog={toggleDialogImage} toggleDialog={toggleDialogImage}
dataImage={dataImage} dataImage={dataImage}
configApp={configApp}
role_name={role_name}
/> />
<Card> <Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}> <CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

Loading…
Cancel
Save