digikhata-mashreq-sdk 0.1.1 → 1.1.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 (719) hide show
  1. package/README.md +8 -2
  2. package/lib/module/App.js +13 -26
  3. package/lib/module/App.js.map +1 -1
  4. package/lib/module/app/api/api.js +12 -0
  5. package/lib/module/app/api/api.js.map +1 -0
  6. package/lib/module/app/assets/Icons/Bill.png +0 -0
  7. package/lib/module/app/assets/Icons/Bill_Grey.png +0 -0
  8. package/lib/module/app/assets/Icons/Cash.png +0 -0
  9. package/lib/module/app/assets/Icons/Cash_Grey.png +0 -0
  10. package/lib/module/app/assets/Icons/Expense.png +0 -0
  11. package/lib/module/app/assets/Icons/Expense_Grey.png +0 -0
  12. package/lib/module/app/assets/Icons/Staff.png +0 -0
  13. package/lib/module/app/assets/Icons/Stock.png +0 -0
  14. package/lib/module/app/assets/Icons/Stock_Grey.png +0 -0
  15. package/lib/module/app/assets/Icons/abc.png +0 -0
  16. package/lib/module/app/assets/Icons/bank_logo.png +0 -0
  17. package/lib/module/app/assets/Icons/download_sale.png +0 -0
  18. package/lib/module/app/assets/Icons/recycle-bin.png +0 -0
  19. package/lib/module/app/assets/animations/recording.json +1 -0
  20. package/lib/module/app/assets/animations/success.json +1 -0
  21. package/lib/module/app/assets/animations/voice_visualization.json +1 -0
  22. package/lib/module/app/assets/businessCards/card_11.png +0 -0
  23. package/lib/module/app/assets/businessCards/card_12_bg.png +0 -0
  24. package/lib/module/app/assets/businessCards/card_wall_01.jpeg +0 -0
  25. package/lib/module/app/assets/businessCards/card_wall_02.jpeg +0 -0
  26. package/lib/module/app/assets/businessCards/card_wall_03.jpeg +0 -0
  27. package/lib/module/app/assets/businessCards/card_wall_04.jpeg +0 -0
  28. package/lib/module/app/assets/businessCards/card_wall_05.jpeg +0 -0
  29. package/lib/module/app/assets/businessCards/card_wall_06.jpeg +0 -0
  30. package/lib/module/app/assets/businessCards/card_wall_07.jpeg +0 -0
  31. package/lib/module/app/assets/businessCards/card_wall_08.jpeg +0 -0
  32. package/lib/module/app/assets/illustrations/empty.png +0 -0
  33. package/lib/module/app/assets/illustrations/packages.png +0 -0
  34. package/lib/module/app/assets/images/Digikhata_idzarHgH0q_0.png +0 -0
  35. package/lib/module/app/assets/images/bank.png +0 -0
  36. package/lib/module/app/assets/images/digiLogo-main.png +0 -0
  37. package/lib/module/app/assets/images/svgviewer-output.svg +57 -0
  38. package/lib/module/app/assets/images/user.png +0 -0
  39. package/lib/module/app/assets/oldIcons/BILL.svg +3 -0
  40. package/lib/module/app/assets/oldIcons/CASH.svg +4 -0
  41. package/lib/module/app/assets/oldIcons/EXPENSE.svg +6 -0
  42. package/lib/module/app/assets/oldIcons/STAFF.svg +3 -0
  43. package/lib/module/app/assets/oldIcons/Sale Active.svg +14 -0
  44. package/lib/module/app/assets/oldIcons/Stock.svg +5 -0
  45. package/lib/module/app/assets/svg/BILL.svg +4 -0
  46. package/lib/module/app/assets/svg/CASH.svg +6 -0
  47. package/lib/module/app/assets/svg/EXPENSE.svg +5 -0
  48. package/lib/module/app/assets/svg/More Icon.svg +6 -0
  49. package/lib/module/app/assets/svg/Payment Icon.svg +4 -0
  50. package/lib/module/app/assets/svg/Pos.svg +13 -0
  51. package/lib/module/app/assets/svg/STAFF.svg +5 -0
  52. package/lib/module/app/assets/svg/Sale Active.svg +8 -0
  53. package/lib/module/app/assets/svg/Sale Icon.svg +3 -0
  54. package/lib/module/app/assets/svg/Stock.svg +5 -0
  55. package/lib/module/app/components/AccountSetupSteps.js +64 -0
  56. package/lib/module/app/components/AccountSetupSteps.js.map +1 -0
  57. package/lib/module/app/components/AddItemBillParent.js +366 -0
  58. package/lib/module/app/components/AddItemBillParent.js.map +1 -0
  59. package/lib/module/app/components/AdditemBillChild.js +1123 -0
  60. package/lib/module/app/components/AdditemBillChild.js.map +1 -0
  61. package/lib/module/app/components/Balance.js +116 -70
  62. package/lib/module/app/components/Balance.js.map +1 -1
  63. package/lib/module/app/components/BillList.js +428 -0
  64. package/lib/module/app/components/BillList.js.map +1 -0
  65. package/lib/module/app/components/BillSetupSteps.js +64 -0
  66. package/lib/module/app/components/BillSetupSteps.js.map +1 -0
  67. package/lib/module/app/components/BottomView.js +35 -0
  68. package/lib/module/app/components/BottomView.js.map +1 -0
  69. package/lib/module/app/components/BusinessCards/Card1.js +202 -0
  70. package/lib/module/app/components/BusinessCards/Card1.js.map +1 -0
  71. package/lib/module/app/components/BusinessCards/Card10.js +234 -0
  72. package/lib/module/app/components/BusinessCards/Card10.js.map +1 -0
  73. package/lib/module/app/components/BusinessCards/Card2.js +190 -0
  74. package/lib/module/app/components/BusinessCards/Card2.js.map +1 -0
  75. package/lib/module/app/components/BusinessCards/Card3.js +186 -0
  76. package/lib/module/app/components/BusinessCards/Card3.js.map +1 -0
  77. package/lib/module/app/components/BusinessCards/Card4.js +186 -0
  78. package/lib/module/app/components/BusinessCards/Card4.js.map +1 -0
  79. package/lib/module/app/components/BusinessCards/Card5.js +189 -0
  80. package/lib/module/app/components/BusinessCards/Card5.js.map +1 -0
  81. package/lib/module/app/components/BusinessCards/Card6.js +198 -0
  82. package/lib/module/app/components/BusinessCards/Card6.js.map +1 -0
  83. package/lib/module/app/components/BusinessCards/Card7.js +185 -0
  84. package/lib/module/app/components/BusinessCards/Card7.js.map +1 -0
  85. package/lib/module/app/components/BusinessCards/Card8.js +187 -0
  86. package/lib/module/app/components/BusinessCards/Card8.js.map +1 -0
  87. package/lib/module/app/components/BusinessCards/Card9.js +234 -0
  88. package/lib/module/app/components/BusinessCards/Card9.js.map +1 -0
  89. package/lib/module/app/components/BusinessCards/index.js +13 -0
  90. package/lib/module/app/components/BusinessCards/index.js.map +1 -0
  91. package/lib/module/app/components/CashEntryComponent.js +256 -0
  92. package/lib/module/app/components/CashEntryComponent.js.map +1 -0
  93. package/lib/module/app/components/CityModal.js +116 -0
  94. package/lib/module/app/components/CityModal.js.map +1 -0
  95. package/lib/module/app/components/CountryPhoneInput.js +263 -166
  96. package/lib/module/app/components/CountryPhoneInput.js.map +1 -1
  97. package/lib/module/app/components/CreateExpenseAccount.js +139 -0
  98. package/lib/module/app/components/CreateExpenseAccount.js.map +1 -0
  99. package/lib/module/app/components/CustomStatusBar.js +29 -0
  100. package/lib/module/app/components/CustomStatusBar.js.map +1 -0
  101. package/lib/module/app/components/CustomToast.js +135 -0
  102. package/lib/module/app/components/CustomToast.js.map +1 -0
  103. package/lib/module/app/components/DeleteBusinessModal.js +174 -0
  104. package/lib/module/app/components/DeleteBusinessModal.js.map +1 -0
  105. package/lib/module/app/components/DiscountTaxModal.js +242 -0
  106. package/lib/module/app/components/DiscountTaxModal.js.map +1 -0
  107. package/lib/module/app/components/Entries.js +54 -32
  108. package/lib/module/app/components/Entries.js.map +1 -1
  109. package/lib/module/app/components/ExpenseList.js +402 -0
  110. package/lib/module/app/components/ExpenseList.js.map +1 -0
  111. package/lib/module/app/components/ExpenseParent.js +441 -0
  112. package/lib/module/app/components/ExpenseParent.js.map +1 -0
  113. package/lib/module/app/components/FloatingInput.js +159 -0
  114. package/lib/module/app/components/FloatingInput.js.map +1 -0
  115. package/lib/module/app/components/Header.js +107 -0
  116. package/lib/module/app/components/Header.js.map +1 -0
  117. package/lib/module/app/components/Loader.js +45 -0
  118. package/lib/module/app/components/Loader.js.map +1 -0
  119. package/lib/module/app/components/PartyModal.js +230 -0
  120. package/lib/module/app/components/PartyModal.js.map +1 -0
  121. package/lib/module/app/components/PickerModal.js +153 -0
  122. package/lib/module/app/components/PickerModal.js.map +1 -0
  123. package/lib/module/app/components/SalePaymentModal.js +743 -0
  124. package/lib/module/app/components/SalePaymentModal.js.map +1 -0
  125. package/lib/module/app/components/SearchBar.js +179 -42
  126. package/lib/module/app/components/SearchBar.js.map +1 -1
  127. package/lib/module/app/components/StockDetailChild.js +425 -0
  128. package/lib/module/app/components/StockDetailChild.js.map +1 -0
  129. package/lib/module/app/components/StockList.js +448 -0
  130. package/lib/module/app/components/StockList.js.map +1 -0
  131. package/lib/module/app/components/StockReportTransaction.js +182 -0
  132. package/lib/module/app/components/StockReportTransaction.js.map +1 -0
  133. package/lib/module/app/components/Transaction.js +193 -53
  134. package/lib/module/app/components/Transaction.js.map +1 -1
  135. package/lib/module/app/components/User.js +106 -51
  136. package/lib/module/app/components/User.js.map +1 -1
  137. package/lib/module/app/components/index.js +20 -1
  138. package/lib/module/app/components/index.js.map +1 -1
  139. package/lib/module/app/database/bill.js +247 -0
  140. package/lib/module/app/database/bill.js.map +1 -0
  141. package/lib/module/app/database/business.js +262 -0
  142. package/lib/module/app/database/business.js.map +1 -0
  143. package/lib/module/app/database/cash.js +299 -0
  144. package/lib/module/app/database/cash.js.map +1 -0
  145. package/lib/module/app/database/clients.js +1182 -36
  146. package/lib/module/app/database/clients.js.map +1 -1
  147. package/lib/module/app/database/expense.js +299 -0
  148. package/lib/module/app/database/expense.js.map +1 -0
  149. package/lib/module/app/database/schema.js +113 -3
  150. package/lib/module/app/database/schema.js.map +1 -1
  151. package/lib/module/app/database/stock.js +509 -0
  152. package/lib/module/app/database/stock.js.map +1 -0
  153. package/lib/module/app/htmlTemplates/htmlTemplates.js +2504 -0
  154. package/lib/module/app/htmlTemplates/htmlTemplates.js.map +1 -0
  155. package/lib/module/app/navigation/BillStack/BillStack.js +40 -0
  156. package/lib/module/app/navigation/BillStack/BillStack.js.map +1 -0
  157. package/lib/module/app/navigation/BottomTabs/BottomTabs.js +10 -5
  158. package/lib/module/app/navigation/BottomTabs/BottomTabs.js.map +1 -1
  159. package/lib/module/app/navigation/BusinessStack/BusinessStack.js +30 -0
  160. package/lib/module/app/navigation/BusinessStack/BusinessStack.js.map +1 -0
  161. package/lib/module/app/navigation/CashStack/CashStack.js +79 -0
  162. package/lib/module/app/navigation/CashStack/CashStack.js.map +1 -0
  163. package/lib/module/app/navigation/EntriesStack/EntriesStack.js +223 -0
  164. package/lib/module/app/navigation/EntriesStack/EntriesStack.js.map +1 -0
  165. package/lib/module/app/navigation/ExpenseStack.js/ExpenseStack.js +37 -0
  166. package/lib/module/app/navigation/ExpenseStack.js/ExpenseStack.js.map +1 -0
  167. package/lib/module/app/navigation/HomeStack/HomeStack.js +93 -1
  168. package/lib/module/app/navigation/HomeStack/HomeStack.js.map +1 -1
  169. package/lib/module/app/navigation/Root.js +10 -1
  170. package/lib/module/app/navigation/Root.js.map +1 -1
  171. package/lib/module/app/navigation/SaleStack/SaleStack.js +73 -0
  172. package/lib/module/app/navigation/SaleStack/SaleStack.js.map +1 -0
  173. package/lib/module/app/navigation/StockStack/StockStack.js +49 -0
  174. package/lib/module/app/navigation/StockStack/StockStack.js.map +1 -0
  175. package/lib/module/app/navigation/index.js +3 -1
  176. package/lib/module/app/navigation/index.js.map +1 -1
  177. package/lib/module/app/redux/Store.js +3 -1
  178. package/lib/module/app/redux/Store.js.map +1 -1
  179. package/lib/module/app/redux/reducers/client/client_reducers.js +23 -2
  180. package/lib/module/app/redux/reducers/client/client_reducers.js.map +1 -1
  181. package/lib/module/app/redux/reducers/client/client_types.js +5 -0
  182. package/lib/module/app/redux/reducers/client/client_types.js.map +1 -1
  183. package/lib/module/app/redux/reducers/user/user_reducers.js +22 -0
  184. package/lib/module/app/redux/reducers/user/user_reducers.js.map +1 -0
  185. package/lib/module/app/redux/reducers/user/user_types.js +6 -0
  186. package/lib/module/app/redux/reducers/user/user_types.js.map +1 -0
  187. package/lib/module/app/screens/AddBank.js +237 -0
  188. package/lib/module/app/screens/AddBank.js.map +1 -0
  189. package/lib/module/app/screens/AddBusiness.js +905 -0
  190. package/lib/module/app/screens/AddBusiness.js.map +1 -0
  191. package/lib/module/app/screens/AddItems.js +433 -0
  192. package/lib/module/app/screens/AddItems.js.map +1 -0
  193. package/lib/module/app/screens/AddScreen.js +341 -77
  194. package/lib/module/app/screens/AddScreen.js.map +1 -1
  195. package/lib/module/app/screens/All.js +836 -0
  196. package/lib/module/app/screens/All.js.map +1 -0
  197. package/lib/module/app/screens/AllTransactions.js +846 -0
  198. package/lib/module/app/screens/AllTransactions.js.map +1 -0
  199. package/lib/module/app/screens/Banks.js +807 -48
  200. package/lib/module/app/screens/Banks.js.map +1 -1
  201. package/lib/module/app/screens/BillDetails.js +1033 -0
  202. package/lib/module/app/screens/BillDetails.js.map +1 -0
  203. package/lib/module/app/screens/BillHome.js +102 -0
  204. package/lib/module/app/screens/BillHome.js.map +1 -0
  205. package/lib/module/app/screens/BillParent.js +373 -0
  206. package/lib/module/app/screens/BillParent.js.map +1 -0
  207. package/lib/module/app/screens/BusinessDetail.js +787 -0
  208. package/lib/module/app/screens/BusinessDetail.js.map +1 -0
  209. package/lib/module/app/screens/CashEntry.js +2429 -0
  210. package/lib/module/app/screens/CashEntry.js.map +1 -0
  211. package/lib/module/app/screens/CashEntryDetails.js +574 -0
  212. package/lib/module/app/screens/CashEntryDetails.js.map +1 -0
  213. package/lib/module/app/screens/CashHome.js +544 -0
  214. package/lib/module/app/screens/CashHome.js.map +1 -0
  215. package/lib/module/app/screens/CashReport.js +1297 -0
  216. package/lib/module/app/screens/CashReport.js.map +1 -0
  217. package/lib/module/app/screens/CashSummary.js +602 -0
  218. package/lib/module/app/screens/CashSummary.js.map +1 -0
  219. package/lib/module/app/screens/CreateBill.js +2137 -0
  220. package/lib/module/app/screens/CreateBill.js.map +1 -0
  221. package/lib/module/app/screens/CustomerEntries.js +1093 -184
  222. package/lib/module/app/screens/CustomerEntries.js.map +1 -1
  223. package/lib/module/app/screens/Customers.js +727 -96
  224. package/lib/module/app/screens/Customers.js.map +1 -1
  225. package/lib/module/app/screens/EditCategory.js +299 -0
  226. package/lib/module/app/screens/EditCategory.js.map +1 -0
  227. package/lib/module/app/screens/EditCategoryStock.js +302 -0
  228. package/lib/module/app/screens/EditCategoryStock.js.map +1 -0
  229. package/lib/module/app/screens/Entry.js +1838 -275
  230. package/lib/module/app/screens/Entry.js.map +1 -1
  231. package/lib/module/app/screens/ExpenseDetail.js +15 -0
  232. package/lib/module/app/screens/ExpenseDetail.js.map +1 -0
  233. package/lib/module/app/screens/ExpenseEntries.js +713 -0
  234. package/lib/module/app/screens/ExpenseEntries.js.map +1 -0
  235. package/lib/module/app/screens/ExpenseEntry.js +2095 -0
  236. package/lib/module/app/screens/ExpenseEntry.js.map +1 -0
  237. package/lib/module/app/screens/ExpenseEntryDetails.js +508 -0
  238. package/lib/module/app/screens/ExpenseEntryDetails.js.map +1 -0
  239. package/lib/module/app/screens/ExpenseEntryReport.js +792 -0
  240. package/lib/module/app/screens/ExpenseEntryReport.js.map +1 -0
  241. package/lib/module/app/screens/ExpenseReport.js +792 -0
  242. package/lib/module/app/screens/ExpenseReport.js.map +1 -0
  243. package/lib/module/app/screens/Geolocation.js +374 -0
  244. package/lib/module/app/screens/Geolocation.js.map +1 -0
  245. package/lib/module/app/screens/GetStarted.js +213 -0
  246. package/lib/module/app/screens/GetStarted.js.map +1 -0
  247. package/lib/module/app/screens/HomeScreen.js +202 -55
  248. package/lib/module/app/screens/HomeScreen.js.map +1 -1
  249. package/lib/module/app/screens/InBuy.js +854 -0
  250. package/lib/module/app/screens/InBuy.js.map +1 -0
  251. package/lib/module/app/screens/ItemEntryDetails.js +652 -0
  252. package/lib/module/app/screens/ItemEntryDetails.js.map +1 -0
  253. package/lib/module/app/screens/LowStock.js +372 -0
  254. package/lib/module/app/screens/LowStock.js.map +1 -0
  255. package/lib/module/app/screens/NewPin.js +234 -0
  256. package/lib/module/app/screens/NewPin.js.map +1 -0
  257. package/lib/module/app/screens/OutSell.js +1883 -0
  258. package/lib/module/app/screens/OutSell.js.map +1 -0
  259. package/lib/module/app/screens/POSSale.js +637 -0
  260. package/lib/module/app/screens/POSSale.js.map +1 -0
  261. package/lib/module/app/screens/PinScreen.js +663 -0
  262. package/lib/module/app/screens/PinScreen.js.map +1 -0
  263. package/lib/module/app/screens/PreviewBill.js +329 -0
  264. package/lib/module/app/screens/PreviewBill.js.map +1 -0
  265. package/lib/module/app/screens/Profile.js +1160 -0
  266. package/lib/module/app/screens/Profile.js.map +1 -0
  267. package/lib/module/app/screens/RateList.js +432 -0
  268. package/lib/module/app/screens/RateList.js.map +1 -0
  269. package/lib/module/app/screens/Report.js +1105 -0
  270. package/lib/module/app/screens/Report.js.map +1 -0
  271. package/lib/module/app/screens/SaleItemDetail.js +1047 -0
  272. package/lib/module/app/screens/SaleItemDetail.js.map +1 -0
  273. package/lib/module/app/screens/SaleParent.js +289 -0
  274. package/lib/module/app/screens/SaleParent.js.map +1 -0
  275. package/lib/module/app/screens/SelectBank.js +220 -0
  276. package/lib/module/app/screens/SelectBank.js.map +1 -0
  277. package/lib/module/app/screens/SelectBusiness.js +497 -93
  278. package/lib/module/app/screens/SelectBusiness.js.map +1 -1
  279. package/lib/module/app/screens/Splash.js +93 -20
  280. package/lib/module/app/screens/Splash.js.map +1 -1
  281. package/lib/module/app/screens/StockChild.js +362 -0
  282. package/lib/module/app/screens/StockChild.js.map +1 -0
  283. package/lib/module/app/screens/StockDetail.js +705 -0
  284. package/lib/module/app/screens/StockDetail.js.map +1 -0
  285. package/lib/module/app/screens/StockParent.js +260 -0
  286. package/lib/module/app/screens/StockParent.js.map +1 -0
  287. package/lib/module/app/screens/StockReport.js +1031 -0
  288. package/lib/module/app/screens/StockReport.js.map +1 -0
  289. package/lib/module/app/screens/StockValue.js +545 -0
  290. package/lib/module/app/screens/StockValue.js.map +1 -0
  291. package/lib/module/app/screens/Suppliers.js +753 -98
  292. package/lib/module/app/screens/Suppliers.js.map +1 -1
  293. package/lib/module/app/screens/TransactionDetails.js +1169 -81
  294. package/lib/module/app/screens/TransactionDetails.js.map +1 -1
  295. package/lib/module/app/screens/UpdateBusiness.js +707 -0
  296. package/lib/module/app/screens/UpdateBusiness.js.map +1 -0
  297. package/lib/module/app/screens/VisionCamera.js +60 -0
  298. package/lib/module/app/screens/VisionCamera.js.map +1 -0
  299. package/lib/module/app/screens/index.js +46 -1
  300. package/lib/module/app/screens/index.js.map +1 -1
  301. package/lib/module/app/screens/new.html +171 -0
  302. package/lib/module/app/themes/config.js +299 -30
  303. package/lib/module/app/themes/config.js.map +1 -1
  304. package/lib/module/app/utils/city.json +7265 -0
  305. package/lib/typescript/eslint.config.d.mts +1 -1
  306. package/lib/typescript/src/App.d.ts.map +1 -1
  307. package/lib/typescript/src/app/api/api.d.ts +10 -0
  308. package/lib/typescript/src/app/api/api.d.ts.map +1 -0
  309. package/lib/typescript/src/app/components/AccountSetupSteps.d.ts +3 -0
  310. package/lib/typescript/src/app/components/AccountSetupSteps.d.ts.map +1 -0
  311. package/lib/typescript/src/app/components/AddItemBillParent.d.ts +5 -0
  312. package/lib/typescript/src/app/components/AddItemBillParent.d.ts.map +1 -0
  313. package/lib/typescript/src/app/components/AdditemBillChild.d.ts +6 -0
  314. package/lib/typescript/src/app/components/AdditemBillChild.d.ts.map +1 -0
  315. package/lib/typescript/src/app/components/Balance.d.ts +3 -1
  316. package/lib/typescript/src/app/components/Balance.d.ts.map +1 -1
  317. package/lib/typescript/src/app/components/BillList.d.ts +5 -0
  318. package/lib/typescript/src/app/components/BillList.d.ts.map +1 -0
  319. package/lib/typescript/src/app/components/BillSetupSteps.d.ts +3 -0
  320. package/lib/typescript/src/app/components/BillSetupSteps.d.ts.map +1 -0
  321. package/lib/typescript/src/app/components/BottomView.d.ts +6 -0
  322. package/lib/typescript/src/app/components/BottomView.d.ts.map +1 -0
  323. package/lib/typescript/src/app/components/BusinessCards/Card1.d.ts +14 -0
  324. package/lib/typescript/src/app/components/BusinessCards/Card1.d.ts.map +1 -0
  325. package/lib/typescript/src/app/components/BusinessCards/Card10.d.ts +14 -0
  326. package/lib/typescript/src/app/components/BusinessCards/Card10.d.ts.map +1 -0
  327. package/lib/typescript/src/app/components/BusinessCards/Card2.d.ts +14 -0
  328. package/lib/typescript/src/app/components/BusinessCards/Card2.d.ts.map +1 -0
  329. package/lib/typescript/src/app/components/BusinessCards/Card3.d.ts +14 -0
  330. package/lib/typescript/src/app/components/BusinessCards/Card3.d.ts.map +1 -0
  331. package/lib/typescript/src/app/components/BusinessCards/Card4.d.ts +14 -0
  332. package/lib/typescript/src/app/components/BusinessCards/Card4.d.ts.map +1 -0
  333. package/lib/typescript/src/app/components/BusinessCards/Card5.d.ts +14 -0
  334. package/lib/typescript/src/app/components/BusinessCards/Card5.d.ts.map +1 -0
  335. package/lib/typescript/src/app/components/BusinessCards/Card6.d.ts +14 -0
  336. package/lib/typescript/src/app/components/BusinessCards/Card6.d.ts.map +1 -0
  337. package/lib/typescript/src/app/components/BusinessCards/Card7.d.ts +14 -0
  338. package/lib/typescript/src/app/components/BusinessCards/Card7.d.ts.map +1 -0
  339. package/lib/typescript/src/app/components/BusinessCards/Card8.d.ts +14 -0
  340. package/lib/typescript/src/app/components/BusinessCards/Card8.d.ts.map +1 -0
  341. package/lib/typescript/src/app/components/BusinessCards/Card9.d.ts +14 -0
  342. package/lib/typescript/src/app/components/BusinessCards/Card9.d.ts.map +1 -0
  343. package/lib/typescript/src/app/components/BusinessCards/index.d.ts +11 -0
  344. package/lib/typescript/src/app/components/BusinessCards/index.d.ts.map +1 -0
  345. package/lib/typescript/src/app/components/CashEntryComponent.d.ts +8 -0
  346. package/lib/typescript/src/app/components/CashEntryComponent.d.ts.map +1 -0
  347. package/lib/typescript/src/app/components/CityModal.d.ts +7 -0
  348. package/lib/typescript/src/app/components/CityModal.d.ts.map +1 -0
  349. package/lib/typescript/src/app/components/CountryPhoneInput.d.ts +4 -1
  350. package/lib/typescript/src/app/components/CountryPhoneInput.d.ts.map +1 -1
  351. package/lib/typescript/src/app/components/CreateExpenseAccount.d.ts +9 -0
  352. package/lib/typescript/src/app/components/CreateExpenseAccount.d.ts.map +1 -0
  353. package/lib/typescript/src/app/components/CustomStatusBar.d.ts +3 -0
  354. package/lib/typescript/src/app/components/CustomStatusBar.d.ts.map +1 -0
  355. package/lib/typescript/src/app/components/CustomToast.d.ts +10 -0
  356. package/lib/typescript/src/app/components/CustomToast.d.ts.map +1 -0
  357. package/lib/typescript/src/app/components/DeleteBusinessModal.d.ts +8 -0
  358. package/lib/typescript/src/app/components/DeleteBusinessModal.d.ts.map +1 -0
  359. package/lib/typescript/src/app/components/DiscountTaxModal.d.ts +9 -0
  360. package/lib/typescript/src/app/components/DiscountTaxModal.d.ts.map +1 -0
  361. package/lib/typescript/src/app/components/Entries.d.ts.map +1 -1
  362. package/lib/typescript/src/app/components/ExpenseList.d.ts +6 -0
  363. package/lib/typescript/src/app/components/ExpenseList.d.ts.map +1 -0
  364. package/lib/typescript/src/app/components/ExpenseParent.d.ts +4 -0
  365. package/lib/typescript/src/app/components/ExpenseParent.d.ts.map +1 -0
  366. package/lib/typescript/src/app/components/FloatingInput.d.ts +18 -0
  367. package/lib/typescript/src/app/components/FloatingInput.d.ts.map +1 -0
  368. package/lib/typescript/src/app/components/Header.d.ts +11 -0
  369. package/lib/typescript/src/app/components/Header.d.ts.map +1 -0
  370. package/lib/typescript/src/app/components/Loader.d.ts +5 -0
  371. package/lib/typescript/src/app/components/Loader.d.ts.map +1 -0
  372. package/lib/typescript/src/app/components/PartyModal.d.ts +7 -0
  373. package/lib/typescript/src/app/components/PartyModal.d.ts.map +1 -0
  374. package/lib/typescript/src/app/components/PickerModal.d.ts +8 -0
  375. package/lib/typescript/src/app/components/PickerModal.d.ts.map +1 -0
  376. package/lib/typescript/src/app/components/SalePaymentModal.d.ts +15 -0
  377. package/lib/typescript/src/app/components/SalePaymentModal.d.ts.map +1 -0
  378. package/lib/typescript/src/app/components/SearchBar.d.ts +2 -4
  379. package/lib/typescript/src/app/components/SearchBar.d.ts.map +1 -1
  380. package/lib/typescript/src/app/components/StockDetailChild.d.ts +5 -0
  381. package/lib/typescript/src/app/components/StockDetailChild.d.ts.map +1 -0
  382. package/lib/typescript/src/app/components/StockList.d.ts +6 -0
  383. package/lib/typescript/src/app/components/StockList.d.ts.map +1 -0
  384. package/lib/typescript/src/app/components/StockReportTransaction.d.ts +18 -0
  385. package/lib/typescript/src/app/components/StockReportTransaction.d.ts.map +1 -0
  386. package/lib/typescript/src/app/components/Transaction.d.ts +9 -2
  387. package/lib/typescript/src/app/components/Transaction.d.ts.map +1 -1
  388. package/lib/typescript/src/app/components/User.d.ts +3 -1
  389. package/lib/typescript/src/app/components/User.d.ts.map +1 -1
  390. package/lib/typescript/src/app/components/index.d.ts +26 -7
  391. package/lib/typescript/src/app/components/index.d.ts.map +1 -1
  392. package/lib/typescript/src/app/database/bill.d.ts +7 -0
  393. package/lib/typescript/src/app/database/bill.d.ts.map +1 -0
  394. package/lib/typescript/src/app/database/business.d.ts +9 -0
  395. package/lib/typescript/src/app/database/business.d.ts.map +1 -0
  396. package/lib/typescript/src/app/database/cash.d.ts +14 -0
  397. package/lib/typescript/src/app/database/cash.d.ts.map +1 -0
  398. package/lib/typescript/src/app/database/clients.d.ts +36 -5
  399. package/lib/typescript/src/app/database/clients.d.ts.map +1 -1
  400. package/lib/typescript/src/app/database/expense.d.ts +12 -0
  401. package/lib/typescript/src/app/database/expense.d.ts.map +1 -0
  402. package/lib/typescript/src/app/database/schema.d.ts.map +1 -1
  403. package/lib/typescript/src/app/database/stock.d.ts +16 -0
  404. package/lib/typescript/src/app/database/stock.d.ts.map +1 -0
  405. package/lib/typescript/src/app/htmlTemplates/htmlTemplates.d.ts +29 -0
  406. package/lib/typescript/src/app/htmlTemplates/htmlTemplates.d.ts.map +1 -0
  407. package/lib/typescript/src/app/navigation/BillStack/BillStack.d.ts +2 -0
  408. package/lib/typescript/src/app/navigation/BillStack/BillStack.d.ts.map +1 -0
  409. package/lib/typescript/src/app/navigation/BottomTabs/BottomTabs.d.ts.map +1 -1
  410. package/lib/typescript/src/app/navigation/BusinessStack/BusinessStack.d.ts +2 -0
  411. package/lib/typescript/src/app/navigation/BusinessStack/BusinessStack.d.ts.map +1 -0
  412. package/lib/typescript/src/app/navigation/CashStack/CashStack.d.ts +2 -0
  413. package/lib/typescript/src/app/navigation/CashStack/CashStack.d.ts.map +1 -0
  414. package/lib/typescript/src/app/navigation/EntriesStack/EntriesStack.d.ts +2 -0
  415. package/lib/typescript/src/app/navigation/EntriesStack/EntriesStack.d.ts.map +1 -0
  416. package/lib/typescript/src/app/navigation/ExpenseStack.js/ExpenseStack.d.ts +2 -0
  417. package/lib/typescript/src/app/navigation/ExpenseStack.js/ExpenseStack.d.ts.map +1 -0
  418. package/lib/typescript/src/app/navigation/HomeStack/HomeStack.d.ts.map +1 -1
  419. package/lib/typescript/src/app/navigation/Root.d.ts.map +1 -1
  420. package/lib/typescript/src/app/navigation/SaleStack/SaleStack.d.ts +2 -0
  421. package/lib/typescript/src/app/navigation/SaleStack/SaleStack.d.ts.map +1 -0
  422. package/lib/typescript/src/app/navigation/StockStack/StockStack.d.ts +2 -0
  423. package/lib/typescript/src/app/navigation/StockStack/StockStack.d.ts.map +1 -0
  424. package/lib/typescript/src/app/navigation/index.d.ts +3 -1
  425. package/lib/typescript/src/app/navigation/index.d.ts.map +1 -1
  426. package/lib/typescript/src/app/redux/Store.d.ts.map +1 -1
  427. package/lib/typescript/src/app/redux/reducers/client/client_reducers.d.ts.map +1 -1
  428. package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts +5 -0
  429. package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts.map +1 -1
  430. package/lib/typescript/src/app/redux/reducers/user/user_reducers.d.ts +3 -0
  431. package/lib/typescript/src/app/redux/reducers/user/user_reducers.d.ts.map +1 -0
  432. package/lib/typescript/src/app/redux/reducers/user/user_types.d.ts +4 -0
  433. package/lib/typescript/src/app/redux/reducers/user/user_types.d.ts.map +1 -0
  434. package/lib/typescript/src/app/screens/AddBank.d.ts +5 -0
  435. package/lib/typescript/src/app/screens/AddBank.d.ts.map +1 -0
  436. package/lib/typescript/src/app/screens/AddBusiness.d.ts +4 -0
  437. package/lib/typescript/src/app/screens/AddBusiness.d.ts.map +1 -0
  438. package/lib/typescript/src/app/screens/AddItems.d.ts +5 -0
  439. package/lib/typescript/src/app/screens/AddItems.d.ts.map +1 -0
  440. package/lib/typescript/src/app/screens/AddScreen.d.ts.map +1 -1
  441. package/lib/typescript/src/app/screens/All.d.ts +2 -0
  442. package/lib/typescript/src/app/screens/All.d.ts.map +1 -0
  443. package/lib/typescript/src/app/screens/AllTransactions.d.ts +5 -0
  444. package/lib/typescript/src/app/screens/AllTransactions.d.ts.map +1 -0
  445. package/lib/typescript/src/app/screens/Banks.d.ts.map +1 -1
  446. package/lib/typescript/src/app/screens/BillDetails.d.ts +6 -0
  447. package/lib/typescript/src/app/screens/BillDetails.d.ts.map +1 -0
  448. package/lib/typescript/src/app/screens/BillHome.d.ts +5 -0
  449. package/lib/typescript/src/app/screens/BillHome.d.ts.map +1 -0
  450. package/lib/typescript/src/app/screens/BillParent.d.ts +5 -0
  451. package/lib/typescript/src/app/screens/BillParent.d.ts.map +1 -0
  452. package/lib/typescript/src/app/screens/BusinessDetail.d.ts +4 -0
  453. package/lib/typescript/src/app/screens/BusinessDetail.d.ts.map +1 -0
  454. package/lib/typescript/src/app/screens/CashEntry.d.ts +5 -0
  455. package/lib/typescript/src/app/screens/CashEntry.d.ts.map +1 -0
  456. package/lib/typescript/src/app/screens/CashEntryDetails.d.ts +5 -0
  457. package/lib/typescript/src/app/screens/CashEntryDetails.d.ts.map +1 -0
  458. package/lib/typescript/src/app/screens/CashHome.d.ts +4 -0
  459. package/lib/typescript/src/app/screens/CashHome.d.ts.map +1 -0
  460. package/lib/typescript/src/app/screens/CashReport.d.ts +4 -0
  461. package/lib/typescript/src/app/screens/CashReport.d.ts.map +1 -0
  462. package/lib/typescript/src/app/screens/CashSummary.d.ts +5 -0
  463. package/lib/typescript/src/app/screens/CashSummary.d.ts.map +1 -0
  464. package/lib/typescript/src/app/screens/CreateBill.d.ts +5 -0
  465. package/lib/typescript/src/app/screens/CreateBill.d.ts.map +1 -0
  466. package/lib/typescript/src/app/screens/CustomerEntries.d.ts.map +1 -1
  467. package/lib/typescript/src/app/screens/Customers.d.ts +1 -3
  468. package/lib/typescript/src/app/screens/Customers.d.ts.map +1 -1
  469. package/lib/typescript/src/app/screens/EditCategory.d.ts +4 -0
  470. package/lib/typescript/src/app/screens/EditCategory.d.ts.map +1 -0
  471. package/lib/typescript/src/app/screens/EditCategoryStock.d.ts +4 -0
  472. package/lib/typescript/src/app/screens/EditCategoryStock.d.ts.map +1 -0
  473. package/lib/typescript/src/app/screens/Entry.d.ts.map +1 -1
  474. package/lib/typescript/src/app/screens/ExpenseDetail.d.ts +3 -0
  475. package/lib/typescript/src/app/screens/ExpenseDetail.d.ts.map +1 -0
  476. package/lib/typescript/src/app/screens/ExpenseEntries.d.ts +5 -0
  477. package/lib/typescript/src/app/screens/ExpenseEntries.d.ts.map +1 -0
  478. package/lib/typescript/src/app/screens/ExpenseEntry.d.ts +5 -0
  479. package/lib/typescript/src/app/screens/ExpenseEntry.d.ts.map +1 -0
  480. package/lib/typescript/src/app/screens/ExpenseEntryDetails.d.ts +5 -0
  481. package/lib/typescript/src/app/screens/ExpenseEntryDetails.d.ts.map +1 -0
  482. package/lib/typescript/src/app/screens/ExpenseEntryReport.d.ts +5 -0
  483. package/lib/typescript/src/app/screens/ExpenseEntryReport.d.ts.map +1 -0
  484. package/lib/typescript/src/app/screens/ExpenseReport.d.ts +5 -0
  485. package/lib/typescript/src/app/screens/ExpenseReport.d.ts.map +1 -0
  486. package/lib/typescript/src/app/screens/Geolocation.d.ts +5 -0
  487. package/lib/typescript/src/app/screens/Geolocation.d.ts.map +1 -0
  488. package/lib/typescript/src/app/screens/GetStarted.d.ts +4 -0
  489. package/lib/typescript/src/app/screens/GetStarted.d.ts.map +1 -0
  490. package/lib/typescript/src/app/screens/HomeScreen.d.ts.map +1 -1
  491. package/lib/typescript/src/app/screens/InBuy.d.ts +5 -0
  492. package/lib/typescript/src/app/screens/InBuy.d.ts.map +1 -0
  493. package/lib/typescript/src/app/screens/ItemEntryDetails.d.ts +5 -0
  494. package/lib/typescript/src/app/screens/ItemEntryDetails.d.ts.map +1 -0
  495. package/lib/typescript/src/app/screens/LowStock.d.ts +4 -0
  496. package/lib/typescript/src/app/screens/LowStock.d.ts.map +1 -0
  497. package/lib/typescript/src/app/screens/NewPin.d.ts +5 -0
  498. package/lib/typescript/src/app/screens/NewPin.d.ts.map +1 -0
  499. package/lib/typescript/src/app/screens/OutSell.d.ts +6 -0
  500. package/lib/typescript/src/app/screens/OutSell.d.ts.map +1 -0
  501. package/lib/typescript/src/app/screens/POSSale.d.ts +9 -0
  502. package/lib/typescript/src/app/screens/POSSale.d.ts.map +1 -0
  503. package/lib/typescript/src/app/screens/PinScreen.d.ts +5 -0
  504. package/lib/typescript/src/app/screens/PinScreen.d.ts.map +1 -0
  505. package/lib/typescript/src/app/screens/PreviewBill.d.ts +5 -0
  506. package/lib/typescript/src/app/screens/PreviewBill.d.ts.map +1 -0
  507. package/lib/typescript/src/app/screens/Profile.d.ts +5 -0
  508. package/lib/typescript/src/app/screens/Profile.d.ts.map +1 -0
  509. package/lib/typescript/src/app/screens/RateList.d.ts +5 -0
  510. package/lib/typescript/src/app/screens/RateList.d.ts.map +1 -0
  511. package/lib/typescript/src/app/screens/Report.d.ts +5 -0
  512. package/lib/typescript/src/app/screens/Report.d.ts.map +1 -0
  513. package/lib/typescript/src/app/screens/SaleItemDetail.d.ts +6 -0
  514. package/lib/typescript/src/app/screens/SaleItemDetail.d.ts.map +1 -0
  515. package/lib/typescript/src/app/screens/SaleParent.d.ts +2 -0
  516. package/lib/typescript/src/app/screens/SaleParent.d.ts.map +1 -0
  517. package/lib/typescript/src/app/screens/SelectBank.d.ts +4 -0
  518. package/lib/typescript/src/app/screens/SelectBank.d.ts.map +1 -0
  519. package/lib/typescript/src/app/screens/SelectBusiness.d.ts.map +1 -1
  520. package/lib/typescript/src/app/screens/Splash.d.ts.map +1 -1
  521. package/lib/typescript/src/app/screens/StockChild.d.ts +7 -0
  522. package/lib/typescript/src/app/screens/StockChild.d.ts.map +1 -0
  523. package/lib/typescript/src/app/screens/StockDetail.d.ts +5 -0
  524. package/lib/typescript/src/app/screens/StockDetail.d.ts.map +1 -0
  525. package/lib/typescript/src/app/screens/StockParent.d.ts +2 -0
  526. package/lib/typescript/src/app/screens/StockParent.d.ts.map +1 -0
  527. package/lib/typescript/src/app/screens/StockReport.d.ts +5 -0
  528. package/lib/typescript/src/app/screens/StockReport.d.ts.map +1 -0
  529. package/lib/typescript/src/app/screens/StockValue.d.ts +5 -0
  530. package/lib/typescript/src/app/screens/StockValue.d.ts.map +1 -0
  531. package/lib/typescript/src/app/screens/Suppliers.d.ts +1 -3
  532. package/lib/typescript/src/app/screens/Suppliers.d.ts.map +1 -1
  533. package/lib/typescript/src/app/screens/TransactionDetails.d.ts.map +1 -1
  534. package/lib/typescript/src/app/screens/UpdateBusiness.d.ts +5 -0
  535. package/lib/typescript/src/app/screens/UpdateBusiness.d.ts.map +1 -0
  536. package/lib/typescript/src/app/screens/VisionCamera.d.ts +2 -0
  537. package/lib/typescript/src/app/screens/VisionCamera.d.ts.map +1 -0
  538. package/lib/typescript/src/app/screens/index.d.ts +56 -11
  539. package/lib/typescript/src/app/screens/index.d.ts.map +1 -1
  540. package/lib/typescript/src/app/themes/config.d.ts +60 -8
  541. package/lib/typescript/src/app/themes/config.d.ts.map +1 -1
  542. package/package.json +6 -2
  543. package/src/App.js +30 -34
  544. package/src/app/api/api.js +11 -0
  545. package/src/app/assets/Icons/Bill.png +0 -0
  546. package/src/app/assets/Icons/Bill_Grey.png +0 -0
  547. package/src/app/assets/Icons/Cash.png +0 -0
  548. package/src/app/assets/Icons/Cash_Grey.png +0 -0
  549. package/src/app/assets/Icons/Expense.png +0 -0
  550. package/src/app/assets/Icons/Expense_Grey.png +0 -0
  551. package/src/app/assets/Icons/Staff.png +0 -0
  552. package/src/app/assets/Icons/Stock.png +0 -0
  553. package/src/app/assets/Icons/Stock_Grey.png +0 -0
  554. package/src/app/assets/Icons/abc.png +0 -0
  555. package/src/app/assets/Icons/bank_logo.png +0 -0
  556. package/src/app/assets/Icons/download_sale.png +0 -0
  557. package/src/app/assets/Icons/recycle-bin.png +0 -0
  558. package/src/app/assets/animations/recording.json +1 -0
  559. package/src/app/assets/animations/success.json +1 -0
  560. package/src/app/assets/animations/voice_visualization.json +1 -0
  561. package/src/app/assets/businessCards/card_11.png +0 -0
  562. package/src/app/assets/businessCards/card_12_bg.png +0 -0
  563. package/src/app/assets/businessCards/card_wall_01.jpeg +0 -0
  564. package/src/app/assets/businessCards/card_wall_02.jpeg +0 -0
  565. package/src/app/assets/businessCards/card_wall_03.jpeg +0 -0
  566. package/src/app/assets/businessCards/card_wall_04.jpeg +0 -0
  567. package/src/app/assets/businessCards/card_wall_05.jpeg +0 -0
  568. package/src/app/assets/businessCards/card_wall_06.jpeg +0 -0
  569. package/src/app/assets/businessCards/card_wall_07.jpeg +0 -0
  570. package/src/app/assets/businessCards/card_wall_08.jpeg +0 -0
  571. package/src/app/assets/illustrations/empty.png +0 -0
  572. package/src/app/assets/illustrations/packages.png +0 -0
  573. package/src/app/assets/images/Digikhata_idzarHgH0q_0.png +0 -0
  574. package/src/app/assets/images/bank.png +0 -0
  575. package/src/app/assets/images/digiLogo-main.png +0 -0
  576. package/src/app/assets/images/svgviewer-output.svg +57 -0
  577. package/src/app/assets/images/user.png +0 -0
  578. package/src/app/assets/oldIcons/BILL.svg +3 -0
  579. package/src/app/assets/oldIcons/CASH.svg +4 -0
  580. package/src/app/assets/oldIcons/EXPENSE.svg +6 -0
  581. package/src/app/assets/oldIcons/STAFF.svg +3 -0
  582. package/src/app/assets/oldIcons/Sale Active.svg +14 -0
  583. package/src/app/assets/oldIcons/Stock.svg +5 -0
  584. package/src/app/assets/svg/BILL.svg +4 -0
  585. package/src/app/assets/svg/CASH.svg +6 -0
  586. package/src/app/assets/svg/EXPENSE.svg +5 -0
  587. package/src/app/assets/svg/More Icon.svg +6 -0
  588. package/src/app/assets/svg/Payment Icon.svg +4 -0
  589. package/src/app/assets/svg/Pos.svg +13 -0
  590. package/src/app/assets/svg/STAFF.svg +5 -0
  591. package/src/app/assets/svg/Sale Active.svg +8 -0
  592. package/src/app/assets/svg/Sale Icon.svg +3 -0
  593. package/src/app/assets/svg/Stock.svg +5 -0
  594. package/src/app/components/AccountSetupSteps.js +58 -0
  595. package/src/app/components/AddItemBillParent.js +373 -0
  596. package/src/app/components/AdditemBillChild.js +1257 -0
  597. package/src/app/components/Balance.js +211 -114
  598. package/src/app/components/BillList.js +548 -0
  599. package/src/app/components/BillSetupSteps.js +56 -0
  600. package/src/app/components/BottomView.js +39 -0
  601. package/src/app/components/BusinessCards/Card1.js +160 -0
  602. package/src/app/components/BusinessCards/Card10.js +209 -0
  603. package/src/app/components/BusinessCards/Card2.js +148 -0
  604. package/src/app/components/BusinessCards/Card3.js +147 -0
  605. package/src/app/components/BusinessCards/Card4.js +147 -0
  606. package/src/app/components/BusinessCards/Card5.js +151 -0
  607. package/src/app/components/BusinessCards/Card6.js +157 -0
  608. package/src/app/components/BusinessCards/Card7.js +146 -0
  609. package/src/app/components/BusinessCards/Card8.js +170 -0
  610. package/src/app/components/BusinessCards/Card9.js +209 -0
  611. package/src/app/components/BusinessCards/index.js +10 -0
  612. package/src/app/components/CashEntryComponent.js +297 -0
  613. package/src/app/components/CityModal.js +117 -0
  614. package/src/app/components/CountryPhoneInput.js +373 -267
  615. package/src/app/components/CreateExpenseAccount.js +141 -0
  616. package/src/app/components/CustomStatusBar.js +33 -0
  617. package/src/app/components/CustomToast.js +143 -0
  618. package/src/app/components/DeleteBusinessModal.js +196 -0
  619. package/src/app/components/DiscountTaxModal.js +256 -0
  620. package/src/app/components/Entries.js +87 -67
  621. package/src/app/components/ExpenseList.js +507 -0
  622. package/src/app/components/ExpenseParent.js +446 -0
  623. package/src/app/components/FloatingInput.js +188 -0
  624. package/src/app/components/Header.js +121 -0
  625. package/src/app/components/Loader.js +35 -0
  626. package/src/app/components/PartyModal.js +213 -0
  627. package/src/app/components/PickerModal.js +176 -0
  628. package/src/app/components/SalePaymentModal.js +822 -0
  629. package/src/app/components/SearchBar.js +225 -47
  630. package/src/app/components/StockDetailChild.js +461 -0
  631. package/src/app/components/StockList.js +582 -0
  632. package/src/app/components/StockReportTransaction.js +192 -0
  633. package/src/app/components/Transaction.js +277 -86
  634. package/src/app/components/User.js +188 -80
  635. package/src/app/components/index.js +51 -13
  636. package/src/app/database/bill.js +305 -0
  637. package/src/app/database/business.js +499 -0
  638. package/src/app/database/cash.js +451 -0
  639. package/src/app/database/clients.js +1536 -43
  640. package/src/app/database/expense.js +439 -0
  641. package/src/app/database/schema.js +115 -4
  642. package/src/app/database/stock.js +724 -0
  643. package/src/app/htmlTemplates/htmlTemplates.js +2603 -0
  644. package/src/app/navigation/BillStack/BillStack.js +38 -0
  645. package/src/app/navigation/BottomTabs/BottomTabs.js +24 -19
  646. package/src/app/navigation/BusinessStack/BusinessStack.js +27 -0
  647. package/src/app/navigation/CashStack/CashStack.js +59 -0
  648. package/src/app/navigation/EntriesStack/EntriesStack.js +186 -0
  649. package/src/app/navigation/ExpenseStack.js/ExpenseStack.js +50 -0
  650. package/src/app/navigation/HomeStack/HomeStack.js +106 -39
  651. package/src/app/navigation/Root.js +16 -1
  652. package/src/app/navigation/SaleStack/SaleStack.js +62 -0
  653. package/src/app/navigation/StockStack/StockStack.js +48 -0
  654. package/src/app/navigation/index.js +5 -1
  655. package/src/app/redux/Store.js +2 -0
  656. package/src/app/redux/reducers/client/client_reducers.js +31 -2
  657. package/src/app/redux/reducers/client/client_types.js +8 -1
  658. package/src/app/redux/reducers/user/user_reducers.js +24 -0
  659. package/src/app/redux/reducers/user/user_types.js +3 -0
  660. package/src/app/screens/AddBank.js +353 -0
  661. package/src/app/screens/AddBusiness.js +1161 -0
  662. package/src/app/screens/AddItems.js +515 -0
  663. package/src/app/screens/AddScreen.js +525 -165
  664. package/src/app/screens/All.js +1074 -0
  665. package/src/app/screens/AllTransactions.js +1138 -0
  666. package/src/app/screens/Banks.js +1134 -133
  667. package/src/app/screens/BillDetails.js +989 -0
  668. package/src/app/screens/BillHome.js +97 -0
  669. package/src/app/screens/BillParent.js +419 -0
  670. package/src/app/screens/BusinessDetail.js +939 -0
  671. package/src/app/screens/CashEntry.js +2913 -0
  672. package/src/app/screens/CashEntryDetails.js +650 -0
  673. package/src/app/screens/CashHome.js +594 -0
  674. package/src/app/screens/CashReport.js +1658 -0
  675. package/src/app/screens/CashSummary.js +607 -0
  676. package/src/app/screens/CreateBill.js +2504 -0
  677. package/src/app/screens/CustomerEntries.js +1578 -350
  678. package/src/app/screens/Customers.js +1066 -213
  679. package/src/app/screens/EditCategory.js +316 -0
  680. package/src/app/screens/EditCategoryStock.js +320 -0
  681. package/src/app/screens/Entry.js +2555 -585
  682. package/src/app/screens/ExpenseDetail.js +14 -0
  683. package/src/app/screens/ExpenseEntries.js +837 -0
  684. package/src/app/screens/ExpenseEntry.js +2478 -0
  685. package/src/app/screens/ExpenseEntryDetails.js +612 -0
  686. package/src/app/screens/ExpenseEntryReport.js +1059 -0
  687. package/src/app/screens/ExpenseReport.js +1071 -0
  688. package/src/app/screens/Geolocation.js +435 -0
  689. package/src/app/screens/GetStarted.js +201 -0
  690. package/src/app/screens/HomeScreen.js +368 -132
  691. package/src/app/screens/InBuy.js +918 -0
  692. package/src/app/screens/ItemEntryDetails.js +582 -0
  693. package/src/app/screens/LowStock.js +417 -0
  694. package/src/app/screens/NewPin.js +225 -0
  695. package/src/app/screens/OutSell.js +2153 -0
  696. package/src/app/screens/POSSale.js +639 -0
  697. package/src/app/screens/PinScreen.js +720 -0
  698. package/src/app/screens/PreviewBill.js +302 -0
  699. package/src/app/screens/Profile.js +1594 -0
  700. package/src/app/screens/RateList.js +525 -0
  701. package/src/app/screens/Report.js +1401 -0
  702. package/src/app/screens/SaleItemDetail.js +1187 -0
  703. package/src/app/screens/SaleParent.js +345 -0
  704. package/src/app/screens/SelectBank.js +220 -0
  705. package/src/app/screens/SelectBusiness.js +670 -163
  706. package/src/app/screens/Splash.js +96 -15
  707. package/src/app/screens/StockChild.js +372 -0
  708. package/src/app/screens/StockDetail.js +758 -0
  709. package/src/app/screens/StockParent.js +287 -0
  710. package/src/app/screens/StockReport.js +1359 -0
  711. package/src/app/screens/StockValue.js +720 -0
  712. package/src/app/screens/Suppliers.js +1098 -205
  713. package/src/app/screens/TransactionDetails.js +1674 -180
  714. package/src/app/screens/UpdateBusiness.js +837 -0
  715. package/src/app/screens/VisionCamera.js +54 -0
  716. package/src/app/screens/index.js +111 -21
  717. package/src/app/screens/new.html +171 -0
  718. package/src/app/themes/config.js +431 -114
  719. package/src/app/utils/city.json +7265 -0
