Browse Source

update payload & add state

pull/1/head
wahyun 9 months ago
parent
commit
a8de9dd6a3
  1. 78
      src/views/SimproV2/CreatedProyek/index.js

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

@ -91,7 +91,7 @@ const url = "";
const format = "DD-MM-YYYY";
const CreatedProyek = ({ 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) {
role_id = props.role_id;
user_id = props.user_id;
@ -155,6 +155,8 @@ const CreatedProyek = ({ params, ...props }) => {
const [openDialogDoc, setOpenDialogDoc] = useState(false);
const [proyekName, setProyekName] = useState("");
const [openDialogProyek, setOpenDialogProyek] = useState(false);
const [companyId, setCompanyId] = useState(props.role_name !== 'Super Admin' ? company_id : 0);
const [companyName, setCompanyName] = useState('');
// project charter
const [projectCharter, setProjectCharter] = useState(null);
const [projectParticipant, setProjectParticipant] = useState(null);
@ -369,7 +371,14 @@ const CreatedProyek = ({ params, ...props }) => {
}
const payload = {
columns: [],
columns: [
{
name: "deleted_at",
logic_operator: "isnull",
value: "null",
operator: "AND"
}
],
group_column: {
"operator": "AND",
"group_operator": "OR",
@ -401,6 +410,9 @@ const CreatedProyek = ({ params, ...props }) => {
"currency_symbol",
"mulai_proyek",
"akhir_proyek",
"company_id",
"deleted_at",
"deleted_by_id"
],
joins: [
{
@ -553,11 +565,12 @@ const CreatedProyek = ({ params, ...props }) => {
};
const handleOpenDialogProyek = async (id) => {
const handleOpenDialogProyek = async (text) => {
setCompanyId(text.company_id);
setOpenDialogProyek(true);
setidTask(id);
if (id !== 0) {
await getProjectImage(id);
setidTask(text.id);
if (text.id !== 0) {
await getProjectImage(text.id);
}
};
@ -565,6 +578,7 @@ const CreatedProyek = ({ params, ...props }) => {
setDataViewStartDate(data.mulai_proyek)
setidTask(data.id);
setProyekName(data.nama);
setCompanyId(data.company_id);
setOpenDialogGantt(true);
};
@ -599,12 +613,16 @@ const CreatedProyek = ({ params, ...props }) => {
const handleOpenAsignHr = (data) => {
setidTask(data.id);
setProyekName(data.nama);
setCompanyId(data.company_id);
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(props.configApp).company_name);
setOpenDialogAsignHR(true);
};
const handleOpenAsignCust = (data) => {
setidTask(data.id);
setProyekName(data.nama);
setCompanyId(data.company_id);
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(props.configApp).company_name);
setOpenDialogAsignCust(true);
};
@ -1375,7 +1393,14 @@ const CreatedProyek = ({ params, ...props }) => {
const handleExportExcel = async () => {
const payload = {
columns: [],
columns: [
{
name: "deleted_at",
logic_operator: "isnull",
value: "null",
operator: "AND"
}
],
group_column: {
"operator": "AND",
"group_operator": "OR",
@ -1462,7 +1487,14 @@ const CreatedProyek = ({ params, ...props }) => {
];
const payload = {
columns: [],
columns: [
{
name: "deleted_at",
logic_operator: "isnull",
value: "null",
operator: "AND"
}
],
group_column: {
"operator": "AND",
"group_operator": "OR",
@ -1568,6 +1600,8 @@ const CreatedProyek = ({ params, ...props }) => {
const handleOpenDokumen = async (data) => {
await setidTask(data.id);
setProyekName(data.nama);
setCompanyId(data.company_id);
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(props.configApp).company_name);
setOpenDialogDoc(true);
};
@ -1627,7 +1661,7 @@ const CreatedProyek = ({ params, ...props }) => {
</div>
<div
className="menu-list"
onClick={() => handleOpenDialogProyek(text.id)}
onClick={() => handleOpenDialogProyek(text)}
>
<span className="menu-icon">
<i className="fa fa-edit"></i>
@ -1656,7 +1690,17 @@ const CreatedProyek = ({ params, ...props }) => {
{!loadVersionGantt && text.type_proyek_id !== 9 && (
<>
{dataVersionGantt.slice(0, 8).map((res) => (
<Link to={`/projects/${res.id}/${text.id}/gantt`}>
<Link to={{
pathname : `/projects/${res.id}/${text.id}/gantt`,
state: {
isLogin,
token,
role_id,
user_id,
company_id: text.company_id,
dataViewStartDate
}
}}>
<div className="menu-list">
<span className="menu-icon">
<i className="fa fa-file"></i>
@ -1888,9 +1932,10 @@ const CreatedProyek = ({ params, ...props }) => {
dataDivisions={dataDivisions}
dataPM={dataPm}
projectImage={image}
company_id={company_id}
company_id={companyId}
role_name={role_name}
companyList={companyList}
token={token}
/>
),
[
@ -1952,7 +1997,8 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignHr}
idTask={idTask}
proyekName={proyekName}
company_id={company_id}
company_id={companyId}
token={token}
/>
),
[openDialogAsignHR]
@ -1968,7 +2014,8 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignCust}
idTask={idTask}
proyekName={proyekName}
company_id={company_id}
company_id={companyId}
token={token}
/>
),
[openDialogAsignCust]
@ -2003,6 +2050,10 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogDoc}
idTask={idTask}
proyekName={proyekName}
companyId={companyId}
token={token}
role_name={role_name}
companyName={companyName}
/>
),
[openDialogDoc]
@ -2053,6 +2104,7 @@ const CreatedProyek = ({ params, ...props }) => {
token={token}
isLogin={isLogin}
proyekName={proyekName}
companyId={companyId}
dataViewStartDate={dataViewStartDate}
/>
),

Loading…
Cancel
Save