Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/pages/campaigns/components/campaignForm/FormProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export interface NewCampaignValues {
notes?: string;
cuf?: { id: string; value: string[] }[];
provinces?: string[];
autoApply?: boolean;
}

const useGetInitialCufCriteria = ({
Expand Down Expand Up @@ -187,6 +188,7 @@ const FormProvider = ({
})) || [],
cuf: initialCufCriteria,
provinces: dossier?.visibilityCriteria?.province || [],
autoApply: dossier?.autoApply === 1,
};

const validationSchema = yup.object({
Expand Down Expand Up @@ -354,6 +356,7 @@ const FormProvider = ({
? parseInt(values.productType, 10)
: undefined,
notes: values.notes,
autoApply: values.autoApply,
visibilityCriteria: {
gender: values.genderRequirements?.options || [],
cuf: values.cuf
Expand Down
34 changes: 34 additions & 0 deletions src/pages/campaigns/components/campaignForm/fields/AutoApply.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
Checkbox,
FieldProps,
FormikField,
FormLabel,
} from "@appquality/appquality-design-system";
import { useFormikContext } from "formik";
import { NewCampaignValues } from "../FormProvider";

const AutoApply = () => {
const { setFieldValue } = useFormikContext<NewCampaignValues>();

return (
<div>
<FormLabel htmlFor="" label="Auto-apply candidates" />

<FormikField name="autoApply">
{({ field }: FieldProps) => (
<Checkbox
name={field.name}
id="autoApply"
label="Should auto-select candidates once the tester applies?"
checked={field.value}
onChange={(e) => {
setFieldValue("autoApply", e.target.checked);
}}
/>
)}
</FormikField>
</div>
);
};

export default AutoApply;
2 changes: 2 additions & 0 deletions src/pages/campaigns/components/campaignForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { PhaseSelector } from "../PhaseSelector";
import { CampaignFormContext } from "./campaignFormContext";
import FormOverlay from "./feedbackMessages/FormOverlay";
import AgeRequirements from "./fields/AgeRequirements";
import AutoApply from "./fields/AutoApply";
import BrowsersMultiselect from "./fields/BrowsersMultiselect";
import CountrySelect from "./fields/CountrySelect";
import CufCriteria from "./fields/CufCriteria";
Expand Down Expand Up @@ -129,6 +130,7 @@ const CampaignFormContent = ({ dossier, isEdit, duplicate }: FormProps) => {
required
/>
<TestTypeSelect />
<AutoApply />
</FieldWrapper>
<Title size="s" className="aq-mb-2 aq-pt-4">
Give some context to your co-workers
Expand Down
4 changes: 4 additions & 0 deletions src/services/tryberApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,8 @@ export type GetCampaignsByCampaignBugsAndBugIdApiResponse =
id: number;
media: {
id: number;
type: string;
url: string;
}[];
note: string;
reason: string;
Expand Down Expand Up @@ -1877,6 +1879,7 @@ export type PostDossiersApiArg = {
};
};
export type GetDossiersByCampaignApiResponse = /** status 200 OK */ {
autoApply: number;
browsers?: {
id: number;
name: string;
Expand Down Expand Up @@ -3122,6 +3125,7 @@ export type DossierCreationData = {
additionals?: ({
showInStats?: boolean;
} & CampaignAdditionalField)[];
autoApply?: boolean;
browsers?: number[];
bugTypes?: number[];
closeDate?: string;
Expand Down
Loading