diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..59d6d4a
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,25 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Wosull",
+ "request": "launch",
+ "type": "dart"
+ },
+ {
+ "name": "Wosull (profile mode)",
+ "request": "launch",
+ "type": "dart",
+ "flutterMode": "profile"
+ },
+ {
+ "name": "Wosull (release mode)",
+ "request": "launch",
+ "type": "dart",
+ "flutterMode": "release"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 9386822..eb531c5 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,10 +1,11 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/fonts/DejaVuSansMono.ttf b/fonts/DejaVuSansMono.ttf
new file mode 100644
index 0000000..8b7bb2a
Binary files /dev/null and b/fonts/DejaVuSansMono.ttf differ
diff --git a/images/active_cart.svg b/images/active_cart.svg
new file mode 100644
index 0000000..1613056
--- /dev/null
+++ b/images/active_cart.svg
@@ -0,0 +1,12 @@
+
diff --git a/images/active_cashier.svg b/images/active_cashier.svg
new file mode 100644
index 0000000..983a4fa
--- /dev/null
+++ b/images/active_cashier.svg
@@ -0,0 +1,14 @@
+
diff --git a/images/active_hold.svg b/images/active_hold.svg
new file mode 100644
index 0000000..06dcf78
--- /dev/null
+++ b/images/active_hold.svg
@@ -0,0 +1,11 @@
+
diff --git a/images/cart.svg b/images/cart.svg
new file mode 100644
index 0000000..9834b5f
--- /dev/null
+++ b/images/cart.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/cart_icon_svg.svg b/images/cart_icon_svg.svg
new file mode 100644
index 0000000..9834b5f
--- /dev/null
+++ b/images/cart_icon_svg.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/cashier.svg b/images/cashier.svg
new file mode 100644
index 0000000..0eb6f93
--- /dev/null
+++ b/images/cashier.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/hold_order.svg b/images/hold_order.svg
new file mode 100644
index 0000000..a095258
--- /dev/null
+++ b/images/hold_order.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/home.svg b/images/home.svg
new file mode 100644
index 0000000..f30051e
--- /dev/null
+++ b/images/home.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/home_active.svg b/images/home_active.svg
new file mode 100644
index 0000000..98cdf82
--- /dev/null
+++ b/images/home_active.svg
@@ -0,0 +1,14 @@
+
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 3ec9ff2..cbfff2c 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -1,4 +1,7 @@
PODS:
+ - connectivity_plus (0.0.1):
+ - Flutter
+ - ReachabilitySwift
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
@@ -33,17 +36,20 @@ PODS:
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
+ - file_saver (0.0.1):
+ - Flutter
- Flutter (1.0.0)
- fluttertoast (0.0.2):
- Flutter
- Toast
- - FMDB (2.7.5):
- - FMDB/standard (= 2.7.5)
- - FMDB/standard (2.7.5)
- image_picker_ios (0.0.1):
- Flutter
- modal_progress_hud_nsn (0.4.0):
- Flutter
+ - ObjectBox (1.8.1)
+ - objectbox_flutter_libs (0.0.1):
+ - Flutter
+ - ObjectBox (= 1.8.1)
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
@@ -51,42 +57,47 @@ PODS:
- FlutterMacOS
- permission_handler_apple (9.1.1):
- Flutter
+ - ReachabilitySwift (5.0.0)
- SDWebImage (5.16.0):
- SDWebImage/Core (= 5.16.0)
- SDWebImage/Core (5.16.0)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- - sqflite (0.0.3):
- - Flutter
- - FMDB (>= 2.7.5)
- SwiftyGif (5.4.4)
- Toast (4.0.0)
DEPENDENCIES:
+ - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
+ - file_saver (from `.symlinks/plugins/file_saver/ios`)
- Flutter (from `Flutter`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- modal_progress_hud_nsn (from `.symlinks/plugins/modal_progress_hud_nsn/ios`)
+ - objectbox_flutter_libs (from `.symlinks/plugins/objectbox_flutter_libs/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- - sqflite (from `.symlinks/plugins/sqflite/ios`)
SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- - FMDB
+ - ObjectBox
+ - ReachabilitySwift
- SDWebImage
- SwiftyGif
- Toast
EXTERNAL SOURCES:
+ connectivity_plus:
+ :path: ".symlinks/plugins/connectivity_plus/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
+ file_saver:
+ :path: ".symlinks/plugins/file_saver/ios"
Flutter:
:path: Flutter
fluttertoast:
@@ -95,6 +106,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker_ios/ios"
modal_progress_hud_nsn:
:path: ".symlinks/plugins/modal_progress_hud_nsn/ios"
+ objectbox_flutter_libs:
+ :path: ".symlinks/plugins/objectbox_flutter_libs/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
@@ -103,24 +116,25 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler_apple/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
- sqflite:
- :path: ".symlinks/plugins/sqflite/ios"
SPEC CHECKSUMS:
+ connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
+ file_saver: 503e386464dbe118f630e17b4c2e1190fa0cf808
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
- FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
modal_progress_hud_nsn: b66f99f02da7de83484e50dfe1fe2d71ac406e67
+ ObjectBox: a7900d5335218cd437cbc080b7ccc38a5211f7b4
+ objectbox_flutter_libs: 61d74196d924fbc773da5f5757d1e9fab7b3cc78
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
+ ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
SDWebImage: 2aea163b50bfcb569a2726b6a754c54a4506fcf6
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
- sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index f3cc074..86fc99f 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -4,10 +4,18 @@
CADisableMinimumFrameDurationOnPhone
+ LSSupportsOpeningDocumentsInPlace
+
+ UIFileSharingEnabled
+
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
Wosul
+ LSSupportsOpeningDocumentsInPlace
+
+ UIFileSharingEnabled
+
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
diff --git a/lib/application/MyApp.dart b/lib/application/MyApp.dart
index b41d9f9..2ac1abd 100644
--- a/lib/application/MyApp.dart
+++ b/lib/application/MyApp.dart
@@ -4,28 +4,51 @@ import 'package:provider/provider.dart';
import 'package:sizer/sizer.dart';
import 'package:wosull/application/language/AppLocale.dart';
import 'package:wosull/application/localdb/SharedPrefs.dart';
+import 'package:wosull/application/views/authModule/checkinViews/viewModel/CheckInViewModel.dart';
import 'package:wosull/application/views/authModule/loginViews/LoginVC.dart';
-import 'package:wosull/application/views/authModule/viewModel/CheckInViewModel.dart';
-import 'package:wosull/application/views/authModule/viewModel/LoginViewModel.dart';
+import 'package:wosull/application/views/authModule/loginViews/viewModel/LoginViewModel.dart';
+import 'package:wosull/application/views/authModule/registerViews/viewModel/AuthViewModel.dart';
import 'package:wosull/application/views/create_order_module/viewModels/CartViewModel.dart';
+import 'package:wosull/application/views/create_order_module/viewModels/CounterCloseViewMdoel.dart';
import 'package:wosull/application/views/create_order_module/viewModels/CreateOrderViewModel.dart';
+import 'package:wosull/application/views/create_order_module/viewModels/DineInViewModel.dart';
+import 'package:wosull/application/views/create_order_module/viewModels/ItemModifiersViewModel.dart';
+import 'package:wosull/application/views/create_order_module/viewModels/PaymentOptionViewModel.dart';
+import 'package:wosull/application/views/create_order_module/viewModels/PrintInvoiceViewModel.dart';
import 'package:wosull/application/views/create_order_module/viewModels/RegisterCashOutViewModel.dart';
import 'package:wosull/application/views/dashboard/viewModel/DashboardViewModel.dart';
+import 'package:wosull/application/views/discountModule/viewModels/NewDiscountViewModel.dart';
+import 'package:wosull/application/views/dowloadReports/viewModel/DownloadBestSellerReportViewModel.dart';
import 'package:wosull/application/views/home/HomePage.dart';
import 'package:wosull/application/views/inventorymodule/categoryviews/viewModels/AddCategoryViewModel.dart';
+import 'package:wosull/application/views/inventorymodule/comboviews/viewModels/AddComboGroupViewModel.dart';
+import 'package:wosull/application/views/inventorymodule/comboviews/viewModels/AddNewComboViewModel.dart';
import 'package:wosull/application/views/inventorymodule/deliveryPartnerViews/viewModels/DeliveryPartnerPriceViewModel.dart';
+import 'package:wosull/application/views/inventorymodule/deliveryPartnerViews/viewModels/NewDeliveryPartnerViewModel.dart';
+import 'package:wosull/application/views/inventorymodule/ingredientsViews/viewModels/AddIngredientViewModel.dart';
import 'package:wosull/application/views/inventorymodule/measurementviews/viewModels/AddMeasurementUnitVM.dart';
import 'package:wosull/application/views/inventorymodule/measurementviews/viewModels/AddMeasurementViewModel.dart';
import 'package:wosull/application/views/inventorymodule/modifierviews/viewModels/NewModifierVM.dart';
-import 'package:wosull/application/views/inventorymodule/productviews/viewModels/AddIngredientViewModel.dart';
import 'package:wosull/application/views/inventorymodule/productviews/viewModels/AddProductViewModel.dart';
+import 'package:wosull/application/views/inventorymodule/stockReturn/viewmodels/NewStockReturnViewModel.dart';
import 'package:wosull/application/views/inventorymodule/subCategoryViews/viewModels/AddSubCategoryViewModel.dart';
import 'package:wosull/application/views/kitchenmodule/views/table/viewModels/NewTableViewModel.dart';
+import 'package:wosull/application/views/salesandordermodule/views/invoiceModule/viewModels/InvoiceViewModel.dart';
+import 'package:wosull/application/views/salesandordermodule/views/invoiceModule/viewModels/MakePaymentViewModel.dart';
+import 'package:wosull/application/views/salesandordermodule/views/invoiceModule/viewModels/NewInvoiceViewModel.dart';
+import 'package:wosull/application/views/salesandordermodule/views/invoiceModule/viewModels/ReturnDamageInvoiceViewModel.dart';
import 'package:wosull/application/views/salesandordermodule/views/ordersModule/viewModel/OrderViewModel.dart';
+import 'package:wosull/application/views/salesandordermodule/views/quotataionModule/viewModels/NewQuotationViewModel.dart';
+import 'package:wosull/application/views/settings/viewModels/POSCompleteViewModel.dart';
+import 'package:wosull/application/views/settings/views/paymentMethods/viewModel/NewPaymentMethodViewModel.dart';
import 'package:wosull/application/views/transactions/viewmodels/TransactionQuotationViewModel.dart';
+import 'package:wosull/application/views/transactions/widgets/EditOrderViewModel.dart';
+import 'views/billingCounterDashboard/viewModels/BillingCounterViewModel.dart';
import 'views/create_order_module/viewModels/SelectComboVM.dart';
import 'views/home/HomePageViewModel.dart';
+import 'views/inventorymodule/comboviews/viewModels/AddComboSizeViewModel.dart';
+import 'views/inventorymodule/modiferOption/viewModels/NewModifierOptionViewModel.dart';
import 'views/inventorymodule/stockTransferViews/viewModels/NewStockTransferVM.dart';
import 'views/transactions/viewmodels/ReturnPOSOrderVM.dart';
@@ -38,6 +61,52 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MultiProvider(
providers: [
+ ChangeNotifierProvider(
+ create: (context) => DineInViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => ItemModifiersViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => AuthViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => POSCompleteViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => DownloadBestSellerReportViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => NewPaymentMethodViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => MakePaymentViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => ReturnDamageInvoiceViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => CounterCloseViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => NewQuotationViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => NewStockReturnViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => NewModifierOptionViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => InvoiceViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => NewInvoiceViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => EditOrderViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => NewDiscountViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => NewDeliveryPartnerViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => AddNewComboViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => AddComboGroupViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => AddComboSizeViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => BillingCounterViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => PaymentOptionViewModel()),
+ ChangeNotifierProvider(
+ create: (context) => PrintInvoiceViewModel()),
ChangeNotifierProvider(
create: (context) => CartViewModel()),
ChangeNotifierProvider(
@@ -91,7 +160,9 @@ class MyApp extends StatelessWidget {
home: Directionality(
// add this
textDirection: TextDirection.ltr, // set this property
- child: sharedPrefs.isLoggedIn ? const HomePage() : LoginVC(),
+ child: sharedPrefs.isLoggedIn
+ ? const HomePage()
+ : const LoginVC(),
),
// home: ,
localizationsDelegates: AppLocalizations.localizationsDelegates,
diff --git a/lib/application/ViewModel/InventoryViewModel.dart b/lib/application/ViewModel/InventoryViewModel.dart
deleted file mode 100644
index add1d11..0000000
--- a/lib/application/ViewModel/InventoryViewModel.dart
+++ /dev/null
@@ -1,106 +0,0 @@
-import 'dart:convert';
-
-import 'package:http/http.dart' as http;
-import 'package:wosull/application/model/SimpleResponsModel.dart';
-import 'package:wosull/application/model/StockTransfer/ProductItemCategoryModel.dart';
-import 'package:wosull/application/model/store/GetSpecificStores.dart';
-import 'package:wosull/application/repo/AuthRepository.dart';
-import 'package:wosull/application/utils/Constants.dart';
-
-class InventoryViewModel {
- Future getSpecificStoresById(Map value) async {
- try {
- dynamic response = await AuthRepository()
- .postResponseAuth(Constants.GET_SPECIFIC_STORES, value);
- return GetSpecificStores.fromJson(response);
- } catch (e) {
- return GetSpecificStores(success: false, stores: [], message: '');
- }
- }
-
- Future addMeasurement(Map data) async {
- try {
- dynamic response = await AuthRepository()
- .postResponseAuth(Constants.ADD_UPDATE_MEASUREMENT, data);
- return SimpleResponseModel.fromJson(response);
- } catch (e) {
- return SimpleResponseModel();
- }
- }
-
- Future getProductSearchStores(
- Map data) async {
- try {
- dynamic response = await AuthRepository()
- .postResponseAuth(Constants.SEARCH_ITEM_STORE, data);
- return ProductItemCategoryModel.fromJson(response);
- } catch (e) {
- return ProductItemCategoryModel();
- }
- }
-
- Future getResponse(String url) async {
- Map headers = {
- "Content-Type": "application/json",
- "Authorization": Constants.auth
- };
- final res = await http
- .get(Uri.parse('${Constants.baseURL}$url'), headers: headers)
- .timeout(const Duration(seconds: 60));
-
- final data = await jsonDecode(res.body);
- return data;
- }
-
- Future getResponseAuth(String url,
- [Map? queryParameter]) async {
- try {
- dynamic response =
- await AuthRepository().getResponseAuth(url, queryParameter);
- return response;
- } catch (e) {
- return e;
- }
- }
-
- Future updateStoreItem(Map data) async {
- try {
- dynamic response = await AuthRepository()
- .postResponseAuth(Constants.UPDATE_STORE_ITEM, data);
- return SimpleResponseModel.fromJson(response);
- } catch (e) {
- dynamic response = e;
- return SimpleResponseModel.fromJson(response);
- }
- }
-
- Future addStockTransfer(
- Map data) async {
- try {
- dynamic response = await AuthRepository()
- .postResponseAuth(Constants.ADD_STOCK_TRANSFER, data);
- return SimpleResponseModel.fromJson(response);
- } catch (e) {
- return SimpleResponseModel();
- }
- }
-
- Future getData(String url, Map data) async {
- try {
- dynamic response = await AuthRepository().postResponseAuth(url, data);
- return response;
- } catch (e) {
- return e;
- }
- }
-
- Future getResponsePatch(
- String url, Map data) async {
- try {
- dynamic response = await AuthRepository().patchResponseAuth(url, data);
- return SimpleResponseModel.fromJson(response);
- } catch (e) {
- return SimpleResponseModel(success: false, message: e.toString());
- }
- }
-}
diff --git a/lib/application/interfaces/DrawerWidgetSelect.dart b/lib/application/interfaces/DrawerWidgetSelect.dart
index 639025a..1750402 100644
--- a/lib/application/interfaces/DrawerWidgetSelect.dart
+++ b/lib/application/interfaces/DrawerWidgetSelect.dart
@@ -1,7 +1,7 @@
import 'package:wosull/application/model/cart/GetHoldOrderModel.dart';
import 'package:wosull/application/model/customers/GetStoreCustomer.dart';
import 'package:wosull/application/model/invoice/StoreInvoice.dart';
-import 'package:wosull/application/model/reports/CashierOrderHistory.dart';
+import 'package:wosull/application/model/reports/CashierOrder.dart';
import 'package:wosull/application/model/reports/TopOrderItemsModel.dart';
import 'package:wosull/application/model/suppliers/GetStoreSupplierModel.dart';
diff --git a/lib/application/localdb/SharedPrefs.dart b/lib/application/localdb/SharedPrefs.dart
index f4cb191..a7f59ca 100644
--- a/lib/application/localdb/SharedPrefs.dart
+++ b/lib/application/localdb/SharedPrefs.dart
@@ -16,7 +16,13 @@ class SharedPrefs {
String get token =>
_sharedPrefs.getString('token') ??
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzZTcyOGNlYTFlZDA2ZmY1ODUwYTdkOSIsImVtYWlsIjoic2F5ZWRfcmVzdEBnbWFpbC5jb20iLCJyb2xlIjoic3RvcmUiLCJpYXQiOjE2ODcxNjA5MjUsImV4cCI6MTY5NDkzNjkyNX0.MYYfG9EJrFaffcAoSYfxK7qGkurqcmQXbXb1tDyybQw';
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0Zjk3Yjk0ZTJkYjI0Mjk5NzlkMzI3ZCIsImVtYWlsIjoib2ZmbGluZUBnbWFpbC5jb20iLCJyb2xlIjoic3RvcmUiLCJpYXQiOjE2OTQ1MDUyNDEsImV4cCI6MTcwMjI4MTI0MX0.DbrP2oHNBHN3bJB_nZrPe1dhPwHm8fqT_SpOKJRF3C8';
+
+ set limit(String limit) {
+ _sharedPrefs.setString('limit', limit);
+ }
+
+ int get pageLimit => int.parse(_sharedPrefs.getString('limit') ?? '10');
set token(String value) {
_sharedPrefs.setString('token', value);
@@ -119,6 +125,13 @@ class SharedPrefs {
set billingCounterId(String value) {
_sharedPrefs.setString(Constants.billingCounterId, value);
}
+
+ String get businessRegisterId =>
+ _sharedPrefs.getString(Constants.businessRegisterId) ?? '';
+
+ set businessRegisterId(String value) {
+ _sharedPrefs.setString(Constants.businessRegisterId, value);
+ }
}
final sharedPrefs = SharedPrefs();
diff --git a/lib/application/model/BusinessRegister/BusinessRegister.dart b/lib/application/model/BusinessRegister/BusinessRegister.dart
new file mode 100644
index 0000000..6bae733
--- /dev/null
+++ b/lib/application/model/BusinessRegister/BusinessRegister.dart
@@ -0,0 +1,39 @@
+import 'package:wosull/helpers/Utils.dart';
+
+class BusinessRegister {
+ final String id;
+ final double openedAmount;
+ final double closingCashAmount;
+ final double expectedCashAmount;
+ final double varianceCash;
+ final double closingCreditAmount;
+ final double expectedCreditAmount;
+ final double varianceCredit;
+
+ BusinessRegister({
+ required this.id,
+ required this.openedAmount,
+ required this.closingCashAmount,
+ required this.expectedCashAmount,
+ required this.varianceCash,
+ required this.closingCreditAmount,
+ required this.expectedCreditAmount,
+ required this.varianceCredit,
+ });
+
+ factory BusinessRegister.fromJson(Map json) {
+ return BusinessRegister(
+ id: json['_id'] ?? '',
+ openedAmount: Utils.checkDouble(json['opened_amount'] ?? '')!,
+ closingCashAmount:
+ Utils.checkDouble(json['closing_cash_amount'] ?? '')!,
+ expectedCashAmount:
+ Utils.checkDouble(json['expected_cash_amount'] ?? '')!,
+ varianceCash: Utils.checkDouble(json['variance_cash'] ?? '')!,
+ closingCreditAmount:
+ Utils.checkDouble(json['closing_credit_amount'] ?? '')!,
+ expectedCreditAmount:
+ Utils.checkDouble(json['expected_credit_amount'] ?? '')!,
+ varianceCredit: Utils.checkDouble(json['variance_credit'] ?? '')!);
+ }
+}
diff --git a/lib/application/model/BusinessRegister/BusinessRegisterResponse.dart b/lib/application/model/BusinessRegister/BusinessRegisterResponse.dart
new file mode 100644
index 0000000..7c46b43
--- /dev/null
+++ b/lib/application/model/BusinessRegister/BusinessRegisterResponse.dart
@@ -0,0 +1,17 @@
+import 'package:wosull/application/model/BusinessRegister/BusinessRegister.dart';
+
+class BusinessRegisterResponse {
+ final bool success;
+ final BusinessRegister businessRegister;
+
+ BusinessRegisterResponse({
+ required this.success,
+ required this.businessRegister,
+ });
+
+ factory BusinessRegisterResponse.fromJson(Map json) {
+ return BusinessRegisterResponse(
+ success: json['success'] ?? false,
+ businessRegister: BusinessRegister.fromJson(json['business_register']));
+ }
+}
diff --git a/lib/application/model/Combo/AddNewComboModel.dart b/lib/application/model/Combo/AddNewComboModel.dart
index 050dfc4..b5a04a5 100644
--- a/lib/application/model/Combo/AddNewComboModel.dart
+++ b/lib/application/model/Combo/AddNewComboModel.dart
@@ -9,7 +9,7 @@ class AddNewComboModel {
List comboProducts = [];
Map toJson() {
- final Map data = Map();
+ final Map data = {};
data['store_id'] = sharedPrefs.storeId;
data['category_id'] = categoryId;
data['combo_name'] = comboName;
diff --git a/lib/application/model/Combo/ComboProduct.dart b/lib/application/model/Combo/ComboProduct.dart
index d4af667..354faa9 100644
--- a/lib/application/model/Combo/ComboProduct.dart
+++ b/lib/application/model/Combo/ComboProduct.dart
@@ -1,4 +1,3 @@
-
class ComboProducts {
String? size;
String? group;
@@ -8,12 +7,17 @@ class ComboProducts {
String? quantity;
var price;
-
- ComboProducts({this.size, this.group, this.subGroup, this.product,
- this.measurementId, this.quantity, this.price});
+ ComboProducts(
+ {this.size,
+ this.group,
+ this.subGroup,
+ this.product,
+ this.measurementId,
+ this.quantity,
+ this.price});
Map toJson() {
- final Map data = Map();
+ final Map data = {};
data['size'] = size;
data['group'] = group;
data['subGroup'] = subGroup;
@@ -23,4 +27,4 @@ class ComboProducts {
data['price'] = price;
return data;
}
-}
\ No newline at end of file
+}
diff --git a/lib/application/model/inventory/SearchComboItemModel.dart b/lib/application/model/Combo/SearchComboItemModel.dart
similarity index 95%
rename from lib/application/model/inventory/SearchComboItemModel.dart
rename to lib/application/model/Combo/SearchComboItemModel.dart
index edb4739..8a12a11 100644
--- a/lib/application/model/inventory/SearchComboItemModel.dart
+++ b/lib/application/model/Combo/SearchComboItemModel.dart
@@ -1,4 +1,4 @@
-import '../Combo/GetComboModel.dart';
+import 'GetComboModel.dart';
class SearchComboItemModel {
bool? success;
diff --git a/lib/application/model/CreateAndUpdateOrder.dart b/lib/application/model/CreateAndUpdateOrder.dart
index 23a8056..c4e948f 100644
--- a/lib/application/model/CreateAndUpdateOrder.dart
+++ b/lib/application/model/CreateAndUpdateOrder.dart
@@ -1,11 +1,12 @@
import 'package:flutter/foundation.dart';
import 'package:objectbox/objectbox.dart';
import 'package:wosull/application/model/Combo/GetComboModel.dart';
+import 'package:wosull/application/model/Modifiers/ModifierOption.dart';
import 'package:wosull/application/model/createOrder/OrderDetails.dart';
+import 'package:wosull/application/utils/Constants.dart';
import 'package:wosull/helpers/Utils.dart';
import '../localdb/SharedPrefs.dart';
-import 'Modifiers/GetModifiersModel.dart';
import 'store/StoreItemsResponse.dart';
@Entity()
@@ -22,15 +23,21 @@ class CreateAndUpdateOrder {
String? cartUniqueToken;
String? destinationAddresses = "Business Bay";
double? minOrderPrice = 0.0;
+
+ @Transient()
var orderDetails = ToMany();
// List? orderDetails;
+
+ String? orderDetailsOffline = '';
+
String? storeId;
String? orderId;
String? cartId;
- String? orderType = 'TAKE AWAY';
+ String? orderType = Constants.takeawayService;
String selectedTableName = "";
//for offline
String createdAt = '';
+ @Unique(onConflict: ConflictStrategy.replace)
int cartUniqueId = 0;
String? orderStatus;
bool paymentStatus = false;
@@ -38,12 +45,38 @@ class CreateAndUpdateOrder {
double? amount;
double? totalAmount;
double? totalDiscount;
+ String? discountId;
int? cardNumber;
double? changeBalanceAmount;
int? timer = 10;
int? orderNumber;
String? deliveryNotes;
+ Map toOfflineJson() {
+ final Map data = {};
+ data['selectedTableName'] = selectedTableName;
+ data['orderStatus'] = orderStatus;
+ data['paymentStatus'] = paymentStatus;
+ data['paymentMode'] = paymentMode;
+ data['amount'] = amount;
+ data['totalAmount'] = totalAmount;
+ data['totalDiscount'] = totalDiscount;
+ data['deliveryNotes'] = deliveryNotes;
+ data['timer'] = timer;
+ data['changeBalanceAmount'] = changeBalanceAmount;
+ data['cardNumber'] = cardNumber;
+ data['discountId'] = discountId;
+ data['cart_unique_id'] = sharedPrefs.getCartUniqueId;
+ data['cart_unique_token'] = sharedPrefs.cartUniqueToken;
+ data['delivery_partner_id'] = deliveryPartnerId;
+ data['destination_addresses'] = 'Business Bay';
+ data['min_order_price'] = minOrderPrice ?? 0;
+ data['order_details'] = orderDetailsOffline;
+ data['order_type'] = orderType ?? '';
+ data['store_id'] = sharedPrefs.storeId;
+ return data;
+ }
+
CreateAndUpdateOrder(
{this.totalCartPrice = 0.0,
this.totalItemTax,
@@ -72,17 +105,12 @@ class CreateAndUpdateOrder {
Map toJson() {
final Map data = {};
- // data['total_cart_price'] = totalCartPrice;
- // data['total_item_tax'] = totalItemTax;
- // if (sharedPrefs.cartID.isNotEmpty) {
- // data['cartId'] = sharedPrefs.cartID;
- // }
data['cart_unique_id'] = sharedPrefs.getCartUniqueId;
data['cart_unique_token'] = sharedPrefs.cartUniqueToken;
data['delivery_partner_id'] = deliveryPartnerId;
data['destination_addresses'] = 'Business Bay';
data['min_order_price'] = minOrderPrice ?? 0;
- data['order_details'] = orderDetails!.map((v) => v.toJson()).toList();
+ data['order_details'] = orderDetails.map((v) => v.toJson()).toList();
data['order_type'] = orderType ?? '';
data['store_id'] = sharedPrefs.storeId;
return data;
@@ -90,13 +118,11 @@ class CreateAndUpdateOrder {
void addItem(StoreItems items, String selectedProductId) {
int orderIndex = -1;
- if (cartOrder.orderDetails != null) {
- orderIndex = getIndex(selectedProductId);
- }
+ orderIndex = getIndex(selectedProductId);
items.totalItemPrice = getSingleItemPrice(items); // single item price
if (orderIndex >= 0) {
- cartOrder.orderDetails![orderIndex].items!.add(items);
- cartOrder.orderDetails![orderIndex].productId = selectedProductId;
+ cartOrder.orderDetails[orderIndex].items.add(items);
+ cartOrder.orderDetails[orderIndex].productId = selectedProductId;
addUpdateCartPrice(orderIndex);
} else {
addNewItemInOrderDetails(items, selectedProductId);
@@ -108,19 +134,19 @@ class CreateAndUpdateOrder {
}
void addUpdateCartPrice(int orderIndex) {
- cartOrder.orderDetails![orderIndex].totalItemPrice =
- getTotalItemPrice(cartOrder.orderDetails![orderIndex]);
- cartOrder.orderDetails![orderIndex].totalItemTax = 0.0;
+ cartOrder.orderDetails[orderIndex].totalItemPrice =
+ getTotalItemPrice(cartOrder.orderDetails[orderIndex]);
+ cartOrder.orderDetails[orderIndex].totalItemTax = 0.0;
cartOrder.totalCartPrice = getTotalCartPrice();
}
void addNote(StoreItems items, String selectedProductId, String note) {
int orderIndex = getIndex(selectedProductId);
try {
- int itemIndex = getItemIndexInOrderDetails(orderIndex, items.id);
+ int itemIndex = getItemIndexInOrderDetails(orderIndex, items.itemId);
int quantity = getQuantityForAdd(orderIndex, itemIndex);
- cartOrder.orderDetails![orderIndex].items![itemIndex]
+ cartOrder.orderDetails[orderIndex].items[itemIndex]
.noteForItem![quantity - 1] = note;
} catch (e) {
if (kDebugMode) {
@@ -131,23 +157,23 @@ class CreateAndUpdateOrder {
int getItemIndexWithId(StoreItems items, String selectedProductId) {
int parent = getIndex(selectedProductId);
- return getItemIndexInOrderDetails(parent, items.id);
+ return getItemIndexInOrderDetails(parent, items.itemId);
}
int getQuantityForAdd(int parent, int child) {
- return cartOrder.orderDetails![parent].items![child].quantity;
+ return cartOrder.orderDetails[parent].items[child].quantity ?? 1;
}
int getItemIndexInOrderDetails(int parent, String id) {
- return cartOrder.orderDetails![parent].items!
- .indexWhere((element) => element.id == id);
+ return cartOrder.orderDetails[parent].items
+ .indexWhere((element) => element.itemId == id);
}
void removeModifierOnDecrease(StoreItems items, String selectedProductId) {
int orderIndex = getIndex(selectedProductId);
try {
- int itemIndex = getItemIndexInOrderDetails(orderIndex, items.id);
- cartOrder.orderDetails![orderIndex].items![itemIndex].selectedModifiers
+ int itemIndex = getItemIndexInOrderDetails(orderIndex, items.itemId);
+ cartOrder.orderDetails[orderIndex].items[itemIndex].selectedModifiers
.removeWhere((element) => element.qtyIdx == items.quantity);
} catch (e) {
if (kDebugMode) {
@@ -159,8 +185,8 @@ class CreateAndUpdateOrder {
void removeModifier(StoreItems items, String selectedProductId) {
int orderIndex = getIndex(selectedProductId);
try {
- int itemIndex = getItemIndexInOrderDetails(orderIndex, items.id);
- cartOrder.orderDetails![orderIndex].items![itemIndex].selectedModifiers
+ int itemIndex = getItemIndexInOrderDetails(orderIndex, items.itemId);
+ cartOrder.orderDetails[orderIndex].items[itemIndex].selectedModifiers
.removeWhere((element) => element.qtyIdx == items.quantity);
} catch (e) {
if (kDebugMode) {
@@ -174,8 +200,8 @@ class CreateAndUpdateOrder {
int orderIndex = getIndex(selectedProductId);
try {
items.totalItemPrice = getSingleItemPrice(items); // single item price
- int itemIndex = getItemIndexInOrderDetails(orderIndex, items.id);
- cartOrder.orderDetails![orderIndex].items![itemIndex] = items;
+ int itemIndex = getItemIndexInOrderDetails(orderIndex, items.itemId);
+ cartOrder.orderDetails[orderIndex].items[itemIndex] = items;
addUpdateCartPrice(orderIndex);
} catch (e) {
if (kDebugMode) {
@@ -187,12 +213,12 @@ class CreateAndUpdateOrder {
void removeItem(StoreItems items, String selectedProductId) {
int orderIndex = getIndex(selectedProductId);
if (orderIndex >= 0) {
- cartOrder.orderDetails![orderIndex].items!
- .removeWhere((element) => element.id == items.id);
- cartOrder.orderDetails![orderIndex].productId = selectedProductId;
+ cartOrder.orderDetails[orderIndex].items
+ .removeWhere((element) => element.itemId == items.itemId);
+ cartOrder.orderDetails[orderIndex].productId = selectedProductId;
addUpdateCartPrice(orderIndex);
- if (cartOrder.orderDetails![orderIndex].items!.isEmpty) {
- cartOrder.orderDetails!.removeAt(orderIndex);
+ if (cartOrder.orderDetails[orderIndex].items.isEmpty) {
+ cartOrder.orderDetails.removeAt(orderIndex);
}
}
}
@@ -200,10 +226,10 @@ class CreateAndUpdateOrder {
void addNewItemInOrderDetails(StoreItems items, String selectedProductId) {
final orderDetails = OrderDetails(items: ToMany(items: []));
// orderDetails.items = [];
- orderDetails.items!.add(items);
+ orderDetails.items.add(items);
+ // orderDetails.obid = orderDetails.obid + 100;
orderDetails.productId = selectedProductId;
orderDetails.totalItemTax = 0.0;
- cartOrder.orderDetails ??= ToMany(items: []);
cartOrder.orderDetails.add(orderDetails);
int orderIndex = getIndex(selectedProductId);
addUpdateCartPrice(orderIndex);
@@ -213,11 +239,11 @@ class CreateAndUpdateOrder {
StoreItems items, String selectedProductId) {
int orderIndex = getIndex(selectedProductId);
if (orderIndex >= 0) {
- int itemIndex = cartOrder.orderDetails![orderIndex].items!
- .indexWhere((element) => element.id == items.id);
+ int itemIndex = cartOrder.orderDetails[orderIndex].items
+ .indexWhere((element) => element.itemId == items.itemId);
return cartOrder
- .orderDetails![orderIndex].items![itemIndex].selectedModifiers;
+ .orderDetails[orderIndex].items[itemIndex].selectedModifiers;
}
return [];
}
@@ -225,11 +251,10 @@ class CreateAndUpdateOrder {
List getCombos(StoreItems items, String selectedProductId) {
int orderIndex = getIndex(selectedProductId);
if (orderIndex >= 0) {
- int itemIndex = cartOrder.orderDetails![orderIndex].items!
- .indexWhere((element) => element.id == items.id);
+ int itemIndex = cartOrder.orderDetails[orderIndex].items
+ .indexWhere((element) => element.itemId == items.itemId);
- return cartOrder
- .orderDetails![orderIndex].items![itemIndex].selectedCombos;
+ return cartOrder.orderDetails[orderIndex].items[itemIndex].selectedCombos;
}
return [];
}
@@ -237,19 +262,19 @@ class CreateAndUpdateOrder {
List getNotes(StoreItems items, String selectedProductId) {
int orderIndex = getIndex(selectedProductId);
if (orderIndex >= 0) {
- int itemIndex = cartOrder.orderDetails![orderIndex].items!
- .indexWhere((element) => element.id == items.id);
+ int itemIndex = cartOrder.orderDetails[orderIndex].items
+ .indexWhere((element) => element.itemId == items.itemId);
- return cartOrder.orderDetails![orderIndex].items![itemIndex].noteForItem!;
+ return cartOrder.orderDetails[orderIndex].items[itemIndex].noteForItem!;
}
return [];
}
-//will get all items price in single order
+ //will get all items price in single order
double getTotalItemPrice(OrderDetails orderDetails) {
double totalPrice = 0.0;
- for (var item in orderDetails.items!) {
- totalPrice += item.totalItemPrice;
+ for (var item in orderDetails.items) {
+ totalPrice += item.totalItemPrice ?? 0.0;
}
return totalPrice;
@@ -257,21 +282,10 @@ class CreateAndUpdateOrder {
//set single item price with modifier
double getSingleItemPrice(StoreItems item) {
- double totalPrice = item.price * item.quantity; // item price only
+ double totalPrice = item.price * item.quantity!; // item price only
//will add modifier price
- print('Total ' + totalPrice.toString());
-
- // if (item.isCombo) {
- // for (int i = 0; i < item.selectedCombos!.length; i++) {
- // print('combo price ' + item.selectedCombos![i].price!.toString());
- // final itemPrice = item.selectedCombos![i].price!;
- // totalPrice += itemPrice;
- // }
- // }
-
if (item.selectedModifiers.isNotEmpty) {
for (int i = 0; i < item.selectedModifiers.length; i++) {
- print('modi price ' + item.selectedModifiers[i].price.toString());
final itemPrice = item.selectedModifiers[i].price;
totalPrice += itemPrice;
}
@@ -283,17 +297,15 @@ class CreateAndUpdateOrder {
//get total cart price
double getTotalCartPrice() {
double totalPrice = 0.0;
- if (cartOrder.orderDetails != null) {
- for (int i = 0; i < cartOrder.orderDetails!.length; i++) {
- final itemPrice = cartOrder.orderDetails![i].totalItemPrice!;
- totalPrice += itemPrice;
- }
+ for (int i = 0; i < cartOrder.orderDetails.length; i++) {
+ final itemPrice = cartOrder.orderDetails[i].totalItemPrice!;
+ totalPrice += itemPrice;
}
return totalPrice;
}
int getIndex(String id) {
- return cartOrder.orderDetails!
+ return cartOrder.orderDetails
.indexWhere((element) => element.productId! == id);
}
@@ -321,9 +333,10 @@ class CreateAndUpdateOrder {
var quantity = 1;
if (orderIndex >= 0) {
try {
- quantity = cartOrder.orderDetails![orderIndex].items!
- .singleWhere((element) => element.id == itemId)
- .quantity;
+ quantity = cartOrder.orderDetails[orderIndex].items
+ .singleWhere((element) => element.itemId == itemId)
+ .quantity ??
+ 1;
} catch (e) {
quantity = 1;
}
@@ -342,16 +355,14 @@ class CreateAndUpdateOrder {
cartOrder.orderType = 'TAKE AWAY';
cartOrder.totalCartPrice = 0.0;
cartOrder.totalItemTax = 0.0;
- if (cartOrder.orderDetails != null) {
- cartOrder.orderDetails!.clear();
- }
+ cartOrder.orderDetails.clear();
}
bool isThere(String id) {
// int index = -1;
if (cartOrder.orderDetails != null) {
- return cartOrder.orderDetails!
- .any((element) => element.items!.any((element) => element.id == id));
+ return cartOrder.orderDetails.any(
+ (element) => element.items.any((element) => element.itemId == id));
} else {
return false;
}
diff --git a/lib/application/model/DeliveryPartner/GetDeliveryPartner.dart b/lib/application/model/DeliveryPartner/GetDeliveryPartner.dart
index 10e4bef..02a41a6 100644
--- a/lib/application/model/DeliveryPartner/GetDeliveryPartner.dart
+++ b/lib/application/model/DeliveryPartner/GetDeliveryPartner.dart
@@ -46,27 +46,28 @@ class DeliveryPartner {
String createdAt;
String updatedAt;
List? stores = [];
+ int? totalItemCount;
- DeliveryPartner({
- this.id = '',
- this.status = '',
- this.nameArabic = '',
- this.stores,
- this.name = '',
- this.createdAt = '',
- this.updatedAt = '',
- });
+ DeliveryPartner(
+ {this.id = '',
+ this.status = '',
+ this.nameArabic = '',
+ this.stores,
+ this.name = '',
+ this.createdAt = '',
+ this.updatedAt = '',
+ this.totalItemCount});
factory DeliveryPartner.fromJson(Map json) {
return DeliveryPartner(
- stores: json['store_id'] != null ? json['store_id'].cast() : [],
- id: json['_id'] ?? '',
- name: json['name'] ?? '',
- nameArabic: json['arabic_name'] ?? '',
- status: json['status'] ?? '',
- createdAt: json['createdAt'] ?? '',
- updatedAt: json['updatedAt'] ?? '',
- );
+ stores: json['store_id'] != null ? json['store_id'].cast() : [],
+ id: json['_id'] ?? '',
+ name: json['name'] ?? '',
+ nameArabic: json['arabic_name'] ?? '',
+ status: json['status'] ?? '',
+ createdAt: json['createdAt'] ?? '',
+ updatedAt: json['updatedAt'] ?? '',
+ totalItemCount: json['total_item_count'] ?? 0);
}
bool getStatus() {
diff --git a/lib/application/model/inventory/GetMeasurementCategory.dart b/lib/application/model/Measurement/GetMeasurementCategory.dart
similarity index 100%
rename from lib/application/model/inventory/GetMeasurementCategory.dart
rename to lib/application/model/Measurement/GetMeasurementCategory.dart
diff --git a/lib/application/model/Measurement/GetStoreMeasurementModel.dart b/lib/application/model/Measurement/GetStoreMeasurementModel.dart
new file mode 100644
index 0000000..122660c
--- /dev/null
+++ b/lib/application/model/Measurement/GetStoreMeasurementModel.dart
@@ -0,0 +1,18 @@
+import 'package:wosull/application/model/Measurement/InventoryMeasurementModel.dart';
+
+class GetStoreMeasurementModel {
+ bool? success;
+ List? measurements;
+
+ GetStoreMeasurementModel({this.success, this.measurements});
+
+ factory GetStoreMeasurementModel.fromJson(Map json) {
+ return GetStoreMeasurementModel(
+ success: json['success'] ?? false,
+ measurements: json['measurement'] != null
+ ? List.from(json['measurement'])
+ .map((i) => Measurement.fromJson(i))
+ .toList()
+ : []);
+ }
+}
diff --git a/lib/application/model/inventory/InventoryMeasurementModel.dart b/lib/application/model/Measurement/InventoryMeasurementModel.dart
similarity index 71%
rename from lib/application/model/inventory/InventoryMeasurementModel.dart
rename to lib/application/model/Measurement/InventoryMeasurementModel.dart
index 961091e..27a3393 100644
--- a/lib/application/model/inventory/InventoryMeasurementModel.dart
+++ b/lib/application/model/Measurement/InventoryMeasurementModel.dart
@@ -13,7 +13,6 @@ class InventoryMeasurementModel {
}
}
-
class InvoiceMeasurementModel {
bool? success;
List? measurements;
@@ -23,9 +22,11 @@ class InvoiceMeasurementModel {
factory InvoiceMeasurementModel.fromJson(Map json) {
return InvoiceMeasurementModel(
success: json['success'] ?? false,
- measurements: json['measurement'] != null ? List.from(json['measurement'])
- .map((i) => Measurement.fromJson(i))
- .toList() : []);
+ measurements: json['measurment'] != null
+ ? List.from(json['measurment'])
+ .map((i) => Measurement.fromJson(i))
+ .toList()
+ : []);
}
}
@@ -38,9 +39,11 @@ class ProductMeasurementModel {
factory ProductMeasurementModel.fromJson(Map json) {
return ProductMeasurementModel(
success: json['success'] ?? false,
- measurements: json['measurment'] != null ? List.from(json['measurment'])
- .map((i) => Measurement.fromJson(i))
- .toList() : []);
+ measurements: json['measurment'] != null
+ ? List.from(json['measurment'])
+ .map((i) => Measurement.fromJson(i))
+ .toList()
+ : []);
}
}
@@ -52,7 +55,6 @@ class Measurement {
String? createdAt;
String? updatedAt;
-
bool getStatus() {
return status == "Inactive" ? false : true;
}
@@ -68,10 +70,10 @@ class Measurement {
factory Measurement.fromJson(Map data) {
return Measurement(
id: data['_id'] ?? "",
- name: data['name'] ?? "",
- measurement: data['measurement_unit'] ?? "",
- status: data[ 'status'] ?? "",
- createdAt: data['created_at'] ?? "",
- updatedAt: data['updated_at'] ?? "");
+ name: data['name'] ?? "",
+ measurement: data['measurement_unit'] ?? "",
+ status: data['status'] ?? "",
+ createdAt: data['created_at'] ?? "",
+ updatedAt: data['updated_at'] ?? "");
}
}
diff --git a/lib/application/model/inventory/MeasurementUnitModel.dart b/lib/application/model/Measurement/MeasurementUnitModel.dart
similarity index 100%
rename from lib/application/model/inventory/MeasurementUnitModel.dart
rename to lib/application/model/Measurement/MeasurementUnitModel.dart
diff --git a/lib/application/model/Measurement/MeasuringUnit.dart b/lib/application/model/Measurement/MeasuringUnit.dart
new file mode 100644
index 0000000..48158e5
--- /dev/null
+++ b/lib/application/model/Measurement/MeasuringUnit.dart
@@ -0,0 +1,18 @@
+import 'package:wosull/application/model/Measurement/MeasurementUnitModel.dart';
+
+class MeasuringUnit {
+ bool success;
+ List measurementUnits;
+
+ MeasuringUnit({this.success = false, this.measurementUnits = const []});
+
+ factory MeasuringUnit.fromJson(Map json) {
+ return MeasuringUnit(
+ success: json['success'] ?? false,
+ measurementUnits: json['measuring_unit'] != null
+ ? List.from(json['measuring_unit'])
+ .map((i) => MeasurementUnit.fromJson(i))
+ .toList()
+ : []);
+ }
+}
diff --git a/lib/application/model/Modifiers/GetModifiersModel.dart b/lib/application/model/Modifiers/GetModifiersModel.dart
index 52c6098..c318fdc 100644
--- a/lib/application/model/Modifiers/GetModifiersModel.dart
+++ b/lib/application/model/Modifiers/GetModifiersModel.dart
@@ -1,7 +1,4 @@
-import 'package:objectbox/objectbox.dart';
-import 'package:wosull/application/localdb/SharedPrefs.dart';
-
-import '../../../helpers/Utils.dart';
+import 'package:wosull/application/model/Modifiers/Modifier.dart';
class GetModifiersModel {
bool? success;
@@ -19,129 +16,3 @@ class GetModifiersModel {
: []);
}
}
-
-@Entity()
-class Modifier {
- @Id()
- int obid = 0;
-
- String id;
- String name;
- String arabicName;
- String description;
- double price;
- String status = "Inactive";
- bool isMultiple;
- var options = ToMany();
- var selected = ToMany();
- String createdOn;
- String updatedOn;
- bool isSelected;
- int selectedModifierIndex = 0;
-
- Modifier(
- {this.id = '',
- this.name = '',
- this.arabicName = '',
- this.description = '',
- this.price = 0.0,
- required this.options,
- required this.selected,
- this.status = '',
- this.isSelected = false,
- this.isMultiple = false,
- this.createdOn = '',
- this.updatedOn = ''});
-
- factory Modifier.fromJson(Map json) {
- return Modifier(
- id: json['_id'] ?? "",
- name: json['name'] ?? "",
- arabicName:
- json['arabicName'] != null ? json['arabicName'] as String : '',
- description: json['description'] ?? "",
- price: Utils.checkDouble(json['price'])!,
- options: ToMany(
- items: json['options'] != null
- ? List.from(json['options'])
- .map((i) => ModifierOption.fromJson(i))
- .toList()
- : []),
- selected: ToMany(
- items: json['selected'] != null
- ? List.from(json['selected'])
- .map((i) => ModifierOption.fromJson(i))
- .toList()
- : []),
- status: json['status'] != null ? json['status'] ?? 'Inactive' : '',
- isMultiple: json['is_multiple'] ?? false,
- createdOn:
- json['created_at'] != null ? json['created_at'] as String : '',
- updatedOn:
- json['updated_at'] != null ? json['updated_at'] as String : '');
- }
-
- Map toJson() {
- final Map data = {};
- data['name'] = name;
- data['arabicName'] = arabicName;
- data['store_id'] = sharedPrefs.storeId;
- data['status'] = status;
- data['is_multiple'] = isMultiple;
- data['options'] = options;
- data['selected'] = selected;
- data['modifier_id'] = id;
- if (selectedModifierIndex > 0) {
- data['selectedModifierIndex'] = selectedModifierIndex;
- }
-
- return data;
- }
-
- bool getStatus() {
- return status == "Inactive" ? false : true;
- }
-}
-
-@Entity()
-class ModifierOption {
- @Id()
- int obid = 0;
-
- String name;
- String arabicName;
- double price;
- bool isSelected = false;
- String modifierName;
- int qtyIdx;
-
- ModifierOption(
- {this.name = '',
- this.arabicName = '',
- this.price = 0,
- this.isSelected = false,
- this.modifierName = '',
- this.qtyIdx = 1});
-
- factory ModifierOption.fromJson(Map json) {
- return ModifierOption(
- name: json['name'] ?? "",
- arabicName: json['arabic_name'] ?? "",
- price: Utils.checkDouble(json['price'] ?? 0.0)!,
- isSelected: json['is_selected'] ?? false,
- modifierName: json['modifier'] ?? "",
- qtyIdx: json['qtyIdx'] ?? 1,
- );
- }
-
- Map toJson() {
- final Map data = {};
- data['name'] = name;
- data['arabic_name'] = arabicName;
- data['price'] = price;
- data['is_selected'] = isSelected;
- data['modifier'] = modifierName;
- data['qtyIdx'] = qtyIdx;
- return data;
- }
-}
diff --git a/lib/application/model/Modifiers/Modifier.dart b/lib/application/model/Modifiers/Modifier.dart
new file mode 100644
index 0000000..cd336b8
--- /dev/null
+++ b/lib/application/model/Modifiers/Modifier.dart
@@ -0,0 +1,85 @@
+import 'package:objectbox/objectbox.dart';
+import 'package:wosull/application/localdb/SharedPrefs.dart';
+import 'package:wosull/application/model/Modifiers/ModifierOption.dart';
+import 'package:wosull/helpers/Utils.dart';
+
+@Entity()
+class Modifier {
+ @Id()
+ int obid = 0;
+
+ String id;
+ String name;
+ String arabicName;
+ String description;
+ double price;
+ String status = "Active";
+ bool isMultiple;
+ var options = ToMany();
+ var selected = ToMany();
+ String createdOn;
+ String updatedOn;
+ bool isSelected;
+ int selectedModifierIndex = 0;
+
+ Modifier(
+ {this.id = '',
+ this.name = '',
+ this.arabicName = '',
+ this.description = '',
+ this.price = 0.0,
+ required this.options,
+ required this.selected,
+ this.status = 'Active',
+ this.isSelected = false,
+ this.isMultiple = false,
+ this.createdOn = '',
+ this.updatedOn = ''});
+
+ factory Modifier.fromJson(Map json) {
+ return Modifier(
+ id: json['_id'] ?? "",
+ name: json['name'] ?? "",
+ arabicName: json['arabicName'] ?? '',
+ description: json['description'] ?? "",
+ price: Utils.checkDouble(json['price'])!,
+ options: ToMany(
+ items: json['options'] != null
+ ? List.from(json['options'])
+ .map((i) => ModifierOption.fromJson(i))
+ .toList()
+ : []),
+ selected: ToMany(
+ items: json['selected'] != null
+ ? List.from(json['selected'])
+ .map((i) => ModifierOption.fromJson(i))
+ .toList()
+ : []),
+ status: json['status'] ?? 'Inactive',
+ isMultiple: json['is_multiple'] ?? false,
+ createdOn: json['created_at'] ?? '',
+ updatedOn: json['updated_at'] ?? '');
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['name'] = name;
+ data['arabicName'] = arabicName;
+ data['store_id'] = sharedPrefs.storeId;
+ data['status'] = status;
+ data['is_multiple'] = isMultiple;
+ data['modifier_id'] = id;
+ //data['options'] = options;
+ // data['selected'] = selected;
+
+ // if (selectedModifierIndex > 0) {
+ // data['selectedModifierIndex'] = selectedModifierIndex;
+ // }
+
+ return data;
+ }
+
+ bool getStatus() {
+ return status == "Inactive" ? false : true;
+ }
+}
diff --git a/lib/application/model/Modifiers/ModifierOption.dart b/lib/application/model/Modifiers/ModifierOption.dart
new file mode 100644
index 0000000..2cad390
--- /dev/null
+++ b/lib/application/model/Modifiers/ModifierOption.dart
@@ -0,0 +1,60 @@
+import 'package:objectbox/objectbox.dart';
+import 'package:wosull/application/model/ingredients/AddIngredient.dart';
+import 'package:wosull/helpers/Utils.dart';
+
+@Entity()
+class ModifierOption {
+ @Id()
+ int obid = 0;
+
+ String id;
+ String modifierId;
+ String name;
+ String arabicName;
+ double price;
+ var ingredients = ToMany();
+ bool isSelected = false;
+ String modifierName;
+ int qtyIdx;
+
+ ModifierOption(
+ {this.name = '',
+ this.id = '',
+ this.modifierId = '',
+ this.arabicName = '',
+ this.price = 0,
+ required this.ingredients,
+ this.isSelected = false,
+ this.modifierName = '',
+ this.qtyIdx = 1});
+
+ factory ModifierOption.fromJson(Map json) {
+ return ModifierOption(
+ id: json['_id'] ?? '',
+ modifierId: json['modifier_id'] ?? '',
+ name: json['name'] ?? '',
+ arabicName: json['arabic_name'] ?? '',
+ price: Utils.checkDouble(json['price'] ?? 0.0)!,
+ isSelected: json['is_selected'] ?? false,
+ modifierName: json['modifier'] ?? '',
+ qtyIdx: json['qtyIdx'] ?? 1,
+ ingredients: ToMany(
+ items: json['ingredients'] != null
+ ? List.from(json['ingredients'])
+ .map((i) => AddIngredient.fromJson(i))
+ .toList()
+ : []),
+ );
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['name'] = name;
+ data['arabic_name'] = arabicName;
+ data['price'] = price;
+ data['is_selected'] = isSelected;
+ data['modifier'] = modifierName;
+ data['qtyIdx'] = qtyIdx;
+ return data;
+ }
+}
diff --git a/lib/application/model/Products/AddProduct.dart b/lib/application/model/Products/AddProduct.dart
new file mode 100644
index 0000000..247ec7e
--- /dev/null
+++ b/lib/application/model/Products/AddProduct.dart
@@ -0,0 +1,218 @@
+import 'package:wosull/application/localdb/SharedPrefs.dart';
+import 'package:wosull/application/model/DeliveryPartner/ItemsDeliveryPartner.dart';
+import 'package:wosull/application/model/Modifiers/ModifierOption.dart';
+import 'package:wosull/application/model/Products/ProductId.dart';
+import 'package:wosull/application/model/ingredients/AddIngredient.dart';
+
+import '../../../helpers/Utils.dart';
+
+class AddProduct {
+ String itemId = "";
+
+ String name;
+
+ List? noteForItem = [];
+ String storeId;
+ bool isUnlimitedQuantity;
+ String itemNameArabic;
+ ProductId? productId;
+ String productIdSt = '';
+
+ String product_product_id = '';
+ double? price;
+ int? uniqueId;
+ String uniqueIdForStoreData;
+
+ int? quantity;
+ String imageUrl = "";
+ String updatedAt;
+ bool isItemInStock = false;
+ String description;
+ String descriptionArabic;
+ double? purchasePrice;
+ int? stockAlertQuantity;
+ double? itemPriceWithOutOffer;
+ int? totalAddedQuantity;
+ int? totalUsedQuantity;
+ double? salePriceExclusiveTax;
+
+ double? totalItemPrice;
+ String supplier;
+ String discount;
+ String measurementCategory;
+ String measurement;
+ String measurementUnit;
+ String brand;
+ String deliveryPartner;
+ String manufactureDate;
+ String expireDate;
+ bool status;
+ bool isCombo = false;
+ bool isCheckedForReturn = false;
+
+ List selectedModifiers = [];
+ List ingredients = [];
+ List modifiers = [];
+ List deliveryPartners = [];
+
+ AddProduct(
+ {this.name = '',
+ this.itemId = '',
+ required this.deliveryPartners,
+ this.isUnlimitedQuantity = false,
+ this.storeId = '',
+ this.deliveryPartner = '',
+ this.itemNameArabic = '',
+ this.productId,
+ this.price,
+ this.uniqueId,
+ this.measurementUnit = '',
+ this.uniqueIdForStoreData = '',
+ this.quantity,
+ this.imageUrl = '',
+ this.updatedAt = '',
+ this.totalItemPrice,
+ this.isItemInStock = false,
+ this.description = '',
+ this.descriptionArabic = '',
+ this.purchasePrice,
+ this.stockAlertQuantity,
+ this.itemPriceWithOutOffer,
+ this.totalAddedQuantity,
+ this.noteForItem,
+ this.totalUsedQuantity,
+ this.salePriceExclusiveTax,
+ required this.modifiers,
+ required this.ingredients,
+ required this.selectedModifiers,
+ this.supplier = '',
+ this.discount = '',
+ this.measurementCategory = '',
+ this.measurement = '',
+ this.brand = '',
+ this.isCombo = false,
+ this.manufactureDate = '',
+ this.expireDate = '',
+ this.status = false});
+
+ factory AddProduct.fromJson(Map json) {
+ return AddProduct(
+ status: json['status'] ?? false,
+ name: json['name'] as String,
+ itemNameArabic: json['item_name_arabic'] ?? "",
+ itemId: json['_id'] ?? "",
+ deliveryPartner: json['delivery_partner'] ?? "",
+ isUnlimitedQuantity: json['unlimited_quantity'] ?? false,
+ storeId: json['store_id'] ?? "",
+ productId: ProductId.fromJson(json['product_id']),
+ price: Utils.checkDouble(json['price'])!,
+ uniqueId: json['unique_id'] ?? 0,
+ totalItemPrice: Utils.checkDouble(json['totalItemPrice'])!,
+ description: json['details'] ?? "",
+ totalAddedQuantity: json['total_quantity'] ?? 0,
+ stockAlertQuantity: json['stock_alert_quantity'] ?? 0,
+ discount: json['discount'] ?? "",
+ supplier: json['supplier'] ?? "",
+ purchasePrice: Utils.checkDouble(json['purchase_cost'])!,
+ measurement: json['measurement'] ?? "",
+ manufactureDate: json['manufacturer_date'] ?? "",
+ expireDate: json['expiry_date'] ?? "",
+ isCombo: json['isCombo'] ?? false,
+ salePriceExclusiveTax:
+ Utils.checkDouble(json['sale_price_exclusive_tax'])!,
+ descriptionArabic: json['item_description_arabic'] ?? "",
+ uniqueIdForStoreData: json['unique_id_for_store_data'] ?? "0",
+ quantity: json['quantity'] ?? 0,
+ measurementUnit: json['measurement_unit'] ?? '',
+ selectedModifiers: json['selectedModifiers'] != null
+ ? List.from(json['selectedModifiers'])
+ .map((i) => ModifierOption.fromJson(i))
+ .toList()
+ : [],
+ imageUrl: json['image_url'] != null
+ ? Utils.checkList(json['image_url'])!
+ : "",
+ updatedAt: json['updated_at'] ?? '',
+ isItemInStock: json['is_item_in_stock'] ?? false,
+ deliveryPartners: json['delivery_partners'] != null
+ ? List.from(json['delivery_partners'])
+ .map((i) => ItemsDeliveryPartner.fromJson(i))
+ .toList()
+ : [],
+ modifiers:
+ json['modifiers'] != null ? Utils.getList(json['modifiers'])! : [],
+ ingredients: json['ingrediants'] != null
+ ? List.from(json['ingrediants'])
+ .map((i) => AddIngredient.fromJson(i))
+ .toList()
+ : []);
+ }
+
+ Map toJsonProduct() {
+ final Map data = {};
+ data['product_id'] = productIdSt;
+ data['store_id'] = sharedPrefs.storeId;
+ data['name'] = name;
+ data['unlimited_quantity'] = isUnlimitedQuantity;
+ data['unique_id_for_store_data'] = uniqueIdForStoreData;
+ data['is_item_in_stock'] = isItemInStock;
+ data['item_name_arabic'] = itemNameArabic;
+ data['item_description_arabic'] = descriptionArabic;
+ data['details'] = description;
+ data['total_quantity'] = totalAddedQuantity;
+ data['sale_price_exclusive_tax'] = salePriceExclusiveTax;
+ data['stock_alert_quantity'] = stockAlertQuantity;
+ data['is_visible_in_store'] = true;
+ data['price'] = price;
+ if (supplier.isNotEmpty) {
+ data['supplier'] = supplier;
+ }
+ if (discount.isNotEmpty) {
+ data['discount'] = discount ?? "";
+ }
+ data['purchase_cost'] = purchasePrice;
+ //data['totalItemPrice'] = totalItemPrice ?? 0.0;
+ data['delivery_partners'] = deliveryPartners;
+ data['measurement'] = measurement ?? "";
+ data['manufacturer_date'] = manufactureDate;
+ data['expiry_date'] = expireDate;
+ data['ingrediants'] = ingredients;
+ data['modifiers'] = modifiers;
+ return data;
+ }
+
+ Map toJsonUpdateProduct() {
+ final Map data = {};
+ data['product_id'] = productId!.toJson();
+ data['store_id'] = sharedPrefs.storeId;
+ data['name'] = name;
+ data['unlimited_quantity'] = isUnlimitedQuantity ?? false;
+ data['productId'] = product_product_id ?? "0";
+ data['_id'] = itemId;
+ data['unique_id_for_store_data'] = uniqueIdForStoreData;
+ data['is_item_in_stock'] = isItemInStock;
+ data['item_name_arabic'] = itemNameArabic;
+ data['item_description_arabic'] = descriptionArabic;
+ data['details'] = description;
+ data['total_quantity'] = totalAddedQuantity;
+ data['sale_price_exclusive_tax'] = salePriceExclusiveTax;
+ data['stock_alert_quantity'] = stockAlertQuantity;
+ data['is_visible_in_store'] = true;
+ data['price'] = price;
+ data['purchase_cost'] = purchasePrice;
+ data['quantity'] = quantity ?? 1;
+ if (supplier.isNotEmpty) {
+ data['supplier'] = supplier ?? "";
+ }
+ if (discount.isNotEmpty) {
+ data['discount'] = discount ?? "";
+ }
+ data['delivery_partners'] = deliveryPartners;
+ data['measurement'] = measurement ?? "";
+ data['manufacturer_date'] = manufactureDate ?? "";
+ data['expiry_date'] = expireDate ?? "";
+ data['ingrediants'] = ingredients;
+ data['modifiers'] = modifiers;
+ return data;
+ }
+}
diff --git a/lib/application/model/Products/GetProductResponse.dart b/lib/application/model/Products/GetProductResponse.dart
new file mode 100644
index 0000000..8fd12d9
--- /dev/null
+++ b/lib/application/model/Products/GetProductResponse.dart
@@ -0,0 +1,28 @@
+import 'package:wosull/application/model/store/StoreItemsResponse.dart';
+
+class GetProductResponse {
+ bool success;
+ int count;
+ int message;
+ int pages;
+ List storeItems;
+
+ GetProductResponse(
+ {this.success = false,
+ this.count = 0,
+ this.message = 0,
+ this.pages = 0,
+ this.storeItems = const []});
+
+ factory GetProductResponse.fromJson(Map json) {
+ return GetProductResponse(
+ success: json['success'] ?? false,
+ count: json['count'] ?? 0,
+ pages: json['pages'] ?? 0,
+ storeItems: json['items'] != null
+ ? List.from(json['items'])
+ .map((i) => StoreItems.fromJson(i))
+ .toList()
+ : []);
+ }
+}
diff --git a/lib/application/model/Products/ItemProductModel.dart b/lib/application/model/Products/ItemProductModel.dart
index 4036e80..e50f8dd 100644
--- a/lib/application/model/Products/ItemProductModel.dart
+++ b/lib/application/model/Products/ItemProductModel.dart
@@ -2,15 +2,17 @@ import '../inventory/ItemSubCategoryResponse.dart';
class ItemProductModel {
bool success;
- ItemSubCategory product;
+ List product;
ItemProductModel({required this.success, required this.product});
factory ItemProductModel.fromJson(Map json) {
return ItemProductModel(
success: json['success'] ?? false,
- product: json['success'] == true
- ? ItemSubCategory.fromJson(json['product'])
- : ItemSubCategory());
+ product: json['product'] != null
+ ? List.from(json['product'])
+ .map((i) => ItemSubCategory.fromJson(i))
+ .toList()
+ : []);
}
}
diff --git a/lib/application/model/Products/ProductById.dart b/lib/application/model/Products/ProductById.dart
new file mode 100644
index 0000000..bb9fa6a
--- /dev/null
+++ b/lib/application/model/Products/ProductById.dart
@@ -0,0 +1,14 @@
+import 'package:wosull/application/model/Products/AddProduct.dart';
+
+class ProductById {
+ bool success;
+ AddProduct item;
+
+ ProductById({required this.success, required this.item});
+
+ factory ProductById.fromJson(Map json) {
+ return ProductById(
+ success: json['success'] ?? false,
+ item: AddProduct.fromJson(json['product']));
+ }
+}
diff --git a/lib/application/model/Products/ProductId.dart b/lib/application/model/Products/ProductId.dart
new file mode 100644
index 0000000..bbf1c81
--- /dev/null
+++ b/lib/application/model/Products/ProductId.dart
@@ -0,0 +1,24 @@
+import 'package:objectbox/objectbox.dart';
+
+@Entity()
+class ProductId {
+ @Id()
+ int obid = 0;
+
+ String? productId;
+ String? categoryId;
+
+ ProductId({this.productId, this.categoryId});
+
+ factory ProductId.fromJson(Map json) {
+ return ProductId(
+ productId: json['_id'] ?? '', categoryId: json['category_id'] ?? '');
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['category_id'] = categoryId;
+ data['_id'] = productId;
+ return data;
+ }
+}
diff --git a/lib/application/model/Products/SearchProductResponse.dart b/lib/application/model/Products/SearchProductResponse.dart
new file mode 100644
index 0000000..58a11b9
--- /dev/null
+++ b/lib/application/model/Products/SearchProductResponse.dart
@@ -0,0 +1,18 @@
+import 'package:wosull/application/model/store/StoreItemsResponse.dart';
+
+class SearchItemsResponse {
+ bool? success;
+ List? storeItems;
+
+ SearchItemsResponse({this.success, this.storeItems});
+
+ factory SearchItemsResponse.fromJson(Map json) {
+ return SearchItemsResponse(
+ success: json['success'] ?? false,
+ storeItems: json['item'] != null
+ ? List.from(json['item'])
+ .map((i) => StoreItems.fromJson(i))
+ .toList()
+ : []);
+ }
+}
diff --git a/lib/application/model/ReturnStock/ReturnStock.dart b/lib/application/model/ReturnStock/ReturnStock.dart
new file mode 100644
index 0000000..05331f1
--- /dev/null
+++ b/lib/application/model/ReturnStock/ReturnStock.dart
@@ -0,0 +1,126 @@
+import 'package:wosull/application/localdb/SharedPrefs.dart';
+import 'package:wosull/application/model/ReturnStock/ReturnStockCharges.dart';
+import 'package:wosull/application/model/store/StoreInvoicesModel.dart';
+import 'package:wosull/helpers/Utils.dart';
+
+class ReturnStock {
+ String? id;
+ String? storeId;
+ Supplier? supplierId;
+ String? stockReference;
+ String? currency;
+ String? taxOption;
+ String? stockReturnDate;
+ List? products;
+ List? charges;
+ String? discountType;
+ String? notes;
+ double? shippingCharges;
+ double? packingCharges;
+ double? totalDiscountAmount;
+ double? totalVat;
+ double? totalAmount;
+ double? totalExcludingVat;
+ double? totalTaxableAmount;
+ bool? isDeleted;
+ String? createdAt;
+ String? updatedAt;
+ int? uniqueId;
+
+ ReturnStock({
+ this.id,
+ this.storeId,
+ this.supplierId,
+ this.stockReference,
+ this.currency,
+ this.taxOption,
+ this.stockReturnDate,
+ this.products,
+ this.charges,
+ this.discountType,
+ this.notes,
+ this.shippingCharges,
+ this.packingCharges,
+ this.totalDiscountAmount,
+ this.totalVat,
+ this.totalAmount,
+ this.totalExcludingVat,
+ this.totalTaxableAmount,
+ this.isDeleted,
+ this.createdAt,
+ this.updatedAt,
+ this.uniqueId,
+ });
+
+ factory ReturnStock.fromJson(Map json) {
+ return ReturnStock(
+ id: json['_id'] ?? '',
+ storeId: json['store_id'] ?? '',
+ supplierId: json['supplier_id'] != null
+ ? Supplier.fromJson(json['supplier_id'])
+ : Supplier(id: '', name: ''),
+ stockReference: json['stock_reference'] ?? '',
+ currency: json['currency'] ?? '',
+ taxOption: json['tax_option'] ?? '',
+ stockReturnDate: json['stock_return_date'] ?? '',
+ products: json['products'] != null
+ ? List.from(json['products'])
+ .map((i) => StoreInvoiceProduct.fromJson(i))
+ .toList()
+ : [],
+ charges: json['charges'] != null
+ ? List.from(json['charges'])
+ .map((i) => ReturnStockCharges.fromJson(i))
+ .toList()
+ : [],
+ discountType: json['discount_type'] ?? '',
+ notes: json['notes'] ?? '',
+ shippingCharges: Utils.checkDouble(json['shipping_charges'])!,
+ packingCharges: Utils.checkDouble(json['packing_charges'])!,
+ totalDiscountAmount: Utils.checkDouble(json['total_discount_amount'])!,
+ totalVat: Utils.checkDouble(json['total_vat'])!,
+ totalAmount: Utils.checkDouble(json['total_amount'])!,
+ totalExcludingVat: Utils.checkDouble(json['total_excluding_vat'])!,
+ totalTaxableAmount: Utils.checkDouble(json['total_taxable_amount'])!,
+ isDeleted: json['is_deleted'] ?? false,
+ createdAt: json['createdAt'] ?? '',
+ updatedAt: json['updatedAt'] ?? '',
+ uniqueId: json['unique_id'] ?? 0);
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['store_id'] = sharedPrefs.storeId;
+ data['supplier_id'] = supplierId!.id ?? '';
+ data['stock_return_date'] = stockReturnDate;
+ data['currency'] = currency;
+ data['notes'] = notes;
+ data['return_stock_id'] = id ?? '';
+ data['tax_option'] = taxOption;
+ data['total_amount'] = totalAmount;
+ data['total_discount_amount'] = totalDiscountAmount;
+ data['products'] = products!.map((v) => v.toJson()).toList();
+ data['charges'] = charges!.map((v) => v.toJson()).toList();
+ data['total_excluding_vat'] = getExcludingVat();
+ data['total_taxable_amount'] = getTotalTaxableAmount();
+ data['total_vat'] = totalVat;
+
+ return data;
+ }
+
+ double getExcludingVat() {
+ var price = 0.0;
+ for (var product in products!) {
+ price += (product.totalQuantity! * product.price!);
+ }
+ return price;
+ }
+
+ double getTotalTaxableAmount() {
+ var price = 0.0;
+ for (var product in products!) {
+ price += (product.totalQuantity! * product.price!);
+ }
+ return price;
+ }
+}
diff --git a/lib/application/model/ReturnStock/ReturnStockCharges.dart b/lib/application/model/ReturnStock/ReturnStockCharges.dart
new file mode 100644
index 0000000..f19572c
--- /dev/null
+++ b/lib/application/model/ReturnStock/ReturnStockCharges.dart
@@ -0,0 +1,21 @@
+class ReturnStockCharges {
+ String amount;
+ String name;
+
+ ReturnStockCharges({
+ required this.amount,
+ required this.name,
+ });
+
+ factory ReturnStockCharges.fromJson(Map json) {
+ return ReturnStockCharges(
+ amount: json['amount'] ?? '', name: json['name'] ?? '');
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['amount'] = amount;
+ data['name'] = name;
+ return data;
+ }
+}
diff --git a/lib/application/model/ReturnStock/ReturnStockResponse.dart b/lib/application/model/ReturnStock/ReturnStockResponse.dart
new file mode 100644
index 0000000..e6c7d97
--- /dev/null
+++ b/lib/application/model/ReturnStock/ReturnStockResponse.dart
@@ -0,0 +1,21 @@
+import 'package:wosull/application/model/ReturnStock/ReturnStock.dart';
+
+class ReturnStockResponse {
+ bool success;
+ List returnStock;
+
+ ReturnStockResponse({
+ required this.success,
+ required this.returnStock,
+ });
+
+ factory ReturnStockResponse.fromJson(Map json) {
+ return ReturnStockResponse(
+ success: json['success'] ?? false,
+ returnStock: json['returnStock'] != null
+ ? List.from(json['returnStock'])
+ .map((i) => ReturnStock.fromJson(i))
+ .toList()
+ : []);
+ }
+}
diff --git a/lib/application/model/StockTransfer/ProductItemCategoryModel.dart b/lib/application/model/StockTransfer/ProductItemCategoryModel.dart
index 33adcb1..f252b68 100644
--- a/lib/application/model/StockTransfer/ProductItemCategoryModel.dart
+++ b/lib/application/model/StockTransfer/ProductItemCategoryModel.dart
@@ -1,21 +1,23 @@
+import 'package:wosull/application/model/Modifiers/Modifier.dart';
+import 'package:wosull/application/model/ingredients/AddIngredient.dart';
import 'package:wosull/helpers/Utils.dart';
import '../Combo/GetComboModel.dart';
-import '../Modifiers/GetModifiersModel.dart';
-import '../inventory/AddIngredientModel.dart';
class ProductItemCategoryModel {
- bool? success;
- List? categories;
+ bool success;
+ List categories;
- ProductItemCategoryModel({this.success, this.categories});
+ ProductItemCategoryModel({required this.success, required this.categories});
factory ProductItemCategoryModel.fromJson(Map json) {
return ProductItemCategoryModel(
success: json['success'] as bool,
- categories: List.from(json['item'])
- .map((i) => ProductItem.fromJson(i))
- .toList());
+ categories: json['item'] != null
+ ? List.from(json['item'])
+ .map((i) => ProductItem.fromJson(i))
+ .toList()
+ : []);
}
}
@@ -57,11 +59,11 @@ class ProductItem {
.map((i) => ComboProduct.fromJson(i))
.toList()
: [],
- modifiers: data['modifiers'] != null
- ? List.from(data['modifiers'])
- .map((i) => Modifier.fromJson(i))
- .toList()
- : [],
+ // modifiers: data['modifiers'] != null
+ // ? List.from(data['modifiers'])
+ // .map((i) => Modifier.fromJson(i))
+ // .toList()
+ // : [],
ingredients: data['ingrediants'] != null
? List.from(data['ingrediants'])
.map((i) => AddIngredient.fromJson(i))
diff --git a/lib/application/model/StockTransfer/SearchStockTransferResponse.dart b/lib/application/model/StockTransfer/SearchStockTransferResponse.dart
new file mode 100644
index 0000000..372c4d5
--- /dev/null
+++ b/lib/application/model/StockTransfer/SearchStockTransferResponse.dart
@@ -0,0 +1,17 @@
+import 'package:wosull/application/model/StockTransfer/StockTransferDetailsModel.dart';
+
+class SearchStockTransferResponse {
+ bool success;
+ List stockTransfers;
+
+ SearchStockTransferResponse(
+ {this.success = false, this.stockTransfers = const []});
+
+ factory SearchStockTransferResponse.fromJson(Map json) {
+ return SearchStockTransferResponse(
+ success: json['success'] ?? false,
+ stockTransfers: List.from(json['stocktransfer'] ?? [])
+ .map((i) => StockTransfer.fromJson(i))
+ .toList());
+ }
+}
diff --git a/lib/application/model/StockTransfer/StockTransferDetailsModel.dart b/lib/application/model/StockTransfer/StockTransferDetailsModel.dart
index 6f0c66a..949415a 100644
--- a/lib/application/model/StockTransfer/StockTransferDetailsModel.dart
+++ b/lib/application/model/StockTransfer/StockTransferDetailsModel.dart
@@ -53,7 +53,9 @@ class StockTransfer {
uniqueId: json['unique_id'] ?? 0,
isDeleted: json['is_deleted'] ?? false,
fromStore: WosulStore.fromJson(json['from_store']),
- toStore: WosulStore.fromJson(json['to_store']));
+ toStore: json['to_store'] != null
+ ? WosulStore.fromJson(json['to_store'])
+ : WosulStore(id: '', name: ''));
}
bool getStatus() {
diff --git a/lib/application/model/StockTransfer/ViewStockTransferModel.dart b/lib/application/model/StockTransfer/ViewStockTransferModel.dart
index 632dcb4..5a87a7e 100644
--- a/lib/application/model/StockTransfer/ViewStockTransferModel.dart
+++ b/lib/application/model/StockTransfer/ViewStockTransferModel.dart
@@ -49,7 +49,9 @@ class ViewStockTransfer {
uniqueId: json['unique_id'] as int,
isDeleted: json['is_deleted'] as bool,
fromStore: WosulStore.fromJson(json['from_store']),
- toStore: WosulStore.fromJson(json['to_store']));
+ toStore: json['to_store'] != null
+ ? WosulStore.fromJson(json['to_store'])
+ : WosulStore(id: '', name: ''));
}
}
diff --git a/lib/application/model/auth/AccessToken.dart b/lib/application/model/auth/AccessToken.dart
new file mode 100644
index 0000000..eae6489
--- /dev/null
+++ b/lib/application/model/auth/AccessToken.dart
@@ -0,0 +1,11 @@
+class AccessToken {
+ String? accessToken;
+
+ AccessToken({this.accessToken});
+
+ factory AccessToken.fromJson(Map json) {
+ return AccessToken(
+ accessToken: json['token'] ?? '',
+ );
+ }
+}
diff --git a/lib/application/model/auth/AccessTokenModel.dart b/lib/application/model/auth/AccessTokenModel.dart
new file mode 100644
index 0000000..5d9dad3
--- /dev/null
+++ b/lib/application/model/auth/AccessTokenModel.dart
@@ -0,0 +1,16 @@
+import 'package:wosull/application/model/auth/AccessToken.dart';
+
+class AccessTokenModel {
+ bool? success;
+ AccessToken? access;
+
+ AccessTokenModel({this.success = false, this.access});
+
+ factory AccessTokenModel.fromJson(Map json) {
+ return AccessTokenModel(
+ success: json['success'] ?? false,
+ access: json['access_token'] != null
+ ? AccessToken.fromJson(json['access_token'])
+ : AccessToken());
+ }
+}
diff --git a/lib/application/model/billingCounter/BillingCounterDashboard.dart b/lib/application/model/billingCounter/BillingCounterDashboard.dart
new file mode 100644
index 0000000..362d9b0
--- /dev/null
+++ b/lib/application/model/billingCounter/BillingCounterDashboard.dart
@@ -0,0 +1,21 @@
+import 'package:wosull/application/model/billingCounter/CounterDashboard.dart';
+
+class BillingCounterDashboard {
+ bool success;
+ List billingCounter;
+
+ BillingCounterDashboard({
+ required this.success,
+ required this.billingCounter,
+ });
+
+ factory BillingCounterDashboard.fromJson(Map json) {
+ return BillingCounterDashboard(
+ success: json['success'] ?? false,
+ billingCounter: json['billing_counter'] != null
+ ? List.from(json['billing_counter'])
+ .map((i) => CounterDashboard.fromJson(i))
+ .toList()
+ : []);
+ }
+}
diff --git a/lib/application/model/billingCounter/BillingPaymentModes.dart b/lib/application/model/billingCounter/BillingPaymentModes.dart
new file mode 100644
index 0000000..b1abf32
--- /dev/null
+++ b/lib/application/model/billingCounter/BillingPaymentModes.dart
@@ -0,0 +1,46 @@
+import 'package:wosull/application/model/billingCounter/PaymentModes.dart';
+
+class BillingPaymentModes {
+ PaymentModes? cash;
+ PaymentModes? mada;
+ PaymentModes? stcPay;
+ PaymentModes? visa;
+ PaymentModes? surePay;
+ PaymentModes? expressPay;
+ PaymentModes? nearPay;
+
+ BillingPaymentModes(
+ {this.cash,
+ this.mada,
+ this.stcPay,
+ this.visa,
+ this.surePay,
+ this.expressPay,
+ this.nearPay});
+
+ factory BillingPaymentModes.fromJson(Map json) {
+ return BillingPaymentModes(
+ cash: json['Cash'] != null
+ ? PaymentModes.fromJson(json['Cash'])
+ : PaymentModes(),
+ mada: json['Mada'] != null
+ ? PaymentModes.fromJson(json['Mada'])
+ : PaymentModes(),
+ stcPay: json['Stc_Pay'] != null
+ ? PaymentModes.fromJson(json['Stc_Pay'])
+ : PaymentModes(),
+ visa: json['Visa'] != null
+ ? PaymentModes.fromJson(json['Visa'])
+ : PaymentModes(),
+ surePay: json['Sure_Pay'] != null
+ ? PaymentModes.fromJson(json['Sure_Pay'])
+ : PaymentModes(),
+ expressPay: json['Express_Pay'] != null
+ ? PaymentModes.fromJson(json['Express_Pay'])
+ : PaymentModes(),
+ nearPay: json['Near_Pay'] != null
+ ? PaymentModes.fromJson(json['Near_Pay'])
+ : PaymentModes(),
+ );
+ }
+}
diff --git a/lib/application/model/billingCounter/CounterDashboard.dart b/lib/application/model/billingCounter/CounterDashboard.dart
new file mode 100644
index 0000000..8dace3f
--- /dev/null
+++ b/lib/application/model/billingCounter/CounterDashboard.dart
@@ -0,0 +1,25 @@
+import 'package:wosull/application/model/billingCounter/BillingPaymentModes.dart';
+import 'package:wosull/application/model/billingCounter/GetBillingCounter.dart';
+import 'package:wosull/helpers/Utils.dart';
+
+class CounterDashboard {
+ BillingCounter? counterDetails;
+ BillingPaymentModes? paymentModes;
+ int? orderCount;
+ double? orderValues;
+
+ CounterDashboard(
+ {this.counterDetails,
+ this.paymentModes,
+ this.orderCount,
+ this.orderValues});
+
+ factory CounterDashboard.fromJson(Map json) {
+ return CounterDashboard(
+ counterDetails: BillingCounter.fromJson(json['_id']),
+ paymentModes: BillingPaymentModes.fromJson(json['payment_mode']),
+ orderCount: json['order_count'] ?? 0,
+ orderValues: Utils.checkDouble(json['order_value']),
+ );
+ }
+}
diff --git a/lib/application/model/billingCounter/GetBillingCounter.dart b/lib/application/model/billingCounter/GetBillingCounter.dart
index 2fd2a1e..3220e3f 100644
--- a/lib/application/model/billingCounter/GetBillingCounter.dart
+++ b/lib/application/model/billingCounter/GetBillingCounter.dart
@@ -24,14 +24,18 @@ class BillingCounter {
String id;
String counterName;
String counterCode;
+ String storeName;
String status;
double cashIn;
double cashOut;
+ String checkInTime;
double availableCash;
bool isAvailable;
BillingCounter(
{this.id = '',
+ this.checkInTime = '',
+ this.storeName = '',
this.cashIn = 0.0,
this.cashOut = 0.0,
this.availableCash = 0.0,
@@ -49,6 +53,8 @@ class BillingCounter {
counterName: json['counter_name'] ?? "",
counterCode: json['counter_code'] ?? "",
status: json['status'] ?? "",
+ checkInTime: json['check_in_time'] ?? '',
+ storeName: json['store_name'] ?? "",
isAvailable: json['is_available'] ?? false,
);
}
diff --git a/lib/application/model/billingCounter/PaymentModes.dart b/lib/application/model/billingCounter/PaymentModes.dart
new file mode 100644
index 0000000..2ef75d6
--- /dev/null
+++ b/lib/application/model/billingCounter/PaymentModes.dart
@@ -0,0 +1,13 @@
+import 'package:wosull/helpers/Utils.dart';
+
+class PaymentModes {
+ double? amount;
+ int? count;
+
+ PaymentModes({this.amount, this.count});
+
+ factory PaymentModes.fromJson(Map json) {
+ return PaymentModes(
+ amount: Utils.checkDouble(json['amount']), count: json['count'] ?? 0);
+ }
+}
diff --git a/lib/application/model/cart/GetHoldOrderModel.dart b/lib/application/model/cart/GetHoldOrderModel.dart
index 9e98553..d4778ce 100644
--- a/lib/application/model/cart/GetHoldOrderModel.dart
+++ b/lib/application/model/cart/GetHoldOrderModel.dart
@@ -36,6 +36,22 @@ class GetOrderByStatusModel {
}
}
+class SearchCashier {
+ bool? success;
+ List? orderModel;
+
+ SearchCashier({this.success, this.orderModel});
+
+ factory SearchCashier.fromJson(Map json) {
+ return SearchCashier(
+ success: json['success'],
+ orderModel: List.from(json['cashier'])
+ .map((i) => ReturnOrderModel.fromJson(i))
+ .toList(),
+ );
+ }
+}
+
class GetReturnOrderModel {
bool? success;
List? orderModel;
@@ -44,6 +60,22 @@ class GetReturnOrderModel {
factory GetReturnOrderModel.fromJson(Map json) {
return GetReturnOrderModel(
+ success: json['success'],
+ orderModel: List.from(json['cashier_order'])
+ .map((i) => ReturnOrderModel.fromJson(i))
+ .toList(),
+ );
+ }
+}
+
+class GetReturnAndDamageModel {
+ bool? success;
+ List? orderModel;
+
+ GetReturnAndDamageModel({this.success, this.orderModel});
+
+ factory GetReturnAndDamageModel.fromJson(Map json) {
+ return GetReturnAndDamageModel(
success: json['success'],
orderModel: List.from(json['return_order'])
.map((i) => ReturnOrderModel.fromJson(i))
@@ -168,6 +200,9 @@ class ReturnOrderModel {
int? uniqueId;
String? createdAt;
String? updatedAt;
+ int? reference;
+ String? transactionId;
+ int? orderNumber;
ReturnOrderModel(
{this.id,
@@ -175,6 +210,8 @@ class ReturnOrderModel {
this.storeId,
this.orderType,
this.status,
+ this.orderNumber,
+ this.reference,
this.paymentMode,
this.paymentStatus,
this.amount,
@@ -184,6 +221,7 @@ class ReturnOrderModel {
this.changeBalanceAmount,
this.timer,
this.table,
+ this.transactionId,
this.deliveryNotes,
this.createdAt,
this.updatedAt,
@@ -207,6 +245,9 @@ class ReturnOrderModel {
changeBalanceAmount: Utils.checkDouble(json['change_balance_amount'])!,
timer: json['timer'] ?? 0,
table: json['table'] ?? "",
+ orderNumber: json['order_number'] ?? 0,
+ transactionId: json['transaction_id'] ?? "",
+ reference: json['reference'] ?? 0,
createdAt: json['createdAt'] ?? "",
updatedAt: json['updatedAt'] ?? "",
deliveryNotes: json['delivery_notes'] ?? "",
diff --git a/lib/application/model/converters/DataTimeFormat.dart b/lib/application/model/converters/DataTimeFormat.dart
index dc7caff..f6c13c7 100644
--- a/lib/application/model/converters/DataTimeFormat.dart
+++ b/lib/application/model/converters/DataTimeFormat.dart
@@ -3,7 +3,7 @@ import 'package:intl/intl.dart';
class DataTimeFormat {
static String getFormatDate(String date) {
if (date.isEmpty) {
- return "";
+ return "dd/mm/yyyy";
}
var dateValue = DateFormat("yyyy-MM-ddTHH:mm:ssZ").parseUTC(date).toLocal();
@@ -11,6 +11,18 @@ class DataTimeFormat {
return formattedDate;
}
+ static String getFormatDateWithTime() {
+ String formattedDate =
+ DateFormat("dd-MM-yyyy, hh:mm a").format(DateTime.now());
+ return formattedDate;
+ }
+
+ static String getCurrentTimeDate() {
+ String formattedDate =
+ DateFormat("yyyy-MM-ddTHH:mm:ssZ").format(DateTime.now());
+ return formattedDate;
+ }
+
static bool subtractTime(String date, int timer) {
var endTime = DateFormat("yyyy-MM-ddTHH:mm:ssZ").parseUTC(date).toLocal();
return DateTime.now().isAfter(endTime.add(Duration(minutes: timer)));
@@ -23,7 +35,11 @@ class DataTimeFormat {
}
static String getFormatDateString(String date) {
+ if (date.isEmpty) {
+ return "";
+ }
var dateValue = DateFormat("yyyy-MM-ddTHH:mm:ssZ").parseUTC(date).toLocal();
+
String formattedDate = DateFormat("yyyy-MM-dd").format(dateValue);
return formattedDate;
}
@@ -32,7 +48,27 @@ class DataTimeFormat {
return DateFormat("yyyy-MM-dd").format(picked);
}
+ static String formatDateMMDDYYYY(DateTime picked) {
+ return DateFormat("dd/MM/yyyy").format(picked);
+ }
+
static String formatDateFromPicketINVOICE(DateTime picked) {
return DateFormat("yyyy-MM-ddTHH:mm:ssZ").format(picked);
}
+
+ static String getDay(String s) {
+ var dateValue = DateFormat("yyyy-MM-ddTHH:mm:ssZ").parseUTC(s).toLocal();
+ return DateFormat('EEEE').format(dateValue);
+ }
+
+ static String getTimeFormat(String s) {
+ var dateValue = DateFormat("yyyy-MM-ddTHH:mm:ssZ").parseUTC(s).toLocal();
+ return DateFormat('jm').format(dateValue);
+ }
+
+ static bool isDateExpired(String date) {
+ final now = DateTime.now();
+ var endTime = DateFormat("yyyy-MM-ddTHH:mm:ssZ").parseUTC(date).toLocal();
+ return endTime.isBefore(now);
+ }
}
diff --git a/lib/application/model/createOrder/CashierCart.dart b/lib/application/model/createOrder/CashierCart.dart
index 42ed0d8..c6703ac 100644
--- a/lib/application/model/createOrder/CashierCart.dart
+++ b/lib/application/model/createOrder/CashierCart.dart
@@ -1,8 +1,10 @@
+import 'package:wosull/application/model/Modifiers/Modifier.dart';
+import 'package:wosull/application/model/Modifiers/ModifierOption.dart';
+import 'package:wosull/application/model/ingredients/AddIngredient.dart';
+
import '../../../helpers/Utils.dart';
import '../../localdb/SharedPrefs.dart';
import '../Combo/GetComboModel.dart';
-import '../Modifiers/GetModifiersModel.dart';
-import '../inventory/AddIngredientModel.dart';
import '../store/StoreItemsResponse.dart';
class CashierCart {
diff --git a/lib/application/model/createOrder/OrderDetails.dart b/lib/application/model/createOrder/OrderDetails.dart
index a6772b9..9e1cfb7 100644
--- a/lib/application/model/createOrder/OrderDetails.dart
+++ b/lib/application/model/createOrder/OrderDetails.dart
@@ -1,20 +1,24 @@
+import 'dart:convert';
+
import 'package:objectbox/objectbox.dart';
import 'package:wosull/application/model/store/StoreItemsResponse.dart';
import 'package:wosull/helpers/Utils.dart';
@Entity()
class OrderDetails {
- @Id()
- int obid = 0;
+ @Id(assignable: true)
+ int id = 0;
String? productId;
double? totalItemTax;
double? totalItemPrice;
double? totalItemPriceWithoutModifier;
+
var items = ToMany();
OrderDetails(
{this.productId,
+ this.id = 0,
this.totalItemTax,
this.totalItemPrice,
required this.items,
@@ -22,6 +26,7 @@ class OrderDetails {
factory OrderDetails.fromJson(Map json) {
return OrderDetails(
+ id: 0,
productId: json['product_id'],
totalItemTax: Utils.checkDouble(json['total_item_tax'])!,
totalItemPrice: Utils.checkDouble(json['total_item_price'])!,
@@ -43,9 +48,18 @@ class OrderDetails {
data['total_item_price'] = totalItemPrice ?? 0;
data['total_item_price_without_modifier'] =
totalItemPriceWithoutModifier ?? 0;
- if (items != null) {
- data['items'] = items!.map((v) => v.toJson()).toList();
- }
+ data['items'] = items.map((v) => v.toJson()).toList();
+ return data;
+ }
+
+ Map toJsonOffline() {
+ final Map data = {};
+ data['product_id'] = productId;
+ data['total_item_tax'] = totalItemTax ?? 0;
+ data['total_item_price'] = totalItemPrice ?? 0;
+ data['total_item_price_without_modifier'] =
+ totalItemPriceWithoutModifier ?? 0;
+ data['items'] = jsonEncode(items);
return data;
}
}
diff --git a/lib/application/model/dashboard/AdminDashboardModel.dart b/lib/application/model/dashboard/AdminDashboardModel.dart
index fbb09d6..6ac6813 100644
--- a/lib/application/model/dashboard/AdminDashboardModel.dart
+++ b/lib/application/model/dashboard/AdminDashboardModel.dart
@@ -10,6 +10,10 @@ class AdminDashboardModel {
int? totalSupplier = 0;
int? totalCancelledOrders = 0;
int? totalCompleteOrders = 0;
+ int? totalDamagedOrders = 0;
+ int? totalReturnOrders = 0;
+ int? totalPartiallyReturnOrders = 0;
+ int? totalPartiallyDamagedOrders = 0;
AdminDashboardModel(
{this.success,
@@ -19,6 +23,10 @@ class AdminDashboardModel {
this.totalCustomer,
this.totalBranches,
this.totalSupplier,
+ this.totalDamagedOrders,
+ this.totalReturnOrders,
+ this.totalPartiallyReturnOrders,
+ this.totalPartiallyDamagedOrders,
this.totalCancelledOrders,
this.totalCompleteOrders});
@@ -31,6 +39,10 @@ class AdminDashboardModel {
totalCustomer: data['total_customers'] ?? 0,
totalSupplier: data['total_suppliers'] ?? 0,
totalBranches: data['total_branches'] ?? 0,
+ totalDamagedOrders: data['total_damaged_orders'] ?? 0,
+ totalReturnOrders: data['total_returned_orders'] ?? 0,
+ totalPartiallyReturnOrders: data['total_partially_return_orders'] ?? 0,
+ totalPartiallyDamagedOrders: data['total_partially_damage_orders'] ?? 0,
totalCancelledOrders: data['total_cancelled_orders'] ?? 0,
totalCompleteOrders: data['total_completed_orders'] ?? 0);
}
diff --git a/lib/application/model/dashboard/graph/AllInvoiceStatus.dart b/lib/application/model/dashboard/graph/AllInvoiceStatus.dart
index f840ef4..f5d6f01 100644
--- a/lib/application/model/dashboard/graph/AllInvoiceStatus.dart
+++ b/lib/application/model/dashboard/graph/AllInvoiceStatus.dart
@@ -13,10 +13,10 @@ class AllInvoiceStatus {
this.cancelledInvoices});
AllInvoiceStatus.fromJson(Map json) {
- openInvoices = json['open_invoices'];
- paidInvoices = json['paid_invoices'];
- partiallyPaidInvoices = json['partially_paid_invoices'];
- returnInvoices = json['return_invoices'];
- cancelledInvoices = json['cancelled_invoices'];
+ openInvoices = json['open_invoices'] ?? 0;
+ paidInvoices = json['paid_invoices'] ?? 0;
+ partiallyPaidInvoices = json['partially_paid_invoices'] ?? 0;
+ returnInvoices = json['return_invoices'] ?? 0;
+ cancelledInvoices = json['cancelled_invoices'] ?? 0;
}
}
diff --git a/lib/application/model/dashboard/graph/AllPosStatus.dart b/lib/application/model/dashboard/graph/AllPosStatus.dart
index cce54aa..6e95bd8 100644
--- a/lib/application/model/dashboard/graph/AllPosStatus.dart
+++ b/lib/application/model/dashboard/graph/AllPosStatus.dart
@@ -11,9 +11,9 @@ class AllPosStatus {
this.returnOrders});
AllPosStatus.fromJson(Map json) {
- completeOrders = json['complete_orders'];
- cancelledOrders = json['cancelled_orders'];
- damagedOrders = json['damaged_orders'];
- returnOrders = json['return_orders'];
+ completeOrders = json['complete_orders'] ?? 0;
+ cancelledOrders = json['cancelled_orders'] ?? 0;
+ damagedOrders = json['damaged_orders'] ?? 0;
+ returnOrders = json['return_orders'] ?? 0;
}
}
diff --git a/lib/application/model/dashboard/graph/POSValueDataWise.dart b/lib/application/model/dashboard/graph/POSValueDataWise.dart
index 1982e8c..be6db54 100644
--- a/lib/application/model/dashboard/graph/POSValueDataWise.dart
+++ b/lib/application/model/dashboard/graph/POSValueDataWise.dart
@@ -1,13 +1,15 @@
+import 'package:wosull/helpers/Utils.dart';
+
class POSValueDataWise {
String? id;
- int? totalAmount;
+ double? totalAmount;
int? index;
POSValueDataWise({this.id, this.totalAmount, this.index});
POSValueDataWise.fromJson(Map json) {
id = json['_id'];
- totalAmount = json['total_amount'];
+ totalAmount = Utils.checkDouble(json['total_amount']);
index = json['index'];
}
}
diff --git a/lib/application/model/dashboard/graph/PosOrderCountTodayTimewise.dart b/lib/application/model/dashboard/graph/PosOrderCountTodayTimewise.dart
index 991a3f1..a8bd0ee 100644
--- a/lib/application/model/dashboard/graph/PosOrderCountTodayTimewise.dart
+++ b/lib/application/model/dashboard/graph/PosOrderCountTodayTimewise.dart
@@ -1,13 +1,15 @@
+import 'package:wosull/helpers/Utils.dart';
+
class PosOrderCountTodayTimewise {
String? sId;
int? count;
- int? totalAmount;
+ double? totalAmount;
PosOrderCountTodayTimewise({this.sId, this.count, this.totalAmount});
PosOrderCountTodayTimewise.fromJson(Map json) {
sId = json['_id'];
count = json['count'];
- totalAmount = json['total_amount'];
+ totalAmount = Utils.checkDouble(json['total_amount']);
}
}
diff --git a/lib/application/model/dashboard/graph/TodaySales.dart b/lib/application/model/dashboard/graph/TodaySales.dart
index bffae4d..3885c97 100644
--- a/lib/application/model/dashboard/graph/TodaySales.dart
+++ b/lib/application/model/dashboard/graph/TodaySales.dart
@@ -1,12 +1,14 @@
+import 'package:wosull/helpers/Utils.dart';
+
class TodaySales {
Id? id;
- int? totalAmount;
+ double? totalAmount;
TodaySales({this.id, this.totalAmount});
TodaySales.fromJson(Map json) {
id = json['_id'] != null ? Id.fromJson(json['_id']) : null;
- totalAmount = json['total_amount'];
+ totalAmount = Utils.checkDouble(json['total_amount']);
}
}
diff --git a/lib/application/model/dashboard/graph/TotalIncomeExpense.dart b/lib/application/model/dashboard/graph/TotalIncomeExpense.dart
index 1b78cb0..c3de79c 100644
--- a/lib/application/model/dashboard/graph/TotalIncomeExpense.dart
+++ b/lib/application/model/dashboard/graph/TotalIncomeExpense.dart
@@ -1,13 +1,15 @@
+import 'package:wosull/helpers/Utils.dart';
+
class TotalIncomeExpense {
String? id;
- int? totalIncome;
- int? totalExpense;
+ double? totalIncome;
+ double? totalExpense;
TotalIncomeExpense({this.id, this.totalIncome, this.totalExpense});
TotalIncomeExpense.fromJson(Map json) {
id = json['_id'];
- totalIncome = json['total_income'] ?? 0;
- totalExpense = json['total_expense'] ?? 0;
+ totalIncome = Utils.checkDouble(json['total_income'])!;
+ totalExpense = Utils.checkDouble(json['total_expense'])!;
}
}
diff --git a/lib/application/model/discount/StoreDiscountModel.dart b/lib/application/model/discount/StoreDiscountModel.dart
index 4e91838..4cb2d9d 100644
--- a/lib/application/model/discount/StoreDiscountModel.dart
+++ b/lib/application/model/discount/StoreDiscountModel.dart
@@ -2,11 +2,14 @@ import 'package:objectbox/objectbox.dart';
import 'package:wosull/helpers/Utils.dart';
class StoreDiscountModel {
- bool? success;
- List? storeDiscount;
- int? pages;
+ bool success;
+ List storeDiscount;
+ int pages;
- StoreDiscountModel({this.success, this.storeDiscount, this.pages});
+ StoreDiscountModel(
+ {required this.success,
+ required this.storeDiscount,
+ required this.pages});
factory StoreDiscountModel.fromJson(Map json) {
return StoreDiscountModel(
@@ -41,6 +44,7 @@ class StoreDiscount {
String? discountType;
String? discountTypeLabel;
double? limitOfDiscount;
+ double? isUserUsed;
String? discountStartDate;
String? discountEndDate;
bool? isDeleted;
@@ -59,6 +63,7 @@ class StoreDiscount {
this.value,
this.type,
this.storeId,
+ this.isUserUsed,
this.categories,
this.products,
this.status,
@@ -95,6 +100,7 @@ class StoreDiscount {
categories: json['categories'].cast(),
products: json['products'].cast(),
status: json['status'] ?? "",
+ isUserUsed: Utils.checkDouble(json['is_user_used'])!,
minAmountLimit: Utils.checkDouble(json['min_amount_limit'])!,
maxDiscountLimit: Utils.checkDouble(json['max_discount_limit'])!,
discountPercentage: json['discount_percentage'] ?? "",
diff --git a/lib/application/model/home/DrawerItem.dart b/lib/application/model/home/DrawerItem.dart
new file mode 100644
index 0000000..b5b01b8
--- /dev/null
+++ b/lib/application/model/home/DrawerItem.dart
@@ -0,0 +1,8 @@
+import 'package:flutter/material.dart';
+
+class DrawerItem {
+ String title;
+ IconData icon;
+
+ DrawerItem(this.title, this.icon);
+}
diff --git a/lib/application/model/ingredients/Add.dart b/lib/application/model/ingredients/Add.dart
new file mode 100644
index 0000000..6cd79dd
--- /dev/null
+++ b/lib/application/model/ingredients/Add.dart
@@ -0,0 +1,9 @@
+class Add {
+ String id;
+
+ Add({this.id = ''});
+
+ factory Add.fromJson(Map json) {
+ return Add(id: json['_id'] ?? "");
+ }
+}
diff --git a/lib/application/model/inventory/AddIngredientModel.dart b/lib/application/model/ingredients/AddIngredient.dart
similarity index 73%
rename from lib/application/model/inventory/AddIngredientModel.dart
rename to lib/application/model/ingredients/AddIngredient.dart
index bedf83e..31cfdb8 100644
--- a/lib/application/model/inventory/AddIngredientModel.dart
+++ b/lib/application/model/ingredients/AddIngredient.dart
@@ -1,92 +1,6 @@
import 'package:objectbox/objectbox.dart';
-
-import '../../localdb/SharedPrefs.dart';
-
-class AddIngredientModel {
- bool success;
- String message;
- Add ingredient;
- String error_code;
-
- AddIngredientModel(
- {required this.success,
- required this.message,
- required this.ingredient,
- required this.error_code});
-
- factory AddIngredientModel.fromJson(Map json) {
- return AddIngredientModel(
- success: json['success'] as bool,
- message: json['message'] == null ? '' : json['message'] as String,
- error_code:
- json['error_code'] == null ? '' : json['error_code'] as String,
- ingredient: json['ingredient'] == null
- ? Add(id: '')
- : Add.fromJson(json['ingredient']),
- );
- }
-}
-
-class AddProductModel {
- bool success;
- int message;
- AddProductItem product;
- int error_code;
-
- AddProductModel(
- {required this.success,
- required this.message,
- required this.product,
- required this.error_code});
-
- factory AddProductModel.fromJson(Map json) {
- return AddProductModel(
- success: json['success'] ?? false,
- message: json['message'] == null ? 200 : json['message'] as int,
- error_code: json['error_code'] == null ? 500 : json['error_code'] as int,
- product: json['item'] == null
- ? AddProductItem()
- : AddProductItem.fromJson(json['item']),
- );
- }
-}
-
-class AddProductItem {
- String id;
-
- AddProductItem({this.id = ''});
-
- factory AddProductItem.fromJson(Map json) {
- return AddProductItem(
- id: json['_id'] ?? "",
- );
- }
-}
-
-class GetIngredientModel {
- bool success;
- List ingredient;
-
- GetIngredientModel({required this.success, required this.ingredient});
-
- factory GetIngredientModel.fromJson(Map json) {
- return GetIngredientModel(
- success: json['success'] as bool,
- ingredient: List.from(json['ingrediant'])
- .map((i) => AddIngredient.fromJson(i))
- .toList());
- }
-}
-
-class Add {
- String id;
-
- Add({this.id = ''});
-
- factory Add.fromJson(Map json) {
- return Add(id: json['_id'] ?? "");
- }
-}
+import 'package:wosull/application/localdb/SharedPrefs.dart';
+import 'package:wosull/helpers/Utils.dart';
@Entity()
class AddIngredient {
@@ -96,23 +10,23 @@ class AddIngredient {
String name;
String description;
String value;
- var purchasePrice;
- var salePrice;
- var defaultSalePrice;
+ double? purchasePrice;
+ double? salePrice;
+ double? defaultSalePrice;
String categoryId;
String productId;
String details;
String details1;
- var price;
- var purchaseCost;
- var itemPriceWithoutOffer;
+ double? price;
+ double? purchaseCost;
+ double? itemPriceWithoutOffer;
var discountPercentage;
var discountValue;
var offerMessageOrPercentage;
- var totalQuantity;
+ int? totalQuantity;
bool inCartQuantity;
- var totalAddedQuantity;
- var totalUsedQuantity;
+ int? totalAddedQuantity;
+ int? totalUsedQuantity;
var sequenceNumber;
String noteForItem;
String uniqueIdForStoreData;
@@ -128,10 +42,10 @@ class AddIngredient {
String tags;
String itemNameArabic;
String itemDescriptionArabic;
- var salePriceExclusiveTax;
+ double? salePriceExclusiveTax;
String productCode;
- var stockAlertQuantity;
- var salePriceInclusiveTax;
+ int? stockAlertQuantity;
+ double? salePriceInclusiveTax;
String supplier;
String discount;
String measurementCategory;
@@ -141,7 +55,7 @@ class AddIngredient {
String expiryDate;
String createdAt;
String updatedAt;
-
+ String quantity;
String measuringUnit;
bool checked;
@@ -151,6 +65,7 @@ class AddIngredient {
{this.name = '',
this.description = '',
this.value = '',
+ this.quantity = '',
this.purchasePrice,
this.salePrice,
this.defaultSalePrice,
@@ -205,16 +120,19 @@ class AddIngredient {
name: json['name'] ?? '',
description: json['description'] ?? '',
value: json['value'] ?? '',
- purchasePrice: json['purchase_price'] ?? '',
- salePrice: json['sale_price'] ?? '0.0',
- defaultSalePrice: json['default_sale_price'] ?? '',
+ purchasePrice: Utils.checkDouble(json['purchase_price'] ?? '0'),
+ salePrice: Utils.checkDouble(json['sale_price'] ?? '0.0'),
+ defaultSalePrice:
+ Utils.checkDouble(json['default_sale_price'] ?? '0.0'),
categoryId: json['category_id'] ?? '',
productId: json['product_id'] ?? '',
details: json['details'] ?? '',
+ quantity: json['quantity'] ?? '',
details1: json['details_1'] ?? '',
- price: json['price'] ?? 0.0,
- purchaseCost: json['purchase_cost'] ?? '',
- itemPriceWithoutOffer: json['item_price_without_offer'] ?? '',
+ price: Utils.checkDouble(json['price'] ?? '0.0'),
+ purchaseCost: Utils.checkDouble(json['purchase_cost'] ?? '0.0'),
+ itemPriceWithoutOffer:
+ Utils.checkDouble(json['item_price_without_offer'] ?? '0.0'),
discountPercentage: json['discount_percentage'] ?? '',
discountValue: json['discount_value'] ?? '',
offerMessageOrPercentage: json['offer_message_or_percentage'] ?? '',
@@ -238,10 +156,12 @@ class AddIngredient {
tags: json['tags'] ?? '',
itemNameArabic: json['item_name_arabic'] ?? '',
itemDescriptionArabic: json['item_description_arabic'] ?? '',
- salePriceExclusiveTax: json['sale_price_exclusive_tax'] ?? '',
+ salePriceExclusiveTax:
+ Utils.checkDouble(json['sale_price_exclusive_tax'] ?? '0.0'),
productCode: json['product_code'] ?? '',
stockAlertQuantity: json['stock_alert_quantity'] ?? '',
- salePriceInclusiveTax: json['sale_price_inclusive_tax'] ?? '',
+ salePriceInclusiveTax:
+ Utils.checkDouble(json['sale_price_inclusive_tax'] ?? '0.0'),
supplier: json['supplier'] ?? '',
discount: json['discount'] ?? '',
measurementCategory: json['measurement_category'] ?? '',
diff --git a/lib/application/model/ingredients/AddIngredientModel.dart b/lib/application/model/ingredients/AddIngredientModel.dart
new file mode 100644
index 0000000..5bea5f4
--- /dev/null
+++ b/lib/application/model/ingredients/AddIngredientModel.dart
@@ -0,0 +1,26 @@
+import 'package:wosull/application/model/ingredients/Add.dart';
+
+class AddIngredientModel {
+ bool success;
+ String message;
+ Add ingredient;
+ String error_code;
+
+ AddIngredientModel(
+ {required this.success,
+ required this.message,
+ required this.ingredient,
+ required this.error_code});
+
+ factory AddIngredientModel.fromJson(Map json) {
+ return AddIngredientModel(
+ success: json['success'] as bool,
+ message: json['message'] == null ? '' : json['message'] as String,
+ error_code:
+ json['error_code'] == null ? '' : json['error_code'] as String,
+ ingredient: json['ingredient'] == null
+ ? Add(id: '')
+ : Add.fromJson(json['ingredient']),
+ );
+ }
+}
diff --git a/lib/application/model/ingredients/AddProdcutModel.dart b/lib/application/model/ingredients/AddProdcutModel.dart
new file mode 100644
index 0000000..89ebe90
--- /dev/null
+++ b/lib/application/model/ingredients/AddProdcutModel.dart
@@ -0,0 +1,25 @@
+import 'package:wosull/application/model/ingredients/AddProductItem.dart';
+
+class AddProductModel {
+ bool success;
+ int message;
+ AddProductItem product;
+ int error_code;
+
+ AddProductModel(
+ {required this.success,
+ required this.message,
+ required this.product,
+ required this.error_code});
+
+ factory AddProductModel.fromJson(Map json) {
+ return AddProductModel(
+ success: json['success'] ?? false,
+ message: json['message'] == null ? 200 : json['message'] as int,
+ error_code: json['error_code'] == null ? 500 : json['error_code'] as int,
+ product: json['item'] == null
+ ? AddProductItem()
+ : AddProductItem.fromJson(json['item']),
+ );
+ }
+}
diff --git a/lib/application/model/ingredients/AddProductItem.dart b/lib/application/model/ingredients/AddProductItem.dart
new file mode 100644
index 0000000..792515d
--- /dev/null
+++ b/lib/application/model/ingredients/AddProductItem.dart
@@ -0,0 +1,11 @@
+class AddProductItem {
+ String id;
+
+ AddProductItem({this.id = ''});
+
+ factory AddProductItem.fromJson(Map json) {
+ return AddProductItem(
+ id: json['_id'] ?? "",
+ );
+ }
+}
diff --git a/lib/application/model/ingredients/GetIngredientModel.dart b/lib/application/model/ingredients/GetIngredientModel.dart
new file mode 100644
index 0000000..b92ba9f
--- /dev/null
+++ b/lib/application/model/ingredients/GetIngredientModel.dart
@@ -0,0 +1,18 @@
+import 'package:wosull/application/model/ingredients/AddIngredient.dart';
+
+class GetIngredientModel {
+ bool success;
+ List ingredient;
+
+ GetIngredientModel({required this.success, required this.ingredient});
+
+ factory GetIngredientModel.fromJson(Map json) {
+ return GetIngredientModel(
+ success: json['success'] as bool,
+ ingredient: json['ingrediant'] != null
+ ? List.from(json['ingrediant'])
+ .map((i) => AddIngredient.fromJson(i))
+ .toList()
+ : []);
+ }
+}
diff --git a/lib/application/model/inventory/Item.dart b/lib/application/model/inventory/Item.dart
index 4667c30..08f3005 100644
--- a/lib/application/model/inventory/Item.dart
+++ b/lib/application/model/inventory/Item.dart
@@ -1,18 +1,18 @@
import 'package:wosull/helpers/Utils.dart';
class ReportProductModel {
- bool? success;
- List- ? storeItems;
+ bool success;
+ List
- storeItems;
- ReportProductModel({this.success, this.storeItems});
+ ReportProductModel(this.success, this.storeItems);
factory ReportProductModel.fromJson(Map json) {
return ReportProductModel(
- success: json['success'] ?? false,
- storeItems: json['item'] != null
+ json['success'] ?? false,
+ json['item'] != null
? List.from(json['item'])
- .map((i) => Item.fromJson(i))
- .toList()
+ .map((i) => Item.fromJson(i))
+ .toList()
: []);
}
}
@@ -25,12 +25,13 @@ class Item {
double? price;
int? totalQuantity;
- Item({this.id,
- this.productId,
- this.details,
- this.name,
- this.price,
- this.totalQuantity});
+ Item(
+ {this.id,
+ this.productId,
+ this.details,
+ this.name,
+ this.price,
+ this.totalQuantity});
factory Item.fromJson(Map json) {
return Item(
@@ -66,9 +67,6 @@ class CategoryId {
CategoryId({this.id, this.name});
factory CategoryId.fromJson(Map json) {
- return CategoryId(
- id: json['_id'] ?? "",
- name: json['name'] ?? ""
- );
+ return CategoryId(id: json['_id'] ?? "", name: json['name'] ?? "");
}
}
diff --git a/lib/application/model/inventory/category/ItemCategory.dart b/lib/application/model/inventory/category/ItemCategory.dart
index 3bc921a..1d8d6d9 100644
--- a/lib/application/model/inventory/category/ItemCategory.dart
+++ b/lib/application/model/inventory/category/ItemCategory.dart
@@ -27,7 +27,7 @@ class ItemCategory {
{this.name = '',
this.id = '',
this.categoryAppliedOn = '',
- this.isVisibleInStore = false,
+ this.isVisibleInStore = true,
this.createdAt = '',
this.updatedAt = '',
this.description = '',
diff --git a/lib/application/model/inventory/subCategory/SearchSubCategoryResponse.dart b/lib/application/model/inventory/subCategory/SearchSubCategoryResponse.dart
new file mode 100644
index 0000000..4b2eca7
--- /dev/null
+++ b/lib/application/model/inventory/subCategory/SearchSubCategoryResponse.dart
@@ -0,0 +1,18 @@
+import 'package:wosull/application/model/inventory/ItemSubCategoryResponse.dart';
+
+class SearchSubCategoryResponse {
+ bool success;
+ List categories;
+
+ SearchSubCategoryResponse({this.success = false, this.categories = const []});
+
+ factory SearchSubCategoryResponse.fromJson(Map json) {
+ return SearchSubCategoryResponse(
+ success: json['success'] ?? false,
+ categories: json['success'] == true
+ ? List.from(json['subCategory'])
+ .map((i) => ItemSubCategory.fromJson(i))
+ .toList()
+ : []);
+ }
+}
diff --git a/lib/application/model/invoice/Account.dart b/lib/application/model/invoice/Account.dart
new file mode 100644
index 0000000..7c162d5
--- /dev/null
+++ b/lib/application/model/invoice/Account.dart
@@ -0,0 +1,12 @@
+class Account {
+ String id;
+ String name;
+ String type;
+
+ Account(this.id, this.name, this.type);
+
+ factory Account.fromJson(Map json) {
+ return Account(json['_id'] ?? '', json['account_name'] ?? '',
+ json['account_type'] ?? '');
+ }
+}
diff --git a/lib/application/model/invoice/MakePayment.dart b/lib/application/model/invoice/MakePayment.dart
new file mode 100644
index 0000000..69a4143
--- /dev/null
+++ b/lib/application/model/invoice/MakePayment.dart
@@ -0,0 +1,22 @@
+class MakePayment {
+ String account;
+ String paymentMethod;
+ String date;
+ double amount;
+ String notes;
+ String invoiceId;
+
+ MakePayment(this.account, this.paymentMethod, this.date, this.amount,
+ this.notes, this.invoiceId);
+
+ Map toJson() {
+ return {
+ 'account': account,
+ 'payment_method': paymentMethod,
+ 'transaction_date': date,
+ 'amount': amount,
+ 'notes': notes,
+ 'invoice_id': invoiceId
+ };
+ }
+}
diff --git a/lib/application/model/invoice/PaymentHistory.dart b/lib/application/model/invoice/PaymentHistory.dart
new file mode 100644
index 0000000..c819f9b
--- /dev/null
+++ b/lib/application/model/invoice/PaymentHistory.dart
@@ -0,0 +1,26 @@
+import 'package:wosull/helpers/Utils.dart';
+
+class PaymentHistory {
+ String account;
+ String paymentMethod;
+ String date;
+ double amount;
+ String notes;
+ String invoiceId;
+ double paidAmount;
+
+ PaymentHistory(this.account, this.paymentMethod, this.date, this.amount,
+ this.notes, this.invoiceId, this.paidAmount);
+
+ factory PaymentHistory.fromJson(Map json) {
+ return PaymentHistory(
+ json['account'] ?? '',
+ json['payment_method'] ?? '',
+ json['transaction_date'] ?? '',
+ Utils.checkDouble(json['amount']) ?? 0,
+ json['notes'] ?? '',
+ json['invoice_id'] ?? '',
+ Utils.checkDouble(json['total_paid_amount']) ?? 0,
+ );
+ }
+}
diff --git a/lib/application/model/invoice/PaymentMethod.dart b/lib/application/model/invoice/PaymentMethod.dart
new file mode 100644
index 0000000..0d074d2
--- /dev/null
+++ b/lib/application/model/invoice/PaymentMethod.dart
@@ -0,0 +1,35 @@
+import 'package:wosull/application/localdb/SharedPrefs.dart';
+
+class PaymentMethod {
+ String? id;
+ String? paymentMethod;
+ bool? status;
+ String? updatedAt;
+ String? description;
+
+ PaymentMethod(
+ {this.id,
+ this.paymentMethod,
+ this.status,
+ this.description,
+ this.updatedAt});
+
+ factory PaymentMethod.fromJson(Map json) {
+ return PaymentMethod(
+ id: json['_id'] ?? '',
+ paymentMethod: json['paymentMethod'] ?? '',
+ status: json['status'] ?? false,
+ description: json['description'] ?? '',
+ updatedAt: json['updatedAt'] ?? '');
+ }
+
+ Map toJson() {
+ return {
+ 'description': description,
+ 'paymentMethod': paymentMethod,
+ 'status': status ?? true,
+ 'store_id': sharedPrefs.storeId,
+ 'payment_id': id
+ };
+ }
+}
diff --git a/lib/application/model/invoice/PaymentMethodResponse.dart b/lib/application/model/invoice/PaymentMethodResponse.dart
new file mode 100644
index 0000000..1c71516
--- /dev/null
+++ b/lib/application/model/invoice/PaymentMethodResponse.dart
@@ -0,0 +1,19 @@
+import 'package:wosull/application/model/invoice/PaymentMethod.dart';
+
+class PaymentMethodResponse {
+ bool status;
+ List paymentMethods;
+
+ PaymentMethodResponse(this.status, this.paymentMethods);
+
+ factory PaymentMethodResponse.fromJson(Map json) {
+ return PaymentMethodResponse(
+ json['success'] ?? false,
+ json['payment_methods'] != null
+ ? List.from(json['payment_methods'])
+ .map((i) => PaymentMethod.fromJson(i))
+ .toList()
+ : [],
+ );
+ }
+}
diff --git a/lib/application/model/invoice/QuotationInvioceModel.dart b/lib/application/model/invoice/QuotationInvioceModel.dart
index 0db6bd1..08af239 100644
--- a/lib/application/model/invoice/QuotationInvioceModel.dart
+++ b/lib/application/model/invoice/QuotationInvioceModel.dart
@@ -90,12 +90,8 @@ class QuotationInvoice {
currencyId: Utils.checkCurrency(json['currency_id'])!,
uniqueId: json['unique_id'] ?? 0,
status: json['status'] ?? "",
- supplier: json['supplier_id'] != null
- ? Supplier.fromJson(json['supplier_id'])
- : Supplier(),
- customer: json['customer_id'] != null
- ? Customer.fromJson(json['customer_id'])
- : Customer(),
+ supplier: Utils.checkSupplier(json['supplier_id']),
+ customer: Utils.checkCustomer(json['customer_id']),
products: json['products'] != null
? List.from(json['products'])
.map((i) => StoreInvoiceProduct.fromJson(i))
@@ -133,7 +129,7 @@ class QuotationInvoice {
data['vat_number'] = vatNumber;
data['total_excluding_vat'] = totalTaxExcluding;
data['total_taxable_amount'] = totalTaxableAmount;
- data['currency_id'] = currencyId!.id!;
+ data['currency_id'] = currencyId?.id! ?? '';
return data;
}
}
diff --git a/lib/application/model/invoice/StoreIncomeAccountResponse.dart b/lib/application/model/invoice/StoreIncomeAccountResponse.dart
new file mode 100644
index 0000000..d0c9a0e
--- /dev/null
+++ b/lib/application/model/invoice/StoreIncomeAccountResponse.dart
@@ -0,0 +1,19 @@
+import 'package:wosull/application/model/invoice/Account.dart';
+
+class StoreIncomeAccountResponse {
+ bool status;
+ List accounts;
+
+ StoreIncomeAccountResponse(this.status, this.accounts);
+
+ factory StoreIncomeAccountResponse.fromJson(Map json) {
+ return StoreIncomeAccountResponse(
+ json['success'] ?? false,
+ json['accounts'] != null
+ ? List.from(json['accounts'])
+ .map((i) => Account.fromJson(i))
+ .toList()
+ : [],
+ );
+ }
+}
diff --git a/lib/application/model/invoice/StoreInvoice.dart b/lib/application/model/invoice/StoreInvoice.dart
index efc9d6f..0b8410f 100644
--- a/lib/application/model/invoice/StoreInvoice.dart
+++ b/lib/application/model/invoice/StoreInvoice.dart
@@ -1,4 +1,5 @@
import 'package:wosull/application/localdb/SharedPrefs.dart';
+import 'package:wosull/application/model/invoice/PaymentHistory.dart';
import 'package:wosull/application/model/store/GetStoreCurrency.dart';
import 'package:wosull/application/model/store/StoreInvoicesModel.dart';
import 'package:wosull/helpers/Utils.dart';
@@ -16,6 +17,7 @@ class StoreInvoice {
Supplier? supplier;
Customer? customer;
List products = [];
+ List? paymentHistory = [];
double? totalDiscount;
double? totalAmount;
String? terms;
@@ -24,6 +26,8 @@ class StoreInvoice {
int? totalVat;
double? totalTaxExcluding;
double? totalTaxableAmount;
+ double? totalPaidAmount;
+ double? totalPendingAmount;
String? vatNumber;
int? uniqueId;
@@ -39,10 +43,13 @@ class StoreInvoice {
this.currencyId,
this.status,
this.customer,
+ this.paymentHistory,
required this.products,
this.totalDiscount,
this.totalAmount,
this.terms,
+ this.totalPaidAmount,
+ this.totalPendingAmount,
this.productStock,
this.totalTax,
this.totalVat,
@@ -68,11 +75,18 @@ class StoreInvoice {
.map((i) => StoreInvoiceProduct.fromJson(i))
.toList()
: [],
+ paymentHistory: json['payment_history'] != null
+ ? List.from(json['payment_history'])
+ .map((i) => PaymentHistory.fromJson(i))
+ .toList()
+ : [],
totalTax: Utils.checkDouble(json['total_tax'])!,
totalVat: json['total_vat'] ?? 0,
totalDiscount: Utils.checkDouble(json['total_discount'])!,
totalAmount: Utils.checkDouble(json['total_amount'])!,
terms: json['terms'],
+ totalPaidAmount: Utils.checkDouble(json['total_paid_amount'])!,
+ totalPendingAmount: Utils.checkDouble(json['total_pending_amount'])!,
totalTaxExcluding: Utils.checkDouble(json['total_excluding_vat'])!,
totalTaxableAmount: Utils.checkDouble(json['total_taxable_amount'])!,
vatNumber: json['vat_number'] ?? "",
@@ -83,6 +97,7 @@ class StoreInvoice {
Map toJson() {
final Map data = {};
data['store_id'] = sharedPrefs.storeId;
+ data['invoice_for'] = invoiceFor!.first;
data['invoiceId'] = id ?? '';
data['customer_id'] = customerId ?? '';
data['invoice_number'] = invoiceNumber;
diff --git a/lib/application/model/modifierOptions/ModifierId.dart b/lib/application/model/modifierOptions/ModifierId.dart
new file mode 100644
index 0000000..4a10d45
--- /dev/null
+++ b/lib/application/model/modifierOptions/ModifierId.dart
@@ -0,0 +1,13 @@
+class ModifierId {
+ String? id;
+ String? name;
+
+ ModifierId({this.id, this.name});
+
+ factory ModifierId.fromJson(Map json) {
+ return ModifierId(
+ id: json['_id'] ?? "",
+ name: json['name'] ?? "",
+ );
+ }
+}
diff --git a/lib/application/model/modifierOptions/ModifierOption.dart b/lib/application/model/modifierOptions/ModifierOption.dart
new file mode 100644
index 0000000..102bf46
--- /dev/null
+++ b/lib/application/model/modifierOptions/ModifierOption.dart
@@ -0,0 +1,62 @@
+import 'package:wosull/application/localdb/SharedPrefs.dart';
+import 'package:wosull/application/model/ingredients/AddIngredient.dart';
+import 'package:wosull/application/model/modifierOptions/ModifierId.dart';
+import 'package:wosull/application/model/store/WosulStore.dart';
+import 'package:wosull/helpers/Utils.dart';
+
+class ModifierOption {
+ String? id;
+ ModifierId? modifier;
+ WosulStore? store;
+ String? name;
+ double? price;
+ bool? status;
+ String? createdAt;
+ String? updatedAt;
+ List? ingredients;
+
+ ModifierOption(
+ {this.id = '',
+ this.modifier,
+ this.store,
+ this.name = '',
+ this.price,
+ this.status = true,
+ this.createdAt,
+ this.updatedAt,
+ this.ingredients});
+
+ factory ModifierOption.fromJson(Map json) {
+ return ModifierOption(
+ id: json['_id'] ?? "",
+ name: json['name'] ?? "",
+ modifier: json['modifier_id'] != null
+ ? ModifierId.fromJson(json['modifier_id'])
+ : ModifierId(),
+ store: json['store_id'] != null
+ ? WosulStore.fromJson(json['store_id'])
+ : WosulStore(),
+ price: Utils.checkDouble(json['price']),
+ status: json['status'] ?? false,
+ createdAt: json['createdAt'] ?? "",
+ updatedAt: json['updatedAt'] ?? "",
+ ingredients: json['ingredients'] != null
+ ? List.from(json['ingredients'])
+ .map((i) => AddIngredient.fromJson(i))
+ .toList()
+ : []);
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['name'] = name;
+ data['status'] = status;
+ data['store_id'] = sharedPrefs.storeId;
+ data['modifier_id'] = modifier!.id;
+ data['price'] = price;
+ data['modifier_option_id'] = id;
+ data['ingredients'] = ingredients;
+
+ return data;
+ }
+}
diff --git a/lib/application/model/modifierOptions/ModifierOptionsResponse.dart b/lib/application/model/modifierOptions/ModifierOptionsResponse.dart
new file mode 100644
index 0000000..00d809f
--- /dev/null
+++ b/lib/application/model/modifierOptions/ModifierOptionsResponse.dart
@@ -0,0 +1,19 @@
+import 'package:wosull/application/model/modifierOptions/ModifierOption.dart';
+
+class ModifierOptionsResponse {
+ bool? status;
+ List? modifierOptions;
+
+ ModifierOptionsResponse({this.status, this.modifierOptions});
+
+ factory ModifierOptionsResponse.fromJson(Map json) {
+ return ModifierOptionsResponse(
+ status: json['success'] ?? "",
+ modifierOptions: json['modifier_options'] != null
+ ? List.from(json['modifier_options'])
+ .map((i) => ModifierOption.fromJson(i))
+ .toList()
+ : [],
+ );
+ }
+}
diff --git a/lib/application/model/reports/CashierOrder.dart b/lib/application/model/reports/CashierOrder.dart
new file mode 100644
index 0000000..d5c6466
--- /dev/null
+++ b/lib/application/model/reports/CashierOrder.dart
@@ -0,0 +1,107 @@
+import 'package:wosull/application/localdb/SharedPrefs.dart';
+import 'package:wosull/application/model/createOrder/CashierCart.dart';
+import 'package:wosull/application/model/store/WosulStore.dart';
+import 'package:wosull/helpers/Utils.dart';
+
+class CashierOrder {
+ String? id;
+ CashierCart? cart;
+ double? totalAmount;
+ double? totalDiscount;
+ int? cardNumber;
+ int? timer;
+ String? deliveryNotes;
+ WosulStore? storeId;
+ String? orderType;
+ String? status;
+ bool? paymentStatus;
+ String? paymentMode;
+ double? amount;
+ double? changeBalanceAmount;
+ bool? isDeleted;
+ String? table;
+ String? createdAt;
+ String? updatedAt;
+ int? uniqueId;
+ String? returnOrderId;
+ int? referenceNo;
+ String? transactionId;
+ List? returnOrderDetails = [];
+
+ CashierOrder(
+ {this.id,
+ this.returnOrderId,
+ this.totalAmount,
+ this.referenceNo,
+ this.transactionId,
+ this.totalDiscount,
+ this.cardNumber,
+ this.timer,
+ this.cart,
+ this.deliveryNotes,
+ this.storeId,
+ this.orderType,
+ this.status,
+ this.paymentStatus,
+ this.paymentMode,
+ this.amount,
+ this.changeBalanceAmount,
+ this.isDeleted,
+ this.table,
+ this.createdAt,
+ this.updatedAt,
+ this.uniqueId});
+
+ Map toJson() {
+ final Map data = {};
+
+ data['cart_id'] = cart!.toJsonOrder();
+ data['order_id'] = id;
+ data['status'] = status;
+ data['store_id'] = sharedPrefs.storeId;
+ data['order_type'] = orderType;
+ data['payment_mode'] = paymentMode;
+ data['amount'] = amount;
+ data['change_balance_amount'] = changeBalanceAmount;
+ data['table'] = table;
+ data['card_number'] = cardNumber;
+ data['delivery_notes'] = deliveryNotes;
+ if (returnOrderId!.isNotEmpty) {
+ data['return_order_id'] = returnOrderId;
+ }
+ if (returnOrderDetails!.isNotEmpty) {
+ data['order_status'] = 'return';
+ data['return_order_details'] = returnOrderDetails;
+ }
+
+ return data;
+ }
+
+ factory CashierOrder.fromJson(Map json) {
+ return CashierOrder(
+ id: json['_id'] ?? "",
+ totalAmount: Utils.checkDouble(json['total_amount'])!,
+ totalDiscount: Utils.checkDouble(json['total_discount'])!,
+ cardNumber: json['card_number'] ?? 0,
+ cart: json['cart_id'] != null
+ ? CashierCart.fromJson(json['cart_id'])
+ : CashierCart(orderDetails: []),
+ timer: json['timer'] ?? 0,
+ deliveryNotes: json['delivery_notes'] ?? "",
+ referenceNo: json['reference'] ?? 0,
+ transactionId: json['transaction_id'] ?? "",
+ storeId: WosulStore.fromJson(json['store_id']),
+ orderType: json['order_type'] ?? "",
+ status: json['status'] ?? "",
+ paymentStatus: json['payment_status'] ?? false,
+ paymentMode: json['payment_mode'] ?? "",
+ amount: Utils.checkDouble(json['amount'])!,
+ changeBalanceAmount: Utils.checkDouble(json['change_balance_amount'])!,
+ table: json['table'] ?? "",
+ uniqueId: json['order_number'] ?? 0,
+ createdAt: json['createdAt'] ?? "",
+ returnOrderId: json['return_order_id'] ?? '',
+ updatedAt: json['updatedAt'] ?? "",
+ );
+ }
+}
diff --git a/lib/application/model/reports/CashierOrderHistory.dart b/lib/application/model/reports/CashierOrderHistory.dart
index ead2895..ade7ad0 100644
--- a/lib/application/model/reports/CashierOrderHistory.dart
+++ b/lib/application/model/reports/CashierOrderHistory.dart
@@ -1,134 +1,18 @@
-import 'package:wosull/application/localdb/SharedPrefs.dart';
-import 'package:wosull/helpers/Utils.dart';
-
-import '../createOrder/CashierCart.dart';
-import '../store/WosulStore.dart';
+import 'package:wosull/application/model/reports/CashierOrder.dart';
class CashierOrderHistory {
- bool? success;
- List