Skip to content

Commit

Permalink
Merge pull request #762 from stasgm/old_selectors
Browse files Browse the repository at this point in the history
chore: total in PalletView
  • Loading branch information
sunnycreature authored Mar 29, 2024
2 parents b120ff6 + 391616c commit 7cf2039
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/app-pallet/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "GDMN Паллета",
"slug": "gdmn-pallet",
"version": "0.1.0",
"version": "0.2.0",
"githubUrl": "https://github.com/stasgm/gdmn-mob",
"orientation": "default",
"icon": "./assets/icon.png",
Expand All @@ -26,7 +26,7 @@
"android": {
"package": "com.gsbelarus.palletlist",
"permissions": ["CAMERA", "VIBRATE"],
"versionCode": 4
"versionCode": 5
},
"web": {
"favicon": "./assets/favicon.png"
Expand Down
2 changes: 2 additions & 0 deletions apps/app-pallet/src/screens/Pallet/PalletViewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { PalletStackParamList } from '../../navigation/Root/types';
import { getStatusColor, ONE_SECOND_IN_MS } from '../../utils/constants';

import { BarcodeImage } from './components/Barcode';
import ViewTotal from './components/ViewTotal';

export const PalletViewScreen = () => {
const showActionSheet = useActionSheet();
Expand Down Expand Up @@ -428,6 +429,7 @@ export const PalletViewScreen = () => {
keyExtractor={keyExtractor}
extraData={[lines, isBlocked, delList, isDelList]}
/>
{lines?.length ? <ViewTotal total={lines?.length || 0} /> : null}
<AppDialog
title="Введите штрих-код"
visible={visibleDialog}
Expand Down
45 changes: 45 additions & 0 deletions apps/app-pallet/src/screens/Pallet/components/ViewTotal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { globalStyles as styles, MediumText } from '@lib/mobile-ui';
import { Divider } from 'react-native-paper';

import { useTheme } from '@react-navigation/native';

export interface IItem {
total?: number;
scan?: boolean;
}

const ViewTotal = ({ total }: IItem) => {
const { colors } = useTheme();

return (
<View>
<Divider style={{ backgroundColor: colors.primary }} />
<View style={[localStyles.total, styles.directionRow]}>
<View style={localStyles.groupWidth}>
<MediumText style={styles.textTotal}>Итого: </MediumText>
</View>
<View style={localStyles.quantity}>
<MediumText>{total || 0}</MediumText>
</View>
</View>
</View>
);
};

export default ViewTotal;

const localStyles = StyleSheet.create({
groupWidth: {
width: '62%',
},
quantity: {
alignItems: 'flex-end',
width: '35%',
},
total: {
margin: 5,
alignItems: 'center',
},
});

0 comments on commit 7cf2039

Please sign in to comment.