Browse Source

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

Reviewed-on: ibnu/generic-ospro-frontend#77
pull/1/head
farhantock 9 months ago
parent
commit
9f2a268d83
  1. 12
      src/const/ApiConst.js
  2. 1
      src/containers/DefaultLayout/DefaultLayout.js
  3. 31
      src/views/Master/MasterCompany/DialogForm.js
  4. 3
      src/views/Master/MasterCompany/index.js
  5. 24
      src/views/Master/MasterTransaction/index.js
  6. 11
      src/views/Pages/Login/Login.js
  7. 7
      src/views/SimproV2/CreatedProyek/AsignCustProject.js
  8. 8
      src/views/SimproV2/CreatedProyek/AsignHrProject.js
  9. 34
      src/views/SimproV2/CreatedProyek/DialogDocument.js
  10. 2
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  11. 24
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  12. 17
      src/views/SimproV2/CreatedProyek/FormDocument.js
  13. 4
      src/views/SimproV2/CreatedProyek/FormFolderDocument.js
  14. 78
      src/views/SimproV2/CreatedProyek/index.js
  15. 6
      src/views/SimproV2/Gantt/GanttFrame.js
  16. 6
      src/views/SimproV2/Gantt/index.js
  17. 2
      src/views/SimproV2/Settings/DialogForm.js
  18. 4
      src/views/SimproV2/Settings/components/MyProfile/Index.js

12
src/const/ApiConst.js

@ -121,11 +121,11 @@ export let BASE_OSPRO = "http://localhost:8444/generic-ospro-backend";
export let BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`; export let BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
export let BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`; export let BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
export let BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`; export let BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
export let BASE_SIMPRO_LUMEN_FILE_COMPANY = (file, company_name) => { export let BASE_SIMPRO_LUMEN_FILE_COMPANY = (file, company_name, dateFile) => {
return `${BASE_OSPRO}/assets/${company_name}/file/project/${file}`; return `${BASE_OSPRO}/assets/${company_name}/${dateFile}/file/project/${file}`;
} }
export let BASE_SIMPRO_LUMEN_IMAGE_COMPANY = (file, company_name) => { export let BASE_SIMPRO_LUMEN_IMAGE_COMPANY = (file, company_name, dateFile) => {
return `${BASE_OSPRO}/assets/${company_name}/image/${file}`; return `${BASE_OSPRO}/assets/${company_name}/${dateFile}/image/${file}`;
} }
export const USERROLE_ADD = `${BASE_SIMPRO}/user-role/add`; export const USERROLE_ADD = `${BASE_SIMPRO}/user-role/add`;
@ -736,8 +736,8 @@ export const FOLDER_DOCUMENT_PROYEK_ADD = `${BASE_SIMPRO_LUMEN}/folder-document-
export const FOLDER_DOCUMENT_PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/folder-document-proyek/search`; export const FOLDER_DOCUMENT_PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/folder-document-proyek/search`;
export const FOLDER_DOCUMENT_PROYEK_UPDATE = (id) => export const FOLDER_DOCUMENT_PROYEK_UPDATE = (id) =>
`${BASE_SIMPRO_LUMEN}/folder-document-proyek/update/${id}`; `${BASE_SIMPRO_LUMEN}/folder-document-proyek/update/${id}`;
export const FOLDER_DOCUMENT_PROYEK_DELETE = (id) => export const FOLDER_DOCUMENT_PROYEK_DELETE = (id, company_id) =>
`${BASE_SIMPRO_LUMEN}/folder-document-proyek/delete/${id}`; `${BASE_SIMPRO_LUMEN}/folder-document-proyek/delete/${id}/${company_id}`;
export const FOLDER_DOCUMENT_PROYEK_GET_TREE = (proyek_id) => export const FOLDER_DOCUMENT_PROYEK_GET_TREE = (proyek_id) =>
`${BASE_SIMPRO_LUMEN}/folder-document-proyek/get-tree/${proyek_id}`; `${BASE_SIMPRO_LUMEN}/folder-document-proyek/get-tree/${proyek_id}`;