@@ -1,658 +1,2628 @@
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";
1
+ import {
2
+ View,
3
+ Text,
4
+ StyleSheet,
5
+ TouchableOpacity,
6
+ TextInput,
7
+ Keyboard,
8
+ ScrollView,
9
+ Platform,
10
+ PermissionsAndroid,
11
+ Image,
12
+ Dimensions,
13
+ ActivityIndicator,
14
+ Alert,
15
+ StatusBar,
16
+ PixelRatio,
17
+ FlatList,
18
+ } from 'react-native';
19
+ import React, { useState, useEffect, useRef } from 'react';
20
+ import {
21
+ addCommas,
22
+ COLORS,
23
+ FONT_BOLD,
24
+ FONT_MEDIUM,
25
+ FONT_NORMAL,
26
+ formatDateTime,
27
+ formatPhoneNumber,
28
+ fromJsDateToSql,
29
+ getAvatar,
30
+ HP,
31
+ Input_Field_SIZES,
32
+ isPdfFile,
33
+ mergeDateTime,
34
+ TEXT_SIZES,
35
+ toISOStringUTC,
36
+ WP,
37
+ } from '../themes/config';
38
+ import LinearGradient from 'react-native-linear-gradient';
39
+ import Ionicons from 'react-native-vector-icons/Ionicons';
40
+ import DateTimePicker, {
41
+ DateTimePickerAndroid,
42
+ } from '@react-native-community/datetimepicker';
43
+ import {
44
+ addClient,
45
+ addTransaction,
46
+ addTransactionImages,
47
+ deleteTransactionImage,
48
+ deleteTransactionImagesByTrxId,
49
+ getClientDetails,
50
+ getClientsByType,
51
+ getClientTransactions,
52
+ updateTransaction,
53
+ updateTransactionImage,
54
+ } from '../database/clients';
55
+ import { useSelector } from 'react-redux';
56
+ import Modal from 'react-native-modal';
57
+ import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
58
+ import { pick } from '@react-native-documents/picker';
59
+ import Sound, {
60
+ AudioEncoderAndroidType,
61
+ AudioSourceAndroidType,
62
+ AVEncoderAudioQualityIOSType,
63
+ AVEncodingOption,
64
+ RecordBackType,
65
+ PlayBackType,
66
+ createSound,
67
+ } from 'react-native-nitro-sound';
68
+ import LottieView from 'lottie-react-native';
69
+ import {
70
+ SafeAreaView,
71
+ SafeAreaProvider,
72
+ useSafeAreaInsets,
73
+ } from 'react-native-safe-area-context';
74
+ import { useDispatch } from 'react-redux';
75
+ import Contacts from 'react-native-contacts';
76
+ import {
77
+ CLIENT_DETAILS,
78
+ STATUS_BAR_COLOR,
79
+ } from '../redux/reducers/client/client_types';
80
+ import { CountryPhoneInput, FloatingInput, User } from '../components';
81
+ import { addItemDetails, updateItemQty } from '../database/stock';
82
+
83
+ const CustomStatusBar = () => {
84
+ const insets = useSafeAreaInsets();
85
+
86
+ return (
87
+ <View style={{ height: insets.top, backgroundColor: 'red' }}>
88
+ <StatusBar
89
+ translucent
90
+ backgroundColor={COLORS.primaryColor}
91
+ barStyle="light-content"
92
+ />
93
+ </View>
94
+ );
95
+ };
12
96
 
