diff --git a/ember/app/caluma-query/models/work-item.js b/ember/app/caluma-query/models/work-item.js index 9ce8b371d..badf7e02b 100644 --- a/ember/app/caluma-query/models/work-item.js +++ b/ember/app/caluma-query/models/work-item.js @@ -139,6 +139,7 @@ export default class CustomWorkItemModel extends WorkItemModel { id question { slug + meta ... on ChoiceQuestion { options { edges { diff --git a/ember/app/ui/cases/detail/index/controller.js b/ember/app/ui/cases/detail/index/controller.js index 56c843b18..1438e46e4 100644 --- a/ember/app/ui/cases/detail/index/controller.js +++ b/ember/app/ui/cases/detail/index/controller.js @@ -15,6 +15,7 @@ import redoWorkItemMutation from "mysagw/gql/mutations/redo-work-item.graphql"; import reopenCaseMutation from "mysagw/gql/mutations/reopen-case.graphql"; import getCaseQuery from "mysagw/gql/queries/get-case.graphql"; import downloadFile from "mysagw/utils/download-file"; +import formatCurrency from "mysagw/utils/format-currency"; import CaseValidations from "mysagw/validations/case"; export default class CasesDetailIndexController extends Controller { @@ -128,12 +129,7 @@ export default class CasesDetailIndexController extends Controller { let value = answer.node[`${answer.node.__typename}Value`]; if (answer.node.question.meta.waehrung) { - value = new Intl.NumberFormat("de-CH", { - style: "currency", - currency: answer.node.question.meta.waehrung, - }) - .format(value) - .replace(".00", ".-"); + value = formatCurrency(value, answer.node.question.meta.waehrung); } return { diff --git a/ember/app/ui/components/dynamic-table/answer-value/component.js b/ember/app/ui/components/dynamic-table/answer-value/component.js index 9696268b7..ea69b39ba 100644 --- a/ember/app/ui/components/dynamic-table/answer-value/component.js +++ b/ember/app/ui/components/dynamic-table/answer-value/component.js @@ -1,6 +1,8 @@ import { get } from "@ember/object"; import Component from "@glimmer/component"; +import formatCurrency from "mysagw/utils/format-currency"; + export default class AnswerValue extends Component { get value() { const value = this.args.value.parentWorkItem ?? this.args.value; @@ -20,6 +22,13 @@ export default class AnswerValue extends Component { ).node.label; } + if (answer.question.meta?.waehrung) { + return formatCurrency( + answer[`${answer.__typename}Value`], + answer.question.meta.waehrung + ); + } + return answer[`${answer.__typename}Value`]; } } diff --git a/ember/app/utils/format-currency.js b/ember/app/utils/format-currency.js new file mode 100644 index 000000000..b172aab43 --- /dev/null +++ b/ember/app/utils/format-currency.js @@ -0,0 +1,8 @@ +export default function formatCurrency(value, currency) { + return new Intl.NumberFormat("de-CH", { + style: "currency", + currency, + }) + .format(value) + .replace(".00", ".-"); +} diff --git a/ember/translations/work-items/de.yaml b/ember/translations/work-items/de.yaml index f12fc1668..9f20ff277 100755 --- a/ember/translations/work-items/de.yaml +++ b/ember/translations/work-items/de.yaml @@ -15,7 +15,7 @@ work-items: documentNumber: "Referenz" circulationComment: "Bemerkung" circulationDecision: "Entscheid" - circulationAmount: "Betrag" + circulationAmount: "Betrag (WiMa)" distributionPlan: "Verteilplan" saveSuccess: "Aufgabe gespeichert" diff --git a/ember/translations/work-items/en.yaml b/ember/translations/work-items/en.yaml index 3ae9d39f6..e395d66e8 100644 --- a/ember/translations/work-items/en.yaml +++ b/ember/translations/work-items/en.yaml @@ -15,7 +15,7 @@ work-items: documentNumber: "Number" circulationComment: "Comment" circulationDecision: "Decision" - circulationAmount: "Amount" + circulationAmount: "Amount (WiMa)" distributionPlan: "Distribution plan" saveSuccess: "Task successfully saved" diff --git a/ember/translations/work-items/fr.yaml b/ember/translations/work-items/fr.yaml index 34fe63efa..1443a94f6 100755 --- a/ember/translations/work-items/fr.yaml +++ b/ember/translations/work-items/fr.yaml @@ -15,7 +15,7 @@ work-items: documentNumber: "Référence" circulationComment: "Remarque" circulationDecision: "Décision" - circulationAmount: "Somme" + circulationAmount: "Somme (WiMa)" distributionPlan: "Plan de distribution" saveSuccess: "Tâche enregistrée"