From 31d665e91eb2aca21b1aeb5159a511e63c27af36 Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Mon, 23 Jan 2023 16:38:36 +0200 Subject: [PATCH 01/68] fix(projects): fetch projects if the feature was enabled. --- .../Accounting/MakeJournal/MakeJournalProvider.tsx | 3 ++- .../Expenses/ExpenseForm/ExpenseFormPageProvider.tsx | 5 +++-- .../Purchases/Bills/BillForm/BillFormProvider.tsx | 6 ++++-- .../Sales/Estimates/EstimateForm/EstimateFormProvider.tsx | 6 ++++-- .../Sales/Invoices/InvoiceForm/InvoiceFormProvider.tsx | 6 ++++-- .../PaymentReceiveForm/PaymentReceiveFormProvider.tsx | 5 +++-- .../Sales/Receipts/ReceiptForm/ReceiptFormProvider.tsx | 3 ++- 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/containers/Accounting/MakeJournal/MakeJournalProvider.tsx b/src/containers/Accounting/MakeJournal/MakeJournalProvider.tsx index 00579a577..7b1e0b7e4 100644 --- a/src/containers/Accounting/MakeJournal/MakeJournalProvider.tsx +++ b/src/containers/Accounting/MakeJournal/MakeJournalProvider.tsx @@ -24,6 +24,7 @@ function MakeJournalProvider({ journalId, query, ...props }) { // Features guard. const { featureCan } = useFeatureCan(); const isBranchFeatureCan = featureCan(Features.Branches); + const isProjectFeatureCan = featureCan(Features.Projects); // Load the accounts list. const { data: accounts, isLoading: isAccountsLoading } = useAccounts(); @@ -60,7 +61,7 @@ function MakeJournalProvider({ journalId, query, ...props }) { const { data: { projects }, isLoading: isProjectsLoading, - } = useProjects(); + } = useProjects({}, { enabled: !!isProjectFeatureCan }); // Submit form payload. const [submitPayload, setSubmitPayload] = useState({}); diff --git a/src/containers/Expenses/ExpenseForm/ExpenseFormPageProvider.tsx b/src/containers/Expenses/ExpenseForm/ExpenseFormPageProvider.tsx index 0953548e3..2e7d6ede6 100644 --- a/src/containers/Expenses/ExpenseForm/ExpenseFormPageProvider.tsx +++ b/src/containers/Expenses/ExpenseForm/ExpenseFormPageProvider.tsx @@ -23,6 +23,7 @@ function ExpenseFormPageProvider({ query, expenseId, ...props }) { // Features guard. const { featureCan } = useFeatureCan(); const isBranchFeatureCan = featureCan(Features.Branches); + const isProjectsFeatureCan = featureCan(Features.Projects); const { data: currencies, isLoading: isCurrenciesLoading } = useCurrencies(); @@ -51,7 +52,7 @@ function ExpenseFormPageProvider({ query, expenseId, ...props }) { const { data: { projects }, isLoading: isProjectsLoading, - } = useProjects(); + } = useProjects({}, { enabled: !!isProjectsFeatureCan }); // Create and edit expense mutate. const { mutateAsync: createExpenseMutate } = useCreateExpense(); @@ -75,7 +76,7 @@ function ExpenseFormPageProvider({ query, expenseId, ...props }) { accounts, branches, projects, - + isCurrenciesLoading, isExpenseLoading, isCustomersLoading, diff --git a/src/containers/Purchases/Bills/BillForm/BillFormProvider.tsx b/src/containers/Purchases/Bills/BillForm/BillFormProvider.tsx index af4f4950f..7c717a9b1 100644 --- a/src/containers/Purchases/Bills/BillForm/BillFormProvider.tsx +++ b/src/containers/Purchases/Bills/BillForm/BillFormProvider.tsx @@ -44,6 +44,7 @@ function BillFormProvider({ billId, ...props }) { const { featureCan } = useFeatureCan(); const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isBranchFeatureCan = featureCan(Features.Branches); + const isProjectsFeatureCan = featureCan(Features.Projects); // Handle fetch accounts. const { data: accounts, isLoading: isAccountsLoading } = useAccounts(); @@ -86,7 +87,7 @@ function BillFormProvider({ billId, ...props }) { const { data: { projects }, isLoading: isProjectsLoading, - } = useProjects(); + } = useProjects({}, { enabled: !!isProjectsFeatureCan }); // Handle fetching bill settings. const { isFetching: isSettingLoading } = useSettings(); @@ -101,7 +102,8 @@ function BillFormProvider({ billId, ...props }) { const isNewMode = !billId; // Determines whether the warehouse and branches are loading. - const isFeatureLoading = isWarehouesLoading || isBranchesLoading; + const isFeatureLoading = + isWarehouesLoading || isBranchesLoading || isProjectsLoading; const provider = { accounts, diff --git a/src/containers/Sales/Estimates/EstimateForm/EstimateFormProvider.tsx b/src/containers/Sales/Estimates/EstimateForm/EstimateFormProvider.tsx index 9af9eeae9..87196dc24 100644 --- a/src/containers/Sales/Estimates/EstimateForm/EstimateFormProvider.tsx +++ b/src/containers/Sales/Estimates/EstimateForm/EstimateFormProvider.tsx @@ -27,6 +27,7 @@ function EstimateFormProvider({ query, estimateId, ...props }) { const { featureCan } = useFeatureCan(); const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isBranchFeatureCan = featureCan(Features.Branches); + const isProjectsFeatureCan = featureCan(Features.Projects); const { data: estimate, @@ -68,7 +69,7 @@ function EstimateFormProvider({ query, estimateId, ...props }) { const { data: { projects }, isLoading: isProjectsLoading, - } = useProjects(); + } = useProjects({}, { enabled: !!isProjectsFeatureCan }); // Handle fetch settings. useSettingsEstimates(); @@ -83,7 +84,8 @@ function EstimateFormProvider({ query, estimateId, ...props }) { const isNewMode = !estimateId; // Determines whether the warehouse and branches are loading. - const isFeatureLoading = isWarehouesLoading || isBranchesLoading; + const isFeatureLoading = + isWarehouesLoading || isBranchesLoading || isProjectsLoading; // Provider payload. const provider = { diff --git a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.tsx b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.tsx index 7b8c10fdd..ba5e0884b 100644 --- a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.tsx +++ b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.tsx @@ -32,6 +32,7 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) { const { featureCan } = useFeatureCan(); const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isBranchFeatureCan = featureCan(Features.Branches); + const isProjectsFeatureCan = featureCan(Features.Projects); const { data: invoice, isLoading: isInvoiceLoading } = useInvoice(invoiceId, { enabled: !!invoiceId, @@ -41,7 +42,7 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) { const { data: { projects }, isLoading: isProjectsLoading, - } = useProjects(); + } = useProjects({}, { enabled: !!isProjectsFeatureCan }); // Fetches the estimate by the given id. const { data: estimate, isLoading: isEstimateLoading } = useEstimate( @@ -98,7 +99,8 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) { const isNewMode = !invoiceId; // Determines whether the warehouse and branches are loading. - const isFeatureLoading = isWarehouesLoading || isBranchesLoading; + const isFeatureLoading = + isWarehouesLoading || isBranchesLoading || isProjectsLoading; const provider = { invoice, diff --git a/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveFormProvider.tsx b/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveFormProvider.tsx index 998ca45b8..8c08abd3e 100644 --- a/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveFormProvider.tsx +++ b/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveFormProvider.tsx @@ -27,6 +27,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) { // Features guard. const { featureCan } = useFeatureCan(); const isBranchFeatureCan = featureCan(Features.Branches); + const isProjectsFeatureCan = featureCan(Features.Projects); // Fetches payment recevie details. const { @@ -62,7 +63,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) { const { data: { projects }, isLoading: isProjectsLoading, - } = useProjects(); + } = useProjects({}, { enabled: !!isProjectsFeatureCan }); // Detarmines whether the new mode. const isNewMode = !paymentReceiveId; @@ -82,7 +83,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) { customers, branches, projects, - + isPaymentLoading, isAccountsLoading, isPaymentFetching, diff --git a/src/containers/Sales/Receipts/ReceiptForm/ReceiptFormProvider.tsx b/src/containers/Sales/Receipts/ReceiptForm/ReceiptFormProvider.tsx index d70414252..23f432115 100644 --- a/src/containers/Sales/Receipts/ReceiptForm/ReceiptFormProvider.tsx +++ b/src/containers/Sales/Receipts/ReceiptForm/ReceiptFormProvider.tsx @@ -26,6 +26,7 @@ function ReceiptFormProvider({ receiptId, ...props }) { const { featureCan } = useFeatureCan(); const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isBranchFeatureCan = featureCan(Features.Branches); + const isProjectsFeatureCan = featureCan(Features.Projects); // Fetch sale receipt details. const { data: receipt, isLoading: isReceiptLoading } = useReceipt(receiptId, { @@ -89,7 +90,7 @@ function ReceiptFormProvider({ receiptId, ...props }) { const { data: { projects }, isLoading: isProjectsLoading, - } = useProjects(); + } = useProjects({}, { enabled: !!isProjectsFeatureCan }); // Fetch receipt settings. const { isLoading: isSettingLoading } = useSettingsReceipts(); From 49f3465265ccffe4b9192acfd35c92270e3b0754 Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Mon, 23 Jan 2023 22:45:59 +0200 Subject: [PATCH 02/68] fix(DataTable): text style of table header. --- src/style/components/DataTable/DataTable.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/style/components/DataTable/DataTable.scss b/src/style/components/DataTable/DataTable.scss index b5e6276c6..42f588972 100644 --- a/src/style/components/DataTable/DataTable.scss +++ b/src/style/components/DataTable/DataTable.scss @@ -18,11 +18,11 @@ overflow: hidden; .th { - padding: 0.7rem 0.5rem; + padding: 0.68rem 0.5rem; background: #f5f5f5; font-size: 14px; - color: #3b495d; - font-weight: 600; + color: #4E5B6F; + font-weight: 400; border-bottom: 1px solid #d2dde2; >div { @@ -389,7 +389,7 @@ .thead .th { background: #fff; - color: #222222; + color: #000; border-bottom: 1px solid #000000; padding: 0.5rem; } From 806e4fb54cf2a7fb8715b627f1b536cc407ae9f2 Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Mon, 23 Jan 2023 22:52:45 +0200 Subject: [PATCH 03/68] fix(FinancialStatements): Hide filtering by branches/warehouses if the feature is not enabled. --- .../CashFlowAccountsActionsBar.tsx | 1 - .../APAgingSummary/APAgingSummaryHeader.tsx | 19 ++++--- .../APAgingSummaryHeaderDimensions.tsx | 21 +++++--- .../ARAgingSummary/ARAgingSummaryHeader.tsx | 18 +++++-- .../ARAgingSummaryHeaderDimensions.tsx | 23 +++++--- .../BalanceSheet/BalanceSheetHeader.tsx | 20 ++++--- .../BalanceSheetHeaderDimensionsPanel.tsx | 21 +++++--- .../CashFlowStatementDimensionsPanel.tsx | 20 ++++--- .../CashFlowStatementHeader.tsx | 19 ++++--- .../FinancialStatementsFilter.tsx | 12 +++-- .../GeneralLedger/GeneralLedgerHeader.tsx | 18 +++++-- .../GeneralLedgerHeaderDimensionsPanel.tsx | 21 +++++--- .../InventoryItemDetailsHeader.tsx | 20 ++++--- ...entoryItemDetailsHeaderDimensionsPanel.tsx | 52 ++++++++++++------- .../InventoryValuationHeader.tsx | 21 +++++--- ...nventoryValuationHeaderDimensionsPanel.tsx | 50 ++++++++++++------ .../ProfitLossSheet/ProfitLossSheetHeader.tsx | 18 +++++-- .../ProfitLossSheetHeaderDimensionsPanel.tsx | 25 +++++---- .../TrialBalanceSheetHeader.tsx | 18 +++++-- ...TrialBalanceSheetHeaderDimensionsPanel.tsx | 25 +++++---- src/index.tsx | 5 +- 21 files changed, 298 insertions(+), 149 deletions(-) diff --git a/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.tsx b/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.tsx index 45c9d1d76..faa61dfbc 100644 --- a/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.tsx +++ b/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.tsx @@ -71,7 +71,6 @@ function CashFlowAccountsActionsBar({ text={} onClick={handleAddBankAccount} /> -