Browse Source

update after created gantt add permission created

pull/1/head
farhantock 1 year ago
parent
commit
fcf47b144b
  1. 1
      src/views/SimproV2/CreatedProyek/AsignHrProject.js
  2. 25
      src/views/SimproV2/CreatedProyek/DialogFormGantt.js

1
src/views/SimproV2/CreatedProyek/AsignHrProject.js

@ -120,6 +120,7 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, compan
}, },
"columns": [ "columns": [
{ "name": "created_by", "logic_operator": "ilike", "value": "" }, { "name": "created_by", "logic_operator": "ilike", "value": "" },
{ "name": "company_id", "logic_operator": "=", "value": company_id },
], ],
"joins": [], "joins": [],
"orders": { "orders": {

25
src/views/SimproV2/CreatedProyek/DialogFormGantt.js

@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form, FormGroup, Label, Input, Col, Row } from 'reactstrap'; import { Button, Form, FormGroup, Label, Input, Col, Row } from 'reactstrap';
import axios from "../../../const/interceptorApi"; import axios from "../../../const/interceptorApi";
import { VERSION_GANTT_ADD, VERSION_GANTT_EDIT } from '../../../const/ApiConst'; import { VERSION_GANTT_ADD, VERSION_GANTT_EDIT, USER_VERSION_GANTT_ADD } from '../../../const/ApiConst';
import { Select } from 'antd'; import { Select } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parentId, dataEdit, typeDialog}) => { const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parentId, dataEdit, typeDialog, user_id }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -30,8 +30,7 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
} }
} }
useEffect(() => { useEffect(() => {
if(typeDialog === "Edit") if (typeDialog === "Edit") {
{
setId(dataEdit.id); setId(dataEdit.id);
setName(dataEdit.name_version); setName(dataEdit.name_version);
setDesctription(dataEdit.description); setDesctription(dataEdit.description);
@ -77,6 +76,14 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.status == 200) { if (result && result.status == 200) {
const formData = {
user_id: user_id,
version_gantt_id: result.data.id
}
await axios
.post(USER_VERSION_GANTT_ADD, formData, HEADER)
.then(res => res)
.catch((error) => error.response);
closeDialog('Save') closeDialog('Save')
} else { } else {
closeDialog('failed') closeDialog('failed')
@ -87,7 +94,7 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
const formData = { const formData = {
name_version: data.name, name_version: data.name,
description:data.description, description: data.description,
calculation_type: data.calculationType, calculation_type: data.calculationType,
proyek_id: idTask, proyek_id: idTask,
hierarchy_ftth_id: parentId hierarchy_ftth_id: parentId
@ -115,11 +122,11 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
<Form> <Form>
<FormGroup> <FormGroup>
<Label className="capitalize">Nama <span style={{ color: "red" }}>*</span> </Label> <Label className="capitalize">Nama <span style={{ color: "red" }}>*</span> </Label>
<Input type="text" value={name} onChange={(e) => setName(e.target.value)}/> <Input type="text" value={name} onChange={(e) => setName(e.target.value)} />
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<Label className="capitalize">Deskripsi </Label> <Label className="capitalize">Deskripsi </Label>
<Input type="textarea" value={description} onChange={(e) => setDesctription(e.target.value)}/> <Input type="textarea" value={description} onChange={(e) => setDesctription(e.target.value)} />
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<Label className="capitalize">Tipe Kalkulasi </Label> <Label className="capitalize">Tipe Kalkulasi </Label>
@ -157,12 +164,12 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
return ( return (
<> <>
<Modal isOpen={openDialog} toggle={toggleDialog}> <Modal isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>{typeDialog == "Edit" ? "Edit" :"Tambah"} Gantt Project</ModalHeader> <ModalHeader className="capitalize" toggle={closeDialog}>{typeDialog == "Edit" ? "Edit" : "Tambah"} Gantt Project</ModalHeader>
<ModalBody> <ModalBody>
{renderForm()} {renderForm()}
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button color="primary" onClick={() => handleSave()}>{typeDialog == "Edit" ? "Update" :"Save"}</Button>{' '} <Button color="primary" onClick={() => handleSave()}>{typeDialog == "Edit" ? "Update" : "Save"}</Button>{' '}
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Cancel</Button> <Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Cancel</Button>
</ModalFooter> </ModalFooter>
</Modal> </Modal>

Loading…
Cancel
Save