|
|
|
@ -6,7 +6,7 @@ import { Button, Table, Form, Upload, Tooltip, Alert, Spin } from 'antd';
|
|
|
|
|
import { InboxOutlined, UploadOutlined } from '@ant-design/icons'; |
|
|
|
|
import {OutTable, ExcelRenderer} from 'react-excel-renderer'; |
|
|
|
|
import './table.css'; |
|
|
|
|
import { BASE_OSPRO } from '../../../../const/ApiConst'; |
|
|
|
|
import { BASE_OSPRO, ASSIGN_HR_PROJECT_SEARCH } from '../../../../const/ApiConst'; |
|
|
|
|
import { Prompt } from 'react-router-dom'; |
|
|
|
|
//
|
|
|
|
|
const config = { |
|
|
|
@ -91,10 +91,52 @@ const ImportActivity = ({ params }) => {
|
|
|
|
|
const pageName = params.name; |
|
|
|
|
|
|
|
|
|
const [dataTable, setDatatable] = useState([]) |
|
|
|
|
const [dataUserToProject, setdataUserToProject] = useState([]) |
|
|
|
|
//
|
|
|
|
|
const [isMovePage, setIsMovePage] = useState(false); |
|
|
|
|
const [isPreview, setIsPreview] = useState(false); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
getDataAssignHr(); |
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
const getDataAssignHr = async () => { |
|
|
|
|
let url = window.location.href; |
|
|
|
|
let urlSplitted = url.split('/') |
|
|
|
|
const payload = { |
|
|
|
|
"paging": { |
|
|
|
|
"start": 0, |
|
|
|
|
"length": -1 |
|
|
|
|
}, |
|
|
|
|
"columns": [ |
|
|
|
|
{ "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" }, |
|
|
|
|
{ "name": "proyek_id", "logic_operator": "=", "value": urlSplitted[6] } |
|
|
|
|
], |
|
|
|
|
"joins": [ |
|
|
|
|
{ "name": "m_users", "column_join": "user_id", "column_results": ["name", "ktp_number"] }, |
|
|
|
|
{ "name": "m_role_proyek", "column_join": "project_role", "column_results": ["name"] }, |
|
|
|
|
], |
|
|
|
|
"orders": { |
|
|
|
|
"columns": [ |
|
|
|
|
"id" |
|
|
|
|
], |
|
|
|
|
"ascending": false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const URL = ASSIGN_HR_PROJECT_SEARCH |
|
|
|
|
const result = await axios |
|
|
|
|
.post(URL, payload, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
let dataRes = result.data.data || [] |
|
|
|
|
setdataUserToProject(dataRes); |
|
|
|
|
} else { |
|
|
|
|
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const fileHandler = (file) => { |
|
|
|
|
setIsMovePage(true); |
|
|
|
|
if(file.name.slice(file.name.lastIndexOf('.')+1) === "xlsx"){ |
|
|
|
@ -152,6 +194,15 @@ const ImportActivity = ({ params }) => {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(["nik"].includes(prop)){ |
|
|
|
|
if(columnData){ |
|
|
|
|
let index = dataUserToProject.findIndex((x) => columnData == x.join_first_ktp_number);
|
|
|
|
|
if(index >= 0) { |
|
|
|
|
columnData = dataUserToProject[index].join_first_ktp_number; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(prop == 'weight'){ |
|
|
|
|
if (columnData == null) { |
|
|
|
|
columnData = 0; |
|
|
|
|