Browse Source

update colomn company name

pull/1/head
farhantock 11 months ago
parent
commit
21752ca924
  1. 26
      src/views/Master/MasterAbsensi/index.js
  2. 83
      src/views/Master/MasterBroadcast/index.js
  3. 12
      src/views/Master/MasterRoles/index.js
  4. 37
      src/views/Master/ProjectPhase/index.js
  5. 30
      src/views/Report/k3/index.js
  6. 45
      src/views/SimproV2/ChecklistK3/index.js
  7. 12
      src/views/SimproV2/CreatedProyek/index.js
  8. 34
      src/views/SimproV2/Divisi/index.js
  9. 16
      src/views/SimproV2/PanicButton/index.js
  10. 21
      src/views/SimproV2/Presence/index.js
  11. 34
      src/views/SimproV2/ProjectType/index.js
  12. 11
      src/views/SimproV2/ResourceWorker/index.js
  13. 26
      src/views/SimproV2/Satuan/index.js

26
src/views/Master/MasterAbsensi/index.js

@ -55,7 +55,15 @@ class index extends Component {
currentProyek: parseInt(localStorage.getItem('role_id')) === 2 ? parseInt(localStorage.getItem('proyek_id')) : null,
allUserToProyek: [],
allDataProyek: [],
finishSetupOption: false
finishSetupOption: false,
role_name: props.role_name || '',
role_id: props.role_id || 0,
user_id: props.user_id || 0,
isLogin: props.isLogin || false,
token: props.token || '',
all_project: props.all_project || null,
hierarchy: props.hierarchy || [],
user_name: props.user_name || '',
}
}
@ -195,7 +203,14 @@ class index extends Component {
"ascending": false
}
}
if (this.state.role_name === 'Super Admin') {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios
@ -448,6 +463,9 @@ class index extends Component {
Edit
</Tooltip>
</td> */}
{this.state.role_name === 'Super Admin' &&
<td>{n.join_second_company_name ? n.join_second_company_name : ""}</td>
}
<td>{n.join_first_name ? n.join_first_name : ""}</td>
<td>{n.description ? n.description : "-"}</td>
<td>{n.created_at ? moment(n.created_at).format("YYYY-MM-DD") : "-"}</td>
@ -494,10 +512,12 @@ class index extends Component {
render() {
const t = this.props;
const column = [
this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
{ name: this.props.t('nameHR') },
{ name: this.props.t('description') },
{ name: this.props.t('dateAbsent') },
]
].filter(column => column && column.name);
const { tooltipTambah, tooltipExport, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete } = this.state
return (
<div>

83
src/views/Master/MasterBroadcast/index.js

@ -5,7 +5,7 @@ import React, { Component } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert';
import axios from 'axios';
import moment from 'moment';
import { USER_LIST, BASE_SIMPRO_LUMEN, ROLE_LIST } from '../../../const/ApiConst';
import { USER_LIST, BASE_SIMPRO_LUMEN, ROLE_LIST, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst';
import { Button, Card, CardBody, CardHeader, DropdownItem, DropdownMenu, DropdownToggle, Input, InputGroup, InputGroupButtonDropdown, Table, Row, Col } from 'reactstrap';
import { DatePicker, Pagination } from 'antd';
import { NotificationContainer, NotificationManager } from 'react-notifications';
@ -66,6 +66,9 @@ class index extends Component {
totalPage: 0,
typeClock: "All",
typeDialog: 'Save',
role_name: props.role_name || '',
company_id: props.company_id,
listCompany: []
}
}
@ -79,42 +82,22 @@ class index extends Component {
if (startDate !== prevState.startDate) this.getDataBroadcast()
}
handleSearch = e => {
const value = e.target.value
this.setState({ search: value, currentPage: 1 })
};
getDataUsers = async () => {
getDataCompany = async () => {
const result = await axios
.get(USER_LIST, config)
.get(COMPANY_MANAGEMENT_LIST, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.status == 200) {
const dataRes = result.data.data;
const finalData = [];
if (dataRes.length > 0) {
dataRes.map((val, index) => {
let data = {
id: val.id,
name: val.name,
};
finalData.push(data);
});
}
this.setState({ dataUser: finalData });
}
}
getDataRoles = async () => {
const result = await axios
.get(ROLE_LIST, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.status == 200) {
this.setState({ dataRoles: result.data.data });
if (result && result.data && result.data.code == 200) {
this.setState({ listCompany: result.data.data })
}
}
handleSearch = e => {
const value = e.target.value
this.setState({ search: value, currentPage: 1 })
};
getDataBroadcast = async () => {
let url = BASE_SIMPRO_LUMEN + `/broadcast/search`;
@ -141,8 +124,9 @@ class index extends Component {
"name": searchDetailField,
"operator": "AND",
"value": search
}
},
],
"joins": [],
"orders": {
"ascending": false,
"columns": [
@ -155,7 +139,22 @@ class index extends Component {
}
}
if (this.state.search !== "" && this.state.search !== null) {
if (this.state.role_name === 'Super Admin') {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
} else {
payload.columns.push(
{
"name": "company_id",
"logic_operator": "=",
"value": this.state.company_id,
"operator": "AND"
}
)
}
const result = await axios
@ -165,8 +164,7 @@ class index extends Component {
if (result && result.data) {
if (result.data.code === 200) {
this.setState({ dataTable: result.data.data, totalPage: result.data.totalRecord });
this.getDataUsers()
this.getDataRoles()
this.getDataCompany()
} else {
NotificationManager.error('Failed retreiving data!!', 'Failed');
}
@ -214,13 +212,13 @@ class index extends Component {
saveBroadcast = async (type, data) => {
let url = BASE_SIMPRO_LUMEN + `/broadcast/add`;
const param = {
"title_notif": data.title,
"status_send": type,
"send_to_type": "all",
"message_notif": data.message,
"description": data.description,
"company_id": data.company_id
}
const paramRoles = {
@ -229,7 +227,8 @@ class index extends Component {
"send_to_type": "roles",
"message_notif": data.message,
"description": data.description,
"send_to_id": data.id
"send_to_id": data.id,
"company_id": data.company_id
}
const paramUsers = {
@ -238,7 +237,8 @@ class index extends Component {
"send_to_type": "users",
"message_notif": data.message,
"description": data.description,
"send_to_id": data.send_to_type == "users" ? data.id.map((id, index) => id) : null
"send_to_id": data.send_to_type == "users" ? data.id.map((id, index) => id) : null,
"company_id": data.company_id
}
if (data.send_to_type === "all") {
@ -491,6 +491,9 @@ class index extends Component {
</Col>
</Row>
</td>
{this.state.role_name === 'Super Admin' &&
<td>{n.join_first_company_name ? n.join_first_company_name : "-"}</td>
}
<td>{n.title_notif}</td>
<td>{n.message_notif !== "" ? n.message_notif : "-"}</td>
<td>{n.description !== "" ? n.description : "-"}</td>
@ -557,13 +560,14 @@ class index extends Component {
render() {
const column = [
{ name: this.props.t('action') },
this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
{ name: this.props.t('title') },
{ name: this.props.t('message') },
{ name: this.props.t('description') },
{ name: this.props.t('receiver') },
{ name: "Status" },
{ name: this.props.t('date') },
]
].filter(column => column && column.name);
const t = this.props;
const { tooltipTambah, tooltipExport, dataTable, splitButtonOpen, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete, statusSend } = this.state
return (
@ -591,6 +595,9 @@ class index extends Component {
dataEdit={this.state.dataEdit}
showDialog={showDialog => this.showChildDialog = showDialog}
dataHs={this.state.dataIdHo}
company_id={this.state.company_id}
role_name={this.state.role_name}
listCompany={this.state.listCompany}
/>
<DialogDetail
openDialog={this.state.openDialogDetail}

12
src/views/Master/MasterRoles/index.js

@ -78,16 +78,18 @@ class index extends Component {
</Tooltip>
</>,
},
...(this.state.role_name === 'Super Admin'
? [
{
title: this.state.role_name === 'Super Admin' ? "Company Name" : null,
title: this.props.t('company'),
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => {
return this.state.role_name === 'Super Admin' ? (
render: (text, record) => (
<span>{record.join_first_company_name}</span>
) : null;
),
}
},
]
: []),
{ title: this.props.t('nameRole'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: this.props.t('description'), dataIndex: 'description', key: 'description' },
]

37
src/views/Master/ProjectPhase/index.js

@ -6,7 +6,7 @@ import axios from "../../../const/interceptorApi"
import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { PROJECT_PHASE_ADD, PROJECT_PHASE_EDIT, PROJECT_PHASE_DELETE, PROJECT_PHASE_SEARCH, PROJECT_PHASE_LIST, BASE_OSPRO } from '../../../const/ApiConst';
import { PROJECT_PHASE_ADD, PROJECT_PHASE_EDIT, PROJECT_PHASE_DELETE, PROJECT_PHASE_SEARCH, COMPANY_MANAGEMENT_LIST, BASE_OSPRO } from '../../../const/ApiConst';
import { Pagination, Button, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next';
@ -49,6 +49,7 @@ const ProjectPhase = ({ params, ...props }) => {
const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation()
useEffect(() => {
getDataProjectPhase()
@ -61,6 +62,21 @@ const ProjectPhase = ({ params, ...props }) => {
}
}, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getDataProjectPhase = async () => {
let start = 0;
if (currentPage !== 1 && currentPage > 1) {
@ -341,17 +357,19 @@ const ProjectPhase = ({ params, ...props }) => {
</Tooltip>{" "}
</>,
},
{
title: role_name === 'Super Admin' ? "Company Name" : null,
...(role_name === 'Super Admin' ?
[{
title: t('companyName'),
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => {
return role_name === 'Super Admin' ? (
render: (text, record) => (
<span>{record.join_first_company_name}</span>
) : null;
}
)
}]
: []),
{
title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap"
},
{ title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap" },
{
title: t('color'),
dataIndex: 'color',
@ -398,6 +416,9 @@ const ProjectPhase = ({ params, ...props }) => {
dataEdit={dataEdit}
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
listCompany={listCompany}
role_name={role_name}
company_id={company_id}
/>
<Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

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

@ -127,7 +127,7 @@ class index extends Component {
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
if (this.state.role_id !== "Super Admin") {
if (this.state.role_name !== "Super Admin") {
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: this.state.hierarchy, operator: "AND" }
)
@ -207,11 +207,25 @@ class index extends Component {
}
if (currentProyek) {
let proyekPayload = { "name": "proyek_id", "logic_operator": "=", "value": this.state.currentProyek };
payload.columns.push(proyekPayload)
payload.columns.push({ "name": "proyek_id", "logic_operator": "=", "value": this.state.currentProyek })
if (this.state.role_name === "Super Admin") {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
} else {
let proyekPayload = { "name": "proyek_id", "logic_operator": "in", "value": this.state.proyekIds };
payload.columns.push(proyekPayload)
payload.columns.push({ "name": "proyek_id", "logic_operator": "in", "value": this.state.proyekIds })
if (this.state.role_name === "Super Admin") {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
}
const result = await axios
@ -465,6 +479,9 @@ class index extends Component {
{dataTable2.length !== 0 ? dataTable2.map((n) => {
return (
<tr key={n.id}>
{this.state.role_name === 'Super Admin' &&
<td>{n.join_third_company_name ? n.join_third_company_name : "-"}</td>
}
<td>{n.join_first_name ? n.join_first_name : "-"}</td>
<td>{n.join_second_nama ? n.join_second_nama : "-"}</td>
<td>{n.report_date ? moment(n.report_date).format("DD-MM-YYYY") : "-"}</td>
@ -534,6 +551,7 @@ class index extends Component {
render() {
const column = [
this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
{ name: this.props.t('nameHR') },
{ name: this.props.t('projectName') },
{ name: this.props.t('dateReport') },
@ -541,7 +559,7 @@ class index extends Component {
{ name: this.props.t('gearNotUse') },
{ name: this.props.t('description') },
{ name: this.props.t('action') },
]
].filter(column => column && column.name);
const t = this.props;
const { tooltipExport, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete } = this.state
return (

45
src/views/SimproV2/ChecklistK3/index.js

@ -5,15 +5,13 @@ import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi"
import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip } from 'antd';
import { Pagination, Button, Tooltip, } from 'antd';
import {
CHECKLIST_K3_ADD, CHECKLIST_K3_EDIT, CHECKLIST_K3_DELETE, CHECKLIST_K3_SEARCH
CHECKLIST_K3_ADD, CHECKLIST_K3_EDIT, CHECKLIST_K3_DELETE, CHECKLIST_K3_SEARCH, COMPANY_MANAGEMENT_LIST
} from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token');
const role_name = window.localStorage.getItem('role_name');
const company_id = window.localStorage.getItem('company_id');
const config = {
headers:
{
@ -22,8 +20,20 @@ const config = {
}
};
const ChecklistK3 = ({ params }) => {
const token = localStorage.getItem("token")
const ChecklistK3 = ({ params, ...props }) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
hierarchy = props.hierarchy;
user_name = props.user_name;
}
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -45,12 +55,13 @@ const ChecklistK3 = ({ params }) => {
const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation()
const column = [
{ name: "Company Name" },
role_name === 'Super Admin' ? { name: t('company') } : null,
{ name: t('name') },
{ name: t('description') },
]
].filter(column => column && column.name)
useEffect(() => {
getDataChecklistK3()
}, [currentPage, rowsPerPage, search])
@ -62,6 +73,22 @@ const ChecklistK3 = ({ params }) => {
}
}, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getDataChecklistK3 = async () => {
let start = 0;
@ -324,6 +351,8 @@ const ChecklistK3 = ({ params }) => {
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
company_id={company_id}
listCompany={listCompany}
role_name={role_name}
/>
<Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

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

@ -80,6 +80,7 @@ import ReportAnalysis from "./ReportAnalysis";
import { Icon } from "@iconify/react";
// import SubProyekComp from './SubProyekComp';
import { Link, useHistory, withRouter } from "react-router-dom";
import { t } from "i18next";
const url = "";
const format = "DD-MM-YYYY";
@ -1726,16 +1727,15 @@ const CreatedProyek = ({ params, ...props }) => {
</>
),
},
...(role_name === 'Super Admin' ? [
{
title: role_name === 'Super Admin' ? "Company Name" : null,
title: t('company'),
dataIndex: "join_third_company_name",
key: "join_third_company_name",
render: (text, record) => {
return role_name === 'Super Admin' ? (
render: (text, record) => (
<span>{record.join_third_company_name}</span>
) : null;
}
},
)
}] : []),
{ title: "Project Name", dataIndex: "nama", key: "nama" },
{
title: "Budget",

34
src/views/SimproV2/Divisi/index.js

@ -4,19 +4,12 @@ import React, { useState, useEffect } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi"
import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
import { DIVISI_LIST, DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH } from '../../../const/ApiConst';
import { DIVISI_LIST, DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip } from 'antd';
import { useTranslation } from 'react-i18next';
const column = [
{ name: "Company Name" },
{ name: "Nama Divisi" },
{ name: "Deskripsi" },
{ name: "Color" },
]
const ProjectType = ({ params, ...props }) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) {
@ -31,6 +24,7 @@ const ProjectType = ({ params, ...props }) => {
hierarchy = props.hierarchy;
user_name = props.user_name;
}
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -53,8 +47,14 @@ const ProjectType = ({ params, ...props }) => {
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
const [dataDivisions, setDataDivisions] = useState([])
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation()
const column = [
role_name === 'Super Admin' ? { name: t('company') } : null,
{ name: t('nameDivision') },
{ name: t('description') },
{ name: t('color') },
].filter(column => column && column.name);
useEffect(() => {
getDataProjectType();
}, [currentPage, rowsPerPage, search])
@ -65,6 +65,20 @@ const ProjectType = ({ params, ...props }) => {
exportExcel()
}
}, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getListDivision = async () => {
const payload = {
@ -393,6 +407,8 @@ const ProjectType = ({ params, ...props }) => {
dataParent={allDataMenu}
dataDivisions={dataDivisions}
company_id={company_id}
listCompany={listCompany}
role_name={role_name}
/>
<Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

16
src/views/SimproV2/PanicButton/index.js

@ -60,6 +60,7 @@ class index extends Component {
totalPage: 0,
typeClock: "All",
typeDialog: 'Save',
role_name: props.role_name || '',
}
}
@ -120,6 +121,15 @@ class index extends Component {
}
}
if (this.state.role_name === 'Super Admin') {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios
.post(PANIC_BUTTON_SEARCH, payload, config)
.then(res => res)
@ -275,6 +285,9 @@ class index extends Component {
<i id="tooltipMap" className="fa fa-map" style={{ color: 'black', cursor: "pointer" }} onClick={() => this.handleMap(n)}></i>
</Tooltip>
</td>
{this.state.role_name === 'Super Admin' &&
<td>{n.join_second_company_name ? n.join_second_company_name : "-"}</td>
}
<td>{n.created_at !== null ? moment(n.created_at).format("DD-MM-YYYY HH:mm:ss") : "-"}</td>
<td>{n.join_first_name !== null ? n.join_first_name : "-"}</td>
<td>{n.status_response !== null ? n.status_response : "-"}</td>
@ -321,10 +334,11 @@ class index extends Component {
render() {
const column = [
{ name: this.props.t('action') },
this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
{ name: this.props.t('date') },
{ name: this.props.t('nameHR') },
{ name: this.props.t('statusResponse') },
]
].filter(column => column && column.name);
const t = this.props;
const { tooltipExport, dataTable, openDialogEdit, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipMap, tooltipDelete } = this.state
return (

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

@ -92,6 +92,15 @@ const Index = ({ params,...props }) => {
"orders": { "columns": ["id"], "ascending": false }
}
if (role_name === 'Super Admin') {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios
@ -244,6 +253,18 @@ const Index = ({ params,...props }) => {
</Tooltip>
</>,
},
...(role_name === 'Super Admin'
? [
{
title: t('company'),
dataIndex: "join_second_company_name",
key: "join_second_company_name",
render: (text, record) => (
<span>{record.join_second_company_name}</span>
)
},
]
: []),
{ title: t('nik'), dataIndex: 'join_first_ktp_number', key: 'join_first_ktp_number' },
{ title: t('nameHR'), dataIndex: 'join_first_name', key: 'join_first_name' },
{ title: t('presenceIn'), dataIndex: 'clock_in', key: 'clock_in', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY HH:mm:ss") : "-"}</div>) },

34
src/views/SimproV2/ProjectType/index.js

@ -8,10 +8,11 @@ import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { DownloadOutlined } from '@ant-design/icons';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { PROJECT_TYPE_ADD, PROJECT_TYPE_EDIT, PROJECT_TYPE_DELETE, PROJECT_TYPE_SEARCH } from '../../../const/ApiConst';
import { PROJECT_TYPE_ADD, PROJECT_TYPE_EDIT, PROJECT_TYPE_DELETE, PROJECT_TYPE_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst';
import { Pagination, Button, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next';
const ProjectType = ({ params, ...props }) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) {
@ -49,6 +50,7 @@ const ProjectType = ({ params, ...props }) => {
const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation();
useEffect(() => {
getDataProjectType()
@ -61,6 +63,21 @@ const ProjectType = ({ params, ...props }) => {
}
}, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getDataProjectType = async () => {
let start = 0;
@ -346,16 +363,16 @@ const ProjectType = ({ params, ...props }) => {
</Tooltip>
</>,
},
...(role_name === 'Super Admin' ? [
{
title: role_name === 'Super Admin' ? "Company Name" : null,
title: t('company'),
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => {
return role_name === 'Super Admin' ? (
render: (text, record) => (
<span>{record.join_first_company_name}</span>
) : null;
}
},
)
}] : []),
{ title: t('nameProjectType'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: t('description'), dataIndex: 'description', key: 'description' },
];
@ -394,6 +411,9 @@ const ProjectType = ({ params, ...props }) => {
dataEdit={dataEdit}
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
listCompany={listCompany}
company_id={company_id}
role_name={role_name}
/>
<DialogInitialGantt
openDialog={openDialogIG}

11
src/views/SimproV2/ResourceWorker/index.js

@ -539,16 +539,15 @@ const ResourceWorker = ({ params, ...props }) => {
</Tooltip>
</>,
},
...(role_name === 'Super Admin' ? [
{
title: role_name === 'Super Admin' ? "Company Name" : null,
title: t('company'),
dataIndex: "join_third_company_name",
key: "join_third_company_name",
render: (text, record) => {
return role_name === 'Super Admin' ? (
render: (text, record) => (
<span>{record.join_third_company_name}</span>
) : null;
}
},
)
}] : []),
{ title: t('nik'), dataIndex: 'ktp_number', key: 'ktp_number' },
{ title: t('nameHR'), dataIndex: 'name', key: 'name' },
{ title: t('division'), dataIndex: 'join_second_name', key: 'join_second_name' },

26
src/views/SimproV2/Satuan/index.js

@ -6,7 +6,7 @@ import axios from "../../../const/interceptorApi"
import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip } from 'antd';
import { SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH } from '../../../const/ApiConst';
import { SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next';
@ -46,6 +46,7 @@ const Satuan = ({ params, ...props }) => {
const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation()
useEffect(() => {
getDataSatuan()
@ -58,11 +59,27 @@ const Satuan = ({ params, ...props }) => {
}
}, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const column = [
{ name: "Company Name" },
role_name === 'Super Admin' ? { name: t('company') } : null,
{ name: t('name') },
{ name: t('description') },
]
].filter(column => column && column.name);
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getDataSatuan = async () => {
let start = 0;
@ -322,6 +339,9 @@ const Satuan = ({ params, ...props }) => {
dataEdit={dataEdit}
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
listCompany={listCompany}
role_name={role_name}
company_id={company_id}
/>
<Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

Loading…
Cancel
Save