1
src/containers/DefaultLayout/DefaultLayout.js

@ -370,6 +370,7 @@ class DefaultLayout extends Component {
token={props.location.state ? props.location.state.token : localStorage.getItem("token")} token={props.location.state ? props.location.state.token : localStorage.getItem("token")}
menu_login={props.location.state ? props.location.state.menu_login : localStorage.getItem("menu_login")} menu_login={props.location.state ? props.location.state.menu_login : localStorage.getItem("menu_login")}
user_name={props.location.state ? props.location.state.user_name : localStorage.getItem("user_name")} user_name={props.location.state ? props.location.state.user_name : localStorage.getItem("user_name")}
configApp={props.location.state ? props.location.state.configApp : localStorage.getItem("configApp")}
{...props} {...props}
/> />
)} /> )} />

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

@ -13,7 +13,7 @@ import { useTranslation } from 'react-i18next';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import moment from 'moment'; import moment from 'moment';
import { import {
USER_SEARCH, MENU_COMPANY_DELETE, USER_DELETE, ROLE_SEARCH, COMPANY_MANAGEMENT_GET_ID, MENU_COMPANY_SEARCH, BASE_SIMPRO_LUMEN_IMAGE USER_SEARCH, MENU_COMPANY_DELETE, USER_DELETE, ROLE_SEARCH, COMPANY_MANAGEMENT_GET_ID, MENU_COMPANY_SEARCH, BASE_SIMPRO_LUMEN_IMAGE_COMPANY
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const config = { const config = {
@ -594,6 +594,24 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
} }
}; };
const imageUrl = (() => {
let imageType = '';
let createdAt = '';
if (typeImage === 'imageHeader' && imageHeader) {
imageType = imageHeader.image;
createdAt = moment(imageHeader.created_at).format('YYYY-MM');
} else if (typeImage === 'imageLogin' && imageLogin) {
imageType = imageLogin.image;
createdAt = moment(imageLogin.created_at).format('YYYY-MM');
} else if (typeImage === 'favIcon' && imageFavIcon) {
imageType = imageFavIcon.image;
createdAt = moment(imageFavIcon.created_at).format('YYYY-MM');
}
return BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageType, companyNameProp, createdAt);
})();
const renderFromCompany = () => { const renderFromCompany = () => {
return ( return (
<> <>
@ -823,21 +841,16 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
typeImage !== 'imageSlider' ? ( typeImage !== 'imageSlider' ? (
imageLogin || imageHeader || imageFavIcon ? ( imageLogin || imageHeader || imageFavIcon ? (
<img <img
src={ src={imageUrl}
`${BASE_SIMPRO_LUMEN_IMAGE}/` +
(typeImage === 'imageHeader' && imageHeader ? imageHeader.image :
typeImage === 'imageLogin' && imageLogin ? imageLogin.image :
typeImage === 'favIcon' && imageFavIcon ? imageFavIcon.image : '')
}
style={{ maxWidth: "100%" }} style={{ maxWidth: "100%" }}
alt="Image Preview" alt="Not Image Preview"
/> />
) : ('-') ) : ('-')
) : ( ) : (
<Row style={{ display: 'flex', justifyContent: 'center' }}> <Row style={{ display: 'flex', justifyContent: 'center' }}>
{imageSlider && imageSlider.map((item, index) => ( {imageSlider && imageSlider.map((item, index) => (
<Col md={6} style={{ marginBottom: '20px' }}> <Col md={6} style={{ marginBottom: '20px' }}>
<img key={index} src={`${BASE_SIMPRO_LUMEN_IMAGE}/` + item.image} style={{ width: '150px', display: 'block' }}></img> <img key={index} src={`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(item?.image, companyNameProp, moment(item?.created_at).format('YYYY-MM'))}`} style={{ width: '150px', display: 'block' }}></img>
</Col> </Col>
))} ))}
</Row> </Row>

3
src/views/Master/MasterCompany/index.js

@ -147,7 +147,8 @@ const MasterCompany = ({ params }) => {
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
setProjectImageHeader(result.data.data); const dataRes = result.data.data;
setProjectImageHeader(dataRes);
} }
} }

24
src/views/Master/MasterTransaction/index.js

@ -86,21 +86,25 @@ class index extends Component {
</Tooltip> </Tooltip>
</>, </>,
}, },
{ ...(this.state.role_name === 'Super Admin' ? [
title: this.state.role_name === 'Super Admin' ? "Company Name" : null, {
dataIndex: "join_first_company_name", title: "Company Name",
key: "join_first_company_name", dataIndex: "join_first_company_name",
render: (text, record) => { key: "join_first_company_name",
return this.state.role_name === 'Super Admin' ? ( render: (text, record) => {
<span>{record.join_first_company_name}</span> return <span>{ record.join_first_company_name }</span>;
) : null; }
}] : [])
,
{ title: 'Type Paket', dataIndex: 'type_paket', key: 'type_paket', className: "nowrap",
render: (text,record) => {
return <span>{ !["Basic","Free"].includes(record.type_paket) ? 'Enterprise' : record.type_paket}</span>
} }
}, },
{ title: 'Type Paket', dataIndex: 'type_paket', key: 'type_paket', className: "nowrap" },
{ {
title: this.props.t('Expired Date'), dataIndex: 'exp_ospro', key: 'exp_ospro', title: this.props.t('Expired Date'), dataIndex: 'exp_ospro', key: 'exp_ospro',
render: (text,record) => { render: (text,record) => {
return moment(record.exp_ospro).format('DD MMMM, YYYY'); return <span>{ moment(record.exp_ospro).format('DD MMMM, YYYY') }</span>;
} }
}, },
]; ];

