digikhata-mashreq-sdk 0.1.1

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 (203) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +37 -0
  3. package/lib/module/App.js +41 -0
  4. package/lib/module/App.js.map +1 -0
  5. package/lib/module/app/assets/Icons/Bill.png +0 -0
  6. package/lib/module/app/assets/Icons/Cash.png +0 -0
  7. package/lib/module/app/assets/Icons/Expense.png +0 -0
  8. package/lib/module/app/assets/Icons/Staff.png +0 -0
  9. package/lib/module/app/assets/Icons/Stock.png +0 -0
  10. package/lib/module/app/assets/images/bill.png +0 -0
  11. package/lib/module/app/assets/images/book.png +0 -0
  12. package/lib/module/app/assets/images/digiKhataSolo256.png +0 -0
  13. package/lib/module/app/assets/images/money.png +0 -0
  14. package/lib/module/app/assets/images/staff.png +0 -0
  15. package/lib/module/app/assets/images/stock.png +0 -0
  16. package/lib/module/app/assets/images/svgviewer-png-output-white.png +0 -0
  17. package/lib/module/app/components/Balance.js +153 -0
  18. package/lib/module/app/components/Balance.js.map +1 -0
  19. package/lib/module/app/components/CountryPhoneInput.js +271 -0
  20. package/lib/module/app/components/CountryPhoneInput.js.map +1 -0
  21. package/lib/module/app/components/Entries.js +89 -0
  22. package/lib/module/app/components/Entries.js.map +1 -0
  23. package/lib/module/app/components/SearchBar.js +70 -0
  24. package/lib/module/app/components/SearchBar.js.map +1 -0
  25. package/lib/module/app/components/Transaction.js +108 -0
  26. package/lib/module/app/components/Transaction.js.map +1 -0
  27. package/lib/module/app/components/User.js +109 -0
  28. package/lib/module/app/components/User.js.map +1 -0
  29. package/lib/module/app/components/index.js +10 -0
  30. package/lib/module/app/components/index.js.map +1 -0
  31. package/lib/module/app/database/clients.js +149 -0
  32. package/lib/module/app/database/clients.js.map +1 -0
  33. package/lib/module/app/database/database.js +9 -0
  34. package/lib/module/app/database/database.js.map +1 -0
  35. package/lib/module/app/database/schema.js +525 -0
  36. package/lib/module/app/database/schema.js.map +1 -0
  37. package/lib/module/app/navigation/BottomTabs/BottomTabs.js +29 -0
  38. package/lib/module/app/navigation/BottomTabs/BottomTabs.js.map +1 -0
  39. package/lib/module/app/navigation/Drawer/Drawer.js +13 -0
  40. package/lib/module/app/navigation/Drawer/Drawer.js.map +1 -0
  41. package/lib/module/app/navigation/HomeStack/HomeStack.js +36 -0
  42. package/lib/module/app/navigation/HomeStack/HomeStack.js.map +1 -0
  43. package/lib/module/app/navigation/Root.js +26 -0
  44. package/lib/module/app/navigation/Root.js.map +1 -0
  45. package/lib/module/app/navigation/index.js +7 -0
  46. package/lib/module/app/navigation/index.js.map +1 -0
  47. package/lib/module/app/redux/Store.js +10 -0
  48. package/lib/module/app/redux/Store.js.map +1 -0
  49. package/lib/module/app/redux/reducers/client/client_actions.js +2 -0
  50. package/lib/module/app/redux/reducers/client/client_actions.js.map +1 -0
  51. package/lib/module/app/redux/reducers/client/client_reducers.js +26 -0
  52. package/lib/module/app/redux/reducers/client/client_reducers.js.map +1 -0
  53. package/lib/module/app/redux/reducers/client/client_types.js +7 -0
  54. package/lib/module/app/redux/reducers/client/client_types.js.map +1 -0
  55. package/lib/module/app/screens/AddScreen.js +200 -0
  56. package/lib/module/app/screens/AddScreen.js.map +1 -0
  57. package/lib/module/app/screens/Banks.js +126 -0
  58. package/lib/module/app/screens/Banks.js.map +1 -0
  59. package/lib/module/app/screens/CustomerEntries.js +475 -0
  60. package/lib/module/app/screens/CustomerEntries.js.map +1 -0
  61. package/lib/module/app/screens/Customers.js +233 -0
  62. package/lib/module/app/screens/Customers.js.map +1 -0
  63. package/lib/module/app/screens/Entry.js +696 -0
  64. package/lib/module/app/screens/Entry.js.map +1 -0
  65. package/lib/module/app/screens/HomeScreen.js +176 -0
  66. package/lib/module/app/screens/HomeScreen.js.map +1 -0
  67. package/lib/module/app/screens/SelectBusiness.js +201 -0
  68. package/lib/module/app/screens/SelectBusiness.js.map +1 -0
  69. package/lib/module/app/screens/Splash.js +51 -0
  70. package/lib/module/app/screens/Splash.js.map +1 -0
  71. package/lib/module/app/screens/Suppliers.js +222 -0
  72. package/lib/module/app/screens/Suppliers.js.map +1 -0
  73. package/lib/module/app/screens/TransactionDetails.js +301 -0
  74. package/lib/module/app/screens/TransactionDetails.js.map +1 -0
  75. package/lib/module/app/screens/index.js +14 -0
  76. package/lib/module/app/screens/index.js.map +1 -0
  77. package/lib/module/app/themes/config.js +156 -0
  78. package/lib/module/app/themes/config.js.map +1 -0
  79. package/lib/module/app/utils/countries.json +1930 -0
  80. package/lib/module/declarations.d.js +2 -0
  81. package/lib/module/declarations.d.js.map +1 -0
  82. package/lib/module/index.js +5 -0
  83. package/lib/module/index.js.map +1 -0
  84. package/lib/module/package.json +1 -0
  85. package/lib/typescript/babel.config.d.ts +10 -0
  86. package/lib/typescript/babel.config.d.ts.map +1 -0
  87. package/lib/typescript/eslint.config.d.mts +3 -0
  88. package/lib/typescript/eslint.config.d.mts.map +1 -0
  89. package/lib/typescript/package.json +1 -0
  90. package/lib/typescript/src/App.d.ts +2 -0
  91. package/lib/typescript/src/App.d.ts.map +1 -0
  92. package/lib/typescript/src/app/components/Balance.d.ts +8 -0
  93. package/lib/typescript/src/app/components/Balance.d.ts.map +1 -0
  94. package/lib/typescript/src/app/components/CountryPhoneInput.d.ts +6 -0
  95. package/lib/typescript/src/app/components/CountryPhoneInput.d.ts.map +1 -0
  96. package/lib/typescript/src/app/components/Entries.d.ts +4 -0
  97. package/lib/typescript/src/app/components/Entries.d.ts.map +1 -0
  98. package/lib/typescript/src/app/components/SearchBar.d.ts +6 -0
  99. package/lib/typescript/src/app/components/SearchBar.d.ts.map +1 -0
  100. package/lib/typescript/src/app/components/Transaction.d.ts +11 -0
  101. package/lib/typescript/src/app/components/Transaction.d.ts.map +1 -0
  102. package/lib/typescript/src/app/components/User.d.ts +10 -0
  103. package/lib/typescript/src/app/components/User.d.ts.map +1 -0
  104. package/lib/typescript/src/app/components/index.d.ts +8 -0
  105. package/lib/typescript/src/app/components/index.d.ts.map +1 -0
  106. package/lib/typescript/src/app/database/clients.d.ts +9 -0
  107. package/lib/typescript/src/app/database/clients.d.ts.map +1 -0
  108. package/lib/typescript/src/app/database/database.d.ts +3 -0
  109. package/lib/typescript/src/app/database/database.d.ts.map +1 -0
  110. package/lib/typescript/src/app/database/schema.d.ts +2 -0
  111. package/lib/typescript/src/app/database/schema.d.ts.map +1 -0
  112. package/lib/typescript/src/app/navigation/BottomTabs/BottomTabs.d.ts +2 -0
  113. package/lib/typescript/src/app/navigation/BottomTabs/BottomTabs.d.ts.map +1 -0
  114. package/lib/typescript/src/app/navigation/Drawer/Drawer.d.ts +2 -0
  115. package/lib/typescript/src/app/navigation/Drawer/Drawer.d.ts.map +1 -0
  116. package/lib/typescript/src/app/navigation/HomeStack/HomeStack.d.ts +2 -0
  117. package/lib/typescript/src/app/navigation/HomeStack/HomeStack.d.ts.map +1 -0
  118. package/lib/typescript/src/app/navigation/Root.d.ts +2 -0
  119. package/lib/typescript/src/app/navigation/Root.d.ts.map +1 -0
  120. package/lib/typescript/src/app/navigation/index.d.ts +5 -0
  121. package/lib/typescript/src/app/navigation/index.d.ts.map +1 -0
  122. package/lib/typescript/src/app/redux/Store.d.ts +2 -0
  123. package/lib/typescript/src/app/redux/Store.d.ts.map +1 -0
  124. package/lib/typescript/src/app/redux/reducers/client/client_actions.d.ts +1 -0
  125. package/lib/typescript/src/app/redux/reducers/client/client_actions.d.ts.map +1 -0
  126. package/lib/typescript/src/app/redux/reducers/client/client_reducers.d.ts +3 -0
  127. package/lib/typescript/src/app/redux/reducers/client/client_reducers.d.ts.map +1 -0
  128. package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts +5 -0
  129. package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts.map +1 -0
  130. package/lib/typescript/src/app/screens/AddScreen.d.ts +5 -0
  131. package/lib/typescript/src/app/screens/AddScreen.d.ts.map +1 -0
  132. package/lib/typescript/src/app/screens/Banks.d.ts +2 -0
  133. package/lib/typescript/src/app/screens/Banks.d.ts.map +1 -0
  134. package/lib/typescript/src/app/screens/CustomerEntries.d.ts +5 -0
  135. package/lib/typescript/src/app/screens/CustomerEntries.d.ts.map +1 -0
  136. package/lib/typescript/src/app/screens/Customers.d.ts +4 -0
  137. package/lib/typescript/src/app/screens/Customers.d.ts.map +1 -0
  138. package/lib/typescript/src/app/screens/Entry.d.ts +5 -0
  139. package/lib/typescript/src/app/screens/Entry.d.ts.map +1 -0
  140. package/lib/typescript/src/app/screens/HomeScreen.d.ts +4 -0
  141. package/lib/typescript/src/app/screens/HomeScreen.d.ts.map +1 -0
  142. package/lib/typescript/src/app/screens/SelectBusiness.d.ts +4 -0
  143. package/lib/typescript/src/app/screens/SelectBusiness.d.ts.map +1 -0
  144. package/lib/typescript/src/app/screens/Splash.d.ts +4 -0
  145. package/lib/typescript/src/app/screens/Splash.d.ts.map +1 -0
  146. package/lib/typescript/src/app/screens/Suppliers.d.ts +4 -0
  147. package/lib/typescript/src/app/screens/Suppliers.d.ts.map +1 -0
  148. package/lib/typescript/src/app/screens/TransactionDetails.d.ts +5 -0
  149. package/lib/typescript/src/app/screens/TransactionDetails.d.ts.map +1 -0
  150. package/lib/typescript/src/app/screens/index.d.ts +12 -0
  151. package/lib/typescript/src/app/screens/index.d.ts.map +1 -0
  152. package/lib/typescript/src/app/themes/config.d.ts +63 -0
  153. package/lib/typescript/src/app/themes/config.d.ts.map +1 -0
  154. package/lib/typescript/src/index.d.ts +3 -0
  155. package/lib/typescript/src/index.d.ts.map +1 -0
  156. package/package.json +154 -0
  157. package/src/App.js +41 -0
  158. package/src/app/assets/Icons/Bill.png +0 -0
  159. package/src/app/assets/Icons/Cash.png +0 -0
  160. package/src/app/assets/Icons/Expense.png +0 -0
  161. package/src/app/assets/Icons/Staff.png +0 -0
  162. package/src/app/assets/Icons/Stock.png +0 -0
  163. package/src/app/assets/images/bill.png +0 -0
  164. package/src/app/assets/images/book.png +0 -0
  165. package/src/app/assets/images/digiKhataSolo256.png +0 -0
  166. package/src/app/assets/images/money.png +0 -0
  167. package/src/app/assets/images/staff.png +0 -0
  168. package/src/app/assets/images/stock.png +0 -0
  169. package/src/app/assets/images/svgviewer-png-output-white.png +0 -0
  170. package/src/app/components/Balance.js +122 -0
  171. package/src/app/components/CountryPhoneInput.js +286 -0
  172. package/src/app/components/Entries.js +75 -0
  173. package/src/app/components/SearchBar.js +64 -0
  174. package/src/app/components/Transaction.js +91 -0
  175. package/src/app/components/User.js +85 -0
  176. package/src/app/components/index.js +15 -0
  177. package/src/app/database/clients.js +207 -0
  178. package/src/app/database/database.js +9 -0
  179. package/src/app/database/schema.js +525 -0
  180. package/src/app/navigation/BottomTabs/BottomTabs.js +27 -0
  181. package/src/app/navigation/Drawer/Drawer.js +10 -0
  182. package/src/app/navigation/HomeStack/HomeStack.js +43 -0
  183. package/src/app/navigation/Root.js +32 -0
  184. package/src/app/navigation/index.js +9 -0
  185. package/src/app/redux/Store.js +9 -0
  186. package/src/app/redux/reducers/client/client_actions.js +0 -0
  187. package/src/app/redux/reducers/client/client_reducers.js +30 -0
  188. package/src/app/redux/reducers/client/client_types.js +5 -0
  189. package/src/app/screens/AddScreen.js +185 -0
  190. package/src/app/screens/Banks.js +151 -0
  191. package/src/app/screens/CustomerEntries.js +402 -0
  192. package/src/app/screens/Customers.js +240 -0
  193. package/src/app/screens/Entry.js +658 -0
  194. package/src/app/screens/HomeScreen.js +146 -0
  195. package/src/app/screens/SelectBusiness.js +177 -0
  196. package/src/app/screens/Splash.js +43 -0
  197. package/src/app/screens/Suppliers.js +228 -0
  198. package/src/app/screens/TransactionDetails.js +199 -0
  199. package/src/app/screens/index.js +23 -0
  200. package/src/app/themes/config.js +185 -0
  201. package/src/app/utils/countries.json +1930 -0
  202. package/src/declarations.d.ts +1 -0
  203. package/src/index.tsx +3 -0
