Skip to content

Commit

Permalink
fix: isuue product searchBar
Browse files Browse the repository at this point in the history
  • Loading branch information
gca-axelor committed Dec 12, 2024
1 parent ef02171 commit b060853
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/apps/purchase/src/api/product-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const createProductCriteria = ({searchValue}) => {
export async function searchProduct({page = 0, searchValue}) {
return createStandardSearch({
model: 'com.axelor.apps.base.db.Product',
criteria: createProductCriteria(searchValue),
criteria: createProductCriteria({searchValue}),
fieldKey: 'purchase_product',
sortKey: 'purchase_product',
page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface RequestCreationButtonProps {
lines: any[];
movedQty: number;
isEditionMode: boolean;
unit: any;
addLine: () => void;
}

Expand All @@ -36,6 +37,7 @@ const RequestCreationButton = ({
setStep,
lines,
movedQty,
unit,
isEditionMode,
addLine,
}: RequestCreationButtonProps) => {
Expand Down Expand Up @@ -80,19 +82,19 @@ const RequestCreationButton = ({
);
}

if (step === RequestCreation.step.addLine) {
if (step === RequestCreation.step.finish) {
return (
<View style={styles.container}>
<Button
title={I18n.t('Base_Add')}
iconName="arrow-left"
color={Colors.progressColor}
width={true ? '45%' : '90%'}
width={unit ? '45%' : '90%'}
onPress={() => {
setStep(RequestCreation.step.addLine);
}}
/>
{true && (
{unit && (
<Button
title={I18n.t('Base_Realize')}
iconName="check"
Expand Down
2 changes: 2 additions & 0 deletions packages/apps/purchase/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"Purchase_Unit": "Unit",
"Purchase_Quantity": "Quantity",
"Purchase_ProductTitle": "Product title",
"Purchase_Description": "Description",
"Purchase_Products": "Products",
"Purchase_SliceAction_SearchPurchaseRequest": "search purchase request",
"Purchase_SliceAction_SearchSupplier": "search supplier",
"Purchase_SliceAction_SearchProduct": "search product",
Expand Down
2 changes: 2 additions & 0 deletions packages/apps/purchase/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"Purchase_Unit": "Unité",
"Purchase_Quantity": "Quantité",
"Purchase_ProductTitle": "Nom du produit",
"Purchase_Description": "Description",
"Purchase_Products": "Produits",
"Purchase_SliceAction_SearchPurchaseRequest": "recherche sur les demandes d'achat",
"Purchase_SliceAction_SearchSupplier": "recherche sur les fournisseurs",
"Purchase_SliceAction_SearchProduct": "recherche sur les produits",
Expand Down
8 changes: 7 additions & 1 deletion packages/apps/purchase/src/screens/RequestCreationScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const RequestCreationScreen = () => {
step={currentStep}
setStep={setCurrentStep}
lines={lines}
unit={unit}
movedQty={movedQty}
isEditionMode={isEditionMode}
addLine={handleAddLine}
Expand Down Expand Up @@ -162,6 +163,7 @@ const RequestCreationScreen = () => {
(RequestCreation.step.validateLine && isCustomProduct)) && (
<FormInput
title={I18n.t('Purchase_ProductTitle')}
defaultValue={productTitle}
onChange={value => {
handleCustomProductInput(value);
if (value) {
Expand All @@ -181,7 +183,11 @@ const RequestCreationScreen = () => {
availableQty={newLine?.currentQty}
productUnit={unit?.name || newLine?.product?.unit?.name}
/>
<UnitSearchBar defaultValue={unit} onChange={setUnit} />
<UnitSearchBar
defaultValue={unit}
onChange={setUnit}
isScrollViewContainer={true}
/>
</>
)}
</KeyboardAvoidingScrollView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ const ViewAllEditList = ({

const [isAlertVisible, setIsAlertVisible] = useState(false);

console.log('lines', lines);

return (
<>
<ViewAllContainer
Expand Down

0 comments on commit b060853

Please sign in to comment.