diff --git a/docs/integration-weight-based-products.md b/docs/integration-weight-based-products.md
new file mode 100644
index 0000000..1d9d658
--- /dev/null
+++ b/docs/integration-weight-based-products.md
@@ -0,0 +1,279 @@
+# Integrasi Produk Timbangan — POS Mobile & Backoffice
+
+**Migrasi:** `000089` · **Base URL:** `/api/v1` · **Kompatibilitas:** mundur penuh
+
+Panduan untuk menjual produk per timbangan (ikan, daging, buah) dari sisi klien.
+Alasan di balik setiap keputusan desain ada di [`rfc-weight-based-products.md`](./rfc-weight-based-products.md).
+
+---
+
+## 1. Konsep inti
+
+**Satu penimbangan = satu baris order.**
+
+Pelanggan memesan Ikan Tude 4,2 ons, lalu memesan Ikan Tude lagi 5,6 ons. Itu **dua
+baris terpisah**, karena keduanya dua ikan berbeda yang ditimbang sendiri-sendiri.
+
+| Bukan begini | Melainkan begini |
+|---|---|
+| `quantity: 9.8` | `quantity: 1, weight: 4.2`
`quantity: 1, weight: 5.6` |
+| Dua ikan hilang jejaknya, dan `quantity` bertipe integer sehingga pecahan ditolak | Tiap penimbangan berdiri sendiri, bisa di-void atau dibayar terpisah |
+
+Empat aturan yang berlaku di seluruh dokumen ini:
+
+1. `quantity` untuk produk timbangan **selalu 1**. Backend memaksanya, dan database
+ menolak nilai lain lewat constraint `chk_order_items_weight_single_line`.
+2. `weight` menyimpan angka timbangan, dalam satuan produk itu sendiri (ons, kg, gram —
+ apa pun yang dipilih saat setup).
+3. Harga baris dihitung `weight × unit_price`, bukan `quantity × unit_price`.
+ `unit_price` tetap berarti harga per satu satuan (per ons).
+4. **Jangan pernah menggabungkan dua baris** produk timbangan menjadi satu, meski
+ produknya sama.
+
+Untuk produk biasa tidak ada yang berubah: `weight` tidak dikirim, `quantity` tetap
+cacah seperti sekarang.
+
+---
+
+## 2. Backoffice — setup produk
+
+### 2.1 Pastikan satuannya ada
+
+Satuan disimpan per organisasi. Buat sekali, pakai ulang untuk semua produk timbangan.
+
+`POST /api/v1/units`
+
+```json
+{
+ "name": "Ons",
+ "abbreviation": "ons",
+ "is_active": true
+}
+```
+
+`abbreviation` yang dipakai POS untuk mencetak `4,2 ons` di struk — isi dengan bentuk
+pendek yang benar-benar ingin ditampilkan. Daftar satuan dibaca lewat `GET /api/v1/units`.
+
+### 2.2 Buat produk sebagai produk timbangan
+
+`POST /api/v1/products`
+
+```json
+{
+ "category_id": "…",
+ "name": "Ikan Tude",
+ "price": 4500,
+ "cost": 3000,
+ "sell_by": "weight",
+ "unit_id": ""
+}
+```
+
+| Field | Tipe | Keterangan |
+|---|---|---|
+| `sell_by` | `"unit"` \| `"weight"` | Opsional, default `"unit"`. Nilai lain **ditolak** dengan pesan jelas. |
+| `unit_id` | UUID | **Wajib** saat `sell_by: "weight"`, ditolak backend bila kosong. Opsional untuk produk satuan. |
+| `price` | number | Harga per satu satuan. Rp 4.500 per ons, bukan harga per ikan. |
+
+Pada `PUT /api/v1/products/:id`, `unit_id` **tidak perlu dikirim ulang** bila produknya
+sudah punya satuan — mengubah `sell_by` menjadi `"weight"` saja sudah cukup. Yang ditolak
+adalah kondisi akhirnya: produk yang dijual per timbangan tanpa satuan.
+
+Keduanya juga bisa diubah lewat `PUT /api/v1/products/:id` dengan bentuk yang sama, dan
+ikut terbaca di setiap response produk (`GET /api/v1/products`, `/products/all`,
+`/products/:id`).
+
+### 2.3 Catatan UI
+
+- Kunci `sell_by` **setelah produk punya transaksi**. Mengubah produk lama dari `unit`
+ ke `weight` tidak mengubah baris order yang sudah ada — baris lama tetap dihitung per
+ cacah — tapi akan membingungkan pengguna yang melihat riwayatnya.
+- Saat `weight` dipilih, jadikan pemilih satuan sebagai field **wajib** di form. Backend
+ juga menolaknya, tapi ditangkap di form lebih baik daripada baru gagal saat simpan.
+- Ubah label harga mengikuti satuan yang dipilih: *"Harga per ons"*.
+- Untuk produk satuan, pemilih satuan boleh disembunyikan — `unit_id` opsional dan belum
+ dikonsumsi apa pun di POS.
+
+---
+
+## 3. POS Mobile — transaksi
+
+### 3.1 Bentuk input mengikuti `sell_by`
+
+| `sell_by` | Input di POS | Yang dikirim |
+|---|---|---|
+| `"unit"` | Stepper − / + seperti sekarang | `quantity: n`, tanpa `weight` |
+| `"weight"` | Papan angka desimal, satuan dari `unit` produk | `quantity: 1` + `weight: 4.2` |
+
+### 3.2 Mengirim order
+
+`POST /api/v1/orders`
+
+```json
+{
+ "outlet_id": "…",
+ "user_id": "…",
+ "order_type": "dine_in",
+ "order_items": [
+ { "product_id": "", "quantity": 1, "weight": 4.2 },
+ { "product_id": "", "quantity": 1, "weight": 5.6 },
+ { "product_id": "", "quantity": 2 }
+ ]
+}
+```
+
+Bentuk yang sama berlaku untuk `POST /api/v1/orders/:id/add-items` dan untuk pemesanan
+mandiri `POST /api/v1/self-order/orders`.
+
+**Presisi.** Berat dibulatkan backend ke 3 desimal. Kirim `4.2` atau `4.237`; angka di
+bawah `0.001` membulat ke nol dan ditolak.
+
+**Harga.** Field `unit_price` pada request **diabaikan** — harga selalu diambil backend
+dari master produk. Jangan mengirim harga hasil hitungan sendiri.
+
+---
+
+## 4. Menampilkan baris
+
+Setiap `order_items[]` di response membawa empat field tambahan:
+
+```json
+{
+ "product_name": "Ikan Tude",
+ "quantity": 1,
+ "weight": 4.2,
+ "unit_id": "…",
+ "unit_name": "Ons",
+ "unit_abbreviation": "ons",
+ "unit_price": 4500,
+ "total_price": 18900
+}
+```
+
+Semuanya `null` atau absen untuk produk biasa, jadi cabangkan tampilan pada `weight`:
+
+| Kondisi | Tampilkan |
+|---|---|
+| `weight == null` | `2 × Rp 25.000` |
+| `weight != null` | `4,2 ons × Rp 4.500` |
+
+**Jangan menampilkan `quantity` untuk baris berbobot** — nilainya selalu 1 dan akan
+terbaca seperti "satu ons". Gunakan `weight` dengan `unit_abbreviation`, dan pakai koma
+desimal sesuai format Indonesia.
+
+---
+
+## 5. Void, refund, split bill
+
+Baris berbobot bersifat **utuh**: dibatalkan seluruhnya atau tidak sama sekali. Karena
+`quantity`-nya 1, semua endpoint cukup dikirimi `1`, dan backend menghitung nilai
+rupiahnya dari `weight`.
+
+| Aksi | Endpoint | Field untuk baris berbobot |
+|---|---|---|
+| Void per item | `POST /orders/void` | `items[].quantity: 1` |
+| Refund per item | `POST /orders/:id/refund` | `order_items[].refund_quantity: 1` (atau kosongkan) |
+| Split bill per item | `POST /orders/split-bill` | `items[].quantity: 1` = bayar baris itu penuh |
+
+```json
+{
+ "order_id": "…",
+ "reason": "Salah timbang",
+ "type": "ITEM",
+ "items": [
+ { "order_item_id": "", "quantity": 1 }
+ ]
+}
+```
+
+Untuk split bill, baris berbobot hanya bisa berstatus belum dibayar atau lunas — tidak
+ada nilai di antaranya. Sembunyikan stepper jumlah pada baris berbobot, ganti dengan
+tombol pilih baris.
+
+**Batasan yang disengaja.** Mengembalikan *sebagian berat* — 1 ons dari baris 4,2 ons —
+tidak didukung. Koreksi salah timbang ditangani dengan void baris itu lalu input ulang,
+sehingga jejak auditnya tetap jujur.
+
+---
+
+## 6. Referensi error
+
+Semua error mengikuti amplop standar. Pesan validasi baru muncul dengan kode `900`:
+
+```json
+{
+ "success": false,
+ "data": null,
+ "errors": [
+ { "code": "900", "entity": "ORDER",
+ "cause": "product Ikan Tude is sold by weight and requires a weight" }
+ ]
+}
+```
+
+| Pesan (`cause`) | Penyebab | Perbaikan di klien |
+|---|---|---|
+| `… is sold by weight and requires a weight` | Produk `sell_by: "weight"` dikirim tanpa `weight` | Wajibkan input timbangan sebelum item masuk keranjang |
+| `… is not sold by weight and must not carry a weight` | `weight` dikirim untuk produk satuan | Kirim `weight` hanya bila `sell_by == "weight"` |
+| `weight for … must be greater than 0` | Berat nol, negatif, atau membulat ke nol | Validasi minimal `0.001` di keypad |
+| `quantity for … must be at least 1` | Produk satuan dengan `quantity` ≤ 0 | Perilaku lama, tidak berubah |
+
+Pesan menyebut **nama produk**, sehingga bisa ditampilkan apa adanya ke kasir.
+
+### Setup produk (Backoffice)
+
+| Pesan (`cause`) | Penyebab | Perbaikan di klien |
+|---|---|---|
+| `unit_id is required when sell_by is 'weight'` | Produk timbangan dibuat tanpa satuan | Wajibkan pemilih satuan saat Timbangan dipilih |
+| `sell_by must be either 'unit' or 'weight'` | Nilai `sell_by` di luar dua itu | Kirim persis `"unit"` atau `"weight"` |
+| `product '…' is sold by weight and requires a unit_id` | Update membuat produk jadi timbangan tanpa satuan | Kirim `unit_id` bersama perubahan `sell_by` |
+
+---
+
+## 7. Kompatibilitas mundur
+
+- Semua produk lama otomatis `sell_by: "unit"`. Perilakunya identik dengan sebelumnya.
+- `weight` opsional di request. Klien yang tidak mengenalnya tetap berfungsi penuh untuk
+ produk satuan.
+- Field baru di response semuanya `omitempty` — tidak muncul untuk baris biasa, jadi
+ parser lama tidak terganggu.
+- `quantity` tetap **integer** di seluruh API. Tidak ada field yang berubah tipe.
+
+Yang tidak berfungsi di klien lama hanyalah menjual produk timbangan itu sendiri —
+permintaannya ditolak dengan pesan jelas, bukan gagal diam-diam.
+
+---
+
+## 8. Batasan yang diketahui
+
+- **Pembulatan uang ke 2 desimal.** `4,237 ons × Rp 4.500` tersimpan `Rp 19.066,50`,
+ bukan dibulatkan ke rupiah utuh. Bila kasir harus menerima rupiah penuh, ini perlu
+ diputuskan dan diubah di backend lebih dulu (`RoundMoney`, satu tempat).
+- **Stok belum otomatis berkurang** saat penjualan — untuk produk timbangan maupun
+ produk biasa. Pengurangan stok belum tersambung di backend, jadi jangan menampilkan
+ sisa stok yang mengandaikan itu berjalan.
+
+---
+
+## 9. Checklist per tim
+
+**Backoffice Website**
+
+- [ ] CRUD satuan tersedia di menu master data
+- [ ] Form produk punya pilihan cara jual: Satuan / Timbangan
+- [ ] Pemilih satuan menjadi wajib saat Timbangan dipilih
+- [ ] Label harga ikut satuan — "Harga per ons"
+- [ ] `sell_by` dikunci untuk produk yang sudah bertransaksi
+- [ ] Daftar produk menandai mana yang dijual per timbangan
+- [ ] Laporan harian menampilkan kolom Berat
+
+**POS Mobile**
+
+- [ ] Menu membaca `sell_by` tiap produk
+- [ ] Papan angka desimal untuk produk timbangan
+- [ ] Kirim `quantity: 1` + `weight`
+- [ ] Dua penimbangan menjadi dua baris, tidak digabung
+- [ ] Keranjang & struk menampilkan `4,2 ons × Rp 4.500`
+- [ ] Void & refund baris berbobot bersifat utuh
+- [ ] Split bill: pilih baris, bukan stepper jumlah
+- [ ] Pesan error validasi ditampilkan ke kasir
diff --git a/lib/application/auth/login_form/login_form_bloc.dart b/lib/application/auth/login_form/login_form_bloc.dart
index 98f19f4..7d480b9 100644
--- a/lib/application/auth/login_form/login_form_bloc.dart
+++ b/lib/application/auth/login_form/login_form_bloc.dart
@@ -6,6 +6,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import '../../../common/service/device_info_service.dart';
+import '../../../common/service/unit_registry.dart';
import '../../../common/service/fcm_service.dart';
import '../../../domain/auth/auth.dart';
@@ -18,11 +19,13 @@ class LoginFormBloc extends Bloc {
final IAuthRepository _authRepository;
final FcmService _fcmService;
final DeviceInfoService _deviceInfoService;
+ final UnitRegistry _unitRegistry;
LoginFormBloc(
this._authRepository,
this._fcmService,
this._deviceInfoService,
+ this._unitRegistry,
) : super(LoginFormState.initial()) {
on(_onLoginFormEvent);
}
@@ -62,6 +65,12 @@ class LoginFormBloc extends Bloc {
devicePayload: devicePayload,
);
+ // Master satuan diambil sekali per sesi supaya keranjang bisa
+ // menulis "4,2 ons" tanpa menunggu request saat kasir menimbang.
+ if (failureOrLogin.isRight()) {
+ await _unitRegistry.load(forceRefresh: true);
+ }
+
emit(
state.copyWith(
isSubmitting: false,
diff --git a/lib/application/checkout/checkout_form/checkout_form_bloc.dart b/lib/application/checkout/checkout_form/checkout_form_bloc.dart
index 533352b..20e5db5 100644
--- a/lib/application/checkout/checkout_form/checkout_form_bloc.dart
+++ b/lib/application/checkout/checkout_form/checkout_form_bloc.dart
@@ -3,6 +3,7 @@ import 'dart:developer';
import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart' hide Order;
+import 'package:uuid/uuid.dart';
import '../../../common/types/order_type.dart';
import '../../../domain/delivery/delivery.dart';
@@ -19,6 +20,33 @@ class CheckoutFormBloc extends Bloc {
CheckoutFormBloc() : super(CheckoutFormState.initial()) {
on(_onCheckoutFormEvent);
}
+
+ /// Baris berbobot dihitung `weight × harga`, baris cacah `quantity × harga`.
+ /// Satu tempat saja supaya total keranjang, subtotal, dan ringkasan tidak
+ /// pernah berbeda hitungan.
+ CheckoutFormState _recalculate(
+ CheckoutFormState state,
+ List items,
+ ) {
+ final totalQuantity = items.fold(
+ 0,
+ // Baris berbobot selalu satu penimbangan, jadi dihitung satu.
+ (sum, item) => sum + (item.isWeighted ? 1 : item.quantity),
+ );
+
+ final totalPrice = items.fold(
+ 0,
+ (sum, item) => sum + item.lineTotal,
+ );
+
+ return state.copyWith(
+ items: items,
+ totalQuantity: totalQuantity,
+ totalPrice: totalPrice.toInt(),
+ isLoading: false,
+ );
+ }
+
Future _onCheckoutFormEvent(
CheckoutFormEvent event,
Emitter emit,
@@ -26,12 +54,21 @@ class CheckoutFormBloc extends Bloc {
return event.map(
addItem: (e) async {
final currentState = state;
+
+ // Produk timbangan tidak punya stepper — masuk lewat addWeightedItem
+ // setelah kasir memasukkan angka timbangan.
+ if (e.product.isSoldByWeight) {
+ log('⚖️ ${e.product.name} dijual per timbangan, butuh berat');
+ return;
+ }
+
emit(currentState.copyWith(isLoading: true));
List items = [...currentState.items];
final index = items.indexWhere(
(element) =>
+ !element.isWeighted &&
element.product.id == e.product.id &&
element.variant?.id == e.variant?.id,
);
@@ -49,35 +86,47 @@ class CheckoutFormBloc extends Bloc {
quantity: 1,
variant: e.variant,
notes: '',
+ lineId: const Uuid().v4(),
),
);
}
log('🛒 Items updated: ${items.length} items total ${items.toList()}');
- final totalQuantity = items.fold(
- 0,
- (sum, item) => sum + item.quantity,
- );
+ emit(_recalculate(currentState, items));
+ },
+ addWeightedItem: (e) async {
+ final currentState = state;
+ emit(currentState.copyWith(isLoading: true));
- final totalPrice = state.items.isEmpty
- ? 0.0
- : state.items
- .map(
- (e) =>
- (e.product.price * e.quantity) +
- (e.variant?.priceModifier ?? 0),
- )
- .reduce((value, element) => value + element);
-
- emit(
- currentState.copyWith(
- items: items,
- totalQuantity: totalQuantity,
- totalPrice: totalPrice.toInt(),
- isLoading: false,
+ // Sengaja tidak digabung dengan baris lain: dua penimbangan adalah dua
+ // ikan berbeda, masing-masing bisa di-void atau dibayar terpisah.
+ final items = [
+ ...currentState.items,
+ ProductQuantity(
+ product: e.product,
+ variant: e.variant,
+ quantity: 1,
+ notes: '',
+ lineId: const Uuid().v4(),
+ weight: e.weight,
),
- );
+ ];
+
+ log('⚖️ Penimbangan baru: ${e.product.name} ${e.weight}');
+
+ emit(_recalculate(currentState, items));
+ },
+ updateItemWeight: (e) async {
+ final currentState = state;
+ final items = [...currentState.items];
+
+ final index = items.indexWhere((item) => item.lineId == e.lineId);
+ if (index == -1) return;
+
+ items[index] = items[index].copyWith(weight: e.weight);
+
+ emit(_recalculate(currentState, items));
},
removeItem: (e) async {
final currentState = state;
@@ -86,6 +135,7 @@ class CheckoutFormBloc extends Bloc {
final index = items.indexWhere(
(element) =>
+ !element.isWeighted &&
element.product.id == e.product.id &&
element.variant?.id == e.variant?.id,
);
@@ -103,32 +153,18 @@ class CheckoutFormBloc extends Bloc {
}
}
- final totalQuantity = items.fold(
- 0,
- (sum, item) => sum + item.quantity,
- );
- final totalPrice = items.fold(
- 0,
- (sum, item) =>
- sum +
- (item.quantity *
- (item.variant?.priceModifier.toInt() ??
- item.product.price.toInt())),
- );
+ log('🗑️ Item removed. Total items: ${items.length}');
- log(
- '🗑️ Item removed. Total items: ${items.length}, totalQuantity: $totalQuantity, totalPrice: $totalPrice',
- );
+ emit(_recalculate(currentState, items));
+ },
+ removeLine: (e) async {
+ final currentState = state;
+ final items = [...currentState.items]
+ ..removeWhere((item) => item.lineId == e.lineId);
- // Emit state baru
- emit(
- currentState.copyWith(
- items: items,
- totalQuantity: totalQuantity,
- totalPrice: totalPrice,
- isLoading: false,
- ),
- );
+ log('🗑️ Baris dihapus. Sisa ${items.length} baris');
+
+ emit(_recalculate(currentState, items));
},
started: (e) async {
emit(CheckoutFormState.initial().copyWith(isLoading: true));
@@ -153,14 +189,13 @@ class CheckoutFormBloc extends Bloc {
);
}
},
- updateItemNotes: (e) async {
+ updateLineNotes: (e) async {
final currentState = state;
- // Clone list items agar tidak mutasi langsung
+ // Catatan diikat ke baris, bukan ke produk: dua penimbangan produk yang
+ // sama bisa punya catatan berbeda.
final items = [...currentState.items];
- final index = items.indexWhere(
- (element) => element.product.id == e.product.id,
- );
+ final index = items.indexWhere((item) => item.lineId == e.lineId);
if (index != -1) {
items[index] = items[index].copyWith(notes: e.notes);
@@ -181,8 +216,8 @@ class CheckoutFormBloc extends Bloc {
emit(state.copyWith(orderAdded: e.order));
},
customerNameChanged: (e) async {
- emit(state.copyWith(customerName: e.name,));
- }
+ emit(state.copyWith(customerName: e.name));
+ },
);
}
}
diff --git a/lib/application/checkout/checkout_form/checkout_form_bloc.freezed.dart b/lib/application/checkout/checkout_form/checkout_form_bloc.freezed.dart
index 6087f76..c5b39f8 100644
--- a/lib/application/checkout/checkout_form/checkout_form_bloc.freezed.dart
+++ b/lib/application/checkout/checkout_form/checkout_form_bloc.freezed.dart
@@ -21,9 +21,17 @@ mixin _$CheckoutFormEvent {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -34,8 +42,12 @@ mixin _$CheckoutFormEvent {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -46,8 +58,12 @@ mixin _$CheckoutFormEvent {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -59,8 +75,11 @@ mixin _$CheckoutFormEvent {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -71,8 +90,11 @@ mixin _$CheckoutFormEvent {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -83,8 +105,11 @@ mixin _$CheckoutFormEvent {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -194,9 +219,17 @@ class _$StartedImpl implements _Started {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -211,8 +244,12 @@ class _$StartedImpl implements _Started {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -227,8 +264,12 @@ class _$StartedImpl implements _Started {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -247,8 +288,11 @@ class _$StartedImpl implements _Started {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -263,8 +307,11 @@ class _$StartedImpl implements _Started {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -279,8 +326,11 @@ class _$StartedImpl implements _Started {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -413,9 +463,17 @@ class _$AddItemImpl implements _AddItem {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -430,8 +488,12 @@ class _$AddItemImpl implements _AddItem {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -446,8 +508,12 @@ class _$AddItemImpl implements _AddItem {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -466,8 +532,11 @@ class _$AddItemImpl implements _AddItem {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -482,8 +551,11 @@ class _$AddItemImpl implements _AddItem {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -498,8 +570,11 @@ class _$AddItemImpl implements _AddItem {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -528,6 +603,492 @@ abstract class _AddItem implements CheckoutFormEvent {
throw _privateConstructorUsedError;
}
+/// @nodoc
+abstract class _$$AddWeightedItemImplCopyWith<$Res> {
+ factory _$$AddWeightedItemImplCopyWith(
+ _$AddWeightedItemImpl value,
+ $Res Function(_$AddWeightedItemImpl) then,
+ ) = __$$AddWeightedItemImplCopyWithImpl<$Res>;
+ @useResult
+ $Res call({Product product, ProductVariant? variant, double weight});
+
+ $ProductCopyWith<$Res> get product;
+ $ProductVariantCopyWith<$Res>? get variant;
+}
+
+/// @nodoc
+class __$$AddWeightedItemImplCopyWithImpl<$Res>
+ extends _$CheckoutFormEventCopyWithImpl<$Res, _$AddWeightedItemImpl>
+ implements _$$AddWeightedItemImplCopyWith<$Res> {
+ __$$AddWeightedItemImplCopyWithImpl(
+ _$AddWeightedItemImpl _value,
+ $Res Function(_$AddWeightedItemImpl) _then,
+ ) : super(_value, _then);
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @pragma('vm:prefer-inline')
+ @override
+ $Res call({
+ Object? product = null,
+ Object? variant = freezed,
+ Object? weight = null,
+ }) {
+ return _then(
+ _$AddWeightedItemImpl(
+ null == product
+ ? _value.product
+ : product // ignore: cast_nullable_to_non_nullable
+ as Product,
+ freezed == variant
+ ? _value.variant
+ : variant // ignore: cast_nullable_to_non_nullable
+ as ProductVariant?,
+ null == weight
+ ? _value.weight
+ : weight // ignore: cast_nullable_to_non_nullable
+ as double,
+ ),
+ );
+ }
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @override
+ @pragma('vm:prefer-inline')
+ $ProductCopyWith<$Res> get product {
+ return $ProductCopyWith<$Res>(_value.product, (value) {
+ return _then(_value.copyWith(product: value));
+ });
+ }
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @override
+ @pragma('vm:prefer-inline')
+ $ProductVariantCopyWith<$Res>? get variant {
+ if (_value.variant == null) {
+ return null;
+ }
+
+ return $ProductVariantCopyWith<$Res>(_value.variant!, (value) {
+ return _then(_value.copyWith(variant: value));
+ });
+ }
+}
+
+/// @nodoc
+
+class _$AddWeightedItemImpl implements _AddWeightedItem {
+ const _$AddWeightedItemImpl(this.product, this.variant, this.weight);
+
+ @override
+ final Product product;
+ @override
+ final ProductVariant? variant;
+ @override
+ final double weight;
+
+ @override
+ String toString() {
+ return 'CheckoutFormEvent.addWeightedItem(product: $product, variant: $variant, weight: $weight)';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ return identical(this, other) ||
+ (other.runtimeType == runtimeType &&
+ other is _$AddWeightedItemImpl &&
+ (identical(other.product, product) || other.product == product) &&
+ (identical(other.variant, variant) || other.variant == variant) &&
+ (identical(other.weight, weight) || other.weight == weight));
+ }
+
+ @override
+ int get hashCode => Object.hash(runtimeType, product, variant, weight);
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @JsonKey(includeFromJson: false, includeToJson: false)
+ @override
+ @pragma('vm:prefer-inline')
+ _$$AddWeightedItemImplCopyWith<_$AddWeightedItemImpl> get copyWith =>
+ __$$AddWeightedItemImplCopyWithImpl<_$AddWeightedItemImpl>(
+ this,
+ _$identity,
+ );
+
+ @override
+ @optionalTypeArgs
+ TResult when({
+ required TResult Function(List items) started,
+ required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
+ required TResult Function(Product product, ProductVariant? variant)
+ removeItem,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
+ required TResult Function(OrderType orderType) updateOrderType,
+ required TResult Function(Delivery delivery) updateDelivery,
+ required TResult Function(Table? table) updateTable,
+ required TResult Function(Order? order) orderAddedItems,
+ required TResult Function(String name) customerNameChanged,
+ }) {
+ return addWeightedItem(product, variant, weight);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult? whenOrNull({
+ TResult? Function(List items)? started,
+ TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
+ TResult? Function(Product product, ProductVariant? variant)? removeItem,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
+ TResult? Function(OrderType orderType)? updateOrderType,
+ TResult? Function(Delivery delivery)? updateDelivery,
+ TResult? Function(Table? table)? updateTable,
+ TResult? Function(Order? order)? orderAddedItems,
+ TResult? Function(String name)? customerNameChanged,
+ }) {
+ return addWeightedItem?.call(product, variant, weight);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult maybeWhen({
+ TResult Function(List items)? started,
+ TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
+ TResult Function(Product product, ProductVariant? variant)? removeItem,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
+ TResult Function(OrderType orderType)? updateOrderType,
+ TResult Function(Delivery delivery)? updateDelivery,
+ TResult Function(Table? table)? updateTable,
+ TResult Function(Order? order)? orderAddedItems,
+ TResult Function(String name)? customerNameChanged,
+ required TResult orElse(),
+ }) {
+ if (addWeightedItem != null) {
+ return addWeightedItem(product, variant, weight);
+ }
+ return orElse();
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult map({
+ required TResult Function(_Started value) started,
+ required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
+ required TResult Function(_RemoveItem value) removeItem,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
+ required TResult Function(_UpdateOrderType value) updateOrderType,
+ required TResult Function(_UpdateDelivery value) updateDelivery,
+ required TResult Function(_UpdateTable value) updateTable,
+ required TResult Function(_OrderAddedItems value) orderAddedItems,
+ required TResult Function(_CustomerNameChanged value) customerNameChanged,
+ }) {
+ return addWeightedItem(this);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult? mapOrNull({
+ TResult? Function(_Started value)? started,
+ TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
+ TResult? Function(_RemoveItem value)? removeItem,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
+ TResult? Function(_UpdateOrderType value)? updateOrderType,
+ TResult? Function(_UpdateDelivery value)? updateDelivery,
+ TResult? Function(_UpdateTable value)? updateTable,
+ TResult? Function(_OrderAddedItems value)? orderAddedItems,
+ TResult? Function(_CustomerNameChanged value)? customerNameChanged,
+ }) {
+ return addWeightedItem?.call(this);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult maybeMap({
+ TResult Function(_Started value)? started,
+ TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
+ TResult Function(_RemoveItem value)? removeItem,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
+ TResult Function(_UpdateOrderType value)? updateOrderType,
+ TResult Function(_UpdateDelivery value)? updateDelivery,
+ TResult Function(_UpdateTable value)? updateTable,
+ TResult Function(_OrderAddedItems value)? orderAddedItems,
+ TResult Function(_CustomerNameChanged value)? customerNameChanged,
+ required TResult orElse(),
+ }) {
+ if (addWeightedItem != null) {
+ return addWeightedItem(this);
+ }
+ return orElse();
+ }
+}
+
+abstract class _AddWeightedItem implements CheckoutFormEvent {
+ const factory _AddWeightedItem(
+ final Product product,
+ final ProductVariant? variant,
+ final double weight,
+ ) = _$AddWeightedItemImpl;
+
+ Product get product;
+ ProductVariant? get variant;
+ double get weight;
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @JsonKey(includeFromJson: false, includeToJson: false)
+ _$$AddWeightedItemImplCopyWith<_$AddWeightedItemImpl> get copyWith =>
+ throw _privateConstructorUsedError;
+}
+
+/// @nodoc
+abstract class _$$UpdateItemWeightImplCopyWith<$Res> {
+ factory _$$UpdateItemWeightImplCopyWith(
+ _$UpdateItemWeightImpl value,
+ $Res Function(_$UpdateItemWeightImpl) then,
+ ) = __$$UpdateItemWeightImplCopyWithImpl<$Res>;
+ @useResult
+ $Res call({String lineId, double weight});
+}
+
+/// @nodoc
+class __$$UpdateItemWeightImplCopyWithImpl<$Res>
+ extends _$CheckoutFormEventCopyWithImpl<$Res, _$UpdateItemWeightImpl>
+ implements _$$UpdateItemWeightImplCopyWith<$Res> {
+ __$$UpdateItemWeightImplCopyWithImpl(
+ _$UpdateItemWeightImpl _value,
+ $Res Function(_$UpdateItemWeightImpl) _then,
+ ) : super(_value, _then);
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @pragma('vm:prefer-inline')
+ @override
+ $Res call({Object? lineId = null, Object? weight = null}) {
+ return _then(
+ _$UpdateItemWeightImpl(
+ null == lineId
+ ? _value.lineId
+ : lineId // ignore: cast_nullable_to_non_nullable
+ as String,
+ null == weight
+ ? _value.weight
+ : weight // ignore: cast_nullable_to_non_nullable
+ as double,
+ ),
+ );
+ }
+}
+
+/// @nodoc
+
+class _$UpdateItemWeightImpl implements _UpdateItemWeight {
+ const _$UpdateItemWeightImpl(this.lineId, this.weight);
+
+ @override
+ final String lineId;
+ @override
+ final double weight;
+
+ @override
+ String toString() {
+ return 'CheckoutFormEvent.updateItemWeight(lineId: $lineId, weight: $weight)';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ return identical(this, other) ||
+ (other.runtimeType == runtimeType &&
+ other is _$UpdateItemWeightImpl &&
+ (identical(other.lineId, lineId) || other.lineId == lineId) &&
+ (identical(other.weight, weight) || other.weight == weight));
+ }
+
+ @override
+ int get hashCode => Object.hash(runtimeType, lineId, weight);
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @JsonKey(includeFromJson: false, includeToJson: false)
+ @override
+ @pragma('vm:prefer-inline')
+ _$$UpdateItemWeightImplCopyWith<_$UpdateItemWeightImpl> get copyWith =>
+ __$$UpdateItemWeightImplCopyWithImpl<_$UpdateItemWeightImpl>(
+ this,
+ _$identity,
+ );
+
+ @override
+ @optionalTypeArgs
+ TResult when({
+ required TResult Function(List items) started,
+ required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
+ required TResult Function(Product product, ProductVariant? variant)
+ removeItem,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
+ required TResult Function(OrderType orderType) updateOrderType,
+ required TResult Function(Delivery delivery) updateDelivery,
+ required TResult Function(Table? table) updateTable,
+ required TResult Function(Order? order) orderAddedItems,
+ required TResult Function(String name) customerNameChanged,
+ }) {
+ return updateItemWeight(lineId, weight);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult? whenOrNull({
+ TResult? Function(List items)? started,
+ TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
+ TResult? Function(Product product, ProductVariant? variant)? removeItem,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
+ TResult? Function(OrderType orderType)? updateOrderType,
+ TResult? Function(Delivery delivery)? updateDelivery,
+ TResult? Function(Table? table)? updateTable,
+ TResult? Function(Order? order)? orderAddedItems,
+ TResult? Function(String name)? customerNameChanged,
+ }) {
+ return updateItemWeight?.call(lineId, weight);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult maybeWhen({
+ TResult Function(List items)? started,
+ TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
+ TResult Function(Product product, ProductVariant? variant)? removeItem,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
+ TResult Function(OrderType orderType)? updateOrderType,
+ TResult Function(Delivery delivery)? updateDelivery,
+ TResult Function(Table? table)? updateTable,
+ TResult Function(Order? order)? orderAddedItems,
+ TResult Function(String name)? customerNameChanged,
+ required TResult orElse(),
+ }) {
+ if (updateItemWeight != null) {
+ return updateItemWeight(lineId, weight);
+ }
+ return orElse();
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult map({
+ required TResult Function(_Started value) started,
+ required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
+ required TResult Function(_RemoveItem value) removeItem,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
+ required TResult Function(_UpdateOrderType value) updateOrderType,
+ required TResult Function(_UpdateDelivery value) updateDelivery,
+ required TResult Function(_UpdateTable value) updateTable,
+ required TResult Function(_OrderAddedItems value) orderAddedItems,
+ required TResult Function(_CustomerNameChanged value) customerNameChanged,
+ }) {
+ return updateItemWeight(this);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult? mapOrNull({
+ TResult? Function(_Started value)? started,
+ TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
+ TResult? Function(_RemoveItem value)? removeItem,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
+ TResult? Function(_UpdateOrderType value)? updateOrderType,
+ TResult? Function(_UpdateDelivery value)? updateDelivery,
+ TResult? Function(_UpdateTable value)? updateTable,
+ TResult? Function(_OrderAddedItems value)? orderAddedItems,
+ TResult? Function(_CustomerNameChanged value)? customerNameChanged,
+ }) {
+ return updateItemWeight?.call(this);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult maybeMap({
+ TResult Function(_Started value)? started,
+ TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
+ TResult Function(_RemoveItem value)? removeItem,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
+ TResult Function(_UpdateOrderType value)? updateOrderType,
+ TResult Function(_UpdateDelivery value)? updateDelivery,
+ TResult Function(_UpdateTable value)? updateTable,
+ TResult Function(_OrderAddedItems value)? orderAddedItems,
+ TResult Function(_CustomerNameChanged value)? customerNameChanged,
+ required TResult orElse(),
+ }) {
+ if (updateItemWeight != null) {
+ return updateItemWeight(this);
+ }
+ return orElse();
+ }
+}
+
+abstract class _UpdateItemWeight implements CheckoutFormEvent {
+ const factory _UpdateItemWeight(final String lineId, final double weight) =
+ _$UpdateItemWeightImpl;
+
+ String get lineId;
+ double get weight;
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @JsonKey(includeFromJson: false, includeToJson: false)
+ _$$UpdateItemWeightImplCopyWith<_$UpdateItemWeightImpl> get copyWith =>
+ throw _privateConstructorUsedError;
+}
+
/// @nodoc
abstract class _$$RemoveItemImplCopyWith<$Res> {
factory _$$RemoveItemImplCopyWith(
@@ -634,9 +1195,17 @@ class _$RemoveItemImpl implements _RemoveItem {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -651,8 +1220,12 @@ class _$RemoveItemImpl implements _RemoveItem {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -667,8 +1240,12 @@ class _$RemoveItemImpl implements _RemoveItem {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -687,8 +1264,11 @@ class _$RemoveItemImpl implements _RemoveItem {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -703,8 +1283,11 @@ class _$RemoveItemImpl implements _RemoveItem {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -719,8 +1302,11 @@ class _$RemoveItemImpl implements _RemoveItem {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -752,109 +1338,95 @@ abstract class _RemoveItem implements CheckoutFormEvent {
}
/// @nodoc
-abstract class _$$UpdateItemNotesImplCopyWith<$Res> {
- factory _$$UpdateItemNotesImplCopyWith(
- _$UpdateItemNotesImpl value,
- $Res Function(_$UpdateItemNotesImpl) then,
- ) = __$$UpdateItemNotesImplCopyWithImpl<$Res>;
+abstract class _$$RemoveLineImplCopyWith<$Res> {
+ factory _$$RemoveLineImplCopyWith(
+ _$RemoveLineImpl value,
+ $Res Function(_$RemoveLineImpl) then,
+ ) = __$$RemoveLineImplCopyWithImpl<$Res>;
@useResult
- $Res call({Product product, String notes});
-
- $ProductCopyWith<$Res> get product;
+ $Res call({String lineId});
}
/// @nodoc
-class __$$UpdateItemNotesImplCopyWithImpl<$Res>
- extends _$CheckoutFormEventCopyWithImpl<$Res, _$UpdateItemNotesImpl>
- implements _$$UpdateItemNotesImplCopyWith<$Res> {
- __$$UpdateItemNotesImplCopyWithImpl(
- _$UpdateItemNotesImpl _value,
- $Res Function(_$UpdateItemNotesImpl) _then,
+class __$$RemoveLineImplCopyWithImpl<$Res>
+ extends _$CheckoutFormEventCopyWithImpl<$Res, _$RemoveLineImpl>
+ implements _$$RemoveLineImplCopyWith<$Res> {
+ __$$RemoveLineImplCopyWithImpl(
+ _$RemoveLineImpl _value,
+ $Res Function(_$RemoveLineImpl) _then,
) : super(_value, _then);
/// Create a copy of CheckoutFormEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
- $Res call({Object? product = null, Object? notes = null}) {
+ $Res call({Object? lineId = null}) {
return _then(
- _$UpdateItemNotesImpl(
- null == product
- ? _value.product
- : product // ignore: cast_nullable_to_non_nullable
- as Product,
- null == notes
- ? _value.notes
- : notes // ignore: cast_nullable_to_non_nullable
+ _$RemoveLineImpl(
+ null == lineId
+ ? _value.lineId
+ : lineId // ignore: cast_nullable_to_non_nullable
as String,
),
);
}
-
- /// Create a copy of CheckoutFormEvent
- /// with the given fields replaced by the non-null parameter values.
- @override
- @pragma('vm:prefer-inline')
- $ProductCopyWith<$Res> get product {
- return $ProductCopyWith<$Res>(_value.product, (value) {
- return _then(_value.copyWith(product: value));
- });
- }
}
/// @nodoc
-class _$UpdateItemNotesImpl implements _UpdateItemNotes {
- const _$UpdateItemNotesImpl(this.product, this.notes);
+class _$RemoveLineImpl implements _RemoveLine {
+ const _$RemoveLineImpl(this.lineId);
@override
- final Product product;
- @override
- final String notes;
+ final String lineId;
@override
String toString() {
- return 'CheckoutFormEvent.updateItemNotes(product: $product, notes: $notes)';
+ return 'CheckoutFormEvent.removeLine(lineId: $lineId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
- other is _$UpdateItemNotesImpl &&
- (identical(other.product, product) || other.product == product) &&
- (identical(other.notes, notes) || other.notes == notes));
+ other is _$RemoveLineImpl &&
+ (identical(other.lineId, lineId) || other.lineId == lineId));
}
@override
- int get hashCode => Object.hash(runtimeType, product, notes);
+ int get hashCode => Object.hash(runtimeType, lineId);
/// Create a copy of CheckoutFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
- _$$UpdateItemNotesImplCopyWith<_$UpdateItemNotesImpl> get copyWith =>
- __$$UpdateItemNotesImplCopyWithImpl<_$UpdateItemNotesImpl>(
- this,
- _$identity,
- );
+ _$$RemoveLineImplCopyWith<_$RemoveLineImpl> get copyWith =>
+ __$$RemoveLineImplCopyWithImpl<_$RemoveLineImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
required TResult Function(Order? order) orderAddedItems,
required TResult Function(String name) customerNameChanged,
}) {
- return updateItemNotes(product, notes);
+ return removeLine(lineId);
}
@override
@@ -862,15 +1434,19 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
TResult? Function(Order? order)? orderAddedItems,
TResult? Function(String name)? customerNameChanged,
}) {
- return updateItemNotes?.call(product, notes);
+ return removeLine?.call(lineId);
}
@override
@@ -878,8 +1454,12 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -887,8 +1467,8 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
TResult Function(String name)? customerNameChanged,
required TResult orElse(),
}) {
- if (updateItemNotes != null) {
- return updateItemNotes(product, notes);
+ if (removeLine != null) {
+ return removeLine(lineId);
}
return orElse();
}
@@ -898,15 +1478,18 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
required TResult Function(_OrderAddedItems value) orderAddedItems,
required TResult Function(_CustomerNameChanged value) customerNameChanged,
}) {
- return updateItemNotes(this);
+ return removeLine(this);
}
@override
@@ -914,15 +1497,18 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
TResult? Function(_OrderAddedItems value)? orderAddedItems,
TResult? Function(_CustomerNameChanged value)? customerNameChanged,
}) {
- return updateItemNotes?.call(this);
+ return removeLine?.call(this);
}
@override
@@ -930,8 +1516,11 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -939,24 +1528,244 @@ class _$UpdateItemNotesImpl implements _UpdateItemNotes {
TResult Function(_CustomerNameChanged value)? customerNameChanged,
required TResult orElse(),
}) {
- if (updateItemNotes != null) {
- return updateItemNotes(this);
+ if (removeLine != null) {
+ return removeLine(this);
}
return orElse();
}
}
-abstract class _UpdateItemNotes implements CheckoutFormEvent {
- const factory _UpdateItemNotes(final Product product, final String notes) =
- _$UpdateItemNotesImpl;
+abstract class _RemoveLine implements CheckoutFormEvent {
+ const factory _RemoveLine(final String lineId) = _$RemoveLineImpl;
- Product get product;
+ String get lineId;
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @JsonKey(includeFromJson: false, includeToJson: false)
+ _$$RemoveLineImplCopyWith<_$RemoveLineImpl> get copyWith =>
+ throw _privateConstructorUsedError;
+}
+
+/// @nodoc
+abstract class _$$UpdateLineNotesImplCopyWith<$Res> {
+ factory _$$UpdateLineNotesImplCopyWith(
+ _$UpdateLineNotesImpl value,
+ $Res Function(_$UpdateLineNotesImpl) then,
+ ) = __$$UpdateLineNotesImplCopyWithImpl<$Res>;
+ @useResult
+ $Res call({String lineId, String notes});
+}
+
+/// @nodoc
+class __$$UpdateLineNotesImplCopyWithImpl<$Res>
+ extends _$CheckoutFormEventCopyWithImpl<$Res, _$UpdateLineNotesImpl>
+ implements _$$UpdateLineNotesImplCopyWith<$Res> {
+ __$$UpdateLineNotesImplCopyWithImpl(
+ _$UpdateLineNotesImpl _value,
+ $Res Function(_$UpdateLineNotesImpl) _then,
+ ) : super(_value, _then);
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @pragma('vm:prefer-inline')
+ @override
+ $Res call({Object? lineId = null, Object? notes = null}) {
+ return _then(
+ _$UpdateLineNotesImpl(
+ null == lineId
+ ? _value.lineId
+ : lineId // ignore: cast_nullable_to_non_nullable
+ as String,
+ null == notes
+ ? _value.notes
+ : notes // ignore: cast_nullable_to_non_nullable
+ as String,
+ ),
+ );
+ }
+}
+
+/// @nodoc
+
+class _$UpdateLineNotesImpl implements _UpdateLineNotes {
+ const _$UpdateLineNotesImpl(this.lineId, this.notes);
+
+ @override
+ final String lineId;
+ @override
+ final String notes;
+
+ @override
+ String toString() {
+ return 'CheckoutFormEvent.updateLineNotes(lineId: $lineId, notes: $notes)';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ return identical(this, other) ||
+ (other.runtimeType == runtimeType &&
+ other is _$UpdateLineNotesImpl &&
+ (identical(other.lineId, lineId) || other.lineId == lineId) &&
+ (identical(other.notes, notes) || other.notes == notes));
+ }
+
+ @override
+ int get hashCode => Object.hash(runtimeType, lineId, notes);
+
+ /// Create a copy of CheckoutFormEvent
+ /// with the given fields replaced by the non-null parameter values.
+ @JsonKey(includeFromJson: false, includeToJson: false)
+ @override
+ @pragma('vm:prefer-inline')
+ _$$UpdateLineNotesImplCopyWith<_$UpdateLineNotesImpl> get copyWith =>
+ __$$UpdateLineNotesImplCopyWithImpl<_$UpdateLineNotesImpl>(
+ this,
+ _$identity,
+ );
+
+ @override
+ @optionalTypeArgs
+ TResult when({
+ required TResult Function(List items) started,
+ required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
+ required TResult Function(Product product, ProductVariant? variant)
+ removeItem,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
+ required TResult Function(OrderType orderType) updateOrderType,
+ required TResult Function(Delivery delivery) updateDelivery,
+ required TResult Function(Table? table) updateTable,
+ required TResult Function(Order? order) orderAddedItems,
+ required TResult Function(String name) customerNameChanged,
+ }) {
+ return updateLineNotes(lineId, notes);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult? whenOrNull({
+ TResult? Function(List items)? started,
+ TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
+ TResult? Function(Product product, ProductVariant? variant)? removeItem,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
+ TResult? Function(OrderType orderType)? updateOrderType,
+ TResult? Function(Delivery delivery)? updateDelivery,
+ TResult? Function(Table? table)? updateTable,
+ TResult? Function(Order? order)? orderAddedItems,
+ TResult? Function(String name)? customerNameChanged,
+ }) {
+ return updateLineNotes?.call(lineId, notes);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult maybeWhen({
+ TResult Function(List items)? started,
+ TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
+ TResult Function(Product product, ProductVariant? variant)? removeItem,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
+ TResult Function(OrderType orderType)? updateOrderType,
+ TResult Function(Delivery delivery)? updateDelivery,
+ TResult Function(Table? table)? updateTable,
+ TResult Function(Order? order)? orderAddedItems,
+ TResult Function(String name)? customerNameChanged,
+ required TResult orElse(),
+ }) {
+ if (updateLineNotes != null) {
+ return updateLineNotes(lineId, notes);
+ }
+ return orElse();
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult map({
+ required TResult Function(_Started value) started,
+ required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
+ required TResult Function(_RemoveItem value) removeItem,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
+ required TResult Function(_UpdateOrderType value) updateOrderType,
+ required TResult Function(_UpdateDelivery value) updateDelivery,
+ required TResult Function(_UpdateTable value) updateTable,
+ required TResult Function(_OrderAddedItems value) orderAddedItems,
+ required TResult Function(_CustomerNameChanged value) customerNameChanged,
+ }) {
+ return updateLineNotes(this);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult? mapOrNull({
+ TResult? Function(_Started value)? started,
+ TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
+ TResult? Function(_RemoveItem value)? removeItem,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
+ TResult? Function(_UpdateOrderType value)? updateOrderType,
+ TResult? Function(_UpdateDelivery value)? updateDelivery,
+ TResult? Function(_UpdateTable value)? updateTable,
+ TResult? Function(_OrderAddedItems value)? orderAddedItems,
+ TResult? Function(_CustomerNameChanged value)? customerNameChanged,
+ }) {
+ return updateLineNotes?.call(this);
+ }
+
+ @override
+ @optionalTypeArgs
+ TResult maybeMap({
+ TResult Function(_Started value)? started,
+ TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
+ TResult Function(_RemoveItem value)? removeItem,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
+ TResult Function(_UpdateOrderType value)? updateOrderType,
+ TResult Function(_UpdateDelivery value)? updateDelivery,
+ TResult Function(_UpdateTable value)? updateTable,
+ TResult Function(_OrderAddedItems value)? orderAddedItems,
+ TResult Function(_CustomerNameChanged value)? customerNameChanged,
+ required TResult orElse(),
+ }) {
+ if (updateLineNotes != null) {
+ return updateLineNotes(this);
+ }
+ return orElse();
+ }
+}
+
+abstract class _UpdateLineNotes implements CheckoutFormEvent {
+ const factory _UpdateLineNotes(final String lineId, final String notes) =
+ _$UpdateLineNotesImpl;
+
+ String get lineId;
String get notes;
/// Create a copy of CheckoutFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
- _$$UpdateItemNotesImplCopyWith<_$UpdateItemNotesImpl> get copyWith =>
+ _$$UpdateLineNotesImplCopyWith<_$UpdateLineNotesImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1036,9 +1845,17 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -1053,8 +1870,12 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -1069,8 +1890,12 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -1089,8 +1914,11 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -1105,8 +1933,11 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -1121,8 +1952,11 @@ class _$UpdateOrderTypeImpl implements _UpdateOrderType {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -1226,9 +2060,17 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -1243,8 +2085,12 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -1259,8 +2105,12 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -1279,8 +2129,11 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -1295,8 +2148,11 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -1311,8 +2167,11 @@ class _$UpdateDeliveryImpl implements _UpdateDelivery {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -1427,9 +2286,17 @@ class _$UpdateTableImpl implements _UpdateTable {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -1444,8 +2311,12 @@ class _$UpdateTableImpl implements _UpdateTable {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -1460,8 +2331,12 @@ class _$UpdateTableImpl implements _UpdateTable {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -1480,8 +2355,11 @@ class _$UpdateTableImpl implements _UpdateTable {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -1496,8 +2374,11 @@ class _$UpdateTableImpl implements _UpdateTable {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -1512,8 +2393,11 @@ class _$UpdateTableImpl implements _UpdateTable {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -1631,9 +2515,17 @@ class _$OrderAddedItemsImpl implements _OrderAddedItems {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -1648,8 +2540,12 @@ class _$OrderAddedItemsImpl implements _OrderAddedItems {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -1664,8 +2560,12 @@ class _$OrderAddedItemsImpl implements _OrderAddedItems {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -1684,8 +2584,11 @@ class _$OrderAddedItemsImpl implements _OrderAddedItems {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -1700,8 +2603,11 @@ class _$OrderAddedItemsImpl implements _OrderAddedItems {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -1716,8 +2622,11 @@ class _$OrderAddedItemsImpl implements _OrderAddedItems {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
@@ -1819,9 +2728,17 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
TResult when({
required TResult Function(List items) started,
required TResult Function(Product product, ProductVariant? variant) addItem,
+ required TResult Function(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ )
+ addWeightedItem,
+ required TResult Function(String lineId, double weight) updateItemWeight,
required TResult Function(Product product, ProductVariant? variant)
removeItem,
- required TResult Function(Product product, String notes) updateItemNotes,
+ required TResult Function(String lineId) removeLine,
+ required TResult Function(String lineId, String notes) updateLineNotes,
required TResult Function(OrderType orderType) updateOrderType,
required TResult Function(Delivery delivery) updateDelivery,
required TResult Function(Table? table) updateTable,
@@ -1836,8 +2753,12 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
TResult? whenOrNull({
TResult? Function(List items)? started,
TResult? Function(Product product, ProductVariant? variant)? addItem,
+ TResult? Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult? Function(String lineId, double weight)? updateItemWeight,
TResult? Function(Product product, ProductVariant? variant)? removeItem,
- TResult? Function(Product product, String notes)? updateItemNotes,
+ TResult? Function(String lineId)? removeLine,
+ TResult? Function(String lineId, String notes)? updateLineNotes,
TResult? Function(OrderType orderType)? updateOrderType,
TResult? Function(Delivery delivery)? updateDelivery,
TResult? Function(Table? table)? updateTable,
@@ -1852,8 +2773,12 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
TResult maybeWhen({
TResult Function(List items)? started,
TResult Function(Product product, ProductVariant? variant)? addItem,
+ TResult Function(Product product, ProductVariant? variant, double weight)?
+ addWeightedItem,
+ TResult Function(String lineId, double weight)? updateItemWeight,
TResult Function(Product product, ProductVariant? variant)? removeItem,
- TResult Function(Product product, String notes)? updateItemNotes,
+ TResult Function(String lineId)? removeLine,
+ TResult Function(String lineId, String notes)? updateLineNotes,
TResult Function(OrderType orderType)? updateOrderType,
TResult Function(Delivery delivery)? updateDelivery,
TResult Function(Table? table)? updateTable,
@@ -1872,8 +2797,11 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
TResult map({
required TResult Function(_Started value) started,
required TResult Function(_AddItem value) addItem,
+ required TResult Function(_AddWeightedItem value) addWeightedItem,
+ required TResult Function(_UpdateItemWeight value) updateItemWeight,
required TResult Function(_RemoveItem value) removeItem,
- required TResult Function(_UpdateItemNotes value) updateItemNotes,
+ required TResult Function(_RemoveLine value) removeLine,
+ required TResult Function(_UpdateLineNotes value) updateLineNotes,
required TResult Function(_UpdateOrderType value) updateOrderType,
required TResult Function(_UpdateDelivery value) updateDelivery,
required TResult Function(_UpdateTable value) updateTable,
@@ -1888,8 +2816,11 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
TResult? mapOrNull({
TResult? Function(_Started value)? started,
TResult? Function(_AddItem value)? addItem,
+ TResult? Function(_AddWeightedItem value)? addWeightedItem,
+ TResult? Function(_UpdateItemWeight value)? updateItemWeight,
TResult? Function(_RemoveItem value)? removeItem,
- TResult? Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult? Function(_RemoveLine value)? removeLine,
+ TResult? Function(_UpdateLineNotes value)? updateLineNotes,
TResult? Function(_UpdateOrderType value)? updateOrderType,
TResult? Function(_UpdateDelivery value)? updateDelivery,
TResult? Function(_UpdateTable value)? updateTable,
@@ -1904,8 +2835,11 @@ class _$CustomerNameChangedImpl implements _CustomerNameChanged {
TResult maybeMap({
TResult Function(_Started value)? started,
TResult Function(_AddItem value)? addItem,
+ TResult Function(_AddWeightedItem value)? addWeightedItem,
+ TResult Function(_UpdateItemWeight value)? updateItemWeight,
TResult Function(_RemoveItem value)? removeItem,
- TResult Function(_UpdateItemNotes value)? updateItemNotes,
+ TResult Function(_RemoveLine value)? removeLine,
+ TResult Function(_UpdateLineNotes value)? updateLineNotes,
TResult Function(_UpdateOrderType value)? updateOrderType,
TResult Function(_UpdateDelivery value)? updateDelivery,
TResult Function(_UpdateTable value)? updateTable,
diff --git a/lib/application/checkout/checkout_form/checkout_form_event.dart b/lib/application/checkout/checkout_form/checkout_form_event.dart
index 8290512..3cf44d8 100644
--- a/lib/application/checkout/checkout_form/checkout_form_event.dart
+++ b/lib/application/checkout/checkout_form/checkout_form_event.dart
@@ -10,15 +10,32 @@ class CheckoutFormEvent with _$CheckoutFormEvent {
ProductVariant? variant,
) = _AddItem;
+ /// Satu penimbangan = satu baris baru. Dipanggil setiap kali kasir selesai
+ /// memasukkan angka timbangan, meski produknya sama dengan baris lain.
+ const factory CheckoutFormEvent.addWeightedItem(
+ Product product,
+ ProductVariant? variant,
+ double weight,
+ ) = _AddWeightedItem;
+
+ /// Koreksi angka timbangan pada satu baris tertentu.
+ const factory CheckoutFormEvent.updateItemWeight(
+ String lineId,
+ double weight,
+ ) = _UpdateItemWeight;
+
const factory CheckoutFormEvent.removeItem(
Product product,
ProductVariant? variant,
) = _RemoveItem;
- const factory CheckoutFormEvent.updateItemNotes(
- Product product,
+ /// Hapus satu baris utuh — satu-satunya cara membatalkan baris berbobot.
+ const factory CheckoutFormEvent.removeLine(String lineId) = _RemoveLine;
+
+ const factory CheckoutFormEvent.updateLineNotes(
+ String lineId,
String notes,
- ) = _UpdateItemNotes;
+ ) = _UpdateLineNotes;
const factory CheckoutFormEvent.updateOrderType(OrderType orderType) =
_UpdateOrderType;
@@ -30,6 +47,6 @@ class CheckoutFormEvent with _$CheckoutFormEvent {
const factory CheckoutFormEvent.orderAddedItems(Order? order) =
_OrderAddedItems;
- const factory CheckoutFormEvent.customerNameChanged(String name) =
+ const factory CheckoutFormEvent.customerNameChanged(String name) =
_CustomerNameChanged;
}
diff --git a/lib/application/order/order_form/order_form_bloc.dart b/lib/application/order/order_form/order_form_bloc.dart
index e287690..ff443f7 100644
--- a/lib/application/order/order_form/order_form_bloc.dart
+++ b/lib/application/order/order_form/order_form_bloc.dart
@@ -60,15 +60,7 @@ class OrderFormBloc extends Bloc {
notes: '',
customerName: state.customerName ?? "",
orderItems: e.items
- .map(
- (item) => OrderItemRequest(
- productId: item.product.id,
- productVariantId: item.variant?.id ?? "",
- quantity: item.quantity,
- unitPrice: item.product.price.toInt(),
- notes: item.notes,
- ),
- )
+ .map(OrderItemRequest.fromProductQuantity)
.toList(),
);
@@ -100,15 +92,7 @@ class OrderFormBloc extends Bloc {
notes: '',
customerName: state.customerName ?? "",
orderItems: e.items
- .map(
- (item) => OrderItemRequest(
- productId: item.product.id,
- productVariantId: item.variant?.id ?? "",
- quantity: item.quantity,
- unitPrice: item.product.price.toInt(),
- notes: item.notes,
- ),
- )
+ .map(OrderItemRequest.fromProductQuantity)
.toList(),
);
@@ -137,15 +121,7 @@ class OrderFormBloc extends Bloc {
);
final request = e.items
- .map(
- (item) => AddItemOrderRequest(
- productId: item.product.id,
- productVariantId: item.variant?.id ?? '',
- quantity: item.quantity,
- unitPrice: item.product.price.toInt(),
- notes: item.notes,
- ),
- )
+ .map(AddItemOrderRequest.fromProductQuantity)
.toList();
failureOrAddItemOrder = await _repository.addItemOrder(
diff --git a/lib/application/split_bill/split_bill_form/split_bill_form_bloc.dart b/lib/application/split_bill/split_bill_form/split_bill_form_bloc.dart
index ef768e7..7b253c3 100644
--- a/lib/application/split_bill/split_bill_form/split_bill_form_bloc.dart
+++ b/lib/application/split_bill/split_bill_form/split_bill_form_bloc.dart
@@ -67,7 +67,11 @@ class SplitBillFormBloc extends Bloc {
final item = state.pendingItems.firstWhere(
(item) => item.id == entry.key,
);
- newTotal += item.unitPrice.toInt() * entry.value;
+ // Baris berbobot dibayar utuh: nilainya weight x harga, bukan
+ // quantity x harga.
+ newTotal += item.isWeighted
+ ? item.totalPrice
+ : item.unitPrice.toInt() * entry.value;
}
emit(
diff --git a/lib/application/sync/sync_setting/sync_setting_bloc.dart b/lib/application/sync/sync_setting/sync_setting_bloc.dart
index 89cbd47..3052fc1 100644
--- a/lib/application/sync/sync_setting/sync_setting_bloc.dart
+++ b/lib/application/sync/sync_setting/sync_setting_bloc.dart
@@ -3,6 +3,7 @@ import 'package:dartz/dartz.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
+import '../../../common/service/unit_registry.dart';
import '../../../domain/category/category.dart';
import '../../../domain/product/product.dart';
@@ -14,9 +15,13 @@ part 'sync_setting_bloc.freezed.dart';
class SyncSettingBloc extends Bloc {
final IProductRepository _productRepository;
final ICategoryRepository _categoryRepository;
+ final UnitRegistry _unitRegistry;
- SyncSettingBloc(this._productRepository, this._categoryRepository)
- : super(SyncSettingState.initial()) {
+ SyncSettingBloc(
+ this._productRepository,
+ this._categoryRepository,
+ this._unitRegistry,
+ ) : super(SyncSettingState.initial()) {
on(_onSyncSettingEvent);
}
@@ -97,6 +102,10 @@ class SyncSettingBloc extends Bloc {
),
);
+ // Satuan lebih dulu: produk timbangan butuh singkatannya untuk bisa
+ // ditulis "4,2 ons" begitu selesai disinkronkan.
+ await _unitRegistry.load(forceRefresh: true);
+
// Sync categories first
final categoryResult = await _categoryRepository.syncAllCategories();
@@ -169,6 +178,8 @@ class SyncSettingBloc extends Bloc {
Future _onSyncProducts(Emitter emit) async {
emit(state.copyWith(isLoading: true, failureOptionSyncProduct: none()));
+ await _unitRegistry.load(forceRefresh: true);
+
final result = await _productRepository.syncAllProducts();
result.fold(
diff --git a/lib/application/void/void_form/void_form_bloc.dart b/lib/application/void/void_form/void_form_bloc.dart
index 3e5b415..abdae6b 100644
--- a/lib/application/void/void_form/void_form_bloc.dart
+++ b/lib/application/void/void_form/void_form_bloc.dart
@@ -55,7 +55,10 @@ class VoidFormBloc extends Bloc {
(item) => item.id == entry.key,
);
if (item == null) continue;
- newTotal += item.unitPrice.toInt() * entry.value;
+ // Baris berbobot di-void utuh; rupiahnya sudah weight x harga.
+ newTotal += item.isWeighted
+ ? item.totalPrice
+ : item.unitPrice.toInt() * entry.value;
}
emit(
@@ -92,7 +95,13 @@ class VoidFormBloc extends Bloc {
productVariantName: originalItem.productVariantName,
quantity: voidQty,
unitPrice: originalItem.unitPrice,
- totalPrice: (originalItem.unitPrice) * voidQty,
+ totalPrice: originalItem.isWeighted
+ ? originalItem.totalPrice
+ : (originalItem.unitPrice) * voidQty,
+ weight: originalItem.weight,
+ unitId: originalItem.unitId,
+ unitName: originalItem.unitName,
+ unitAbbreviation: originalItem.unitAbbreviation,
modifiers: originalItem.modifiers,
notes: originalItem.notes,
status: originalItem.status,
diff --git a/lib/common/constant/local_storage_key.dart b/lib/common/constant/local_storage_key.dart
index 5be2a70..c645118 100644
--- a/lib/common/constant/local_storage_key.dart
+++ b/lib/common/constant/local_storage_key.dart
@@ -2,4 +2,5 @@ class LocalStorageKey {
static const String token = 'token';
static const String user = 'user';
static const String outlet = 'outlet';
+ static const String units = 'units';
}
diff --git a/lib/common/database/database_helper.dart b/lib/common/database/database_helper.dart
index 9d3d666..3082780 100644
--- a/lib/common/database/database_helper.dart
+++ b/lib/common/database/database_helper.dart
@@ -17,7 +17,7 @@ class DatabaseHelper {
return await openDatabase(
path,
- version: 2,
+ version: 3,
onCreate: _onCreate,
onUpgrade: _onUpgrade,
);
@@ -42,7 +42,11 @@ class DatabaseHelper {
metadata TEXT,
is_active INTEGER,
created_at TEXT,
- updated_at TEXT
+ updated_at TEXT,
+ sell_by TEXT DEFAULT 'unit',
+ unit_id TEXT,
+ unit_name TEXT,
+ unit_abbreviation TEXT
)
''');
@@ -114,6 +118,17 @@ class DatabaseHelper {
'ALTER TABLE products ADD COLUMN print_to_checker INTEGER DEFAULT 0',
);
}
+
+ // Produk timbangan: cara jual dan satuan ikut disimpan lokal supaya POS
+ // tetap bisa menampilkan "4,2 ons" saat offline.
+ if (oldVersion < 3) {
+ await db.execute(
+ "ALTER TABLE products ADD COLUMN sell_by TEXT DEFAULT 'unit'",
+ );
+ await db.execute('ALTER TABLE products ADD COLUMN unit_id TEXT');
+ await db.execute('ALTER TABLE products ADD COLUMN unit_name TEXT');
+ await db.execute('ALTER TABLE products ADD COLUMN unit_abbreviation TEXT');
+ }
}
Future close() async {
diff --git a/lib/common/extension/double_extension.dart b/lib/common/extension/double_extension.dart
index a8cf993..c4fa0cc 100644
--- a/lib/common/extension/double_extension.dart
+++ b/lib/common/extension/double_extension.dart
@@ -13,3 +13,10 @@ extension DoubleExt on double {
decimalDigits: 0,
).format(this);
}
+
+extension WeightExt on double {
+ /// Format berat gaya Indonesia: koma desimal, tanpa nol di belakang.
+ /// `4.2` → `4,2`, `4.237` → `4,237`, `5.0` → `5`.
+ String get weightFormat =>
+ NumberFormat('#,##0.###', 'id').format(this);
+}
diff --git a/lib/common/function/app_function.dart b/lib/common/function/app_function.dart
index 3fd64b2..f159a81 100644
--- a/lib/common/function/app_function.dart
+++ b/lib/common/function/app_function.dart
@@ -75,3 +75,25 @@ int generateRandomNumber() {
final random = Random();
return 1 + random.nextInt(10000);
}
+
+/// Ambil pesan validasi dari amplop error standar backend.
+///
+/// Untuk produk timbangan pesannya menyebut nama produk — misalnya
+/// "product Ikan Tude is sold by weight and requires a weight" — jadi layak
+/// ditampilkan apa adanya ke kasir alih-alih diganti pesan generik.
+String? extractApiErrorCause(dynamic responseData) {
+ if (responseData is! Map) return null;
+
+ final errors = responseData['errors'];
+ if (errors is! List || errors.isEmpty) return null;
+
+ final causes = errors
+ .whereType