Browse Source

add select company by super admin

pull/1/head
farhantock 11 months ago
parent
commit
0aecd61415
  1. 110
      src/views/Master/MasterBroadcast/DialogForm.js
  2. 48
      src/views/Master/ProjectPhase/DialogForm.js
  3. 56
      src/views/SimproV2/ChecklistK3/DialogForm.js
  4. 47
      src/views/SimproV2/Divisi/DialogForm.js
  5. 58
      src/views/SimproV2/ProjectType/DialogForm.js
  6. 60
      src/views/SimproV2/Satuan/DialogForm.js

110
src/views/Master/MasterBroadcast/DialogForm.js

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { Button, Form, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; import { Button, Form, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
import Select from 'react-select'; import Select from 'react-select';
import axios from 'axios'; import axios from 'axios';
import { BASE_URL_GEOHR_API2, ROLE_SEARCH, USER_WASPANG, USER_LIST } from '../../../const/ApiConst'; import { BASE_URL_GEOHR_API2, ROLE_SEARCH, USER_WASPANG, USER_LIST, USER_SEARCH } from '../../../const/ApiConst';
import { Transfer } from 'antd'; import { Transfer } from 'antd';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
@ -51,13 +51,18 @@ class DialogForm extends Component {
allEmployeeId: [], allEmployeeId: [],
idEmployeeDivision: [], idEmployeeDivision: [],
idOrganization: [], idOrganization: [],
disableTransfer: true disableTransfer: true,
listCompany: [],
company_id: this.props.company_id,
role_name: ''
} }
} }
async componentDidMount() { async componentDidMount() {
this.getDataUsers(); if (this.props.company_id !== null) {
this.getDataRole(); this.getDataRole();
this.getDataUsers();
}
this.props.showDialog(this.showDialog); this.props.showDialog(this.showDialog);
} }
@ -69,14 +74,16 @@ class DialogForm extends Component {
id: dataEdit.id, id: dataEdit.id,
title: dataEdit.title_notif, title: dataEdit.title_notif,
description: dataEdit.description, description: dataEdit.description,
message: dataEdit.message_notif message: dataEdit.message_notif,
company_id: dataEdit.company_id
}) })
} else { } else {
this.setState({ this.setState({
id: 0, id: 0,
title: "", title: "",
description: "", description: "",
message: "" message: "",
company_id: 0
}) })
} }
this.setState({ isParentClick: false }); this.setState({ isParentClick: false });
@ -128,9 +135,12 @@ class DialogForm extends Component {
title, title,
description, description,
message, message,
penerima penerima,
} = this.state
} = this.state
let {
company_id
} = this.state
let idSend = []; let idSend = [];
let send_to_type = "all"; let send_to_type = "all";
if (penerima === "all") { if (penerima === "all") {
@ -151,15 +161,17 @@ class DialogForm extends Component {
} else { } else {
idSend = idSend; idSend = idSend;
} }
if (this.props.role_name !== 'Super Admin') {
company_id = parseInt(this.props.company_id)
}
const data = { const data = {
title, title,
description, description,
message, message,
send_to_type, send_to_type,
id: idSend id: idSend,
company_id: company_id
} }
if (param === 'registered' || param === 'send') { if (param === 'registered' || param === 'send') {
this.props.handleSaveBroadcast(param, data) this.props.handleSaveBroadcast(param, data)
} }
@ -201,7 +213,18 @@ class DialogForm extends Component {
getDataRole = async () => { getDataRole = async () => {
const payload = { const payload = {
"paging": {
"start": 0,
"length": -1
},
"columns": [
{
"name": "company_id",
"logic_operator": "=",
"value": this.state.company_id,
"operator": "AND"
}
],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
@ -231,20 +254,11 @@ class DialogForm extends Component {
} }
getDataUsers = async () => { getDataUsers = async () => {
const payload = { const payload = {
"paging": { "paging": {
"start": 0, "start": 0,
"length": 10 "length": -1
}, },
"filter_columns": [
{
"name": "name",
"value": "",
"table_name": "m_users"
}
],
"columns": [ "columns": [
{ {
"name": "name", "name": "name",
@ -254,34 +268,10 @@ class DialogForm extends Component {
"table_name": "m_users" "table_name": "m_users"
}, },
{ {
"name": "id", "name": "company_id",
"logic_operator": "=", "logic_operator": "=",
"value": "3", "value": this.state.company_id,
"operator": "AND", "operator": "AND"
"table_name": "m_roles"
}
],
"joins": [
{
"name": "m_users",
"column_join": "user_id",
"column_results": [
"username",
"name",
"email",
"gender",
"phone_number",
"address",
"birth_place",
"birth_date"
]
},
{
"name": "m_roles",
"column_join": "role_id",
"column_results": [
"name"
]
} }
], ],
"orders": { "orders": {
@ -293,7 +283,7 @@ class DialogForm extends Component {
} }
//TODO should use search instead //TODO should use search instead
const result = await axios const result = await axios
.get(USER_LIST, config) .post(USER_SEARCH, payload, config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -330,11 +320,29 @@ class DialogForm extends Component {
}; };
handleSelectCompany = (selectedOption) => {
const selectedCompanyId = selectedOption.value;
this.setState({ company_id: selectedCompanyId }, () => {
this.getDataRole();
this.getDataUsers();
});
}
renderForm = () => { renderForm = () => {
const t = this.props const t = this.props
const { errorTitle, errorMessage } = this.state const { errorTitle, errorMessage } = this.state
return ( return (
<Form> <Form>
{this.props.role_name === 'Super Admin' && (
<FormGroup>
<Label>{this.props.t('company')}</Label>
<Select
options={this.props.listCompany.map(company => ({ value: company.id, label: company.company_name }))}
onChange={this.handleSelectCompany}
value={this.state.company_id}
/>
</FormGroup>
)}
<FormGroup> <FormGroup>
<Label>{this.props.t('receiver')}</Label> <Label>{this.props.t('receiver')}</Label>
<Input type="select" value={this.state.penerima} onChange={(e) => this.handleChangePenerima(e.target.value)}> <Input type="select" value={this.state.penerima} onChange={(e) => this.handleChangePenerima(e.target.value)}>
@ -395,7 +403,7 @@ class DialogForm extends Component {
<Label>{this.props.t('broadcastDescription')}</Label> <Label>{this.props.t('broadcastDescription')}</Label>
<Input style={{ minHeight: "100px" }} type="textarea" value={this.state.description} onChange={(e) => this.setState({ description: e.target.value })} placeholder={this.props.t('inputDescription')} /> <Input style={{ minHeight: "100px" }} type="textarea" value={this.state.description} onChange={(e) => this.setState({ description: e.target.value })} placeholder={this.props.t('inputDescription')} />
</FormGroup> </FormGroup>
</Form> </Form >
) )
} }
handleCloseDialog = () => { handleCloseDialog = () => {

48
src/views/Master/ProjectPhase/DialogForm.js

@ -8,17 +8,20 @@ import InputColor from "./InputColor";
import "./styles.css"; import "./styles.css";
import "rc-color-picker/assets/index.css"; import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const company_id = localStorage.getItem("company_id") import { Select } from 'antd';
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const { Option } = Select
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [projectType, setProjectType] = useState('') const [projectType, setProjectType] = useState('')
const [color, setColor] = useState('') const [color, setColor] = useState('')
const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation(); const { t } = useTranslation();
useEffect(() => { useEffect(() => {
if (typeDialog === "Edit") { if (typeDialog === "Edit") {
setId(dataEdit.id) setId(dataEdit.id)
setProjectType(dataEdit.name) setProjectType(dataEdit.name)
setColor(dataEdit.color) setColor(dataEdit.color)
setSelectedCompany(dataEdit.company_id)
} else { } else {
setId(0) setId(0)
setColor('') setColor('')
@ -29,18 +32,24 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (typeDialog === "Save") { if (typeDialog === "Save") {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
name: projectType, name: projectType,
color, color,
company_id company_id: company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
id, id,
name: projectType, name: projectType,
color, color,
company_id company_id: company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
@ -52,6 +61,10 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(0) setId(0)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -69,6 +82,33 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

56
src/views/SimproV2/ChecklistK3/DialogForm.js

@ -5,20 +5,22 @@ import {
} from 'reactstrap'; } from 'reactstrap';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Select } from 'antd';
const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => {
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [name, setName] = useState('') const [name, setName] = useState('')
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation() const { t } = useTranslation()
useEffect(() => { useEffect(() => {
if (typeDialog === "Edit") { if (typeDialog === "Edit") {
setId(dataEdit.id) setId(dataEdit.id)
setDescription(dataEdit.description) setDescription(dataEdit.description)
setName(dataEdit.name) setName(dataEdit.name)
setSelectedCompany(dataEdit.company_id);
} else { } else {
handleClearData() handleClearData()
@ -27,20 +29,26 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: name, name: name,
description, description: description,
company_id company_id: parseInt(company_id),
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
id, id,
name: name, name: name,
description, description: description,
company_id company_id: company_id,
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
@ -56,8 +64,13 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(0) setId(0)
setName('') setName('')
setDescription('') setDescription('')
setSelectedCompany(null)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -75,6 +88,33 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

47
src/views/SimproV2/Divisi/DialogForm.js

@ -10,12 +10,13 @@ import InputColor from "./InputColor";
import "./styles.css"; import "./styles.css";
import "rc-color-picker/assets/index.css"; import "rc-color-picker/assets/index.css";
const { Option } = Select const { Option } = Select
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataDivisions, company_id }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataDivisions, company_id, role_name, listCompany }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [name, setName] = useState('') const [name, setName] = useState('')
const [parent, setParent] = useState(null) const [parent, setParent] = useState(null)
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [color, setColor] = useState('') const [color, setColor] = useState('')
const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation() const { t } = useTranslation()
const onChangeParent = (val) => { const onChangeParent = (val) => {
@ -29,6 +30,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setName(dataEdit.name) setName(dataEdit.name)
setParent(dataEdit.parent) setParent(dataEdit.parent)
setColor(dataEdit.color) setColor(dataEdit.color)
setSelectedCompany(dataEdit.company_id);
} else { } else {
setId(0) setId(0)
setColor('') setColor('')
@ -47,22 +49,28 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (!err) { if (!err) {
if (typeDialog === "Save") { if (typeDialog === "Save") {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
name, name,
description, description,
parent, parent,
color, color,
company_id company_id: company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
id, id,
name, name,
description, description,
parent, parent,
color, color,
company_id company_id: company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
@ -71,6 +79,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setName('') setName('')
setParent(null) setParent(null)
setColor('') setColor('')
setSelectedCompany(null)
} }
} }
const handleCancel = () => { const handleCancel = () => {
@ -79,8 +88,13 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setDescription('') setDescription('')
setName('') setName('')
setParent(null) setParent(null)
setSelectedCompany(null)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -133,6 +147,33 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

58
src/views/SimproV2/ProjectType/DialogForm.js

@ -3,20 +3,19 @@ import {
Modal, ModalHeader, ModalBody, ModalFooter, Modal, ModalHeader, ModalBody, ModalFooter,
Button, Form, FormGroup, Label, Input, Col, Row Button, Form, FormGroup, Label, Input, Col, Row
} from 'reactstrap'; } from 'reactstrap';
import { DatePicker, Tooltip, Select } from 'antd'; import { Select } from 'antd';
import { formatRupiah, formatNumber } from '../../../const/CustomFunc'
import moment from 'moment'; import moment from 'moment';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select const { Option } = Select
const company_id = window.localStorage.getItem('company_id');
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [projectType, setProjectType] = useState('') const [projectType, setProjectType] = useState('')
const [uom, setUom] = useState('') const [uom, setUom] = useState('')
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [unitPrice, setUnitPrice] = useState() const [unitPrice, setUnitPrice] = useState()
const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation(); const { t } = useTranslation();
@ -28,7 +27,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setUnitPrice(dataEdit.unit_price) setUnitPrice(dataEdit.unit_price)
setUom(dataEdit.uom) setUom(dataEdit.uom)
setProjectType(dataEdit.name) setProjectType(dataEdit.name)
setSelectedCompany(dataEdit.company_id)
} else { } else {
setId(0) setId(0)
} }
@ -37,39 +36,43 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (typeDialog === "Save") { if (typeDialog === "Save") {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
name: projectType, name: projectType,
description, description,
company_id company_id: company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
id, id,
name: projectType, name: projectType,
description, description,
company_id company_id: company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
setId(0) setId(0)
setDescription('') setDescription('')
setSelectedCompany(null)
} }
const handleCancel = () => { const handleCancel = () => {
closeDialog('cancel', 'none') closeDialog('cancel', 'none')
setId(0) setId(0)
setDescription('') setDescription('')
setSelectedCompany(null)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
@ -88,6 +91,33 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

60
src/views/SimproV2/Satuan/DialogForm.js

@ -3,15 +3,16 @@ import {
Modal, ModalHeader, ModalBody, ModalFooter, Modal, ModalHeader, ModalBody, ModalFooter,
Button, Form, FormGroup, Label, Input, Col, Row Button, Form, FormGroup, Label, Input, Col, Row
} from 'reactstrap'; } from 'reactstrap';
import { Select } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select;
const company_id = localStorage.getItem("company_id") const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => {
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [name, setName] = useState('') const [name, setName] = useState('')
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation() const { t } = useTranslation()
@ -20,7 +21,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(dataEdit.id) setId(dataEdit.id)
setDescription(dataEdit.description) setDescription(dataEdit.description)
setName(dataEdit.name) setName(dataEdit.name)
setSelectedCompany(dataEdit.company_id);
} else { } else {
setId(0) setId(0)
} }
@ -29,34 +30,46 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (typeDialog === "Save") { if (typeDialog === "Save") {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
name: name, name: name,
description, description: description,
company_id company_id: company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
id, id,
name: name, name: name,
description, description: description,
company_id company_id: company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
setId(0) setId(0)
setDescription('') setDescription('')
setSelectedCompany(null)
} }
const handleCancel = () => { const handleCancel = () => {
closeDialog('cancel', 'none') closeDialog('cancel', 'none')
setId(0) setId(0)
setDescription('') setDescription('')
setSelectedCompany(null)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -74,6 +87,33 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

Loading…
Cancel
Save