Browse Source

add company_id and company_name

pull/1/head
wahyun 10 months ago
parent
commit
778490e790
  1. 14
      src/views/Master/MasterCompany/index.js
  2. 3
      src/views/Master/Proyek/index.js
  3. 3
      src/views/SimproV2/Closing/index.js
  4. 2
      src/views/SimproV2/CreatedProyek/AsignCustProject.js
  5. 22
      src/views/SimproV2/CreatedProyek/DialogDocument.js
  6. 9
      src/views/SimproV2/CreatedProyek/FormDocument.js
  7. 6
      src/views/SimproV2/CreatedProyek/index.js
  8. 4
      src/views/SimproV2/ResourceWorker/DialogForm.js

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

@ -53,7 +53,7 @@ const MasterCompany = ({ params }) => {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const pageName = params.name; const pageName = params.name;
const { t } = useTranslation(); const { t } = useTranslation();
const configApp = JSON.parse(window.localStorage.getItem('configApp'));
useEffect(() => { useEffect(() => {
setLoading(true) setLoading(true)
getDataCompany() getDataCompany()
@ -354,6 +354,7 @@ const MasterCompany = ({ params }) => {
formData.append('ref_id', id); formData.append('ref_id', id);
formData.append('category', 'company_logo_header'); formData.append('category', 'company_logo_header');
formData.append('files', data); formData.append('files', data);
formData.append('company_name',configApp.company_name);
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -367,6 +368,7 @@ const MasterCompany = ({ params }) => {
formData.append('ref_id', id); formData.append('ref_id', id);
formData.append('category', 'company_logo_login'); formData.append('category', 'company_logo_login');
formData.append('files', data); formData.append('files', data);
formData.append('company_name',configApp.company_name);
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -380,6 +382,7 @@ const MasterCompany = ({ params }) => {
formData.append('ref_id', id); formData.append('ref_id', id);
formData.append('category', 'company_favicon'); formData.append('category', 'company_favicon');
formData.append('files', data); formData.append('files', data);
formData.append('company_name',configApp.company_name);
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -389,6 +392,7 @@ const MasterCompany = ({ params }) => {
}; };
const saveSliderLogin = async (data) => { const saveSliderLogin = async (data) => {
data.company_name = configApp.company_name;
await axios await axios
.post(IMAGE_MULTIPLE_UPLOAD, data, HEADER_MULTIPART) .post(IMAGE_MULTIPLE_UPLOAD, data, HEADER_MULTIPART)
.then(res => res) .then(res => res)
@ -398,7 +402,7 @@ const MasterCompany = ({ params }) => {
// Delete Image Function // Delete Image Function
const deleteImageHeader = async (id) => { const deleteImageHeader = async (id) => {
const URL = IMAGE_DELETE(id, 'company_logo_header'); const URL = IMAGE_DELETE(id, 'company_logo_header', company_id);
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -407,7 +411,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageLogin = async (id) => { const deleteImageLogin = async (id) => {
const URL = IMAGE_DELETE(id, 'company_logo_login'); const URL = IMAGE_DELETE(id, 'company_logo_login', company_id);
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -416,7 +420,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageFavicon = async (id) => { const deleteImageFavicon = async (id) => {
const URL = IMAGE_DELETE(id, 'company_favicon'); const URL = IMAGE_DELETE(id, 'company_favicon', company_id);
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -425,7 +429,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageSlider = async (id) => { const deleteImageSlider = async (id) => {
const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login'); const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login', company_id);
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)

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

@ -48,6 +48,7 @@ const data = [
const url = ""; const url = "";
const proyek_id = localStorage.getItem('proyek_id'); const proyek_id = localStorage.getItem('proyek_id');
const role_id = localStorage.getItem('role_id'); const role_id = localStorage.getItem('role_id');
const company_id = window.localStorage.getItem('company_id');
const IndexRole = ({ params }) => { const IndexRole = ({ params }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
@ -214,7 +215,7 @@ const IndexRole = ({ params }) => {
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = PROYEK_DELETE(idDelete) let urlDel = PROYEK_DELETE(idDelete, 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);

3
src/views/SimproV2/Closing/index.js

@ -14,6 +14,7 @@ import { formatRupiah } from '../../../const/CustomFunc'
const url = ""; const url = "";
const proyek_id = localStorage.getItem('proyek_id'); const proyek_id = localStorage.getItem('proyek_id');
const role_id = localStorage.getItem('role_id'); const role_id = localStorage.getItem('role_id');
const company_id = window.localStorage.getItem('company_id');
const format = "DD-MM-YYYY"; const format = "DD-MM-YYYY";
const Closing = ({ params, ...props }) => { const Closing = ({ params, ...props }) => {
@ -144,7 +145,7 @@ const Closing = ({ params, ...props }) => {
const toggleAddDialogView = () => setOpenDialogViewDetail(!openDialogViewDetail) const toggleAddDialogView = () => setOpenDialogViewDetail(!openDialogViewDetail)
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = PROYEK_DELETE(idDelete) let urlDel = PROYEK_DELETE(idDelete, 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);

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

@ -84,7 +84,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete) let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete, 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);

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

@ -5,7 +5,7 @@ import { Table, Tooltip, Popover, Spin } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import moment from 'moment'; import moment from 'moment';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import { DOCUMENT_DOWNLOAD, DOCUMENT_GET, BASE_SIMPRO_LUMEN_FILE, REQUEST_MATERIAL_EDIT, DOCUMENT_DELETE, DOCUMENT_SEARCH, FOLDER_DOCUMENT_PROYEK_GET_TREE, FOLDER_DOCUMENT_PROYEK_DELETE } from '../../../const/ApiConst'; import { DOCUMENT_DOWNLOAD, DOCUMENT_GET, BASE_SIMPRO_LUMEN_FILE_COMPANY, REQUEST_MATERIAL_EDIT, DOCUMENT_DELETE, DOCUMENT_SEARCH, FOLDER_DOCUMENT_PROYEK_GET_TREE, FOLDER_DOCUMENT_PROYEK_DELETE } from '../../../const/ApiConst';
import axios from "../../../const/interceptorApi" 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';
@ -18,13 +18,6 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
"Authorization": `Bearer ${token}` "Authorization": `Bearer ${token}`
} }
} }
const config = {
headers:
{
Authorization: `Bearer ${token}`,
"Content-type": `application/json`
}
};
const [dataDocument, setDataDocument] = useState([]) const [dataDocument, setDataDocument] = useState([])
const [openDialogReq, setOpenDialogReq] = useState(false) const [openDialogReq, setOpenDialogReq] = useState(false)
const [openDialogNewFolder, setOpenDialogNewFolder] = useState(false) const [openDialogNewFolder, setOpenDialogNewFolder] = useState(false)
@ -34,6 +27,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
const [dataEdit, setDataEdit] = useState(null) const [dataEdit, setDataEdit] = useState(null)
const [parentIdNewFolder, setParentIdNewFolder] = useState(0) const [parentIdNewFolder, setParentIdNewFolder] = useState(0)
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const company_id = window.localStorage.getItem('company_id');
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
@ -58,7 +52,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
const getDataDocument = async () => { const getDataDocument = async () => {
const url = FOLDER_DOCUMENT_PROYEK_GET_TREE(idTask) const url = FOLDER_DOCUMENT_PROYEK_GET_TREE(idTask)
const result = await axios const result = await axios
.get(url, config) .get(url, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
@ -86,7 +80,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const handleDownload = (id, file) => { const handleDownload = (id, file) => {
fetch(DOCUMENT_DOWNLOAD(id), { fetch(DOCUMENT_DOWNLOAD(id, company_id), {
headers: new Headers({ headers: new Headers({
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': `Bearer ${token}` 'Authorization': `Bearer ${token}`
@ -101,14 +95,12 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
a.click(); a.click();
a.remove(); a.remove();
}); });
//window.location.href = response.url;
}); });
// const urlDownload = DOCUMENT_DOWNLOAD(id);
// window.open(urlDownload);
} }
const handleShow = (file) => { const handleShow = (file) => {
const urlShow = `${BASE_SIMPRO_LUMEN_FILE}/${file}` const configApp = JSON.parse(window.localStorage.getItem('configApp'));
const urlShow = `${BASE_SIMPRO_LUMEN_FILE_COMPANY(file, configApp.company_name)}`
window.open(urlShow); window.open(urlShow);
} }
@ -215,7 +207,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = DOCUMENT_DELETE(idDelete) let urlDel = DOCUMENT_DELETE(idDelete, 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);

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

@ -33,8 +33,11 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
} }
const uploadDokumen = async () => { const uploadDokumen = async () => {
const configApp = JSON.parse(window.localStorage.getItem('configApp'));
const formData = new FormData; const formData = new FormData;
formData.append('dokumen', file, file.name); formData.append('dokumen', file, file.name);
formData.append('company_name',configApp.company_name);
if (parentIdNewFolder > 0) { if (parentIdNewFolder > 0) {
formData.append('ref_id', parentIdNewFolder); // folder_id formData.append('ref_id', parentIdNewFolder); // folder_id
@ -49,12 +52,12 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
.post(DOCUMENT_ADD, formData, HEADER) .post(DOCUMENT_ADD, formData, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
const notif = result.data.message;
if (result && result.status == 200) { if (result && result.status == 200) {
NotificationManager.success('Dokumen project berhasil diupload!!', 'Success'); NotificationManager.success(notif, 'Success');
closeDialog('upload') closeDialog('upload')
} else { } else {
NotificationManager.error('Dokumen project gagal diupload!!', 'Failed'); NotificationManager.error(notif, 'Failed');
closeDialog('failed upload') closeDialog('failed upload')
} }
} }

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

@ -968,7 +968,7 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = PROYEK_DELETE(idDelete); let urlDel = PROYEK_DELETE(idDelete, company_id);
const result = await axios const result = await axios
.delete(urlDel, HEADER) .delete(urlDel, HEADER)
.then((res) => res) .then((res) => res)
@ -1189,8 +1189,8 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const deleteImage = async (id) => { const deleteImage = async (id) => {
const URL = IMAGE_DELETE(id, 'project_structure_organization'); const company_id = localStorage.getItem("company_id");
const URL = IMAGE_DELETE(id, 'project_structure_organization', company_id);
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)

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

@ -135,6 +135,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
username, username,
password, password,
email, email,
company_id: parseInt(company_id)
} }
closeDialog('edit', data); closeDialog('edit', data);
@ -215,8 +216,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
<Label className="capitalize">{t('nik')} <span style={{ color: "red" }}>*</span></Label> <Label className="capitalize">{t('nik')} <span style={{ color: "red" }}>*</span></Label>
{/* <Input type="text" value={ktpNumber} onChange={(e) => setKtpNumber(e.target.value.replace(/[^0-9]/g, ''))} placeholder={`Input NIK (KTP)...`} maxLength="16" /> */} <Input type="text" value={ktpNumber} onChange={(e) => setKtpNumber(e.target.value)} placeholder={'KTP/ID Card'} maxLength="16" />
<Input type="text" value={ktpNumber} onChange={(e) => setKtpNumber(e.target.value.replace(/[^0-9]/g, ''))} placeholder={t('inputNik')} maxLength="16" />
</FormGroup> </FormGroup>
</Col> </Col>
<Col md={6}> <Col md={6}>

Loading…
Cancel
Save