|
|
|
@ -3,7 +3,7 @@ import {
|
|
|
|
|
Modal, ModalHeader, ModalBody, ModalFooter, |
|
|
|
|
Button, Form, FormGroup, Row, Col, Label, Input, |
|
|
|
|
} from 'reactstrap'; |
|
|
|
|
import { Pagination, Table, Tooltip, Select } from 'antd'; |
|
|
|
|
import { Pagination, Table, Tooltip, Select, Spin } from 'antd'; |
|
|
|
|
import SweetAlert from 'react-bootstrap-sweetalert'; |
|
|
|
|
import { NotificationContainer, NotificationManager } from 'react-notifications'; |
|
|
|
|
import DialogFormUser from './FormUser'; |
|
|
|
@ -12,7 +12,7 @@ import 'antd/dist/antd.css';
|
|
|
|
|
import { useTranslation } from 'react-i18next'; |
|
|
|
|
import axios from "../../../const/interceptorApi" |
|
|
|
|
import { |
|
|
|
|
USER_SEARCH, USER_EDIT, USER_DELETE, ROLE_SEARCH, DIVISI_SEARCH, MENU_COMPANY_SEARCH |
|
|
|
|
USER_SEARCH, MENU_COMPANY_DELETE, USER_DELETE, ROLE_SEARCH, COMPANY_MANAGEMENT_GET_ID, MENU_COMPANY_SEARCH |
|
|
|
|
} from '../../../const/ApiConst'; |
|
|
|
|
const token = window.localStorage.getItem('token'); |
|
|
|
|
const config = { |
|
|
|
@ -22,7 +22,7 @@ const config = {
|
|
|
|
|
"Content-type": `application/json` |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, companyID, companyNameProp }) => { |
|
|
|
|
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, companyID, companyNameProp, dataEditCompany, imageHeader, imageFavIcon, imageLogin, lastIdCompany }) => { |
|
|
|
|
const { Option } = Select |
|
|
|
|
const { t } = useTranslation() |
|
|
|
|
const [registrationnumber, setRegistrationNumber] = useState('') |
|
|
|
@ -31,9 +31,9 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
const [phoneNumber, setPhoneNumber] = useState('') |
|
|
|
|
const [emailCompany, setEmailCompany] = useState('') |
|
|
|
|
const [description, setDescription] = useState('') |
|
|
|
|
const [logoLogin, setLogoLogin] = useState([]) |
|
|
|
|
const [logoHeader, setLogoHeader] = useState([]) |
|
|
|
|
const [favIcon, setFavIcon] = useState([]) |
|
|
|
|
const [logoLogin, setLogoLogin] = useState(null) |
|
|
|
|
const [logoHeader, setLogoHeader] = useState(null) |
|
|
|
|
const [favIcon, setFavIcon] = useState(null) |
|
|
|
|
const [loginInstruction, setLoginInstruction] = useState('') |
|
|
|
|
const [about, setAbout] = useState('') |
|
|
|
|
const [htmlTitle, setHtmlTitle] = useState('') |
|
|
|
@ -42,7 +42,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
const [statusCompany, setStatusCompany] = useState(true) |
|
|
|
|
const [template, setTemplate] = useState('') |
|
|
|
|
const [lastIdxURL, setLastIdxURL] = useState(0); |
|
|
|
|
|
|
|
|
|
const [availableUrl, setAvailableBaseUrl] = useState(false); |
|
|
|
|
const [id, setId] = useState(0) |
|
|
|
|
|
|
|
|
|
const [dataTable, setDatatable] = useState([]) |
|
|
|
|
const [openDialogUser, setOpenDialogUser] = useState(false) |
|
|
|
@ -63,15 +64,57 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
const [totalPageMenu, setTotalPageMenu] = useState(0) |
|
|
|
|
const [openDialogMenu, setOpenDialogMenu] = useState(false) |
|
|
|
|
const [typeDialogMenu, setTypeDialogMenu] = useState("add") |
|
|
|
|
const [loading, setLoading] = useState(true); |
|
|
|
|
useEffect(() => { |
|
|
|
|
if (companyID && typeDialog === 'Set') { |
|
|
|
|
setLoading(true) |
|
|
|
|
getDataUser() |
|
|
|
|
getRoleList() |
|
|
|
|
} else { |
|
|
|
|
} else if(typeDialog === 'Set-Menu') { |
|
|
|
|
setLoading(true) |
|
|
|
|
getDataMenu() |
|
|
|
|
} else if(lastIdCompany && typeDialog === 'Save'){ |
|
|
|
|
getLastCompany() |
|
|
|
|
} |
|
|
|
|
}, [typeDialog, companyID, rowsPerPage, currentPage, rowsPerPageMenu, currentPageMenu]) |
|
|
|
|
},[typeDialog, companyID, lastIdCompany, rowsPerPage, currentPage, rowsPerPageMenu, currentPageMenu]) |
|
|
|
|
|
|
|
|
|
useEffect(()=> { |
|
|
|
|
if(typeDialog==="Edit"){ |
|
|
|
|
setId(dataEditCompany.id) |
|
|
|
|
setRegistrationNumber(dataEditCompany.registration_no) |
|
|
|
|
setCompanyName(dataEditCompany.company_name) |
|
|
|
|
setEmailCompany(dataEditCompany.email) |
|
|
|
|
setPhoneNumber(dataEditCompany.phone_no) |
|
|
|
|
setAddressCompany(dataEditCompany.address) |
|
|
|
|
setAbout(dataEditCompany.about) |
|
|
|
|
setAppName(dataEditCompany.app_name) |
|
|
|
|
setHtmlTitle(dataEditCompany.html_title) |
|
|
|
|
setStatusCompany(dataEditCompany.is_active) |
|
|
|
|
setTemplate(dataEditCompany.template_id) |
|
|
|
|
setBaseUrl(dataEditCompany.base_url ? dataEditCompany.base_url : []) |
|
|
|
|
if(dataEditCompany.base_url) |
|
|
|
|
{ |
|
|
|
|
setAvailableBaseUrl(true) |
|
|
|
|
} else { |
|
|
|
|
setAvailableBaseUrl(false) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
setId(0) |
|
|
|
|
setCompanyName('') |
|
|
|
|
setEmailCompany('') |
|
|
|
|
setPhoneNumber('') |
|
|
|
|
setAddressCompany('') |
|
|
|
|
setAbout('') |
|
|
|
|
setAppName('') |
|
|
|
|
setHtmlTitle('') |
|
|
|
|
setStatusCompany('') |
|
|
|
|
setTemplate('') |
|
|
|
|
setLogoLogin(null) |
|
|
|
|
setLogoHeader(null) |
|
|
|
|
setFavIcon(null) |
|
|
|
|
setBaseUrl([]) |
|
|
|
|
} |
|
|
|
|
},[dataEditCompany,openDialog]) |
|
|
|
|
|
|
|
|
|
const onShowSizeChange = (current, pageSize) => { |
|
|
|
|
setRowsPerPage(pageSize) |
|
|
|
@ -94,13 +137,12 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
|
|
|
|
|
"orders": { "columns": ["id"], "ascending": false } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
.post(ROLE_SEARCH, formData, config) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
setLoading(false) |
|
|
|
|
setRoleList(result.data.data); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -204,7 +246,9 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
setDatatable(result.data.data); |
|
|
|
|
setTotalPage(result.data.totalRecord); |
|
|
|
|
setLoading(false) |
|
|
|
|
} else { |
|
|
|
|
setLoading(false) |
|
|
|
|
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -212,14 +256,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
const getDataMenu = async () => { |
|
|
|
|
let start = 0; |
|
|
|
|
|
|
|
|
|
if (currentPage !== 1 && currentPage > 1) { |
|
|
|
|
start = (currentPage * rowsPerPage) - rowsPerPage |
|
|
|
|
if (currentPageMenu !== 1 && currentPageMenu > 1) { |
|
|
|
|
start = (currentPageMenu * rowsPerPageMenu) - rowsPerPageMenu |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const payload = { |
|
|
|
|
"paging": { |
|
|
|
|
"start": start, |
|
|
|
|
"length": rowsPerPage |
|
|
|
|
"length": rowsPerPageMenu |
|
|
|
|
}, |
|
|
|
|
"columns": [{ |
|
|
|
|
"name": "company_id", |
|
|
|
@ -245,11 +289,24 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
setDatatableMenu(result.data.data); |
|
|
|
|
setTotalPageMenu(result.data.totalRecord); |
|
|
|
|
setLoading(false) |
|
|
|
|
} else { |
|
|
|
|
setLoading(false) |
|
|
|
|
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const getLastCompany = async () => { |
|
|
|
|
const result = await axios |
|
|
|
|
.get(`${COMPANY_MANAGEMENT_GET_ID(lastIdCompany)}`, config) |
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
const lastRegistrationNumber = result.data.data.registration_no; |
|
|
|
|
const lastNumber = parseInt(lastRegistrationNumber.match(/\d+$/)[0]); |
|
|
|
|
const newNumber = lastNumber + 1; |
|
|
|
|
const newRegistrationNumber = `RG-${newNumber}`; |
|
|
|
|
setRegistrationNumber(newRegistrationNumber); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleAddUser = async () => { |
|
|
|
|
await setTypeDialogUser("Save") |
|
|
|
@ -271,7 +328,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
if (type == 'success') { |
|
|
|
|
NotificationManager.success(`${message}`, "Success!!"); |
|
|
|
|
getDataUser() |
|
|
|
|
} else if (type == 'Failed') { |
|
|
|
|
} else if (type == 'failed') { |
|
|
|
|
NotificationManager.error(`${message}`, "Failed!!"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -297,7 +354,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
if (type == 'success') { |
|
|
|
|
NotificationManager.success(`${message}`, "Success!!"); |
|
|
|
|
getDataMenu() |
|
|
|
|
} else if (type == 'Failed') { |
|
|
|
|
} else if (type == 'failed') { |
|
|
|
|
NotificationManager.error(`${message}`, "Failed!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -323,68 +380,41 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
phone_no: phoneNumber, |
|
|
|
|
email: emailCompany, |
|
|
|
|
description: description, |
|
|
|
|
logo_login: logoLogin, |
|
|
|
|
logo_header: logoHeader, |
|
|
|
|
favicon_image: favIcon, |
|
|
|
|
login_instruction: loginInstruction, |
|
|
|
|
about: about, |
|
|
|
|
html_title: htmlTitle, |
|
|
|
|
app_name: appName, |
|
|
|
|
base_url: baseUrl, |
|
|
|
|
base_url: baseUrl.length == 0 ? null : baseUrl, |
|
|
|
|
is_active: statusCompany, |
|
|
|
|
template_id: template |
|
|
|
|
template_id: parseInt(template) |
|
|
|
|
} |
|
|
|
|
console.log(data) |
|
|
|
|
|
|
|
|
|
data.imageLogin = logoLogin ? logoLogin : null; |
|
|
|
|
data.imageHeader = logoHeader ? logoHeader : null; |
|
|
|
|
data.imageFavicon = favIcon ? favIcon : null; |
|
|
|
|
closeDialog('save', data); |
|
|
|
|
} else if (typeDialog === "Set") { |
|
|
|
|
// if (!password && password === "") {
|
|
|
|
|
// alert("Please fill password");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (password !== retryPassword) {
|
|
|
|
|
// alert("Password doesn't match");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (password.length < 8) {
|
|
|
|
|
// alert("Password minimum 8 character");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// data = {
|
|
|
|
|
// id,
|
|
|
|
|
// username,
|
|
|
|
|
// password,
|
|
|
|
|
// email,
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
closeDialog('edit', data); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
// data = {
|
|
|
|
|
// id,
|
|
|
|
|
// name: resourceName,
|
|
|
|
|
// username,
|
|
|
|
|
// employee_type: employeeType,
|
|
|
|
|
// phone_number: phoneNo,
|
|
|
|
|
// email,
|
|
|
|
|
// gender,
|
|
|
|
|
// birth_place: birthPlace,
|
|
|
|
|
// blood_type: bloodType,
|
|
|
|
|
// ktp_number: ktpNumber,
|
|
|
|
|
// biaya_per_jam: biayaPerJam.replace('.', ''),
|
|
|
|
|
// role_id: roleId,
|
|
|
|
|
// divisi_id: divisionId,
|
|
|
|
|
// address,
|
|
|
|
|
// status_resource: statusResource,
|
|
|
|
|
// status_boundary: statusRestriction,
|
|
|
|
|
// company_id: company_id
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (birthDate && birthDate != "") {
|
|
|
|
|
// data['birth_date'] = birthDate;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
setLoading(false); |
|
|
|
|
} else if (typeDialog === "Edit") { |
|
|
|
|
data = { |
|
|
|
|
id, |
|
|
|
|
registration_no: registrationnumber, |
|
|
|
|
company_name: companyName, |
|
|
|
|
address: addressCompany, |
|
|
|
|
phone_no: phoneNumber, |
|
|
|
|
email: emailCompany, |
|
|
|
|
description: description, |
|
|
|
|
login_instruction: loginInstruction, |
|
|
|
|
about: about, |
|
|
|
|
html_title: htmlTitle, |
|
|
|
|
app_name: appName, |
|
|
|
|
base_url: baseUrl.length == 0 ? null : baseUrl, |
|
|
|
|
is_active: statusCompany, |
|
|
|
|
template_id: parseInt(template), |
|
|
|
|
} |
|
|
|
|
data.imageLogin = logoLogin ? logoLogin : null; |
|
|
|
|
data.imageHeader = logoHeader ? logoHeader : null; |
|
|
|
|
data.imageFavicon = favIcon ? favIcon : null; |
|
|
|
|
closeDialog('edit', data); |
|
|
|
|
setLoading(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -395,27 +425,45 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
|
|
|
|
|
const handleCancel = () => { |
|
|
|
|
closeDialog('cancel', 'none') |
|
|
|
|
setDatatable([]) |
|
|
|
|
setDatatable([]); |
|
|
|
|
setBaseUrl([]); |
|
|
|
|
setAvailableBaseUrl(false); |
|
|
|
|
setLoading(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const onConfirmDelete = async () => { |
|
|
|
|
let url = USER_DELETE(idDelete); |
|
|
|
|
|
|
|
|
|
let url; |
|
|
|
|
if(typeDialog === "Set-Menu") { |
|
|
|
|
url = MENU_COMPANY_DELETE(idDelete); |
|
|
|
|
} else if(typeDialog === "Set") { |
|
|
|
|
url = USER_DELETE(idDelete); |
|
|
|
|
} |
|
|
|
|
const result = await axios.delete(url, config) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
|
getDataUser() |
|
|
|
|
setIdDelete(0) |
|
|
|
|
setAlertDelete(false) |
|
|
|
|
setIdDelete(0); |
|
|
|
|
setAlertDelete(false); |
|
|
|
|
setLoading(false); |
|
|
|
|
if (typeDialog === "Set-Menu") { |
|
|
|
|
getDataMenu(); |
|
|
|
|
NotificationManager.success(`Data menu berhasil dihapus!`, 'Success!!'); |
|
|
|
|
} else if (typeDialog === "Set") { |
|
|
|
|
getDataUser(); |
|
|
|
|
NotificationManager.success(`Data user berhasil dihapus!`, 'Success!!'); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
setIdDelete(0) |
|
|
|
|
setAlertDelete(false) |
|
|
|
|
setLoading(false); |
|
|
|
|
if (typeDialog === "Set-Menu") { |
|
|
|
|
NotificationManager.success(`Data menu gagal dihapus!`, 'Success!!'); |
|
|
|
|
} else if (typeDialog === "Set") { |
|
|
|
|
NotificationManager.error(`Data user gagal dihapus!`, 'Failed!!'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const cancelDelete = () => { |
|
|
|
|
setAlertDelete(false) |
|
|
|
@ -423,22 +471,48 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const addBaseUrl = () => { |
|
|
|
|
if (availableUrl === true) { |
|
|
|
|
const baseUrlArray = JSON.parse(baseUrl); |
|
|
|
|
baseUrlArray.push({ |
|
|
|
|
id: lastIdxURL + 1, |
|
|
|
|
base_url: "", |
|
|
|
|
}); |
|
|
|
|
setBaseUrl(JSON.stringify(baseUrlArray)); |
|
|
|
|
setLastIdxURL(lastIdxURL + 1); |
|
|
|
|
} else { |
|
|
|
|
baseUrl.push({ |
|
|
|
|
id: lastIdxURL + 1, |
|
|
|
|
url: "", |
|
|
|
|
base_url: "", |
|
|
|
|
}); |
|
|
|
|
setBaseUrl(baseUrl); |
|
|
|
|
setLastIdxURL(lastIdxURL + 1); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handleChangeBaseURL = (value, index) => { |
|
|
|
|
const handleChangeBaseURL = (e, index) => { |
|
|
|
|
if (availableUrl === true) { |
|
|
|
|
const { name, value } = e.target; |
|
|
|
|
const newBaseURL = [...JSON.parse(baseUrl)]; |
|
|
|
|
newBaseURL[index][name] = value; |
|
|
|
|
setBaseUrl(JSON.stringify(newBaseURL)); |
|
|
|
|
} else { |
|
|
|
|
const { name, value } = e.target; |
|
|
|
|
const newBaseURL = [...baseUrl]; |
|
|
|
|
newBaseURL[index] = value; |
|
|
|
|
newBaseURL[index][name] = value; |
|
|
|
|
setBaseUrl(newBaseURL); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const deleteBaseURL = (id) => { |
|
|
|
|
if (baseUrl && baseUrl.length > 0) { |
|
|
|
|
if (availableUrl === true) { |
|
|
|
|
const baseUrlArray = JSON.parse(baseUrl); |
|
|
|
|
let checkIdx = baseUrlArray.findIndex((o) => o.id === id); |
|
|
|
|
if (checkIdx > -1) { |
|
|
|
|
baseUrlArray.splice(checkIdx, 1); |
|
|
|
|
const baseFilter = baseUrlArray.filter((i2) => i2 !== id); |
|
|
|
|
setBaseUrl(JSON.stringify(baseFilter)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
let checkIdx = baseUrl.findIndex((o) => o.id === id); |
|
|
|
|
if (checkIdx > -1) { |
|
|
|
|
baseUrl.splice(checkIdx, 1); |
|
|
|
@ -447,24 +521,22 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleLogoHeader = (content) => { |
|
|
|
|
const newLogoHeader = [...logoHeader, { |
|
|
|
|
type: "image", |
|
|
|
|
content: content, |
|
|
|
|
}]; |
|
|
|
|
setLogoHeader(newLogoHeader); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const RenderBaseURL = () => { |
|
|
|
|
if (baseUrl.length > 0) { |
|
|
|
|
return baseUrl.map((item, index) => { |
|
|
|
|
let baseUrlArray; |
|
|
|
|
if(availableUrl === true) { |
|
|
|
|
baseUrlArray = JSON.parse(baseUrl); |
|
|
|
|
} else { |
|
|
|
|
baseUrlArray = baseUrl; |
|
|
|
|
} |
|
|
|
|
return baseUrlArray.map((item, index) => { |
|
|
|
|
return ( |
|
|
|
|
<Row key={index} style={{ marginBottom: 10 }}> |
|
|
|
|
<Col md={8}> |
|
|
|
|
<Input |
|
|
|
|
type="text" |
|
|
|
|
value={item.url} |
|
|
|
|
name="item" |
|
|
|
|
value={availableUrl === true ? item.base_url ? item.base_url : "" : item.base_url ? item.base_url : "" } |
|
|
|
|
name="base_url" |
|
|
|
|
onChange={(e) => handleChangeBaseURL(e, index)} |
|
|
|
|
/> |
|
|
|
|
</Col> |
|
|
|
@ -472,7 +544,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
<Button |
|
|
|
|
color="danger" |
|
|
|
|
size="sm" |
|
|
|
|
onClick={() => deleteBaseURL(item.id)} |
|
|
|
|
onClick={() => deleteBaseURL(availableUrl === true ? item.id ? item.id : "" : item.id ? item.id : "")} |
|
|
|
|
> |
|
|
|
|
<i className="fa fa-trash"></i> |
|
|
|
|
</Button> |
|
|
|
@ -502,14 +574,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
<Form> |
|
|
|
|
<Row> |
|
|
|
|
<Col md={12}> |
|
|
|
|
<span style={{ color: "red" }}>*</span>required. |
|
|
|
|
<span style={{ color: "red" }}>*</span>Is Required |
|
|
|
|
</Col> |
|
|
|
|
</Row> |
|
|
|
|
<Row> |
|
|
|
|
<Col md={6}> |
|
|
|
|
<FormGroup> |
|
|
|
|
<Label className="capitalize">Number Registration<span style={{ color: "red" }}>*</span></Label> |
|
|
|
|
<Input type="text" value={registrationnumber} onChange={(e) => setRegistrationNumber(e.target.value)} placeholder='Input Number Registration' /> |
|
|
|
|
<Input type="text" value={registrationnumber} readOnly disabled /> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
|
<Col md={6}> |
|
|
|
@ -581,8 +653,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
<FormGroup> |
|
|
|
|
<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"> |
|
|
|
|
<Option value={'1'}>Construction</Option> |
|
|
|
|
<Option value={'2'}>IT (Information AND Technology)</Option> |
|
|
|
|
<Option value={1}>Construction</Option> |
|
|
|
|
{/* <Option value={2}>IT (Information AND Technology)</Option> */} |
|
|
|
|
</Select> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
@ -620,8 +692,9 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
<Input |
|
|
|
|
type="file" |
|
|
|
|
accept="image/*" |
|
|
|
|
// onChange={(e) => handleLogoHeader(e.target.files[0])}
|
|
|
|
|
onChange={(e) => setLogoLogin(e.target.files[0])} |
|
|
|
|
/> |
|
|
|
|
<small>{imageLogin ? imageLogin.image : <p style={{ color: "red" }}>Not found image</p> }</small> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Row> |
|
|
|
|
<Row> |
|
|
|
@ -630,18 +703,20 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
<Input |
|
|
|
|
type="file" |
|
|
|
|
accept="image/*" |
|
|
|
|
onChange={(e) => handleLogoHeader(e.target.files[0])} |
|
|
|
|
onChange={(e) => setLogoHeader(e.target.files[0])} |
|
|
|
|
/> |
|
|
|
|
<small>{imageHeader ? imageHeader.image : <p style={{ color: "red" }}>Not found image</p> }</small> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Row> |
|
|
|
|
<Row> |
|
|
|
|
<FormGroup> |
|
|
|
|
<Label className="capitalize" style={{ fontWeight: "bold" }}>Fav Icon Logo</Label> |
|
|
|
|
<Label className="capitalize" style={{ fontWeight: "bold" }}>Favicon Logo</Label> |
|
|
|
|
<Input |
|
|
|
|
type="file" |
|
|
|
|
accept="image/*" |
|
|
|
|
// onChange={(e) => setProjectStructureOrg(e.target.files[0])}
|
|
|
|
|
accept=".ico" |
|
|
|
|
onChange={(e) => setFavIcon(e.target.files[0])} |
|
|
|
|
/> |
|
|
|
|
<small>{imageFavIcon ? imageFavIcon.image : <p style={{ color: "red" }}>Not found image</p> }</small> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Row> |
|
|
|
|
</Col> |
|
|
|
@ -714,7 +789,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
{ title: t('icon'), dataIndex: 'icon', key: 'icon' }, |
|
|
|
|
{ title: 'Alias', dataIndex: 'alias_name', key: 'alias_name' }, |
|
|
|
|
{ title: t('order'), dataIndex: 'sequence', key: 'sequence' }, |
|
|
|
|
{ title: t('parentMenu'), dataIndex: 'join_first_name', key: 'join_first_name', render: (text, record) => (text ? text : "-") } |
|
|
|
|
]; |
|
|
|
|
return ( |
|
|
|
|
<Table |
|
|
|
@ -767,6 +841,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
<Button onClick={handleAddUser} size='sm' color="primary"><i className='fa fa-plus'></i></Button> |
|
|
|
|
</Tooltip> |
|
|
|
|
) : |
|
|
|
|
typeDialog != "Save" && typeDialog != "Edit" && |
|
|
|
|
( |
|
|
|
|
<Tooltip title="Add Menu"> |
|
|
|
|
<Button onClick={handleAddMenu} size='sm' color="primary"><i className='fa fa-plus'></i></Button> |
|
|
|
@ -778,6 +853,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
{typeDialog !== "Set" && typeDialog !== "Set-Menu" && renderFromCompany()} |
|
|
|
|
{typeDialog === "Set" && ( |
|
|
|
|
<> |
|
|
|
|
<Spin tip="Loading..." spinning={loading}> |
|
|
|
|
{RenderTableUser} |
|
|
|
|
<Pagination |
|
|
|
|
style={{ marginTop: "25px" }} |
|
|
|
@ -789,10 +865,12 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
pageSize={rowsPerPage} |
|
|
|
|
current={currentPage} |
|
|
|
|
/> |
|
|
|
|
</Spin> |
|
|
|
|
</> |
|
|
|
|
)} |
|
|
|
|
{typeDialog === "Set-Menu" && ( |
|
|
|
|
<> |
|
|
|
|
<Spin tip="Loading..." spinning={loading}> |
|
|
|
|
{renderTableMenu} |
|
|
|
|
<Pagination |
|
|
|
|
style={{ marginTop: "25px" }} |
|
|
|
@ -804,6 +882,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
|
|
|
|
|
pageSize={rowsPerPageMenu} |
|
|
|
|
current={currentPageMenu} |
|
|
|
|
/> |
|
|
|
|
</Spin> |
|
|
|
|
</> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|