30 lines
776 B
JavaScript
30 lines
776 B
JavaScript
import { gql, useQuery } from '@apollo/client';
|
|
import { GetCurrencySymbolDocument } from 'graphql/crm.types';
|
|
import { observer } from 'mobx-react-lite';
|
|
import { useStore } from 'stores/hooks';
|
|
|
|
const QUERY_GET_CURRENCY_SYMBOL = gql`
|
|
query GetCurrencySymbol($currencyid: Uuid!) {
|
|
transactioncurrency(transactioncurrencyid: $currencyid) {
|
|
currencysymbol
|
|
}
|
|
}
|
|
`;
|
|
|
|
const CurrencyAddon = observer(() => {
|
|
const { $calculation } = useStore();
|
|
|
|
const currencyid = $calculation.element('selectSupplierCurrency').getValue();
|
|
|
|
const { data } = useQuery(GetCurrencySymbolDocument, {
|
|
variables: {
|
|
currencyid,
|
|
},
|
|
skip: !currencyid,
|
|
});
|
|
|
|
return <span>{data?.transactioncurrency?.currencysymbol}</span>;
|
|
});
|
|
|
|
export default <CurrencyAddon />;
|