@@ -0,0 +1,199 @@
1
+ import { View, Text, StyleSheet, TouchableOpacity, FlatList, ScrollView, Image } from 'react-native'
2
+ import React, { useState, useEffect } from 'react'
3
+ import LinearGradient from 'react-native-linear-gradient'
4
+ import Ionicons from "react-native-vector-icons/Ionicons"
5
+ import { COLORS, FONT_MEDIUM, FONT_NORMAL, formatDateTime, getAvatar, HP, isPdfFile, WP } from '../themes/config'
6
+ import { useSelector } from "react-redux";
7
+ import { getClientTransactions } from '../database/clients'
8
+ import { SearchBar, Transaction } from '../components'
9
+ import { viewDocument } from '@react-native-documents/viewer'
10
+
11
+ export default function TransactionDetails({ navigation, route }) {
12
+
13
+ let item = route?.params?.item;
14
+ const ClientDetails = useSelector(state => state.client.client_details);
15
+
16
+ // console.log(item)
17
+
18
+ return (
19
+ <View style={Styles._mainContainer}>
20
+ <LinearGradient
21
+ style={Styles._headerMain}
22
+ start={{ x: 0, y: 0 }}
23
+ end={{ x: 1, y: 0 }}
24
+ colors={[COLORS.primaryColor, COLORS.secondaryColor]}
25
+ >
26
+ <TouchableOpacity
27
+ activeOpacity={0.8}
28
+ onPress={() => navigation?.goBack()}
29
+ >
30
+ <Ionicons
31
+ name={"chevron-back"}
32
+ color={COLORS.whiteColor}
33
+ size={25}
34
+ />
35
+ </TouchableOpacity>
36
+
37
+ <Text style={Styles._nameTxt}>Entry Details</Text>
38
+ </LinearGradient>
39
+
40
+ <View style={Styles._contentMain}>
41
+ <ScrollView
42
+ contentContainerStyle={{ alignItems: "center" }}
43
+ >
44
+ <LinearGradient
45
+ style={[Styles._headerMain, { height: 40 }]}
46
+ start={{ x: 0, y: 0 }}
47
+ end={{ x: 1, y: 0 }}
48
+ colors={[COLORS.primaryColor, COLORS.secondaryColor]}
49
+ />
50
+ <View style={Styles._sectionOne}>
51
+ <View style={Styles._segment}>
52
+ <View style={{ flexDirection: "row", height: "100%", alignItems: "center", gap: 10 }}>
53
+ <View style={Styles._avatarMain}>
54
+ <Text style={[Styles._avatarText, { color: "red" }]}>{getAvatar("Saud")}</Text>
55
+ </View>
56
+
57
+ <View>
58
+ <Text style={{ color: COLORS.blackColor, fontFamily: FONT_MEDIUM, fontSize: 13 }}>{ClientDetails?.name}</Text>
59
+ <Text style={{ color: COLORS.blackColor, fontFamily: FONT_NORMAL, fontSize: 12, opacity: 0.6 }}>{formatDateTime(item?.date)}</Text>
60
+ </View>
61
+ </View>
62
+
63
+ <View style={{ alignItems: "flex-end" }}>
64
+ <Text style={{ color: item?.amount !== "0" ? "red" : "green", fontFamily: FONT_MEDIUM, fontSize: 14 }}>Rs {item?.amount !== "0" ? item?.amount : item?.subamount}</Text>
65
+ <Text style={{ color: COLORS.blackColor, opacity: 0.8, fontFamily: FONT_NORMAL, fontSize: 12 }}>{item?.amount !== "0" ? (ClientDetails.type == 0 ? "You Gave" : "Payment") : (ClientDetails?.type == 0 ? "You Get" : "Purchase")}</Text>
66
+ </View>
67
+ </View>
68
+ {
69
+ item?.notes &&
70
+ <View style={[Styles._segment, { flexDirection: "column", alignItems: "flex-start" }]}>
71
+ <Text style={{ color: COLORS.blackColor, opacity: 0.6, fontFamily: FONT_MEDIUM, fontSize: 13 }}>Details</Text>
72
+ <Text style={{ color: COLORS.blackColor, fontFamily: FONT_MEDIUM, fontSize: 11 }}>{item?.notes}</Text>
73
+ </View>
74
+ }
75
+
76
+ {
77
+ item?.attachments?.length != 0 &&
78
+ <View style={[Styles._segment, { flexDirection: "column", alignItems: "flex-start" }]}>
79
+ <Text style={{ color: COLORS.blackColor, opacity: 0.6, fontFamily: FONT_MEDIUM, fontSize: 13 }}>Attachments</Text>
80
+ {/* Attachments Here */}
81
+ <View style={{ flexDirection: "row" }}>
82
+ {item?.attachments?.map((i, index) => (
83
+ <TouchableOpacity
84
+ key={index}
85
+ activeOpacity={0.8}
86
+ onPress={() => viewDocument({ uri: i?.local_path })}
87
+ >
88
+ {isPdfFile(i?.local_path) ? (
89
+ <Ionicons
90
+ name="document-text-outline"
91
+ size={45}
92
+ color={COLORS.primaryColor}
93
+ style={{ margin: 5 }}
94
+ />
95
+ ) : (
96
+ <Image
97
+ source={{ uri: i?.local_path }}
98
+ style={{ width: 45, height: 45, margin: 5, borderRadius: 8 }}
99
+ resizeMode="cover"
100
+ />
101
+ )}
102
+ </TouchableOpacity>
103
+ ))}
104
+ </View>
105
+
106
+ </View>
107
+ }
108
+
109
+ <View style={[Styles._segment, { flexDirection: "column", alignItems: "flex-start" }]}>
110
+ <Text style={{ color: COLORS.blackColor, opacity: 0.6, fontFamily: FONT_MEDIUM, fontSize: 13 }}>Running Balance</Text>
111
+ <Text style={{ color: item?.balance < 0 ? "red" : "green", fontFamily: FONT_MEDIUM, fontSize: 11 }}>Rs {Math.abs(item?.balance)}</Text>
112
+ </View>
113
+
114
+ <TouchableOpacity
115
+ style={[Styles._segment, { justifyContent: "center", gap: 5 }]}
116
+ activeOpacity={0.8}
117
+ >
118
+ <Ionicons
119
+ name={"pencil-outline"}
120
+ color={COLORS.primaryColor}
121
+ size={20}
122
+ />
123
+ <Text style={{ color: COLORS.primaryColor, fontSize: 14, fontFamily: FONT_NORMAL }}>Edit Entry</Text>
124
+ </TouchableOpacity>
125
+ </View>
126
+ </ScrollView>
127
+ </View>
128
+ </View>
129
+ )
130
+ }
131
+
132
+ const Styles = StyleSheet.create({
133
+ _mainContainer: {
134
+ flex: 1,
135
+ backgroundColor: COLORS.backgroundColor,
136
+ },
137
+ _headerMain: {
138
+ width: WP(100),
139
+ height: 60,
140
+ flexDirection: "row",
141
+ alignItems: "center",
142
+ justifyContent: "flex-start",
143
+ gap: 10
144
+ },
145
+ _nameTxt: {
146
+ color: COLORS.whiteColor,
147
+ fontFamily: FONT_MEDIUM,
148
+ fontSize: 15
149
+ },
150
+ _contentMain: {
151
+ flex: 1,
152
+ width: "100%",
153
+ // height: "85%",
154
+ // backgroundColor: "red",
155
+ alignItems: "center"
156
+ },
157
+ _sectionOne: {
158
+ width: "95%",
159
+ // height: 200,
160
+ backgroundColor: COLORS.whiteColor,
161
+ position: "absolute",
162
+ top: 0,
163
+ borderRadius: 12,
164
+ shadowColor: "#000",
165
+ shadowOffset: {
166
+ width: 0,
167
+ height: 2,
168
+ },
169
+ shadowOpacity: 0.2,
170
+ shadowRadius: 3.84,
171
+ elevation: 5,
172
+ alignItems: "center",
173
+ paddingHorizontal: 10,
174
+ },
175
+ _segment: {
176
+ flexDirection: "row",
177
+ justifyContent: "space-between",
178
+ alignItems: "center",
179
+ width: "100%",
180
+ // height:40,
181
+ // backgroundColor: "pink",
182
+ paddingVertical: 10,
183
+ borderBottomColor: COLORS.grey,
184
+ borderBottomWidth: 1
185
+ },
186
+ _avatarMain: {
187
+ width: 47,
188
+ height: 47,
189
+ backgroundColor: COLORS.lightGrey,
190
+ borderRadius: 100,
191
+ justifyContent: "center",
192
+ alignItems: "center",
193
+ },
194
+ _avatarText: {
195
+ fontFamily: FONT_NORMAL,
196
+ fontSize: 16,
197
+ color: COLORS.primaryColor
198
+ },
199
+ })
@@ -0,0 +1,23 @@
1
+ import Splash from "./Splash";
2
+ import HomeScreen from "./HomeScreen";
3
+ import Banks from "./Banks";
4
+ import Customers from "./Customers";
5
+ import Suppliers from "./Suppliers";
6
+ import AddScreen from "./AddScreen";
7
+ import CustomerEntries from "./CustomerEntries";
8
+ import SelectBusiness from "./SelectBusiness";
9
+ import Entry from "./Entry";
10
+ import TransactionDetails from "./TransactionDetails";
11
+
12
+ export {
13
+ Splash,
14
+ HomeScreen,
15
+ Banks,
16
+ Customers,
17
+ Suppliers,
18
+ AddScreen,
19
+ CustomerEntries,
20
+ SelectBusiness,
21
+ Entry,
22
+ TransactionDetails,
23
+ }
@@ -0,0 +1,185 @@
1
+ import React from 'react';
2
+ import {
3
+ Platform,
4
+ Dimensions,
5
+ useWindowDimensions,
6
+ Image,
7
+ I18nManager,
8
+ } from 'react-native';
9
+ import {
10
+ widthPercentageToDP,
11
+ heightPercentageToDP,
12
+ } from 'react-native-responsive-screen';
13
+ import AntDesign from 'react-native-vector-icons/AntDesign';
14
+ import Entypo from 'react-native-vector-icons/Entypo';
15
+ import EvilIcons from 'react-native-vector-icons/EvilIcons';
16
+ import Feather from 'react-native-vector-icons/Feather';
17
+ import FontAwesome from 'react-native-vector-icons/FontAwesome';
18
+ import Ionicons from 'react-native-vector-icons/Ionicons';
19
+
20
+ //CONSTANTS USED IN APP
21
+ export const APP_NAME = 'DigiKhata';
22
+ export const PLATFORM = Platform.OS;
23
+ export const WP = widthPercentageToDP;
24
+ export const HP = heightPercentageToDP;
25
+ export const MOBILE_WIDTH = Dimensions.get('window').width;
26
+ export const MOBILE_HEIGHT = Dimensions.get('window').height;
27
+
28
+ //COLORS USED IN APPLICATION
29
+ export const COLORS = {
30
+ primaryColor: '#FF5F00',
31
+ textColor: '#333333',
32
+ backgroundColor: '#F2F2F2',
33
+ primaryRGB: 'rgba(90,44,102,',
34
+ secondaryColor: '#FCBF11',
35
+ territoryColor: '#9D4DB3',
36
+ primaryColor2: '#9E2654',
37
+ secondaryColor2: '#BC2E65',
38
+ territoryColor2: '#D34D80',
39
+ lightGrey: '#F1F1F1',
40
+ darkGrey: '#9B9B9B',
41
+ grey: '#cccccc',
42
+ gray: 'rgb(211,211,211)',
43
+ blackColor: '#000',
44
+ whiteColor: '#ffffff',
45
+ borderColor: '#E7E7E7',
46
+ redColor: '#E6344A',
47
+ greenColor: '#21CE99',
48
+ yellowColor: '#FEA503',
49
+ circle1: '#9e2654',
50
+ circle2: '#a83c65',
51
+ circle3: '#b15176',
52
+ circle4: '#bb6787',
53
+ circle5: '#c57d98',
54
+ primary_circle1: '#5a2c66',
55
+ primary_circle2: '#6b4175',
56
+ primary_circle3: '#7b5685',
57
+ primary_circle4: '#8c6b94',
58
+ dark_orange: '#D28C64',
59
+ primaryGreen: '#6BC9B9',
60
+ primaryRed: '#E71E25',
61
+ primaryOrange: '#F36B10',
62
+ primaryYellow: '#FCD100',
63
+ dark_golden: '#b58146',
64
+ };
65
+
66
+ // export const mainLogo = require("../assets/images/maiLogo.png");
67
+ // export const mainLogoBlack = require("../assets/images/mianLogoBlack.png");
68
+
69
+ export const FONT_NORMAL = "29LTBukra-Regular";
70
+ export const FONT_MEDIUM = "29LTBukra-Medium";
71
+ export const FONT_BOLD = "29LTBukra-Bold";
72
+
73
+ export const TEXT_SIZES = {
74
+ h1: 7,
75
+ h2: 6,
76
+ h3: 5,
77
+ info_1: 4,
78
+ info_2: 3.5,
79
+ };
80
+
81
+ export const EXPENSE_COLORS = [
82
+ 'tomato',
83
+ 'orange',
84
+ '#FF7F50',
85
+ 'gold',
86
+ 'yellow',
87
+ '#90EE90',
88
+ 'green',
89
+ '#A84420',
90
+ '#FFC600',
91
+ '#FE5000',
92
+ '#12B347',
93
+ '#E8A20C',
94
+ '#E6A467',
95
+ ];
96
+
97
+ //MONTHS
98
+ export const MONTHS = [
99
+ 'Jan',
100
+ 'Feb',
101
+ 'Mar',
102
+ 'Apr',
103
+ 'May',
104
+ 'Jun',
105
+ 'Jul',
106
+ 'Aug',
107
+ 'Sep',
108
+ 'Oct',
109
+ 'Nov',
110
+ 'Dec',
111
+ ];
112
+
113
+ export const DAYS = [
114
+ { value: 'Sunday', label: 'Sunday' },
115
+ { value: 'Monday', label: 'Monday' },
116
+ { value: 'Tuesday', label: 'Tuesday' },
117
+ { value: 'Wednesday', label: 'Wednesday' },
118
+ { value: 'Thursday', label: 'Thursday' },
119
+ { value: 'Friday', label: 'Friday' },
120
+ { value: 'Saturday', label: 'Saturday' },
121
+ ];
122
+
123
+ export function getAvatar(name) {
124
+ if (!name) return "";
125
+
126
+ const words = name.trim().split(" ");
127
+
128
+ if (words.length === 1) {
129
+ return words[0][0].toUpperCase();
130
+ } else {
131
+ return (words[0][0] + " " + words[1][0]).toUpperCase();
132
+ }
133
+ }
134
+
135
+ export function formatDateTime(dateTimeStr) {
136
+ const inputDate = new Date(dateTimeStr.replace(" ", "T")); // Convert to ISO format
137
+ const now = new Date();
138
+
139
+ const isToday = inputDate.toDateString() === now.toDateString();
140
+
141
+ const yesterday = new Date();
142
+ yesterday.setDate(now.getDate() - 1);
143
+ const isYesterday = inputDate.toDateString() === yesterday.toDateString();
144
+
145
+ const optionsTime = { hour: '2-digit', minute: '2-digit', hour12: true };
146
+ const formattedTime = inputDate.toLocaleTimeString('en-US', optionsTime);
147
+
148
+ if (isToday) return `Today • ${formattedTime}`;
149
+ if (isYesterday) return `Yesterday • ${formattedTime}`;
150
+
151
+ const optionsDate = { weekday: 'short', day: '2-digit', month: 'short', year: '2-digit' };
152
+ const formattedDate = inputDate.toLocaleDateString('en-US', optionsDate);
153
+
154
+ return `${formattedDate} • ${formattedTime}`;
155
+ }
156
+
157
+ export function mergeDateTime(dateObj) {
158
+ const date = new Date(dateObj.date);
159
+ const time = new Date(dateObj.time);
160
+
161
+ // Merge date part from `date` and time part from `time`
162
+ date.setHours(time.getHours(), time.getMinutes(), time.getSeconds());
163
+
164
+ const year = date.getFullYear();
165
+ const month = String(date.getMonth() + 1).padStart(2, "0");
166
+ const day = String(date.getDate()).padStart(2, "0");
167
+ const hours = String(date.getHours()).padStart(2, "0");
168
+ const minutes = String(date.getMinutes()).padStart(2, "0");
169
+ const seconds = String(date.getSeconds()).padStart(2, "0");
170
+
171
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
172
+ }
173
+
174
+ export const isPdfFile = (uri) => {
175
+ if (!uri) return false;
176
+
177
+ const lowerUri = uri.toLowerCase();
178
+
179
+ // If ends with .pdf
180
+ if (lowerUri.endsWith(".pdf")) return true;
181
+
182
+ // If no extension in the path
183
+ const filename = lowerUri.split("/").pop(); // get last part after /
184
+ return !filename.includes("."); // true if no "." in filename
185
+ };