Fixed manual job creation validation errors BOD-252
This commit is contained in:
@@ -6,7 +6,7 @@ import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
||||
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
export default function JobsCreateJobsInfo({ form }) {
|
||||
export default function JobsCreateJobsInfo({ form, selected }) {
|
||||
const { t } = useTranslation();
|
||||
const { getFieldValue } = form;
|
||||
return (
|
||||
@@ -74,7 +74,7 @@ export default function JobsCreateJobsInfo({ form }) {
|
||||
name="est_ct_fn"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
required: selected && true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
@@ -86,7 +86,7 @@ export default function JobsCreateJobsInfo({ form }) {
|
||||
name="est_ct_ln"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
required: selected && true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
|
||||
@@ -12,11 +12,11 @@ export default function JobsCreateOwnerContainer() {
|
||||
skip: !state.owner.search,
|
||||
});
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type='error' />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
return (
|
||||
<JobsCreateOwnerInfoComponent
|
||||
loading={loading}
|
||||
owners={data ? data.search_owner : null}
|
||||
owners={data ? data.search_owners : null}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,16 +125,11 @@ export default function JobsCreateOwnerInfoNewComponent() {
|
||||
},
|
||||
]}
|
||||
name={["owner", "data", "ownr_ea"]}
|
||||
shouldUpdate
|
||||
>
|
||||
{() => {
|
||||
return (
|
||||
<FormItemEmail
|
||||
//email={form.getFieldValue("ownr_ea")}
|
||||
disabled={!state.owner.new}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
<FormItemEmail
|
||||
//email={form.getFieldValue("ownr_ea")}
|
||||
disabled={!state.owner.new}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("owners.fields.ownr_ph1")}
|
||||
|
||||
@@ -20,27 +20,28 @@ export default function OwnerFindModalContainer({
|
||||
|
||||
const ownersList = useQuery(QUERY_SEARCH_OWNER_BY_IDX, {
|
||||
variables: {
|
||||
search: owner ? `${owner.ownr_fn || ""} ${owner.ownr_ln || ""}` : null
|
||||
search: owner ? `${owner.ownr_fn || ""} ${owner.ownr_ln || ""}` : null,
|
||||
},
|
||||
skip: !owner,
|
||||
fetchPolicy: "network-only"
|
||||
fetchPolicy: "network-only",
|
||||
});
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={t("owners.labels.existing_owners")}
|
||||
width={"80%"}
|
||||
{...modalProps}>
|
||||
{...modalProps}
|
||||
>
|
||||
{loading ? <LoadingSpinner /> : null}
|
||||
{error ? <AlertComponent message={error.message} type='error' /> : null}
|
||||
{error ? <AlertComponent message={error.message} type="error" /> : null}
|
||||
{owner ? (
|
||||
<OwnerFindModalComponent
|
||||
selectedOwner={selectedOwner}
|
||||
setSelectedOwner={setSelectedOwner}
|
||||
ownersListLoading={ownersList.loading}
|
||||
ownersList={
|
||||
ownersList.data && ownersList.data.search_owner
|
||||
? ownersList.data.search_owner
|
||||
ownersList.data && ownersList.data.search_owners
|
||||
? ownersList.data.search_owners
|
||||
: null
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -46,12 +45,12 @@ function RbacWrapper({
|
||||
);
|
||||
}
|
||||
|
||||
RbacWrapper.propTypes = {
|
||||
currentUser: PropTypes.object.isRequired,
|
||||
authLevel: PropTypes.number.isRequired,
|
||||
noauth: PropTypes.oneOfType(PropTypes.string, PropTypes.func),
|
||||
requiredAuthLevel: PropTypes.number,
|
||||
action: PropTypes.string,
|
||||
};
|
||||
// RbacWrapper.propTypes = {
|
||||
// currentUser: PropTypes.object.isRequired,
|
||||
// authLevel: PropTypes.number.isRequired,
|
||||
// noauth: PropTypes.oneOfType(PropTypes.string, PropTypes.func),
|
||||
// requiredAuthLevel: PropTypes.number,
|
||||
// action: PropTypes.string,
|
||||
// };
|
||||
|
||||
export default connect(mapStateToProps, null)(RbacWrapper);
|
||||
|
||||
Reference in New Issue
Block a user