Browse Source

Merge pull request 'Import Nik' (#46) from dev-wahyu into staging

Reviewed-on: ordo/adw-frontend#46
pull/2/head
ibnu 2 years ago
parent
commit
e94a74061f
  1. 1
      src/routes.js
  2. 14
      src/views/Dashboard/Components/index.js
  3. 2
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  4. 53
      src/views/SimproV2/CreatedProyek/ImportActivity/index.js

1
src/routes.js

@ -57,6 +57,7 @@ const routes = [
{ path: '/dashboard-project/:PROJECT_ID/:GANTT_ID', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/projects', exact: true, name: 'Projects', component: CreatedProyek },
{ path: '/projects/:id/import/activity', exact: true, name: 'Gantt Import Activity', component: GanttImportActivity },
{ path: '/projects/:id/:project/import/activity', exact: true, name: 'Gantt Import Activity', component: GanttImportActivity },
{ path: '/projects/:id/:project/gantt', exact: true, name: 'Gantt', component: Gantt },
{ path: '/human-resource', exact: true, name: 'Human Resource', component: ResourceWorker },
{ path: '/material-resource', exact: true, name: 'Material Resource', component: ResourceMaterial },

14
src/views/Dashboard/Components/index.js

@ -65,7 +65,12 @@ export const ProgressPlanningBar = ({progress}) => {
}
}
else {
return null;
return (
<div style={{backgroundColor: '#DDDDDD', color: '#FFFFFF', borderRadius: 10, marginBottom: 10}}>
<div style={{ backgroundColor: '#0000cc', width: `0%`, padding: 5, borderTopLeftRadius: 10, borderBottomLeftRadius: 10, borderTopRightRadius: 0 < 100 ? 0 : 10, borderBottomRightRadius: 0 < 100 ? 0 : 10, textAlign: 'center', fontWeight: 500, height: 30 }}></div>
<span style={{textAlign: 'center', width: '100%', float: 'left', marginTop: -25, color: '#4e4c4c', fontWeight: 500}}>Planning : 0%</span>
</div>
)
}
}
@ -88,7 +93,12 @@ export const ProgressActualBar = ({progress}) => {
}
}
else {
return null;
return (
<div style={{backgroundColor: '#DDDDDD', color: '#FFFFFF', borderRadius: 10, marginBottom: 10}}>
<div style={{ backgroundColor: '#006600', width: `0%`, padding: 5, borderTopLeftRadius: 10, borderBottomLeftRadius: 10, borderTopRightRadius: 0 < 100 ? 0 : 10, borderBottomRightRadius: 0 < 100 ? 0 : 10, textAlign: 'center', fontWeight: 500, height: 30 }}></div>
<span style={{textAlign: 'center', width: '100%', float: 'left', marginTop: -25, color: '#4e4c4c', fontWeight: 500}}>Actual : 0%</span>
</div>
)
}
}

2
src/views/SimproV2/CreatedProyek/DialogGantt.js

@ -130,7 +130,7 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
<Tooltip title="Gantt Permission">
<Button size={"sm"} color='success' onClick={() => handleUserGant(text.id)}><i className="fa fa-users"></i></Button>
</Tooltip>{" "}
<Link to={`/projects/${text.id}/import/activity`}>
<Link to={`/projects/${text.id}/${idTask}/import/activity`}>
{" "}<Tooltip title="Import Activity">
<Button size={"sm"} color='success'>
<i className="fa fa-file-excel-o"></i>

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

@ -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;

Loading…
Cancel
Save