Skip to content

Commit

Permalink
fix: publishStartDate on quickEditOfferForm is now correct one
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaspalma committed Mar 17, 2024
1 parent 89afd67 commit cb8f75d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ const generateRow = ({
title, location, publishDate, publishEndDate, isHidden, isArchived, hiddenReason,
ownerName, getOfferVisibility, setOfferVisibility, offerId, _id, ...args }) => ({
fields: {
title: { value: (
<OfferTitle
title={title}
getOfferVisibility={getOfferVisibility}
offerId={offerId}
/>), align: "left", linkDestination: `/offer/${_id}` },
title: {
value: (
<OfferTitle
title={title}
getOfferVisibility={getOfferVisibility}
offerId={offerId}
/>), align: "left", linkDestination: `/offer/${_id}`,
},
publishStartDate: { value: format(parseISO(publishDate), "yyyy-MM-dd") },
publishEndDate: { value: format(parseISO(publishEndDate), "yyyy-MM-dd") },
location: { value: location },
Expand Down Expand Up @@ -198,16 +200,15 @@ const CompanyOffersManagementWidget = ({ addSnackbar, isMobile }) => {
return !isMobile ? (
<CollapsedQuickOfferEdit
offerId={rowKey}
offers={offers}
setOffers={setOffers}
isMobile={isMobile}
/>
) : (
<>
<div className={classes.payloadSection}>
<Grid container alignItems="center">
<Grid item xs={6}>
<Typography className={classes.collapsableTitles} variant="body1">
Actions
Actions
</Typography>
</Grid>
<Grid item xs={6} justifyContent="center">
Expand Down Expand Up @@ -269,8 +270,8 @@ const CompanyOffersManagementWidget = ({ addSnackbar, isMobile }) => {
emptyMessage="No offers here."
RowContent={RowContent}
RowCollapseComponent={RowCollapseComponent}
handleSelect={() => {}}
handleSelectAll={() => {}}
handleSelect={() => { }}
handleSelectAll={() => { }}
isSelectableTable={false}
isLoading={isLoading}
error={error}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Company/Offers/Manage/QuickOfferEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ export const QuickOfferEditForm = ({ offerId, showTitle = false }) => {
dispatch(addSnackbar(notification));
};

const { publishEndDate } = offers[offerId]["fields"];
const { publishStartDate, publishEndDate } = offers[offerId]["fields"];

const { control, fields, errors } = useOfferForm(EditOfferSchema, {
publishEndDate: publishEndDate.value,
publishDate: publishStartDate.value,
});

const isObjectEmpty =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const PublicationEndDateComponent = ({
format="yyyy-MM-dd"
minDate={fields?.publishDate}
error={!!errors?.publishEndDate ||
!!requestErrors?.publishEndDate}
!!requestErrors?.publishEndDate}
helperText={errors?.publishEndDate?.message ||
requestErrors?.publishEndDate?.message || " "}
requestErrors?.publishEndDate?.message || " "}
{...datePickerProps}
/>)}
control={control}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useOfferForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default (schema, overrideDefaultValues) => {
reValidateMode: "onChange",
defaultValues: {
title: "",
publishDate: defaultDates.getPublishDate(),
publishDate: overrideDefaultValues?.publishDate ?? defaultDates.getPublishDate(),
publishEndDate: overrideDefaultValues?.publishEndDate ?? defaultDates.getPublishEndDate(),
jobDuration: [INITIAL_JOB_DURATION, INITIAL_JOB_DURATION + 1],
jobStartDate: null,
Expand Down

0 comments on commit cb8f75d

Please sign in to comment.