diff --git a/src/pages/AdminPanel/CompanyController.jsx b/src/pages/AdminPanel/CompanyController.jsx index 0d5a27e..8ce555d 100644 --- a/src/pages/AdminPanel/CompanyController.jsx +++ b/src/pages/AdminPanel/CompanyController.jsx @@ -51,7 +51,7 @@ export default function CompanyController() { columns={companyColumns} dataSource={companies} onRowAdd={makeActionHandler('insert', handlerProps)} - onRowEdit={makeActionHandler('update', handlerProps)} + onRowEdit={makeActionHandler('put', handlerProps)} onRowDelete={makeActionHandler('delete', handlerProps)} /> diff --git a/src/pages/AdminPanel/PermissionController.jsx b/src/pages/AdminPanel/PermissionController.jsx index 4e7bb17..8fcf992 100644 --- a/src/pages/AdminPanel/PermissionController.jsx +++ b/src/pages/AdminPanel/PermissionController.jsx @@ -55,7 +55,7 @@ export const PermissionController = () => { columns={columns} dataSource={permissions} onRowAdd={makeActionHandler('insert', handlerProps)} - onRowEdit={makeActionHandler('update', handlerProps)} + onRowEdit={makeActionHandler('put', handlerProps)} onRowDelete={makeActionHandler('delete', handlerProps)} /> diff --git a/src/pages/AdminPanel/UserController.jsx b/src/pages/AdminPanel/UserController.jsx index 5f10bde..4054501 100644 --- a/src/pages/AdminPanel/UserController.jsx +++ b/src/pages/AdminPanel/UserController.jsx @@ -158,7 +158,7 @@ export default function UserController() { columns={columns} dataSource={users} onRowAdd={makeActionHandler('insert', handlerProps)} - onRowEdit={makeActionHandler('update', handlerProps)} + onRowEdit={makeActionHandler('put', handlerProps)} onRowDelete={makeActionHandler('delete', handlerProps)} additionalButtons={additionalButtons} buttonsWidth={120} diff --git a/src/pages/AdminPanel/WellController.jsx b/src/pages/AdminPanel/WellController.jsx index b756c3b..6547e82 100644 --- a/src/pages/AdminPanel/WellController.jsx +++ b/src/pages/AdminPanel/WellController.jsx @@ -23,27 +23,33 @@ import { import { arrayOrDefault } from '../../utils' import { coordsFixed } from './DepositController' +import '../../styles/admin.css' + const wellTypes = [ { value: 1, label: 'Наклонно-направленная' }, { value: 2, label: 'Горизонтальная' }, ] const TelemetrySelect = memo(({ telemetry, value, onChange }) => { - const [options, setOptions] = useState([]) - - useEffect(() => { - const options = telemetry.map((row) => ({ - value: row.id, - label: getTelemetryLabel(row) - })) - setOptions(options) - }, [telemetry]) - const onSelectChange = (id) => { onChange?.(telemetry.find((row) => row.id === id)) } - return + {telemetry.map((row, i) => ( + + + {getTelemetryLabel(row)} + + + ))} + + ) }) export default function WellController() { @@ -104,7 +110,7 @@ export default function WellController() { editable: true, render: (telemetry) => , input: , - }), + }, ), makeTagColumn('Компании', 'companies', companies, 'id', 'caption', { editable: true, render: (company) => , @@ -117,6 +123,11 @@ export default function WellController() { `Не удалось загрузить список кустов` ), []) + const recordParser = (record) => ({ + ...record, + idTelemetry: record.telemetry.id, + }) + const handlerProps = { service: AdminWellService, setLoader: setShowLoader, @@ -131,8 +142,8 @@ export default function WellController() { bordered columns={columns} dataSource={wells} - onRowAdd={makeActionHandler('insert', handlerProps)} - onRowEdit={makeActionHandler('put', handlerProps)} + onRowAdd={makeActionHandler('insert', handlerProps, recordParser)} + onRowEdit={makeActionHandler('put', handlerProps, recordParser)} onRowDelete={makeActionHandler('delete', handlerProps)} //additionalButtons={addititonalButtons} buttonsWidth={95} diff --git a/src/styles/admin.css b/src/styles/admin.css new file mode 100644 index 0000000..d2f6af7 --- /dev/null +++ b/src/styles/admin.css @@ -0,0 +1,12 @@ + +.telemetry_select { + min-width: 300px !important; +} + +.telemetry_select .telemetry_used { + color: black; +} + +.telemetry_select .telemetry_unused { + color: gray; +}