-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add internal purchase request details screen
- Loading branch information
1 parent
8c63f9a
commit c7452a7
Showing
20 changed files
with
547 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/apps/purchase/src/api/purchase-request-line-api.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
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, | ||
}); | ||
} |
65 changes: 65 additions & 0 deletions
65
...se/src/components/atoms/DropdownRequestCharacteristics/DropdownRequestCharacteristics.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import {checkNullString, LabelText} from '@axelor/aos-mobile-ui'; | ||
import {useSelector, useTranslator} from '@axelor/aos-mobile-core'; | ||
|
||
const DropdownRequestCharacteristics = () => { | ||
const {purchaseRequest} = useSelector( | ||
state => state.purchase_purchaseRequest, | ||
); | ||
|
||
const I18n = useTranslator(); | ||
|
||
return ( | ||
<View> | ||
{!checkNullString(purchaseRequest.supplierPartner?.fullName) && ( | ||
<LabelText | ||
title={purchaseRequest.supplierPartner?.fullName} | ||
iconName="person-fill" | ||
textSize={16} | ||
/> | ||
)} | ||
{!checkNullString(purchaseRequest.stockLocation?.name) && ( | ||
<LabelText | ||
title={`${I18n.t('Purchase_StockLocation')} :`} | ||
value={purchaseRequest.stockLocation?.name} | ||
textSize={16} | ||
/> | ||
)} | ||
{!checkNullString(purchaseRequest.requesterUser?.fullName) && ( | ||
<LabelText | ||
title={`${I18n.t('Purchase_RequesterUser')} :`} | ||
value={purchaseRequest.requesterUser?.fullName} | ||
textSize={16} | ||
/> | ||
)} | ||
{!checkNullString(purchaseRequest.validatorUser?.fullName) && ( | ||
<LabelText | ||
title={`${I18n.t('Purchase_ValidatorUser')} :`} | ||
value={purchaseRequest.validatorUser?.fullName} | ||
textSize={16} | ||
/> | ||
)} | ||
</View> | ||
); | ||
}; | ||
|
||
export default DropdownRequestCharacteristics; |
93 changes: 93 additions & 0 deletions
93
...ages/apps/purchase/src/components/atoms/PurchaseSeeLinesButton/PurchaseSeeLinesButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React, {useMemo} from 'react'; | ||
import {StyleSheet, TouchableOpacity, View} from 'react-native'; | ||
import {useTranslator} from '@axelor/aos-mobile-core'; | ||
import { | ||
Card, | ||
Icon, | ||
NumberBubble, | ||
useThemeColor, | ||
Text, | ||
} from '@axelor/aos-mobile-ui'; | ||
|
||
interface PurchaseSeeLinesButtonProps { | ||
numberLines: number; | ||
} | ||
|
||
const PurchaseSeeLinesButton = ({numberLines}: PurchaseSeeLinesButtonProps) => { | ||
const I18n = useTranslator(); | ||
const Colors = useThemeColor(); | ||
|
||
const styles = useMemo( | ||
() => getStyles(Colors.secondaryColor.background), | ||
[Colors.secondaryColor.background], | ||
); | ||
|
||
return ( | ||
<TouchableOpacity onPress={() => {}} activeOpacity={0.9}> | ||
<Card style={styles.container}> | ||
<Text style={styles.text}>{I18n.t('Purchase_SeeLines')}</Text> | ||
<View style={styles.rightContainer}> | ||
{numberLines > 0 && ( | ||
<NumberBubble | ||
style={styles.numberBubble} | ||
number={numberLines} | ||
color={Colors.progressColor} | ||
isNeutralBackground={false} | ||
/> | ||
)} | ||
<Icon name="chevron-right" color={Colors.primaryColor.background} /> | ||
</View> | ||
</Card> | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
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 PurchaseSeeLinesButton; |
66 changes: 66 additions & 0 deletions
66
packages/apps/purchase/src/components/atoms/RequestHeader/RequestHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from 'react'; | ||
import {StyleSheet, View} from 'react-native'; | ||
import {Text, LabelText, Badge, useThemeColor} from '@axelor/aos-mobile-ui'; | ||
import {useSelector, useTypeHelpers, useTypes} from '@axelor/aos-mobile-core'; | ||
|
||
const RequestHeader = ({}) => { | ||
const Colors = useThemeColor(); | ||
const {PurchaseRequest} = useTypes(); | ||
const {getItemTitle} = useTypeHelpers(); | ||
|
||
const {purchaseRequest} = useSelector( | ||
state => state.purchase_purchaseRequest, | ||
); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<View style={styles.chlidrenContainer}> | ||
<Text writingType="title">{purchaseRequest?.purchaseRequestSeq}</Text> | ||
<Badge | ||
title={getItemTitle( | ||
PurchaseRequest?.statusSelect, | ||
purchaseRequest.statusSelect, | ||
)} | ||
color={Colors.infoColor} | ||
/> | ||
</View> | ||
<LabelText | ||
iconName="building-fill" | ||
size={16} | ||
title={purchaseRequest?.company?.name} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
marginHorizontal: 15, | ||
}, | ||
chlidrenContainer: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
marginBottom: 5, | ||
}, | ||
}); | ||
|
||
export default RequestHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,5 @@ | |
*/ | ||
|
||
export * from './atoms'; | ||
export * from './molecules'; | ||
export * from './templates'; |
40 changes: 40 additions & 0 deletions
40
...ages/apps/purchase/src/components/molecules/RequestDropdownCards/RequestDropdownCards.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from 'react'; | ||
import {useTranslator} from '@axelor/aos-mobile-core'; | ||
import {DropdownCardSwitch} from '@axelor/aos-mobile-ui'; | ||
import {DropdownRequestCharacteristics} from '../../atoms'; | ||
|
||
const RequestDropdownCards = () => { | ||
const I18n = useTranslator(); | ||
|
||
return ( | ||
<DropdownCardSwitch | ||
dropdownItems={[ | ||
{ | ||
key: 1, | ||
title: I18n.t('Purchase_Characteristics'), | ||
childrenComp: <DropdownRequestCharacteristics />, | ||
}, | ||
]} | ||
/> | ||
); | ||
}; | ||
|
||
export default RequestDropdownCards; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
export {default as RequestDropdownCards} from './RequestDropdownCards/RequestDropdownCards'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.