feat( S&P ): add branch name to details.

This commit is contained in:
elforjani13
2022-03-02 19:07:09 +02:00
parent e46609e3f1
commit 7f4ee26979
10 changed files with 106 additions and 10 deletions

View File

@@ -2,6 +2,8 @@ import React from 'react';
import intl from 'react-intl-universal';
import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useBill, useBillLocatedLandedCost } from 'hooks/query';
import { useFeatureCan } from 'hooks/state';
import { Features } from 'common';
const BillDrawerContext = React.createContext();
@@ -9,6 +11,9 @@ const BillDrawerContext = React.createContext();
* Bill drawer provider.
*/
function BillDrawerProvider({ billId, ...props }) {
// Features guard.
const { featureCan } = useFeatureCan();
// Handle fetch bill details.
const { isLoading: isBillLoading, data: bill } = useBill(billId, {
enabled: !!billId,
@@ -36,6 +41,13 @@ function BillDrawerProvider({ billId, ...props }) {
title={intl.get('bill.drawer.title', {
number: bill.bill_number ? `(${bill.bill_number})` : null,
})}
subTitle={
featureCan(Features.Branches)
? intl.get('bill.drawer.subtitle', {
value: bill.branch?.name,
})
: null
}
/>
<BillDrawerContext.Provider value={provider} {...props} />
</DrawerLoading>