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": [
{ "name": "created_by", "logic_operator": "ilike", "value": "" },
{ "name": "company_id", "logic_operator": "=", "value": company_id },
],
"joins": [],
"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 { Button, Form, FormGroup, Label, Input, Col, Row } from 'reactstrap';
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 '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 HEADER = {
headers: {
@ -30,8 +30,7 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
}
}
useEffect(() => {
if(typeDialog === "Edit")
{
if (typeDialog === "Edit") {
setId(dataEdit.id);
setName(dataEdit.name_version);
setDesctription(dataEdit.description);
@ -77,6 +76,14 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
.catch((error) => error.response);
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')
} else {
closeDialog('failed')
@ -87,7 +94,7 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
const formData = {
name_version: data.name,
description:data.description,
description: data.description,
calculation_type: data.calculationType,
proyek_id: idTask,
hierarchy_ftth_id: parentId
@ -115,11 +122,11 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
<Form>
<FormGroup>
<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>
<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>
<Label className="capitalize">Tipe Kalkulasi </Label>
@ -157,12 +164,12 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
return (
<>
<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>
{renderForm()}
</ModalBody>
<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>
</ModalFooter>
</Modal>

Loading…
Cancel
Save