11
src/views/Pages/Login/Login.js

@ -212,7 +212,8 @@ class Login extends Component {
company_id, company_id,
role_name, role_name,
all_project, all_project,
user_name user_name,
configApp
} }
}); });
} }
@ -375,7 +376,7 @@ class Login extends Component {
<h1 className="mb-1" style={{coror:'#232323'}}>Welcome to OSPRO!</h1> <h1 className="mb-1" style={{coror:'#232323'}}>Welcome to OSPRO!</h1>
<p style={{fontSize:'16px', color:'#898989'}}>Please sign-in to your account and start the adventure</p> <p style={{fontSize:'16px', color:'#898989'}}>Please sign-in to your account and start the adventure</p>
</div> </div>
<InputGroup className="mb-3"> <InputGroup className="mb-3">
<InputGroupAddon addonType="prepend"> <InputGroupAddon addonType="prepend">
<InputGroupText> <InputGroupText>
@ -393,7 +394,7 @@ class Login extends Component {
}} }}
/> />
</InputGroup> </InputGroup>
<InputGroup > <InputGroup >
<InputGroupAddon addonType="prepend"> <InputGroupAddon addonType="prepend">
<InputGroupText> <InputGroupText>
@ -427,7 +428,7 @@ class Login extends Component {
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Col className="text-right "> <Col className="text-right ">
{this.state.loader ? ( {this.state.loader ? (
<Spin indicator={antIcon} /> <Spin indicator={antIcon} />
@ -436,7 +437,7 @@ class Login extends Component {
)} )}
</Col> </Col>
</Row> </Row>
</Form> </Form>
</CardBody> </CardBody>
</Card> </Card>

7
src/views/SimproV2/CreatedProyek/AsignCustProject.js

@ -13,8 +13,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import FormAsignCust from './DialogAssignCust'; import FormAsignCust from './DialogAssignCust';
const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, company_id }) => { const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, company_id, token }) => {
const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -42,7 +41,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
}, },
"columns": [ "columns": [
{ "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" }, { "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" },
{ "name": "proyek_id", "logic_operator": "=", "value": idTask }, { "name": "proyek_id", "logic_operator": "=", "value": parseInt(idTask) },
{ "name": "is_customer", "logic_operator": "=", "value": "true" } { "name": "is_customer", "logic_operator": "=", "value": "true" }
], ],
"joins": [ "joins": [
@ -84,7 +83,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete, company_id) let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete, parseInt(company_id))
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);

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

