diff --git a/packages/apps/purchase/src/api/index.ts b/packages/apps/purchase/src/api/index.ts
index e7d036217..fae530922 100644
--- a/packages/apps/purchase/src/api/index.ts
+++ b/packages/apps/purchase/src/api/index.ts
@@ -16,5 +16,9 @@
* along with this program. If not, see .
*/
-export {searchPurchaseRequest as searchPurchaseRequestApi} from './purchase-request-api';
+export {
+ getPurchaseRequest as getPurchaseRequestApi,
+ searchPurchaseRequest as searchPurchaseRequestApi,
+} from './purchase-request-api';
+export {searchPurchaseRequestLine as searchPurchaseRequestLineApi} from './purchase-request-line-api';
export {searchSupplier as searchSupplierApi} from './supplier-api';
diff --git a/packages/apps/purchase/src/api/purchase-request-api.js b/packages/apps/purchase/src/api/purchase-request-api.js
index 14b05ae0b..accd6a100 100644
--- a/packages/apps/purchase/src/api/purchase-request-api.js
+++ b/packages/apps/purchase/src/api/purchase-request-api.js
@@ -17,6 +17,7 @@
*/
import {
+ createStandardFetch,
createStandardSearch,
getSearchCriterias,
} from '@axelor/aos-mobile-core';
@@ -66,3 +67,11 @@ export async function searchPurchaseRequest({
page,
});
}
+
+export async function getPurchaseRequest({id}) {
+ return createStandardFetch({
+ model: 'com.axelor.apps.purchase.db.PurchaseRequest',
+ id,
+ fieldKey: 'purchase_purchaseRequest',
+ });
+}
diff --git a/packages/apps/purchase/src/api/purchase-request-line-api.js b/packages/apps/purchase/src/api/purchase-request-line-api.js
new file mode 100644
index 000000000..19079848b
--- /dev/null
+++ b/packages/apps/purchase/src/api/purchase-request-line-api.js
@@ -0,0 +1,39 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import {createStandardSearch} from '@axelor/aos-mobile-core';
+
+const createPurchaseRequestLineCriteria = purchaseRequestId => {
+ return [
+ {
+ fieldName: 'purchaseRequest.id',
+ operator: '=',
+ value: purchaseRequestId,
+ },
+ ];
+};
+
+export async function searchPurchaseRequestLine({page = 0, purchaseRequestId}) {
+ return createStandardSearch({
+ model: 'com.axelor.apps.purchase.db.PurchaseRequestLine',
+ criteria: createPurchaseRequestLineCriteria(purchaseRequestId),
+ fieldKey: 'purchase_purchaseRequestLine',
+ sortKey: 'purchase_purchaseRequestLine',
+ page,
+ });
+}
diff --git a/packages/apps/purchase/src/components/atoms/DropdownRequestCharacteristics/DropdownRequestCharacteristics.tsx b/packages/apps/purchase/src/components/atoms/DropdownRequestCharacteristics/DropdownRequestCharacteristics.tsx
new file mode 100644
index 000000000..e4dfa256a
--- /dev/null
+++ b/packages/apps/purchase/src/components/atoms/DropdownRequestCharacteristics/DropdownRequestCharacteristics.tsx
@@ -0,0 +1,80 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import React from 'react';
+import {View} from 'react-native';
+import {checkNullString, Label, LabelText} from '@axelor/aos-mobile-ui';
+import {useSelector, useTranslator} from '@axelor/aos-mobile-core';
+
+const DropdownRequestCharacteristics = () => {
+ const I18n = useTranslator();
+
+ const {purchaseRequest} = useSelector(
+ state => state.purchase_purchaseRequest,
+ );
+
+ if (
+ checkNullString(purchaseRequest.supplierPartner?.fullName) &&
+ checkNullString(purchaseRequest.stockLocation?.name) &&
+ checkNullString(purchaseRequest.requesterUser?.fullName) &&
+ checkNullString(purchaseRequest.validatorUser?.fullName)
+ ) {
+ return (
+
+ );
+ }
+
+ return (
+
+ {!checkNullString(purchaseRequest.supplierPartner?.fullName) && (
+
+ )}
+ {!checkNullString(purchaseRequest.stockLocation?.name) && (
+
+ )}
+ {!checkNullString(purchaseRequest.requesterUser?.fullName) && (
+
+ )}
+ {!checkNullString(purchaseRequest.validatorUser?.fullName) && (
+
+ )}
+
+ );
+};
+
+export default DropdownRequestCharacteristics;
diff --git a/packages/apps/purchase/src/components/atoms/RequestHeader/RequestHeader.tsx b/packages/apps/purchase/src/components/atoms/RequestHeader/RequestHeader.tsx
new file mode 100644
index 000000000..92d1f0fa3
--- /dev/null
+++ b/packages/apps/purchase/src/components/atoms/RequestHeader/RequestHeader.tsx
@@ -0,0 +1,69 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import React from 'react';
+import {StyleSheet, View} from 'react-native';
+import {Text, LabelText, Badge} from '@axelor/aos-mobile-ui';
+import {useSelector, useTypeHelpers, useTypes} from '@axelor/aos-mobile-core';
+
+const RequestHeader = ({}) => {
+ const {PurchaseRequest} = useTypes();
+ const {getItemColor, getItemTitle} = useTypeHelpers();
+
+ const {purchaseRequest} = useSelector(
+ state => state.purchase_purchaseRequest,
+ );
+
+ return (
+
+
+ {purchaseRequest?.purchaseRequestSeq}
+
+
+
+
+ );
+};
+
+const styles = StyleSheet.create({
+ container: {
+ marginHorizontal: 24,
+ marginBottom: 5,
+ },
+ chlidrenContainer: {
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ marginBottom: 5,
+ },
+});
+
+export default RequestHeader;
diff --git a/packages/apps/purchase/src/components/atoms/RequestSeeLinesButton/RequestSeeLinesButton.tsx b/packages/apps/purchase/src/components/atoms/RequestSeeLinesButton/RequestSeeLinesButton.tsx
new file mode 100644
index 000000000..b0a30bcac
--- /dev/null
+++ b/packages/apps/purchase/src/components/atoms/RequestSeeLinesButton/RequestSeeLinesButton.tsx
@@ -0,0 +1,96 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import React, {useMemo} from 'react';
+import {StyleSheet, TouchableOpacity, View} from 'react-native';
+import {useSelector, useTranslator} from '@axelor/aos-mobile-core';
+import {
+ Card,
+ Icon,
+ NumberBubble,
+ useThemeColor,
+ Text,
+} from '@axelor/aos-mobile-ui';
+
+const RequestSeeLinesButton = () => {
+ const I18n = useTranslator();
+ const Colors = useThemeColor();
+
+ const styles = useMemo(
+ () => getStyles(Colors.secondaryColor.background),
+ [Colors.secondaryColor.background],
+ );
+
+ const {totalPurchaseRequestLine} = useSelector(
+ state => state.purchase_purchaseRequestLine,
+ );
+
+ return (
+ {}}
+ disabled={totalPurchaseRequestLine === 0}
+ activeOpacity={0.9}>
+
+ {I18n.t('Purchase_SeeLines')}
+
+
+ {totalPurchaseRequestLine > 0 && (
+
+ )}
+
+
+
+ );
+};
+
+const getStyles = (borderColor: string) =>
+ StyleSheet.create({
+ container: {
+ width: '90%',
+ height: 40,
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ alignSelf: 'center',
+ alignItems: 'center',
+ marginRight: 0,
+ paddingVertical: 5,
+ paddingLeft: 10,
+ paddingRight: 10,
+ borderWidth: 1,
+ borderRadius: 7,
+ borderColor: borderColor,
+ marginVertical: 3,
+ },
+ text: {
+ fontWeight: 'bold',
+ },
+ rightContainer: {
+ flexDirection: 'row',
+ },
+ numberBubble: {
+ borderRadius: 7,
+ marginRight: 4,
+ },
+ });
+
+export default RequestSeeLinesButton;
diff --git a/packages/apps/purchase/src/components/atoms/index.ts b/packages/apps/purchase/src/components/atoms/index.ts
index 33fdb3deb..a9335ea63 100644
--- a/packages/apps/purchase/src/components/atoms/index.ts
+++ b/packages/apps/purchase/src/components/atoms/index.ts
@@ -16,4 +16,7 @@
* along with this program. If not, see .
*/
+export {default as DropdownRequestCharacteristics} from './DropdownRequestCharacteristics/DropdownRequestCharacteristics';
+export {default as RequestSeeLinesButton} from './RequestSeeLinesButton/RequestSeeLinesButton';
export {default as RequestCard} from './RequestCard/RequestCard';
+export {default as RequestHeader} from './RequestHeader/RequestHeader';
diff --git a/packages/apps/purchase/src/components/index.ts b/packages/apps/purchase/src/components/index.ts
index f0795f640..54f518afd 100644
--- a/packages/apps/purchase/src/components/index.ts
+++ b/packages/apps/purchase/src/components/index.ts
@@ -17,4 +17,6 @@
*/
export * from './atoms';
+export * from './molecules';
+export * from './organisms';
export * from './templates';
diff --git a/packages/apps/purchase/src/components/molecules/RequestDropdownCards/RequestDropdownCards.tsx b/packages/apps/purchase/src/components/molecules/RequestDropdownCards/RequestDropdownCards.tsx
new file mode 100644
index 000000000..f73044bde
--- /dev/null
+++ b/packages/apps/purchase/src/components/molecules/RequestDropdownCards/RequestDropdownCards.tsx
@@ -0,0 +1,41 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import React from 'react';
+import {useTranslator} from '@axelor/aos-mobile-core';
+import {DropdownCardSwitch} from '@axelor/aos-mobile-ui';
+import {DropdownRequestCharacteristics} from '../../atoms';
+
+const RequestDropdownCards = ({style}: {style: any}) => {
+ const I18n = useTranslator();
+
+ return (
+ ,
+ },
+ ]}
+ />
+ );
+};
+
+export default RequestDropdownCards;
diff --git a/packages/apps/purchase/src/components/molecules/index.ts b/packages/apps/purchase/src/components/molecules/index.ts
new file mode 100644
index 000000000..10570c2e4
--- /dev/null
+++ b/packages/apps/purchase/src/components/molecules/index.ts
@@ -0,0 +1,19 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+export {default as RequestDropdownCards} from './RequestDropdownCards/RequestDropdownCards';
diff --git a/packages/apps/purchase/src/components/organisms/RequestButtons/RequestButtons.tsx b/packages/apps/purchase/src/components/organisms/RequestButtons/RequestButtons.tsx
new file mode 100644
index 000000000..4baf3d034
--- /dev/null
+++ b/packages/apps/purchase/src/components/organisms/RequestButtons/RequestButtons.tsx
@@ -0,0 +1,120 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import React, {useCallback, useMemo} from 'react';
+import {View, StyleSheet, DimensionValue} from 'react-native';
+import {Button, useThemeColor} from '@axelor/aos-mobile-ui';
+import {useSelector, useTranslator, useTypes} from '@axelor/aos-mobile-core';
+
+const RequestButtons = () => {
+ const Colors = useThemeColor();
+ const I18n = useTranslator();
+ const {PurchaseRequest} = useTypes();
+
+ const {purchaseRequest} = useSelector(
+ state => state.purchase_purchaseRequest,
+ );
+
+ const getButtonsForStatus = useCallback(
+ status => {
+ switch (status) {
+ case PurchaseRequest.statusSelect.Draft:
+ return [
+ {
+ title: I18n.t('Purchase_Request'),
+ onPress: () => {},
+ width: '45%',
+ iconName: 'check-lg',
+ },
+ {
+ title: I18n.t('Base_Cancel'),
+ onPress: () => {},
+ width: '45%',
+ color: Colors.cautionColor,
+ iconName: 'reply-fill',
+ },
+ ];
+ case PurchaseRequest.statusSelect.Requested:
+ return [
+ {
+ title: I18n.t('Purchase_Accept'),
+ onPress: () => {},
+ width: '45%',
+ iconName: 'check-lg',
+ },
+ {
+ title: I18n.t('Purchase_Refuse'),
+ onPress: () => {},
+ width: '45%',
+ color: Colors.errorColor,
+ iconName: 'x-lg',
+ },
+ {
+ title: I18n.t('Base_Cancel'),
+ onPress: () => {},
+ width: '94%',
+ color: Colors.cautionColor,
+ iconName: 'reply-fill',
+ },
+ ];
+ case PurchaseRequest.statusSelect.Accepted:
+ case PurchaseRequest.statusSelect.Purchased:
+ case PurchaseRequest.statusSelect.Refused:
+ return [
+ {
+ title: I18n.t('Base_Cancel'),
+ onPress: () => {},
+ width: '90%',
+ color: Colors.cautionColor,
+ iconName: 'reply-fill',
+ },
+ ];
+ default:
+ return [];
+ }
+ },
+ [Colors, I18n, PurchaseRequest],
+ );
+
+ const buttons = useMemo(
+ () => getButtonsForStatus(purchaseRequest?.statusSelect),
+ [getButtonsForStatus, purchaseRequest?.statusSelect],
+ );
+
+ if (buttons.length === 0) {
+ return null;
+ }
+
+ return (
+
+ {buttons.map((btn, idx) => (
+
+ ))}
+
+ );
+};
+
+const styles = StyleSheet.create({
+ buttonContainer: {
+ flexWrap: 'wrap',
+ flexDirection: 'row',
+ justifyContent: 'space-evenly',
+ },
+});
+
+export default RequestButtons;
diff --git a/packages/apps/purchase/src/components/organisms/index.ts b/packages/apps/purchase/src/components/organisms/index.ts
new file mode 100644
index 000000000..88769ef6a
--- /dev/null
+++ b/packages/apps/purchase/src/components/organisms/index.ts
@@ -0,0 +1,19 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+export {default as RequestButtons} from './RequestButtons/RequestButtons';
diff --git a/packages/apps/purchase/src/features/asyncFunctions-index.ts b/packages/apps/purchase/src/features/asyncFunctions-index.ts
index 508d3ff2f..1c635ef7e 100644
--- a/packages/apps/purchase/src/features/asyncFunctions-index.ts
+++ b/packages/apps/purchase/src/features/asyncFunctions-index.ts
@@ -16,5 +16,9 @@
* along with this program. If not, see .
*/
-export {searchPurchaseRequest} from './purchaseRequestSlice';
+export {searchPurchaseRequestLine} from './purchaseRequestLineSlice';
+export {
+ getPurchaseRequest,
+ searchPurchaseRequest,
+} from './purchaseRequestSlice';
export {searchSupplier} from './supplierSlice';
diff --git a/packages/apps/purchase/src/features/index.js b/packages/apps/purchase/src/features/index.js
index eddd74760..12732e56d 100644
--- a/packages/apps/purchase/src/features/index.js
+++ b/packages/apps/purchase/src/features/index.js
@@ -16,5 +16,6 @@
* along with this program. If not, see .
*/
+export {purchaseRequestLineReducer as purchase_purchaseRequestLine} from './purchaseRequestLineSlice';
export {purchaseRequestReducer as purchase_purchaseRequest} from './purchaseRequestSlice';
export {supplierReducer as purchase_supplier} from './supplierSlice';
diff --git a/packages/apps/purchase/src/features/purchaseRequestLineSlice.js b/packages/apps/purchase/src/features/purchaseRequestLineSlice.js
new file mode 100644
index 000000000..ed2f19b50
--- /dev/null
+++ b/packages/apps/purchase/src/features/purchaseRequestLineSlice.js
@@ -0,0 +1,68 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import {createAsyncThunk, createSlice} from '@reduxjs/toolkit';
+import {
+ generateInifiniteScrollCases,
+ handlerApiCall,
+} from '@axelor/aos-mobile-core';
+import {searchPurchaseRequestLine as _searchPurchaseRequestLine} from '../api/purchase-request-line-api';
+
+export const searchPurchaseRequestLine = createAsyncThunk(
+ 'purchase_purchaseRequestLine/searchPurchaseRequestLine',
+ async function (data, {getState}) {
+ return handlerApiCall({
+ fetchFunction: _searchPurchaseRequestLine,
+ data,
+ action: 'Purchase_SliceAction_SearchPurchaseRequestLine',
+ getState,
+ responseOptions: {isArrayResponse: true, resturnTotalWithData: true},
+ });
+ },
+);
+
+const initialState = {
+ loadingPurchaseRequestLines: false,
+ moreLoadingPurchaseRequestLine: false,
+ isListEndPurchaseRequestLine: false,
+ purchaseRequestLineList: [],
+ totalPurchaseRequestLine: 0,
+};
+
+const purchaseRequestLineSlice = createSlice({
+ name: 'purchase_purchaseRequestLine',
+ initialState,
+ extraReducers: builder => {
+ generateInifiniteScrollCases(
+ builder,
+ searchPurchaseRequestLine,
+ {
+ loading: 'loadingPurchaseRequestLines',
+ moreLoading: 'moreLoadingPurchaseRequestLine',
+ isListEnd: 'isListEndPurchaseRequestLine',
+ list: 'purchaseRequestLineList',
+ total: 'totalPurchaseRequestLine',
+ },
+ {
+ manageTotal: true,
+ },
+ );
+ },
+});
+
+export const purchaseRequestLineReducer = purchaseRequestLineSlice.reducer;
diff --git a/packages/apps/purchase/src/features/purchaseRequestSlice.js b/packages/apps/purchase/src/features/purchaseRequestSlice.js
index 97ef58e7d..2d6757605 100644
--- a/packages/apps/purchase/src/features/purchaseRequestSlice.js
+++ b/packages/apps/purchase/src/features/purchaseRequestSlice.js
@@ -21,7 +21,10 @@ import {
generateInifiniteScrollCases,
handlerApiCall,
} from '@axelor/aos-mobile-core';
-import {searchPurchaseRequest as _searchPurchaseRequest} from '../api/purchase-request-api';
+import {
+ getPurchaseRequest as _getPurchaseRequest,
+ searchPurchaseRequest as _searchPurchaseRequest,
+} from '../api/purchase-request-api';
export const searchPurchaseRequest = createAsyncThunk(
'purchase_purchaseRequest/searchPurchaseRequest',
@@ -36,7 +39,23 @@ export const searchPurchaseRequest = createAsyncThunk(
},
);
+export const getPurchaseRequest = createAsyncThunk(
+ 'purchase_purchaseRequest/getPurchaseRequest',
+ async function (data, {getState}) {
+ return handlerApiCall({
+ fetchFunction: _getPurchaseRequest,
+ data,
+ action: 'Purchase_SliceAction_GetPurchaseRequest',
+ getState,
+ responseOptions: {isArrayResponse: false},
+ });
+ },
+);
+
const initialState = {
+ loadingPurchaseRequest: false,
+ purchaseRequest: {},
+
loadingPurchaseRequests: false,
moreLoadingPurchaseRequest: false,
isListEndPurchaseRequest: false,
@@ -53,6 +72,16 @@ const purchaseRequestSlice = createSlice({
isListEnd: 'isListEndPurchaseRequest',
list: 'purchaseRequestList',
});
+ builder.addCase(getPurchaseRequest.pending, state => {
+ state.loadingPurchaseRequest = true;
+ });
+ builder.addCase(getPurchaseRequest.rejected, state => {
+ state.loadingPurchaseRequest = false;
+ });
+ builder.addCase(getPurchaseRequest.fulfilled, (state, action) => {
+ state.loadingPurchaseRequest = false;
+ state.purchaseRequest = action.payload;
+ });
},
});
diff --git a/packages/apps/purchase/src/i18n/en.json b/packages/apps/purchase/src/i18n/en.json
index 61478a6bb..f1ceeee02 100644
--- a/packages/apps/purchase/src/i18n/en.json
+++ b/packages/apps/purchase/src/i18n/en.json
@@ -8,6 +8,17 @@
"Purchase_Status_Refused": "Refused",
"Purchase_Status_Canceled": "Canceled",
"Purchase_Supplier": "Supplier",
+ "Purchase_StockLocation": "Stock location",
+ "Purchase_RequesterUser": "Requester",
+ "Purchase_ValidatorUser": "Validator",
+ "Purchase_Characteristics": "Characteristics",
+ "Purchase_SeeLines": "See lines",
+ "Purchase_Request": "Request",
+ "Purchase_Accept": "Accept",
+ "Purchase_Refuse": "Refuse",
+ "Purchase_NoInformationAvailable": "No information available",
"Purchase_SliceAction_SearchPurchaseRequest": "search purchase request",
- "Purchase_SliceAction_SearchSupplier": "search supplier"
+ "Purchase_SliceAction_SearchSupplier": "search supplier",
+ "Purchase_SliceAction_GetPurchaseRequest": "get purchase request",
+ "Purchase_SliceAction_SearchPurchaseRequestLine": "search purchase request lines"
}
diff --git a/packages/apps/purchase/src/i18n/fr.json b/packages/apps/purchase/src/i18n/fr.json
index befa869d8..fbe342b34 100644
--- a/packages/apps/purchase/src/i18n/fr.json
+++ b/packages/apps/purchase/src/i18n/fr.json
@@ -8,6 +8,17 @@
"Purchase_Status_Refused": "Refusée",
"Purchase_Status_Canceled": "Annulée",
"Purchase_Supplier": "Fournisseur",
+ "Purchase_StockLocation": "Emplacement de stock",
+ "Purchase_RequesterUser": "Demandeur",
+ "Purchase_ValidatorUser": "Valideur",
+ "Purchase_Characteristics": "Caractéristiques",
+ "Purchase_SeeLines": "Voir les lignes",
+ "Purchase_Request": "Demander",
+ "Purchase_Accept": "Accepter",
+ "Purchase_Refuse": "Refuser",
+ "Purchase_NoInformationAvailable": "Aucune information disponible",
"Purchase_SliceAction_SearchPurchaseRequest": "recherche sur les demandes d'achat",
- "Purchase_SliceAction_SearchSupplier": "recherche sur les fournisseurs"
+ "Purchase_SliceAction_SearchSupplier": "recherche sur les fournisseurs",
+ "Purchase_SliceAction_GetPurchaseRequest": "récupération de la demande d'achat",
+ "Purchase_SliceAction_SearchPurchaseRequestLine": "recherche sur les lignes de demandes d'achat"
}
diff --git a/packages/apps/purchase/src/models/objectFields.ts b/packages/apps/purchase/src/models/objectFields.ts
index 664b9d37d..efb18d96c 100644
--- a/packages/apps/purchase/src/models/objectFields.ts
+++ b/packages/apps/purchase/src/models/objectFields.ts
@@ -24,6 +24,10 @@ export const purchase_modelAPI: ObjectFields = {
supplierPartner: schemaContructor.subObject('fullName'),
company: schemaContructor.subObject('name'),
statusSelect: schemaContructor.number(),
+ description: schemaContructor.string(),
+ stockLocation: schemaContructor.subObject(),
+ requesterUser: schemaContructor.subObject(),
+ validatorUser: schemaContructor.subObject(),
}),
purchase_supplier: schemaContructor.object({
simpleFullName: schemaContructor.string(),
diff --git a/packages/apps/purchase/src/screens/RequestDetailsScreen.tsx b/packages/apps/purchase/src/screens/RequestDetailsScreen.tsx
new file mode 100644
index 000000000..693a1e46b
--- /dev/null
+++ b/packages/apps/purchase/src/screens/RequestDetailsScreen.tsx
@@ -0,0 +1,85 @@
+/*
+ * Axelor Business Solutions
+ *
+ * Copyright (C) 2024 Axelor ().
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import React, {useCallback, useEffect} from 'react';
+import {StyleSheet} from 'react-native';
+import {
+ HeaderContainer,
+ NotesCard,
+ Screen,
+ ScrollView,
+} from '@axelor/aos-mobile-ui';
+import {useDispatch, useSelector, useTranslator} from '@axelor/aos-mobile-core';
+import {
+ RequestSeeLinesButton,
+ RequestDropdownCards,
+ RequestHeader,
+ RequestButtons,
+} from '../components';
+import {getPurchaseRequest} from '../features/purchaseRequestSlice';
+import {searchPurchaseRequestLine} from '../features/purchaseRequestLineSlice';
+
+const RequestDetailsScreen = ({route}) => {
+ const {idRequest} = route.params;
+ const dispatch = useDispatch();
+ const I18n = useTranslator();
+
+ const {loadingPurchaseRequest, purchaseRequest} = useSelector(
+ state => state.purchase_purchaseRequest,
+ );
+
+ const getPurchaseRequestAPI = useCallback(() => {
+ dispatch((getPurchaseRequest as any)({id: idRequest}));
+ dispatch(
+ (searchPurchaseRequestLine as any)({purchaseRequestId: idRequest}),
+ );
+ }, [dispatch, idRequest]);
+
+ useEffect(() => {
+ getPurchaseRequestAPI();
+ }, [getPurchaseRequestAPI]);
+
+ return (
+ }>
+ }
+ expandableFilter={false}
+ />
+
+
+
+
+
+
+ );
+};
+
+export default RequestDetailsScreen;
+
+const styles = StyleSheet.create({
+ margin: {
+ marginVertical: 5,
+ },
+});
diff --git a/packages/apps/purchase/src/screens/RequestListScreen.tsx b/packages/apps/purchase/src/screens/RequestListScreen.tsx
index 8e2bd8065..55709dc5f 100644
--- a/packages/apps/purchase/src/screens/RequestListScreen.tsx
+++ b/packages/apps/purchase/src/screens/RequestListScreen.tsx
@@ -30,7 +30,7 @@ import {searchPurchaseRequest} from '../features/purchaseRequestSlice';
const displayPurchaseRequestSeq = item => item.purchaseRequestSeq;
-const RequestListScreen = ({}) => {
+const RequestListScreen = ({navigation}) => {
const I18n = useTranslator();
const {PurchaseRequest} = useTypes();
const {getSelectionItems} = useTypeHelpers();
@@ -81,7 +81,11 @@ const RequestListScreen = ({}) => {
}
renderListItem={({item}) => (
{}}
+ onPress={() => {
+ navigation.navigate('RequestDetailsView', {
+ idRequest: item.id,
+ });
+ }}
statusSelect={item.statusSelect}
reference={item.purchaseRequestSeq}
companyName={item.company?.name}
diff --git a/packages/apps/purchase/src/screens/index.ts b/packages/apps/purchase/src/screens/index.ts
index caa2bede2..940f41765 100644
--- a/packages/apps/purchase/src/screens/index.ts
+++ b/packages/apps/purchase/src/screens/index.ts
@@ -16,6 +16,7 @@
* along with this program. If not, see .
*/
+import RequestDetailsScreen from './RequestDetailsScreen';
import RequestListScreen from './RequestListScreen';
export default {
@@ -27,6 +28,14 @@ export default {
},
isUsableOnShortcut: true,
},
+ RequestDetailsView: {
+ title: 'Purchase_Request',
+ component: RequestDetailsScreen,
+ options: {
+ shadedHeader: false,
+ },
+ },
};
+export {RequestDetailsScreen};
export {RequestListScreen};