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,658 @@
1
+ import { View, Text, StyleSheet, TouchableOpacity, TextInput, Keyboard, ScrollView, Platform, PermissionsAndroid, Image, Dimensions } from 'react-native'
2
+ import React, { useState } from 'react'
3
+ import { COLORS, FONT_MEDIUM, FONT_NORMAL, HP, mergeDateTime, WP } from '../themes/config'
4
+ import LinearGradient from 'react-native-linear-gradient'
5
+ import Ionicons from "react-native-vector-icons/Ionicons"
6
+ import DateTimePicker, { DateTimePickerAndroid } from '@react-native-community/datetimepicker';
7
+ import { addTransaction, addTransactionImages } from '../database/clients';
8
+ import { useSelector } from "react-redux";
9
+ import Modal from "react-native-modal";
10
+ import { launchCamera, launchImageLibrary } from "react-native-image-picker";
11
+ import { pick } from "@react-native-documents/picker";
12
+
13
+ export default function Entry({ navigation, route }) {
14
+
15
+
16
+ const ClientDetails = useSelector(state => state.client.client_details);
17
+ const type = route?.params?.type;
18
+ const mainColor = type;
19
+
20
+ const [input, setInput] = useState('');
21
+ const [memory, setMemory] = useState(null);
22
+ const [Notes, setNotes] = useState("");
23
+ const [date, setDate] = useState(new Date());
24
+ const [time, setTime] = useState(new Date());
25
+ const [MergedDate, setMergedDate] = useState("");
26
+
27
+ const [isModalVisible, setIsModalVisible] = useState(false);
28
+ const [attachments, setAttachments] = useState([]); // {type, uri, name}
29
+
30
+
31
+ // ✅ Add file in state (max 3)
32
+ const addAttachment = (file) => {
33
+ if (attachments.length >= 3) {
34
+ alert("You can only attach up to 3 files.");
35
+ return;
36
+ }
37
+ setAttachments([...attachments, file]);
38
+ };
39
+
40
+ // ✅ Gallery
41
+ const handleGallery = async () => {
42
+ try {
43
+ const result = await launchImageLibrary({ mediaType: "photo" });
44
+ if (result.assets && result.assets.length > 0) {
45
+ addAttachment({
46
+ type: "image",
47
+ uri: result.assets[0].uri,
48
+ name: result.assets[0].fileName || "gallery_image.jpg"
49
+ });
50
+ }
51
+ } catch (err) {
52
+ console.log("Gallery Error:", err);
53
+ }
54
+ setIsModalVisible(false);
55
+ };
56
+
57
+ // ✅ Camera with permission
58
+ const handleCamera = async () => {
59
+ try {
60
+ const granted = await PermissionsAndroid.request(
61
+ PermissionsAndroid.PERMISSIONS.CAMERA,
62
+ {
63
+ title: "Camera Permission",
64
+ message: "This app needs camera access to take photos",
65
+ buttonNeutral: "Ask Me Later",
66
+ buttonNegative: "Cancel",
67
+ buttonPositive: "OK"
68
+ }
69
+ );
70
+
71
+ if (granted === PermissionsAndroid.RESULTS.GRANTED) {
72
+ const result = await launchCamera({ mediaType: "photo" });
73
+ if (result.assets && result.assets.length > 0) {
74
+ addAttachment({
75
+ type: "image",
76
+ uri: result.assets[0].uri,
77
+ name: result.assets[0].fileName || "camera_image.jpg"
78
+ });
79
+ }
80
+ } else {
81
+ alert("Camera permission denied");
82
+ }
83
+ } catch (err) {
84
+ console.log("Camera Error:", err);
85
+ }
86
+ setIsModalVisible(false);
87
+ };
88
+
89
+ // ✅ PDF Picker (using @react-native-documents/picker)
90
+ const handlePDF = async () => {
91
+ try {
92
+ const res = await pick({ type: ["application/pdf"] });
93
+ if (res && res.length > 0) {
94
+ addAttachment({
95
+ type: "pdf",
96
+ uri: res[0].uri,
97
+ name: res[0].name || "document.pdf"
98
+ });
99
+ }
100
+ } catch (err) {
101
+ if (err.message !== "DOCUMENT_PICKER_CANCELED") {
102
+ console.log("PDF Error:", err);
103
+ }
104
+ }
105
+ setIsModalVisible(false);
106
+ };
107
+
108
+ const removeAttachment = (index) => {
109
+ setAttachments(attachments.filter((_, i) => i !== index));
110
+ };
111
+
112
+ // Calculator buttons
113
+ const buttons = [
114
+ ['AC', 'M+', 'M-', 'MR'],
115
+ ['%', '÷', 'x', '-'],
116
+ ['7', '8', '9', '+'],
117
+ ['4', '5', '6', '='],
118
+ ['1', '2', '3', '↵'],
119
+ ['0', '.']
120
+ ];
121
+
122
+ const handlePress = (key) => {
123
+ if (key === 'AC') {
124
+ setInput('');
125
+ setMemory(null);
126
+ } else if (key === 'M+') {
127
+ if (input) setMemory(Number(input));
128
+ } else if (key === 'M-') {
129
+ setMemory(null);
130
+ } else if (key === 'MR') {
131
+ if (memory !== null) setInput(prev => prev + memory.toString());
132
+ } else if (key === '=') {
133
+ try {
134
+ const expression = input
135
+ .replace(/x/g, '*')
136
+ .replace(/÷/g, '/')
137
+ .replace(/%/g, '/100');
138
+ const result = eval(expression);
139
+ setInput(result.toString());
140
+ } catch (err) {
141
+ setInput('Error');
142
+ }
143
+ } else if (key === '↵') {
144
+ Keyboard.dismiss();
145
+ } else {
146
+ setInput(prev => prev + key);
147
+ }
148
+ };
149
+
150
+ const handleBackspace = () => {
151
+ setInput(prev => prev.slice(0, -1));
152
+ };
153
+
154
+ const onChangeDate = (event, selectedDate) => {
155
+ const currentDate = selectedDate;
156
+ setDate(currentDate);
157
+ };
158
+
159
+ const onChangeTime = (event, selectedDate) => {
160
+ const currentDate = selectedDate;
161
+ setTime(currentDate);
162
+ };
163
+
164
+ const showDate = (currentMode) => {
165
+ DateTimePickerAndroid.open({
166
+ value: date,
167
+ onChange: onChangeDate,
168
+ mode: "date",
169
+ is24Hour: false,
170
+ });
171
+ };
172
+
173
+ const showTime = (currentMode) => {
174
+ DateTimePickerAndroid.open({
175
+ value: time,
176
+ onChange: onChangeTime,
177
+ mode: "time",
178
+ is24Hour: false,
179
+ });
180
+ };
181
+
182
+ const onSave = () => {
183
+ try {
184
+ let finalValue = input;
185
+
186
+ if (input) {
187
+ // Replace calculator symbols with JS operators
188
+ const expression = input
189
+ .replace(/x/g, "*")
190
+ .replace(/÷/g, "/")
191
+ .replace(/%/g, "/100");
192
+
193
+ let result = eval(expression);
194
+
195
+ // ✅ Ensure result is a valid finite number
196
+ if (typeof result === "number" && isFinite(result)) {
197
+ finalValue = result.toString();
198
+ } else {
199
+ console.log("Invalid result, not saving");
200
+ return; // stop here
201
+ }
202
+ } else {
203
+ console.log("Empty input, not saving");
204
+ return;
205
+ }
206
+
207
+ addTransaction(
208
+ ClientDetails.id,
209
+ type == "red" ? finalValue : 0,
210
+ type == "green" ? finalValue : 0,
211
+ Notes,
212
+ mergeDateTime({ date, time }),
213
+ ""
214
+ )
215
+ .then(async (res) => {
216
+ console.log(res, "Transaction Success");
217
+ const trxId = res.insertId; // ✅ new transaction ID
218
+
219
+ // If there are attachments, insert them
220
+ if (attachments && attachments.length > 0) {
221
+ for (const file of attachments) {
222
+ try {
223
+ await addTransactionImages(trxId, file.uri);
224
+ console.log(`Attachment added: ${file.name}`);
225
+ } catch (err) {
226
+ console.log("Attachment insert error:", err);
227
+ }
228
+ }
229
+ }
230
+
231
+ // ✅ Reset form
232
+ setInput("");
233
+ setMemory("");
234
+ setNotes("");
235
+ setDate(new Date());
236
+ setTime(new Date());
237
+ setMergedDate("");
238
+ setAttachments([]);
239
+ navigation?.navigate("HomeScreen", { screen: ClientDetails.type == 0 ? "Customers" : "Suppliers" });
240
+ })
241
+ .catch((err) => {
242
+ console.log(err, "Transaction Error");
243
+ });
244
+ } catch (err) {
245
+ console.log("Calculation Error:", err);
246
+ }
247
+ };
248
+
249
+
250
+
251
+
252
+
253
+ return (
254
+ <View style={Styles._mainContainers}>
255
+ <LinearGradient
256
+ start={{ x: 0, y: 0 }}
257
+ end={{ x: 1, y: 0 }}
258
+ colors={[mainColor == "green" ? "darkgreen" : "darkred", mainColor]}
259
+ style={Styles._linearGradient}
260
+ >
261
+ <View style={Styles._titleMain}>
262
+ <TouchableOpacity
263
+ activeOpacity={0.8}
264
+ onPress={() => { navigation.goBack() }}
265
+ >
266
+ <Ionicons
267
+ name={"chevron-back"}
268
+ color={COLORS.whiteColor}
269
+ size={20}
270
+ />
271
+ </TouchableOpacity>
272
+ {
273
+ ClientDetails.type == 0 ?
274
+ (<Text style={Styles._title}>You {mainColor == "green" ? "Got" : "Gave"} Rs {input} {mainColor == "green" ? "from" : "to"} {ClientDetails?.name}</Text>) :
275
+ (<Text style={Styles._title}>{mainColor == "green" ? "Purchase" : "Payment"} of Rs {input} {mainColor == "green" ? "from" : "to"} {ClientDetails?.name}</Text>)
276
+ }
277
+ </View>
278
+ </LinearGradient>
279
+
280
+ <View style={Styles._contentMain}>
281
+ <View style={{ width: "100%", alignItems: "center", gap: 12 }}>
282
+ <ScrollView
283
+ contentContainerStyle={Styles._scrollMain}
284
+ style={{ height: Platform.OS == "ios" ? 200 : Dimensions.get("screen").height - HP(74) }}
285
+ >
286
+ {/* Input with backspace */}
287
+ <View style={Styles._inputMain}>
288
+ <Text style={{ color: COLORS.blackColor, fontFamily: FONT_NORMAL, fontSize: 14, opacity: 0.6 }}>Rs</Text>
289
+ <TextInput
290
+ placeholder=''
291
+ style={[Styles._input, { color: mainColor }]}
292
+ placeholderTextColor={COLORS.grey}
293
+ cursorColor={COLORS.primaryColor}
294
+ value={input}
295
+ editable={false}
296
+ onFocus={() => Keyboard.dismiss()}
297
+ />
298
+ <TouchableOpacity onPress={handleBackspace}>
299
+ <Text style={{ fontSize: 18, color: '#555', paddingHorizontal: 8 }}>⌫</Text>
300
+ </TouchableOpacity>
301
+ </View>
302
+
303
+ {/* Memory display */}
304
+ {memory !== null && (
305
+ <View style={Styles._memoryDisplay}>
306
+ <Text style={Styles._memoryText}>Memory: {memory}</Text>
307
+ </View>
308
+ )}
309
+
310
+ {/* Attach Voice Note */}
311
+ <TouchableOpacity
312
+ style={[Styles._inputMain, { paddingHorizontal: 12 }]}
313
+ activeOpacity={0.8}
314
+ >
315
+ <Text style={{ color: mainColor, fontFamily: FONT_NORMAL, fontSize: 12 }}>Attach Voice Note</Text>
316
+ <Ionicons
317
+ name={"mic-outline"}
318
+ color={mainColor}
319
+ size={22}
320
+ />
321
+ </TouchableOpacity>
322
+ {
323
+ input &&
324
+ <View style={Styles._hidableMain}>
325
+ <View style={Styles._hidableRow}>
326
+ <TouchableOpacity
327
+ style={Styles._cellMain}
328
+ activeOpacity={0.8}
329
+ onPress={showDate}
330
+ >
331
+ <Ionicons
332
+ name={"calendar-outline"}
333
+ color={mainColor}
334
+ size={22}
335
+ />
336
+ <Text style={Styles._cellText}>{date.toDateString()}</Text>
337
+ </TouchableOpacity>
338
+
339
+ <TouchableOpacity
340
+ style={Styles._cellMain}
341
+ activeOpacity={0.8}
342
+ onPress={showTime}
343
+ >
344
+ <Ionicons
345
+ name={"time-outline"}
346
+ color={mainColor}
347
+ size={22}
348
+ />
349
+ <Text style={Styles._cellText}>{time.toLocaleTimeString()}</Text>
350
+ </TouchableOpacity>
351
+ </View>
352
+
353
+ <TextInput
354
+ style={Styles._detailMain}
355
+ placeholder='Enter Details'
356
+ placeholderTextColor={COLORS.grey}
357
+ multiline
358
+ value={Notes}
359
+ onChangeText={(text) => setNotes(text)}
360
+ />
361
+
362
+ {/* Attachments */}
363
+ <View style={Styles._hidableRow}>
364
+ <TouchableOpacity
365
+ style={Styles._cellMain}
366
+ activeOpacity={0.8}
367
+ onPress={() => setIsModalVisible(true)}
368
+ >
369
+ <Ionicons name={"attach"} color={mainColor} size={23} />
370
+ <Text style={Styles._cellText}>PDF/Photos</Text>
371
+ </TouchableOpacity>
372
+
373
+ <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center" }}>
374
+ {attachments.map((file, index) => (
375
+ <View key={index} style={{ marginLeft: 8, alignItems: "center" }}>
376
+ {file.type === "image" ? (
377
+ <Image
378
+ source={{ uri: file.uri }}
379
+ style={{ width: 40, height: 40, borderRadius: 5 }}
380
+ />
381
+ ) : (
382
+ <Ionicons name="document-text-outline" size={30} color={mainColor} />
383
+ )}
384
+ {/* delete cross */}
385
+ <TouchableOpacity
386
+ onPress={() => removeAttachment(index)}
387
+ style={{
388
+ position: "absolute",
389
+ top: -5,
390
+ right: -5,
391
+ backgroundColor: "white",
392
+ borderRadius: 10,
393
+ padding: 2
394
+ }}
395
+ >
396
+ <Ionicons name="close-circle" size={18} color={mainColor} />
397
+ </TouchableOpacity>
398
+ </View>
399
+ ))}
400
+ </View>
401
+ </View>
402
+ </View>
403
+ }
404
+ </ScrollView>
405
+
406
+ {/* Save button (non-functional) */}
407
+ <TouchableOpacity
408
+ activeOpacity={0.8}
409
+ style={[Styles._continueBtn, { backgroundColor: mainColor }]}
410
+ onPress={onSave}
411
+ >
412
+ <Text style={Styles._continueBtnTxt}>Save</Text>
413
+ </TouchableOpacity>
414
+
415
+ {/* Calculator */}
416
+ <View style={Styles._calculatorMain}>
417
+ {buttons.map((row, rowIndex) => (
418
+ <View style={Styles._calculatorRow} key={rowIndex}>
419
+ {row.map((key) => (
420
+ <TouchableOpacity
421
+ key={key}
422
+ activeOpacity={0.8}
423
+ style={[
424
+ Styles._key,
425
+ key === '0' && { flex: 2 },
426
+ (['AC', 'M+', 'M-', 'MR'].includes(key)) && { backgroundColor: '#ccc' },
427
+ (['=', '↵'].includes(key)) && { backgroundColor: COLORS.primaryColor },
428
+ (['÷', 'x', '-', '+', '%'].includes(key)) && { backgroundColor: "#ccc" }
429
+ ]}
430
+ onPress={() => handlePress(key)}
431
+ >
432
+ <Text style={Styles._keyText}>{key}</Text>
433
+ </TouchableOpacity>
434
+ ))}
435
+ </View>
436
+ ))}
437
+ </View>
438
+ </View>
439
+ </View>
440
+
441
+ {/* Modal */}
442
+ <Modal
443
+ isVisible={isModalVisible}
444
+ onBackdropPress={() => setIsModalVisible(false)}
445
+ onBackButtonPress={() => setIsModalVisible(false)}
446
+ >
447
+ <View style={{ backgroundColor: "white", padding: 20, borderRadius: 12 }}>
448
+ <Text style={{ fontSize: 16, fontFamily: FONT_MEDIUM, marginBottom: 12 }}>Choose Option</Text>
449
+
450
+ <TouchableOpacity style={Styles._modalBtn} onPress={handleGallery}>
451
+ <Ionicons name="image-outline" size={20} color="red" />
452
+ <Text style={Styles._modalText}>Gallery</Text>
453
+ </TouchableOpacity>
454
+
455
+ <TouchableOpacity style={Styles._modalBtn} onPress={handleCamera}>
456
+ <Ionicons name="camera-outline" size={20} color="red" />
457
+ <Text style={Styles._modalText}>Camera</Text>
458
+ </TouchableOpacity>
459
+
460
+ <TouchableOpacity style={Styles._modalBtn} onPress={handlePDF}>
461
+ <Ionicons name="document-outline" size={20} color="red" />
462
+ <Text style={Styles._modalText}>PDF</Text>
463
+ </TouchableOpacity>
464
+ </View>
465
+ </Modal>
466
+
467
+ </View>
468
+ )
469
+ }
470
+
471
+ const Styles = StyleSheet.create({
472
+ _mainContainers: {
473
+ flex: 1,
474
+ backgroundColor: COLORS.backgroundColor,
475
+ alignItems: "center"
476
+ },
477
+ _linearGradient: {
478
+ width: WP(100),
479
+ height: 80,
480
+ alignItems: "center",
481
+ },
482
+ _titleMain: {
483
+ width: WP(94),
484
+ height: 30,
485
+ flexDirection: "row",
486
+ alignItems: "center",
487
+ marginTop: 10
488
+ },
489
+ _title: {
490
+ color: COLORS.whiteColor,
491
+ fontFamily: FONT_NORMAL,
492
+ fontSize: 15,
493
+ marginLeft: 15
494
+ },
495
+ _contentMain: {
496
+ width: WP(94),
497
+ height: "95%",
498
+ backgroundColor: COLORS.whiteColor,
499
+ position: "absolute",
500
+ top: 50,
501
+ shadowColor: "#000",
502
+ shadowOffset: { width: 0, height: 2 },
503
+ shadowOpacity: 0.2,
504
+ shadowRadius: 3.84,
505
+ elevation: 5,
506
+ borderRadius: 10,
507
+ alignItems: "center",
508
+ justifyContent: "space-between",
509
+ paddingVertical: 12,
510
+ },
511
+ _input: {
512
+ flex: 1,
513
+ height: "100%",
514
+ fontFamily: FONT_MEDIUM,
515
+ fontSize: 15,
516
+ color: "red",
517
+ paddingLeft: 13,
518
+ },
519
+ _inputMain: {
520
+ width: "95%",
521
+ height: 50,
522
+ flexDirection: "row",
523
+ borderColor: COLORS.grey,
524
+ borderWidth: 1,
525
+ borderRadius: 15,
526
+ justifyContent: "space-between",
527
+ alignItems: "center",
528
+ paddingHorizontal: 12,
529
+ backgroundColor: COLORS.whiteColor
530
+ },
531
+ _memoryDisplay: {
532
+ width: WP(85),
533
+ height: 50,
534
+ alignItems: "flex-start",
535
+ justifyContent: "center",
536
+ paddingLeft: 12,
537
+ // paddingVertical: 4,
538
+ backfaceVisibility: COLORS.whiteColor,
539
+ borderColor: COLORS.grey,
540
+ borderWidth: 1,
541
+ borderRadius: 15,
542
+ },
543
+ _memoryText: {
544
+ fontSize: 12,
545
+ fontFamily: FONT_NORMAL,
546
+ color: '#333'
547
+ },
548
+ _continueBtn: {
549
+ width: "95%",
550
+ height: 50,
551
+ backgroundColor: "red",
552
+ borderRadius: 100,
553
+ justifyContent: "center",
554
+ alignItems: "center",
555
+ },
556
+ _continueBtnTxt: {
557
+ color: COLORS.whiteColor,
558
+ fontFamily: FONT_NORMAL,
559
+ fontSize: 17
560
+ },
561
+ _calculatorMain: {
562
+ width: "95%",
563
+ // height: 350,
564
+ // backgroundColor: "red"
565
+ },
566
+ _calculatorRow: {
567
+ flexDirection: 'row',
568
+ justifyContent: 'space-between',
569
+ // marginBottom: 3
570
+ },
571
+ _key: {
572
+ flex: 1,
573
+ margin: 5,
574
+ backgroundColor: COLORS.whiteColor,
575
+ paddingVertical: 10,
576
+ alignItems: 'center',
577
+ justifyContent: 'center',
578
+ borderRadius: 8,
579
+ marginHorizontal: 10,
580
+ shadowColor: "#000",
581
+ shadowOffset: {
582
+ width: 0,
583
+ height: 2,
584
+ },
585
+ shadowOpacity: 0.2,
586
+ shadowRadius: 3.84,
587
+ elevation: 5,
588
+ },
589
+ _keyText: {
590
+ fontSize: 15,
591
+ color: COLORS.blackColor,
592
+ fontFamily: FONT_MEDIUM
593
+ },
594
+ _scrollMain: {
595
+ width: "95%",
596
+ alignItems: "center",
597
+ gap: 12,
598
+ // backgroundColor: "green",
599
+ // maxHeight: Platform.OS == "ios" ? 200 : 250,
600
+ },
601
+ _hidableMain: {
602
+ width: WP(94),
603
+ height: 300,
604
+ // backgroundColor: "green",
605
+ alignItems: "center",
606
+ gap: 12
607
+ },
608
+ _hidableRow: {
609
+ width: "95%",
610
+ // height:30,
611
+ // backgroundColor: "red",
612
+ flexDirection: "row",
613
+ justifyContent: "space-between",
614
+ alignItems: "center",
615
+ paddingHorizontal: 9
616
+ },
617
+ _cellMain: {
618
+ width: "48%",
619
+ height: 50,
620
+ // backgroundColor: "pink",
621
+ borderColor: COLORS.grey,
622
+ borderWidth: 1,
623
+ borderRadius: 15,
624
+ flexDirection: "row",
625
+ justifyContent: "space-between",
626
+ alignItems: "center",
627
+ paddingHorizontal: WP(4)
628
+ },
629
+ _cellText: {
630
+ color: COLORS.blackColor,
631
+ fontFamily: FONT_NORMAL,
632
+ fontSize: 10,
633
+ },
634
+ _detailMain: {
635
+ minHeight: 50,
636
+ width: "91%",
637
+ borderColor: COLORS.grey,
638
+ borderWidth: 1,
639
+ borderRadius: 15,
640
+ paddingHorizontal: 15,
641
+ color: COLORS.blackColor,
642
+ fontFamily: FONT_NORMAL,
643
+ fontSize: 13
644
+ },
645
+ _modalBtn: {
646
+ flexDirection: "row",
647
+ alignItems: "center",
648
+ paddingVertical: 12,
649
+ borderBottomColor: "#eee",
650
+ borderBottomWidth: 1
651
+ },
652
+ _modalText: {
653
+ marginLeft: 10,
654
+ fontSize: 14,
655
+ fontFamily: FONT_NORMAL,
656
+ color: COLORS.blackColor
657
+ }
658
+ })