Browse Source

Merge pull request 'upload 2024-04-23' (#80) from staging into master

Reviewed-on: ibnu/generic-ospro-frontend#80
pull/1/head
farhantock 8 months ago
parent
commit
4a699c16d5
  1. 8
      src/views/MapMonitoring/index.js
  2. 8
      src/views/Report/k3/DialogForm.js
  3. 7
      src/views/Report/k3/index.js
  4. 4
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  5. 9
      src/views/SimproV2/CreatedProyek/ImportActivity/index.js
  6. 13
      src/views/SimproV2/CreatedProyek/index.js
  7. 13
      src/views/SimproV2/Presence/DialogFoto.js
  8. 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({

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

@ -3,7 +3,9 @@ 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';
import moment from 'moment';
export default class DialogForm extends Component { export default class DialogForm extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -43,7 +45,7 @@ export default class DialogForm extends Component {
} }
renderForm = () => { renderForm = () => {
const { dataImage } = this.props; const { dataImage, companyName } = this.props;
return( return(
<div style={{justifyContent:'center'}}> <div style={{justifyContent:'center'}}>
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>
@ -53,7 +55,7 @@ export default class DialogForm extends Component {
<Col span={8}> <Col span={8}>
<Image <Image
style={{width: 150, height: 200}} style={{width: 150, height: 200}}
src={`${BASE_SIMPRO_LUMEN_IMAGE}/${item.image}`} src={`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(item?.image, companyName, moment(item?.created_at).format('YYYY-MM'))}`}
/> />
</Col> </Col>
) )

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>

4
src/views/SimproV2/CreatedProyek/DialogFormProyek.js

@ -281,7 +281,7 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol, currency_symbol: currencySymbol,
currency_code: currencyCode, currency_code: currencyCode,
currency_name: currencyName, currency_name: currencyName,
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id) company_id: role_name !== "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
}; };
data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval }; data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval };
data.imageStructureOrg = organization ? organization : null; data.imageStructureOrg = organization ? organization : null;
@ -312,7 +312,7 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol, currency_symbol: currencySymbol,
currency_code: currencyCode, currency_code: currencyCode,
currency_name: currencyName, currency_name: currencyName,
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id) company_id: role_name !== "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
}; };
data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval }; data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval };
data.imageStructureOrg = organization ? organization : null; data.imageStructureOrg = organization ? organization : null;

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)

13
src/views/SimproV2/CreatedProyek/index.js

@ -203,12 +203,15 @@ const CreatedProyek = ({ params, ...props }) => {
handleGetPhaseProject(); handleGetPhaseProject();
handleGetDivisions(); handleGetDivisions();
handleGetDataPm(); handleGetDataPm();
if(role_name === 'Super Admin') {
getDataProyekCompany();
}
} }
}, [openDialogProyek]); }, [openDialogProyek]);
useEffect(() => {
if(role_name === 'Super Admin') {
getDataProyekCompany();
}
},[])
useEffect(() => { useEffect(() => {
if (parseInt(role_id) === 44) { if (parseInt(role_id) === 44) {
getDataProyekByCustomer() getDataProyekByCustomer()
@ -435,7 +438,7 @@ const CreatedProyek = ({ params, ...props }) => {
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" } { name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" }
); );
} }
if (role_name !== 'Super Admin' && all_project === 'null') { if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') {
payload.columns.push( payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } { name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
); );
@ -1932,7 +1935,7 @@ const CreatedProyek = ({ params, ...props }) => {
dataDivisions={dataDivisions} dataDivisions={dataDivisions}
dataPM={dataPm} dataPM={dataPm}
projectImage={image} projectImage={image}
company_id={companyId} company_id={company_id}
role_name={role_name} role_name={role_name}
companyList={companyList} companyList={companyList}
token={token} token={token}

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

@ -2,20 +2,25 @@ 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, configApp, role_name }) => {
const DialogFoto = ({ openDialog, closeDialog, toggleDialog, dataImage }) => {
const [urlImage, setUrlImage] = useState("") const [urlImage, setUrlImage] = useState("")
const [dateImage, setDateImage] = useState("")
const [companyName, setCompanyName] = useState("")
const [dataReady, setDataReady] = useState(false) const [dataReady, setDataReady] = useState(false)
const [hrName, setHrName] = useState(false) const [hrName, setHrName] = useState(false)
const { t } = useTranslation() const { t } = useTranslation()
useEffect(() => { useEffect(() => {
if (dataImage && dataImage != null) { if (dataImage && dataImage != null) {
setCompanyName(role_name !== "Super Admin" ? JSON.parse(configApp).company_name : "undifined");
setUrlImage(dataImage.url); setUrlImage(dataImage.url);
setDateImage(dataImage.date);
setHrName(dataImage.name); setHrName(dataImage.name);
setDataReady(true) setDataReady(true)
} }
@ -35,7 +40,7 @@ const DialogFoto = ({ openDialog, closeDialog, toggleDialog, dataImage }) => {
<div style={{ width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}> <div style={{ width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Image <Image
width={200} width={200}
src={`${BASE_SIMPRO_LUMEN_IMAGE}/${urlImage}`} src={`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(urlImage, companyName, moment(dateImage).format('YYYY-MM'))}`}
/> />
</div> </div>
</div> </div>

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