Browse Source

conflict

pull/2/head
ibnu 1 year ago
parent
commit
3e9edf34a2
  1. 1
      .env
  2. 970
      src/const/ApiConst.js
  3. 2485
      src/views/Dashboard/DashboardProject.js
  4. 34
      src/views/Master/MasterBroadcast/DialogDetail.js
  5. 20
      src/views/Master/MasterBroadcast/DialogForm.js
  6. 8
      src/views/Master/MasterBroadcast/index.js
  7. 2
      src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
  8. 2949
      src/views/SimproV2/CreatedProyek/index.js
  9. 179
      src/views/SimproV2/Gantt/index.js

1
.env

@ -1,3 +1,4 @@
PORT=3000 PORT=3000
CHOKIDAR_USEPOLLING=true CHOKIDAR_USEPOLLING=true
GENERATE_SOURCEMAP=false GENERATE_SOURCEMAP=false
SKIP_PREFLIGHT_CHECK=true

970
src/const/ApiConst.js

File diff suppressed because it is too large Load Diff

2485
src/views/Dashboard/DashboardProject.js

File diff suppressed because it is too large Load Diff

34
src/views/Master/MasterBroadcast/DialogDetail.js

@ -4,10 +4,17 @@ import moment from 'moment';
import { Button, Table, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; import { Button, Table, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
import Select from 'react-select'; import Select from 'react-select';
import axios from 'axios'; import axios from 'axios';
import { BASE_URL_GEOHR_API } from '../../../const/ApiConst'; import { BASE_SIMPRO_LUMEN, BASE_URL_GEOHR_API } from '../../../const/ApiConst';
import { Transfer } from 'antd'; import { Transfer } from 'antd';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token');
const config = {
headers:
{
Authorization: `Bearer ${token}`,
"Content-type": `application/json`
}
};
const ERROR_TITLE = "judul is required!" const ERROR_TITLE = "judul is required!"
const ERROR_MESSAGE = "message is required!" const ERROR_MESSAGE = "message is required!"
const BASE_URL = "https://oslog.id/geohr-api/"; const BASE_URL = "https://oslog.id/geohr-api/";
@ -42,26 +49,23 @@ class DialogDetail extends Component {
getDataDetail = async () => { getDataDetail = async () => {
countError++; countError++;
let url = BASE_URL_GEOHR_API + `/broadcast-detail/search?broadcastId=${this.state.id}`; let url = BASE_SIMPRO_LUMEN + `/broadcast/search`;
const payload = { const payload = {
"paging": { "start": 0, "length": 25 }, "paging": { "start": 0, "length": 25 },
"orders": { "columns": ["id"], "ascending": true }, "orders": { "columns": ["id"], "ascending": true },
"columns": [ "columns": [
{ "name": "status_send", "logic_operator": "ilike", "value": "", "operator": "AND" } { "name": "id", "logic_operator": "=", "value": this.state.id, "operator": "AND" }
],
"joins": [
{ "name": "m_broadcast", "column_results": ["title_notif", "message_notif", "description", "status_send"], "column_join": "broadcast_id" }
] ]
} }
const result = await axios const result = await axios
.post(url, payload) .post(url, payload, config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
console.log('cek data detail', result.data) console.log('cek data detail', result.data)
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
if (result.data.data && result.data.data.broadcast_details) { if (result.data.data && result.data.data) {
this.setState({ dataListDetail: result.data.data.broadcast_details }) this.setState({ dataListDetail: result.data.data })
} }
} else { } else {
if (countError < 6) { if (countError < 6) {
@ -97,11 +101,11 @@ class DialogDetail extends Component {
{this.state.dataListDetail.map((val, index) => { {this.state.dataListDetail.map((val, index) => {
return ( return (
<tr key={index}> <tr key={index}>
<td>{val.join.status_send === "" ? "-" : val.status_send}</td> <td>{val.status_send === "" ? "-" : val.status_send}</td>
<td>{val.join.created_date === "" ? "-" : moment(val.created_date).format("YYYY-MM-DD HH:mm:ss")}</td> <td>{val.created_at === "" ? "-" : moment(val.created_date).format("DD-MM-YYYY HH:mm:ss")}</td>
<td>{val.join.broadcast_description === "" ? "-" : val.join.broadcast_description}</td> <td>{val.description === "" ? "-" : val.description}</td>
<td>{val.join.broadcast_title_notif === "" ? "-" : val.join.broadcast_title_notif}</td> <td>{val.title_notif === "" ? "-" : val.title_notif}</td>
<td>{val.join.broadcast_message_notif === "" ? "-" : val.join.broadcast_message_notif}</td> <td>{val.message_notif === "" ? "-" : val.message_notif}</td>
</tr> </tr>
) )
})} })}

20
src/views/Master/MasterBroadcast/DialogForm.js

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { Button, Form, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; import { Button, Form, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
import Select from 'react-select'; import Select from 'react-select';
import axios from 'axios'; import axios from 'axios';
import { BASE_URL_GEOHR_API2, ROLE_SEARCH, USER_WASPANG } from '../../../const/ApiConst'; import { BASE_URL_GEOHR_API2, ROLE_SEARCH, USER_WASPANG, USER_LIST } from '../../../const/ApiConst';
import { Transfer } from 'antd'; import { Transfer } from 'antd';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
@ -137,7 +137,7 @@ class DialogForm extends Component {
if (penerima === "all") { if (penerima === "all") {
idSend = this.state.allEmployeeId; idSend = this.state.allEmployeeId;
send_to_type = "all"; send_to_type = "all";
} else if (penerima === "division") { } else if (penerima === "organization") {
idSend = this.state.idOrganization; idSend = this.state.idOrganization;
send_to_type = "roles"; send_to_type = "roles";
} else if (penerima === "karyawan") { } else if (penerima === "karyawan") {
@ -145,9 +145,13 @@ class DialogForm extends Component {
send_to_type = "users"; send_to_type = "users";
} }
if(Array.isArray(idSend)){
idSend = idSend.map(function (e) { idSend = idSend.map(function (e) {
return e.toString() return e.toString()
}); });
} else {
idSend = idSend;
}
const data = { const data = {
title, title,
@ -186,7 +190,7 @@ class DialogForm extends Component {
} }
setEmployeeOrganization = () => { setEmployeeOrganization = () => {
let arrEd = this.state.dataEmployee; let arrEd = this.state.dataEmployee.data;
let cek = arrEd.filter(this.filterId) let cek = arrEd.filter(this.filterId)
this.setState({ idEmployeeDivision: cek }) this.setState({ idEmployeeDivision: cek })
@ -289,14 +293,14 @@ class DialogForm extends Component {
"ascending": false "ascending": false
} }
} }
//TODO should use search instead
const result = await axios const result = await axios
.post(USER_WASPANG, payload, config) .get(USER_LIST, config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
console.log('test role', result) console.log('test role', result)
if (result && result.data && result.code == "200") { if (result && result.data && result.status == 200) {
this.setState({ dataEmployee: result.data }, () => { this.setState({ dataEmployee: result.data }, () => {
this.setDataEmployee(); this.setDataEmployee();
}); });
@ -307,12 +311,12 @@ class DialogForm extends Component {
setDataEmployee = () => { setDataEmployee = () => {
const listEmployee = []; const listEmployee = [];
const allIdEmployee = []; const allIdEmployee = [];
this.state.dataEmployee.map((val, index) => { this.state.dataEmployee.data.map((val, index) => {
allIdEmployee.push(val.id); allIdEmployee.push(val.id);
listEmployee.push({ listEmployee.push({
key: val.id, key: val.id,
id: val.id, id: val.id,
title: val.join.m_users_name title: val.name
}); });
}) })

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

@ -5,7 +5,7 @@ import React, { Component } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
import { API_BROADCAST_SIMPRO, BASE_SIMPRO, BASE_URL_GEOHR_API2 } from '../../../const/ApiConst'; import { API_BROADCAST_SIMPRO, BASE_SIMPRO, BASE_SIMPRO_LUMEN, BASE_URL_GEOHR_API2 } from '../../../const/ApiConst';
import { Button, Card, CardBody, CardHeader, DropdownItem, DropdownMenu, DropdownToggle, Input, InputGroup, InputGroupButtonDropdown, Table, Row, Col } from 'reactstrap'; import { Button, Card, CardBody, CardHeader, DropdownItem, DropdownMenu, DropdownToggle, Input, InputGroup, InputGroupButtonDropdown, Table, Row, Col } from 'reactstrap';
import { DatePicker, Pagination } from 'antd'; import { DatePicker, Pagination } from 'antd';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
@ -85,7 +85,7 @@ class index extends Component {
}; };
getDataBroadcast = async () => { getDataBroadcast = async () => {
let url = BASE_SIMPRO + `/broadcast/search`; let url = BASE_SIMPRO_LUMEN + `/broadcast/search`;
const { searchDetail } = this.state const { searchDetail } = this.state
let start = 0; let start = 0;
@ -180,7 +180,7 @@ class index extends Component {
} }
saveBroadcast = async (type, data) => { saveBroadcast = async (type, data) => {
let url = BASE_SIMPRO + `/broadcast/add`; let url = BASE_SIMPRO_LUMEN + `/broadcast/add`;
const param = { const param = {
"title_notif": data.title, "title_notif": data.title,
@ -205,7 +205,7 @@ class index extends Component {
"send_to_type": "users", "send_to_type": "users",
"message_notif": data.message, "message_notif": data.message,
"description": data.description, "description": data.description,
"send_to_id": data.id.map((id, index) => id) "send_to_id": data.send_to_type == "users" ? data.id.map((id, index) => id) : null
} }
if (data.send_to_type === "all") { if (data.send_to_type === "all") {

2
src/views/SimproV2/CreatedProyek/DataRequestMaterial.js

@ -26,7 +26,7 @@ const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, mat
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
getDataRequestMaterial(); // getDataRequestMaterial();
} }
}, [idTask]) }, [idTask])

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

File diff suppressed because it is too large Load Diff

179
src/views/SimproV2/Gantt/index.js

@ -1,103 +1,114 @@
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from "react";
import Timeline from 'react-calendar-timeline' import Timeline from "react-calendar-timeline";
import 'react-calendar-timeline/lib/Timeline.css' import "react-calendar-timeline/lib/Timeline.css";
import { USER_VERSION_GANTT_SEARCH, BASE_SIMPRO_LUMEN, BASE_URL_GANTT } from '../../../const/ApiConst'; import {
import axios from "../../../const/interceptorApi" USER_VERSION_GANTT_SEARCH,
import { Fab, Action } from 'react-tiny-fab'; BASE_SIMPRO_LUMEN,
import 'react-tiny-fab/dist/styles.css'; BASE_URL_GANTT,
} from "../../../const/ApiConst";
import axios from "../../../const/interceptorApi";
import { Fab, Action } from "react-tiny-fab";
import "react-tiny-fab/dist/styles.css";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import GanttFrame from './GanttFrame'; import GanttFrame from "./GanttFrame";
const token = localStorage.getItem("token") const token = localStorage.getItem("token");
const userId = parseInt(localStorage.getItem("user_id")); const userId = parseInt(localStorage.getItem("user_id"));
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"Authorization": `Bearer ${token}` Authorization: `Bearer ${token}`,
} },
} };
let roCount = 0; let roCount = 0;
const Gantt = (props) => { const Gantt = (props) => {
const versionGanttId = props.match.params ? props.match.params.id : 0; const versionGanttId = props.match.params ? props.match.params.id : 0;
const idProject = props.match.params.project ? props.match.params.project : 0; const idProject = props.match.params.project ? props.match.params.project : 0;
const timestamp = props.match.params.timestamp ? props.match.params.timestamp : 0; const timestamp = props.match.params.timestamp
? props.match.params.timestamp
: 0;
const [ro, setRo] = useState(1) const [ro, setRo] = useState(1);
const [listUserGant, setListUserGantt] = useState([]) const [listUserGant, setListUserGantt] = useState([]);
const [ready, setReady] = useState(false) const [ready, setReady] = useState(false);
let history = useHistory(); let history = useHistory();
useEffect(() => { useEffect(() => {
document.getElementsByClassName("breadcrumb-item active").innerHTML = "Gantt Project"; document.getElementsByClassName("breadcrumb-item active").innerHTML =
getDataUserGantt(); "Gantt Project";
}, []); getDataUserGantt();
}, []);
useEffect(() => { useEffect(() => {
cekPermission(); cekPermission();
}, [listUserGant]) }, [listUserGant]);
useEffect(() => { useEffect(() => {}, [ro]);
}, [ro])
const getDataUserGantt = async () => { const getDataUserGantt = async () => {
const payload = { const payload = {
"columns": [ columns: [
{ "name": "version_gantt_id", "logic_operator": "=", "value": versionGanttId, "operator": "AND" } {
] name: "version_gantt_id",
} logic_operator: "=",
const result = await axios value: versionGanttId,
.post(USER_VERSION_GANTT_SEARCH, payload, HEADER) operator: "AND",
.then(res => res) },
.catch((error) => error.response); ],
};
const result = await axios
.post(USER_VERSION_GANTT_SEARCH, payload, HEADER)
.then((res) => res)
.catch((error) => error.response);
if (result && result.status == 200) { if (result && result.status == 200) {
setUserGantt(result.data.data); setUserGantt(result.data.data);
} else { } else {
cekPermission() cekPermission();
} }
} };
const setUserGantt = (data) => { const setUserGantt = (data) => {
let newTargetKeys = [] let newTargetKeys = [];
data.map((val, index) => { data.map((val, index) => {
newTargetKeys.push(val.user_id) newTargetKeys.push(val.user_id);
}); });
setListUserGantt(newTargetKeys) setListUserGantt(newTargetKeys);
} };
const handleRedirect = () => { const handleRedirect = () => {
history.push("/dashboard-project/"+idProject+"/"+versionGanttId); history.push("/dashboard-project/" + idProject + "/" + versionGanttId);
} };
const cekPermission = () => { const cekPermission = () => {
let check = listUserGant.includes(userId) let check = listUserGant.includes(userId);
if (check) { if (check) {
setRo(0) setRo(0);
} else { } else {
setRo(1) setRo(1);
} }
if (roCount >= 1) { if (roCount >= 1) {
setReady(true) setReady(true);
} }
roCount = roCount + 1; roCount = roCount + 1;
} };
return ( return (
<> <>
<div style={{ margin: "-15px", marginBottom: "-30px" }}> <div style={{ margin: "-15px", marginBottom: "-30px" }}>
{ready && ( {ready && (
<GanttFrame <GanttFrame
versionGanttId={versionGanttId} versionGanttId={versionGanttId}
idProject={idProject} idProject={idProject}
token={token} token={token}
ro={ro} ro={ro}
timestamp={timestamp} timestamp={timestamp}
/> />
)} )}
</div> </div>
</> </>
); );
} };
export default Gantt; export default Gantt;

Loading…
Cancel
Save