From f849df13d4546dd1e96bdfbbd33f6fbe3aaac9ad Mon Sep 17 00:00:00 2001 From: Duncan-Brain Date: Tue, 2 Dec 2025 16:37:37 -0500 Subject: [PATCH 1/4] LF-5041 comment out library references in product inventory --- packages/api/src/controllers/productController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/api/src/controllers/productController.js b/packages/api/src/controllers/productController.js index 8eb6676978..53b48559cb 100644 --- a/packages/api/src/controllers/productController.js +++ b/packages/api/src/controllers/productController.js @@ -123,9 +123,9 @@ const productController = { } // LF-4963 - confirm property that will distinguish custom from library products - const isLibraryProduct = product.product_translation_key; - - if (!isLibraryProduct && isUnusedByTasks) { + // const isLibraryProduct = product.product_translation_key; + // if (!isLibraryProduct && isUnusedByTasks) { + if (isUnusedByTasks) { await baseController.delete(ProductModel, product_id, req, { trx }); } From 7c54b054c23dce761158b7ffc474179548c2ad7a Mon Sep 17 00:00:00 2001 From: Duncan-Brain Date: Tue, 2 Dec 2025 16:47:23 -0500 Subject: [PATCH 2/4] LF-5041 comment out library references in product inventory --- .../ProductForm/PureSoilAmendmentProductForm.tsx | 8 ++++---- packages/webapp/src/containers/ProductInventory/index.tsx | 8 ++++---- .../containers/ProductInventory/useFilteredInventory.ts | 3 ++- packages/webapp/src/containers/productSlice.js | 1 - packages/webapp/src/util/product.ts | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/webapp/src/components/ProductInventory/ProductForm/PureSoilAmendmentProductForm.tsx b/packages/webapp/src/components/ProductInventory/ProductForm/PureSoilAmendmentProductForm.tsx index 9789f0ff39..d6cdf96914 100644 --- a/packages/webapp/src/components/ProductInventory/ProductForm/PureSoilAmendmentProductForm.tsx +++ b/packages/webapp/src/components/ProductInventory/ProductForm/PureSoilAmendmentProductForm.tsx @@ -20,7 +20,8 @@ import Input, { getInputErrors } from '../../Form/Input'; import ProductDetails, { type ProductDetailsProps } from '../../Form/ProductDetails'; import { hookFormMaxCharsValidation } from '../../Form/hookformValidationUtils'; import { getSoilAmendmentFormValues } from '../../Form/ProductDetails/utils'; -import { isLibraryProduct } from '../../../util/product'; +// LF-4970 +// import { isLibraryProduct } from '../../../util/product'; import { productDefaultValuesByType } from '../../../containers/ProductInventory/ProductForm/constants'; import { TASK_TYPES } from '../../../containers/Task/constants'; import { PRODUCT_FIELD_NAMES } from '../../Task/AddSoilAmendmentProducts/types'; @@ -81,9 +82,8 @@ const PureSoilAmendmentProductForm = ({ }, [mode]); const customProductNames = useMemo(() => { - return products - .filter((product) => !product.removed && !isLibraryProduct(product)) - .map(({ name }) => name); + // LF-4970 -> .filter((product) => !product.removed && !isLibraryProduct(product)) + return products.filter((product) => !product.removed).map(({ name }) => name); }, [products]); return ( diff --git a/packages/webapp/src/containers/ProductInventory/index.tsx b/packages/webapp/src/containers/ProductInventory/index.tsx index c502eacd84..14ecb8f9df 100644 --- a/packages/webapp/src/containers/ProductInventory/index.tsx +++ b/packages/webapp/src/containers/ProductInventory/index.tsx @@ -37,7 +37,7 @@ import { useFilteredInventory } from './useFilteredInventory'; export type TableProduct = SoilAmendmentProduct & { id: Extract; - isLibraryProduct: boolean; + // LF-4970 - isLibraryProduct: boolean; }; const PRODUCT_TYPE_LABELS: Partial> = { @@ -73,8 +73,8 @@ export default function ProductInventory() { .map((product) => ({ ...product, id: product.product_id, - /* Placeholder until library products are defined */ - isLibraryProduct: product.product_id % 2 === 0, + /* LF-4970 - Placeholder until library products are defined */ + // isLibraryProduct: product.product_id % 2 === 0, })); const filteredInventory = useFilteredInventory(inventory); @@ -132,7 +132,7 @@ export default function ProductInventory() { // Custom JSX used over to reduce style override complexity
- {d.isLibraryProduct && } + {/* LF-4970 {d.isLibraryProduct && } */} {d.name}
{d.supplier} diff --git a/packages/webapp/src/containers/ProductInventory/useFilteredInventory.ts b/packages/webapp/src/containers/ProductInventory/useFilteredInventory.ts index 08a531ed0e..3a482c7570 100644 --- a/packages/webapp/src/containers/ProductInventory/useFilteredInventory.ts +++ b/packages/webapp/src/containers/ProductInventory/useFilteredInventory.ts @@ -28,7 +28,8 @@ export const useFilteredInventory = (inventory: TableProduct[]) => { const filterMatches = useMemo(() => { return inventory.filter((product) => { - const key = product.isLibraryProduct ? ProductCategory.LIBRARY : ProductCategory.CUSTOM; + // LF-4970 - const key = product.isLibraryProduct ? ProductCategory.LIBRARY : ProductCategory.CUSTOM; + const key = ProductCategory.CUSTOM; const customOrLibraryMatches = isInactive(customOrLibraryFilter) || customOrLibraryFilter[key]?.active; diff --git a/packages/webapp/src/containers/productSlice.js b/packages/webapp/src/containers/productSlice.js index 5d05d2ecef..af7528851e 100644 --- a/packages/webapp/src/containers/productSlice.js +++ b/packages/webapp/src/containers/productSlice.js @@ -2,7 +2,6 @@ import { createEntityAdapter, createSlice } from '@reduxjs/toolkit'; import { loginSelector, onLoadingFail, onLoadingStart } from './userFarmSlice'; import { pick } from '../util/pick'; import { createSelector } from 'reselect'; -import { isLibraryProduct } from '../util/product'; export const getProduct = (obj) => { return pick(obj, [ diff --git a/packages/webapp/src/util/product.ts b/packages/webapp/src/util/product.ts index 75869cd980..62d833eac5 100644 --- a/packages/webapp/src/util/product.ts +++ b/packages/webapp/src/util/product.ts @@ -15,7 +15,7 @@ import { Product } from '../store/api/types'; -// LF-4963 - confirm property that will distinguish custom from library products +// LF-4970, LF-4963 - confirm property that will distinguish custom from library products export const isLibraryProduct = (product: Product) => { return !!product.product_translation_key; }; From 638a2e19c5e1824b41ed380fba85b846e7d39ec4 Mon Sep 17 00:00:00 2001 From: Duncan-Brain Date: Tue, 2 Dec 2025 21:02:04 -0500 Subject: [PATCH 3/4] LF-5041 Comment out filter --- .../Filter/ProductInventory/index.tsx | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/packages/webapp/src/containers/Filter/ProductInventory/index.tsx b/packages/webapp/src/containers/Filter/ProductInventory/index.tsx index 9c5c5d8837..001b7132f8 100644 --- a/packages/webapp/src/containers/Filter/ProductInventory/index.tsx +++ b/packages/webapp/src/containers/Filter/ProductInventory/index.tsx @@ -18,7 +18,7 @@ import FilterGroup from '../../../components/Filter/FilterGroup'; import type { ReduxFilterEntity, ContainerOnChangeCallback, FilterState } from '../types'; import { FilterType, type ComponentFilter } from '../../../components/Filter/types'; import { useGetSoilAmendmentFertiliserTypesQuery } from '../../../store/api/apiSlice'; -import { ProductCategory, InventoryFilterKeys } from './types'; +import { InventoryFilterKeys } from './types'; import { sortFilterOptions } from '../../../components/Filter/utils'; interface ProductInventoryFilterContentProps { @@ -37,27 +37,28 @@ const ProductInventoryFilterContent = ({ const { data: fertiliserTypes = [] } = useGetSoilAmendmentFertiliserTypesQuery(); const filters: ComponentFilter[] = [ - { - subject: t('filter:INVENTORY.CUSTOM_OR_LITEFARM_LIBRARY'), - type: FilterType.SEARCHABLE_MULTI_SELECT, - filterKey: InventoryFilterKeys.CUSTOM_OR_LIBRARY, - options: [ - { - value: ProductCategory.CUSTOM, - default: - inventoryFilter[InventoryFilterKeys.CUSTOM_OR_LIBRARY][ProductCategory.CUSTOM] - ?.active ?? false, - label: t('filter:INVENTORY.CUSTOM'), - }, - { - value: ProductCategory.LIBRARY, - default: - inventoryFilter[InventoryFilterKeys.CUSTOM_OR_LIBRARY][ProductCategory.LIBRARY] - ?.active ?? false, - label: t('filter:INVENTORY.LITEFARM_LIBRARY'), - }, - ], - }, + // LF-4970 + // { + // subject: t('filter:INVENTORY.CUSTOM_OR_LITEFARM_LIBRARY'), + // type: FilterType.SEARCHABLE_MULTI_SELECT, + // filterKey: InventoryFilterKeys.CUSTOM_OR_LIBRARY, + // options: [ + // { + // value: ProductCategory.CUSTOM, + // default: + // inventoryFilter[InventoryFilterKeys.CUSTOM_OR_LIBRARY][ProductCategory.CUSTOM] + // ?.active ?? false, + // label: t('filter:INVENTORY.CUSTOM'), + // }, + // { + // value: ProductCategory.LIBRARY, + // default: + // inventoryFilter[InventoryFilterKeys.CUSTOM_OR_LIBRARY][ProductCategory.LIBRARY] + // ?.active ?? false, + // label: t('filter:INVENTORY.LITEFARM_LIBRARY'), + // }, + // ], + // }, { subject: t('filter:INVENTORY.FERTILISER_TYPE'), type: FilterType.SEARCHABLE_MULTI_SELECT, From 7c5bd2d1fd8183fca5f2dc56e89cb1f01adb6111 Mon Sep 17 00:00:00 2001 From: Duncan-Brain Date: Tue, 2 Dec 2025 21:09:02 -0500 Subject: [PATCH 4/4] LF-5041 undo backed isLibrary commenting -- it is causing no harm --- packages/api/src/controllers/productController.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/api/src/controllers/productController.js b/packages/api/src/controllers/productController.js index 53b48559cb..62dfcb6a71 100644 --- a/packages/api/src/controllers/productController.js +++ b/packages/api/src/controllers/productController.js @@ -123,9 +123,8 @@ const productController = { } // LF-4963 - confirm property that will distinguish custom from library products - // const isLibraryProduct = product.product_translation_key; - // if (!isLibraryProduct && isUnusedByTasks) { - if (isUnusedByTasks) { + const isLibraryProduct = product.product_translation_key; + if (!isLibraryProduct && isUnusedByTasks) { await baseController.delete(ProductModel, product_id, req, { trx }); }