13
97
  export default function Entry({ navigation, route }) {
98
+ const animationRef = useRef(null);
99
+ const insets = useSafeAreaInsets();
100
+ const dispatch = useDispatch();
101
+
102
+ const ClientDetails = useSelector((state) => state.client.client_details);
103
+ const selectBusiness = useSelector((state) => state.client.selected_business);
104
+ const clients = useSelector((state) => state.client.home_customers);
105
+ const suppliers = useSelector((state) => state.client.home_suppliers);
14
106
 
107
+ const type = route?.params?.type;
108
+ const item = route?.params?.item;
109
+ const pay_type = route?.params?.pay_type;
110
+ const amount = route?.params?.amount;
111
+ const mainColor = type;
15
112
 
16
- const ClientDetails = useSelector(state => state.client.client_details);
17
- const type = route?.params?.type;
18
- const mainColor = type;
113
+ const [input, setInput] = useState(''); // only the current number
114
+ const [history, setHistory] = useState(''); // full expression
115
+ const [result, setResult] = useState('0'); // live evaluated result
116
+ const [CalculatorErr, setCalculatorErr] = useState('');
117
+ const [HeaderValue, setHeaderValue] = useState('0');
118
+ const [memory, setMemory] = useState([]);
119
+ const [Notes, setNotes] = useState('');
120
+ const [date, setDate] = useState(new Date());
121
+ const [showPicker, setShowPicker] = useState(false);
122
+ const [showTimePicker, setShowTimePicker] = useState(false);
123
+ const [time, setTime] = useState(new Date());
124
+ const [MergedDate, setMergedDate] = useState('');
125
+ const [SuccessModal, setSuccessModal] = useState(false);
19
126
 
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("");
127
+ const [isModalVisible, setIsModalVisible] = useState(false);
128
+ const [attachments, setAttachments] = useState([]);
129
+ const [keyboardVisible, setKeyboardVisible] = useState(false);
130
+ const [IsSoundModal, setIsSoundModal] = useState(false);
131
+ const [RecordingTime, setRecordingTime] = useState('');
132
+ const [IsPlaying, setIsPlaying] = useState(false);
133
+ const [AudioFile, setAudioFile] = useState('');
134
+ const [PlayLoading, setPlayLoading] = useState(false);
135
+ const [BillNo, setBillNo] = useState('');
136
+ const [SelectedItems, setSelectedItems] = useState([]);
137
+ const [totalAmount, setTotalAmount] = useState(0);
138
+ const [Amount, setAmount] = useState('');
139
+ const [IsCash, setIsCash] = useState(false);
26
140
 
27
- const [isModalVisible, setIsModalVisible] = useState(false);
28
- const [attachments, setAttachments] = useState([]); // {type, uri, name}
141
+ const [ChangeModal, setChangeModal] = useState(false);
142
+ const [SelectedParty, setSelectedParty] = useState(null);
143
+ const [Clients, setClients] = useState([]);
144
+ const [ShowNewBtn, setShowNewBtn] = useState(false);
145
+ const [contacts, setContacts] = useState([]);
146
+ const [Name, setName] = useState('');
147
+ const [clientPhoneSet, setClientPhoneSet] = useState(new Set());
148
+ const [clientPhoneMap, setClientPhoneMap] = useState(new Map());
149
+ const [searchText, setSearchText] = useState('');
150
+ const [PhoneNum, setPhoneNum] = useState('');
29
151
 
152
+ // ✅ Add file in state (max 3)
153
+ const addAttachment = (file) => {
154
+ if (attachments.length >= 3) {
155
+ alert('You can only attach up to 3 files.');
156
+ return;
157
+ }
158
+ setAttachments([...attachments, file]);
159
+ };
30
160
 
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;
161
+ // ✅ Gallery
162
+ const handleGallery = async () => {
163
+ try {
164
+ const result = await launchImageLibrary({ mediaType: 'photo' });
165
+ if (result.assets && result.assets.length > 0) {
166
+ addAttachment({
167
+ type: 'image',
168
+ uri: result.assets[0].uri,
169
+ name: result.assets[0].fileName || 'gallery_image.jpg',
170
+ });
171
+ }
172
+ } catch (err) {
173
+ console.log('Gallery Error:', err);
174
+ }
175
+ setIsModalVisible(false);
176
+ };
177
+
178
+ // ✅ Camera with permission
179
+ const handleCamera = async () => {
180
+ try {
181
+ const granted = await PermissionsAndroid.request(
182
+ PermissionsAndroid.PERMISSIONS.CAMERA,
183
+ {
184
+ title: 'Camera Permission',
185
+ message: 'This app needs camera access to take photos',
186
+ buttonNeutral: 'Ask Me Later',
187
+ buttonNegative: 'Cancel',
188
+ buttonPositive: 'OK',
36
189
  }
37
- setAttachments([...attachments, file]);
38
- };
190
+ );
39
191
 
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);
192
+ if (granted === PermissionsAndroid.RESULTS.GRANTED) {
193
+ const result = await launchCamera({ mediaType: 'photo' });
194
+ if (result.assets && result.assets.length > 0) {
195
+ addAttachment({
196
+ type: 'image',
197
+ uri: result.assets[0].uri,
198
+ name: result.assets[0].fileName || 'camera_image.jpg',
199
+ });
53
200
  }
54
- setIsModalVisible(false);
201
+ } else {
202
+ alert('Camera permission denied');
203
+ }
204
+ } catch (err) {
205
+ console.log('Camera Error:', err);
206
+ }
207
+ setIsModalVisible(false);
208
+ };
209
+
210
+ // ✅ PDF Picker (using @react-native-documents/picker)
211
+ const handlePDF = async () => {
212
+ try {
213
+ const res = await pick({ type: ['application/pdf'] });
214
+ if (res && res.length > 0) {
215
+ addAttachment({
216
+ type: 'pdf',
217
+ uri: res[0].uri,
218
+ name: res[0].name || 'document.pdf',
219
+ });
220
+ }
221
+ } catch (err) {
222
+ if (err.message !== 'DOCUMENT_PICKER_CANCELED') {
223
+ console.log('PDF Error:', err);
224
+ }
225
+ }
226
+ setIsModalVisible(false);
227
+ };
228
+
229
+ const removeAttachment = (index) => {
230
+ setAttachments(attachments.filter((_, i) => i !== index));
231
+ };
232
+
233
+ // Calculator buttons
234
+ const buttons = [
235
+ ['AC', 'M+', 'M-', 'MR'],
236
+ ['%', '÷', 'x', '-'],
237
+ ['7', '8', '9', '+'],
238
+ ['4', '5', '6', '='],
239
+ ['1', '2', '3', '⌫'],
240
+ ['0', '.'],
241
+ ];
242
+
243
+ const operators = ['+', '-', '*', '/', 'x', '÷', '%'];
244
+
245
+ const handlePress = (key) => {
246
+ const limit = 9;
247
+ const currHist = history || '';
248
+ const currInput = input || '';
249
+
250
+ // --- helpers ---
251
+ const roundTo3 = (num) => Math.round(num * 1000) / 1000;
252
+
253
+ const evaluateLeftToRight = (expr) => {
254
+ if (!expr) return 0;
255
+ expr = expr.replace(/x/g, '*').replace(/÷/g, '/').replace(/%/g, '/100');
256
+ const tokens = expr.match(/(\d+(\.\d+)?|[+\-*/])/g);
257
+ if (!tokens) return 0;
258
+
259
+ let result = parseFloat(tokens[0]);
260
+ for (let i = 1; i < tokens.length; i += 2) {
261
+ const op = tokens[i];
262
+ const num = parseFloat(tokens[i + 1]);
263
+ if (isNaN(num)) return null;
264
+ if (op === '+') result += num;
265
+ else if (op === '-') result -= num;
266
+ else if (op === '*') result *= num;
267
+ else if (op === '/') result /= num;
268
+ }
269
+ return roundTo3(result);
55
270
  };
56
271
 
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
- );
272
+ const isOperator = (ch) => operators.includes(ch);
70
273
 
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);
274
+ const getLastNumber = (hist) => {
275
+ if (!hist) return '';
276
+ const parts = hist.split(/[\+\-\*\/x÷]/);
277
+ return parts[parts.length - 1] || '';
87
278
  };
