@axelor/aos-mobile-hr 7.2.0

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.
Files changed (175) hide show
  1. package/README.md +44 -0
  2. package/lib/api/currency-api.d.ts +4 -0
  3. package/lib/api/currency-api.js +32 -0
  4. package/lib/api/currency-api.js.map +1 -0
  5. package/lib/api/distance-api.d.ts +4 -0
  6. package/lib/api/distance-api.js +40 -0
  7. package/lib/api/distance-api.js.map +1 -0
  8. package/lib/api/expense-api.d.ts +37 -0
  9. package/lib/api/expense-api.js +136 -0
  10. package/lib/api/expense-api.js.map +1 -0
  11. package/lib/api/expense-config-api.d.ts +1 -0
  12. package/lib/api/expense-config-api.js +23 -0
  13. package/lib/api/expense-config-api.js.map +1 -0
  14. package/lib/api/expense-line-api.d.ts +24 -0
  15. package/lib/api/expense-line-api.js +111 -0
  16. package/lib/api/expense-line-api.js.map +1 -0
  17. package/lib/api/expense-type-api.d.ts +5 -0
  18. package/lib/api/expense-type-api.js +56 -0
  19. package/lib/api/expense-type-api.js.map +1 -0
  20. package/lib/api/index.d.ts +6 -0
  21. package/lib/api/index.js +24 -0
  22. package/lib/api/index.js.map +1 -0
  23. package/lib/api/kilometric-allow-param-api.d.ts +5 -0
  24. package/lib/api/kilometric-allow-param-api.js +44 -0
  25. package/lib/api/kilometric-allow-param-api.js.map +1 -0
  26. package/lib/api/project-api.d.ts +5 -0
  27. package/lib/api/project-api.js +39 -0
  28. package/lib/api/project-api.js.map +1 -0
  29. package/lib/components/atoms/ExpenseCard/ExpenseCard.d.ts +15 -0
  30. package/lib/components/atoms/ExpenseCard/ExpenseCard.js +130 -0
  31. package/lib/components/atoms/ExpenseCard/ExpenseCard.js.map +1 -0
  32. package/lib/components/atoms/ExpenseLineCard/ExpenseLineCard.d.ts +12 -0
  33. package/lib/components/atoms/ExpenseLineCard/ExpenseLineCard.js +106 -0
  34. package/lib/components/atoms/ExpenseLineCard/ExpenseLineCard.js.map +1 -0
  35. package/lib/components/atoms/index.d.ts +2 -0
  36. package/lib/components/atoms/index.js +20 -0
  37. package/lib/components/atoms/index.js.map +1 -0
  38. package/lib/components/index.d.ts +3 -0
  39. package/lib/components/index.js +21 -0
  40. package/lib/components/index.js.map +1 -0
  41. package/lib/components/molecules/ExpenseAddPopup/ExpenseAddPopup.d.ts +7 -0
  42. package/lib/components/molecules/ExpenseAddPopup/ExpenseAddPopup.js +78 -0
  43. package/lib/components/molecules/ExpenseAddPopup/ExpenseAddPopup.js.map +1 -0
  44. package/lib/components/molecules/ExpenseDetailsValidationButton/ExpenseDetailsValidationButton.d.ts +5 -0
  45. package/lib/components/molecules/ExpenseDetailsValidationButton/ExpenseDetailsValidationButton.js +76 -0
  46. package/lib/components/molecules/ExpenseDetailsValidationButton/ExpenseDetailsValidationButton.js.map +1 -0
  47. package/lib/components/molecules/ExpenseLineDetailCard/ExpenseLineDetailCard.d.ts +11 -0
  48. package/lib/components/molecules/ExpenseLineDetailCard/ExpenseLineDetailCard.js +131 -0
  49. package/lib/components/molecules/ExpenseLineDetailCard/ExpenseLineDetailCard.js.map +1 -0
  50. package/lib/components/molecules/ExpenseLineValidationButton/ExpenseLineValidationButton.d.ts +6 -0
  51. package/lib/components/molecules/ExpenseLineValidationButton/ExpenseLineValidationButton.js +37 -0
  52. package/lib/components/molecules/ExpenseLineValidationButton/ExpenseLineValidationButton.js.map +1 -0
  53. package/lib/components/molecules/ExpenseRefusalPopup/ExpenseRefusalPopup.d.ts +9 -0
  54. package/lib/components/molecules/ExpenseRefusalPopup/ExpenseRefusalPopup.js +39 -0
  55. package/lib/components/molecules/ExpenseRefusalPopup/ExpenseRefusalPopup.js.map +1 -0
  56. package/lib/components/molecules/index.d.ts +5 -0
  57. package/lib/components/molecules/index.js +23 -0
  58. package/lib/components/molecules/index.js.map +1 -0
  59. package/lib/components/templates/BillableSwitchCard/BillableSwitchCard.d.ts +7 -0
  60. package/lib/components/templates/BillableSwitchCard/BillableSwitchCard.js +26 -0
  61. package/lib/components/templates/BillableSwitchCard/BillableSwitchCard.js.map +1 -0
  62. package/lib/components/templates/CityFormInput/CityFormInput.d.ts +9 -0
  63. package/lib/components/templates/CityFormInput/CityFormInput.js +76 -0
  64. package/lib/components/templates/CityFormInput/CityFormInput.js.map +1 -0
  65. package/lib/components/templates/CurrencySearchBar/CurrencySearchBar.d.ts +9 -0
  66. package/lib/components/templates/CurrencySearchBar/CurrencySearchBar.js +38 -0
  67. package/lib/components/templates/CurrencySearchBar/CurrencySearchBar.js.map +1 -0
  68. package/lib/components/templates/DistanceIncrement/DistanceIncrement.d.ts +9 -0
  69. package/lib/components/templates/DistanceIncrement/DistanceIncrement.js +46 -0
  70. package/lib/components/templates/DistanceIncrement/DistanceIncrement.js.map +1 -0
  71. package/lib/components/templates/ExpenseHeader/ExpenseHeader.d.ts +2 -0
  72. package/lib/components/templates/ExpenseHeader/ExpenseHeader.js +52 -0
  73. package/lib/components/templates/ExpenseHeader/ExpenseHeader.js.map +1 -0
  74. package/lib/components/templates/ExpenseLineTypeSwitch/ExpenseLineTypeSwitch.d.ts +4 -0
  75. package/lib/components/templates/ExpenseLineTypeSwitch/ExpenseLineTypeSwitch.js +63 -0
  76. package/lib/components/templates/ExpenseLineTypeSwitch/ExpenseLineTypeSwitch.js.map +1 -0
  77. package/lib/components/templates/ExpenseTypeSearchBar/ExpenseTypeSearchBar.d.ts +5 -0
  78. package/lib/components/templates/ExpenseTypeSearchBar/ExpenseTypeSearchBar.js +40 -0
  79. package/lib/components/templates/ExpenseTypeSearchBar/ExpenseTypeSearchBar.js.map +1 -0
  80. package/lib/components/templates/ExpenseWaitingValidationSearchBar/ExpenseWaitingValidationSearchBar.d.ts +12 -0
  81. package/lib/components/templates/ExpenseWaitingValidationSearchBar/ExpenseWaitingValidationSearchBar.js +33 -0
  82. package/lib/components/templates/ExpenseWaitingValidationSearchBar/ExpenseWaitingValidationSearchBar.js.map +1 -0
  83. package/lib/components/templates/KilometricAllowParamSearchBar/KilometricAllowParamSearchBar.d.ts +9 -0
  84. package/lib/components/templates/KilometricAllowParamSearchBar/KilometricAllowParamSearchBar.js +81 -0
  85. package/lib/components/templates/KilometricAllowParamSearchBar/KilometricAllowParamSearchBar.js.map +1 -0
  86. package/lib/components/templates/KilometricTypeSelectPicker/KilometricTypeSelectPicker.d.ts +8 -0
  87. package/lib/components/templates/KilometricTypeSelectPicker/KilometricTypeSelectPicker.js +37 -0
  88. package/lib/components/templates/KilometricTypeSelectPicker/KilometricTypeSelectPicker.js.map +1 -0
  89. package/lib/components/templates/ProjectSearchBar/ProjectSearchBar.d.ts +9 -0
  90. package/lib/components/templates/ProjectSearchBar/ProjectSearchBar.js +38 -0
  91. package/lib/components/templates/ProjectSearchBar/ProjectSearchBar.js.map +1 -0
  92. package/lib/components/templates/ToggleSwitchMode/ToggleSwitchMode.d.ts +6 -0
  93. package/lib/components/templates/ToggleSwitchMode/ToggleSwitchMode.js +34 -0
  94. package/lib/components/templates/ToggleSwitchMode/ToggleSwitchMode.js.map +1 -0
  95. package/lib/components/templates/index.d.ts +12 -0
  96. package/lib/components/templates/index.js +30 -0
  97. package/lib/components/templates/index.js.map +1 -0
  98. package/lib/features/asyncFunctions-index.d.ts +6 -0
  99. package/lib/features/asyncFunctions-index.js +24 -0
  100. package/lib/features/asyncFunctions-index.js.map +1 -0
  101. package/lib/features/currencySlice.d.ts +16 -0
  102. package/lib/features/currencySlice.js +49 -0
  103. package/lib/features/currencySlice.js.map +1 -0
  104. package/lib/features/distanceSlice.d.ts +22 -0
  105. package/lib/features/distanceSlice.js +76 -0
  106. package/lib/features/distanceSlice.js.map +1 -0
  107. package/lib/features/expenseConfigSlice.d.ts +14 -0
  108. package/lib/features/expenseConfigSlice.js +48 -0
  109. package/lib/features/expenseConfigSlice.js.map +1 -0
  110. package/lib/features/expenseLineSlice.d.ts +76 -0
  111. package/lib/features/expenseLineSlice.js +180 -0
  112. package/lib/features/expenseLineSlice.js.map +1 -0
  113. package/lib/features/expenseSlice.d.ts +105 -0
  114. package/lib/features/expenseSlice.js +314 -0
  115. package/lib/features/expenseSlice.js.map +1 -0
  116. package/lib/features/expenseTypeSlice.d.ts +16 -0
  117. package/lib/features/expenseTypeSlice.js +49 -0
  118. package/lib/features/expenseTypeSlice.js.map +1 -0
  119. package/lib/features/index.d.ts +8 -0
  120. package/lib/features/index.js +26 -0
  121. package/lib/features/index.js.map +1 -0
  122. package/lib/features/kilometricAllowParamSlice.d.ts +18 -0
  123. package/lib/features/kilometricAllowParamSlice.js +56 -0
  124. package/lib/features/kilometricAllowParamSlice.js.map +1 -0
  125. package/lib/features/projectSlice.d.ts +16 -0
  126. package/lib/features/projectSlice.js +49 -0
  127. package/lib/features/projectSlice.js.map +1 -0
  128. package/lib/hooks/use-hr-header-actions.d.ts +1 -0
  129. package/lib/hooks/use-hr-header-actions.js +53 -0
  130. package/lib/hooks/use-hr-header-actions.js.map +1 -0
  131. package/lib/i18n/en.json +68 -0
  132. package/lib/i18n/fr.json +68 -0
  133. package/lib/index.d.ts +7 -0
  134. package/lib/index.js +66 -0
  135. package/lib/index.js.map +1 -0
  136. package/lib/models/forms.d.ts +2 -0
  137. package/lib/models/forms.js +183 -0
  138. package/lib/models/forms.js.map +1 -0
  139. package/lib/models/index.d.ts +4 -0
  140. package/lib/models/index.js +22 -0
  141. package/lib/models/index.js.map +1 -0
  142. package/lib/models/objectFields.d.ts +2 -0
  143. package/lib/models/objectFields.js +87 -0
  144. package/lib/models/objectFields.js.map +1 -0
  145. package/lib/models/searchFields.d.ts +2 -0
  146. package/lib/models/searchFields.js +26 -0
  147. package/lib/models/searchFields.js.map +1 -0
  148. package/lib/models/sortFields.d.ts +2 -0
  149. package/lib/models/sortFields.js +26 -0
  150. package/lib/models/sortFields.js.map +1 -0
  151. package/lib/screens/ExpenseDetailsScreen.d.ts +5 -0
  152. package/lib/screens/ExpenseDetailsScreen.js +85 -0
  153. package/lib/screens/ExpenseDetailsScreen.js.map +1 -0
  154. package/lib/screens/ExpenseLineFormScreen.d.ts +5 -0
  155. package/lib/screens/ExpenseLineFormScreen.js +202 -0
  156. package/lib/screens/ExpenseLineFormScreen.js.map +1 -0
  157. package/lib/screens/ExpenseLinesListScreen.d.ts +4 -0
  158. package/lib/screens/ExpenseLinesListScreen.js +91 -0
  159. package/lib/screens/ExpenseLinesListScreen.js.map +1 -0
  160. package/lib/screens/ExpenseListScreen.d.ts +4 -0
  161. package/lib/screens/ExpenseListScreen.js +138 -0
  162. package/lib/screens/ExpenseListScreen.js.map +1 -0
  163. package/lib/screens/index.d.ts +38 -0
  164. package/lib/screens/index.js +52 -0
  165. package/lib/screens/index.js.map +1 -0
  166. package/lib/types/expense.d.ts +27 -0
  167. package/lib/types/expense.js +80 -0
  168. package/lib/types/expense.js.map +1 -0
  169. package/lib/types/expenseLine.d.ts +21 -0
  170. package/lib/types/expenseLine.js +57 -0
  171. package/lib/types/expenseLine.js.map +1 -0
  172. package/lib/types/index.d.ts +2 -0
  173. package/lib/types/index.js +20 -0
  174. package/lib/types/index.js.map +1 -0
  175. package/package.json +50 -0
