|
|
@ -12,7 +12,7 @@ import 'antd/dist/antd.css'; |
|
|
|
import { useTranslation } from 'react-i18next'; |
|
|
|
import { useTranslation } from 'react-i18next'; |
|
|
|
import axios from "../../../const/interceptorApi" |
|
|
|
import axios from "../../../const/interceptorApi" |
|
|
|
import { |
|
|
|
import { |
|
|
|
USER_SEARCH, MENU_COMPANY_DELETE, USER_DELETE, ROLE_SEARCH, COMPANY_MANAGEMENT_GET_ID, MENU_COMPANY_SEARCH |
|
|
|
USER_SEARCH, MENU_COMPANY_DELETE, USER_DELETE, ROLE_SEARCH, COMPANY_MANAGEMENT_GET_ID, MENU_COMPANY_SEARCH, BASE_SIMPRO_LUMEN_IMAGE |
|
|
|
} from '../../../const/ApiConst'; |
|
|
|
} from '../../../const/ApiConst'; |
|
|
|
const token = window.localStorage.getItem('token'); |
|
|
|
const token = window.localStorage.getItem('token'); |
|
|
|
const config = { |
|
|
|
const config = { |
|
|
@ -22,7 +22,7 @@ const config = { |
|
|
|
"Content-type": `application/json` |
|
|
|
"Content-type": `application/json` |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, companyID, companyNameProp, dataEditCompany, imageHeader, imageFavIcon, imageLogin, lastIdCompany }) => { |
|
|
|
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, companyID, companyNameProp, dataEditCompany, imageHeader, imageFavIcon, imageLogin, imageSlider, lastIdCompany }) => { |
|
|
|
const { Option } = Select |
|
|
|
const { Option } = Select |
|
|
|
const { t } = useTranslation() |
|
|
|
const { t } = useTranslation() |
|
|
|
const [registrationnumber, setRegistrationNumber] = useState('') |
|
|
|
const [registrationnumber, setRegistrationNumber] = useState('') |
|
|
@ -33,6 +33,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
const [description, setDescription] = useState('') |
|
|
|
const [description, setDescription] = useState('') |
|
|
|
const [logoLogin, setLogoLogin] = useState(null) |
|
|
|
const [logoLogin, setLogoLogin] = useState(null) |
|
|
|
const [logoHeader, setLogoHeader] = useState(null) |
|
|
|
const [logoHeader, setLogoHeader] = useState(null) |
|
|
|
|
|
|
|
const [sliderLogin, setSliderLogin] = useState(null) |
|
|
|
const [favIcon, setFavIcon] = useState(null) |
|
|
|
const [favIcon, setFavIcon] = useState(null) |
|
|
|
const [loginInstruction, setLoginInstruction] = useState('') |
|
|
|
const [loginInstruction, setLoginInstruction] = useState('') |
|
|
|
const [about, setAbout] = useState('') |
|
|
|
const [about, setAbout] = useState('') |
|
|
@ -65,6 +66,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
const [openDialogMenu, setOpenDialogMenu] = useState(false) |
|
|
|
const [openDialogMenu, setOpenDialogMenu] = useState(false) |
|
|
|
const [typeDialogMenu, setTypeDialogMenu] = useState("add") |
|
|
|
const [typeDialogMenu, setTypeDialogMenu] = useState("add") |
|
|
|
const [loading, setLoading] = useState(true); |
|
|
|
const [loading, setLoading] = useState(true); |
|
|
|
|
|
|
|
const [modalOpen, setModalOpen] = useState(false); |
|
|
|
|
|
|
|
const [typeImage, setTypeImage] = useState(''); |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (companyID && typeDialog === 'Set') { |
|
|
|
if (companyID && typeDialog === 'Set') { |
|
|
|
setLoading(true) |
|
|
|
setLoading(true) |
|
|
@ -98,6 +101,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setAvailableBaseUrl(false) |
|
|
|
setAvailableBaseUrl(false) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setSliderLogin(null) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setId(0) |
|
|
|
setId(0) |
|
|
|
setCompanyName('') |
|
|
|
setCompanyName('') |
|
|
@ -111,6 +115,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
setTemplate('') |
|
|
|
setTemplate('') |
|
|
|
setLogoLogin(null) |
|
|
|
setLogoLogin(null) |
|
|
|
setLogoHeader(null) |
|
|
|
setLogoHeader(null) |
|
|
|
|
|
|
|
setSliderLogin(null) |
|
|
|
setFavIcon(null) |
|
|
|
setFavIcon(null) |
|
|
|
setBaseUrl([]) |
|
|
|
setBaseUrl([]) |
|
|
|
} |
|
|
|
} |
|
|
@ -391,6 +396,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
data.imageLogin = logoLogin ? logoLogin : null; |
|
|
|
data.imageLogin = logoLogin ? logoLogin : null; |
|
|
|
data.imageHeader = logoHeader ? logoHeader : null; |
|
|
|
data.imageHeader = logoHeader ? logoHeader : null; |
|
|
|
data.imageFavicon = favIcon ? favIcon : null; |
|
|
|
data.imageFavicon = favIcon ? favIcon : null; |
|
|
|
|
|
|
|
data.imageSlider = sliderLogin ? sliderLogin : null; |
|
|
|
closeDialog('save', data); |
|
|
|
closeDialog('save', data); |
|
|
|
setLoading(false); |
|
|
|
setLoading(false); |
|
|
|
} else if (typeDialog === "Edit") { |
|
|
|
} else if (typeDialog === "Edit") { |
|
|
@ -413,6 +419,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
data.imageLogin = logoLogin ? logoLogin : null; |
|
|
|
data.imageLogin = logoLogin ? logoLogin : null; |
|
|
|
data.imageHeader = logoHeader ? logoHeader : null; |
|
|
|
data.imageHeader = logoHeader ? logoHeader : null; |
|
|
|
data.imageFavicon = favIcon ? favIcon : null; |
|
|
|
data.imageFavicon = favIcon ? favIcon : null; |
|
|
|
|
|
|
|
data.imageSlider = sliderLogin ? sliderLogin : null; |
|
|
|
closeDialog('edit', data); |
|
|
|
closeDialog('edit', data); |
|
|
|
setLoading(false); |
|
|
|
setLoading(false); |
|
|
|
} |
|
|
|
} |
|
|
@ -427,6 +434,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
closeDialog('cancel', 'none') |
|
|
|
closeDialog('cancel', 'none') |
|
|
|
setDatatable([]); |
|
|
|
setDatatable([]); |
|
|
|
setBaseUrl([]); |
|
|
|
setBaseUrl([]); |
|
|
|
|
|
|
|
setSliderLogin(null); |
|
|
|
setAvailableBaseUrl(false); |
|
|
|
setAvailableBaseUrl(false); |
|
|
|
setLoading(false); |
|
|
|
setLoading(false); |
|
|
|
} |
|
|
|
} |
|
|
@ -568,9 +576,27 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const truncateText = (text, maxLength) => { |
|
|
|
|
|
|
|
if (text.length > maxLength) { |
|
|
|
|
|
|
|
return text.substring(0, maxLength) + '...'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return text; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const toggleModal = () => { |
|
|
|
|
|
|
|
setModalOpen(!modalOpen); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleImageClick = async (type) => { |
|
|
|
|
|
|
|
setTypeImage(type); |
|
|
|
|
|
|
|
if (type != '') { |
|
|
|
|
|
|
|
toggleModal(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const renderFromCompany = () => { |
|
|
|
const renderFromCompany = () => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
|
|
|
|
<> |
|
|
|
<Form> |
|
|
|
<Form> |
|
|
|
<Row> |
|
|
|
<Row> |
|
|
|
<Col md={12}> |
|
|
|
<Col md={12}> |
|
|
@ -654,7 +680,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
<Label className="capitalize">Template Application<span style={{ color: "red" }}>*</span></Label> |
|
|
|
<Label className="capitalize">Template Application<span style={{ color: "red" }}>*</span></Label> |
|
|
|
<Select style={{ width: "100%" }} defaultValue={template} onChange={(e) => setTemplate(e)} placeholder="Select a template for application"> |
|
|
|
<Select style={{ width: "100%" }} defaultValue={template} onChange={(e) => setTemplate(e)} placeholder="Select a template for application"> |
|
|
|
<Option value={1}>Construction</Option> |
|
|
|
<Option value={1}>Construction</Option> |
|
|
|
{/* <Option value={2}>IT (Information AND Technology)</Option> */} |
|
|
|
|
|
|
|
</Select> |
|
|
|
</Select> |
|
|
|
</FormGroup> |
|
|
|
</FormGroup> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
@ -687,15 +712,45 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
<Col md={6}> |
|
|
|
<Col md={6}> |
|
|
|
<Row> |
|
|
|
<Row> |
|
|
|
<FormGroup> |
|
|
|
<FormGroup> |
|
|
|
<Label className="capitalize" style={{ fontWeight: "bold" }}>Logo Login</Label> |
|
|
|
<Label className="capitalize" style={{ fontWeight: "bold" }}>Logo Login</Label> |
|
|
|
<Input |
|
|
|
<Input |
|
|
|
type="file" |
|
|
|
type="file" |
|
|
|
accept="image/*" |
|
|
|
accept="image/*" |
|
|
|
onChange={(e) => setLogoLogin(e.target.files[0])} |
|
|
|
onChange={(e) => setLogoLogin(e.target.files[0])} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<small>{imageLogin ? imageLogin.image : <p style={{ color: "red" }}>Not found image</p> }</small> |
|
|
|
<small onClick={imageLogin ? () => handleImageClick('imageLogin') : ''} style={{ cursor: imageLogin ? "pointer" : ""}}> |
|
|
|
</FormGroup> |
|
|
|
<p style={{ textDecoration: imageLogin ? 'underline' : 'none', color: imageLogin ? 'blue' : 'red' }}> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
imageLogin ? ( |
|
|
|
|
|
|
|
"View Image" |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
"Not found image" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
</small> |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
|
|
|
|
<Label className="capitalize" style={{ fontWeight: "bold" }}>Slider Login </Label><small> (Multiple Input)</small> |
|
|
|
|
|
|
|
<Input |
|
|
|
|
|
|
|
type="file" |
|
|
|
|
|
|
|
accept="image/*" |
|
|
|
|
|
|
|
multiple |
|
|
|
|
|
|
|
onChange={(e) => setSliderLogin(e.target.files)} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<small onClick={imageSlider.length ? () => handleImageClick('imageSlider') : ''} style={{ cursor: imageSlider.length ? "pointer" : ""}}> |
|
|
|
|
|
|
|
<p style={{ textDecoration: imageSlider.length ? 'underline' : 'none', color: imageSlider.length ? 'blue' : 'red' }}> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
imageSlider.length > 0 ? ( |
|
|
|
|
|
|
|
"View image" |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
"Not found image" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
</small> |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
<Row> |
|
|
|
<Row> |
|
|
|
<FormGroup> |
|
|
|
<FormGroup> |
|
|
@ -705,10 +760,18 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
accept="image/*" |
|
|
|
accept="image/*" |
|
|
|
onChange={(e) => setLogoHeader(e.target.files[0])} |
|
|
|
onChange={(e) => setLogoHeader(e.target.files[0])} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<small>{imageHeader ? imageHeader.image : <p style={{ color: "red" }}>Not found image</p> }</small> |
|
|
|
<small onClick={imageHeader ? () => handleImageClick('imageHeader') : ''} style={{ cursor: imageHeader ? "pointer" : ""}}> |
|
|
|
|
|
|
|
<p style={{ textDecoration: imageHeader ? 'underline' : 'none', color: imageHeader ? 'blue' : 'red' }}> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
imageHeader ? ( |
|
|
|
|
|
|
|
"View image" |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
"Not found image" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
</small> |
|
|
|
</FormGroup> |
|
|
|
</FormGroup> |
|
|
|
</Row> |
|
|
|
|
|
|
|
<Row> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
<FormGroup> |
|
|
|
<Label className="capitalize" style={{ fontWeight: "bold" }}>Favicon Logo</Label> |
|
|
|
<Label className="capitalize" style={{ fontWeight: "bold" }}>Favicon Logo</Label> |
|
|
|
<Input |
|
|
|
<Input |
|
|
@ -716,12 +779,54 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company |
|
|
|
accept=".ico" |
|
|
|
accept=".ico" |
|
|
|
onChange={(e) => setFavIcon(e.target.files[0])} |
|
|
|
onChange={(e) => setFavIcon(e.target.files[0])} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<small>{imageFavIcon ? imageFavIcon.image : <p style={{ color: "red" }}>Not found image</p> }</small> |
|
|
|
<small onClick={imageFavIcon ? () => handleImageClick('favIcon') : ''} style={{ cursor: imageFavIcon ? "pointer" : "" }}> |
|
|
|
|
|
|
|
<p style={{ textDecoration: imageFavIcon ? 'underline' : 'none', color: imageFavIcon ? 'blue' : 'red' }}> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
imageFavIcon ? ( |
|
|
|
|
|
|
|
"View image" |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
"Not found image" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
</small> |
|
|
|
</FormGroup> |
|
|
|
</FormGroup> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
</Form> |
|
|
|
</Form> |
|
|
|
|
|
|
|
<Modal isOpen={modalOpen} toggle={toggleModal}> |
|
|
|
|
|
|
|
<ModalBody> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
typeImage !== 'imageSlider' ? ( |
|
|
|
|
|
|
|
imageLogin || imageHeader || imageFavIcon ? ( |
|
|
|
|
|
|
|
<img |
|
|
|
|
|
|
|
src={ |
|
|
|
|
|
|
|
`${BASE_SIMPRO_LUMEN_IMAGE}/` + |
|
|
|
|
|
|
|
(typeImage === 'imageHeader' && imageHeader ? imageHeader.image : |
|
|
|
|
|
|
|
typeImage === 'imageLogin' && imageLogin ? imageLogin.image : |
|
|
|
|
|
|
|
typeImage === 'favIcon' && imageFavIcon ? imageFavIcon.image : '') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
style={{ maxWidth: "100%" }} |
|
|
|
|
|
|
|
alt="Image Preview" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
):('-') |
|
|
|
|
|
|
|
):( |
|
|
|
|
|
|
|
<Row style={{ display:'flex', justifyContent:'center' }}> |
|
|
|
|
|
|
|
{imageSlider && imageSlider.map((item, index)=> ( |
|
|
|
|
|
|
|
<Col md={6} style={{ marginBottom:'20px' }}> |
|
|
|
|
|
|
|
<img key={index} src={`${BASE_SIMPRO_LUMEN_IMAGE}/` + item.image} style={{ width:'150px', display:'block' }}></img> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
))} |
|
|
|
|
|
|
|
</Row> |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</ModalBody> |
|
|
|
|
|
|
|
<ModalFooter> |
|
|
|
|
|
|
|
<Button color="secondary" onClick={toggleModal}>Close</Button> |
|
|
|
|
|
|
|
</ModalFooter> |
|
|
|
|
|
|
|
</Modal> |
|
|
|
|
|
|
|
</> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|