88
279
 
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);
280
+ const setSafeValues = (resValue, newHist = null, inputVal = null) => {
281
+ if (resValue < 0) {
282
+ setCalculatorErr && setCalculatorErr('Invalid Amount');
283
+ return;
284
+ }
285
+ setResult(resValue.toString());
286
+ if (newHist !== null) setHistory(newHist);
287
+ if (inputVal !== null) setInput(inputVal);
288
+ setCalculatorErr && setCalculatorErr('');
106
289
  };
107
290
 
108
- const removeAttachment = (index) => {
109
- setAttachments(attachments.filter((_, i) => i !== index));
291
+ // --- AC ---
292
+ if (key === 'AC') {
293
+ setInput('');
294
+ setHistory('');
295
+ setResult('0');
296
+ setMemory([])
297
+ setCalculatorErr && setCalculatorErr('');
298
+ return;
299
+ }
300
+
301
+ // --- BACKSPACE ---
302
+ if (key === '⌫') {
303
+ if (!currHist) return;
304
+ const newHist = currHist.slice(0, -1);
305
+ setHistory(newHist);
306
+
307
+ if (newHist && isOperator(newHist.slice(-1))) {
308
+ const beforeOp = newHist.slice(0, -1);
309
+ const res = evaluateLeftToRight(beforeOp);
310
+ const displayNum = !isNaN(res) ? res.toString() : getLastNumber(newHist) || '';
311
+ setSafeValues(res, newHist, displayNum + newHist.slice(-1));
312
+ } else {
313
+ const last = getLastNumber(newHist);
314
+ const res = newHist && !isOperator(newHist.slice(-1)) ? evaluateLeftToRight(newHist) : 0;
315
+ setSafeValues(res, newHist, last);
316
+ }
317
+ return;
318
+ }
319
+
320
+ // --- EQUAL ---
321
+ if (key === '=') {
322
+ if (!currHist) return;
323
+ let exprToEval = currHist.endsWith('=') ? currHist.slice(0, -1) : currHist;
324
+ if (exprToEval && isOperator(exprToEval.slice(-1))) {
325
+ exprToEval = exprToEval.slice(0, -1);
326
+ }
327
+ if (!exprToEval) return;
328
+ const res = evaluateLeftToRight(exprToEval);
329
+ if (res === null || isNaN(res)) {
330
+ setInput('');
331
+ setHistory('');
332
+ setResult('Error');
333
+ } else {
334
+ setSafeValues(res, exprToEval + '=', res.toString());
335
+ }
336
+ return;
337
+ }
338
+
339
+ // --- OPERATOR ---
340
+ if (isOperator(key)) {
341
+ if (!currHist && !currInput) return;
342
+
343
+ // --- Handle after '=' ---
344
+ if (currHist.endsWith('=')) {
345
+ const base = currInput || currHist.slice(0, -1);
346
+ if (typeof checkMaxValue === 'function' && checkMaxValue(base)) return;
347
+
348
+ const newHist = base + key;
349
+ const res = evaluateLeftToRight(base);
350
+ setSafeValues(res, newHist, base + key);
351
+ return;
352
+ }
353
+
354
+ // --- Replace operator ---
355
+ if (currHist && isOperator(currHist.slice(-1))) {
356
+ const newHist = currHist.slice(0, -1) + key;
357
+ const exprForRes = newHist.slice(0, -1);
358
+ const res = evaluateLeftToRight(exprForRes);
359
+ setSafeValues(res, newHist, (currInput && isOperator(currInput.slice(-1)) ? currInput.slice(0, -1) : res.toString()) + key);
360
+ return;
361
+ }
362
+
363
+ // --- Percentage ---
364
+ if (key === '%') {
365
+ const lastNum = getLastNumber(currHist);
366
+ if (!lastNum) return;
367
+ if (parseFloat(lastNum) < 1 && lastNum.includes('.')) return;
368
+
369
+ const percentValue = parseFloat(lastNum) / 100;
370
+ const newHist = currHist.slice(0, currHist.length - lastNum.length) + percentValue;
371
+ const res = evaluateLeftToRight(newHist);
372
+ setSafeValues(res, newHist, percentValue.toString());
373
+ return;
374
+ }
375
+
376
+ // --- Normal operator handling ---
377
+ const newHist = currHist + key;
378
+ const res = evaluateLeftToRight(currHist);
379
+ setSafeValues(res, newHist, res.toString() + key);
380
+ return;
381
+ }
382
+
383
+ // --- NUMBER / DOT ---
384
+ if (key === '.') {
385
+ const lastNum = getLastNumber(currHist);
386
+ if (!lastNum) return;
387
+ if (lastNum.includes('.')) return;
388
+ }
389
+
390
+ if (key === '0') {
391
+ const lastNum = getLastNumber(currHist);
392
+ if (!lastNum) return;
393
+ if (lastNum === '0') return;
394
+ }
395
+
396
+ if (key === 'M+' || key === 'M-') {
397
+
398
+ if (!currInput && (!result || result === '0')) return;
399
+
400
+ let exprToEval = currHist.endsWith('=') ? currHist.slice(0, -1) : currHist;
401
+
402
+ if (!exprToEval && currInput) {
403
+ exprToEval = currInput;
404
+ } else if (!exprToEval && result && result !== '0') {
405
+ exprToEval = result;
406
+ }
407
+
408
+ if (!exprToEval) return;
409
+
410
+ if (exprToEval && isOperator(exprToEval.slice(-1))) {
411
+ exprToEval = exprToEval.slice(0, -1);
412
+ }
413
+
414
+ const res = evaluateLeftToRight(exprToEval);
415
+ if (res === null || isNaN(res)) return;
416
+
417
+ const valueToStore = key === 'M+' ? res : -res;
418
+ setMemory(prev => [...prev, valueToStore]);
419
+ return;
420
+ }
421
+
422
+
423
+ const lastNum = getLastNumber(currHist);
424
+ if (lastNum.length >= limit) return;
425
+
426
+ const newHist = currHist + key;
427
+ const newLastNum = getLastNumber(newHist);
428
+ const res = evaluateLeftToRight(newHist);
429
+ setSafeValues(res, newHist, newLastNum.slice(0, limit));
430
+ };
431
+
432
+ const handleBackspace = () => {
433
+ const maxValue = 999999999;
434
+ const limit = 9;
435
+
436
+ const roundTo3 = (num) => Math.round(num * 1000) / 1000;
437
+
438
+ const evaluateLeftToRight = (expr) => {
439
+ expr = expr.replace(/x/g, '*').replace(/÷/g, '/').replace(/%/g, '/100');
440
+ const tokens = expr.match(/(\d+(\.\d+)?|[+\-*/])/g);
441
+ if (!tokens) return 0;
442
+
443
+ let result = parseFloat(tokens[0]);
444
+ for (let i = 1; i < tokens.length; i += 2) {
445
+ const op = tokens[i];
446
+ const num = parseFloat(tokens[i + 1]);
447
+ if (op === '+') result += num;
448
+ else if (op === '-') result -= num;
449
+ else if (op === '*') result *= num;
450
+ else if (op === '/') result /= num;
451
+ }
452
+
453
+ result = roundTo3(result);
454
+
455
+ if (result > maxValue) {
456
+ setCalculatorErr('Invalid Amount');
457
+ return null;
458
+ }
459
+ return result;
110
460
  };
111
461
 
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 === '=') {
462
+ // current state
463
+ const currHist = history || '';
464
+ if (!currHist) return;
465
+
466
+ // 🔹 remove the last char from history
467
+ const newHist = currHist.slice(0, -1);
468
+
469
+ // 🔹 find last operator and rebuild current input segment
470
+ const lastOpIndex = Math.max(
471
+ newHist.lastIndexOf('+'),
472
+ newHist.lastIndexOf('-'),
473
+ newHist.lastIndexOf('*'),
474
+ newHist.lastIndexOf('/'),
475
+ newHist.lastIndexOf('x'),
476
+ newHist.lastIndexOf('÷'),
477
+ newHist.lastIndexOf('%')
478
+ );
479
+
480
+ // 🔹 new input segment (after the last operator)
481
+ const newInputSegment =
482
+ lastOpIndex === -1 ? newHist : newHist.slice(lastOpIndex + 1);
483
+
484
+ setHistory(newHist);
485
+ setInput(newInputSegment);
486
+
487
+ // ✅ prepare expression for evaluation:
488
+ // if last char is operator, drop it before evaluating
489
+ let exprForEval = newHist;
490
+ if (exprForEval && operators.includes(exprForEval.slice(-1))) {
491
+ exprForEval = exprForEval.slice(0, -1);
492
+ }
493
+
494
+ // 🔹 update live result
495
+ if (exprForEval) {
496
+ const res = evaluateLeftToRight(exprForEval);
497
+
498
+ // ✅ set result and also update input to evaluated result
499
+ setResult(res !== null ? res.toString().slice(0, limit) : '0');
500
+ setInput(res !== null ? res.toString().slice(0, limit) : '0');
501
+ } else {
502
+ setResult('0');
503
+ }
504
+
505
+ setCalculatorErr('');
506
+ };
507
+
508
+ const onChangeDate = (event, selectedDate) => {
509
+ const currentDate = selectedDate || date;
510
+ setShowPicker(Platform.OS === 'ios'); // for iOS
511
+ setDate(currentDate);
512
+ };
513
+
514
+ const onChangeTime = (event, selectedDate) => {
515
+ const currentDate = selectedDate;
516
+ setShowTimePicker(Platform.OS === 'ios');
517
+ setTime(currentDate);
518
+ };
519
+
520
+ const showDate = () => {
521
+ if (Platform.OS === 'android') {
522
+ // Android dialog
523
+ DateTimePickerAndroid.open({
524
+ value: date,
525
+ onChange: onChangeDate,
526
+ mode: 'date',
527
+ is24Hour: false,
528
+ });
529
+ } else {
530
+ // iOS: just show inline picker
531
+ setShowPicker(true);
532
+ }
533
+ };
534
+
535
+ const showTime = () => {
536
+ if (Platform.OS === 'android') {
537
+ // Android dialog
538
+ DateTimePickerAndroid.open({
539
+ value: time,
540
+ onChange: onChangeTime,
541
+ mode: 'time',
542
+ is24Hour: false,
543
+ });
544
+ } else {
545
+ // iOS: show inline picker
546
+ setShowTimePicker(true);
547
+ }
548
+ };
549
+
550
+ const onSave = () => {
551
+ try {
552
+ const finalValue = Number(result);
553
+
554
+ // ✅ Validate number
555
+ if (
556
+ !finalValue ||
557
+ !isFinite(finalValue) ||
558
+ finalValue <= 0 ||
559
+ finalValue > 999999999 ||
560
+ CalculatorErr ||
561
+ CalculatorErr != ''
562
+ ) {
563
+ console.log('Invalid or non-positive result, not saving');
564
+ return;
565
+ }
566
+
567
+ const amountToSave = finalValue;
568
+ const creditLimit = Number(ClientDetails?.credit_limit || 0);
569
+
570
+ if (
571
+ (pay_type === 'receivable' || pay_type === undefined || pay_type == "none") &&
572
+ mainColor === 'red' &&
573
+ creditLimit > 0 &&
574
+ Number(amountToSave) + Number(amount) > creditLimit
575
+ ) {
576
+ Alert.alert(
577
+ 'Credit Limit Warning',
578
+ `The customer balance will be greater than the assigned credit limit of Rs ${creditLimit}.\nAre you sure you want to continue?`,
579
+ [
580
+ { text: 'No', style: 'cancel' },
581
+ { text: 'Yes', onPress: () => saveTransaction(amountToSave) },
582
+ ],
583
+ { cancelable: true }
584
+ );
585
+ }
586
+ else {
587
+ saveTransaction(amountToSave);
588
+ }
589
+ } catch (err) {
590
+ console.log('Calculation Error:', err);
591
+ }
592
+ };
593
+
594
+ const saveTransaction = (finalValue) => {
595
+ addTransaction(
596
+ ClientDetails.id,
597
+ mainColor === 'red' ? String(finalValue) : '0', // red = debit
598
+ mainColor === 'green' ? String(finalValue) : '0', // green = credit
599
+ Notes + `_bill_${BillNo}`,
600
+ mergeDateTime({ date, time }),
601
+ AudioFile,
602
+ null,
603
+ SelectedItems?.length > 0 ? JSON.stringify(SelectedItems) : ''
604
+ )
605
+ .then(async (res) => {
606
+ console.log(res, 'Transaction Success');
607
+ const trxId = res.insertId; // ✅ new transaction ID
608
+
609
+ // If there are attachments, insert them
610
+ if (attachments && attachments.length > 0) {
611
+ for (const file of attachments) {
133
612
  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());
613
+ await addTransactionImages(trxId, file.uri);
614
+ console.log(`Attachment added: ${file.name}`);
140
615
  } catch (err) {
141
- setInput('Error');
616
+ console.log('Attachment insert error:', err);
142
617
  }
143
- } else if (key === '↵') {
144
- Keyboard.dismiss();
145
- } else {
146
- setInput(prev => prev + key);
618
+ }
147
619
  }
148
- };
149
620
 
