IO-244 IOU Bug Fixes
This commit is contained in:
@@ -21,12 +21,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCreateIOU);
|
||||
|
||||
export function JobCreateIOU({
|
||||
bodyshop,
|
||||
currentUser,
|
||||
jobid,
|
||||
selectedJobLines,
|
||||
}) {
|
||||
export function JobCreateIOU({ bodyshop, currentUser, job, selectedJobLines }) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const client = useApolloClient();
|
||||
@@ -44,7 +39,7 @@ export function JobCreateIOU({
|
||||
//Query all of the job details to recreate.
|
||||
const iouId = await CreateIouForJob(
|
||||
client,
|
||||
jobid,
|
||||
job.id,
|
||||
{
|
||||
status: bodyshop.md_ro_statuses.default_open,
|
||||
bodyshopid: bodyshop.id,
|
||||
@@ -63,7 +58,7 @@ export function JobCreateIOU({
|
||||
variables: { ids: selectedJobLinesIds },
|
||||
update(cache) {
|
||||
cache.modify({
|
||||
id: cache.identify(jobid),
|
||||
id: cache.identify(job.id),
|
||||
fields: {
|
||||
joblines(existingJobLines, { readField }) {
|
||||
return existingJobLines.map((a) => {
|
||||
@@ -86,7 +81,9 @@ export function JobCreateIOU({
|
||||
>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={!selectedJobLines || selectedJobLines.length === 0}
|
||||
disabled={
|
||||
!selectedJobLines || selectedJobLines.length === 0 || !job.converted
|
||||
}
|
||||
>
|
||||
{t("jobs.actions.createiou")}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user