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

#1124 | Option to add and view Colors for Report Card removed! #1195

Merged
merged 1 commit into from
Apr 17, 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
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