150
- const handleBackspace = () => {
151
- setInput(prev => prev.slice(0, -1));
152
- };
621
+ if (SelectedItems) {
622
+ const parsedItems = SelectedItems;
153
623
 
154
- const onChangeDate = (event, selectedDate) => {
155
- const currentDate = selectedDate;
156
- setDate(currentDate);
157
- };
624
+ await Promise.all(
625
+ parsedItems.map(async (i) => {
626
+ await addStockEntry(
627
+ i?.id, // itemId
628
+ i?.addedQty, // stockOUT
629
+ Number(i?.addedQty) * Number(i?.addedRate), // amount
630
+ Number(i?.addedRate), // rateSale
631
+ trxId, // billNo
632
+ i?.qty, // oldQuantity
633
+ i?.addedQty, // addedQuantity
634
+ Notes, // Details
635
+ AudioFile, // AudioFile
636
+ fromJsDateToSql(date), // date
637
+ selectBusiness // selectBusiness
638
+ );
639
+ })
640
+ );
641
+ }
158
642
 
159
- const onChangeTime = (event, selectedDate) => {
160
- const currentDate = selectedDate;
161
- setTime(currentDate);
162
- };
643
+ // Reset form
644
+ setInput('');
645
+ setMemory([]);
646
+ setNotes('');
647
+ setDate(new Date());
648
+ setTime(new Date());
649
+ setMergedDate('');
650
+ setAttachments([]);
163
651
 
164
- const showDate = (currentMode) => {
165
- DateTimePickerAndroid.open({
166
- value: date,
167
- onChange: onChangeDate,
168
- mode: "date",
169
- is24Hour: false,
170
- });
652
+ let clients = await getClientsByType(
653
+ ClientDetails?.type,
654
+ null,
655
+ null,
656
+ selectBusiness?.id
657
+ );
658
+ let filteredClient = clients.find((c) => c.id === ClientDetails.id);
659
+
660
+ let amount =
661
+ filteredClient?.total_subamount - filteredClient?.total_amount;
662
+ let type = 'none';
663
+ if (amount > 0) type = 'payable';
664
+ else if (amount < 0) type = 'receivable';
665
+
666
+ filteredClient = {
667
+ ...filteredClient,
668
+ amount: Math.abs(amount),
669
+ pay_type: type,
670
+ };
671
+
672
+ setSuccessModal(true);
673
+
674
+ setTimeout(() => {
675
+ setSuccessModal(false);
676
+
677
+ // now after 4 seconds go back
678
+ route.params?.onGoBack(filteredClient); // send data back
679
+ navigation.goBack();
680
+ }, 2000);
681
+ })
682
+ .catch((err) => {
683
+ console.log(err, 'Transaction Error');
684
+ });
685
+ };
686
+
687
+ useEffect(() => {
688
+ const showSubscription = Keyboard.addListener('keyboardDidShow', () => {
689
+ setKeyboardVisible(true);
690
+ });
691
+ const hideSubscription = Keyboard.addListener('keyboardDidHide', () => {
692
+ setKeyboardVisible(false);
693
+ });
694
+
695
+ return () => {
696
+ showSubscription.remove();
697
+ hideSubscription.remove();
171
698
  };
699
+ }, []);
700
+
701
+ const askAudioPermission = async () => {
702
+ if (Platform.OS === 'android') {
703
+ try {
704
+ const granted = await PermissionsAndroid.request(
705
+ PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
706
+ {
707
+ title: 'Audio Recording Permission',
708
+ message:
709
+ 'DigiKhata needs access to your microphone to record audio.',
710
+ buttonNeutral: 'Ask Me Later',
711
+ buttonNegative: 'Cancel',
712
+ buttonPositive: 'OK',
713
+ }
714
+ );
715
+
716
+ if (granted === PermissionsAndroid.RESULTS.GRANTED) {
717
+ console.log('Recording permission granted');
718
+ onStartRecord();
719
+ } else {
720
+ console.log('Recording permission denied');
721
+ return;
722
+ }
723
+ } catch (err) {
724
+ console.warn(err);
725
+ return;
726
+ }
727
+ } else {
728
+ onStartRecord();
729
+ }
730
+ };
731
+
732
+ const onStartRecord = async () => {
733
+ setIsSoundModal(true);
734
+ Sound.addRecordBackListener((e) => {
735
+ console.log('Recording progress:', e.currentPosition, e.currentMetering);
736
+ console.log(e.currentPosition);
737
+ console.log(Sound.mmssss(Math.floor(e.currentPosition)));
738
+ setRecordingTime(Sound.mmssss(Math.floor(e.currentPosition)));
739
+ });
740
+
741
+ const result = await Sound.startRecorder();
742
+ console.log('Recording started:', result);
743
+ };
744
+
745
+ const onStopRecord = async (flag) => {
746
+ try {
747
+ const result = await Sound.stopRecorder();
748
+ Sound.removeRecordBackListener();
749
+ console.log('Recording stopped:', result);
750
+
751
+ setAudioFile(flag ? '' : result);
752
+
753
+ setTimeout(() => {
754
+ setIsSoundModal(false);
755
+ }, 350);
756
+ } catch (err) {
757
+ console.error('Error stopping recorder:', err);
758
+ }
759
+ };
760
+
761
+ const onStartPlay = async (fileUrl) => {
762
+ setPlayLoading(true);
763
+ // Set up playback progress listener
764
+ Sound.addPlayBackListener((e) => {
765
+ console.log('Playback progress:', e.currentPosition, e.duration);
766
+ setIsPlaying(true);
767
+ animationRef.current?.play();
768
+ // setCurrentPosition(e.currentPosition);
769
+ // setTotalDuration(e.duration);
770
+ // setPlayTime(Sound.mmssss(Math.floor(e.currentPosition)));
771
+ // setDuration(Sound.mmssss(Math.floor(e.duration)));
772
+ });
773
+
774
+ // Set up playback end listener
775
+ Sound.addPlaybackEndListener((e) => {
776
+ console.log('Playback completed:', e);
777
+ // Handle playback completion
778
+ setIsPlaying(false);
779
+ animationRef.current?.pause();
780
+ // setCurrentPosition(0);
781
+ });
782
+
783
+ const result = await Sound.startPlayer(fileUrl);
784
+ setPlayLoading(false);
785
+ console.log('Playback started:', result);
786
+ };
787
+
788
+ const onPauseRecord = async () => {
789
+ Sound.stopPlayer();
790
+ Sound.removePlayBackListener();
791
+ Sound.removePlaybackEndListener();
792
+ };
172
793
 
173
- const showTime = (currentMode) => {
174
- DateTimePickerAndroid.open({
175
- value: time,
176
- onChange: onChangeTime,
177
- mode: "time",
178
- is24Hour: false,
794
+ useEffect(() => {
795
+ dispatch({
796
+ type: STATUS_BAR_COLOR,
797
+ color: mainColor == "red" ? COLORS.redColor : COLORS.greenColor,
798
+ });
799
+ if (item) {
800
+ let arr = [];
801
+ item?.attachments?.map((i, index) => {
802
+ arr.push({
803
+ name: `pdf-test-${index + 1}.pdf`,
804
+ type: isPdfFile(i?.local_path) ? 'pdf' : 'image',
805
+ uri: i?.local_path,
806
+ attachment_id: i?.id,
179
807
  });
180
- };
808
+ });
809
+
810
+ const value =
811
+ item?.amount === '0'
812
+ ? item?.subamount.toString()
813
+ : item?.amount.toString();
814
+
815
+ setInput(value);
816
+ setResult(value);
817
+ setHistory(value);
818
+
819
+ setAudioFile(item?.local_path);
820
+ setDate(new Date(toISOStringUTC(item?.date)));
821
+ setTime(new Date(toISOStringUTC(item?.date)));
822
+ setNotes(item?.notes?.split('_')[0]);
823
+ setBillNo(item?.notes?.split('_')[2]);
824
+ setAttachments(arr);
825
+ setSelectedItems(item?.items ? JSON.parse(item?.items) : []);
826
+ }
827
+ }, []);
828
+
829
+ const onUpdate = () => {
830
+ try {
831
+ // Use the calculated result directly
832
+ let finalValue = Number(result);
833
+
834
+ // ✅ Check if result is valid, finite, and positive
835
+ if (
836
+ typeof finalValue !== 'number' ||
837
+ !isFinite(finalValue) ||
838
+ finalValue <= 0
839
+ ) {
840
+ console.log('Invalid or non-positive result, not updating');
841
+ return;
842
+ }
843
+
844
+ const amountToSave = finalValue;
845
+ const creditLimit = Number(ClientDetails?.credit_limit || 0);
846
+ const currentBalance = Math.abs(item?.balance || 0);
847
+
848
+ const proceedUpdate = () => {
849
+ updateTransaction(
850
+ item?.id,
851
+ ClientDetails.id,
852
+ type === 'red' ? String(amountToSave) : '0',
853
+ type === 'green' ? String(amountToSave) : '0',
854
+ Notes + `_bill_${BillNo}`,
855
+ mergeDateTime({ date, time }),
856
+ AudioFile,
857
+ SelectedItems?.length > 0 ? JSON.stringify(SelectedItems) : ''
858
+ )
859
+ .then(async (res) => {
860
+ console.log(res, 'Transaction Update Success');
861
+ const trxId = item?.id;
862
+
863
+ // Handle attachments
864
+ if (attachments?.length > 0) {
865
+ try {
866
+ await deleteTransactionImagesByTrxId(trxId);
867
+ console.log(`Previous attachments deleted for trxId: ${trxId}`);
868
+ } catch (err) {
869
+ console.log('Error deleting attachments:', err);
870
+ }
181
871
 
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
872
+ for (const file of attachments) {
873
+ if (file?.uri) {
874
+ try {
875
+ await addTransactionImages(trxId, file.uri);
876
+ console.log(`Attachment added: ${file.name || file.uri}`);
877
+ } catch (err) {
878
+ console.log('Attachment insert error:', err);
879
+ }
201
880
  }
881
+ }
202
882
  } else {
203
- console.log("Empty input, not saving");
204
- return;
883
+ try {
884
+ await deleteTransactionImagesByTrxId(trxId);
885
+ console.log(`No attachments — all deleted for trxId: ${trxId}`);
886
+ } catch (err) {
887
+ console.log('Error deleting attachments:', err);
888
+ }
205
889
  }
206
890
 
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
- }
891
+ // Reset form
892
+ setInput('');
893
+ setMemory([]);
894
+ setNotes('');
895
+ setDate(new Date());
896
+ setTime(new Date());
897
+ setMergedDate('');
898
+ setAttachments([]);
230
899
 
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);
900
+ const transactions = await getClientTransactions(ClientDetails?.id);
901
+ let balance = 0;
902
+ const reversed = [...transactions].reverse();
903
+ const withBalances = reversed.map((t) => {
904
+ const amount = parseFloat(t.amount) || 0;
905
+ const subamount = parseFloat(t.subamount) || 0;
906
+ balance += subamount - amount;
907
+ return { ...t, balance };
908
+ });
909
+
910
+ const filteredTransaction = withBalances.find(
911
+ (t) => t.id === item?.id
912
+ );
913
+
914
+ setSuccessModal(true);
915
+
916
+ setTimeout(() => {
917
+ setSuccessModal(false);
918
+ route.params?.onGoBack({ ...filteredTransaction, balance });
919
+ navigation.goBack();
920
+ }, 2000);
921
+ })
922
+ .catch((err) => console.log(err, 'Transaction Error'));
923
+ };
924
+
925
+ // ✅ Show credit limit popup if needed
926
+ if (
927
+ pay_type === 'payable' &&
928
+ mainColor === 'red' &&
929
+ creditLimit !== 0 &&
930
+ amountToSave + currentBalance > creditLimit
931
+ ) {
932
+ Alert.alert(
933
+ 'Credit Limit Warning',
934
+ `The customer balance will be greater than assigned credit limit Rs ${creditLimit}.\nAre you sure you want to continue?`,
935
+ [
936
+ { text: 'No', style: 'cancel' },
937
+ { text: 'Yes', onPress: proceedUpdate },
938
+ ],
939
+ { cancelable: true }
940
+ );
941
+ } else {
942
+ proceedUpdate();
943
+ }
944
+ } catch (err) {
945
+ console.log('Calculation Error:', err);
946
+ }
947
+ };
948
+
949
+ useEffect(() => {
950
+ const maxValue = 999999999;
951
+
952
+ const numResult = Number(result);
953
+
954
+ // ✅ Only treat input as a number if it’s purely numeric (or decimal)
955
+ const isInputNumeric = /^-?\d*\.?\d+$/.test(input); // matches numbers like 123, -45.6
956
+ const numInput = isInputNumeric ? Number(input) : null;
957
+
958
+ // ✅ check for invalid conditions:
959
+ // 1. result > maxValue or Infinity
960
+ // 2. input > maxValue or Infinity (only if numeric)
961
+ if (
962
+ !isFinite(numResult) || // catches Infinity & NaN in result
963
+ numResult > maxValue ||
964
+ (numInput !== null && (!isFinite(numInput) || numInput > maxValue))
965
+ ) {
966
+ setCalculatorErr('Invalid Amount');
967
+ } else {
968
+ // clear error if values go back to normal
969
+ setCalculatorErr('');
970
+ }
971
+ }, [input, result, history]);
972
+
973
+ const calculateQuantity = (existingQty, newQty, type) => {
974
+ const current = Number(existingQty) || 0;
975
+ const input = Number(newQty) || 0;
976
+
977
+ if (type === 'IN') {
978
+ return current + input; // Add stock
979
+ } else if (type === 'OUT') {
980
+ return current - input; // Reduce stock
981
+ } else {
982
+ return current; // No change if type is invalid
983
+ }
984
+ };
985
+
986
+ const addStockEntry = async (
987
+ itemId,
988
+ stockOUT,
989
+ amount,
990
+ rateSale,
991
+ billNo,
992
+ oldQuantity,
993
+ addedQuantity,
994
+ Details,
995
+ AudioFile,
996
+ date,
997
+ selectBusiness
998
+ ) => {
999
+ try {
1000
+ debugger;
1001
+ const res = await addItemDetails(
1002
+ itemId,
1003
+ '0', // stockIN (since this is stockOUT)
1004
+ stockOUT,
1005
+ amount,
1006
+ rateSale,
1007
+ `${Details}_bill_${String(billNo)}`,
1008
+ AudioFile,
1009
+ fromJsDateToSql(date),
1010
+ selectBusiness?.id,
1011
+ String(billNo)
1012
+ );
1013
+
1014
+ console.log('✅ Transaction Success:', res);
1015
+
1016
+ const updatedQty = calculateQuantity(oldQuantity, addedQuantity, 'OUT');
1017
+ await updateItemQty(itemId, updatedQty);
1018
+
1019
+ const trxId = res?.insertId;
1020
+ console.log('🆔 New Transaction ID:', trxId);
1021
+
1022
+ return trxId; // optional return if you want to use it later
1023
+ } catch (error) {
1024
+ console.error('❌ Error adding entry:', error);
1025
+ }
1026
+ };
1027
+
1028
+ const getAllClientTypes = async () => {
1029
+ try {
1030
+ const [customers, suppliers, banks] = await Promise.all([
1031
+ getClientsByType(0, null, null, selectBusiness?.id),
1032
+ getClientsByType(1, null, null, selectBusiness?.id),
1033
+ getClientsByType(2, null, null, selectBusiness?.id),
1034
+ ]);
1035
+
1036
+ const allClients = [...customers, ...suppliers, ...banks];
1037
+
1038
+ // sort
1039
+ const sortedClients = allClients.sort((a, b) => a.type - b.type);
1040
+ setClients(sortedClients);
1041
+
1042
+ // Map phone -> full client info
1043
+ const phoneMap = new Map();
1044
+ allClients.forEach((c) => {
1045
+ const formatted = formatPhoneNumber(c.phone || '')?.toLowerCase();
1046
+ if (formatted) {
1047
+ phoneMap.set(formatted, {
1048
+ id: c.id,
1049
+ type: c.type,
1050
+ name: c.name,
1051
+ phone: c.phone,
1052
+ });
246
1053
  }
247
- };
1054
+ });
1055
+ setClientPhoneMap(phoneMap);
1056
+ } catch (error) {
1057
+ console.error(error);
1058
+ }
1059
+ };
1060
+
1061
+ const getAllContacts = async () => {
1062
+ if (Platform.OS === 'android') {
1063
+ try {
1064
+ const granted = await PermissionsAndroid.request(
1065
+ PermissionsAndroid.PERMISSIONS.READ_CONTACTS,
1066
+ {
1067
+ title: 'Contacts',
1068
+ message: 'This app would like to view your contacts.',
1069
+ buttonPositive: 'Please accept bare mortal',
1070
+ }
1071
+ );
1072
+
1073
+ if (granted === PermissionsAndroid.RESULTS.GRANTED) {
1074
+ console.log('Contacts permission granted');
1075
+ Contacts.getAll().then((contacts) => {
1076
+ setContacts(contacts);
1077
+ });
1078
+ } else {
1079
+ console.log('Contacts permission denied');
1080
+ return;
1081
+ }
1082
+ } catch (err) {
1083
+ console.warn(err);
1084
+ return;
1085
+ }
1086
+ }
1087
+ };
1088
+
1089
+ const filteredContacts = contacts.filter((item) => {
1090
+ const name = item?.displayName?.toLowerCase() || '';
1091
+ const rawNumber = item?.phoneNumbers?.[0]?.number || '';
1092
+ const formattedNumber = formatPhoneNumber(rawNumber)?.toLowerCase() || '';
1093
+
1094
+ const searchLower = searchText.toLowerCase();
1095
+
1096
+ // Exclude if number matches ClientDetails.phone
1097
+ const clientPhone = ClientDetails?.phone?.toLowerCase() || '';
1098
+
1099
+ // Optional: mapped client type (if needed)
1100
+ const clientType = clientPhoneMap.get(formattedNumber);
1101
+
1102
+ // Skip this contact if it’s the same as ClientDetails
1103
+ if (formattedNumber === clientPhone) return false;
248
1104
 
1105
+ return name.includes(searchLower) || formattedNumber.includes(searchLower);
1106
+ });
249
1107
 
