Browse Source

Merge pull request 'dev-wahyun' (#92) from dev-wahyun into staging

Reviewed-on: ibnu/generic-ospro-frontend#92
pull/1/head
farhantock 7 months ago
parent
commit
488524b225
  1. 1
      src/views/Master/MasterCompany/DialogForm.js
  2. 5
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  3. 4
      src/views/SimproV2/CreatedProyek/index.js
  4. 20
      src/views/SimproV2/Gantt/index.js
  5. 26
      src/views/SimproV2/ResourceWorker/DialogForm.js
  6. 7
      src/views/SimproV2/ResourceWorker/index.js

1
src/views/Master/MasterCompany/DialogForm.js

@ -754,6 +754,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
<Select style={{ width: "100%" }} defaultValue={typePaket} value={typePaket} onChange={(e) => setTypePaket(e)} placeholder="Select a type paket">
<Option value="Free">Free</Option>
<Option value="Basic">Basic</Option>
<Option value="Enterprise">Enterprise</Option>
</Select>
</FormGroup>
</Col>

5
src/views/SimproV2/CreatedProyek/DialogGantt.js

@ -13,7 +13,7 @@ import DialogUserGantt from './DialogUserGantt';
import { Link } from 'react-router-dom';
const { Option } = Select
const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, companyId, companyName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => {
const DialogGantt = ({ openDialog, closeDialog, role_name, toggleDialog, idTask, proyekName, companyId, companyName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => {
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -134,7 +134,8 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
user_id,
company_id: companyId,
dataViewStartDate,
companyName
companyName,
role_name
}
}}>
<Tooltip title="Gantt">

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

@ -156,7 +156,7 @@ 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 [companyId, setCompanyId] = useState(role_name !== 'Super Admin' ? company_id : 0);
const [companyName, setCompanyName] = useState('');
// project charter
const [projectCharter, setProjectCharter] = useState(null);
@ -1703,6 +1703,7 @@ const CreatedProyek = ({ params, ...props }) => {
token,
role_id,
user_id,
role_name,
company_id: text.company_id,
dataViewStartDate,
companyName: (role_name === 'Super Admin' ? text.join_third_company_name : JSON.parse(configApp).company_name)
@ -2124,6 +2125,7 @@ const CreatedProyek = ({ params, ...props }) => {
companyName={companyName}
proyekName={proyekName}
companyId={companyId}
role_name={role_name}
dataViewStartDate={dataViewStartDate}
/>
),

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

@ -3,26 +3,14 @@ import "react-calendar-timeline/lib/Timeline.css";
import {USER_VERSION_GANTT_SEARCH} from "../../../const/ApiConst";
import axios from "../../../const/interceptorApi";
import "react-tiny-fab/dist/styles.css";
import { useHistory } from "react-router-dom";
import { useHistory, useLocation } from "react-router-dom";
import GanttFrame from "./GanttFrame";
let roCount = 0;
const Gantt = (props) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', companyId = 0, all_project = null, role_name='', hierarchy=[], user_name='', companyName='';
if (props && props.role_id && props.user_id) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
companyId = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
hierarchy = props.hierarchy;
user_name = props.user_name;
companyName = props.companyName;
}
const location = useLocation();
const { isLogin, token, role_id, user_id, company_id, dataViewStartDate, companyName, role_name } = location.state || {};
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -110,7 +98,7 @@ const Gantt = (props) => {
token={token}
ro={ro}
role_name={role_name}
companyId={companyId}
companyId={company_id}
timestamp={timestamp}
company_name={companyName}
/>

26
src/views/SimproV2/ResourceWorker/DialogForm.js

@ -6,13 +6,11 @@ import {
import { DatePicker, Tooltip, Select, Input as InputAntd } from 'antd';
import moment from 'moment';
import 'antd/dist/antd.css';
import { formatRupiah, formatNumber } from '../../../const/CustomFunc'
import { formatNumber } from '../../../const/CustomFunc'
import { useTranslation } from 'react-i18next';
const { Option } = Select
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, roleList, divisiList, role_name, companyList, company_id }) => {
const [openDialogMap, setOpenDialogMap] = useState(false)
const [id, setId] = useState(0)
const [resourceName, setResourceName] = useState('')
const [username, setUsername] = useState('')
@ -90,11 +88,19 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
alert("Please input NIK (KTP/ ID Card)");
return;
}
if (!roleId && roleId === "") {
if (!resourceName && resourceName === "") {
alert("Please input name");
return;
}
if (!employeeType && employeeType === "") {
alert("Please input employe type");
return;
}
if (!roleId && roleId === "" && statusCustomer === false) {
alert("Please select the role");
return;
}
if (!divisionId && divisionId === "") {
if (!divisionId && divisionId === "" && statusCustomer === false) {
alert("Please select the division");
return;
}
@ -117,6 +123,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if(statusCustomer === false) {
data.role_id = roleId;
data.divisi_id = divisionId;
} else {
data.is_customer = statusCustomer
}
if (birthDate && birthDate != "") {
@ -163,12 +171,13 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
address,
status_resource: statusResource,
status_boundary: statusRestriction,
is_customer: statusCustomer,
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
}
if(statusCustomer === false) {
data.role_id = roleId;
data.divisi_id = divisionId;
} else {
data.is_customer = statusCustomer
}
if (birthDate && birthDate != "") {
@ -274,7 +283,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
<Select showSearch value={gender} defaultValue={gender} onChange={(val) => setGender(val)} placeholder={t('selectGender')} style={{ width: '100%' }}>
<Option value="Male">Male</Option>
<Option value="Female">Female</Option>
{/* <Option value="Other">Other</Option> */}
</Select>
</FormGroup>
</Col>
@ -340,7 +348,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
<>
<Col md={6} style={{ marginTop: statusCustomer === false ? '15px' : '0px' }}>
<FormGroup>
<Label className="capitalize">{t('roles')}</Label>
<Label className="capitalize">{t('roles')} <span style={{ color: "red" }}>*</span></Label>
<Select showSearch defaultValue={roleId} onChange={(val) => setRoleId(val)} placeholder={t('selectRole')} style={{ width: '100%' }}>
{setupSelectRole()}
</Select>
@ -348,7 +356,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</Col>
<Col md={6} style={{ marginTop: statusCustomer === false ? '15px' : '0px' }}>
<FormGroup>
<Label className="capitalize">{t('division')} </Label>
<Label className="capitalize">{t('division')} <span style={{ color: "red" }}>*</span></Label>
<Select showSearch defaultValue={divisionId} onChange={(val) => setDivisionId(val)} placeholder={t('selectDivision')} style={{ width: '100%' }}>
{setupSelectDivisi()}
</Select>

7
src/views/SimproV2/ResourceWorker/index.js

@ -4,7 +4,6 @@ import DialogFormUserShift from './DialogFormUserShift';
import React, { useState, useEffect, useMemo } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi"
import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { useLocation } from "react-router-dom";
@ -14,11 +13,7 @@ import {
} from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next';
import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup,
checkActMenup
} from "../../../const/CustomFunc";
const ResourceWorker = ({ params, ...props }) => {

Loading…
Cancel
Save