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

Loading…
Cancel
Save