mg-library 1.0.323 → 1.0.325

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/blocks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useState } from 'react';
2
- import { View, ActivityIndicator, Pressable, Image } from 'react-native';
2
+ import { View, ActivityIndicator, Pressable, Image, FlatList } from 'react-native';
3
3
  import { Text, Divider, Button, Popover, Card } from '@ui-kitten/components';
4
4
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
5
5
  import * as ImageManipulator from 'expo-image-manipulator';
@@ -7,8 +7,67 @@ import { Camera } from 'expo-camera';
7
7
  import axios from 'axios';
8
8
  import { uploadFile } from '@uploadcare/upload-client';
9
9
 
10
+ import './prototypes.js';
10
11
  import * as mgFunctionsLib from './functions.js';
11
12
 
13
+ export function MGCurrentAccount(props) {
14
+ function cardHeader(item) {
15
+ return (
16
+ <>
17
+ <View style={{ flexDirection: 'row', marginTop: 10, marginBottom: 10, marginLeft: 10 }}>
18
+ <View style={{ flexGrow: 0.05 }}>
19
+ <MaterialCommunityIcons name='file-account-outline' color={props.theme['color-primary-500']} size={30} style={{ flex: 1 }} />
20
+ </View>
21
+ <View style={{ flexGrow: 0.95 }}>
22
+ <Text category='h6'>{item.document} {mgFunctionsLib.i18nString('number', props.language)} {item.number}</Text>
23
+ <Text category='p1'>{item.creditDate}</Text>
24
+ </View>
25
+ </View>
26
+ </>
27
+ );
28
+ };
29
+ function cardFooter(company, item) {
30
+ return (
31
+ <>
32
+ <View style={{ flexDirection: 'column', alignItems: 'flex-end', marginTop: 10, marginBottom: 10, marginLeft: 10, marginRight: 20 }}>
33
+ <Text category='h6'>{item.balance._asCurrency(company.currencySymbol)}</Text>
34
+ </View>
35
+ </>
36
+ );
37
+ };
38
+ let listHeaderComponent = () => (
39
+ <View>
40
+ {props.listHeaderComponent}
41
+ {props.goBack != undefined &&
42
+ props.goBack
43
+ }
44
+ <Card style={{ marginLeft: 50, marginRight: 50, marginBottom: 10 }}>
45
+ <View style={{ alignItems: 'center' }}>
46
+ <Text category='p1'>{mgFunctionsLib.i18nString('balance', props.language)}</Text>
47
+ <Text category='h2'>{props.balanceComposition.total._asCurrency(props.company.currencySymbol)}</Text>
48
+ </View>
49
+ </Card>
50
+ </View>
51
+ );
52
+ return (
53
+ <FlatList
54
+ data={props.balanceComposition.credits}
55
+ keyExtractor={item => item.idCreditDueDate.toString()}
56
+ renderItem={({ item }) => (
57
+ <Card header={cardHeader(item)} footer={cardFooter(props.company, item)} style={{ marginBottom: 10, marginHorizontal: 10 }}>
58
+ <View style={{ flexDirection: 'column' }}>
59
+ <View>
60
+ <Text category='p1'>{item.description}</Text>
61
+ <Text category='p2'>{props.subDescription(item)}</Text>
62
+ </View>
63
+ </View>
64
+ </Card>
65
+ )}
66
+ ListHeaderComponent={listHeaderComponent}
67
+ />
68
+ )
69
+ }
70
+
12
71
  export function MGCamera(props) {
13
72
  let camera;
14
73
  const __takePicture = async () => {
@@ -17,15 +76,15 @@ export function MGCamera(props) {
17
76
  let photo = await camera.takePictureAsync({ quality: 1 });
18
77
  props.dispatch(props.actions.startProcessing());
19
78
  photo = await ImageManipulator.manipulateAsync(
20
- photo.uri,
21
- [{ resize: { width: 287, height: 385 } }],
79
+ photo.uri,
80
+ [{ resize: { width: 287, height: 385 } }],
22
81
  { compress: 1, format: ImageManipulator.SaveFormat.JPEG }
23
82
  );
24
83
  photo = await ImageManipulator.manipulateAsync(
25
- photo.uri,
26
- [{ flip: 'horizontal' }],
84
+ photo.uri,
85
+ [{ flip: 'horizontal' }],
27
86
  { compress: 1, format: ImageManipulator.SaveFormat.JPEG }
28
- );
87
+ );
29
88
  props.process.fileUri = photo.uri;
30
89
  props.process.goForward(props.nextStep);
31
90
  props.dispatch(props.actions.endProcessing());
@@ -45,8 +104,8 @@ export function MGCamera(props) {
45
104
  );
46
105
  const cardHeader = (
47
106
  <View style={{ marginLeft: 15, marginTop: 10, marginBottom: 10 }}>
48
- <Text category='h6'>{mgFunctionsLib.i18nString('photo',props.language)}</Text>
49
- <Text>{mgFunctionsLib.i18nString('takePhoto',props.language)}</Text>
107
+ <Text category='h6'>{mgFunctionsLib.i18nString('photo', props.language)}</Text>
108
+ <Text>{mgFunctionsLib.i18nString('takePhoto', props.language)}</Text>
50
109
  </View>
51
110
  );
52
111
  const cardFooter = (
@@ -62,7 +121,7 @@ export function MGCamera(props) {
62
121
  type === Camera.Constants.Type.back ? Camera.Constants.Type.front : Camera.Constants.Type.back
63
122
  )
64
123
  }}>
65
- <Text>{mgFunctionsLib.i18nString('doInvertCamera',props.language)}</Text>
124
+ <Text>{mgFunctionsLib.i18nString('doInvertCamera', props.language)}</Text>
66
125
  </Button>
67
126
  </View>
68
127
  <View style={{ flex: 1, alignItems: 'center' }}>
@@ -71,7 +130,7 @@ export function MGCamera(props) {
71
130
  status='primary'
72
131
  accessoryLeft={TakeIcon}
73
132
  onPress={__takePicture}>
74
- <Text>{mgFunctionsLib.i18nString('doTakePhoto',props.language)}</Text>
133
+ <Text>{mgFunctionsLib.i18nString('doTakePhoto', props.language)}</Text>
75
134
  </Button>
76
135
  </View>
77
136
  </View>
package/functions.js CHANGED
@@ -100,14 +100,14 @@ export function i18nString(key, language, stringsSpanish, stringsEnglish) {
100
100
  case mgConstants.LANGUAGE_SPANISH.code: {
101
101
  value = mgStringsSpanish[key];
102
102
  if (value === undefined)
103
- if (stringsSpanish != undefined)
103
+ if (stringsSpanish != undefined)
104
104
  value = stringsSpanish[key];
105
105
  break;
106
106
  }
107
107
  case mgConstants.LANGUAGE_ENGLISH.code: {
108
108
  value = mgStringsEnglish[key];
109
109
  if (value === undefined)
110
- if (stringsEnglish != undefined)
110
+ if (stringsEnglish != undefined)
111
111
  value = stringsEnglish[key];
112
112
  break;
113
113
  }
@@ -167,7 +167,7 @@ export function getBasicStyleSheet() {
167
167
  backgroundColor: 'white',
168
168
  justifyContent: 'center',
169
169
  paddingLeft: 10,
170
- minHeight: 50,
170
+ minHeight: 50,
171
171
  paddingVertical: 5,
172
172
  marginLeft: 30
173
173
  },
@@ -176,9 +176,9 @@ export function getBasicStyleSheet() {
176
176
  backgroundColor: 'white',
177
177
  justifyContent: 'center',
178
178
  paddingLeft: 10,
179
- minHeight: 50,
179
+ minHeight: 50,
180
180
  paddingVertical: 5,
181
- marginBottom: 5
181
+ marginBottom: 5
182
182
  },
183
183
  flatlistHeader: {
184
184
  marginHorizontal: 20,
@@ -195,7 +195,7 @@ export function getBasicStyleSheet() {
195
195
  alignSelf: 'center',
196
196
  marginVertical: 10,
197
197
  borderRadius: 16
198
- }
198
+ }
199
199
  });
200
200
  }
201
201
 
package/i18n/english.js CHANGED
@@ -55,7 +55,8 @@ export const strings = {
55
55
  previewPhoto: 'Preview',
56
56
  doTakePhoto: 'Capture',
57
57
  doInvertCamera: 'Invert',
58
- doSavePhoto: 'Save'
58
+ doSavePhoto: 'Save',
59
+ balance: 'Balance'
59
60
  }
60
61
 
61
62
  // Messages
package/i18n/spanish.js CHANGED
@@ -55,7 +55,8 @@ export const strings = {
55
55
  previewPhoto: 'Vista Previa',
56
56
  doTakePhoto: 'Capturar',
57
57
  doInvertCamera: 'Invertir',
58
- doSavePhoto: 'Guardar'
58
+ doSavePhoto: 'Guardar',
59
+ balance: 'Composición de Saldo'
59
60
  }
60
61
 
61
62
  // Messages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.323",
3
+ "version": "1.0.325",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {