Further UI Updates.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Col, Row, Typography } from "antd";
|
||||
import React from "react";
|
||||
import { Checkbox, Col, Row } from "antd";
|
||||
import React, { useContext } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||
import JobsCreateOwnerInfoNewComponent from "./jobs-create-owner-info.new.component";
|
||||
import JobsCreateOwnerInfoSearchComponent from "./jobs-create-owner-info.search.component";
|
||||
|
||||
@@ -11,12 +12,30 @@ const colSpan = {
|
||||
|
||||
export default function JobsCreateOwnerInfoComponent({ loading, owners }) {
|
||||
const { t } = useTranslation();
|
||||
const [state, setState] = useContext(JobCreateContext);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Row>
|
||||
<Typography.Title>{t("jobs.labels.create.ownerinfo")}</Typography.Title>
|
||||
</Row>
|
||||
<Row gutter={[32, 32]}>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
<Checkbox
|
||||
defaultChecked={state.owner.new}
|
||||
checked={state.owner.new}
|
||||
onChange={() => {
|
||||
setState({
|
||||
...state,
|
||||
owner: {
|
||||
...state.owner,
|
||||
new: !state.owner.new,
|
||||
selectedid: null,
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("jobs.labels.create.newowner")}
|
||||
</Checkbox>
|
||||
</Col>
|
||||
|
||||
<Col {...colSpan}>
|
||||
<JobsCreateOwnerInfoSearchComponent
|
||||
loading={loading}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Form, Input, Checkbox, Switch } from "antd";
|
||||
import { Form, Input, Switch } from "antd";
|
||||
import React, { useContext } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||
@@ -9,28 +9,11 @@ import FormItemPhone, {
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
export default function JobsCreateOwnerInfoNewComponent() {
|
||||
const [state, setState] = useContext(JobCreateContext);
|
||||
const [state] = useContext(JobCreateContext);
|
||||
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div>
|
||||
<Checkbox
|
||||
defaultChecked={state.owner.new}
|
||||
checked={state.owner.new}
|
||||
onChange={() => {
|
||||
setState({
|
||||
...state,
|
||||
owner: {
|
||||
...state.owner,
|
||||
new: !state.owner.new,
|
||||
selectedid: null,
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("jobs.labels.create.newowner")}
|
||||
</Checkbox>
|
||||
|
||||
<LayoutFormRow header={t("owners.forms.name")} grow>
|
||||
<Form.Item
|
||||
label={t("owners.fields.ownr_ln")}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Input, Table } from "antd";
|
||||
import { Card, Input, Table } from "antd";
|
||||
import React, { useContext, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||
@@ -91,65 +91,63 @@ export default function JobsCreateOwnerInfoSearchComponent({
|
||||
};
|
||||
|
||||
return (
|
||||
<Table
|
||||
loading={loading}
|
||||
title={() => {
|
||||
return (
|
||||
<div className="imex-table-header">
|
||||
<Input.Search
|
||||
className="imex-table-header__search"
|
||||
placeholder={t("general.labels.search")}
|
||||
onSearch={(value) => {
|
||||
setState({
|
||||
...state,
|
||||
owner: { ...state.owner, search: value },
|
||||
});
|
||||
}}
|
||||
enterButton
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
scroll={{ x: true }}
|
||||
pagination={{ position: "top" }}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={owners}
|
||||
onChange={handleTableChange}
|
||||
rowSelection={{
|
||||
onSelect: (props) => {
|
||||
setState({
|
||||
...state,
|
||||
owner: { ...state.owner, new: false, selectedid: props.id },
|
||||
});
|
||||
},
|
||||
type: "radio",
|
||||
selectedRowKeys: [state.owner.selectedid],
|
||||
}}
|
||||
onRow={(record, rowIndex) => {
|
||||
return {
|
||||
onClick: (event) => {
|
||||
if (record) {
|
||||
if (record.id) {
|
||||
setState({
|
||||
...state,
|
||||
owner: {
|
||||
...state.owner,
|
||||
new: false,
|
||||
selectedid: record.id,
|
||||
},
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
<Card
|
||||
extra={
|
||||
<Input.Search
|
||||
placeholder={t("general.labels.search")}
|
||||
onSearch={(value) => {
|
||||
setState({
|
||||
...state,
|
||||
owner: { ...state.owner, selectedid: null },
|
||||
owner: { ...state.owner, search: value },
|
||||
});
|
||||
}}
|
||||
enterButton
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
loading={loading}
|
||||
scroll={{ x: true }}
|
||||
pagination={{ position: "top" }}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={owners}
|
||||
onChange={handleTableChange}
|
||||
rowSelection={{
|
||||
onSelect: (props) => {
|
||||
setState({
|
||||
...state,
|
||||
owner: { ...state.owner, new: false, selectedid: props.id },
|
||||
});
|
||||
},
|
||||
};
|
||||
}}
|
||||
/>
|
||||
type: "radio",
|
||||
selectedRowKeys: [state.owner.selectedid],
|
||||
}}
|
||||
onRow={(record, rowIndex) => {
|
||||
return {
|
||||
onClick: (event) => {
|
||||
if (record) {
|
||||
if (record.id) {
|
||||
setState({
|
||||
...state,
|
||||
owner: {
|
||||
...state.owner,
|
||||
new: false,
|
||||
selectedid: record.id,
|
||||
},
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
setState({
|
||||
...state,
|
||||
owner: { ...state.owner, selectedid: null },
|
||||
});
|
||||
},
|
||||
};
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user