1108
+ const filteredClients = Clients.filter((c) => {
1109
+ const name = c.name?.toLowerCase() || '';
1110
+ const phone = c.phone?.toLowerCase() || '';
1111
+ const searchLower = searchText.toLowerCase();
250
1112
 
1113
+ const clientPhone = ClientDetails?.phone?.toLowerCase() || '';
251
1114
 
1115
+ // Skip if phone matches ClientDetails.phone
1116
+ if (phone === clientPhone) return false;
252
1117
 
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}
1118
+ return name.includes(searchLower) || phone.includes(searchLower);
1119
+ });
1120
+
1121
+ const onPartyPress = async () => {
1122
+ await getAllContacts();
1123
+ await getAllClientTypes();
1124
+ setChangeModal(true);
1125
+ };
1126
+
1127
+ const onContinue = async (name, phoneNUmer) => {
1128
+ // normalize phone
1129
+ const normalizedPhone = phoneNUmer ? String(phoneNUmer).trim() : '';
1130
+ let data = [...clients, ...suppliers];
1131
+
1132
+ console.log({ normalizedPhone })
1133
+
1134
+ try {
1135
+ let clientId;
1136
+ let homeDetails = null;
1137
+
1138
+ // If phone exists → check if already in clients array
1139
+ const isExist =
1140
+ normalizedPhone !== ''
1141
+ ? data?.find((item) => {
1142
+ const itemPhone = item?.phone ? String(item.phone).trim() : '';
1143
+ return itemPhone === normalizedPhone && itemPhone !== '';
1144
+ })
1145
+ : undefined; // no phone → force new client
1146
+
1147
+ if (isExist) {
1148
+ // Existing client found
1149
+ clientId = isExist.id;
1150
+ homeDetails = isExist;
1151
+ } else {
1152
+ console.log('else');
1153
+ // No existing client or no phone given → always create new
1154
+ const res = await addClient(
1155
+ name,
1156
+ normalizedPhone,
1157
+ 0,
1158
+ selectBusiness?.id
1159
+ );
1160
+ setName('');
1161
+ setPhoneNum('');
1162
+ clientId = res?.insertId;
1163
+ }
1164
+
1165
+ const resp = await getClientDetails(clientId);
1166
+ dispatch({ type: CLIENT_DETAILS, payload: resp });
1167
+
1168
+ setSelectedParty(resp);
1169
+ setChangeModal(false);
1170
+
1171
+ // navigation.replace('CustomerEntries', homeDetails ? { homeDetails } : {});
1172
+ } catch (err) {
1173
+ console.log('Error:', err);
1174
+ }
1175
+ };
1176
+
1177
+ useEffect(() => {
1178
+ if (SelectedParty) {
1179
+ setIsCash(false)
1180
+ }
1181
+ }, [SelectedParty])
1182
+
1183
+
1184
+ const memorySum = (Array.isArray(memory) ? memory : []).reduce((acc, val) => acc + val, 0);
1185
+
1186
+
1187
+
1188
+ return (
1189
+ <View style={Styles._mainContainers}>
1190
+ <LinearGradient
1191
+ start={{ x: 0, y: 0 }}
1192
+ end={{ x: 1, y: 0 }}
1193
+ colors={[mainColor == "red" ? COLORS.redColor : COLORS.greenColor, mainColor == "red" ? COLORS.redColor : COLORS.greenColor]}
1194
+ style={Styles._linearGradient}
1195
+ >
1196
+ <View style={Styles._titleMain}>
1197
+ <TouchableOpacity
1198
+ activeOpacity={0.8}
1199
+ style={{ padding: 5 }}
1200
+ onPress={() => {
1201
+ navigation.goBack();
1202
+ }}
1203
+ >
1204
+ <Ionicons
1205
+ name={'chevron-back'}
1206
+ color={COLORS.whiteColor}
1207
+ size={60 / PixelRatio.get()}
1208
+ />
1209
+ </TouchableOpacity>
1210
+ {ClientDetails.type == 0 ? (
1211
+ <Text numberOfLines={1} style={[Styles._title, { width: '90%' }]}>
1212
+ You {mainColor == 'green' ? 'Got' : 'Gave'} Rs{' '}
1213
+ {!isNaN(result) && isFinite(result) && result >= 0
1214
+ ? addCommas(Number(result))
1215
+ : 0}
1216
+ {mainColor == 'green' ? ' from' : ' to'} {ClientDetails?.name}
1217
+ </Text>
1218
+ ) : ClientDetails?.type == 1 ? (
1219
+ <Text numberOfLines={1} style={Styles._title}>
1220
+ {mainColor == 'green' ? 'Purchase' : 'Payment'} of Rs{' '}
1221
+ {!isNaN(result) && isFinite(result) && result >= 0
1222
+ ? addCommas(Number(result))
1223
+ : 0}{' '}
1224
+ {mainColor == 'green' ? 'from' : ' to'} {ClientDetails?.name}
1225
+ </Text>
1226
+ ) : (
1227
+ <Text
1228
+ numberOfLines={1}
1229
+ ellipsizeMode="tail"
1230
+ style={[Styles._title, { width: '85%' }]} // fixed width + same styling
1231
+ >
1232
+ {ClientDetails?.phone} - {mainColor == 'red' ? 'In' : 'Out'}
1233
+ </Text>
1234
+ )}
1235
+ </View>
1236
+ </LinearGradient>
1237
+
1238
+ <View style={Styles._contentMain}>
1239
+ <View style={{ width: '100%', alignItems: 'center', gap: 12 }}>
1240
+ <ScrollView
1241
+ contentContainerStyle={Styles._scrollMain}
1242
+ // style={{ paddingBottom:1000 }}
1243
+ >
1244
+ {/* Input with backspace */}
1245
+ <TouchableOpacity
1246
+ style={Styles._inputMain}
1247
+ activeOpacity={0.8}
1248
+ onPress={() => Keyboard.dismiss()}
260
1249
  >
261
- <View style={Styles._titleMain}>
1250
+ <Text
1251
+ style={{
1252
+ color: COLORS.blackColor,
1253
+ fontFamily: FONT_NORMAL,
1254
+ fontSize: 14,
1255
+ opacity: 0.6,
1256
+ }}
1257
+ >
1258
+ Rs
1259
+ </Text>
1260
+ <TextInput
1261
+ placeholder=""
1262
+ style={[
1263
+ Styles._input,
1264
+ {
1265
+ color: mainColor == "red" ? COLORS.redColor : COLORS.greenColor,
1266
+ },
1267
+ ]}
1268
+ placeholderTextColor={COLORS.grey}
1269
+ cursorColor={COLORS.primaryColor}
1270
+ value={input}
1271
+ editable={false}
1272
+ onFocus={() => Keyboard.dismiss()}
1273
+ maxLength={9}
1274
+ />
1275
+ <TouchableOpacity onPress={handleBackspace}>
1276
+ <Text
1277
+ style={{ fontSize: 18, color: '#555', paddingHorizontal: 8 }}
1278
+ >
1279
+
1280
+ </Text>
1281
+ </TouchableOpacity>
1282
+ </TouchableOpacity>
1283
+
1284
+ {(
1285
+ (result && result !== null && result != 0 && history && (() => {
1286
+ const lastOpIndex = Math.max(
1287
+ history.lastIndexOf('+'),
1288
+ history.lastIndexOf('-'),
1289
+ history.lastIndexOf('*'),
1290
+ history.lastIndexOf('/'),
1291
+ history.lastIndexOf('x'),
1292
+ history.lastIndexOf('÷'),
1293
+ history.lastIndexOf('%')
1294
+ );
1295
+ return lastOpIndex !== -1; // show if there's at least one operator
1296
+ })()) || (memory && memory.length > 0)
1297
+ ) && (
1298
+ <View
1299
+ style={[
1300
+ Styles._memoryDisplay,
1301
+ {
1302
+ paddingRight: 15,
1303
+ paddingLeft: 15,
1304
+ minHeight: 60,
1305
+ height: "auto"
1306
+ },
1307
+ ]}
1308
+ >
1309
+ <View
1310
+ style={{
1311
+ flexDirection: 'row',
1312
+ justifyContent: 'space-between',
1313
+ alignItems: 'center',
1314
+ width: "100%",
1315
+ paddingVertical: 5,
1316
+ borderColor: COLORS.darkGrey,
1317
+ borderBottomWidth: 0.7
1318
+ }}
1319
+ >
1320
+ <Text
1321
+ style={{
1322
+ color: COLORS.darkGrey,
1323
+ fontFamily: FONT_NORMAL,
1324
+ fontSize: 11,
1325
+ width: '60%',
1326
+ }}
1327
+ >
1328
+ {history}
1329
+ </Text>
1330
+ <Text
1331
+ style={{
1332
+ color: COLORS.darkGrey,
1333
+ fontFamily: FONT_NORMAL,
1334
+ fontSize: 11,
1335
+ }}
1336
+ >
1337
+ ={result}
1338
+ </Text>
1339
+ </View>
1340
+
1341
+ {memory?.map((mem, index) => (
1342
+ <Text
1343
+ style={{
1344
+ color: COLORS.darkGrey,
1345
+ fontFamily: FONT_NORMAL,
1346
+ fontSize: 11,
1347
+ width: '60%',
1348
+ marginTop: 5
1349
+ }}
1350
+ key={index}
1351
+ >
1352
+ (M) = {mem}
1353
+ </Text>
1354
+ ))}
1355
+ </View>
1356
+ )}
1357
+
1358
+ {CalculatorErr && CalculatorErr !== null && (
1359
+ <View
1360
+ style={[
1361
+ Styles._memoryDisplay,
1362
+ { borderColor: COLORS.redColor },
1363
+ ]}
1364
+ >
1365
+ <Text
1366
+ style={[
1367
+ Styles._memoryText,
1368
+ {
1369
+ fontFamily: FONT_MEDIUM,
1370
+ color: COLORS.redColor,
1371
+ fontSize: 13,
1372
+ },
1373
+ ]}
1374
+ >
1375
+ {CalculatorErr}
1376
+ </Text>
1377
+ </View>
1378
+ )}
1379
+
1380
+ {/* Attach Voice Note */}
1381
+ <TouchableOpacity
1382
+ style={[Styles._inputMain, { paddingHorizontal: 12 }]}
1383
+ activeOpacity={0.8}
1384
+ onPress={() => {
1385
+ !AudioFile && askAudioPermission();
1386
+ }}
1387
+ >
1388
+ {AudioFile ? (
1389
+ <>
1390
+ {PlayLoading ? (
1391
+ <ActivityIndicator
1392
+ color={mainColor == 'red' ? COLORS.redColor : COLORS.greenColor}
1393
+ size={'small'}
1394
+ animating
1395
+ />
1396
+ ) : (
262
1397
  <TouchableOpacity
263
- activeOpacity={0.8}
264
- onPress={() => { navigation.goBack() }}
1398
+ activeOpacity={0.8}
1399
+ onPress={() => {
1400
+ if (IsPlaying) {
1401
+ Sound.stopPlayer();
1402
+ Sound.removePlayBackListener();
1403
+ Sound.removePlaybackEndListener();
1404
+ setIsPlaying(false);
1405
+ animationRef.current?.pause();
1406
+ } else {
1407
+ onStartPlay(AudioFile);
1408
+ }
1409
+ }}
265
1410
  >
266
- <Ionicons
267
- name={"chevron-back"}
268
- color={COLORS.whiteColor}
269
- size={20}
270
- />
1411
+ <Ionicons
1412
+ color={mainColor == 'red' ? COLORS.redColor : COLORS.greenColor}
1413
+ size={22}
1414
+ name={IsPlaying ? 'pause' : 'play'}
1415
+ />
271
1416
  </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>
1417
+ )}
1418
+
1419
+ <LottieView
1420
+ source={require('../assets/animations/voice_visualization.json')}
1421
+ autoPlay={false}
1422
+ loop
1423
+ style={{ width: '80%', height: 42 }}
1424
+ ref={animationRef}
1425
+ />
1426
+
1427
+ <TouchableOpacity
1428
+ activeOpacity={0.8}
1429
+ onPress={async () => {
1430
+ try {
1431
+ await onPauseRecord();
1432
+ setAudioFile('');
1433
+ setIsPlaying(false);
1434
+ } catch (err) {
1435
+ console.error(
1436
+ 'Error stopping audio before clearing:',
1437
+ err
1438
+ );
1439
+ }
1440
+ }}
1441
+ >
1442
+ <Ionicons
1443
+ color={mainColor == 'red' ? COLORS.redColor : COLORS.greenColor}
1444
+ size={22}
1445
+ name={'close'}
1446
+ />
1447
+ </TouchableOpacity>
1448
+ </>
1449
+ ) : (
1450
+ <>
1451
+ <Text
1452
+ style={{
1453
+ color: mainColor == 'red' ? COLORS.redColor : COLORS.greenColor,
1454
+ fontSize: 13,
1455
+ fontFamily: FONT_MEDIUM,
1456
+ }}
1457
+ >
1458
+ Attach Voice Note
1459
+ </Text>
1460
+ <Ionicons
1461
+ name={'mic-outline'}
1462
+ color={mainColor == 'red' ? COLORS.redColor : COLORS.greenColor}
1463
+ size={22}
1464
+ />
1465
+ </>
1466
+ )}
1467
+ </TouchableOpacity>
279
1468
 
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) }}
1469
+ {/*Add Items */}
1470
+ <TouchableOpacity
1471
+ activeOpacity={0.8}
1472
+ style={[Styles._inputMain, { paddingHorizontal: 12 }]}
1473
+ // style={Styles._textInputParty}
1474
+ onPress={() => {
1475
+ navigation.navigate('AddItems', {
1476
+ selectedItems: SelectedItems,
1477
+ totalAmount: totalAmount,
1478
+ onSelect: (newSelectedItems, newTotalAmount) => {
1479
+ setSelectedItems(newSelectedItems);
1480
+ setTotalAmount(newTotalAmount);
1481
+ setAmount(String(newTotalAmount));
1482
+ setInput(String(newTotalAmount));
1483
+ setResult(String(newTotalAmount));
1484
+ },
1485
+ });
1486
+ }}
1487
+ >
1488
+ <Text
1489
+ style={[
1490
+ Styles._inputText,
1491
+ { color: mainColor == "red" ? COLORS.redColor : COLORS.greenColor, fontFamily: FONT_MEDIUM },
1492
+ ]}
1493
+ >
1494
+ Add Items
1495
+ </Text>
1496
+ <Ionicons
1497
+ name={'chevron-forward'}
1498
+ color={mainColor == "red" ? COLORS.redColor : COLORS.greenColor}
1499
+ size={20}
1500
+ />
1501
+ </TouchableOpacity>
1502
+
1503
+ {SelectedItems?.length > 0 && (
1504
+ <View style={{ width: '100%' }}>
1505
+ <View style={Styles._itemHeaderMain}>
1506
+ <View style={{ width: '30%' }}>
1507
+ <Text
1508
+ style={{
1509
+ color: COLORS.gray,
1510
+ fontFamily: FONT_NORMAL,
1511
+ fontSize: 12,
1512
+ }}
1513
+ >
1514
+ ITEM
1515
+ </Text>
1516
+ </View>
1517
+
1518
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1519
+ <Text
1520
+ style={{
1521
+ color: COLORS.gray,
1522
+ fontFamily: FONT_NORMAL,
1523
+ fontSize: 12,
1524
+ }}
285
1525
  >
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>
1526
+ QTY
1527
+ </Text>
1528
+ </View>
1529
+
1530
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1531
+ <Text
1532
+ style={{
1533
+ color: COLORS.gray,
1534
+ fontFamily: FONT_NORMAL,
1535
+ fontSize: 12,
1536
+ }}
1537
+ >
1538
+ RATE
1539
+ </Text>
1540
+ </View>
1541
+
1542
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1543
+ <Text
1544
+ style={{
1545
+ color: COLORS.gray,
1546
+ fontFamily: FONT_NORMAL,
1547
+ fontSize: 12,
1548
+ }}
1549
+ >
1550
+ AMOUNT
1551
+ </Text>
1552
+ </View>
1553
+ </View>
1554
+ {SelectedItems?.map((i, index) => (
1555
+ <View key={index} style={Styles._itemHeaderMain}>
1556
+ <View style={{ width: '30%' }}>
1557
+ <Text
1558
+ style={{
1559
+ color: COLORS.blackColor,
1560
+ fontFamily: FONT_NORMAL,
1561
+ fontSize: 12,
1562
+ }}
1563
+ >
1564
+ {i?.name}
1565
+ </Text>
1566
+ </View>
1567
+
1568
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1569
+ <Text
1570
+ style={{
1571
+ color: COLORS.blackColor,
1572
+ fontFamily: FONT_NORMAL,
1573
+ fontSize: 12,
1574
+ }}
1575
+ >
1576
+ {addCommas(Number(i?.addedQty))}
1577
+ </Text>
1578
+ </View>
1579
+
1580
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1581
+ <Text
1582
+ style={{
1583
+ color: COLORS.blackColor,
1584
+ fontFamily: FONT_NORMAL,
1585
+ fontSize: 12,
1586
+ }}
1587
+ >
1588
+ {addCommas(Number(i?.addedRate))}
1589
+ </Text>
1590
+ </View>
1591
+
1592
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1593
+ <Text
1594
+ style={{
1595
+ color: COLORS.blackColor,
1596
+ fontFamily: FONT_NORMAL,
1597
+ fontSize: 12,
1598
+ }}
1599
+ >
1600
+ {addCommas(
1601
+ Number(i?.addedQty) * Number(i?.addedRate)
308
1602
  )}
1603
+ </Text>
1604
+ </View>
1605
+ </View>
1606
+ ))}
1607
+ </View>
1608
+ )}
1609
+ {input && (
1610
+ <View style={Styles._hidableMain}>
1611
+ {/* <View style={Styles._hidableRow}> */}
1612
+ <View style={Styles._hidableRow}>
1613
+ <TouchableOpacity
1614
+ style={[Styles._cellMains, { width: '49%' }]}
1615
+ // activeOpacity={0.8}
1616
+ // onPress={showDate}
1617
+ >
1618
+ <FloatingInput
1619
+ label="Date"
1620
+ value={date.toDateString()}
1621
+ editable={false}
1622
+ placeholder="Select City"
1623
+ iconName="calendar-outline"
1624
+ iconPosition="right"
1625
+ onPress={showDate} // 👈 opens modal
1626
+ inputStyle={{ fontSize: 11, fontFamily: FONT_MEDIUM }} // 👈 customize font
1627
+ iconColor={mainColor == 'red' ? COLORS.redColor : COLORS.greenColor}
1628
+ />
1629
+ </TouchableOpacity>
1630
+
1631
+ <TouchableOpacity
1632
+ style={[Styles._cellMains, { width: '49%' }]}
1633
+ activeOpacity={0.8}
1634
+ // onPress={showTime}
1635
+ >
1636
+ {/* <Text style={Styles._cellText}>
1637
+ {time.toLocaleTimeString()}
1638
+ </Text>
1639
+ <Ionicons
1640
+ name={'time-outline'}
1641
+ color={
1642
+ mainColor == 'red' ? COLORS.redColor : COLORS.greenColor
1643
+ }
1644
+ size={22}
1645
+ /> */}
1646
+
1647
+ <FloatingInput
1648
+ label="Time"
1649
+ value={time.toLocaleTimeString()}
1650
+ editable={false}
1651
+ placeholder="Time"
1652
+ iconName="time-outline"
1653
+ iconPosition="right"
1654
+ onPress={showTime} // 👈 opens modal
1655
+ inputStyle={{ fontSize: 11, fontFamily: FONT_MEDIUM }} // 👈 customize font
1656
+ iconColor={mainColor == 'red' ? COLORS.redColor : COLORS.greenColor}
1657
+ />
1658
+ </TouchableOpacity>
1659
+ </View>
1660
+ {/* </View> */}
309
1661
 
310
- {/* Attach Voice Note */}
1662
+ {/* <TextInput
1663
+ style={Styles._detailMain}
1664
+ placeholder="Enter Details"
1665
+ placeholderTextColor={COLORS.grey}
1666
+ multiline
1667
+ value={Notes}
1668
+ onChangeText={(text) => setNotes(text)}
1669
+ maxLength={300}
1670
+ /> */}
1671
+
1672
+ <View style={{ width: '90%' }}>
1673
+ <FloatingInput
1674
+ label="Enter Details"
1675
+ iconName=""
1676
+ iconPosition="right"
1677
+ value={Notes}
1678
+ onChangeText={(text) => setNotes(text)}
1679
+
1680
+ // allowedChars={/[^A-Za-z0-9\s]/g}
1681
+ // maxLength={15}
1682
+ />
1683
+ </View>
1684
+
1685
+ {/* <TextInput
1686
+ placeholder="Bill No"
1687
+ style={Styles._billNoMain}
1688
+ placeholderTextColor={COLORS.gray}
1689
+ value={BillNo}
1690
+ onChangeText={(text) => setBillNo(text)}
1691
+ maxLength={10}
1692
+ /> */}
1693
+
1694
+ <View style={{ width: '90%' }}>
1695
+ <FloatingInput
1696
+ label="Bill No"
1697
+ iconName=""
1698
+ iconPosition="right"
1699
+ value={BillNo}
1700
+ onChangeText={(text) => setBillNo(text)}
1701
+ // allowedChars={/[^A-Za-z0-9\s]/g}
1702
+ // maxLength={15}
1703
+ />
1704
+ </View>
1705
+
1706
+ {/* Attachments */}
1707
+ <View style={Styles._hidableRow}>
1708
+ <TouchableOpacity
1709
+ style={Styles._cellMain}
1710
+ activeOpacity={0.8}
1711
+ onPress={() => setIsModalVisible(true)}
1712
+ >
1713
+ <Text style={Styles._cellText}>PDF/Photos</Text>
1714
+ <Ionicons
1715
+ name={'attach'}
1716
+ color={mainColor == "red" ? COLORS.redColor : COLORS.greenColor}
1717
+ size={23}
1718
+ />
1719
+ </TouchableOpacity>
1720
+
1721
+ <View
1722
+ style={{
1723
+ flexDirection: 'row',
1724
+ flexWrap: 'wrap',
1725
+ alignItems: 'center',
1726
+ }}
1727
+ >
1728
+ {attachments.map((file, index) => (
1729
+ <View
1730
+ key={index}
1731
+ style={{ marginLeft: 8, alignItems: 'center' }}
1732
+ >
1733
+ {file.type === 'image' ? (
1734
+ <Image
1735
+ source={{ uri: file.uri }}
1736
+ style={{ width: 40, height: 40, borderRadius: 5 }}
1737
+ />
1738
+ ) : (
1739
+ <Ionicons
1740
+ name="document-text-outline"
1741
+ size={40}
1742
+ color={COLORS.primaryColor}
1743
+ />
1744
+ )}
1745
+ {/* delete cross */}
311
1746
  <TouchableOpacity
312
- style={[Styles._inputMain, { paddingHorizontal: 12 }]}
313
- activeOpacity={0.8}
1747
+ onPress={() => removeAttachment(index)}
1748
+ style={{
1749
+ position: 'absolute',
1750
+ top: -5,
1751
+ right: -5,
1752
+ backgroundColor: 'white',
1753
+ borderRadius: 10,
1754
+ padding: 2,
1755
+ }}
314
1756
  >
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
- />
1757
+ <Ionicons
1758
+ name="close-circle"
1759
+ size={18}
1760
+ color={COLORS.redColor}
1761
+ />
321
1762
  </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>
1763
+ </View>
1764
+ ))}
1765
+ </View>
1766
+ </View>
405
1767
 
406
- {/* Save button (non-functional) */}
1768
+ <View style={Styles._hidableRow}>
1769
+ <View style={[Styles._cellMain, { flexDirection: "row", backgroundColor: COLORS.whiteColor, paddingHorizontal: 0, overflow: "hidden" }]}>
407
1770
  <TouchableOpacity
408
- activeOpacity={0.8}
409
- style={[Styles._continueBtn, { backgroundColor: mainColor }]}
410
- onPress={onSave}
1771
+ activeOpacity={0.8}
1772
+ onPress={() => setIsCash(true)}
1773
+ style={{
1774
+ width: "50%",
1775
+ height: "100%",
1776
+ justifyContent: "center",
1777
+ alignItems: "center",
1778
+ backgroundColor: IsCash ? COLORS.primaryBase : COLORS.whiteColor
1779
+ }}
1780
+ >
1781
+ <Text style={{ color: COLORS.blackColor, fontFamily: FONT_NORMAL, fontSize: 12 }}>
1782
+ Cash
1783
+ </Text>
1784
+ <View
1785
+ style={{
1786
+ position: "absolute",
1787
+ right: 0,
1788
+ height: "60%",
1789
+ width: 1,
1790
+ backgroundColor: COLORS.darkGrey,
1791
+ }}
1792
+ />
1793
+ </TouchableOpacity>
1794
+
1795
+ <TouchableOpacity
1796
+ activeOpacity={0.8}
1797
+ style={{
1798
+ width: "50%",
1799
+ height: "100%",
1800
+ justifyContent: "center",
1801
+ alignItems: "center",
1802
+ backgroundColor: SelectedParty ? COLORS.primaryBase : COLORS.whiteColor
1803
+ }}
1804
+ onPress={onPartyPress}
411
1805
  >
412
- <Text style={Styles._continueBtnTxt}>Save</Text>
1806
+ <Text style={{ color: COLORS.blackColor, fontFamily: FONT_NORMAL, fontSize: 12 }}>
1807
+ Party
1808
+ </Text>
413
1809
  </TouchableOpacity>
1810
+ </View>
1811
+ {
1812
+ SelectedParty &&
1813
+ <View style={[Styles._cellMain, { flexDirection: "row", backgroundColor: COLORS.whiteColor, overflow: "hidden", paddingHorizontal: 10 }]}>
1814
+ <Ionicons
1815
+ name={"person-circle-outline"}
1816
+ color={COLORS.primaryColor}
1817
+ size={25}
1818
+ />
414
1819
 
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
- ))}
1820
+ <Text
1821
+ style={{ color: COLORS.blackColor, fontFamily: FONT_NORMAL, fontSize: 12, textAlign: "center", maxWidth: "60%", }}
1822
+ numberOfLines={1}
1823
+ >{SelectedParty?.name}</Text>
1824
+
1825
+ <TouchableOpacity
1826
+ activeOpacity={0.8}
1827
+ onPress={() => setSelectedParty(null)}
1828
+ >
1829
+ <Ionicons
1830
+ name={"close"}
1831
+ color={COLORS.blackColor}
1832
+ size={22}
1833
+ />
1834
+ </TouchableOpacity>
437
1835
  </View>
