|
|
|
@ -20,7 +20,11 @@ const config = {
|
|
|
|
|
|
|
|
|
|
const MasterCompany = ({ params }) => { |
|
|
|
|
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 = { |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
@ -53,7 +57,10 @@ const MasterCompany = ({ params }) => {
|
|
|
|
|
const [loading, setLoading] = useState(true); |
|
|
|
|
const pageName = params.name; |
|
|
|
|
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(() => { |
|
|
|
|
setLoading(true) |
|
|
|
|
getDataCompany() |
|
|
|
@ -354,7 +361,9 @@ const MasterCompany = ({ params }) => {
|
|
|
|
|
formData.append('ref_id', id); |
|
|
|
|
formData.append('category', 'company_logo_header'); |
|
|
|
|
formData.append('files', data); |
|
|
|
|
formData.append('company_name',configApp.company_name); |
|
|
|
|
if(role != 'Super Admin') { |
|
|
|
|
formData.append('company_name',configApp.company_name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await axios |
|
|
|
|
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) |
|
|
|
@ -368,7 +377,9 @@ const MasterCompany = ({ params }) => {
|
|
|
|
|
formData.append('ref_id', id); |
|
|
|
|
formData.append('category', 'company_logo_login'); |
|
|
|
|
formData.append('files', data); |
|
|
|
|
formData.append('company_name',configApp.company_name); |
|
|
|
|
if(role != 'Super Admin') { |
|
|
|
|
formData.append('company_name',configApp.company_name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await axios |
|
|
|
|
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) |
|
|
|
@ -382,7 +393,9 @@ const MasterCompany = ({ params }) => {
|
|
|
|
|
formData.append('ref_id', id); |
|
|
|
|
formData.append('category', 'company_favicon'); |
|
|
|
|
formData.append('files', data); |
|
|
|
|
formData.append('company_name',configApp.company_name); |
|
|
|
|
if(role != 'Super Admin') { |
|
|
|
|
formData.append('company_name',configApp.company_name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await axios |
|
|
|
|
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) |
|
|
|
@ -402,7 +415,7 @@ const MasterCompany = ({ params }) => {
|
|
|
|
|
|
|
|
|
|
// Delete Image Function
|
|
|
|
|
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 |
|
|
|
|
.delete(URL, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
@ -411,7 +424,7 @@ const MasterCompany = ({ params }) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
.delete(URL, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
@ -420,7 +433,7 @@ const MasterCompany = ({ params }) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
.delete(URL, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
@ -429,7 +442,7 @@ const MasterCompany = ({ params }) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
.delete(URL, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
|