-
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 ControlEntrySample form screen (#382)
* RM#74578
- Loading branch information
1 parent
cbb5ad3
commit bafd096
Showing
36 changed files
with
1,248 additions
and
88 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
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,27 @@ | ||
/* | ||
* 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 {createStandardFetch} from '@axelor/aos-mobile-core'; | ||
|
||
export async function fetchControlPlanById({id}) { | ||
return createStandardFetch({ | ||
model: 'com.axelor.apps.quality.db.ControlPlan', | ||
id, | ||
fieldKey: 'quality_controlPlan', | ||
}); | ||
} |
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
61 changes: 61 additions & 0 deletions
61
packages/apps/quality/src/components/atoms/ControlEntryHeader/ControlEntryHeader.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,61 @@ | ||
/* | ||
* 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 {DateDisplay, useSelector, useTranslator} from '@axelor/aos-mobile-core'; | ||
import {Badge, Text, useThemeColor} from '@axelor/aos-mobile-ui'; | ||
import {ControlEntry} from '../../../types'; | ||
|
||
const ControlEntryHeader = ({}) => { | ||
const I18n = useTranslator(); | ||
const Colors = useThemeColor(); | ||
|
||
const {controlEntry} = useSelector((state: any) => state.controlEntry); | ||
|
||
return ( | ||
<View> | ||
<View style={styles.row}> | ||
<Text writingType="title">{controlEntry.name}</Text> | ||
<Badge | ||
color={ControlEntry.getStatusColor(controlEntry.statusSelect, Colors)} | ||
title={ControlEntry.getStatus(controlEntry.statusSelect, I18n)} | ||
/> | ||
</View> | ||
<View style={styles.row}> | ||
<Text>{`${I18n.t('Quality_SampleCount')} : ${ | ||
controlEntry.sampleCount | ||
}`}</Text> | ||
<DateDisplay date={controlEntry.entryDateTime} /> | ||
</View> | ||
<Text>{`${I18n.t('Quality_ControlPlan')} : ${ | ||
controlEntry.controlPlan?.name | ||
}`}</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
row: { | ||
justifyContent: 'space-between', | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
}, | ||
}); | ||
|
||
export default ControlEntryHeader; |
73 changes: 73 additions & 0 deletions
73
...uality/src/components/atoms/ControlEntrySampleLineHeader/ControlEntrySampleLineHeader.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,73 @@ | ||
/* | ||
* 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 {useSelector, useTranslator} from '@axelor/aos-mobile-core'; | ||
import {Badge, Text, useThemeColor} from '@axelor/aos-mobile-ui'; | ||
import {ControlEntry} from '../../../types'; | ||
|
||
const ControlEntrySampleLineHeader = ({}) => { | ||
const I18n = useTranslator(); | ||
const Colors = useThemeColor(); | ||
|
||
const {sampleLine} = useSelector( | ||
(state: any) => state.controlEntrySampleLine, | ||
); | ||
|
||
if (sampleLine?.id == null) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<View> | ||
<View style={styles.row}> | ||
<Text>{`${I18n.t('Quality_Sample')} : ${ | ||
sampleLine.controlEntrySample?.fullName | ||
}`}</Text> | ||
<Badge | ||
color={ControlEntry.getSampleResultColor( | ||
sampleLine.resultSelect, | ||
Colors, | ||
)} | ||
title={ControlEntry.getSampleResultTitle( | ||
sampleLine.resultSelect, | ||
I18n, | ||
)} | ||
/> | ||
</View> | ||
<Text>{`${I18n.t('Quality_Characteristic')} : ${ | ||
sampleLine.controlPlanLine?.characteristic?.name | ||
}`}</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
row: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
}, | ||
badge: { | ||
margin: 0, | ||
width: null, | ||
}, | ||
}); | ||
|
||
export default ControlEntrySampleLineHeader; |
55 changes: 55 additions & 0 deletions
55
packages/apps/quality/src/components/atoms/NavigationButton/NavigationButton.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,55 @@ | ||
/* | ||
* 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, View} from 'react-native'; | ||
import {Button, Icon, useThemeColor} from '@axelor/aos-mobile-ui'; | ||
|
||
const NavigationButton = ({position, onPress, icon, disabled}) => { | ||
const Colors = useThemeColor(); | ||
|
||
const positionStyle = useMemo(() => ({[position]: '15%'}), [position]); | ||
|
||
return ( | ||
<View style={styles.buttonContainer}> | ||
<Button | ||
onPress={onPress} | ||
color={Colors.priorityColor} | ||
disabled={disabled} | ||
iconName={icon} | ||
/> | ||
<Icon | ||
name={`chevron-${position}`} | ||
style={[styles.chevron, positionStyle]} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
buttonContainer: { | ||
width: '45%', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
chevron: { | ||
position: 'absolute', | ||
}, | ||
}); | ||
|
||
export default NavigationButton; |
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.