Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-19 12:29:04 -05:00
11 changed files with 300 additions and 119 deletions

View File

@@ -9,17 +9,20 @@ import {createStructuredSelector} from "reselect";
import {UPDATE_JOB_LINES_IOU} from "../../graphql/jobs-lines.queries";
import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors";
import {CreateIouForJob} from "../jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util";
import {selectTechnician} from "../../redux/tech/tech.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
currentUser: selectCurrentUser,
technician: selectTechnician,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(mapStateToProps, mapDispatchToProps)(JobCreateIOU);
export function JobCreateIOU({bodyshop, currentUser, job, selectedJobLines}) {
export function JobCreateIOU({bodyshop, currentUser, job, selectedJobLines, technician}) {
const {t} = useTranslation();
const [loading, setLoading] = useState(false);
const client = useApolloClient();
@@ -79,13 +82,13 @@ export function JobCreateIOU({bodyshop, currentUser, job, selectedJobLines}) {
title={t("jobs.labels.createiouwarning")}
onConfirm={handleCreateIou}
disabled={
!selectedJobLines || selectedJobLines.length === 0 || !job.converted
!selectedJobLines || selectedJobLines.length === 0 || !job.converted || technician
}
>
<Button
loading={loading}
disabled={
!selectedJobLines || selectedJobLines.length === 0 || !job.converted
!selectedJobLines || selectedJobLines.length === 0 || !job.converted || technician
}
>
{t("jobs.actions.createiou")}