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

Bug fixes #287

Merged
merged 3 commits into from
Apr 10, 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 @@ -16,7 +16,7 @@
/> -->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].9-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].10-campaign/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->

<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-css",
"version": "1.0.9-campaign",
"version": "1.0.10-campaign",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,17 @@ input[type="date"]::-webkit-calendar-picker-indicator {
top: 20%;
transform: translateY(-50%);
}
.campaign-preview-edit-container {
display: flex;
gap: 1rem;
span {
color: #f47738;
}
}
.campaign-attribute-table {
tbody {
tr:nth-child(odd) {
background-color: white;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const CampaignSummary = () => {
type: "DATA",
cardHeader: { value: t("CAMPAIGN_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(1)}>
<div className="campaign-preview-edit-container" onClick={() => handleRedirect(1)}>
<span>{t(`CAMPAIGN_EDIT`)}</span>
<EditIcon />
</div>
),
Expand Down Expand Up @@ -56,7 +57,8 @@ const CampaignSummary = () => {
type: "DATA",
cardHeader: { value: t("TARGET_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(2)}>
<div className="campaign-preview-edit-container" onClick={() => handleRedirect(4)}>
<span>{t(`CAMPAIGN_EDIT`)}</span>
<EditIcon />
</div>
),
Expand All @@ -74,7 +76,12 @@ const CampaignSummary = () => {
{
type: "COMPONENT",
cardHeader: { value: t("DELIVERY_CYCLE_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: <EditIcon />,
cardSecondaryAction: (
<div className="campaign-preview-edit-container" onClick={() => handleRedirect(2)}>
<span>{t(`CAMPAIGN_EDIT`)}</span>
<EditIcon />
</div>
),
component: "CycleDetaisPreview",
props: {
data: data?.[0],
Expand Down Expand Up @@ -269,7 +276,8 @@ const CampaignSummary = () => {
type: "DATA",
cardHeader: { value: t("CAMPAIGN_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(1)}>
<div className="campaign-preview-edit-container" onClick={() => handleRedirect(1)}>
<span>{t(`CAMPAIGN_EDIT`)}</span>
<EditIcon />
</div>
),
Expand Down Expand Up @@ -300,7 +308,8 @@ const CampaignSummary = () => {
type: "DATA",
cardHeader: { value: t("TARGET_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(2)}>
<div className="campaign-preview-edit-container" onClick={() => handleRedirect(4)}>
<span>{t(`CAMPAIGN_EDIT`)}</span>
<EditIcon />
</div>
),
Expand All @@ -318,7 +327,12 @@ const CampaignSummary = () => {
{
type: "COMPONENT",
cardHeader: { value: t("DELIVERY_CYCLE_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: <EditIcon />,
cardSecondaryAction: (
<div className="campaign-preview-edit-container" onClick={() => handleRedirect(2)}>
<span>{t(`CAMPAIGN_EDIT`)}</span>
<EditIcon />
</div>
),
component: "CycleDetaisPreview",
props: {
DUMMY_DATA: DUMMY_DATA?.[0],
Expand Down Expand Up @@ -367,16 +381,8 @@ const CampaignSummary = () => {

return (
<>
{/* <div className="cardHeaderWithOptions"> */}
<div className="madarchod">
<Header>{t("ES_TQM_SUMMARY_HEADING")}</Header>
</div>
{/* </div> */}

<div className="laudalelo">
{/* {!isLoading && <ViewComposer data={testData} isLoading={isLoading} />} */}
<ViewComposer data={data} />
</div>
<Header>{t("ES_TQM_SUMMARY_HEADING")}</Header>
<ViewComposer data={data} />
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const CycleDetaisPreview = ({ data, item, index }) => {
columnsData={[
{
Header: t("Product"),
accessor: "product",
accessor: "value",
},
{
Header: t("Count"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ const SetupCampaign = () => {
cycle.deliveries.forEach((delivery, index) => {
delivery.deliveryRules.forEach((rule) => {
const restructuredRule = {
startDate: Digit.Utils.date.convertDateToEpoch(dateData?.find((i) => i.key === cycle.cycleIndex)?.fromDate), // Hardcoded for now
endDate: Digit.Utils.date.convertDateToEpoch(dateData?.find((i) => i?.key === cycle?.cycleIndex)?.toDate), // Hardcoded for now
startDate: Digit.Utils.date.convertDateToEpoch(dateData?.find((i) => i.key == cycle.cycleIndex)?.fromDate), // Hardcoded for now
endDate: Digit.Utils.date.convertDateToEpoch(dateData?.find((i) => i?.key == cycle?.cycleIndex)?.toDate), // Hardcoded for now
jagankumar-egov marked this conversation as resolved.
Show resolved Hide resolved
cycleNumber: parseInt(cycle.cycleIndex),
deliveryNumber: parseInt(delivery.deliveryIndex),
deliveryRuleNumber: parseInt(rule.ruleKey), // New key added
Expand All @@ -107,6 +107,13 @@ const SetupCampaign = () => {
});
});

rule.products.forEach((prod) => {
restructuredRule.products.push({
value: prod?.value,
count: prod?.count,
});
});

restructuredData.push(restructuredRule);
});
});
Expand Down Expand Up @@ -295,13 +302,12 @@ const SetupCampaign = () => {
const key = Object.keys(formData)?.[0];
switch (key) {
case "campaignName":
if (typeof formData?.campaignName !== 'string' || !formData?.campaignName.trim() ) {
setShowToast({ key: "error", label: "CAMPAIGN_NAME_MISSING_TYPE_ERROR" });
return false;
}
else {
return true;
}
if (typeof formData?.campaignName !== "string" || !formData?.campaignName.trim()) {
setShowToast({ key: "error", label: "CAMPAIGN_NAME_MISSING_TYPE_ERROR" });
return false;
} else {
return true;
}
case "campaignDates":
const startDateObj = new Date(formData?.campaignDates?.startDate);
const endDateObj = new Date(formData?.campaignDates?.endDate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const AddAttributeField = ({ deliveryRuleIndex, delivery, deliveryRules, setDeli
// setAttributes((pre) => pre.map((item) => (item.key === attribute.key ? { ...item, value: e.target.value } : item)));
const updatedData = deliveryRules.map((item, index) => {
if (item.ruleKey === deliveryRuleIndex) {
item.attributes.find((i) => i.key === attribute.key).value = value;
item.attributes.find((i) => i.key === attribute.key).value = value?.code;
}
return item;
});
Expand Down Expand Up @@ -457,11 +457,12 @@ const AddDeliveryRule = ({ targetedData, deliveryRules, setDeliveryRules, index,
};

const removeProduct = (item) => {
const temp = delivery;
setDeliveryRules((prevState) => {
const updatedDeliveryRules = prevState.map((delivery) => {
if (delivery.ruleKey === delivery.ruleKey) {
if (delivery.ruleKey === temp.ruleKey) {
const updatedProducts = delivery.products
.filter((product) => product.key !== item.key)
.filter((product) => product.value !== item.value)
jagankumar-egov marked this conversation as resolved.
Show resolved Hide resolved
.map((product, index) => ({ ...product, key: index + 1 }));
return { ...delivery, products: updatedProducts };
}
Expand Down Expand Up @@ -498,7 +499,7 @@ const AddDeliveryRule = ({ targetedData, deliveryRules, setDeliveryRules, index,

{delivery?.products?.length > 0 &&
delivery?.products?.map((i) => {
i?.value && i.count ? <RemoveableTagNew text={{ value: i.value }} onClick={() => removeProduct(i)} /> : null;
return i?.value && i?.count ? <RemoveableTagNew text={{ value: i.value }} onClick={() => removeProduct(i)} /> : null;
})}
<Button
variation="secondary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function DeliverySetup({ onSelect, config, formData, control, tabCount = 2, subT
if (rule.ruleKey === action.payload.delivery.ruleKey) {
return {
...rule,
products: prodTemp,
products: [...rule.products, ...prodTemp],
};
}
return rule;
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->
<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> -->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].9-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].10-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#00bcd1" />
Expand Down
Loading