@@ -0,0 +1,5 @@
1
+ export function searchProject({ searchValue, page, activeCompanyId }: {
2
+ searchValue: any;
3
+ page?: number;
4
+ activeCompanyId: any;
5
+ }): Promise<any>;
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { createStandardSearch, getSearchCriterias, } from '@axelor/aos-mobile-core';
19
+ const createProjectCriteria = (searchValue, activeCompanyId) => {
20
+ const criteria = [getSearchCriterias('hr_project', searchValue)];
21
+ if (activeCompanyId != null) {
22
+ criteria.push({
23
+ fieldName: 'company.id',
24
+ operator: '=',
25
+ value: activeCompanyId,
26
+ });
27
+ }
28
+ return criteria;
29
+ };
30
+ export async function searchProject({ searchValue, page = 0, activeCompanyId }) {
31
+ return createStandardSearch({
32
+ model: 'com.axelor.apps.project.db.Project',
33
+ criteria: createProjectCriteria(searchValue, activeCompanyId),
34
+ fieldKey: 'hr_project',
35
+ sortKey: 'hr_project',
36
+ page,
37
+ });
38
+ }
39
+ //# sourceMappingURL=project-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-api.js","sourceRoot":"","sources":["../../src/api/project-api.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,eAAe,EAAE,EAAE;IAC7D,MAAM,QAAQ,GAAG,CAAC,kBAAkB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;IAEjE,IAAI,eAAe,IAAI,IAAI,EAAE;QAC3B,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,YAAY;YACvB,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,eAAe;SACvB,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAAC,WAAW,EAAE,IAAI,GAAG,CAAC,EAAE,eAAe,EAAC;IAC1E,OAAO,oBAAoB,CAAC;QAC1B,KAAK,EAAE,oCAAoC;QAC3C,QAAQ,EAAE,qBAAqB,CAAC,WAAW,EAAE,eAAe,CAAC;QAC7D,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,YAAY;QACrB,IAAI;KACL,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,15 @@
1
+ interface ExpenseCardProps {
2
+ style?: any;
3
+ statusSelect: number;
4
+ expenseId: number;
5
+ expenseSeq: string;
6
+ onPress: () => void;
7
+ onValidate: () => void;
8
+ onSend: () => void;
9
+ periodeCode?: string;
10
+ inTaxTotal?: string;
11
+ employeeManagerId?: number;
12
+ employeeName?: string;
13
+ }
14
+ declare const ExpenseCard: ({ style, onPress, onValidate, onSend, statusSelect, expenseId, expenseSeq, periodeCode, inTaxTotal, employeeManagerId, employeeName, }: ExpenseCardProps) => JSX.Element;
15
+ export default ExpenseCard;
@@ -0,0 +1,130 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import React, { useMemo } from 'react';
19
+ import { StyleSheet, View } from 'react-native';
20
+ import { Text, useThemeColor, checkNullString, CardIconButton, ObjectCard, } from '@axelor/aos-mobile-ui';
21
+ import { AnomalyBubble, useTranslator, useSelector, } from '@axelor/aos-mobile-core';
22
+ import { Expense } from '../../../types';
23
+ const ExpenseCard = ({ style, onPress, onValidate = () => { }, onSend = () => { }, statusSelect, expenseId, expenseSeq, periodeCode, inTaxTotal, employeeManagerId, employeeName, }) => {
24
+ const Colors = useThemeColor();
25
+ const I18n = useTranslator();
26
+ const { user } = useSelector((state) => state.user);
27
+ const userCanValidate = useMemo(() => {
28
+ if ((user?.employee?.hrManager || employeeManagerId === user.id) &&
29
+ statusSelect === Expense.statusSelect.WaitingValidation) {
30
+ return true;
31
+ }
32
+ return false;
33
+ }, [employeeManagerId, statusSelect, user?.employee?.hrManager, user.id]);
34
+ const isDefaultDisplay = useMemo(() => {
35
+ if ((statusSelect === Expense.statusSelect.WaitingValidation &&
36
+ userCanValidate) ||
37
+ statusSelect === Expense.statusSelect.Draft) {
38
+ return false;
39
+ }
40
+ return true;
41
+ }, [userCanValidate, statusSelect]);
42
+ const borderStyle = useMemo(() => {
43
+ return getBorderStyle(Expense.getStatusColor(statusSelect, Colors)).border;
44
+ }, [Colors, statusSelect]);
45
+ return (<View style={[styles.container, style]}>
46
+ <View style={styles.containerCard}>
47
+ <ObjectCard onPress={onPress} style={borderStyle} leftContainerFlex={2} iconLeftMargin={10} upperTexts={{
48
+ items: [
49
+ {
50
+ customComponent: (<View style={styles.titleContainer}>
51
+ <AnomalyBubble objectName="expense" objectId={expenseId} isIndicationDisabled/>
52
+ <Text writingType="title" style={styles.titleText}>
53
+ {expenseSeq}
54
+ </Text>
55
+ </View>),
56
+ },
57
+ {
58
+ displayText: `${I18n.t('Hr_Period')} : ${periodeCode}`,
59
+ hideIf: checkNullString(periodeCode),
60
+ },
61
+ {
62
+ iconName: 'user',
63
+ indicatorText: employeeName,
64
+ hideIfNull: true,
65
+ },
66
+ ],
67
+ }} sideBadges={{
68
+ items: [
69
+ {
70
+ customComponent: !checkNullString(inTaxTotal) && (<Text style={styles.price}>{`${inTaxTotal} ${user?.activeCompany?.currency?.symbol != null
71
+ ? user?.activeCompany?.currency?.symbol
72
+ : user?.activeCompany?.currency?.code}`}</Text>),
73
+ },
74
+ ],
75
+ }}/>
76
+ </View>
77
+ {!isDefaultDisplay && (<View style={styles.iconContainer}>
78
+ <CardIconButton iconName={statusSelect === Expense.statusSelect.Draft
79
+ ? 'paper-plane'
80
+ : 'check'} iconColor={Colors.primaryColor.foreground} onPress={() => {
81
+ statusSelect === Expense.statusSelect.Draft
82
+ ? onSend()
83
+ : onValidate();
84
+ }} style={styles.cardIconButton}/>
85
+ </View>)}
86
+ </View>);
87
+ };
88
+ const getBorderStyle = Colors => StyleSheet.create({
89
+ border: {
90
+ borderLeftWidth: 7,
91
+ borderLeftColor: Colors.background,
92
+ marginHorizontal: 0,
93
+ marginVertical: 0,
94
+ },
95
+ });
96
+ const styles = StyleSheet.create({
97
+ container: {
98
+ display: 'flex',
99
+ flexDirection: 'row',
100
+ alignItems: 'center',
101
+ flex: 1,
102
+ width: '92%',
103
+ marginHorizontal: 14,
104
+ justifyContent: 'space-evenly',
105
+ alignSelf: 'center',
106
+ },
107
+ containerCard: {
108
+ flex: 6,
109
+ },
110
+ cardIconButton: {
111
+ flex: 1,
112
+ margin: 0,
113
+ marginLeft: 5,
114
+ },
115
+ iconContainer: {
116
+ flex: 1,
117
+ },
118
+ titleContainer: {
119
+ flexDirection: 'row',
120
+ },
121
+ titleText: {
122
+ alignSelf: 'center',
123
+ marginLeft: 5,
124
+ },
125
+ price: {
126
+ textAlign: 'right',
127
+ },
128
+ });
129
+ export default ExpenseCard;
130
+ //# sourceMappingURL=ExpenseCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpenseCard.js","sourceRoot":"","sources":["../../../../src/components/atoms/ExpenseCard/ExpenseCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,IAAI,EACJ,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,aAAa,EACb,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAgBvC,MAAM,WAAW,GAAG,CAAC,EACnB,KAAK,EACL,OAAO,EACP,U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pB,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,KAAK;QACZ,gBAAgB,EAAE,EAAE;QACpB,cAAc,EAAE,cAAc;QAC9B,SAAS,EAAE,QAAQ;KACpB;IACD,aAAa,EAAE;QACb,IAAI,EAAE,CAAC;KACR;IACD,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,UAAU,EAAE,CAAC;KACd;IACD,aAAa,EAAE;QACb,IAAI,EAAE,CAAC;KACR;IACD,cAAc,EAAE;QACd,aAAa,EAAE,KAAK;KACrB;IACD,SAAS,EAAE;QACT,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,CAAC;KACd;IACD,KAAK,EAAE;QACL,SAAS,EAAE,OAAO;KACnB;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -0,0 +1,12 @@
1
+ interface ExpenseLineCardProps {
2
+ expenseId: number;
3
+ expenseDate?: string;
4
+ projectName?: string;
5
+ totalAmount?: string;
6
+ currency?: string;
7
+ displayText?: string;
8
+ onLongPress: () => void;
9
+ setCardHeight: (height: any) => void;
10
+ }
11
+ declare const ExpenseLineCard: ({ expenseId, expenseDate, projectName, totalAmount, currency, displayText, onLongPress, setCardHeight, }: ExpenseLineCardProps) => JSX.Element;
12
+ export default ExpenseLineCard;
@@ -0,0 +1,106 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import React, { useMemo } from 'react';
19
+ import { Dimensions, StyleSheet, TouchableOpacity } from 'react-native';
20
+ import { Text, useThemeColor, ObjectCard } from '@axelor/aos-mobile-ui';
21
+ import { AnomalyBubble, getFullDateItems, useSelector, useTranslator, } from '@axelor/aos-mobile-core';
22
+ const ExpenseLineCard = ({ expenseId, expenseDate, projectName, totalAmount, currency, displayText, onLongPress, setCardHeight, }) => {
23
+ const I18n = useTranslator();
24
+ const Colors = useThemeColor();
25
+ const { user } = useSelector((state) => state.user);
26
+ const styles = useMemo(() => getStyles(Colors), [Colors]);
27
+ const _date = useMemo(() => getFullDateItems(expenseDate, I18n), [I18n, expenseDate]);
28
+ return (<TouchableOpacity onLongPress={onLongPress} delayLongPress={200} activeOpacity={1} onLayout={event => {
29
+ const { height } = event.nativeEvent.layout;
30
+ setCardHeight(_current => (_current == null ? height : _current));
31
+ }}>
32
+ <ObjectCard touchable={false} showArrow={false} style={styles.border} leftContainerFlex={2} upperTexts={{
33
+ style: styles.text,
34
+ items: [
35
+ {
36
+ displayText: displayText,
37
+ isTitle: true,
38
+ numberOfLines: 2,
39
+ style: styles.title,
40
+ },
41
+ {
42
+ indicatorText: _date.day,
43
+ displayText: `${_date.date} ${_date.month}`,
44
+ iconName: 'calendar-alt',
45
+ hideIfNull: true,
46
+ style: styles.details,
47
+ },
48
+ {
49
+ indicatorText: projectName,
50
+ hideIfNull: true,
51
+ style: [styles.details, styles.italic],
52
+ },
53
+ ],
54
+ }} sideBadges={{
55
+ items: [
56
+ {
57
+ customComponent: (<Text fontSize={22} style={styles.amountText} textColor={Colors.primaryColor.background}>{`${totalAmount} ${currency != null
58
+ ? currency
59
+ : user.activeCompany?.currency?.symbol ||
60
+ user.activeCompany?.currency.name}`}</Text>),
61
+ },
62
+ {
63
+ customComponent: (<AnomalyBubble objectName="expense-line" objectId={expenseId} indicatorPosition="left" style={styles.anoBubble} textIndicationStyle={styles.anoBubbleText}/>),
64
+ },
65
+ ],
66
+ }}/>
67
+ </TouchableOpacity>);
68
+ };
69
+ const getStyles = Colors => StyleSheet.create({
70
+ title: {
71
+ marginBottom: 5,
72
+ },
73
+ amountText: {
74
+ alignSelf: 'flex-end',
75
+ fontWeight: '900',
76
+ },
77
+ italic: {
78
+ fontStyle: 'italic',
79
+ marginTop: 2,
80
+ },
81
+ details: {
82
+ fontSize: 16,
83
+ },
84
+ text: {
85
+ justifyContent: 'center',
86
+ minHeight: 100,
87
+ },
88
+ border: {
89
+ borderLeftWidth: 7,
90
+ borderLeftColor: Colors.secondaryColor.background,
91
+ marginHorizontal: 0,
92
+ marginVertical: 0,
93
+ paddingRight: 5,
94
+ },
95
+ anoBubble: {
96
+ position: 'absolute',
97
+ right: 0,
98
+ bottom: 0,
99
+ },
100
+ anoBubbleText: {
101
+ width: Dimensions.get('window').width * 0.7,
102
+ bottom: 0,
103
+ },
104
+ });
105
+ export default ExpenseLineCard;
106
+ //# sourceMappingURL=ExpenseLineCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpenseLineCard.js","sourceRoot":"","sources":["../../../../src/components/atoms/ExpenseLineCard/ExpenseLineCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACtE,OAAO,EAAC,IAAI,EAAE,aAAa,EAAE,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACtE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,GACd,MAAM,yBAAyB,CAAC;AAajC,MAAM,eAAe,GAAG,CAAC,EACvB,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,EACX,QAAQ,EACR,WAAW,EACX,WAAW,EACX,aAAa,GACQ,EAAE,EAAE;IACzB,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,MAA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V,SAAS,EAAE,UAAU;QACrB,UAAU,EAAE,KAAK;KAClB;IACD,MAAM,EAAE;QACN,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,CAAC;KACb;IACD,OAAO,EAAE;QACP,QAAQ,EAAE,EAAE;KACb;IACD,IAAI,EAAE;QACJ,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,GAAG;KACf;IACD,MAAM,EAAE;QACN,eAAe,EAAE,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC,cAAc,CAAC,UAAU;QACjD,gBAAgB,EAAE,CAAC;QACnB,cAAc,EAAE,CAAC;QACjB,YAAY,EAAE,CAAC;KAChB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV;IACD,aAAa,EAAE;QACb,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,GAAG;QAC3C,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC;AAEL,eAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as ExpenseCard } from "./ExpenseCard/ExpenseCard";
2
+ export { default as ExpenseLineCard } from "./ExpenseLineCard/ExpenseLineCard";
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export { default as ExpenseCard } from './ExpenseCard/ExpenseCard';
19
+ export { default as ExpenseLineCard } from './ExpenseLineCard/ExpenseLineCard';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/atoms/index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./atoms";
2
+ export * from "./molecules";
3
+ export * from "./templates";
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export * from './atoms';
19
+ export * from './molecules';
20
+ export * from './templates';
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ export default ExpenseAddPopup;
2
+ declare function ExpenseAddPopup({ style, visible, onClose, selectedItems }: {
3
+ style: any;
4
+ visible: any;
5
+ onClose: any;
6
+ selectedItems: any;
7
+ }): JSX.Element;
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import React, { useCallback, useEffect, useState } from 'react';
19
+ import { StyleSheet, TouchableOpacity, View } from 'react-native';
20
+ import { Alert, useThemeColor, LabelText, Picker } from '@axelor/aos-mobile-ui';
21
+ import { useTranslator, useSelector, useDispatch, useNavigation, } from '@axelor/aos-mobile-core';
22
+ import { createExpense, searchExpenseDraft, updateExpense, } from '../../../features/expenseSlice';
23
+ const ExpenseAddPopup = ({ style, visible, onClose, selectedItems }) => {
24
+ const I18n = useTranslator();
25
+ const Colors = useThemeColor();
26
+ const dispatch = useDispatch();
27
+ const navigation = useNavigation();
28
+ const { expenseDraftList } = useSelector(state => state.expense);
29
+ const { user } = useSelector(state => state.user);
30
+ const [expenseSelected, setExpenseSelected] = useState(null);
31
+ useEffect(() => {
32
+ dispatch(searchExpenseDraft({ userId: user?.id }));
33
+ }, [dispatch, user?.id]);
34
+ const createExpenseAPI = useCallback(() => {
35
+ const _expense = {
36
+ expenseLineIdList: selectedItems,
37
+ employeeId: user?.employee?.id,
38
+ companyId: user?.activeCompany?.id,
39
+ currencyId: user?.activeCompany?.currency?.id,
40
+ };
41
+ dispatch(createExpense({ expense: _expense, userId: user.id }));
42
+ onClose();
43
+ navigation.navigate('ExpenseListScreen');
44
+ }, [dispatch, onClose, navigation, selectedItems, user]);
45
+ const updateExpenseAPI = useCallback(() => {
46
+ dispatch(updateExpense({
47
+ expenseId: expenseSelected.id,
48
+ version: expenseSelected.version,
49
+ userId: user.id,
50
+ expenseLineIdList: selectedItems,
51
+ }));
52
+ navigation.navigate('ExpenseListScreen');
53
+ onClose();
54
+ }, [dispatch, onClose, expenseSelected, navigation, selectedItems, user.id]);
55
+ return (<Alert style={style} visible={visible} cancelButtonConfig={{ onPress: onClose }} confirmButtonConfig={{
56
+ title: I18n.t('Base_Add'),
57
+ onPress: updateExpenseAPI,
58
+ disabled: expenseSelected == null,
59
+ }} translator={I18n.t}>
60
+ <View style={styles.container}>
61
+ <Picker listItems={expenseDraftList} onValueChange={setExpenseSelected} labelField="expenseSeq" valueField="id" title={I18n.t('Hr_Expense')} isValueItem={true}/>
62
+ <TouchableOpacity onPress={createExpenseAPI} style={styles.labelText}>
63
+ <LabelText iconName="plus" color={Colors.primaryColor.background} title={I18n.t('Hr_NewExpense')} size={16}/>
64
+ </TouchableOpacity>
65
+ </View>
66
+ </Alert>);
67
+ };
68
+ const styles = StyleSheet.create({
69
+ container: {
70
+ flexDirection: 'column',
71
+ width: '100%',
72
+ },
73
+ labelText: {
74
+ marginVertical: 5,
75
+ },
76
+ });
77
+ export default ExpenseAddPopup;
78
+ //# sourceMappingURL=ExpenseAddPopup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpenseAddPopup.js","sourceRoot":"","sources":["../../../../src/components/molecules/ExpenseAddPopup/ExpenseAddPopup.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAChE,OAAO,EAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW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,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAC5B,WAAW,CAAC,CAAC,IAAI,CAAC,EAEpB;QAAA,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACnE;UAAA,CAAC,SAAS,CACR,QAAQ,CAAC,MAAM,CACf,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CACtC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAC/B,IAAI,CAAC,CAAC,EAAE,CAAC,EAEb;QAAA,EAAE,gBAAgB,CACpB;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,aAAa,EAAE,QAAQ;QACvB,KAAK,EAAE,MAAM;KACd;IACD,SAAS,EAAE;QACT,cAAc,EAAE,CAAC;KAClB;CACF,CAAC,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ export default ExpenseDetailsValidationButton;
2
+ declare function ExpenseDetailsValidationButton({ expense, mode }: {
3
+ expense: any;
4
+ mode: any;
5
+ }): JSX.Element;
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import React, { useCallback, useState } from 'react';
19
+ import { View } from 'react-native';
20
+ import { useTranslator, useSelector, useDispatch } from '@axelor/aos-mobile-core';
21
+ import { Button, useThemeColor } from '@axelor/aos-mobile-ui';
22
+ import { Expense } from '../../../types';
23
+ import { sendExpense, validateExpense } from '../../../features/expenseSlice';
24
+ import ExpenseRefusalPopup from '../ExpenseRefusalPopup/ExpenseRefusalPopup';
25
+ import { StyleSheet } from 'react-native';
26
+ const ExpenseDetailsValidationButton = ({ expense, mode }) => {
27
+ const I18n = useTranslator();
28
+ const dispatch = useDispatch();
29
+ const Colors = useThemeColor();
30
+ const { user } = useSelector(state => state.user);
31
+ const [refusalPopupIsOpen, setRefusalPopupIsOpen] = useState(false);
32
+ const [refusalMessage, setRefusalMessage] = useState('');
33
+ const sendExpenseAPI = useCallback(() => {
34
+ dispatch(sendExpense({
35
+ expenseId: expense.id,
36
+ version: expense.version,
37
+ onExpense: true,
38
+ }));
39
+ }, [dispatch, expense]);
40
+ const validateExpenseAPI = useCallback(() => {
41
+ dispatch(validateExpense({
42
+ expenseId: expense.id,
43
+ version: expense.version,
44
+ onExpense: true,
45
+ mode: mode,
46
+ }));
47
+ }, [dispatch, mode, expense]);
48
+ if (expense.statusSelect === Expense.statusSelect.Draft) {
49
+ return <Button title={I18n.t('Hr_Send')} onPress={sendExpenseAPI}/>;
50
+ }
51
+ if ((user?.employee?.hrManager ||
52
+ expense.employee?.managerUser?.id === user.id) &&
53
+ expense.statusSelect === Expense.statusSelect.WaitingValidation) {
54
+ return (<>
55
+ <View style={styles.buttonContainer}>
56
+ <Button title={I18n.t('Hr_Refuse')} onPress={() => {
57
+ setRefusalPopupIsOpen(true);
58
+ }} color={Colors.errorColor} width="45%" iconName="times"/>
59
+ <Button title={I18n.t('Hr_Validate')} onPress={validateExpenseAPI} width="45%" iconName="check"/>
60
+ </View>
61
+ <ExpenseRefusalPopup expense={expense} mode={mode} refusalMessage={refusalMessage} refusalPopupIsOpen={refusalPopupIsOpen} setRefusalMessage={setRefusalMessage} onClose={() => {
62
+ setRefusalMessage('');
63
+ setRefusalPopupIsOpen(false);
64
+ }}/>
65
+ </>);
66
+ }
67
+ return null;
68
+ };
69
+ const styles = StyleSheet.create({
70
+ buttonContainer: {
71
+ flexDirection: 'row',
72
+ justifyContent: 'space-evenly',
73
+ },
74
+ });
75
+ export default ExpenseDetailsValidationButton;
76
+ //# sourceMappingURL=ExpenseDetailsValidationButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpenseDetailsValidationButton.js","sourceRoot":"","sources":["../../../../src/components/molecules/ExpenseDetailsValidationButton/ExpenseDetailsValidationButton.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC5E,OAAO,mBAAmB,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAExC,MAAM,8BAA8B,GAAG,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,EAAE,EAAE;IACzD,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,EAAC,IAAI,EAAC,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,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,MAAM,CAAC,eAAe,CAAC,CAClC;UAAA,CAAC,MAAM,CACL,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAC3B,OAAO,CAAC,CAAC,GAAG,EAAE;gBACZ,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC9B,CAAC,CAAC,CACF,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CACzB,KAAK,CAAC,KAAK,CACX,QAAQ,CAAC,OAAO,EAElB;UAAA,CAAC,MAAM,CACL,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAC7B,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAC5B,KAAK,CAAC,KAAK,CACX,QAAQ,CAAC,OAAO,EAEpB;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,mBAAmB,CAClB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,kBAAkB,CAAC,CAAC,kBAAkB,CAAC,CACvC,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,OAAO,CAAC,CAAC,GAAG,EAAE;gBACZ,iBAAiB,CAAC,EAAE,CAAC,CAAC;gBACtB,qBAAqB,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,EAEN;MAAA,GAAG,CACJ,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,eAAe,EAAE;QACf,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,cAAc;KAC/B;CACF,CAAC,CAAC;AAEH,eAAe,8BAA8B,CAAC"}
@@ -0,0 +1,11 @@
1
+ declare const ExpenseLineDetailCard: ({ style, item, expense, onEdit, onLongPress, onItemSelection, isSelectionMode, isSelected, }: {
2
+ style: any;
3
+ item: any;
4
+ expense: any;
5
+ onEdit: any;
6
+ onLongPress: any;
7
+ onItemSelection: any;
8
+ isSelectionMode: any;
9
+ isSelected: any;
10
+ }) => JSX.Element;
11
+ export default ExpenseLineDetailCard;