@ -11,8 +11,7 @@ import SweetAlert from 'react-bootstrap-sweetalert';
import FormAsignHr from './FormAsignHr'; import FormAsignHr from './FormAsignHr';
import { formatThousand } from '../../../const/CustomFunc'; import { formatThousand } from '../../../const/CustomFunc';
const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, company_id, proyekName }) => { const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, company_id, proyekName, token }) => {
const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -93,7 +92,7 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, compan
"length": -1 "length": -1
}, },
"columns": [ "columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id }, { "name": "company_id", "logic_operator": "=", "value": parseInt(company_id) },
], ],
"orders": { "orders": {
"columns": [ "columns": [
@ -119,8 +118,7 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, compan
"length": -1 "length": -1
}, },
"columns": [ "columns": [
{ "name": "created_by", "logic_operator": "ilike", "value": "" }, { "name": "company_id", "logic_operator": "=", "value": parseInt(company_id) },
{ "name": "company_id", "logic_operator": "=", "value": company_id },
], ],
"joins": [], "joins": [],
"orders": { "orders": {

34
src/views/SimproV2/CreatedProyek/DialogDocument.js

@ -10,9 +10,7 @@ import axios from "../../../const/interceptorApi"
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import DialogRequest from './FormDocument'; import DialogRequest from './FormDocument';
import DialogRequestFolder from './FormFolderDocument'; import DialogRequestFolder from './FormFolderDocument';
const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => { const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, companyId, token, role_name, companyName }) => {
const token = localStorage.getItem("token")
const role = window.localStorage.getItem('role_name');
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -34,7 +32,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
setLoading(true); setLoading(true);
getDataDocument(); getDataDocument();
} }
}, [parseInt(idTask), openDialog]) }, [openDialog])
useEffect(() => { useEffect(() => {
if (!openDialog) { if (!openDialog) {
@ -75,7 +73,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const handleDownload = (id, file) => { const handleDownload = (id, file) => {
fetch(DOCUMENT_DOWNLOAD(id, parseInt(idTask)), { fetch(DOCUMENT_DOWNLOAD(id, parseInt(companyId)), {
headers: new Headers({ headers: new Headers({
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': `Bearer ${token}` 'Authorization': `Bearer ${token}`
@ -93,12 +91,8 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
}); });
} }
const handleShow = (file) => { const handleShow = (file, dateFile) => {
let configApp = ''; const urlShow = `${BASE_SIMPRO_LUMEN_FILE_COMPANY(file, companyName, dateFile)}`
if (role !== 'Super Admin') {
configApp = JSON.parse(window.localStorage.getItem('configApp'));
}
const urlShow = `${BASE_SIMPRO_LUMEN_FILE_COMPANY(file, configApp != '' ? configApp.company_name : 'undifined')}`
window.open(urlShow); window.open(urlShow);
} }
@ -122,15 +116,16 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
openDialogRequest() openDialogRequest()
} }
const renderShowDokumen = (file) => { const renderShowDokumen = (data) => {
let arrayFile = file.split(".") let arrayFile = data.file.split(".")
const dateFile = moment(data.created_at).format('YYYY-MM');
let length = arrayFile.length let length = arrayFile.length
length = length - 1 length = length - 1
const fileExt = arrayFile[length]; const fileExt = arrayFile[length];
if (fileExt == "pdf" || fileExt == "png" || fileExt == "jpg" || fileExt == "jpeg" || fileExt == "gif") { if (["pdf", "png", "jpg", "jpeg", "gif"].includes(fileExt)) {
return ( return (
<Tooltip title="View Document"> <Tooltip title="View Document">
<Button size={"sm"} color='info' style={{ color: "#FFFFFF" }} onClick={() => handleShow(file)}><i className="fa fa-eye"></i></Button> <Button size={"sm"} color='info' style={{ color: "#FFFFFF" }} onClick={() => handleShow(data.file, dateFile)}><i className="fa fa-eye"></i></Button>
</Tooltip> </Tooltip>
) )
} }
@ -159,7 +154,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
{record.isDir && <Tooltip title="New File"> {record.isDir && <Tooltip title="New File">
<Button size="sm" color="primary" onClick={() => handleNewFileParent(record.id)}><i className="fa fa-file"></i></Button> <Button size="sm" color="primary" onClick={() => handleNewFileParent(record.id)}><i className="fa fa-file"></i></Button>
</Tooltip>}{" "} </Tooltip>}{" "}
{text.file ? renderShowDokumen(text.file) : ""} {text.file ? renderShowDokumen(text) : ""}
</> </>
, ,
}, },
@ -205,7 +200,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = DOCUMENT_DELETE(idDelete, parseInt(idTask)) let urlDel = DOCUMENT_DELETE(idDelete, parseInt(companyId))
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -223,7 +218,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const onConfirmDeleteFolder = async () => { const onConfirmDeleteFolder = async () => {
let urlDel = FOLDER_DOCUMENT_PROYEK_DELETE(idDelete) let urlDel = FOLDER_DOCUMENT_PROYEK_DELETE(idDelete, parseInt(companyId))
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -319,6 +314,9 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
idTask={parseInt(idTask)} idTask={parseInt(idTask)}
parentIdNewFolder={parentIdNewFolder} parentIdNewFolder={parentIdNewFolder}
dataEdit={dataEdit} dataEdit={dataEdit}
companyId={companyId}
token={token}
role_name={role_name}
/> />
<DialogRequestFolder <DialogRequestFolder

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

@ -37,9 +37,9 @@ const DialogFormProyek = ({
projectImage, projectImage,
company_id, company_id,
role_name, role_name,
token,
companyList companyList
}) => { }) => {
const token = localStorage.getItem("token");
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

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

@ -13,18 +13,7 @@ import DialogUserGantt from './DialogUserGantt';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const { Option } = Select const { Option } = Select
const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => { const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, companyId, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => {
if (role_id && user_id && token && isLogin) {
role_id = role_id;
user_id = user_id;
token = token;
isLogin = isLogin;
} else {
role_id = localStorage.getItem("role_id");
user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin");
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -140,11 +129,12 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
<Link to={{ <Link to={{
pathname: `/projects/${text.id}/${idTask}/gantt`, pathname: `/projects/${text.id}/${idTask}/gantt`,
state: { state: {
isLogin: isLogin, isLogin,
token: token, token,
role_id: role_id, role_id,
user_id: user_id, user_id,
dataViewStartDate: dataViewStartDate company_id: companyId,
dataViewStartDate
} }
}}> }}>
<Tooltip title="Gantt"> <Tooltip title="Gantt">

17
src/views/SimproV2/CreatedProyek/FormDocument.js

@ -6,9 +6,8 @@ import { DOCUMENT_ADD } from '../../../const/ApiConst';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications'; import { NotificationManager } from 'react-notifications';
const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentIdNewFolder }) => { const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentIdNewFolder, token, role_name, companyId }) => {
const token = localStorage.getItem("token");
const role = window.localStorage.getItem('role_name');
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -34,12 +33,9 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
} }
const uploadDokumen = async () => { const uploadDokumen = async () => {
let configApp = ''
const formData = new FormData; const formData = new FormData;
if (role !== 'Super Admin') {
configApp = JSON.parse(window.localStorage.getItem('configApp')); formData.append('company_id', parseInt(companyId));
formData.append('company_name',configApp.company_name);
}
formData.append('dokumen', file, file.name); formData.append('dokumen', file, file.name);
if (parentIdNewFolder > 0) { if (parentIdNewFolder > 0) {
formData.append('ref_id', parentIdNewFolder); // folder_id formData.append('ref_id', parentIdNewFolder); // folder_id
@ -73,8 +69,9 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
return ( return (
<Form> <Form>
<FormGroup> <FormGroup>
<Label className="capitalize">Upload File</Label> <Label className="capitalize">Upload File<span style={{ color:'red' }}>*</span></Label>
<Input type="file" onChange={(e) => setFile(e.target.files[0])} /> <Input type="file" onChange={(e) => setFile(e.target.files[0])}/>
<small><span style={{ color:'red' }}>*</span>All Type File Accepted</small>
</FormGroup> </FormGroup>
</Form> </Form>
) )

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

@ -33,10 +33,6 @@ const DialogRequestFolder = ({ openDialog, closeDialog, toggleDialog, idTask, pa
} }
const saveFolder = async () => { const saveFolder = async () => {
let payload = { let payload = {
"proyek_id": idTask, "proyek_id": idTask,
"name_folder": folderName "name_folder": folderName

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}
/> />
), ),

6
src/views/SimproV2/Gantt/GanttFrame.js

@ -4,9 +4,9 @@ import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
const GanttFrame = React.memo((props) => { const GanttFrame = React.memo((props) => {
const history = useHistory(); const history = useHistory();
const { versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, company_id, role_name } = props; const { versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, companyId, role_name } = props;
const iframeSrc = `https://project-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&company_id=${company_id}`; const iframeSrc = `https://project-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&company_id=${companyId}`;
// const iframeSrc = `http://localhost:8444/generic-ospro-gantt/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&company_id=${company_id}`; // const iframeSrc = `http://localhost:8444/generic-ospro-gantt/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&company_id=${companyId}`;
const [batchEntityData, setBatchEntityData] = useState(null); const [batchEntityData, setBatchEntityData] = useState(null);
useEffect(() => { useEffect(() => {

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

@ -15,13 +15,13 @@ import GanttFrame from "./GanttFrame";
let roCount = 0; let roCount = 0;
const Gantt = (props) => { const Gantt = (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 = '', companyId = 0, all_project = null, role_name='', hierarchy=[], user_name='';
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;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id; companyId = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -114,7 +114,7 @@ const Gantt = (props) => {
token={token} token={token}
ro={ro} ro={ro}
role_name={role_name} role_name={role_name}
company_id={company_id} companyId={companyId}
timestamp={timestamp} timestamp={timestamp}
/> />
)} )}

2
src/views/SimproV2/Settings/DialogForm.js

@ -323,7 +323,7 @@ const DialogForm = ({
<img <img
src={ src={
imageProfile ? ( imageProfile ? (
`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image, role != 'Super Admin' ? configApp.company_name : 'undifined')}` `${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image, role != 'Super Admin' ? configApp?.company_name : 'undifined', moment(imageProfile?.created_at).format('YYYY-MM') )}`
) : profile ) : profile
} }
style={{ maxWidth: "100%" }} style={{ maxWidth: "100%" }}

4
src/views/SimproV2/Settings/components/MyProfile/Index.js

@ -254,7 +254,7 @@ const Index = () => {
<div className={stylesHead.img} style={{ cursor:imageProfile ? 'pointer' : '' }} onClick={imageProfile ? () => handleImageClick() : ''}> <div className={stylesHead.img} style={{ cursor:imageProfile ? 'pointer' : '' }} onClick={imageProfile ? () => handleImageClick() : ''}>
<img className={stylesHead.obejct11} src={ <img className={stylesHead.obejct11} src={
imageProfile ? ( imageProfile ? (
`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image, role != 'Super Admin' ? configApp.company_name : 'undifined')}` `${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image, role != 'Super Admin' ? configApp?.company_name : 'undifined', moment(imageProfile?.created_at).format('YYYY-MM'))}`
) : profile ) : profile
} /> } />
</div> </div>
@ -416,7 +416,7 @@ const Index = () => {
<img <img
src={ src={
imageProfile ? ( imageProfile ? (
`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image, role != 'Super Admin' ? configApp.company_name : 'undifined')}` `${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image, role != 'Super Admin' ? configApp?.company_name : 'undifined', moment(imageProfile?.created_at).format('YYYY-MM'))}`
) : profile ) : profile
} }
style={{ maxWidth: "100%" }} style={{ maxWidth: "100%" }}

Loading…
Cancel
Save