Skip to content

Commit

Permalink
Merge pull request #1195 from ombhardwajj/removecolors
Browse files Browse the repository at this point in the history
#1124 | Option to add and view Colors for Report Card removed!
  • Loading branch information
vinayvenu authored Apr 17, 2024
2 parents c3cac9a + df8b7b9 commit 329cd6d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 34 deletions.
42 changes: 19 additions & 23 deletions src/formDesigner/components/ReportCard/CreateEditReportCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ export const CreateEditReportCard = ({ edit, ...props }) => {
]);
isValid = false;
}
if (
!isStandardReportCard &&
nested &&
(count < MinimumNumberOfNestedCards || count > MaximumNumberOfNestedCards)
) {
if (!isStandardReportCard && nested && (count < MinimumNumberOfNestedCards || count > MaximumNumberOfNestedCards)) {
setError([
...error,
{
Expand Down Expand Up @@ -181,9 +177,7 @@ export const CreateEditReportCard = ({ edit, ...props }) => {
setError([
{
key: "SERVER_ERROR",
message: `${get(error, "response.data") ||
get(error, "message") ||
"error while saving card"}`
message: `${get(error, "response.data") || get(error, "message") || "error while saving card"}`
}
]);
});
Expand Down Expand Up @@ -237,14 +231,18 @@ export const CreateEditReportCard = ({ edit, ...props }) => {
toolTipKey={"APP_DESIGNER_CARD_DESCRIPTION"}
/>
<p />
<AvniFormLabel label={"Colour Picker"} toolTipKey={"APP_DESIGNER_CARD_COLOR"} />
<PopoverColorPicker
id="colour"
label="Colour"
color={card.color}
onChange={color => dispatch({ type: "color", payload: color })}
/>
{getErrorByKey(error, "EMPTY_COLOR")}
{!isStandardReportCard && (
<React.Fragment>
<AvniFormLabel label={"Colour Picker"} toolTipKey={"APP_DESIGNER_CARD_COLOR"} />
<PopoverColorPicker
id="colour"
label="Colour"
color={card.color}
onChange={color => dispatch({ type: "color", payload: color })}
/>
{getErrorByKey(error, "EMPTY_COLOR")}
</React.Fragment>
)}
<p />
<AvniImageUpload
onSelect={setFile}
Expand Down Expand Up @@ -290,13 +288,11 @@ export const CreateEditReportCard = ({ edit, ...props }) => {
payload: { nested: card.nested, count: event.target.value }
})
}
options={Array.from({ length: MaximumNumberOfNestedCards }, (_, i) => i + 1).map(
(num, index) => (
<MenuItem value={num} key={index}>
{num}
</MenuItem>
)
)}
options={Array.from({ length: MaximumNumberOfNestedCards }, (_, i) => i + 1).map((num, index) => (
<MenuItem value={num} key={index}>
{num}
</MenuItem>
))}
toolTipKey={"APP_DESIGNER_CARD_COUNT"}
/>
)}
Expand Down
3 changes: 1 addition & 2 deletions src/formDesigner/components/ReportCard/ReportCardList.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { Privilege } from "openchs-models";
const columns = [
{
title: "Name",
render: rowData =>
!rowData.voided && <a href={`#/appDesigner/reportCard/${rowData.id}/show`}>{rowData.name}</a>
render: rowData => !rowData.voided && <a href={`#/appDesigner/reportCard/${rowData.id}/show`}>{rowData.name}</a>
},
{
title: "Description",
Expand Down
17 changes: 8 additions & 9 deletions src/formDesigner/components/ReportCard/ReportCardShow.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ const ReportCardShow = props => {
<p />
<ShowLabelValue label={"Description"} value={card.description} />
<p />
<div>
<FormLabel style={{ fontSize: "13px" }}>{"Colour"}</FormLabel>
<br />
<ColorValue colour={card.color} />
</div>
{!isStandardReportCard && (
<React.Fragment>
<FormLabel style={{ fontSize: "13px" }}>{"Colour"}</FormLabel>
<br />
<ColorValue colour={card.color} />
</React.Fragment>
)}
<p />
{!isStandardReportCard && (
<React.Fragment>
Expand All @@ -70,10 +72,7 @@ const ReportCardShow = props => {
<p />
{isStandardReportCard && (
<React.Fragment>
<ShowLabelValue
label={"Standard Report Card Type"}
value={standardReportCardType.name}
/>
<ShowLabelValue label={"Standard Report Card Type"} value={standardReportCardType.name} />
<p />
</React.Fragment>
)}
Expand Down

0 comments on commit 329cd6d

Please sign in to comment.