digikhata-mashreq-sdk 1.0.0 → 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.
- package/lib/module/App.js +13 -26
- package/lib/module/App.js.map +1 -1
- package/lib/module/app/api/api.js +12 -0
- package/lib/module/app/api/api.js.map +1 -0
- package/lib/module/app/assets/Icons/Bill.png +0 -0
- package/lib/module/app/assets/Icons/Bill_Grey.png +0 -0
- package/lib/module/app/assets/Icons/Cash.png +0 -0
- package/lib/module/app/assets/Icons/Cash_Grey.png +0 -0
- package/lib/module/app/assets/Icons/Expense.png +0 -0
- package/lib/module/app/assets/Icons/Expense_Grey.png +0 -0
- package/lib/module/app/assets/Icons/Staff.png +0 -0
- package/lib/module/app/assets/Icons/Stock.png +0 -0
- package/lib/module/app/assets/Icons/Stock_Grey.png +0 -0
- package/lib/module/app/assets/Icons/abc.png +0 -0
- package/lib/module/app/assets/Icons/bank_logo.png +0 -0
- package/lib/module/app/assets/Icons/download_sale.png +0 -0
- package/lib/module/app/assets/Icons/recycle-bin.png +0 -0
- package/lib/module/app/assets/animations/recording.json +1 -0
- package/lib/module/app/assets/animations/success.json +1 -0
- package/lib/module/app/assets/animations/voice_visualization.json +1 -0
- package/lib/module/app/assets/businessCards/card_11.png +0 -0
- package/lib/module/app/assets/businessCards/card_12_bg.png +0 -0
- package/lib/module/app/assets/businessCards/card_wall_01.jpeg +0 -0
- package/lib/module/app/assets/businessCards/card_wall_02.jpeg +0 -0
- package/lib/module/app/assets/businessCards/card_wall_03.jpeg +0 -0
- package/lib/module/app/assets/businessCards/card_wall_04.jpeg +0 -0
- package/lib/module/app/assets/businessCards/card_wall_05.jpeg +0 -0
- package/lib/module/app/assets/businessCards/card_wall_06.jpeg +0 -0
- package/lib/module/app/assets/businessCards/card_wall_07.jpeg +0 -0
- package/lib/module/app/assets/businessCards/card_wall_08.jpeg +0 -0
- package/lib/module/app/assets/illustrations/empty.png +0 -0
- package/lib/module/app/assets/illustrations/packages.png +0 -0
- package/lib/module/app/assets/images/Digikhata_idzarHgH0q_0.png +0 -0
- package/lib/module/app/assets/images/bank.png +0 -0
- package/lib/module/app/assets/images/digiLogo-main.png +0 -0
- package/lib/module/app/assets/images/svgviewer-output.svg +57 -0
- package/lib/module/app/assets/images/user.png +0 -0
- package/lib/module/app/assets/oldIcons/BILL.svg +3 -0
- package/lib/module/app/assets/oldIcons/CASH.svg +4 -0
- package/lib/module/app/assets/oldIcons/EXPENSE.svg +6 -0
- package/lib/module/app/assets/oldIcons/STAFF.svg +3 -0
- package/lib/module/app/assets/oldIcons/Sale Active.svg +14 -0
- package/lib/module/app/assets/oldIcons/Stock.svg +5 -0
- package/lib/module/app/assets/svg/BILL.svg +4 -0
- package/lib/module/app/assets/svg/CASH.svg +6 -0
- package/lib/module/app/assets/svg/EXPENSE.svg +5 -0
- package/lib/module/app/assets/svg/More Icon.svg +6 -0
- package/lib/module/app/assets/svg/Payment Icon.svg +4 -0
- package/lib/module/app/assets/svg/Pos.svg +13 -0
- package/lib/module/app/assets/svg/STAFF.svg +5 -0
- package/lib/module/app/assets/svg/Sale Active.svg +8 -0
- package/lib/module/app/assets/svg/Sale Icon.svg +3 -0
- package/lib/module/app/assets/svg/Stock.svg +5 -0
- package/lib/module/app/components/AccountSetupSteps.js +64 -0
- package/lib/module/app/components/AccountSetupSteps.js.map +1 -0
- package/lib/module/app/components/AddItemBillParent.js +366 -0
- package/lib/module/app/components/AddItemBillParent.js.map +1 -0
- package/lib/module/app/components/AdditemBillChild.js +1123 -0
- package/lib/module/app/components/AdditemBillChild.js.map +1 -0
- package/lib/module/app/components/Balance.js +116 -70
- package/lib/module/app/components/Balance.js.map +1 -1
- package/lib/module/app/components/BillList.js +428 -0
- package/lib/module/app/components/BillList.js.map +1 -0
- package/lib/module/app/components/BillSetupSteps.js +64 -0
- package/lib/module/app/components/BillSetupSteps.js.map +1 -0
- package/lib/module/app/components/BottomView.js +35 -0
- package/lib/module/app/components/BottomView.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card1.js +202 -0
- package/lib/module/app/components/BusinessCards/Card1.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card10.js +234 -0
- package/lib/module/app/components/BusinessCards/Card10.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card2.js +190 -0
- package/lib/module/app/components/BusinessCards/Card2.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card3.js +186 -0
- package/lib/module/app/components/BusinessCards/Card3.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card4.js +186 -0
- package/lib/module/app/components/BusinessCards/Card4.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card5.js +189 -0
- package/lib/module/app/components/BusinessCards/Card5.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card6.js +198 -0
- package/lib/module/app/components/BusinessCards/Card6.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card7.js +185 -0
- package/lib/module/app/components/BusinessCards/Card7.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card8.js +187 -0
- package/lib/module/app/components/BusinessCards/Card8.js.map +1 -0
- package/lib/module/app/components/BusinessCards/Card9.js +234 -0
- package/lib/module/app/components/BusinessCards/Card9.js.map +1 -0
- package/lib/module/app/components/BusinessCards/index.js +13 -0
- package/lib/module/app/components/BusinessCards/index.js.map +1 -0
- package/lib/module/app/components/CashEntryComponent.js +256 -0
- package/lib/module/app/components/CashEntryComponent.js.map +1 -0
- package/lib/module/app/components/CityModal.js +116 -0
- package/lib/module/app/components/CityModal.js.map +1 -0
- package/lib/module/app/components/CountryPhoneInput.js +263 -166
- package/lib/module/app/components/CountryPhoneInput.js.map +1 -1
- package/lib/module/app/components/CreateExpenseAccount.js +139 -0
- package/lib/module/app/components/CreateExpenseAccount.js.map +1 -0
- package/lib/module/app/components/CustomStatusBar.js +29 -0
- package/lib/module/app/components/CustomStatusBar.js.map +1 -0
- package/lib/module/app/components/CustomToast.js +135 -0
- package/lib/module/app/components/CustomToast.js.map +1 -0
- package/lib/module/app/components/DeleteBusinessModal.js +174 -0
- package/lib/module/app/components/DeleteBusinessModal.js.map +1 -0
- package/lib/module/app/components/DiscountTaxModal.js +242 -0
- package/lib/module/app/components/DiscountTaxModal.js.map +1 -0
- package/lib/module/app/components/Entries.js +54 -32
- package/lib/module/app/components/Entries.js.map +1 -1
- package/lib/module/app/components/ExpenseList.js +402 -0
- package/lib/module/app/components/ExpenseList.js.map +1 -0
- package/lib/module/app/components/ExpenseParent.js +441 -0
- package/lib/module/app/components/ExpenseParent.js.map +1 -0
- package/lib/module/app/components/FloatingInput.js +159 -0
- package/lib/module/app/components/FloatingInput.js.map +1 -0
- package/lib/module/app/components/Header.js +107 -0
- package/lib/module/app/components/Header.js.map +1 -0
- package/lib/module/app/components/Loader.js +45 -0
- package/lib/module/app/components/Loader.js.map +1 -0
- package/lib/module/app/components/PartyModal.js +230 -0
- package/lib/module/app/components/PartyModal.js.map +1 -0
- package/lib/module/app/components/PickerModal.js +153 -0
- package/lib/module/app/components/PickerModal.js.map +1 -0
- package/lib/module/app/components/SalePaymentModal.js +743 -0
- package/lib/module/app/components/SalePaymentModal.js.map +1 -0
- package/lib/module/app/components/SearchBar.js +179 -42
- package/lib/module/app/components/SearchBar.js.map +1 -1
- package/lib/module/app/components/StockDetailChild.js +425 -0
- package/lib/module/app/components/StockDetailChild.js.map +1 -0
- package/lib/module/app/components/StockList.js +448 -0
- package/lib/module/app/components/StockList.js.map +1 -0
- package/lib/module/app/components/StockReportTransaction.js +182 -0
- package/lib/module/app/components/StockReportTransaction.js.map +1 -0
- package/lib/module/app/components/Transaction.js +193 -53
- package/lib/module/app/components/Transaction.js.map +1 -1
- package/lib/module/app/components/User.js +106 -51
- package/lib/module/app/components/User.js.map +1 -1
- package/lib/module/app/components/index.js +20 -1
- package/lib/module/app/components/index.js.map +1 -1
- package/lib/module/app/database/bill.js +247 -0
- package/lib/module/app/database/bill.js.map +1 -0
- package/lib/module/app/database/business.js +262 -0
- package/lib/module/app/database/business.js.map +1 -0
- package/lib/module/app/database/cash.js +299 -0
- package/lib/module/app/database/cash.js.map +1 -0
- package/lib/module/app/database/clients.js +1182 -36
- package/lib/module/app/database/clients.js.map +1 -1
- package/lib/module/app/database/expense.js +299 -0
- package/lib/module/app/database/expense.js.map +1 -0
- package/lib/module/app/database/schema.js +113 -3
- package/lib/module/app/database/schema.js.map +1 -1
- package/lib/module/app/database/stock.js +509 -0
- package/lib/module/app/database/stock.js.map +1 -0
- package/lib/module/app/htmlTemplates/htmlTemplates.js +2504 -0
- package/lib/module/app/htmlTemplates/htmlTemplates.js.map +1 -0
- package/lib/module/app/navigation/BillStack/BillStack.js +40 -0
- package/lib/module/app/navigation/BillStack/BillStack.js.map +1 -0
- package/lib/module/app/navigation/BottomTabs/BottomTabs.js +10 -5
- package/lib/module/app/navigation/BottomTabs/BottomTabs.js.map +1 -1
- package/lib/module/app/navigation/BusinessStack/BusinessStack.js +30 -0
- package/lib/module/app/navigation/BusinessStack/BusinessStack.js.map +1 -0
- package/lib/module/app/navigation/CashStack/CashStack.js +79 -0
- package/lib/module/app/navigation/CashStack/CashStack.js.map +1 -0
- package/lib/module/app/navigation/EntriesStack/EntriesStack.js +223 -0
- package/lib/module/app/navigation/EntriesStack/EntriesStack.js.map +1 -0
- package/lib/module/app/navigation/ExpenseStack.js/ExpenseStack.js +37 -0
- package/lib/module/app/navigation/ExpenseStack.js/ExpenseStack.js.map +1 -0
- package/lib/module/app/navigation/HomeStack/HomeStack.js +93 -1
- package/lib/module/app/navigation/HomeStack/HomeStack.js.map +1 -1
- package/lib/module/app/navigation/Root.js +10 -1
- package/lib/module/app/navigation/Root.js.map +1 -1
- package/lib/module/app/navigation/SaleStack/SaleStack.js +73 -0
- package/lib/module/app/navigation/SaleStack/SaleStack.js.map +1 -0
- package/lib/module/app/navigation/StockStack/StockStack.js +49 -0
- package/lib/module/app/navigation/StockStack/StockStack.js.map +1 -0
- package/lib/module/app/navigation/index.js +3 -1
- package/lib/module/app/navigation/index.js.map +1 -1
- package/lib/module/app/redux/Store.js +3 -1
- package/lib/module/app/redux/Store.js.map +1 -1
- package/lib/module/app/redux/reducers/client/client_reducers.js +23 -2
- package/lib/module/app/redux/reducers/client/client_reducers.js.map +1 -1
- package/lib/module/app/redux/reducers/client/client_types.js +5 -0
- package/lib/module/app/redux/reducers/client/client_types.js.map +1 -1
- package/lib/module/app/redux/reducers/user/user_reducers.js +22 -0
- package/lib/module/app/redux/reducers/user/user_reducers.js.map +1 -0
- package/lib/module/app/redux/reducers/user/user_types.js +6 -0
- package/lib/module/app/redux/reducers/user/user_types.js.map +1 -0
- package/lib/module/app/screens/AddBank.js +237 -0
- package/lib/module/app/screens/AddBank.js.map +1 -0
- package/lib/module/app/screens/AddBusiness.js +905 -0
- package/lib/module/app/screens/AddBusiness.js.map +1 -0
- package/lib/module/app/screens/AddItems.js +433 -0
- package/lib/module/app/screens/AddItems.js.map +1 -0
- package/lib/module/app/screens/AddScreen.js +341 -77
- package/lib/module/app/screens/AddScreen.js.map +1 -1
- package/lib/module/app/screens/All.js +836 -0
- package/lib/module/app/screens/All.js.map +1 -0
- package/lib/module/app/screens/AllTransactions.js +846 -0
- package/lib/module/app/screens/AllTransactions.js.map +1 -0
- package/lib/module/app/screens/Banks.js +807 -48
- package/lib/module/app/screens/Banks.js.map +1 -1
- package/lib/module/app/screens/BillDetails.js +1033 -0
- package/lib/module/app/screens/BillDetails.js.map +1 -0
- package/lib/module/app/screens/BillHome.js +102 -0
- package/lib/module/app/screens/BillHome.js.map +1 -0
- package/lib/module/app/screens/BillParent.js +373 -0
- package/lib/module/app/screens/BillParent.js.map +1 -0
- package/lib/module/app/screens/BusinessDetail.js +787 -0
- package/lib/module/app/screens/BusinessDetail.js.map +1 -0
- package/lib/module/app/screens/CashEntry.js +2429 -0
- package/lib/module/app/screens/CashEntry.js.map +1 -0
- package/lib/module/app/screens/CashEntryDetails.js +574 -0
- package/lib/module/app/screens/CashEntryDetails.js.map +1 -0
- package/lib/module/app/screens/CashHome.js +544 -0
- package/lib/module/app/screens/CashHome.js.map +1 -0
- package/lib/module/app/screens/CashReport.js +1297 -0
- package/lib/module/app/screens/CashReport.js.map +1 -0
- package/lib/module/app/screens/CashSummary.js +602 -0
- package/lib/module/app/screens/CashSummary.js.map +1 -0
- package/lib/module/app/screens/CreateBill.js +2137 -0
- package/lib/module/app/screens/CreateBill.js.map +1 -0
- package/lib/module/app/screens/CustomerEntries.js +1093 -184
- package/lib/module/app/screens/CustomerEntries.js.map +1 -1
- package/lib/module/app/screens/Customers.js +727 -96
- package/lib/module/app/screens/Customers.js.map +1 -1
- package/lib/module/app/screens/EditCategory.js +299 -0
- package/lib/module/app/screens/EditCategory.js.map +1 -0
- package/lib/module/app/screens/EditCategoryStock.js +302 -0
- package/lib/module/app/screens/EditCategoryStock.js.map +1 -0
- package/lib/module/app/screens/Entry.js +1838 -275
- package/lib/module/app/screens/Entry.js.map +1 -1
- package/lib/module/app/screens/ExpenseDetail.js +15 -0
- package/lib/module/app/screens/ExpenseDetail.js.map +1 -0
- package/lib/module/app/screens/ExpenseEntries.js +713 -0
- package/lib/module/app/screens/ExpenseEntries.js.map +1 -0
- package/lib/module/app/screens/ExpenseEntry.js +2095 -0
- package/lib/module/app/screens/ExpenseEntry.js.map +1 -0
- package/lib/module/app/screens/ExpenseEntryDetails.js +508 -0
- package/lib/module/app/screens/ExpenseEntryDetails.js.map +1 -0
- package/lib/module/app/screens/ExpenseEntryReport.js +792 -0
- package/lib/module/app/screens/ExpenseEntryReport.js.map +1 -0
- package/lib/module/app/screens/ExpenseReport.js +792 -0
- package/lib/module/app/screens/ExpenseReport.js.map +1 -0
- package/lib/module/app/screens/Geolocation.js +374 -0
- package/lib/module/app/screens/Geolocation.js.map +1 -0
- package/lib/module/app/screens/GetStarted.js +213 -0
- package/lib/module/app/screens/GetStarted.js.map +1 -0
- package/lib/module/app/screens/HomeScreen.js +202 -55
- package/lib/module/app/screens/HomeScreen.js.map +1 -1
- package/lib/module/app/screens/InBuy.js +854 -0
- package/lib/module/app/screens/InBuy.js.map +1 -0
- package/lib/module/app/screens/ItemEntryDetails.js +652 -0
- package/lib/module/app/screens/ItemEntryDetails.js.map +1 -0
- package/lib/module/app/screens/LowStock.js +372 -0
- package/lib/module/app/screens/LowStock.js.map +1 -0
- package/lib/module/app/screens/NewPin.js +234 -0
- package/lib/module/app/screens/NewPin.js.map +1 -0
- package/lib/module/app/screens/OutSell.js +1883 -0
- package/lib/module/app/screens/OutSell.js.map +1 -0
- package/lib/module/app/screens/POSSale.js +637 -0
- package/lib/module/app/screens/POSSale.js.map +1 -0
- package/lib/module/app/screens/PinScreen.js +663 -0
- package/lib/module/app/screens/PinScreen.js.map +1 -0
- package/lib/module/app/screens/PreviewBill.js +329 -0
- package/lib/module/app/screens/PreviewBill.js.map +1 -0
- package/lib/module/app/screens/Profile.js +1160 -0
- package/lib/module/app/screens/Profile.js.map +1 -0
- package/lib/module/app/screens/RateList.js +432 -0
- package/lib/module/app/screens/RateList.js.map +1 -0
- package/lib/module/app/screens/Report.js +1105 -0
- package/lib/module/app/screens/Report.js.map +1 -0
- package/lib/module/app/screens/SaleItemDetail.js +1047 -0
- package/lib/module/app/screens/SaleItemDetail.js.map +1 -0
- package/lib/module/app/screens/SaleParent.js +289 -0
- package/lib/module/app/screens/SaleParent.js.map +1 -0
- package/lib/module/app/screens/SelectBank.js +220 -0
- package/lib/module/app/screens/SelectBank.js.map +1 -0
- package/lib/module/app/screens/SelectBusiness.js +497 -93
- package/lib/module/app/screens/SelectBusiness.js.map +1 -1
- package/lib/module/app/screens/Splash.js +93 -20
- package/lib/module/app/screens/Splash.js.map +1 -1
- package/lib/module/app/screens/StockChild.js +362 -0
- package/lib/module/app/screens/StockChild.js.map +1 -0
- package/lib/module/app/screens/StockDetail.js +705 -0
- package/lib/module/app/screens/StockDetail.js.map +1 -0
- package/lib/module/app/screens/StockParent.js +260 -0
- package/lib/module/app/screens/StockParent.js.map +1 -0
- package/lib/module/app/screens/StockReport.js +1031 -0
- package/lib/module/app/screens/StockReport.js.map +1 -0
- package/lib/module/app/screens/StockValue.js +545 -0
- package/lib/module/app/screens/StockValue.js.map +1 -0
- package/lib/module/app/screens/Suppliers.js +753 -98
- package/lib/module/app/screens/Suppliers.js.map +1 -1
- package/lib/module/app/screens/TransactionDetails.js +1169 -81
- package/lib/module/app/screens/TransactionDetails.js.map +1 -1
- package/lib/module/app/screens/UpdateBusiness.js +707 -0
- package/lib/module/app/screens/UpdateBusiness.js.map +1 -0
- package/lib/module/app/screens/VisionCamera.js +60 -0
- package/lib/module/app/screens/VisionCamera.js.map +1 -0
- package/lib/module/app/screens/index.js +46 -1
- package/lib/module/app/screens/index.js.map +1 -1
- package/lib/module/app/screens/new.html +171 -0
- package/lib/module/app/themes/config.js +299 -30
- package/lib/module/app/themes/config.js.map +1 -1
- package/lib/module/app/utils/city.json +7265 -0
- package/lib/typescript/eslint.config.d.mts +1 -1
- package/lib/typescript/src/App.d.ts.map +1 -1
- package/lib/typescript/src/app/api/api.d.ts +10 -0
- package/lib/typescript/src/app/api/api.d.ts.map +1 -0
- package/lib/typescript/src/app/components/AccountSetupSteps.d.ts +3 -0
- package/lib/typescript/src/app/components/AccountSetupSteps.d.ts.map +1 -0
- package/lib/typescript/src/app/components/AddItemBillParent.d.ts +5 -0
- package/lib/typescript/src/app/components/AddItemBillParent.d.ts.map +1 -0
- package/lib/typescript/src/app/components/AdditemBillChild.d.ts +6 -0
- package/lib/typescript/src/app/components/AdditemBillChild.d.ts.map +1 -0
- package/lib/typescript/src/app/components/Balance.d.ts +3 -1
- package/lib/typescript/src/app/components/Balance.d.ts.map +1 -1
- package/lib/typescript/src/app/components/BillList.d.ts +5 -0
- package/lib/typescript/src/app/components/BillList.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BillSetupSteps.d.ts +3 -0
- package/lib/typescript/src/app/components/BillSetupSteps.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BottomView.d.ts +6 -0
- package/lib/typescript/src/app/components/BottomView.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card1.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card1.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card10.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card10.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card2.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card2.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card3.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card3.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card4.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card4.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card5.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card5.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card6.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card6.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card7.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card7.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card8.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card8.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/Card9.d.ts +14 -0
- package/lib/typescript/src/app/components/BusinessCards/Card9.d.ts.map +1 -0
- package/lib/typescript/src/app/components/BusinessCards/index.d.ts +11 -0
- package/lib/typescript/src/app/components/BusinessCards/index.d.ts.map +1 -0
- package/lib/typescript/src/app/components/CashEntryComponent.d.ts +8 -0
- package/lib/typescript/src/app/components/CashEntryComponent.d.ts.map +1 -0
- package/lib/typescript/src/app/components/CityModal.d.ts +7 -0
- package/lib/typescript/src/app/components/CityModal.d.ts.map +1 -0
- package/lib/typescript/src/app/components/CountryPhoneInput.d.ts +4 -1
- package/lib/typescript/src/app/components/CountryPhoneInput.d.ts.map +1 -1
- package/lib/typescript/src/app/components/CreateExpenseAccount.d.ts +9 -0
- package/lib/typescript/src/app/components/CreateExpenseAccount.d.ts.map +1 -0
- package/lib/typescript/src/app/components/CustomStatusBar.d.ts +3 -0
- package/lib/typescript/src/app/components/CustomStatusBar.d.ts.map +1 -0
- package/lib/typescript/src/app/components/CustomToast.d.ts +10 -0
- package/lib/typescript/src/app/components/CustomToast.d.ts.map +1 -0
- package/lib/typescript/src/app/components/DeleteBusinessModal.d.ts +8 -0
- package/lib/typescript/src/app/components/DeleteBusinessModal.d.ts.map +1 -0
- package/lib/typescript/src/app/components/DiscountTaxModal.d.ts +9 -0
- package/lib/typescript/src/app/components/DiscountTaxModal.d.ts.map +1 -0
- package/lib/typescript/src/app/components/Entries.d.ts.map +1 -1
- package/lib/typescript/src/app/components/ExpenseList.d.ts +6 -0
- package/lib/typescript/src/app/components/ExpenseList.d.ts.map +1 -0
- package/lib/typescript/src/app/components/ExpenseParent.d.ts +4 -0
- package/lib/typescript/src/app/components/ExpenseParent.d.ts.map +1 -0
- package/lib/typescript/src/app/components/FloatingInput.d.ts +18 -0
- package/lib/typescript/src/app/components/FloatingInput.d.ts.map +1 -0
- package/lib/typescript/src/app/components/Header.d.ts +11 -0
- package/lib/typescript/src/app/components/Header.d.ts.map +1 -0
- package/lib/typescript/src/app/components/Loader.d.ts +5 -0
- package/lib/typescript/src/app/components/Loader.d.ts.map +1 -0
- package/lib/typescript/src/app/components/PartyModal.d.ts +7 -0
- package/lib/typescript/src/app/components/PartyModal.d.ts.map +1 -0
- package/lib/typescript/src/app/components/PickerModal.d.ts +8 -0
- package/lib/typescript/src/app/components/PickerModal.d.ts.map +1 -0
- package/lib/typescript/src/app/components/SalePaymentModal.d.ts +15 -0
- package/lib/typescript/src/app/components/SalePaymentModal.d.ts.map +1 -0
- package/lib/typescript/src/app/components/SearchBar.d.ts +2 -4
- package/lib/typescript/src/app/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/src/app/components/StockDetailChild.d.ts +5 -0
- package/lib/typescript/src/app/components/StockDetailChild.d.ts.map +1 -0
- package/lib/typescript/src/app/components/StockList.d.ts +6 -0
- package/lib/typescript/src/app/components/StockList.d.ts.map +1 -0
- package/lib/typescript/src/app/components/StockReportTransaction.d.ts +18 -0
- package/lib/typescript/src/app/components/StockReportTransaction.d.ts.map +1 -0
- package/lib/typescript/src/app/components/Transaction.d.ts +9 -2
- package/lib/typescript/src/app/components/Transaction.d.ts.map +1 -1
- package/lib/typescript/src/app/components/User.d.ts +3 -1
- package/lib/typescript/src/app/components/User.d.ts.map +1 -1
- package/lib/typescript/src/app/components/index.d.ts +26 -7
- package/lib/typescript/src/app/components/index.d.ts.map +1 -1
- package/lib/typescript/src/app/database/bill.d.ts +7 -0
- package/lib/typescript/src/app/database/bill.d.ts.map +1 -0
- package/lib/typescript/src/app/database/business.d.ts +9 -0
- package/lib/typescript/src/app/database/business.d.ts.map +1 -0
- package/lib/typescript/src/app/database/cash.d.ts +14 -0
- package/lib/typescript/src/app/database/cash.d.ts.map +1 -0
- package/lib/typescript/src/app/database/clients.d.ts +36 -5
- package/lib/typescript/src/app/database/clients.d.ts.map +1 -1
- package/lib/typescript/src/app/database/expense.d.ts +12 -0
- package/lib/typescript/src/app/database/expense.d.ts.map +1 -0
- package/lib/typescript/src/app/database/schema.d.ts.map +1 -1
- package/lib/typescript/src/app/database/stock.d.ts +16 -0
- package/lib/typescript/src/app/database/stock.d.ts.map +1 -0
- package/lib/typescript/src/app/htmlTemplates/htmlTemplates.d.ts +29 -0
- package/lib/typescript/src/app/htmlTemplates/htmlTemplates.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/BillStack/BillStack.d.ts +2 -0
- package/lib/typescript/src/app/navigation/BillStack/BillStack.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/BottomTabs/BottomTabs.d.ts.map +1 -1
- package/lib/typescript/src/app/navigation/BusinessStack/BusinessStack.d.ts +2 -0
- package/lib/typescript/src/app/navigation/BusinessStack/BusinessStack.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/CashStack/CashStack.d.ts +2 -0
- package/lib/typescript/src/app/navigation/CashStack/CashStack.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/EntriesStack/EntriesStack.d.ts +2 -0
- package/lib/typescript/src/app/navigation/EntriesStack/EntriesStack.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/ExpenseStack.js/ExpenseStack.d.ts +2 -0
- package/lib/typescript/src/app/navigation/ExpenseStack.js/ExpenseStack.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/HomeStack/HomeStack.d.ts.map +1 -1
- package/lib/typescript/src/app/navigation/Root.d.ts.map +1 -1
- package/lib/typescript/src/app/navigation/SaleStack/SaleStack.d.ts +2 -0
- package/lib/typescript/src/app/navigation/SaleStack/SaleStack.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/StockStack/StockStack.d.ts +2 -0
- package/lib/typescript/src/app/navigation/StockStack/StockStack.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/index.d.ts +3 -1
- package/lib/typescript/src/app/navigation/index.d.ts.map +1 -1
- package/lib/typescript/src/app/redux/Store.d.ts.map +1 -1
- package/lib/typescript/src/app/redux/reducers/client/client_reducers.d.ts.map +1 -1
- package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts +5 -0
- package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts.map +1 -1
- package/lib/typescript/src/app/redux/reducers/user/user_reducers.d.ts +3 -0
- package/lib/typescript/src/app/redux/reducers/user/user_reducers.d.ts.map +1 -0
- package/lib/typescript/src/app/redux/reducers/user/user_types.d.ts +4 -0
- package/lib/typescript/src/app/redux/reducers/user/user_types.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/AddBank.d.ts +5 -0
- package/lib/typescript/src/app/screens/AddBank.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/AddBusiness.d.ts +4 -0
- package/lib/typescript/src/app/screens/AddBusiness.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/AddItems.d.ts +5 -0
- package/lib/typescript/src/app/screens/AddItems.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/AddScreen.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/All.d.ts +2 -0
- package/lib/typescript/src/app/screens/All.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/AllTransactions.d.ts +5 -0
- package/lib/typescript/src/app/screens/AllTransactions.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Banks.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/BillDetails.d.ts +6 -0
- package/lib/typescript/src/app/screens/BillDetails.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/BillHome.d.ts +5 -0
- package/lib/typescript/src/app/screens/BillHome.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/BillParent.d.ts +5 -0
- package/lib/typescript/src/app/screens/BillParent.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/BusinessDetail.d.ts +4 -0
- package/lib/typescript/src/app/screens/BusinessDetail.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/CashEntry.d.ts +5 -0
- package/lib/typescript/src/app/screens/CashEntry.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/CashEntryDetails.d.ts +5 -0
- package/lib/typescript/src/app/screens/CashEntryDetails.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/CashHome.d.ts +4 -0
- package/lib/typescript/src/app/screens/CashHome.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/CashReport.d.ts +4 -0
- package/lib/typescript/src/app/screens/CashReport.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/CashSummary.d.ts +5 -0
- package/lib/typescript/src/app/screens/CashSummary.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/CreateBill.d.ts +5 -0
- package/lib/typescript/src/app/screens/CreateBill.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/CustomerEntries.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/Customers.d.ts +1 -3
- package/lib/typescript/src/app/screens/Customers.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/EditCategory.d.ts +4 -0
- package/lib/typescript/src/app/screens/EditCategory.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/EditCategoryStock.d.ts +4 -0
- package/lib/typescript/src/app/screens/EditCategoryStock.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Entry.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/ExpenseDetail.d.ts +3 -0
- package/lib/typescript/src/app/screens/ExpenseDetail.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/ExpenseEntries.d.ts +5 -0
- package/lib/typescript/src/app/screens/ExpenseEntries.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/ExpenseEntry.d.ts +5 -0
- package/lib/typescript/src/app/screens/ExpenseEntry.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/ExpenseEntryDetails.d.ts +5 -0
- package/lib/typescript/src/app/screens/ExpenseEntryDetails.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/ExpenseEntryReport.d.ts +5 -0
- package/lib/typescript/src/app/screens/ExpenseEntryReport.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/ExpenseReport.d.ts +5 -0
- package/lib/typescript/src/app/screens/ExpenseReport.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Geolocation.d.ts +5 -0
- package/lib/typescript/src/app/screens/Geolocation.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/GetStarted.d.ts +4 -0
- package/lib/typescript/src/app/screens/GetStarted.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/HomeScreen.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/InBuy.d.ts +5 -0
- package/lib/typescript/src/app/screens/InBuy.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/ItemEntryDetails.d.ts +5 -0
- package/lib/typescript/src/app/screens/ItemEntryDetails.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/LowStock.d.ts +4 -0
- package/lib/typescript/src/app/screens/LowStock.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/NewPin.d.ts +5 -0
- package/lib/typescript/src/app/screens/NewPin.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/OutSell.d.ts +6 -0
- package/lib/typescript/src/app/screens/OutSell.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/POSSale.d.ts +9 -0
- package/lib/typescript/src/app/screens/POSSale.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/PinScreen.d.ts +5 -0
- package/lib/typescript/src/app/screens/PinScreen.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/PreviewBill.d.ts +5 -0
- package/lib/typescript/src/app/screens/PreviewBill.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Profile.d.ts +5 -0
- package/lib/typescript/src/app/screens/Profile.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/RateList.d.ts +5 -0
- package/lib/typescript/src/app/screens/RateList.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Report.d.ts +5 -0
- package/lib/typescript/src/app/screens/Report.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/SaleItemDetail.d.ts +6 -0
- package/lib/typescript/src/app/screens/SaleItemDetail.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/SaleParent.d.ts +2 -0
- package/lib/typescript/src/app/screens/SaleParent.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/SelectBank.d.ts +4 -0
- package/lib/typescript/src/app/screens/SelectBank.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/SelectBusiness.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/Splash.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/StockChild.d.ts +7 -0
- package/lib/typescript/src/app/screens/StockChild.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/StockDetail.d.ts +5 -0
- package/lib/typescript/src/app/screens/StockDetail.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/StockParent.d.ts +2 -0
- package/lib/typescript/src/app/screens/StockParent.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/StockReport.d.ts +5 -0
- package/lib/typescript/src/app/screens/StockReport.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/StockValue.d.ts +5 -0
- package/lib/typescript/src/app/screens/StockValue.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Suppliers.d.ts +1 -3
- package/lib/typescript/src/app/screens/Suppliers.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/TransactionDetails.d.ts.map +1 -1
- package/lib/typescript/src/app/screens/UpdateBusiness.d.ts +5 -0
- package/lib/typescript/src/app/screens/UpdateBusiness.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/VisionCamera.d.ts +2 -0
- package/lib/typescript/src/app/screens/VisionCamera.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/index.d.ts +56 -11
- package/lib/typescript/src/app/screens/index.d.ts.map +1 -1
- package/lib/typescript/src/app/themes/config.d.ts +60 -8
- package/lib/typescript/src/app/themes/config.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/App.js +30 -34
- package/src/app/api/api.js +11 -0
- package/src/app/assets/Icons/Bill.png +0 -0
- package/src/app/assets/Icons/Bill_Grey.png +0 -0
- package/src/app/assets/Icons/Cash.png +0 -0
- package/src/app/assets/Icons/Cash_Grey.png +0 -0
- package/src/app/assets/Icons/Expense.png +0 -0
- package/src/app/assets/Icons/Expense_Grey.png +0 -0
- package/src/app/assets/Icons/Staff.png +0 -0
- package/src/app/assets/Icons/Stock.png +0 -0
- package/src/app/assets/Icons/Stock_Grey.png +0 -0
- package/src/app/assets/Icons/abc.png +0 -0
- package/src/app/assets/Icons/bank_logo.png +0 -0
- package/src/app/assets/Icons/download_sale.png +0 -0
- package/src/app/assets/Icons/recycle-bin.png +0 -0
- package/src/app/assets/animations/recording.json +1 -0
- package/src/app/assets/animations/success.json +1 -0
- package/src/app/assets/animations/voice_visualization.json +1 -0
- package/src/app/assets/businessCards/card_11.png +0 -0
- package/src/app/assets/businessCards/card_12_bg.png +0 -0
- package/src/app/assets/businessCards/card_wall_01.jpeg +0 -0
- package/src/app/assets/businessCards/card_wall_02.jpeg +0 -0
- package/src/app/assets/businessCards/card_wall_03.jpeg +0 -0
- package/src/app/assets/businessCards/card_wall_04.jpeg +0 -0
- package/src/app/assets/businessCards/card_wall_05.jpeg +0 -0
- package/src/app/assets/businessCards/card_wall_06.jpeg +0 -0
- package/src/app/assets/businessCards/card_wall_07.jpeg +0 -0
- package/src/app/assets/businessCards/card_wall_08.jpeg +0 -0
- package/src/app/assets/illustrations/empty.png +0 -0
- package/src/app/assets/illustrations/packages.png +0 -0
- package/src/app/assets/images/Digikhata_idzarHgH0q_0.png +0 -0
- package/src/app/assets/images/bank.png +0 -0
- package/src/app/assets/images/digiLogo-main.png +0 -0
- package/src/app/assets/images/svgviewer-output.svg +57 -0
- package/src/app/assets/images/user.png +0 -0
- package/src/app/assets/oldIcons/BILL.svg +3 -0
- package/src/app/assets/oldIcons/CASH.svg +4 -0
- package/src/app/assets/oldIcons/EXPENSE.svg +6 -0
- package/src/app/assets/oldIcons/STAFF.svg +3 -0
- package/src/app/assets/oldIcons/Sale Active.svg +14 -0
- package/src/app/assets/oldIcons/Stock.svg +5 -0
- package/src/app/assets/svg/BILL.svg +4 -0
- package/src/app/assets/svg/CASH.svg +6 -0
- package/src/app/assets/svg/EXPENSE.svg +5 -0
- package/src/app/assets/svg/More Icon.svg +6 -0
- package/src/app/assets/svg/Payment Icon.svg +4 -0
- package/src/app/assets/svg/Pos.svg +13 -0
- package/src/app/assets/svg/STAFF.svg +5 -0
- package/src/app/assets/svg/Sale Active.svg +8 -0
- package/src/app/assets/svg/Sale Icon.svg +3 -0
- package/src/app/assets/svg/Stock.svg +5 -0
- package/src/app/components/AccountSetupSteps.js +58 -0
- package/src/app/components/AddItemBillParent.js +373 -0
- package/src/app/components/AdditemBillChild.js +1257 -0
- package/src/app/components/Balance.js +211 -114
- package/src/app/components/BillList.js +548 -0
- package/src/app/components/BillSetupSteps.js +56 -0
- package/src/app/components/BottomView.js +39 -0
- package/src/app/components/BusinessCards/Card1.js +160 -0
- package/src/app/components/BusinessCards/Card10.js +209 -0
- package/src/app/components/BusinessCards/Card2.js +148 -0
- package/src/app/components/BusinessCards/Card3.js +147 -0
- package/src/app/components/BusinessCards/Card4.js +147 -0
- package/src/app/components/BusinessCards/Card5.js +151 -0
- package/src/app/components/BusinessCards/Card6.js +157 -0
- package/src/app/components/BusinessCards/Card7.js +146 -0
- package/src/app/components/BusinessCards/Card8.js +170 -0
- package/src/app/components/BusinessCards/Card9.js +209 -0
- package/src/app/components/BusinessCards/index.js +10 -0
- package/src/app/components/CashEntryComponent.js +297 -0
- package/src/app/components/CityModal.js +117 -0
- package/src/app/components/CountryPhoneInput.js +373 -267
- package/src/app/components/CreateExpenseAccount.js +141 -0
- package/src/app/components/CustomStatusBar.js +33 -0
- package/src/app/components/CustomToast.js +143 -0
- package/src/app/components/DeleteBusinessModal.js +196 -0
- package/src/app/components/DiscountTaxModal.js +256 -0
- package/src/app/components/Entries.js +87 -67
- package/src/app/components/ExpenseList.js +507 -0
- package/src/app/components/ExpenseParent.js +446 -0
- package/src/app/components/FloatingInput.js +188 -0
- package/src/app/components/Header.js +121 -0
- package/src/app/components/Loader.js +35 -0
- package/src/app/components/PartyModal.js +213 -0
- package/src/app/components/PickerModal.js +176 -0
- package/src/app/components/SalePaymentModal.js +822 -0
- package/src/app/components/SearchBar.js +225 -47
- package/src/app/components/StockDetailChild.js +461 -0
- package/src/app/components/StockList.js +582 -0
- package/src/app/components/StockReportTransaction.js +192 -0
- package/src/app/components/Transaction.js +277 -86
- package/src/app/components/User.js +188 -80
- package/src/app/components/index.js +51 -13
- package/src/app/database/bill.js +305 -0
- package/src/app/database/business.js +499 -0
- package/src/app/database/cash.js +451 -0
- package/src/app/database/clients.js +1536 -43
- package/src/app/database/expense.js +439 -0
- package/src/app/database/schema.js +115 -4
- package/src/app/database/stock.js +724 -0
- package/src/app/htmlTemplates/htmlTemplates.js +2603 -0
- package/src/app/navigation/BillStack/BillStack.js +38 -0
- package/src/app/navigation/BottomTabs/BottomTabs.js +24 -19
- package/src/app/navigation/BusinessStack/BusinessStack.js +27 -0
- package/src/app/navigation/CashStack/CashStack.js +59 -0
- package/src/app/navigation/EntriesStack/EntriesStack.js +186 -0
- package/src/app/navigation/ExpenseStack.js/ExpenseStack.js +50 -0
- package/src/app/navigation/HomeStack/HomeStack.js +106 -39
- package/src/app/navigation/Root.js +16 -1
- package/src/app/navigation/SaleStack/SaleStack.js +62 -0
- package/src/app/navigation/StockStack/StockStack.js +48 -0
- package/src/app/navigation/index.js +5 -1
- package/src/app/redux/Store.js +2 -0
- package/src/app/redux/reducers/client/client_reducers.js +31 -2
- package/src/app/redux/reducers/client/client_types.js +8 -1
- package/src/app/redux/reducers/user/user_reducers.js +24 -0
- package/src/app/redux/reducers/user/user_types.js +3 -0
- package/src/app/screens/AddBank.js +353 -0
- package/src/app/screens/AddBusiness.js +1161 -0
- package/src/app/screens/AddItems.js +515 -0
- package/src/app/screens/AddScreen.js +525 -165
- package/src/app/screens/All.js +1074 -0
- package/src/app/screens/AllTransactions.js +1138 -0
- package/src/app/screens/Banks.js +1134 -133
- package/src/app/screens/BillDetails.js +989 -0
- package/src/app/screens/BillHome.js +97 -0
- package/src/app/screens/BillParent.js +419 -0
- package/src/app/screens/BusinessDetail.js +939 -0
- package/src/app/screens/CashEntry.js +2913 -0
- package/src/app/screens/CashEntryDetails.js +650 -0
- package/src/app/screens/CashHome.js +594 -0
- package/src/app/screens/CashReport.js +1658 -0
- package/src/app/screens/CashSummary.js +607 -0
- package/src/app/screens/CreateBill.js +2504 -0
- package/src/app/screens/CustomerEntries.js +1578 -350
- package/src/app/screens/Customers.js +1066 -213
- package/src/app/screens/EditCategory.js +316 -0
- package/src/app/screens/EditCategoryStock.js +320 -0
- package/src/app/screens/Entry.js +2555 -585
- package/src/app/screens/ExpenseDetail.js +14 -0
- package/src/app/screens/ExpenseEntries.js +837 -0
- package/src/app/screens/ExpenseEntry.js +2478 -0
- package/src/app/screens/ExpenseEntryDetails.js +612 -0
- package/src/app/screens/ExpenseEntryReport.js +1059 -0
- package/src/app/screens/ExpenseReport.js +1071 -0
- package/src/app/screens/Geolocation.js +435 -0
- package/src/app/screens/GetStarted.js +201 -0
- package/src/app/screens/HomeScreen.js +368 -132
- package/src/app/screens/InBuy.js +918 -0
- package/src/app/screens/ItemEntryDetails.js +582 -0
- package/src/app/screens/LowStock.js +417 -0
- package/src/app/screens/NewPin.js +225 -0
- package/src/app/screens/OutSell.js +2153 -0
- package/src/app/screens/POSSale.js +639 -0
- package/src/app/screens/PinScreen.js +720 -0
- package/src/app/screens/PreviewBill.js +302 -0
- package/src/app/screens/Profile.js +1594 -0
- package/src/app/screens/RateList.js +525 -0
- package/src/app/screens/Report.js +1401 -0
- package/src/app/screens/SaleItemDetail.js +1187 -0
- package/src/app/screens/SaleParent.js +345 -0
- package/src/app/screens/SelectBank.js +220 -0
- package/src/app/screens/SelectBusiness.js +670 -163
- package/src/app/screens/Splash.js +96 -15
- package/src/app/screens/StockChild.js +372 -0
- package/src/app/screens/StockDetail.js +758 -0
- package/src/app/screens/StockParent.js +287 -0
- package/src/app/screens/StockReport.js +1359 -0
- package/src/app/screens/StockValue.js +720 -0
- package/src/app/screens/Suppliers.js +1098 -205
- package/src/app/screens/TransactionDetails.js +1674 -180
- package/src/app/screens/UpdateBusiness.js +837 -0
- package/src/app/screens/VisionCamera.js +54 -0
- package/src/app/screens/index.js +111 -21
- package/src/app/screens/new.html +171 -0
- package/src/app/themes/config.js +431 -114
- package/src/app/utils/city.json +7265 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import db from "./database.js";
|
|
4
|
-
export const addClient = (name, phoneNum, type
|
|
4
|
+
export const addClient = (name, phoneNum, type, business_id = null, serverId = null,
|
|
5
|
+
// NEW: serverId
|
|
6
|
+
created_at = null, updated_at = null) => {
|
|
5
7
|
return new Promise((resolve, reject) => {
|
|
6
|
-
// Default JSON for status
|
|
7
8
|
const defaultStatus = JSON.stringify({
|
|
8
9
|
flat: "",
|
|
9
10
|
landmark: "",
|
|
@@ -11,23 +12,138 @@ export const addClient = (name, phoneNum, type) => {
|
|
|
11
12
|
city: "",
|
|
12
13
|
state: ""
|
|
13
14
|
});
|
|
15
|
+
const normalizedPhone = phoneNum ? String(phoneNum).trim() : "";
|
|
14
16
|
db.transaction(tx => {
|
|
15
|
-
|
|
17
|
+
// 🟢 Case 1: No phone number → insert directly
|
|
18
|
+
if (!normalizedPhone) {
|
|
19
|
+
const fields = ["name", "phone", "type", "status", "isDeleted", "business_id"];
|
|
20
|
+
const placeholders = ["?", "?", "?", "?", 0, "?"];
|
|
21
|
+
const values = [name, null, type, defaultStatus, business_id];
|
|
22
|
+
if (serverId !== null) {
|
|
23
|
+
fields.push("serverId");
|
|
24
|
+
placeholders.push("?");
|
|
25
|
+
values.push(serverId);
|
|
26
|
+
}
|
|
27
|
+
if (created_at) {
|
|
28
|
+
fields.push("created_at");
|
|
29
|
+
placeholders.push("?");
|
|
30
|
+
values.push(created_at);
|
|
31
|
+
}
|
|
32
|
+
if (updated_at) {
|
|
33
|
+
fields.push("updated_at");
|
|
34
|
+
placeholders.push("?");
|
|
35
|
+
values.push(updated_at);
|
|
36
|
+
}
|
|
37
|
+
const sql = `INSERT INTO Clients (${fields.join(",")}) VALUES (${placeholders.join(",")})`;
|
|
38
|
+
tx.executeSql(sql, values, (txObj, insertResult) => resolve(insertResult), (txObj, error) => reject(error));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 🟢 Case 2: Check for existing client (same phone & same business)
|
|
43
|
+
tx.executeSql(`
|
|
44
|
+
SELECT * FROM Clients
|
|
45
|
+
WHERE phone = ?
|
|
46
|
+
AND (isDeleted IS NULL OR isDeleted = 0)
|
|
47
|
+
AND business_id = ?
|
|
48
|
+
`, [normalizedPhone, business_id], (txObj, resultSet) => {
|
|
49
|
+
if (resultSet.rows.length > 0) {
|
|
50
|
+
// 🟥 Duplicate found → don't insert
|
|
51
|
+
const existing = resultSet.rows.item(0);
|
|
52
|
+
resolve({
|
|
53
|
+
insertId: existing.id,
|
|
54
|
+
rowsAffected: 0,
|
|
55
|
+
existing: true,
|
|
56
|
+
client: existing
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
// 🟢 Case 3: Insert new client (unique phone + business_id)
|
|
60
|
+
const fields = ["name", "phone", "type", "status", "isDeleted", "business_id"];
|
|
61
|
+
const placeholders = ["?", "?", "?", "?", 0, "?"];
|
|
62
|
+
const values = [name, normalizedPhone, type, defaultStatus, business_id];
|
|
63
|
+
if (serverId !== null) {
|
|
64
|
+
fields.push("serverId");
|
|
65
|
+
placeholders.push("?");
|
|
66
|
+
values.push(serverId);
|
|
67
|
+
}
|
|
68
|
+
if (created_at) {
|
|
69
|
+
fields.push("created_at");
|
|
70
|
+
placeholders.push("?");
|
|
71
|
+
values.push(created_at);
|
|
72
|
+
}
|
|
73
|
+
if (updated_at) {
|
|
74
|
+
fields.push("updated_at");
|
|
75
|
+
placeholders.push("?");
|
|
76
|
+
values.push(updated_at);
|
|
77
|
+
}
|
|
78
|
+
const sql = `INSERT INTO Clients (${fields.join(",")}) VALUES (${placeholders.join(",")})`;
|
|
79
|
+
tx.executeSql(sql, values, (txObj, insertResult) => resolve(insertResult), (txObj, error) => reject(error));
|
|
80
|
+
}
|
|
81
|
+
}, (txObj, error) => reject(error));
|
|
16
82
|
});
|
|
17
83
|
});
|
|
18
84
|
};
|
|
19
|
-
export const getAllClients = () => {
|
|
85
|
+
export const getAllClients = (sortBy = 'most_recent', business_id = null) => {
|
|
20
86
|
return new Promise((resolve, reject) => {
|
|
21
87
|
db.transaction(tx => {
|
|
22
|
-
|
|
23
|
-
|
|
88
|
+
// Base query
|
|
89
|
+
let sql = `
|
|
90
|
+
SELECT
|
|
91
|
+
c.id,
|
|
92
|
+
c.serverId AS serverId, -- ✅ Ensure serverId is returned
|
|
93
|
+
c.name,
|
|
94
|
+
c.type,
|
|
95
|
+
c.local_path,
|
|
96
|
+
c.notification,
|
|
97
|
+
c.phone,
|
|
98
|
+
c.paydate,
|
|
99
|
+
c.business_id,
|
|
100
|
+
|
|
101
|
+
IFNULL(SUM(CAST(t.amount AS REAL)), 0) AS total_amount,
|
|
102
|
+
IFNULL(SUM(CAST(t.subamount AS REAL)), 0) AS total_subamount,
|
|
103
|
+
IFNULL(MAX(t.created_at), '') AS latest_created_at,
|
|
104
|
+
IFNULL(MAX(t.updated_at), '') AS latest_updated_at,
|
|
105
|
+
IFNULL(MAX(c.created_at), '') AS created_at,
|
|
106
|
+
IFNULL(MAX(t.date), '') AS latest_transaction_date,
|
|
107
|
+
COALESCE(MAX(t.date), MAX(c.created_at)) AS effective_date
|
|
108
|
+
FROM Clients c
|
|
109
|
+
LEFT JOIN Transactions t
|
|
110
|
+
ON c.id = t.customer_id
|
|
111
|
+
AND (t.isDeleted IS NULL OR t.isDeleted = 0)
|
|
112
|
+
WHERE
|
|
113
|
+
(c.isDeleted IS NULL OR c.isDeleted = 0)
|
|
114
|
+
`;
|
|
115
|
+
const params = [];
|
|
116
|
+
// Add filter if business_id is provided
|
|
117
|
+
if (business_id !== null && business_id !== undefined) {
|
|
118
|
+
sql += ` AND c.business_id = ?`;
|
|
119
|
+
params.push(business_id);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// GROUP BY clause
|
|
123
|
+
sql += `
|
|
124
|
+
GROUP BY
|
|
125
|
+
c.id,
|
|
126
|
+
c.serverId, -- ✅ Include in GROUP BY
|
|
127
|
+
c.name,
|
|
128
|
+
c.type,
|
|
129
|
+
c.local_path,
|
|
130
|
+
c.notification,
|
|
131
|
+
c.phone,
|
|
132
|
+
c.paydate,
|
|
133
|
+
c.business_id
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
// Sorting logic
|
|
137
|
+
if (sortBy === 'most_recent') sql += ` ORDER BY effective_date DESC`;else if (sortBy === 'oldest') sql += ` ORDER BY effective_date ASC`;else if (sortBy === 'name_az') sql += ` ORDER BY c.name COLLATE NOCASE ASC`;else if (sortBy === 'name_za') sql += ` ORDER BY c.name COLLATE NOCASE DESC`;else sql += ` ORDER BY effective_date DESC`;
|
|
138
|
+
|
|
139
|
+
// Execute SQL
|
|
140
|
+
tx.executeSql(sql, params, (txObj, resultSet) => {
|
|
141
|
+
const data = [];
|
|
24
142
|
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
25
|
-
|
|
143
|
+
data.push(resultSet.rows.item(i));
|
|
26
144
|
}
|
|
27
|
-
resolve(
|
|
28
|
-
}, (txObj, error) =>
|
|
29
|
-
reject(error);
|
|
30
|
-
});
|
|
145
|
+
resolve(data);
|
|
146
|
+
}, (txObj, error) => reject(error));
|
|
31
147
|
});
|
|
32
148
|
});
|
|
33
149
|
};
|
|
@@ -46,37 +162,277 @@ export const deleteClientById = id => {
|
|
|
46
162
|
});
|
|
47
163
|
});
|
|
48
164
|
};
|
|
49
|
-
export const getClientsByType = type => {
|
|
165
|
+
export const getClientsByType = (type, sortBy = 'most_recent', monthName = null, business_id) => {
|
|
50
166
|
return new Promise((resolve, reject) => {
|
|
51
167
|
db.transaction(tx => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
168
|
+
let sql = `
|
|
169
|
+
SELECT
|
|
170
|
+
c.id,
|
|
171
|
+
c.name,
|
|
172
|
+
c.type,
|
|
173
|
+
c.account, -- ✅ Added account
|
|
174
|
+
c.local_path,
|
|
175
|
+
c.notification,
|
|
176
|
+
c.phone,
|
|
177
|
+
c.paydate,
|
|
178
|
+
c.business_id,
|
|
179
|
+
|
|
180
|
+
IFNULL(SUM(CAST(t.amount AS REAL)), 0) AS total_amount,
|
|
181
|
+
IFNULL(SUM(CAST(t.subamount AS REAL)), 0) AS total_subamount,
|
|
182
|
+
IFNULL(MAX(t.created_at), '') AS latest_created_at,
|
|
183
|
+
IFNULL(MAX(t.updated_at), '') AS latest_updated_at,
|
|
184
|
+
IFNULL(MAX(c.updated_at), '') AS created_at,
|
|
185
|
+
IFNULL(MAX(t.date), '') AS latest_transaction_date,
|
|
186
|
+
COALESCE(MAX(t.date), MAX(c.created_at)) AS effective_date
|
|
187
|
+
FROM Clients c
|
|
188
|
+
LEFT JOIN Transactions t
|
|
189
|
+
ON c.id = t.customer_id
|
|
190
|
+
AND (t.isDeleted IS NULL OR t.isDeleted = 0)
|
|
191
|
+
WHERE
|
|
192
|
+
c.type = ?
|
|
193
|
+
AND c.business_id = ?
|
|
194
|
+
AND (c.isDeleted IS NULL OR c.isDeleted = 0)
|
|
195
|
+
GROUP BY
|
|
196
|
+
c.id,
|
|
197
|
+
c.name,
|
|
198
|
+
c.type,
|
|
199
|
+
c.account, -- ✅ Added to GROUP BY
|
|
200
|
+
c.local_path,
|
|
201
|
+
c.notification,
|
|
202
|
+
c.phone,
|
|
203
|
+
c.paydate,
|
|
204
|
+
c.business_id
|
|
205
|
+
`;
|
|
206
|
+
|
|
207
|
+
// Sorting
|
|
208
|
+
if (sortBy === 'most_recent') sql += ` ORDER BY effective_date DESC`;else if (sortBy === 'oldest') sql += ` ORDER BY effective_date ASC`;else if (sortBy === 'name_az') sql += ` ORDER BY c.name COLLATE NOCASE ASC`;else if (sortBy === 'name_za') sql += ` ORDER BY c.name COLLATE NOCASE DESC`;else sql += ` ORDER BY effective_date DESC`;
|
|
209
|
+
tx.executeSql(sql, [type, business_id], (txObj, resultSet) => {
|
|
210
|
+
const data = [];
|
|
66
211
|
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
67
212
|
data.push(resultSet.rows.item(i));
|
|
68
213
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
214
|
+
|
|
215
|
+
// ✅ Optional month filter
|
|
216
|
+
let filteredData = data;
|
|
217
|
+
if (monthName) {
|
|
218
|
+
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
219
|
+
filteredData = data.filter(item => {
|
|
220
|
+
const dateStr = item?.latest_transaction_date || item?.created_at;
|
|
221
|
+
if (!dateStr) return false;
|
|
222
|
+
const date = new Date(dateStr.replace(" ", "T"));
|
|
223
|
+
return months[date.getMonth()] === monthName;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
resolve(filteredData);
|
|
227
|
+
}, (txObj, error) => reject(error));
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// export const getClientsByType = (type, sortBy = 'most_recent') => {
|
|
233
|
+
// return new Promise((resolve, reject) => {
|
|
234
|
+
// db.transaction((tx) => {
|
|
235
|
+
// // Base query
|
|
236
|
+
// let sql = `
|
|
237
|
+
// SELECT
|
|
238
|
+
// c.id,
|
|
239
|
+
// c.name,
|
|
240
|
+
// c.type,
|
|
241
|
+
// c.local_path,
|
|
242
|
+
// c.notification,
|
|
243
|
+
// c.phone,
|
|
244
|
+
// c.paydate, -- added here
|
|
245
|
+
|
|
246
|
+
// IFNULL(SUM(t.amount), 0) AS total_amount,
|
|
247
|
+
// IFNULL(SUM(t.subamount), 0) AS total_subamount,
|
|
248
|
+
// IFNULL(MAX(t.created_at), '') AS latest_created_at,
|
|
249
|
+
// IFNULL(MAX(t.updated_at), '') AS latest_updated_at,
|
|
250
|
+
// IFNULL(MAX(c.updated_at), '') AS created_at,
|
|
251
|
+
// IFNULL(MAX(t.date), '') AS latest_transaction_date,
|
|
252
|
+
// COALESCE(MAX(t.date), MAX(c.created_at)) AS effective_date
|
|
253
|
+
// FROM Clients c
|
|
254
|
+
// LEFT JOIN Transactions t
|
|
255
|
+
// ON c.id = t.customer_id
|
|
256
|
+
// AND (t.isDeleted IS NULL OR t.isDeleted = 0) -- exclude deleted transactions
|
|
257
|
+
// WHERE c.type = ?
|
|
258
|
+
// GROUP BY
|
|
259
|
+
// c.id,
|
|
260
|
+
// c.name,
|
|
261
|
+
// c.type,
|
|
262
|
+
// c.local_path,
|
|
263
|
+
// c.notification,
|
|
264
|
+
// c.phone,
|
|
265
|
+
// c.paydate
|
|
266
|
+
// `;
|
|
267
|
+
|
|
268
|
+
// // Decide order by clause based on sortBy
|
|
269
|
+
// if (sortBy === 'most_recent') {
|
|
270
|
+
// sql += ` ORDER BY effective_date DESC`;
|
|
271
|
+
// } else if (sortBy === 'oldest') {
|
|
272
|
+
// sql += ` ORDER BY effective_date ASC`;
|
|
273
|
+
// } else if (sortBy === 'name_az') {
|
|
274
|
+
// sql += ` ORDER BY c.name COLLATE NOCASE ASC`;
|
|
275
|
+
// } else if (sortBy === 'name_za') {
|
|
276
|
+
// sql += ` ORDER BY c.name COLLATE NOCASE DESC`;
|
|
277
|
+
// } else {
|
|
278
|
+
// // default
|
|
279
|
+
// sql += ` ORDER BY effective_date DESC`;
|
|
280
|
+
// }
|
|
281
|
+
|
|
282
|
+
// tx.executeSql(
|
|
283
|
+
// sql,
|
|
284
|
+
// [type],
|
|
285
|
+
// (txObj, resultSet) => {
|
|
286
|
+
// let data = [];
|
|
287
|
+
// for (let i = 0; i < resultSet.rows.length; i++) {
|
|
288
|
+
// data.push(resultSet.rows.item(i));
|
|
289
|
+
// }
|
|
290
|
+
// resolve(data);
|
|
291
|
+
// },
|
|
292
|
+
// (txObj, error) => {
|
|
293
|
+
// reject(error);
|
|
294
|
+
// }
|
|
295
|
+
// );
|
|
296
|
+
// });
|
|
297
|
+
// });
|
|
298
|
+
// };
|
|
299
|
+
|
|
300
|
+
// export const getClientsByType = (type, sortBy = 'most_recent') => {
|
|
301
|
+
// return new Promise((resolve, reject) => {
|
|
302
|
+
// db.transaction((tx) => {
|
|
303
|
+
// // Base query
|
|
304
|
+
// let sql = `
|
|
305
|
+
// SELECT
|
|
306
|
+
// c.id,
|
|
307
|
+
// c.name,
|
|
308
|
+
// c.type,
|
|
309
|
+
// c.local_path,
|
|
310
|
+
// c.notification,
|
|
311
|
+
// c.phone,
|
|
312
|
+
// c.paydate, -- added here
|
|
313
|
+
|
|
314
|
+
// IFNULL(SUM(t.amount), 0) AS total_amount,
|
|
315
|
+
// IFNULL(SUM(t.subamount), 0) AS total_subamount,
|
|
316
|
+
// IFNULL(MAX(t.created_at), '') AS latest_created_at,
|
|
317
|
+
// IFNULL(MAX(t.updated_at), '') AS latest_updated_at,
|
|
318
|
+
// IFNULL(MAX(c.updated_at), '') AS created_at,
|
|
319
|
+
// IFNULL(MAX(t.date), '') AS latest_transaction_date,
|
|
320
|
+
// COALESCE(MAX(t.date), MAX(c.created_at)) AS effective_date
|
|
321
|
+
// FROM Clients c
|
|
322
|
+
// LEFT JOIN Transactions t
|
|
323
|
+
// ON c.id = t.customer_id
|
|
324
|
+
// WHERE c.type = ?
|
|
325
|
+
// GROUP BY
|
|
326
|
+
// c.id,
|
|
327
|
+
// c.name,
|
|
328
|
+
// c.type,
|
|
329
|
+
// c.local_path,
|
|
330
|
+
// c.notification,
|
|
331
|
+
// c.phone,
|
|
332
|
+
// c.paydate
|
|
333
|
+
// `;
|
|
334
|
+
|
|
335
|
+
// // Decide order by clause based on sortBy
|
|
336
|
+
// if (sortBy === 'most_recent') {
|
|
337
|
+
// sql += ` ORDER BY effective_date DESC`;
|
|
338
|
+
// } else if (sortBy === 'oldest') {
|
|
339
|
+
// sql += ` ORDER BY effective_date ASC`;
|
|
340
|
+
// } else if (sortBy === 'name_az') {
|
|
341
|
+
// sql += ` ORDER BY c.name COLLATE NOCASE ASC`;
|
|
342
|
+
// } else if (sortBy === 'name_za') {
|
|
343
|
+
// sql += ` ORDER BY c.name COLLATE NOCASE DESC`;
|
|
344
|
+
// } else {
|
|
345
|
+
// // default
|
|
346
|
+
// sql += ` ORDER BY effective_date DESC`;
|
|
347
|
+
// }
|
|
348
|
+
|
|
349
|
+
// tx.executeSql(
|
|
350
|
+
// sql,
|
|
351
|
+
// [type],
|
|
352
|
+
// (txObj, resultSet) => {
|
|
353
|
+
// let data = [];
|
|
354
|
+
// for (let i = 0; i < resultSet.rows.length; i++) {
|
|
355
|
+
// data.push(resultSet.rows.item(i));
|
|
356
|
+
// }
|
|
357
|
+
// resolve(data);
|
|
358
|
+
// },
|
|
359
|
+
// (txObj, error) => {
|
|
360
|
+
// reject(error);
|
|
361
|
+
// }
|
|
362
|
+
// );
|
|
363
|
+
// });
|
|
364
|
+
// });
|
|
365
|
+
// };
|
|
366
|
+
|
|
367
|
+
export const addTransaction = (customer_id, amount, subamount, notes, date, local_path, cash_type, items = '',
|
|
368
|
+
// optional field
|
|
369
|
+
isInstallment = 0,
|
|
370
|
+
// optional field
|
|
371
|
+
serverId = null,
|
|
372
|
+
// optional serverId
|
|
373
|
+
created_at = null,
|
|
374
|
+
// optional created_at
|
|
375
|
+
updated_at = null // optional updated_at
|
|
376
|
+
) => {
|
|
377
|
+
return new Promise((resolve, reject) => {
|
|
378
|
+
db.transaction(tx => {
|
|
379
|
+
const fields = ["customer_id", "amount", "subamount", "notes", "date", "local_path", "cash_type", "items", "isInstallment"];
|
|
380
|
+
const placeholders = ["?", "?", "?", "?", "?", "?", "?", "?", "?"];
|
|
381
|
+
const values = [customer_id, amount, subamount, notes, date, local_path, cash_type, items, isInstallment];
|
|
382
|
+
|
|
383
|
+
// Add serverId if provided
|
|
384
|
+
if (serverId) {
|
|
385
|
+
fields.push("serverId");
|
|
386
|
+
placeholders.push("?");
|
|
387
|
+
values.push(serverId);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Add created_at if provided
|
|
391
|
+
if (created_at) {
|
|
392
|
+
fields.push("created_at");
|
|
393
|
+
placeholders.push("?");
|
|
394
|
+
values.push(created_at);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Add updated_at if provided
|
|
398
|
+
if (updated_at) {
|
|
399
|
+
fields.push("updated_at");
|
|
400
|
+
placeholders.push("?");
|
|
401
|
+
values.push(updated_at);
|
|
402
|
+
}
|
|
403
|
+
const sql = `INSERT INTO Transactions (${fields.join(",")}) VALUES (${placeholders.join(",")})`;
|
|
404
|
+
tx.executeSql(sql, values, (txObj, resultSet) => resolve(resultSet), (txObj, error) => reject(error));
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
export const getAllTransactions = () => {
|
|
409
|
+
return new Promise((resolve, reject) => {
|
|
410
|
+
db.transaction(tx => {
|
|
411
|
+
tx.executeSql(`SELECT * FROM Transactions ORDER BY date DESC, id DESC`,
|
|
412
|
+
// latest first
|
|
413
|
+
[], (txObj, resultSet) => {
|
|
414
|
+
const transactions = [];
|
|
415
|
+
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
416
|
+
transactions.push(resultSet.rows.item(i));
|
|
417
|
+
}
|
|
418
|
+
resolve(transactions);
|
|
419
|
+
}, (txObj, error) => reject(error));
|
|
73
420
|
});
|
|
74
421
|
});
|
|
75
422
|
};
|
|
76
|
-
export const
|
|
423
|
+
export const updateTransaction = (trxId, customer_id, amount, subamount, notes, date, local_path, items = '' // ✅ new optional field
|
|
424
|
+
) => {
|
|
77
425
|
return new Promise((resolve, reject) => {
|
|
78
426
|
db.transaction(tx => {
|
|
79
|
-
tx.executeSql(
|
|
427
|
+
tx.executeSql(`UPDATE Transactions
|
|
428
|
+
SET customer_id = ?,
|
|
429
|
+
amount = ?,
|
|
430
|
+
subamount = ?,
|
|
431
|
+
notes = ?,
|
|
432
|
+
date = ?,
|
|
433
|
+
local_path = ?,
|
|
434
|
+
items = ?
|
|
435
|
+
WHERE id = ?`, [customer_id, amount, subamount, notes, date, local_path, items, trxId], (txObj, resultSet) => resolve(resultSet), (txObj, error) => reject(error));
|
|
80
436
|
});
|
|
81
437
|
});
|
|
82
438
|
};
|
|
@@ -95,11 +451,27 @@ export const getClientDetails = id => {
|
|
|
95
451
|
});
|
|
96
452
|
});
|
|
97
453
|
};
|
|
98
|
-
export const getClientTransactions = client_id => {
|
|
454
|
+
export const getClientTransactions = (client_id, startDate, endDate) => {
|
|
99
455
|
return new Promise((resolve, reject) => {
|
|
100
456
|
db.transaction(tx => {
|
|
101
|
-
//
|
|
102
|
-
|
|
457
|
+
// Base SQL
|
|
458
|
+
let sql = `
|
|
459
|
+
SELECT *
|
|
460
|
+
FROM Transactions
|
|
461
|
+
WHERE customer_id = ?
|
|
462
|
+
AND (isDeleted IS NULL OR isDeleted = 0)
|
|
463
|
+
`;
|
|
464
|
+
const params = [client_id];
|
|
465
|
+
|
|
466
|
+
// ✅ Filter by date range if provided
|
|
467
|
+
if (startDate && endDate) {
|
|
468
|
+
sql += ` AND date(date) BETWEEN date(?) AND date(?)`;
|
|
469
|
+
params.push(startDate, endDate);
|
|
470
|
+
}
|
|
471
|
+
sql += ` ORDER BY date DESC`;
|
|
472
|
+
|
|
473
|
+
// Step 1: Get transactions
|
|
474
|
+
tx.executeSql(sql, params, (txObj, resultSet) => {
|
|
103
475
|
const transactions = [];
|
|
104
476
|
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
105
477
|
transactions.push({
|
|
@@ -108,7 +480,7 @@ export const getClientTransactions = client_id => {
|
|
|
108
480
|
});
|
|
109
481
|
}
|
|
110
482
|
if (transactions.length === 0) {
|
|
111
|
-
resolve([]);
|
|
483
|
+
resolve([]);
|
|
112
484
|
return;
|
|
113
485
|
}
|
|
114
486
|
|
|
@@ -139,6 +511,65 @@ export const getClientTransactions = client_id => {
|
|
|
139
511
|
});
|
|
140
512
|
});
|
|
141
513
|
};
|
|
514
|
+
|
|
515
|
+
// export const getClientTransactions = (client_id) => {
|
|
516
|
+
// return new Promise((resolve, reject) => {
|
|
517
|
+
// db.transaction((tx) => {
|
|
518
|
+
// // Step 1: Get all transactions for the client
|
|
519
|
+
// tx.executeSql(
|
|
520
|
+
// "SELECT * FROM Transactions WHERE customer_id = ? ORDER BY created_at DESC",
|
|
521
|
+
// [client_id],
|
|
522
|
+
// (txObj, resultSet) => {
|
|
523
|
+
// const transactions = [];
|
|
524
|
+
// for (let i = 0; i < resultSet.rows.length; i++) {
|
|
525
|
+
// transactions.push({
|
|
526
|
+
// ...resultSet.rows.item(i),
|
|
527
|
+
// attachments: [] // prepare attachments array
|
|
528
|
+
// });
|
|
529
|
+
// }
|
|
530
|
+
|
|
531
|
+
// if (transactions.length === 0) {
|
|
532
|
+
// resolve([]); // no transactions → return empty array
|
|
533
|
+
// return;
|
|
534
|
+
// }
|
|
535
|
+
|
|
536
|
+
// // Step 2: Collect transaction IDs
|
|
537
|
+
// const trxIds = transactions.map((t) => t.id);
|
|
538
|
+
|
|
539
|
+
// // Step 3: Query all attachments for these trxIds
|
|
540
|
+
// const placeholders = trxIds.map(() => "?").join(",");
|
|
541
|
+
// tx.executeSql(
|
|
542
|
+
// `SELECT * FROM TransactionImages WHERE trxId IN (${placeholders})`,
|
|
543
|
+
// trxIds,
|
|
544
|
+
// (txObj2, resultSet2) => {
|
|
545
|
+
// const attachments = [];
|
|
546
|
+
// for (let i = 0; i < resultSet2.rows.length; i++) {
|
|
547
|
+
// attachments.push(resultSet2.rows.item(i));
|
|
548
|
+
// }
|
|
549
|
+
|
|
550
|
+
// // Step 4: Merge attachments into transactions
|
|
551
|
+
// const transactionMap = {};
|
|
552
|
+
// transactions.forEach((t) => {
|
|
553
|
+
// transactionMap[t.id] = t;
|
|
554
|
+
// });
|
|
555
|
+
|
|
556
|
+
// attachments.forEach((att) => {
|
|
557
|
+
// if (transactionMap[att.trxId]) {
|
|
558
|
+
// transactionMap[att.trxId].attachments.push(att);
|
|
559
|
+
// }
|
|
560
|
+
// });
|
|
561
|
+
|
|
562
|
+
// resolve(transactions);
|
|
563
|
+
// },
|
|
564
|
+
// (txObj2, error) => reject(error)
|
|
565
|
+
// );
|
|
566
|
+
// },
|
|
567
|
+
// (txObj, error) => reject(error)
|
|
568
|
+
// );
|
|
569
|
+
// });
|
|
570
|
+
// });
|
|
571
|
+
// };
|
|
572
|
+
|
|
142
573
|
export const addTransactionImages = (trxId, local_path) => {
|
|
143
574
|
return new Promise((resolve, reject) => {
|
|
144
575
|
db.transaction(tx => {
|
|
@@ -146,4 +577,719 @@ export const addTransactionImages = (trxId, local_path) => {
|
|
|
146
577
|
});
|
|
147
578
|
});
|
|
148
579
|
};
|
|
580
|
+
export const updateTransactionImage = (attachment_id, trxId, local_path) => {
|
|
581
|
+
return new Promise((resolve, reject) => {
|
|
582
|
+
// if uri is falsy or an empty string -> delete the row
|
|
583
|
+
if (!local_path || typeof local_path === 'string' && local_path.trim() === '') {
|
|
584
|
+
if (!attachment_id) {
|
|
585
|
+
// nothing to delete
|
|
586
|
+
console.log('updateTransactionImage: no attachment_id to delete');
|
|
587
|
+
return resolve({
|
|
588
|
+
rowsAffected: 0
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
// delete instead of update
|
|
592
|
+
return deleteTransactionImage(attachment_id).then(res => resolve(res)).catch(err => reject(err));
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// if there's no attachment_id (new file), fall back to INSERT
|
|
596
|
+
if (!attachment_id) {
|
|
597
|
+
// call your existing addTransactionImages function
|
|
598
|
+
return addTransactionImages(trxId, local_path).then(res => {
|
|
599
|
+
console.log('Inserted new TransactionImage, insertId:', res.insertId);
|
|
600
|
+
resolve(res);
|
|
601
|
+
}).catch(err => {
|
|
602
|
+
console.log('Error inserting new TransactionImage:', err);
|
|
603
|
+
reject(err);
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// Normal UPDATE branch
|
|
608
|
+
db.transaction(tx => {
|
|
609
|
+
tx.executeSql(`UPDATE TransactionImages
|
|
610
|
+
SET trxId = ?,
|
|
611
|
+
local_path = ?,
|
|
612
|
+
updated_at = datetime('now')
|
|
613
|
+
WHERE id = ?`, [trxId, local_path, attachment_id], (txObj, resultSet) => {
|
|
614
|
+
console.log('updateTransactionImage rowsAffected:', resultSet.rowsAffected);
|
|
615
|
+
resolve(resultSet);
|
|
616
|
+
}, (txObj, error) => {
|
|
617
|
+
console.log('SQLite error updating image:', error);
|
|
618
|
+
reject(error);
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
});
|
|
622
|
+
};
|
|
623
|
+
export const deleteTransactionImage = attachment_id => {
|
|
624
|
+
return new Promise((resolve, reject) => {
|
|
625
|
+
db.transaction(tx => {
|
|
626
|
+
tx.executeSql(`DELETE FROM TransactionImages WHERE id = ?`, [attachment_id], (txObj, resultSet) => {
|
|
627
|
+
console.log('deleteTransactionImage rowsAffected:', resultSet.rowsAffected);
|
|
628
|
+
resolve(resultSet);
|
|
629
|
+
}, (txObj, error) => {
|
|
630
|
+
console.log('SQLite error deleting image:', error);
|
|
631
|
+
reject(error);
|
|
632
|
+
});
|
|
633
|
+
});
|
|
634
|
+
});
|
|
635
|
+
};
|
|
636
|
+
export const deleteTransactionImagesByTrxId = trxId => {
|
|
637
|
+
return new Promise((resolve, reject) => {
|
|
638
|
+
db.transaction(tx => {
|
|
639
|
+
tx.executeSql(`DELETE FROM TransactionImages WHERE trxId = ?`, [trxId], (txObj, resultSet) => {
|
|
640
|
+
console.log('deleteTransactionImagesByTrxId rowsAffected:', resultSet.rowsAffected);
|
|
641
|
+
resolve(resultSet);
|
|
642
|
+
}, (txObj, error) => {
|
|
643
|
+
console.log('SQLite error deleting images by trxId:', error);
|
|
644
|
+
reject(error);
|
|
645
|
+
});
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
};
|
|
649
|
+
export const addBank = (bank_id, bank_name, bank_charges, transfer_time, icon, code, allowed_digits, bank_hint) => {
|
|
650
|
+
return new Promise((resolve, reject) => {
|
|
651
|
+
db.transaction(tx => {
|
|
652
|
+
tx.executeSql(`INSERT INTO Bank
|
|
653
|
+
(bank_id, bank_name, bank_charges, transfer_time, icon, code, allowed_digits, bank_hint)
|
|
654
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [bank_id, bank_name, bank_charges, transfer_time, icon, code, allowed_digits, bank_hint], (txObj, resultSet) => resolve(resultSet),
|
|
655
|
+
// success
|
|
656
|
+
(txObj, error) => reject(error) // error
|
|
657
|
+
);
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
};
|
|
661
|
+
export const getAllBanks = () => {
|
|
662
|
+
return new Promise((resolve, reject) => {
|
|
663
|
+
db.transaction(tx => {
|
|
664
|
+
tx.executeSql("SELECT * FROM Bank",
|
|
665
|
+
// your table name
|
|
666
|
+
[], (txObj, resultSet) => {
|
|
667
|
+
let results = [];
|
|
668
|
+
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
669
|
+
results.push(resultSet.rows.item(i));
|
|
670
|
+
}
|
|
671
|
+
resolve(results);
|
|
672
|
+
}, (txObj, error) => {
|
|
673
|
+
reject(error);
|
|
674
|
+
});
|
|
675
|
+
});
|
|
676
|
+
});
|
|
677
|
+
};
|
|
678
|
+
export const clearAllBanks = () => {
|
|
679
|
+
return new Promise((resolve, reject) => {
|
|
680
|
+
db.transaction(tx => {
|
|
681
|
+
tx.executeSql("DELETE FROM Bank",
|
|
682
|
+
// delete all rows
|
|
683
|
+
[], (txObj, resultSet) => {
|
|
684
|
+
resolve(resultSet); // success
|
|
685
|
+
}, (txObj, error) => {
|
|
686
|
+
reject(error); // error
|
|
687
|
+
});
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
};
|
|
691
|
+
export const bankExists = bank_id => {
|
|
692
|
+
return new Promise((resolve, reject) => {
|
|
693
|
+
db.transaction(tx => {
|
|
694
|
+
tx.executeSql("SELECT COUNT(*) as count FROM Bank WHERE bank_id = ?", [bank_id], (txObj, resultSet) => {
|
|
695
|
+
const count = resultSet.rows.item(0).count;
|
|
696
|
+
resolve(count > 0); // true if exists
|
|
697
|
+
}, (txObj, error) => reject(error));
|
|
698
|
+
});
|
|
699
|
+
});
|
|
700
|
+
};
|
|
701
|
+
export const insertBank = (name, phoneNum, type, notification, local_path, business_id, serverId = null,
|
|
702
|
+
// NEW: serverId
|
|
703
|
+
created_at = null, updated_at = null) => {
|
|
704
|
+
return new Promise((resolve, reject) => {
|
|
705
|
+
// Default JSON for status
|
|
706
|
+
const defaultStatus = JSON.stringify({
|
|
707
|
+
flat: "",
|
|
708
|
+
landmark: "",
|
|
709
|
+
pincode: "",
|
|
710
|
+
city: "",
|
|
711
|
+
state: ""
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
// Normalize inputs
|
|
715
|
+
const normalizedName = name ? String(name).trim() : "";
|
|
716
|
+
const normalizedPhone = phoneNum ? String(phoneNum).trim() : "";
|
|
717
|
+
db.transaction(tx => {
|
|
718
|
+
// Step 1: Check if a client with SAME name, SAME phone, AND SAME business exists
|
|
719
|
+
tx.executeSql(`SELECT * FROM Clients
|
|
720
|
+
WHERE name = ?
|
|
721
|
+
AND phone = ?
|
|
722
|
+
AND business_id = ?
|
|
723
|
+
AND (isDeleted IS NULL OR isDeleted = 0)`, [normalizedName, normalizedPhone, business_id], (txObj, resultSet) => {
|
|
724
|
+
if (resultSet.rows.length > 0) {
|
|
725
|
+
// Already exists → build a "fake" insertResult
|
|
726
|
+
const existing = resultSet.rows.item(0);
|
|
727
|
+
resolve({
|
|
728
|
+
insertId: existing.id,
|
|
729
|
+
rowsAffected: 0,
|
|
730
|
+
existing: true,
|
|
731
|
+
client: existing
|
|
732
|
+
});
|
|
733
|
+
} else {
|
|
734
|
+
// Step 2: Insert new record with optional created_at / updated_at / serverId
|
|
735
|
+
const fields = ["name", "phone", "type", "status", "notification", "local_path", "business_id", "isDeleted"];
|
|
736
|
+
const placeholders = ["?", "?", "?", "?", "?", "?", "?", 0];
|
|
737
|
+
const values = [normalizedName, normalizedPhone, type, defaultStatus, notification, local_path, business_id];
|
|
738
|
+
if (serverId !== null) {
|
|
739
|
+
fields.push("serverId");
|
|
740
|
+
placeholders.push("?");
|
|
741
|
+
values.push(serverId);
|
|
742
|
+
}
|
|
743
|
+
if (created_at) {
|
|
744
|
+
fields.push("created_at");
|
|
745
|
+
placeholders.push("?");
|
|
746
|
+
values.push(created_at);
|
|
747
|
+
}
|
|
748
|
+
if (updated_at) {
|
|
749
|
+
fields.push("updated_at");
|
|
750
|
+
placeholders.push("?");
|
|
751
|
+
values.push(updated_at);
|
|
752
|
+
}
|
|
753
|
+
const sql = `INSERT INTO Clients (${fields.join(",")}) VALUES (${placeholders.join(",")})`;
|
|
754
|
+
tx.executeSql(sql, values, (txObj, insertResult) => resolve(insertResult), (txObj, error) => reject(error));
|
|
755
|
+
}
|
|
756
|
+
}, (txObj, error) => reject(error));
|
|
757
|
+
});
|
|
758
|
+
});
|
|
759
|
+
};
|
|
760
|
+
export const setPayDate = (newPayDate, clientId, optionId) => {
|
|
761
|
+
return new Promise((resolve, reject) => {
|
|
762
|
+
db.transaction(tx => {
|
|
763
|
+
tx.executeSql("UPDATE Clients SET paydate = ?, fb_id = ? WHERE id = ?", [newPayDate, optionId, clientId], (txObj, resultSet) => {
|
|
764
|
+
console.log("Rows affected:", resultSet.rowsAffected);
|
|
765
|
+
resolve(resultSet);
|
|
766
|
+
}, (txObj, error) => {
|
|
767
|
+
console.log("Error updating paydate and fb_id:", error);
|
|
768
|
+
reject(error);
|
|
769
|
+
});
|
|
770
|
+
});
|
|
771
|
+
});
|
|
772
|
+
};
|
|
773
|
+
export const insertPhoneNum = (phoneNum, clientId) => {
|
|
774
|
+
return new Promise((resolve, reject) => {
|
|
775
|
+
db.transaction(tx => {
|
|
776
|
+
tx.executeSql("UPDATE Clients SET phone = ? WHERE id = ?", [phoneNum, clientId], (txObj, resultSet) => {
|
|
777
|
+
console.log("Rows affected:", resultSet.rowsAffected);
|
|
778
|
+
resolve(resultSet);
|
|
779
|
+
}, (txObj, error) => {
|
|
780
|
+
console.log("Error updating phone num:", error);
|
|
781
|
+
reject(error);
|
|
782
|
+
});
|
|
783
|
+
});
|
|
784
|
+
});
|
|
785
|
+
};
|
|
786
|
+
export const setProfilePic = (uri, clientId) => {
|
|
787
|
+
return new Promise((resolve, reject) => {
|
|
788
|
+
db.transaction(tx => {
|
|
789
|
+
tx.executeSql("UPDATE Clients SET local_path = ? WHERE id = ?", [uri, clientId], (txObj, resultSet) => {
|
|
790
|
+
console.log("Rows affected:", resultSet.rowsAffected);
|
|
791
|
+
resolve(resultSet);
|
|
792
|
+
}, (txObj, error) => {
|
|
793
|
+
console.log("Error updating profile pic and fb_id:", error);
|
|
794
|
+
reject(error);
|
|
795
|
+
});
|
|
796
|
+
});
|
|
797
|
+
});
|
|
798
|
+
};
|
|
799
|
+
export const setClientName = (name, clientId) => {
|
|
800
|
+
return new Promise((resolve, reject) => {
|
|
801
|
+
db.transaction(tx => {
|
|
802
|
+
tx.executeSql("UPDATE Clients SET name = ? WHERE id = ?", [name, clientId], (txObj, resultSet) => {
|
|
803
|
+
console.log("Name updated. Rows affected:", resultSet.rowsAffected);
|
|
804
|
+
resolve(resultSet);
|
|
805
|
+
}, (txObj, error) => {
|
|
806
|
+
console.log("Error updating name:", error);
|
|
807
|
+
reject(error);
|
|
808
|
+
});
|
|
809
|
+
});
|
|
810
|
+
});
|
|
811
|
+
};
|
|
812
|
+
export const setClientPhone = (phone, clientId) => {
|
|
813
|
+
return new Promise((resolve, reject) => {
|
|
814
|
+
db.transaction(tx => {
|
|
815
|
+
tx.executeSql("UPDATE Clients SET phone = ? WHERE id = ?", [phone, clientId], (txObj, resultSet) => {
|
|
816
|
+
console.log("Phone updated. Rows affected:", resultSet.rowsAffected);
|
|
817
|
+
resolve(resultSet);
|
|
818
|
+
}, (txObj, error) => {
|
|
819
|
+
console.log("Error updating phone:", error);
|
|
820
|
+
reject(error);
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
});
|
|
824
|
+
};
|
|
825
|
+
export const setClientCnic = (cnic, clientId) => {
|
|
826
|
+
return new Promise((resolve, reject) => {
|
|
827
|
+
db.transaction(tx => {
|
|
828
|
+
tx.executeSql("UPDATE Clients SET cnic = ? WHERE id = ?", [cnic, clientId], (txObj, resultSet) => {
|
|
829
|
+
console.log("CNIC updated. Rows affected:", resultSet.rowsAffected);
|
|
830
|
+
resolve(resultSet);
|
|
831
|
+
}, (txObj, error) => {
|
|
832
|
+
console.log("Error updating CNIC:", error);
|
|
833
|
+
reject(error);
|
|
834
|
+
});
|
|
835
|
+
});
|
|
836
|
+
});
|
|
837
|
+
};
|
|
838
|
+
export const setClientAddress = (addressObj, clientId) => {
|
|
839
|
+
return new Promise((resolve, reject) => {
|
|
840
|
+
const jsonAddress = JSON.stringify(addressObj);
|
|
841
|
+
db.transaction(tx => {
|
|
842
|
+
tx.executeSql('UPDATE Clients SET status = ? WHERE id = ?', [jsonAddress, clientId], (txObj, res) => resolve(res), (txObj, err) => reject(err));
|
|
843
|
+
});
|
|
844
|
+
});
|
|
845
|
+
};
|
|
846
|
+
export const switchClientToSupplier = clientId => {
|
|
847
|
+
return new Promise((resolve, reject) => {
|
|
848
|
+
db.transaction(tx => {
|
|
849
|
+
tx.executeSql("UPDATE Clients SET type = 1 WHERE id = ?", [clientId], (txObj, resultSet) => {
|
|
850
|
+
console.log("Rows affected (switch to supplier):", resultSet.rowsAffected);
|
|
851
|
+
resolve(resultSet);
|
|
852
|
+
}, (txObj, error) => {
|
|
853
|
+
console.log("Error switching client to supplier:", error);
|
|
854
|
+
reject(error);
|
|
855
|
+
});
|
|
856
|
+
});
|
|
857
|
+
});
|
|
858
|
+
};
|
|
859
|
+
export const getTransactionsByClientType = (type, startDate, endDate, businessId = null) => {
|
|
860
|
+
return new Promise((resolve, reject) => {
|
|
861
|
+
db.transaction(tx => {
|
|
862
|
+
// Base query
|
|
863
|
+
let sql = `
|
|
864
|
+
SELECT
|
|
865
|
+
t.*,
|
|
866
|
+
c.type AS client_type,
|
|
867
|
+
c.name AS client_name,
|
|
868
|
+
c.local_path AS client_local_path,
|
|
869
|
+
c.phone AS client_phone,
|
|
870
|
+
c.business_id AS client_business_id
|
|
871
|
+
FROM Transactions t
|
|
872
|
+
INNER JOIN Clients c ON t.customer_id = c.id
|
|
873
|
+
WHERE (t.isDeleted IS NULL OR t.isDeleted = 0) -- exclude soft deleted transactions
|
|
874
|
+
AND (c.isDeleted IS NULL OR c.isDeleted = 0) -- exclude soft deleted clients
|
|
875
|
+
`;
|
|
876
|
+
|
|
877
|
+
// Params array
|
|
878
|
+
const params = [];
|
|
879
|
+
|
|
880
|
+
// 🔹 Filter by client type if provided and not "all"
|
|
881
|
+
if (type && type.toLowerCase() !== 'all') {
|
|
882
|
+
sql += ` AND c.type = ?`;
|
|
883
|
+
params.push(type);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// 🔹 Filter by business ID if provided
|
|
887
|
+
if (businessId !== null && businessId !== undefined) {
|
|
888
|
+
sql += ` AND c.business_id = ?`;
|
|
889
|
+
params.push(businessId);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// 🔹 Filter by date range if both provided
|
|
893
|
+
if (startDate && endDate) {
|
|
894
|
+
sql += ` AND date(t.date) BETWEEN date(?) AND date(?)`;
|
|
895
|
+
params.push(startDate, endDate);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
// 🔹 Order by most recent first
|
|
899
|
+
sql += ` ORDER BY t.date DESC;`;
|
|
900
|
+
tx.executeSql(sql, params, async (txObj, resultSet) => {
|
|
901
|
+
const transactions = [];
|
|
902
|
+
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
903
|
+
transactions.push(resultSet.rows.item(i));
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// ✅ If no transactions, resolve immediately
|
|
907
|
+
if (transactions.length === 0) return resolve([]);
|
|
908
|
+
|
|
909
|
+
// 🔹 Fetch transaction images for these transactions
|
|
910
|
+
const ids = transactions.map(t => t.id);
|
|
911
|
+
const placeholders = ids.map(() => '?').join(',');
|
|
912
|
+
tx.executeSql(`SELECT * FROM TransactionImages WHERE trxId IN (${placeholders})`, ids, (txObj2, imgResult) => {
|
|
913
|
+
const imagesMap = {};
|
|
914
|
+
for (let j = 0; j < imgResult.rows.length; j++) {
|
|
915
|
+
const row = imgResult.rows.item(j);
|
|
916
|
+
if (!imagesMap[row.trxId]) imagesMap[row.trxId] = [];
|
|
917
|
+
imagesMap[row.trxId].push(row);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
// Attach images to each transaction
|
|
921
|
+
const withAttachments = transactions.map(t => ({
|
|
922
|
+
...t,
|
|
923
|
+
attachments: imagesMap[t.id] || []
|
|
924
|
+
}));
|
|
925
|
+
resolve(withAttachments);
|
|
926
|
+
}, (txObj2, err2) => reject(err2));
|
|
927
|
+
}, (txObj, error) => {
|
|
928
|
+
console.log("Error getting transactions:", error);
|
|
929
|
+
reject(error);
|
|
930
|
+
});
|
|
931
|
+
});
|
|
932
|
+
});
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
// export const getTransactionsByClientType = (type, startDate, endDate) => {
|
|
936
|
+
// return new Promise((resolve, reject) => {
|
|
937
|
+
// db.transaction((tx) => {
|
|
938
|
+
// let sql = `
|
|
939
|
+
// SELECT
|
|
940
|
+
// t.*,
|
|
941
|
+
// c.type AS client_type,
|
|
942
|
+
// c.name AS client_name
|
|
943
|
+
// FROM Transactions t
|
|
944
|
+
// INNER JOIN Clients c ON t.customer_id = c.id
|
|
945
|
+
// WHERE c.type = ?
|
|
946
|
+
// AND (t.isDeleted IS NULL OR t.isDeleted = 0) -- exclude soft deleted transactions
|
|
947
|
+
// `;
|
|
948
|
+
// const params = [type];
|
|
949
|
+
|
|
950
|
+
// if (startDate && endDate) {
|
|
951
|
+
// sql += ` AND date(t.date) BETWEEN date(?) AND date(?)`;
|
|
952
|
+
// params.push(startDate, endDate);
|
|
953
|
+
// }
|
|
954
|
+
|
|
955
|
+
// sql += ` ORDER BY t.date DESC;`;
|
|
956
|
+
|
|
957
|
+
// tx.executeSql(
|
|
958
|
+
// sql,
|
|
959
|
+
// params,
|
|
960
|
+
// async (txObj, resultSet) => {
|
|
961
|
+
// const transactions = [];
|
|
962
|
+
// for (let i = 0; i < resultSet.rows.length; i++) {
|
|
963
|
+
// transactions.push(resultSet.rows.item(i));
|
|
964
|
+
// }
|
|
965
|
+
|
|
966
|
+
// // Fetch all images for these transactions
|
|
967
|
+
// const ids = transactions.map(t => t.id);
|
|
968
|
+
// if (ids.length === 0) return resolve([]);
|
|
969
|
+
|
|
970
|
+
// const placeholders = ids.map(() => '?').join(',');
|
|
971
|
+
// tx.executeSql(
|
|
972
|
+
// `SELECT * FROM TransactionImages WHERE trxId IN (${placeholders})`,
|
|
973
|
+
// ids,
|
|
974
|
+
// (txObj2, imgResult) => {
|
|
975
|
+
// const imagesMap = {};
|
|
976
|
+
// for (let j = 0; j < imgResult.rows.length; j++) {
|
|
977
|
+
// const row = imgResult.rows.item(j);
|
|
978
|
+
// if (!imagesMap[row.trxId]) imagesMap[row.trxId] = [];
|
|
979
|
+
// imagesMap[row.trxId].push(row);
|
|
980
|
+
// }
|
|
981
|
+
|
|
982
|
+
// // Attach images to their transactions
|
|
983
|
+
// const withAttachments = transactions.map(t => ({
|
|
984
|
+
// ...t,
|
|
985
|
+
// attachments: imagesMap[t.id] || []
|
|
986
|
+
// }));
|
|
987
|
+
|
|
988
|
+
// resolve(withAttachments);
|
|
989
|
+
// },
|
|
990
|
+
// (txObj2, err2) => reject(err2)
|
|
991
|
+
// );
|
|
992
|
+
// },
|
|
993
|
+
// (txObj, error) => {
|
|
994
|
+
// console.log("Error getting transactions:", error);
|
|
995
|
+
// reject(error);
|
|
996
|
+
// }
|
|
997
|
+
// );
|
|
998
|
+
// });
|
|
999
|
+
// });
|
|
1000
|
+
// };
|
|
1001
|
+
|
|
1002
|
+
// export const getTransactionsByClientType = (type, startDate, endDate) => {
|
|
1003
|
+
// return new Promise((resolve, reject) => {
|
|
1004
|
+
// db.transaction((tx) => {
|
|
1005
|
+
// let sql = `
|
|
1006
|
+
// SELECT
|
|
1007
|
+
// t.*,
|
|
1008
|
+
// c.type AS client_type,
|
|
1009
|
+
// c.name AS client_name
|
|
1010
|
+
// FROM Transactions t
|
|
1011
|
+
// INNER JOIN Clients c ON t.customer_id = c.id
|
|
1012
|
+
// WHERE c.type = ?
|
|
1013
|
+
// `;
|
|
1014
|
+
// const params = [type];
|
|
1015
|
+
|
|
1016
|
+
// if (startDate && endDate) {
|
|
1017
|
+
// sql += ` AND date(t.date) BETWEEN date(?) AND date(?)`;
|
|
1018
|
+
// params.push(startDate, endDate);
|
|
1019
|
+
// }
|
|
1020
|
+
|
|
1021
|
+
// sql += ` ORDER BY t.date DESC;`;
|
|
1022
|
+
|
|
1023
|
+
// tx.executeSql(
|
|
1024
|
+
// sql,
|
|
1025
|
+
// params,
|
|
1026
|
+
// async (txObj, resultSet) => {
|
|
1027
|
+
// const transactions = [];
|
|
1028
|
+
// for (let i = 0; i < resultSet.rows.length; i++) {
|
|
1029
|
+
// transactions.push(resultSet.rows.item(i));
|
|
1030
|
+
// }
|
|
1031
|
+
|
|
1032
|
+
// // Fetch all images for these transactions
|
|
1033
|
+
// const ids = transactions.map(t => t.id);
|
|
1034
|
+
// if (ids.length === 0) return resolve([]);
|
|
1035
|
+
|
|
1036
|
+
// const placeholders = ids.map(() => '?').join(',');
|
|
1037
|
+
// tx.executeSql(
|
|
1038
|
+
// `SELECT * FROM TransactionImages WHERE trxId IN (${placeholders})`,
|
|
1039
|
+
// ids,
|
|
1040
|
+
// (txObj2, imgResult) => {
|
|
1041
|
+
// const imagesMap = {};
|
|
1042
|
+
// for (let j = 0; j < imgResult.rows.length; j++) {
|
|
1043
|
+
// const row = imgResult.rows.item(j);
|
|
1044
|
+
// if (!imagesMap[row.trxId]) imagesMap[row.trxId] = [];
|
|
1045
|
+
// imagesMap[row.trxId].push(row);
|
|
1046
|
+
// }
|
|
1047
|
+
|
|
1048
|
+
// // Attach images to their transactions
|
|
1049
|
+
// const withAttachments = transactions.map(t => ({
|
|
1050
|
+
// ...t,
|
|
1051
|
+
// attachments: imagesMap[t.id] || []
|
|
1052
|
+
// }));
|
|
1053
|
+
|
|
1054
|
+
// resolve(withAttachments);
|
|
1055
|
+
// },
|
|
1056
|
+
// (txObj2, err2) => reject(err2)
|
|
1057
|
+
// );
|
|
1058
|
+
// },
|
|
1059
|
+
// (txObj, error) => {
|
|
1060
|
+
// console.log("Error getting transactions:", error);
|
|
1061
|
+
// reject(error);
|
|
1062
|
+
// }
|
|
1063
|
+
// );
|
|
1064
|
+
// });
|
|
1065
|
+
// });
|
|
1066
|
+
// };
|
|
1067
|
+
|
|
1068
|
+
export const changeTransactionType = transactionId => {
|
|
1069
|
+
return new Promise((resolve, reject) => {
|
|
1070
|
+
db.transaction(tx => {
|
|
1071
|
+
tx.executeSql(`
|
|
1072
|
+
UPDATE Transactions
|
|
1073
|
+
SET
|
|
1074
|
+
amount = subamount,
|
|
1075
|
+
subamount = amount
|
|
1076
|
+
WHERE id = ?;
|
|
1077
|
+
`, [transactionId], (txObj, resultSet) => {
|
|
1078
|
+
console.log("Rows affected (swap amount & subamount):", resultSet.rowsAffected);
|
|
1079
|
+
resolve(resultSet);
|
|
1080
|
+
}, (txObj, error) => {
|
|
1081
|
+
console.log("Error swapping amount & subamount:", error);
|
|
1082
|
+
reject(error);
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
});
|
|
1086
|
+
};
|
|
1087
|
+
export const softDeleteTransaction = transactionId => {
|
|
1088
|
+
return new Promise((resolve, reject) => {
|
|
1089
|
+
db.transaction(tx => {
|
|
1090
|
+
tx.executeSql(`
|
|
1091
|
+
UPDATE Transactions
|
|
1092
|
+
SET isDeleted = 1
|
|
1093
|
+
WHERE id = ?;
|
|
1094
|
+
`, [transactionId], (txObj, resultSet) => {
|
|
1095
|
+
console.log("Rows affected (soft delete):", resultSet.rowsAffected);
|
|
1096
|
+
resolve(resultSet);
|
|
1097
|
+
}, (txObj, error) => {
|
|
1098
|
+
console.log("Error soft deleting transaction:", error);
|
|
1099
|
+
reject(error);
|
|
1100
|
+
});
|
|
1101
|
+
});
|
|
1102
|
+
});
|
|
1103
|
+
};
|
|
1104
|
+
export const changeClientType = (clientId, newType = 1) => {
|
|
1105
|
+
return new Promise((resolve, reject) => {
|
|
1106
|
+
db.transaction(tx => {
|
|
1107
|
+
tx.executeSql(`
|
|
1108
|
+
UPDATE Clients
|
|
1109
|
+
SET type = ?
|
|
1110
|
+
WHERE id = ?;
|
|
1111
|
+
`, [newType, clientId], (txObj, resultSet) => {
|
|
1112
|
+
console.log(`Client type changed to ${newType} for id ${clientId}`);
|
|
1113
|
+
resolve(resultSet);
|
|
1114
|
+
}, (txObj, error) => {
|
|
1115
|
+
console.log("Error changing client type:", error);
|
|
1116
|
+
reject(error);
|
|
1117
|
+
});
|
|
1118
|
+
});
|
|
1119
|
+
});
|
|
1120
|
+
};
|
|
1121
|
+
export const updateClientCreditLimit = (clientId, newCreditLimit) => {
|
|
1122
|
+
return new Promise((resolve, reject) => {
|
|
1123
|
+
db.transaction(tx => {
|
|
1124
|
+
tx.executeSql(`UPDATE Clients SET credit_limit = ? WHERE id = ?;`, [newCreditLimit, clientId], (txObj, resultSet) => {
|
|
1125
|
+
if (resultSet.rowsAffected > 0) {
|
|
1126
|
+
resolve(true); // Successfully updated
|
|
1127
|
+
} else {
|
|
1128
|
+
resolve(false); // No rows updated (maybe wrong clientId)
|
|
1129
|
+
}
|
|
1130
|
+
}, (txObj, error) => {
|
|
1131
|
+
console.error('Error updating credit_limit', error);
|
|
1132
|
+
reject(error);
|
|
1133
|
+
});
|
|
1134
|
+
});
|
|
1135
|
+
});
|
|
1136
|
+
};
|
|
1137
|
+
export const changeTransactionClient = (transactionId, newCustomerId) => {
|
|
1138
|
+
return new Promise((resolve, reject) => {
|
|
1139
|
+
db.transaction(tx => {
|
|
1140
|
+
tx.executeSql(`
|
|
1141
|
+
UPDATE Transactions
|
|
1142
|
+
SET customer_id = ?
|
|
1143
|
+
WHERE id = ?;
|
|
1144
|
+
`, [newCustomerId, transactionId], (txObj, resultSet) => {
|
|
1145
|
+
console.log(`Transaction ${transactionId} now assigned to customer_id ${newCustomerId}`);
|
|
1146
|
+
resolve(resultSet);
|
|
1147
|
+
}, (txObj, error) => {
|
|
1148
|
+
console.log("Error changing transaction customer_id:", error);
|
|
1149
|
+
reject(error);
|
|
1150
|
+
});
|
|
1151
|
+
});
|
|
1152
|
+
});
|
|
1153
|
+
};
|
|
1154
|
+
export const softDeleteClient = clientId => {
|
|
1155
|
+
return new Promise((resolve, reject) => {
|
|
1156
|
+
db.transaction(tx => {
|
|
1157
|
+
tx.executeSql(`
|
|
1158
|
+
UPDATE Clients
|
|
1159
|
+
SET isDeleted = 1
|
|
1160
|
+
WHERE id = ?;
|
|
1161
|
+
`, [clientId], (txObj, resultSet) => {
|
|
1162
|
+
console.log("Rows affected (soft delete):", resultSet.rowsAffected);
|
|
1163
|
+
resolve(resultSet);
|
|
1164
|
+
}, (txObj, error) => {
|
|
1165
|
+
console.log("Error soft deleting transaction:", error);
|
|
1166
|
+
reject(error);
|
|
1167
|
+
});
|
|
1168
|
+
});
|
|
1169
|
+
});
|
|
1170
|
+
};
|
|
1171
|
+
export const updateClientInstallmentDetails = (clientId, paymentDetails) => {
|
|
1172
|
+
return new Promise((resolve, reject) => {
|
|
1173
|
+
const jsonString = JSON.stringify(paymentDetails); // Convert JSON to string
|
|
1174
|
+
|
|
1175
|
+
db.transaction(tx => {
|
|
1176
|
+
tx.executeSql(`
|
|
1177
|
+
UPDATE Clients
|
|
1178
|
+
SET payment_mode = ?
|
|
1179
|
+
WHERE id = ?;
|
|
1180
|
+
`, [jsonString, clientId], (txObj, resultSet) => {
|
|
1181
|
+
console.log("Rows affected (update payment_details):", resultSet.rowsAffected);
|
|
1182
|
+
resolve(resultSet);
|
|
1183
|
+
}, (txObj, error) => {
|
|
1184
|
+
console.log("Error updating payment_details:", error);
|
|
1185
|
+
reject(error);
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
});
|
|
1189
|
+
};
|
|
1190
|
+
export const updateBankProfile = (clientId, phone, notification) => {
|
|
1191
|
+
return new Promise((resolve, reject) => {
|
|
1192
|
+
db.transaction(tx => {
|
|
1193
|
+
tx.executeSql(`
|
|
1194
|
+
UPDATE Clients
|
|
1195
|
+
SET phone = ?, notification = ?
|
|
1196
|
+
WHERE id = ?;
|
|
1197
|
+
`, [phone, notification, clientId], (txObj, resultSet) => {
|
|
1198
|
+
console.log("Rows affected (update):", resultSet.rowsAffected);
|
|
1199
|
+
resolve(resultSet);
|
|
1200
|
+
}, (txObj, error) => {
|
|
1201
|
+
console.log("Error updating client:", error);
|
|
1202
|
+
reject(error);
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
});
|
|
1206
|
+
};
|
|
1207
|
+
export const getActiveInstallments = () => {
|
|
1208
|
+
return new Promise((resolve, reject) => {
|
|
1209
|
+
db.transaction(tx => {
|
|
1210
|
+
tx.executeSql(`SELECT id, payment_mode FROM Clients WHERE (isDeleted IS NULL OR isDeleted = 0)`, [], (txObj, resultSet) => {
|
|
1211
|
+
let results = [];
|
|
1212
|
+
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
1213
|
+
if (resultSet.rows.item(i).payment_mode) {
|
|
1214
|
+
let parsedInstallment = JSON.parse(resultSet.rows.item(i).payment_mode);
|
|
1215
|
+
let clientId = resultSet.rows.item(i).id;
|
|
1216
|
+
if (parsedInstallment?.active == "1") {
|
|
1217
|
+
results.push({
|
|
1218
|
+
clientId,
|
|
1219
|
+
...parsedInstallment,
|
|
1220
|
+
start_date: parsedInstallment?.start_date,
|
|
1221
|
+
last_entry_date: parsedInstallment?.last_entry_date
|
|
1222
|
+
// start_date: parsedInstallment?.start_date && new Date(parsedInstallment.start_date),
|
|
1223
|
+
// last_entry_date: parsedInstallment?.last_entry_date && new Date(parsedInstallment.last_entry_date),
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
resolve(results);
|
|
1229
|
+
}, (txObj, error) => {
|
|
1230
|
+
reject(error);
|
|
1231
|
+
});
|
|
1232
|
+
});
|
|
1233
|
+
});
|
|
1234
|
+
};
|
|
1235
|
+
export const ensureTransactionsTableColumns = () => {
|
|
1236
|
+
db.transaction(tx => {
|
|
1237
|
+
// ✅ 1. Check and add 'cash_type' in Transactions table
|
|
1238
|
+
tx.executeSql(`PRAGMA table_info(Transactions);`, [], (txObj, resultSet) => {
|
|
1239
|
+
const cols = [];
|
|
1240
|
+
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
1241
|
+
cols.push(resultSet.rows.item(i).name);
|
|
1242
|
+
}
|
|
1243
|
+
if (!cols.includes('cash_type')) {
|
|
1244
|
+
tx.executeSql(`ALTER TABLE Transactions ADD COLUMN cash_type VARCHAR;`, [], () => console.log('✅ Added cash_type column to Transactions table'), (txObj, error) => console.error('⚠️ Failed to add cash_type column:', error));
|
|
1245
|
+
}
|
|
1246
|
+
}, (txObj, error) => console.error('⚠️ PRAGMA error (Transactions):', error));
|
|
1247
|
+
|
|
1248
|
+
// ✅ 2. Check and add 'fromExpense' in CashRegister table
|
|
1249
|
+
tx.executeSql(`PRAGMA table_info(CashRegister);`, [], (txObj, resultSet) => {
|
|
1250
|
+
const cols = [];
|
|
1251
|
+
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
1252
|
+
cols.push(resultSet.rows.item(i).name);
|
|
1253
|
+
}
|
|
1254
|
+
if (!cols.includes('fromExpense')) {
|
|
1255
|
+
tx.executeSql(`ALTER TABLE CashRegister ADD COLUMN fromExpense TEXT;`, [], () => console.log('✅ Added fromExpense column to CashRegister table'), (txObj, error) => console.error('⚠️ Failed to add fromExpense column:', error));
|
|
1256
|
+
}
|
|
1257
|
+
}, (txObj, error) => console.error('⚠️ PRAGMA error (CashRegister):', error));
|
|
1258
|
+
|
|
1259
|
+
// ✅ 3. Check and add 'isCash' in ExpenseTransaction table
|
|
1260
|
+
tx.executeSql(`PRAGMA table_info(ExpenseTransaction);`, [], (txObj, resultSet) => {
|
|
1261
|
+
const cols = [];
|
|
1262
|
+
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
1263
|
+
cols.push(resultSet.rows.item(i).name);
|
|
1264
|
+
}
|
|
1265
|
+
if (!cols.includes('isCash')) {
|
|
1266
|
+
tx.executeSql(`ALTER TABLE ExpenseTransaction ADD COLUMN isCash TEXT;`, [], () => console.log('✅ Added isCash column to ExpenseTransaction table'), (txObj, error) => console.error('⚠️ Failed to add isCash column:', error));
|
|
1267
|
+
}
|
|
1268
|
+
}, (txObj, error) => console.error('⚠️ PRAGMA error (ExpenseTransaction):', error));
|
|
1269
|
+
});
|
|
1270
|
+
};
|
|
1271
|
+
export const updateClientPaymentMode = (clientId, payment_mode) => {
|
|
1272
|
+
return new Promise((resolve, reject) => {
|
|
1273
|
+
db.transaction(tx => {
|
|
1274
|
+
tx.executeSql(`UPDATE Clients
|
|
1275
|
+
SET payment_mode = ?
|
|
1276
|
+
WHERE id = ?`, [payment_mode, clientId], (txObj, resultSet) => resolve(resultSet), (txObj, error) => reject(error));
|
|
1277
|
+
});
|
|
1278
|
+
});
|
|
1279
|
+
};
|
|
1280
|
+
export const hardDeleteClientsNotOfUser = async userId => {
|
|
1281
|
+
return new Promise((resolve, reject) => {
|
|
1282
|
+
db.transaction(tx => {
|
|
1283
|
+
tx.executeSql(`DELETE FROM Clients WHERE business_id NOT IN (
|
|
1284
|
+
SELECT id FROM Business WHERE user_id = ?
|
|
1285
|
+
)`, [userId], (txObj, resultSet) => {
|
|
1286
|
+
console.log('Hard deleted clients not of user:', resultSet);
|
|
1287
|
+
resolve(resultSet);
|
|
1288
|
+
}, (txObj, error) => {
|
|
1289
|
+
console.log('SQL Error (hard delete clients):', error);
|
|
1290
|
+
reject(error);
|
|
1291
|
+
});
|
|
1292
|
+
});
|
|
1293
|
+
});
|
|
1294
|
+
};
|
|
149
1295
|
//# sourceMappingURL=clients.js.map
|