Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 142x 1083x 1083x | import {
CompanyCustomizationDefault,
ShareDisplayCurrencyMode,
type CompanyCustomization,
} from '@amalia/tenants/companies/types';
import { useCurrentCompany } from '../queries';
/**
* Better be realistic with the type here, if a configuration option disappears for instance.
*/
export const useCompanyCustomization = (): Required<CompanyCustomization> => {
const { data: company } = useCurrentCompany();
return {
holdAndReleasePaymentDateLabel: company.customization?.holdAndReleasePaymentDateLabel ?? '',
holdAndReleaseForecastPaymentDateLabel: company.customization?.holdAndReleaseForecastPaymentDateLabel ?? '',
totalCommissionLabel: company.customization?.totalCommissionLabel ?? '',
reportsPrecision: company.customization?.reportsPrecision ?? CompanyCustomizationDefault.reportsPrecision,
forecastShowComparison:
company.customization?.forecastShowComparison ?? CompanyCustomizationDefault.forecastShowComparison,
forecastBelowActualColor:
company.customization?.forecastBelowActualColor ?? CompanyCustomizationDefault.forecastBelowActualColor,
forecastAboveActualColor:
company.customization?.forecastAboveActualColor ?? CompanyCustomizationDefault.forecastAboveActualColor,
planAgreementsSharedWithManagers: !!company.customization?.planAgreementsSharedWithManagers,
defaultPeriod: company.customization?.defaultPeriod ?? CompanyCustomizationDefault.defaultPeriod,
primaryColor: company.customization?.primaryColor ?? '',
logoUrl: company.customization?.logoUrl ?? '',
selectedShareForWidget: company.customization?.selectedShareForWidget ?? null,
shareDisplayCurrencyMode:
company.customization?.shareDisplayCurrencyMode ?? ShareDisplayCurrencyMode.SHARE_CURRENCY,
};
};
|