Browse Source

ignore super admin

pull/1/head
wahyuun 9 months ago
parent
commit
9c92502dbc
  1. 31
      src/views/Master/MasterCompany/index.js
  2. 8
      src/views/SimproV2/CreatedProyek/DialogDocument.js
  3. 12
      src/views/SimproV2/CreatedProyek/FormDocument.js

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

@ -20,7 +20,11 @@ const config = {
const MasterCompany = ({ params }) => { const MasterCompany = ({ params }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const company_id = localStorage.getItem("company_id") let company_id = '';
const role = window.localStorage.getItem('role_name');
if(role != 'Super Admin') {
company_id = localStorage.getItem("company_id");
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -53,7 +57,10 @@ 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')); let configApp = '';
if (role !== 'Super Admin') {
configApp = JSON.parse(window.localStorage.getItem('configApp'));
}
useEffect(() => { useEffect(() => {
setLoading(true) setLoading(true)
getDataCompany() getDataCompany()
@ -354,7 +361,9 @@ 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); if(role != 'Super Admin') {
formData.append('company_name',configApp.company_name);
}
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -368,7 +377,9 @@ 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); if(role != 'Super Admin') {
formData.append('company_name',configApp.company_name);
}
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -382,7 +393,9 @@ 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); if(role != 'Super Admin') {
formData.append('company_name',configApp.company_name);
}
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -402,7 +415,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', company_id); const URL = IMAGE_DELETE(id, 'company_logo_header', company_id != '' ? company_id : 'undifined');
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -411,7 +424,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageLogin = async (id) => { const deleteImageLogin = async (id) => {
const URL = IMAGE_DELETE(id, 'company_logo_login', company_id); const URL = IMAGE_DELETE(id, 'company_logo_login', company_id != '' ? company_id : 'undifined');
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -420,7 +433,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageFavicon = async (id) => { const deleteImageFavicon = async (id) => {
const URL = IMAGE_DELETE(id, 'company_favicon', company_id); const URL = IMAGE_DELETE(id, 'company_favicon', company_id != '' ? company_id : 'undifined');
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -429,7 +442,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageSlider = async (id) => { const deleteImageSlider = async (id) => {
const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login', company_id); const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login', company_id != '' ? company_id : 'undifined');
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)

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

@ -12,6 +12,7 @@ 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 }) => {
const token = localStorage.getItem("token") 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",
@ -99,8 +100,11 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const handleShow = (file) => { const handleShow = (file) => {
const configApp = JSON.parse(window.localStorage.getItem('configApp')); let configApp = '';
const urlShow = `${BASE_SIMPRO_LUMEN_FILE_COMPANY(file, configApp.company_name)}` 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);
} }

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

@ -7,7 +7,8 @@ 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 }) => {
const token = localStorage.getItem("token") 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",
@ -33,12 +34,13 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
} }
const uploadDokumen = async () => { const uploadDokumen = async () => {
const configApp = JSON.parse(window.localStorage.getItem('configApp')); let configApp = '';
const formData = new FormData; const formData = new FormData;
if (role !== 'Super Admin') {
configApp = JSON.parse(window.localStorage.getItem('configApp'));
formData.append('company_name',configApp.company_name);
}
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
formData.append('type_dokumen', 'project-document-in-folder'); formData.append('type_dokumen', 'project-document-in-folder');

Loading…
Cancel
Save