1836
+ }
438
1837
  </View>
439
- </View>
440
1838
 
441
- {/* Modal */}
442
- <Modal
443
- isVisible={isModalVisible}
444
- onBackdropPress={() => setIsModalVisible(false)}
445
- onBackButtonPress={() => setIsModalVisible(false)}
1839
+ </View>
1840
+ )}
1841
+ </ScrollView>
1842
+ </View>
1843
+ </View>
1844
+
1845
+ {/* Calculator */}
1846
+ <View
1847
+ style={{
1848
+ width: '92%',
1849
+ alignItems: 'center',
1850
+ gap: 20,
1851
+ position: 'absolute',
1852
+ bottom: insets.bottom,
1853
+ paddingBottom: 10,
1854
+ backgroundColor: COLORS.whiteColor,
1855
+ }}
1856
+ >
1857
+ {
1858
+ memory?.length > 0 ?
1859
+ <TouchableOpacity
1860
+ activeOpacity={0.8}
1861
+ style={[
1862
+ Styles._continueBtn,
1863
+ {
1864
+ backgroundColor: mainColor == "red" ? COLORS.redColor : COLORS.greenColor,
1865
+ },
1866
+ ]}
1867
+ onPress={() => {
1868
+ setInput(String(Math.abs(memorySum)))
1869
+ setResult(String(Math.abs(memorySum)))
1870
+ setHistory('')
1871
+ setMemory([])
1872
+ }}
446
1873
  >
447
- <View style={{ backgroundColor: "white", padding: 20, borderRadius: 12 }}>
448
- <Text style={{ fontSize: 16, fontFamily: FONT_MEDIUM, marginBottom: 12 }}>Choose Option</Text>
1874
+ <Text style={Styles._continueBtnTxt}>MR = {memorySum}</Text>
1875
+ </TouchableOpacity> :
1876
+ <TouchableOpacity
1877
+ activeOpacity={0.8}
1878
+ style={[
1879
+ Styles._continueBtn,
1880
+ {
1881
+ backgroundColor: mainColor == "red" ? COLORS.redColor : COLORS.greenColor,
1882
+ },
1883
+ ]}
1884
+ onPress={item ? onUpdate : onSave}
1885
+ >
1886
+ <Text style={Styles._continueBtnTxt}>Save</Text>
1887
+ </TouchableOpacity>
449
1888
 
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>
1889
+ }
1890
+ {!keyboardVisible && (
1891
+ <View style={Styles._calculatorMain}>
1892
+ {buttons.map((row, rowIndex) => (
1893
+ <View style={Styles._calculatorRow} key={rowIndex}>
1894
+ {row.map((key) => (
1895
+ <TouchableOpacity
1896
+ key={key}
1897
+ activeOpacity={0.8}
1898
+ style={[
1899
+ Styles._key,
1900
+ key === '0' && { flex: 2 },
1901
+ ['AC', 'M+', 'M-', 'MR'].includes(key) && {
1902
+ backgroundColor: '#ccc',
1903
+ },
1904
+ ['=', '⌫'].includes(key) && {
1905
+ backgroundColor: COLORS.gray,
1906
+ },
1907
+ ['÷', 'x', '-', '+', '%'].includes(key) && {
1908
+ backgroundColor: '#ccc',
1909
+ },
1910
+ ]}
1911
+ onPress={() => {
1912
+ handlePress(key)
1913
+ }}
1914
+ >
1915
+ <Text style={Styles._keyText}>{key}</Text>
1916
+ </TouchableOpacity>
1917
+ ))}
1918
+ </View>
1919
+ ))}
1920
+ </View>
1921
+ )}
1922
+ </View>
454
1923
 
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>
1924
+ {/* Modal */}
1925
+ <Modal
1926
+ isVisible={isModalVisible}
1927
+ onBackdropPress={() => setIsModalVisible(false)}
1928
+ onBackButtonPress={() => setIsModalVisible(false)}
1929
+ >
1930
+ <View
1931
+ style={{ backgroundColor: 'white', padding: 20, borderRadius: 12 }}
1932
+ >
1933
+ <Text
1934
+ style={{ fontSize: 16, fontFamily: FONT_MEDIUM, marginBottom: 12 }}
1935
+ >
1936
+ Choose Option
1937
+ </Text>
459
1938
 
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>
1939
+ <TouchableOpacity style={Styles._modalBtn} onPress={handleGallery}>
1940
+ <Ionicons name="image-outline" size={20} color="red" />
1941
+ <Text style={Styles._modalText}>Gallery</Text>
1942
+ </TouchableOpacity>
1943
+
1944
+ <TouchableOpacity style={Styles._modalBtn} onPress={handleCamera}>
1945
+ <Ionicons name="camera-outline" size={20} color="red" />
1946
+ <Text style={Styles._modalText}>Camera</Text>
1947
+ </TouchableOpacity>
1948
+
1949
+ <TouchableOpacity style={Styles._modalBtn} onPress={handlePDF}>
1950
+ <Ionicons name="document-outline" size={20} color="red" />
1951
+ <Text style={Styles._modalText}>PDF</Text>
1952
+ </TouchableOpacity>
1953
+ </View>
1954
+ </Modal>
1955
+
1956
+ <Modal
1957
+ isVisible={IsSoundModal}
1958
+ // onBackdropPress={() => setIsSoundModal(false)}
1959
+ // onBackButtonPress={() => setIsSoundModal(false)}
1960
+ >
1961
+ <View style={Styles._voiceModalMain}>
1962
+ <Text
1963
+ style={{
1964
+ color: COLORS.blackColor,
1965
+ fontFamily: FONT_MEDIUM,
1966
+ fontSize: 18,
1967
+ }}
1968
+ >
1969
+ DigiKhata
1970
+ </Text>
1971
+
1972
+ <LottieView
1973
+ style={{ width: 130, height: 130 }}
1974
+ source={require('../assets/animations/recording.json')}
1975
+ autoPlay
1976
+ loop
1977
+ />
1978
+
1979
+ <Text
1980
+ style={{
1981
+ color: COLORS.blackColor,
1982
+ fontFamily: FONT_NORMAL,
1983
+ fontSize: 13,
1984
+ opacity: 0.6,
1985
+ }}
1986
+ >
1987
+ Recording
1988
+ </Text>
1989
+
1990
+ <View
1991
+ style={{
1992
+ flexDirection: 'row',
1993
+ width: '50%',
1994
+ justifyContent: 'space-between',
1995
+ alignItems: 'center',
1996
+ }}
1997
+ >
1998
+ <TouchableOpacity
1999
+ style={Styles._voiceBtn}
2000
+ activeOpacity={0.8}
2001
+ onPress={() => {
2002
+ onStopRecord(true);
2003
+ }}
2004
+ >
2005
+ <Ionicons
2006
+ name={'trash-outline'}
2007
+ color={COLORS.blackColor}
2008
+ size={22}
2009
+ />
2010
+ </TouchableOpacity>
2011
+
2012
+ <Text>{RecordingTime}</Text>
2013
+
2014
+ <TouchableOpacity
2015
+ style={Styles._voiceBtn}
2016
+ activeOpacity={0.8}
2017
+ onPress={() => {
2018
+ onStopRecord(false);
2019
+ }}
2020
+ >
2021
+ <Ionicons name={'stop'} color={COLORS.blackColor} size={22} />
2022
+ </TouchableOpacity>
2023
+ </View>
2024
+ </View>
2025
+ </Modal>
2026
+
2027
+ <Modal
2028
+ isVisible={SuccessModal}
2029
+ coverScreen
2030
+ style={{ margin: 0, padding: 0 }}
2031
+ animationInTiming={100}
2032
+ animationOutTiming={100}
2033
+ >
2034
+ <View
2035
+ style={{
2036
+ width: WP(100),
2037
+ height: HP(100),
2038
+ backgroundColor: COLORS.whiteColor,
2039
+ justifyContent: 'center',
2040
+ alignItems: 'center',
2041
+ }}
2042
+ >
2043
+ <LottieView
2044
+ source={require('../assets/animations/success.json')}
2045
+ style={{ width: 120, height: 120 }}
2046
+ autoPlay
2047
+ loop={false}
2048
+ />
2049
+
2050
+ <Text
2051
+ style={{ color: '#00C985', fontFamily: FONT_MEDIUM, fontSize: 15 }}
2052
+ >
2053
+ Transaction Saved
2054
+ </Text>
2055
+ </View>
2056
+ </Modal>
2057
+
2058
+ <Modal
2059
+ isVisible={ChangeModal}
2060
+ onBackButtonPress={() => {
2061
+ setShowNewBtn(false);
2062
+ setChangeModal(false);
2063
+ }}
2064
+ onBackdropPress={() => {
2065
+ setShowNewBtn(false);
2066
+ setChangeModal(false);
2067
+ }}
2068
+ avoidKeyboard={false}
2069
+ >
2070
+ <View style={Styles._changeModalMain}>
2071
+ <View style={Styles._changeModalHeader}>
2072
+ <Text style={Styles._changeModalHeaderTxt}>Select Party</Text>
2073
+ </View>
2074
+ <View style={Styles._modalSearchMain}>
2075
+ <TextInput
2076
+ style={Styles._modalSearch}
2077
+ cursorColor={COLORS.primaryColor}
2078
+ placeholder={
2079
+ ShowNewBtn
2080
+ ? filteredContacts?.length && filteredContacts.length != 0
2081
+ ? 'Search Contacts'
2082
+ : 'Type Customer Names'
2083
+ : 'Search Clients'
2084
+ }
2085
+ value={searchText}
2086
+ onChangeText={setSearchText}
2087
+ placeholderTextColor={COLORS.gray}
2088
+ />
2089
+ </View>
2090
+
2091
+ <View style={Styles._modalSearchMain}>
2092
+ {!ShowNewBtn ? (
2093
+ <TouchableOpacity
2094
+ style={Styles._addContactBtn}
2095
+ activeOpacity={0.8}
2096
+ onPress={() => setShowNewBtn(true)}
2097
+ >
2098
+ <View style={Styles._avatarMain}>
2099
+ <Ionicons
2100
+ name="person-add-outline"
2101
+ color={COLORS.primaryColor}
2102
+ size={22}
2103
+ />
464
2104
  </View>
465
- </Modal>
466
2105
 
2106
+ <View style={{ width: '70%' }}>
2107
+ <Text
2108
+ style={{
2109
+ color: COLORS.primaryColor,
2110
+ fontFamily: FONT_NORMAL,
2111
+ fontSize: 12,
2112
+ }}
2113
+ >
2114
+ Add New Customer
2115
+ </Text>
2116
+ </View>
2117
+
2118
+ <Ionicons
2119
+ name="chevron-forward"
2120
+ color={COLORS.primaryColor}
2121
+ size={22}
2122
+ />
2123
+ </TouchableOpacity>
2124
+ ) : (
2125
+ <View style={Styles._phoneInputMain}>
2126
+ <CountryPhoneInput
2127
+ contentContainerStyle={{ width: '100%' }}
2128
+ onChange={(text) => {
2129
+ setPhoneNum(text?.fullNumber);
2130
+ }}
2131
+ />
2132
+
2133
+ <TouchableOpacity
2134
+ activeOpacity={0.8}
2135
+ onPress={() => {
2136
+ if (searchText.trim()) {
2137
+ onContinue(searchText, PhoneNum);
2138
+ }
2139
+ }}
2140
+ style={[
2141
+ Styles._modalBtn,
2142
+ {
2143
+ backgroundColor: searchText?.trim()
2144
+ ? COLORS.primaryColor
2145
+ : COLORS.gray,
2146
+ width: '100%',
2147
+ justifyContent: 'center',
2148
+ paddingVertical: 15,
2149
+ },
2150
+ ]}
2151
+ >
2152
+ <Text
2153
+ style={{
2154
+ color: COLORS.whiteColor,
2155
+ fontFamily: FONT_NORMAL,
2156
+ fontSize: 12,
2157
+ }}
2158
+ >
2159
+ CONTINUE
2160
+ </Text>
2161
+ </TouchableOpacity>
2162
+ </View>
2163
+ )}
2164
+ </View>
2165
+ {!ShowNewBtn ? (
2166
+ <ScrollView
2167
+ contentContainerStyle={{
2168
+ alignItems: 'center',
2169
+ }}
2170
+ >
2171
+ {filteredClients?.length === 0 ? (
2172
+ <View
2173
+ style={{
2174
+ height: 300,
2175
+ justifyContent: 'center',
2176
+ alignItems: 'center',
2177
+ }}
2178
+ >
2179
+ <Text
2180
+ style={{
2181
+ textAlign: 'center',
2182
+ color: COLORS.blackColor,
2183
+ fontFamily: FONT_MEDIUM,
2184
+ fontSize: 13,
2185
+ }}
2186
+ >
2187
+ No Records Found
2188
+ </Text>
2189
+ </View>
2190
+ ) : (
2191
+ filteredClients.map((item, index) => {
2192
+ let amount = item?.total_subamount - item?.total_amount;
2193
+
2194
+ let type = 'none';
2195
+ if (amount > 0) {
2196
+ type = 'receivable';
2197
+ } else if (amount < 0) {
2198
+ type = 'payable';
2199
+ }
2200
+
2201
+ amount = Math.abs(amount);
2202
+
2203
+ return (
2204
+ <User
2205
+ key={index}
2206
+ name={item?.name}
2207
+ addedAt={formatDateTime(
2208
+ item?.latest_transaction_date || item?.created_at
2209
+ )}
2210
+ amount={amount}
2211
+ type={type}
2212
+ avatarColor={item?.type == 0 ? 'red' : 'green'}
2213
+ clientType={item?.type}
2214
+ icon={item?.local_path}
2215
+ mainContainer={{ width: '90%' }}
2216
+ onPress={() => {
2217
+ setShowNewBtn(false);
2218
+ setChangeModal(false);
2219
+ setSelectedParty(item);
2220
+ }}
2221
+ />
2222
+ );
2223
+ })
2224
+ )}
2225
+ </ScrollView>
2226
+ ) : (
2227
+ <FlatList
2228
+ data={filteredContacts} // 🔹 now using filtered contacts
2229
+ keyExtractor={(item, index) => index.toString()}
2230
+ contentContainerStyle={{ paddingBottom: HP(20) }}
2231
+ renderItem={({ item }) => {
2232
+ const rawNumber = item?.phoneNumbers[0]?.number;
2233
+ const formattedNumber =
2234
+ formatPhoneNumber(rawNumber)?.toLowerCase();
2235
+
2236
+ const clientInfo = clientPhoneMap.get(formattedNumber);
2237
+
2238
+ const clientId = clientInfo?.id;
2239
+ const clientType = clientInfo?.type;
2240
+
2241
+ let typeLabel = '';
2242
+ if (clientType === 0) typeLabel = 'Customer';
2243
+ else if (clientType === 1) typeLabel = 'Supplier';
2244
+ const highlight = clientType === 0 || clientType === 1;
2245
+
2246
+ return (
2247
+ <TouchableOpacity
2248
+ style={[Styles._contactsCardMain]}
2249
+ activeOpacity={0.8}
2250
+ onPress={async () => {
2251
+ if (highlight) {
2252
+ setChangeModal(false);
2253
+ console.log("highlight")
2254
+ } else {
2255
+ console.log(item?.displayName, formattedNumber)
2256
+ await onContinue(item?.displayName, formattedNumber);
2257
+ }
2258
+ }}
2259
+ >
2260
+ <View style={Styles._avatarMain}>
2261
+ <Text style={Styles._avatarText}>
2262
+ {getAvatar(item?.displayName)}
2263
+ </Text>
2264
+ </View>
2265
+ <View style={{ width: '55%' }}>
2266
+ <Text
2267
+ style={{
2268
+ color: COLORS.blackColor,
2269
+ fontFamily: FONT_NORMAL,
2270
+ fontSize: 13,
2271
+ }}
2272
+ >
2273
+ {item?.displayName}
2274
+ </Text>
2275
+ <Text
2276
+ style={{
2277
+ color: COLORS.blackColor,
2278
+ fontFamily: FONT_NORMAL,
2279
+ fontSize: 12,
2280
+ opacity: 0.6,
2281
+ }}
2282
+ >
2283
+ {formattedNumber}
2284
+ </Text>
2285
+ </View>
2286
+
2287
+ <View
2288
+ style={{
2289
+ width: '27%',
2290
+ height: '100%',
2291
+ justifyContent: 'center',
2292
+ alignItems: 'flex-end',
2293
+ }}
2294
+ >
2295
+ <Text
2296
+ style={{
2297
+ color: COLORS.darkGrey,
2298
+ fontFamily: FONT_NORMAL,
2299
+ fontSize: 11,
2300
+ }}
2301
+ >
2302
+ {typeLabel}
2303
+ </Text>
2304
+ </View>
2305
+ </TouchableOpacity>
2306
+ );
2307
+ }}
2308
+ />
2309
+ )}
467
2310
  </View>
