Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes config #769

Merged
merged 1 commit into from
May 31, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,76 +52,77 @@ export const CampaignConfig = (totalFormData, dataParams, isSubmitting) => {
],
},
{
stepCount: "1",
stepCount: "2",
key: "3",
name: "HCM_CAMPAIGN_DATE",
name: "HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA",
body: [
{
isMandatory: false,
key: "campaignDates",
key: "boundaryType",
type: "component",
component: "CampaignDates",
component: "SelectingBoundaries",
withoutLabelFieldPair: true,
withoutLabel: true,
disable: false,
customProps: {
module: "HCM",
sessionData: totalFormData,
isSubmitting: isSubmitting
dataParams: dataParams,
},
populators: {
name: "campaignDates",
name: "boundaryType",
// optionsKey: "code",
// error: "ES__REQUIRED",
error: "ES__REQUIRED",
required: true,
},
},
],
},
{
stepCount: "2",
stepCount: "3",
key: "4",
name: "HCM_CAMPAIGN_CYCLE_CONFIGURE",
name: "HCM_CAMPAIGN_DATE",
body: [
{
isMandatory: false,
key: "cycleConfigure",
key: "campaignDates",
type: "component",
component: "CycleConfiguration",
withoutLabelFieldPair: true,
component: "CampaignDates",
withoutLabel: true,
disable: false,
customProps: {
module: "HCM",
sessionData: totalFormData,
isSubmitting: isSubmitting
},
populators: {
name: "cycleConfiguration",
sessionData: totalFormData,
name: "campaignDates",
// optionsKey: "code",
error: "ES__REQUIRED",
// error: "ES__REQUIRED",
required: true,
},
},
],
},
{
stepCount: "2",
stepCount: "3",
key: "5",
name: "HCM_CAMPAIGN_DELIVERY_DATA",
name: "HCM_CAMPAIGN_CYCLE_CONFIGURE",
body: [
{
isMandatory: false,
key: "deliveryRule",
key: "cycleConfigure",
type: "component",
component: "DeliveryRule",
component: "CycleConfiguration",
withoutLabelFieldPair: true,
withoutLabel: true,
disable: false,
customProps: {
module: "HCM",
sessionData: totalFormData,
},
populators: {
name: "deliveryRule",
name: "cycleConfiguration",
sessionData: totalFormData,
// optionsKey: "code",
error: "ES__REQUIRED",
required: true,
Expand All @@ -132,23 +133,22 @@ export const CampaignConfig = (totalFormData, dataParams, isSubmitting) => {
{
stepCount: "3",
key: "6",
name: "HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA",
name: "HCM_CAMPAIGN_DELIVERY_DATA",
body: [
{
isMandatory: false,
key: "boundaryType",
key: "deliveryRule",
type: "component",
component: "SelectingBoundaries",
component: "DeliveryRule",
withoutLabelFieldPair: true,
withoutLabel: true,
disable: false,
customProps: {
module: "HCM",
sessionData: totalFormData,
dataParams: dataParams,
},
populators: {
name: "boundaryType",
name: "deliveryRule",
// optionsKey: "code",
error: "ES__REQUIRED",
required: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ const SetupCampaign = ({ hierarchyType }) => {
},
HCM_CAMPAIGN_DATE: {
campaignDates: {
startDate: draftData?.startDate ? new Date(draftData?.startDate)?.toISOString()?.split("T")?.[0] : null,
endDate: draftData?.endDate ? new Date(draftData?.endDate)?.toISOString()?.split("T")?.[0] : null,
startDate: draftData?.startDate ? new Date(draftData?.startDate)?.toISOString()?.split("T")?.[0] : "",
endDate: draftData?.endDate ? new Date(draftData?.endDate)?.toISOString()?.split("T")?.[0] : "",
},
},
HCM_CAMPAIGN_CYCLE_CONFIGURE: {
Expand Down Expand Up @@ -386,7 +386,7 @@ const SetupCampaign = ({ hierarchyType }) => {

useEffect(() => {
setTimeout(() => {
setEnabled(fetchUpload || (fetchBoundary && currentKey > 6));
setEnabled(fetchUpload || (fetchBoundary && currentKey > 3));
}, 3000);
}, [fetchUpload, fetchBoundary, currentKey]);

Expand Down Expand Up @@ -1136,7 +1136,7 @@ const SetupCampaign = ({ hierarchyType }) => {
};

const onStepClick = (step) => {
if ((currentKey === 4 || currentKey === 5) && step > 1) {
if ((currentKey === 5 || currentKey === 6) && step > 1) {
return;
}
const filteredSteps = campaignConfig[0].form.filter((item) => item.stepCount === String(step + 1));
Expand All @@ -1147,10 +1147,10 @@ const SetupCampaign = ({ hierarchyType }) => {
if (step === 6 && Object.keys(totalFormData).includes("HCM_CAMPAIGN_UPLOAD_USER_DATA")) {
setCurrentKey(10);
setCurrentStep(7);
} else if (step === 1 && totalFormData["HCM_CAMPAIGN_NAME"] && totalFormData["HCM_CAMPAIGN_DATE"]) {
setCurrentKey(4);
} else if (step === 1 && totalFormData["HCM_CAMPAIGN_NAME"] && totalFormData["HCM_CAMPAIGN_NAME"]) {
setCurrentKey(3);
setCurrentStep(1);
} else if (!totalFormData["HCM_CAMPAIGN_NAME"] || !totalFormData["HCM_CAMPAIGN_DATE"]) {
} else if (!totalFormData["HCM_CAMPAIGN_NAME"] || !totalFormData["HCM_CAMPAIGN_NAME"]) {
// Do not set stepper and key
} else if (Object.keys(totalFormData).includes(name)) {
setCurrentKey(key);
Expand Down Expand Up @@ -1264,8 +1264,8 @@ const SetupCampaign = ({ hierarchyType }) => {
<Stepper
customSteps={[
"HCM_CAMPAIGN_SETUP_DETAILS",
"HCM_DELIVERY_DETAILS",
"HCM_BOUNDARY_DETAILS",
"HCM_DELIVERY_DETAILS",
"HCM_TARGETS",
"HCM_FACILITY_DETAILS",
"HCM_USER_DETAILS",
Expand All @@ -1289,7 +1289,7 @@ const SetupCampaign = ({ hierarchyType }) => {
actionClassName={"actionBarClass"}
className="setup-campaign"
cardClassName="setup-campaign-card"
noCardStyle={currentStep === 7 || currentStep === 0 ? false : true}
noCardStyle={currentKey ===4 || currentStep === 7 || currentStep === 0 ? false : true}
onSecondayActionClick={onSecondayActionClick}
label={noAction === "false" ? null : filteredConfig?.[0]?.form?.[0]?.isLast === true ? t("HCM_SUBMIT") : t("HCM_NEXT")}
/>
Expand Down
Loading