468
- )
2311
+ </Modal>
2312
+
2313
+ {Platform.OS === 'ios' && showPicker && (
2314
+ <DateTimePicker
2315
+ value={date}
2316
+ mode="date"
2317
+ is24Hour={false}
2318
+ onChange={onChangeDate}
2319
+ />
2320
+ )}
2321
+
2322
+ {Platform.OS === 'ios' && showTimePicker && (
2323
+ <DateTimePicker
2324
+ value={time}
2325
+ mode="time"
2326
+ is24Hour={false}
2327
+ onChange={onChangeTime}
2328
+ />
2329
+ )}
2330
+ </View>
2331
+ );
469
2332
  }
470
2333
 
471
2334
  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
2335
+ _mainContainers: {
2336
+ flex: 1,
2337
+ backgroundColor: COLORS.backgroundColor,
2338
+ alignItems: 'center',
2339
+ },
2340
+ _linearGradient: {
2341
+ width: WP(100),
2342
+ height: 80,
2343
+ alignItems: 'center',
2344
+ },
2345
+ _titleMain: {
2346
+ width: WP(94),
2347
+ height: 30,
2348
+ flexDirection: 'row',
2349
+ alignItems: 'center',
2350
+ marginTop: 10,
2351
+ },
2352
+ _title: {
2353
+ color: COLORS.whiteColor,
2354
+ fontFamily: FONT_NORMAL,
2355
+ fontSize: 15,
2356
+ marginLeft: 15,
2357
+ },
2358
+ _contentMain: {
2359
+ width: WP(94),
2360
+ height: '95%',
2361
+ backgroundColor: COLORS.whiteColor,
2362
+ position: 'absolute',
2363
+ top: 50,
2364
+ shadowColor: '#000',
2365
+ shadowOffset: { width: 0, height: 2 },
2366
+ shadowOpacity: 0.2,
2367
+ shadowRadius: 3.84,
2368
+ elevation: 5,
2369
+ borderRadius: 10,
2370
+ alignItems: 'center',
2371
+ justifyContent: 'space-between',
2372
+ paddingVertical: 12,
2373
+ },
2374
+ _input: {
2375
+ flex: 1,
2376
+ height: '100%',
2377
+ fontSize: Input_Field_SIZES.Input_Font_Size,
2378
+ fontFamily: FONT_MEDIUM,
2379
+ color: 'red',
2380
+ paddingLeft: 13,
2381
+ },
2382
+ _inputMain: {
2383
+ width: '95%',
2384
+ height: 60,
2385
+ flexDirection: 'row',
2386
+ borderColor: COLORS.grey,
2387
+ borderWidth: 1,
2388
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2389
+ justifyContent: 'space-between',
2390
+ alignItems: 'center',
2391
+ paddingHorizontal: 12,
2392
+ backgroundColor: COLORS.whiteColor,
2393
+ },
2394
+ _memoryDisplay: {
2395
+ width: WP(85),
2396
+ height: 60,
2397
+ alignItems: 'flex-start',
2398
+ justifyContent: 'center',
2399
+ paddingLeft: 12,
2400
+ // paddingVertical: 4,
2401
+ backfaceVisibility: COLORS.whiteColor,
2402
+ borderColor: COLORS.grey,
2403
+ borderWidth: 1,
2404
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2405
+ },
2406
+ _memoryText: {
2407
+ fontSize: 12,
2408
+ fontFamily: FONT_NORMAL,
2409
+ color: '#333',
2410
+ },
2411
+ _continueBtn: {
2412
+ width: '95%',
2413
+ height: 50,
2414
+ backgroundColor: COLORS.primaryColor,
2415
+ borderRadius:100,
2416
+ justifyContent: 'center',
2417
+ alignItems: 'center',
2418
+ },
2419
+ _continueBtnTxt: {
2420
+ color: COLORS.whiteColor,
2421
+ fontFamily: FONT_MEDIUM,
2422
+ fontSize: TEXT_SIZES.BUTTON_TEXT,
2423
+ },
2424
+ _calculatorMain: {
2425
+ width: '95%',
2426
+ // height: 350,
2427
+ // backgroundColor: "red"
2428
+ },
2429
+ _calculatorRow: {
2430
+ flexDirection: 'row',
2431
+ justifyContent: 'space-between',
2432
+ // marginBottom: 3
2433
+ },
2434
+ _key: {
2435
+ flex: 1,
2436
+ margin: 5,
2437
+ backgroundColor: COLORS.whiteColor,
2438
+ paddingVertical: 10,
2439
+ alignItems: 'center',
2440
+ justifyContent: 'center',
2441
+ borderRadius: 8,
2442
+ marginHorizontal: 10,
2443
+ shadowColor: '#000',
2444
+ shadowOffset: {
2445
+ width: 0,
2446
+ height: 2,
488
2447
  },
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
- })
2448
+ shadowOpacity: 0.2,
2449
+ shadowRadius: 3.84,
2450
+ elevation: 2,
2451
+ },
2452
+ _keyText: {
2453
+ fontSize: 15,
2454
+ color: COLORS.blackColor,
2455
+ fontFamily: FONT_MEDIUM,
2456
+ },
2457
+ _scrollMain: {
2458
+ width: '95%',
2459
+ alignItems: 'center',
2460
+ gap: 12,
2461
+ paddingBottom: HP(70),
2462
+ // backgroundColor: "green",
2463
+ // maxHeight: Platform.OS == "ios" ? 200 : 250,
2464
+ },
2465
+ _hidableMain: {
2466
+ width: WP(94),
2467
+ height: 300,
2468
+ // backgroundColor: "green",
2469
+ alignItems: 'center',
2470
+ gap: 12,
2471
+ },
2472
+ _hidableRow: {
2473
+ width: '95%',
2474
+ // height:30,
2475
+ // backgroundColor: "red",
2476
+ flexDirection: 'row',
2477
+ justifyContent: 'space-between',
2478
+ alignItems: 'center',
2479
+ paddingHorizontal: 9,
2480
+ },
2481
+ _cellMain: {
2482
+ width: '48%',
2483
+ height: 60,
2484
+ // backgroundColor: "pink",
2485
+ borderColor: COLORS.grey,
2486
+ borderWidth: 1,
2487
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2488
+ flexDirection: 'row',
2489
+ justifyContent: 'space-between',
2490
+ alignItems: 'center',
2491
+ paddingHorizontal: WP(4),
2492
+ },
2493
+ _cellText: {
2494
+ color: COLORS.blackColor,
2495
+ fontSize: 11,
2496
+ fontFamily: FONT_MEDIUM,
2497
+ },
2498
+ _detailMain: {
2499
+ minHeight: 60,
2500
+ maxHeight: 150,
2501
+ width: '91%',
2502
+ borderColor: COLORS.grey,
2503
+ borderWidth: 1,
2504
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2505
+ paddingHorizontal: 15,
2506
+ color: COLORS.blackColor,
2507
+ fontFamily: FONT_NORMAL,
2508
+ fontSize: 13,
2509
+ },
2510
+ _modalBtn: {
2511
+ flexDirection: 'row',
2512
+ alignItems: 'center',
2513
+ paddingVertical: 12,
2514
+ borderBottomColor: '#eee',
2515
+ borderBottomWidth: 1,
2516
+ },
2517
+ _modalText: {
2518
+ marginLeft: 10,
2519
+ fontSize: 14,
2520
+ fontFamily: FONT_NORMAL,
2521
+ color: COLORS.blackColor,
2522
+ },
2523
+ _voiceModalMain: {
2524
+ width: WP(90),
2525
+ height: HP(30),
2526
+ backgroundColor: COLORS.whiteColor,
2527
+ justifyContent: 'center',
2528
+ alignItems: 'center',
2529
+ borderRadius: 15,
2530
+ },
2531
+ _voiceBtn: {
2532
+ width: 35,
2533
+ height: 35,
2534
+ borderColor: COLORS.blackColor,
2535
+ borderWidth: 1,
2536
+ borderRadius: 100,
2537
+ justifyContent: 'center',
2538
+ alignItems: 'center',
2539
+ },
2540
+ _billNoMain: {
2541
+ width: '91%',
2542
+ height: 60,
2543
+ borderColor: COLORS.grey,
2544
+ borderWidth: 1,
2545
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2546
+ paddingHorizontal: 15,
2547
+ color: COLORS.blackColor,
2548
+ fontFamily: FONT_NORMAL,
2549
+ fontSize: 13,
2550
+ },
2551
+ _itemHeaderMain: {
2552
+ width: '91%',
2553
+ height: 40,
2554
+ borderTopColor: COLORS.gray,
2555
+ borderBottomColor: COLORS.gray,
2556
+ borderTopWidth: 0.5,
2557
+ borderBottomWidth: 0.5,
2558
+ // backgroundColor: "red",
2559
+ flexDirection: 'row',
2560
+ justifyContent: 'space-between',
2561
+ alignItems: 'center',
2562
+ // paddingVertical:5
2563
+ },
2564
+ _changeModalMain: {
2565
+ width: WP(90),
2566
+ maxHeight: HP(75),
2567
+ backgroundColor: COLORS.whiteColor,
2568
+ },
2569
+ _changeModalHeader: {
2570
+ width: '100%',
2571
+ height: HP(6),
2572
+ backgroundColor: COLORS.primaryColor,
2573
+ justifyContent: 'center',
2574
+ alignItems: 'center',
2575
+ },
2576
+ _changeModalHeaderTxt: {
2577
+ color: COLORS.whiteColor,
2578
+ fontFamily: FONT_MEDIUM,
2579
+ fontSize: 14,
2580
+ },
2581
+ _modalSearchMain: {
2582
+ width: '100%',
2583
+ justifyContent: 'center',
2584
+ alignItems: 'center',
2585
+ marginVertical: 7.5,
2586
+ },
2587
+ _modalSearch: {
2588
+ width: '92%',
2589
+ height: 45,
2590
+ borderWidth: 1,
2591
+ borderColor: COLORS.gray,
2592
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2593
+ paddingLeft: 10,
2594
+ fontFamily: FONT_NORMAL,
2595
+ fontSize: 13,
2596
+ color: COLORS.blackColor,
2597
+ },
2598
+ _avatarText: {
2599
+ fontFamily: FONT_NORMAL,
2600
+ fontSize: 16,
2601
+ color: COLORS.primaryColor,
2602
+ },
2603
+ _addContactBtn: {
2604
+ width: '92%',
2605
+ height: 50,
2606
+ // backgroundColor: "red",
2607
+ flexDirection: 'row',
2608
+ justifyContent: 'space-between',
2609
+ alignItems: 'center',
2610
+ },
2611
+ _contactsCardMain: {
2612
+ width: '92%',
2613
+ height: 50,
2614
+ // backgroundColor: "red",
2615
+ marginVertical: 10,
2616
+ flexDirection: 'row',
2617
+ justifyContent: 'space-between',
2618
+ alignItems: 'center',
2619
+ alignSelf: 'center',
2620
+ },
2621
+ _phoneInputMain: {
2622
+ width: '92%',
2623
+ // height:60,
2624
+ // backgroundColor:"red",
2625
+ alignItems: 'center',
2626
+ gap: 15,
2627
+ },
2628
+ });