Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36bc9e0f9e | ||
|
|
ac991431c8 | ||
|
|
587caa44c5 | ||
|
|
2e4c77888e | ||
|
|
f9bfb69254 | ||
|
|
d02d3b5fbd | ||
|
|
7661319b4f | ||
|
|
75415cc6ff | ||
|
|
843c11b200 | ||
|
|
0917c5132b | ||
|
|
b07af60778 | ||
|
|
8d801e52d9 | ||
|
|
7137cd2335 | ||
|
|
b98462ee8c | ||
|
|
83f4e065ed | ||
|
|
e236d811ce | ||
|
|
0b70194d8e | ||
|
|
c1cefb122b |
@@ -18,6 +18,9 @@ jobs:
|
|||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: "stable"
|
channel: "stable"
|
||||||
|
# Dipin biar CI nggak ikut naik versi diam-diam.
|
||||||
|
# Flutter 3.47 mensyaratkan iOS deployment target minimal 15.0.
|
||||||
|
flutter-version: "3.47.0"
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
@@ -69,7 +72,7 @@ jobs:
|
|||||||
- name: Install CocoaPods Dependencies
|
- name: Install CocoaPods Dependencies
|
||||||
run: |
|
run: |
|
||||||
cd ios
|
cd ios
|
||||||
rm -f Podfile.lock
|
rm -rf Pods Podfile.lock
|
||||||
pod install --repo-update
|
pod install --repo-update
|
||||||
|
|
||||||
# ── Build & Archive ─────────────────────────────────────────────────────
|
# ── Build & Archive ─────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ A POS (Point of Sale) application for business owners, built with Flutter. The p
|
|||||||
- Architecture Overview
|
- Architecture Overview
|
||||||
- Project Structure
|
- Project Structure
|
||||||
- Key Dependencies & Purpose
|
- Key Dependencies & Purpose
|
||||||
- Code Generation
|
- Code Generation (see docs/codegen.md)
|
||||||
- Internationalization (i18n)
|
- Internationalization (i18n)
|
||||||
- Theming & Assets
|
- Theming & Assets
|
||||||
- Environment Configuration (`env.dart`)
|
- Environment Configuration (`env.dart`)
|
||||||
@@ -40,6 +40,7 @@ A POS (Point of Sale) application for business owners, built with Flutter. The p
|
|||||||
|
|
||||||
- Flutter SDK installed as per the official guide (`https://flutter.dev/docs/get-started/install`)
|
- Flutter SDK installed as per the official guide (`https://flutter.dev/docs/get-started/install`)
|
||||||
- Dart version per constraint: ^3.8.1
|
- Dart version per constraint: ^3.8.1
|
||||||
|
- For code generation only: FVM + Flutter 3.41.9 (`dart pub global activate fvm && fvm install 3.41.9`) — see [docs/codegen.md](docs/codegen.md)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
@@ -51,8 +52,16 @@ flutter pub get
|
|||||||
|
|
||||||
### Code generation (required after clone or when annotations change)
|
### Code generation (required after clone or when annotations change)
|
||||||
|
|
||||||
```bash
|
> **Do not run codegen with Flutter 3.47 / Dart 3.13** — every builder crashes with
|
||||||
flutter pub run build_runner build --delete-conflicting-outputs
|
> `Missing implementation of visitDotShorthandPropertyAccess`. Codegen must run on Flutter 3.41.9
|
||||||
|
> (Dart 3.11.5) via FVM. Full setup, commands, and troubleshooting: **[docs/codegen.md](docs/codegen.md)**.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||||
|
|
||||||
|
& "$FVM\flutter.bat" pub get
|
||||||
|
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||||
|
flutter pub get # restore lockfile resolution for the global SDK
|
||||||
```
|
```
|
||||||
|
|
||||||
> Re-run whenever you change files using `@RoutePage()`, `@injectable`, `@freezed`, or `@JsonSerializable`.
|
> Re-run whenever you change files using `@RoutePage()`, `@injectable`, `@freezed`, or `@JsonSerializable`.
|
||||||
@@ -179,14 +188,27 @@ Refer to `pubspec.yaml` for full version constraints.
|
|||||||
|
|
||||||
## Code Generation
|
## Code Generation
|
||||||
|
|
||||||
|
**Full guide: [docs/codegen.md](docs/codegen.md)** — read it before your first codegen run.
|
||||||
|
|
||||||
|
Codegen runs on a pinned SDK (Flutter 3.41.9 / Dart 3.11.5 via FVM), not on the global Flutter 3.47:
|
||||||
|
`freezed 2.5.8` caps `analyzer` below 8.0.0, and analyzer 7.7.1 crashes on the dot-shorthand syntax
|
||||||
|
used by Dart 3.13 sources. The app itself still runs and builds with the global SDK.
|
||||||
|
|
||||||
Common commands:
|
Common commands:
|
||||||
|
|
||||||
```bash
|
```powershell
|
||||||
flutter pub run build_runner build --delete-conflicting-outputs
|
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||||
|
|
||||||
|
& "$FVM\flutter.bat" pub get
|
||||||
|
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||||
# or watch
|
# or watch
|
||||||
flutter pub run build_runner watch --delete-conflicting-outputs
|
& "$FVM\dart.bat" run build_runner watch --delete-conflicting-outputs
|
||||||
|
flutter pub get # restore lockfile resolution for the global SDK
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> `--delete-conflicting-outputs` wipes every generated file first. If you cancel the build midway,
|
||||||
|
> restore them with `git checkout` — see the troubleshooting table in [docs/codegen.md](docs/codegen.md).
|
||||||
|
|
||||||
### Asset generation (flutter_gen_runner)
|
### Asset generation (flutter_gen_runner)
|
||||||
|
|
||||||
`flutter_gen_runner` is integrated with `build_runner`. Running the commands above will also generate typed accessors for assets based on the `flutter_gen` section in `pubspec.yaml`:
|
`flutter_gen_runner` is integrated with `build_runner`. Running the commands above will also generate typed accessors for assets based on the `flutter_gen` section in `pubspec.yaml`:
|
||||||
@@ -255,15 +277,20 @@ flutter pub get
|
|||||||
flutter format .
|
flutter format .
|
||||||
flutter analyze
|
flutter analyze
|
||||||
|
|
||||||
# Code generation (single run / watch)
|
# Localization (safe on the global SDK)
|
||||||
flutter pub run build_runner build --delete-conflicting-outputs
|
flutter gen-l10n
|
||||||
flutter pub run build_runner watch --delete-conflicting-outputs
|
|
||||||
|
|
||||||
# Run by device
|
# Run by device
|
||||||
flutter devices
|
flutter devices
|
||||||
flutter run -d <device-id>
|
flutter run -d <device-id>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Code generation uses the pinned FVM SDK — see [docs/codegen.md](docs/codegen.md):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
& "$env:USERPROFILE\fvm\versions\3.41.9\bin\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Additional Notes
|
## Additional Notes
|
||||||
@@ -316,7 +343,7 @@ Aplikasi Point of Sale (POS) untuk pemilik usaha, dibangun dengan Flutter. Proye
|
|||||||
- Arsitektur & Alur
|
- Arsitektur & Alur
|
||||||
- Struktur Proyek
|
- Struktur Proyek
|
||||||
- Dependensi Utama & Fungsinya
|
- Dependensi Utama & Fungsinya
|
||||||
- Code Generation
|
- Code Generation (lihat docs/codegen.md)
|
||||||
- Internationalization (i18n)
|
- Internationalization (i18n)
|
||||||
- Theming & Assets
|
- Theming & Assets
|
||||||
- Konfigurasi Lingkungan (`env.dart`)
|
- Konfigurasi Lingkungan (`env.dart`)
|
||||||
@@ -344,6 +371,7 @@ Aplikasi Point of Sale (POS) untuk pemilik usaha, dibangun dengan Flutter. Proye
|
|||||||
|
|
||||||
- Flutter SDK terpasang sesuai panduan resmi (`https://flutter.dev/docs/get-started/install`)
|
- Flutter SDK terpasang sesuai panduan resmi (`https://flutter.dev/docs/get-started/install`)
|
||||||
- Versi Dart sesuai constraint: ^3.8.1
|
- Versi Dart sesuai constraint: ^3.8.1
|
||||||
|
- Khusus untuk code generation: FVM + Flutter 3.41.9 (`dart pub global activate fvm && fvm install 3.41.9`) — lihat [docs/codegen.md](docs/codegen.md)
|
||||||
|
|
||||||
### Instalasi
|
### Instalasi
|
||||||
|
|
||||||
@@ -355,8 +383,16 @@ flutter pub get
|
|||||||
|
|
||||||
### Generate kode (wajib setelah clone atau mengubah anotasi)
|
### Generate kode (wajib setelah clone atau mengubah anotasi)
|
||||||
|
|
||||||
```bash
|
> **Jangan jalankan codegen dengan Flutter 3.47 / Dart 3.13** — semua builder crash dengan
|
||||||
flutter pub run build_runner build --delete-conflicting-outputs
|
> `Missing implementation of visitDotShorthandPropertyAccess`. Codegen harus memakai Flutter 3.41.9
|
||||||
|
> (Dart 3.11.5) via FVM. Setup, perintah, dan troubleshooting lengkap: **[docs/codegen.md](docs/codegen.md)**.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||||
|
|
||||||
|
& "$FVM\flutter.bat" pub get
|
||||||
|
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||||
|
flutter pub get # kembalikan resolusi lockfile ke SDK global
|
||||||
```
|
```
|
||||||
|
|
||||||
> Jalankan ulang perintah di atas setiap kali Anda mengubah file yang menggunakan anotasi `@RoutePage()`, `@injectable`, `@freezed`, atau `@JsonSerializable`.
|
> Jalankan ulang perintah di atas setiap kali Anda mengubah file yang menggunakan anotasi `@RoutePage()`, `@injectable`, `@freezed`, atau `@JsonSerializable`.
|
||||||
@@ -472,14 +508,27 @@ Catatan versi lengkap tersedia di `pubspec.yaml`.
|
|||||||
|
|
||||||
## Code Generation
|
## Code Generation
|
||||||
|
|
||||||
|
**Panduan lengkap: [docs/codegen.md](docs/codegen.md)** — baca dulu sebelum codegen pertama kali.
|
||||||
|
|
||||||
|
Codegen dijalankan dengan SDK terpisah (Flutter 3.41.9 / Dart 3.11.5 via FVM), bukan Flutter global 3.47:
|
||||||
|
`freezed 2.5.8` mengunci `analyzer` di bawah 8.0.0, dan analyzer 7.7.1 crash pada sintaks *dot-shorthand*
|
||||||
|
milik Dart 3.13. Aplikasinya sendiri tetap di-`run`/`build` dengan SDK global.
|
||||||
|
|
||||||
Perintah umum:
|
Perintah umum:
|
||||||
|
|
||||||
```bash
|
```powershell
|
||||||
flutter pub run build_runner build --delete-conflicting-outputs
|
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||||
|
|
||||||
|
& "$FVM\flutter.bat" pub get
|
||||||
|
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||||
# atau untuk watch
|
# atau untuk watch
|
||||||
flutter pub run build_runner watch --delete-conflicting-outputs
|
& "$FVM\dart.bat" run build_runner watch --delete-conflicting-outputs
|
||||||
|
flutter pub get # kembalikan resolusi lockfile ke SDK global
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> `--delete-conflicting-outputs` menghapus semua file generated lebih dulu. Kalau build dibatalkan di
|
||||||
|
> tengah jalan, pulihkan dengan `git checkout` — lihat tabel troubleshooting di [docs/codegen.md](docs/codegen.md).
|
||||||
|
|
||||||
Generator yang digunakan:
|
Generator yang digunakan:
|
||||||
|
|
||||||
- AutoRoute: menghasilkan deklarasi router & route.
|
- AutoRoute: menghasilkan deklarasi router & route.
|
||||||
@@ -533,15 +582,20 @@ flutter pub get
|
|||||||
flutter format .
|
flutter format .
|
||||||
flutter analyze
|
flutter analyze
|
||||||
|
|
||||||
# Code generation (sekali jalan / watch)
|
# Localization (aman dengan SDK global)
|
||||||
flutter pub run build_runner build --delete-conflicting-outputs
|
flutter gen-l10n
|
||||||
flutter pub run build_runner watch --delete-conflicting-outputs
|
|
||||||
|
|
||||||
# Run by device
|
# Run by device
|
||||||
flutter devices
|
flutter devices
|
||||||
flutter run -d <device-id>
|
flutter run -d <device-id>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Code generation memakai SDK FVM yang di-pin — lihat [docs/codegen.md](docs/codegen.md):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
& "$env:USERPROFILE\fvm\versions\3.41.9\bin\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Catatan Tambahan
|
## Catatan Tambahan
|
||||||
|
|||||||
@@ -19,3 +19,10 @@ analyzer:
|
|||||||
- test/generated/**
|
- test/generated/**
|
||||||
- "**/**.g.dart"
|
- "**/**.g.dart"
|
||||||
- "**/**.freezed.dart"
|
- "**/**.freezed.dart"
|
||||||
|
- build/**
|
||||||
|
- android/**
|
||||||
|
- ios/**
|
||||||
|
- web/**
|
||||||
|
- windows/**
|
||||||
|
- macos/**
|
||||||
|
- linux/**
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="Enaklo Owner"
|
android:label="Grow Food"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/launcher_icon">
|
android:icon="@mipmap/launcher_icon">
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 27 KiB |
@@ -1,3 +1,7 @@
|
|||||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
# This builtInKotlin flag was added automatically by Flutter migrator
|
||||||
|
android.builtInKotlin=false
|
||||||
|
# This newDsl flag was added automatically by Flutter migrator
|
||||||
|
android.newDsl=false
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ pluginManagement {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||||
id("com.android.application") version "8.7.3" apply false
|
id("com.android.application") version "8.11.1" apply false
|
||||||
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
|
||||||
id("com.google.gms.google-services") version "4.4.2" apply false
|
id("com.google.gms.google-services") version "4.4.2" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
After Width: | Height: | Size: 498 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 952 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 2.0 MiB |
@@ -0,0 +1,163 @@
|
|||||||
|
# Code Generation (build_runner)
|
||||||
|
|
||||||
|
> **PENTING:** `build_runner` di proyek ini **tidak bisa** dijalankan dengan Flutter 3.47 / Dart 3.13.
|
||||||
|
> Gunakan SDK Flutter 3.41.9 (Dart 3.11.5) lewat FVM. Aplikasinya sendiri tetap di-`run`/`build`
|
||||||
|
> dengan Flutter versi global (3.47).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
PowerShell (Windows):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||||
|
|
||||||
|
& "$FVM\flutter.bat" pub get # 1. resolve paket dgn Dart 3.11.5
|
||||||
|
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs # 2. generate
|
||||||
|
flutter pub get # 3. balik ke SDK global 3.47
|
||||||
|
```
|
||||||
|
|
||||||
|
Git Bash:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
FVM=~/fvm/versions/3.41.9/bin
|
||||||
|
|
||||||
|
"$FVM/flutter.bat" pub get
|
||||||
|
"$FVM/dart.bat" run build_runner build --delete-conflicting-outputs
|
||||||
|
flutter pub get
|
||||||
|
```
|
||||||
|
|
||||||
|
Durasi normal: **±90–120 detik** untuk full build (146 output).
|
||||||
|
|
||||||
|
Setelah itu jalankan `flutter analyze` untuk memastikan hasil generate bersih.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Kenapa harus SDK terpisah?
|
||||||
|
|
||||||
|
Kalau codegen dijalankan dengan Flutter global (3.47 / Dart 3.13), semua builder gagal dengan:
|
||||||
|
|
||||||
|
```
|
||||||
|
W SDK language version 3.13.0 is newer than `analyzer` language version 3.9.0.
|
||||||
|
E freezed on lib/application/.../category_analytic_loader_bloc.dart:
|
||||||
|
Exception: Missing implementation of visitDotShorthandPropertyAccess
|
||||||
|
```
|
||||||
|
|
||||||
|
Rantai penyebabnya:
|
||||||
|
|
||||||
|
1. `freezed 2.5.8` membatasi `analyzer <8.0.0`, jadi pub me-resolve ke **analyzer 7.7.1** (language version 3.9).
|
||||||
|
2. Dart 3.13 memakai sintaks *dot-shorthand* (`.value`) di sumber SDK/framework.
|
||||||
|
3. Analyzer 7.7.1 bisa mem-*parse*-nya tapi belum bisa menuliskannya ke summary → crash saat resolve.
|
||||||
|
4. Semua generator (`freezed`, `json_serializable`, `injectable_generator`, `auto_route_generator`) berbagi analyzer yang sama, jadi semuanya ikut mati — termasuk saat men-generate file lama yang tidak diubah.
|
||||||
|
|
||||||
|
Dart 3.11.5 (Flutter 3.41.9) adalah versi tertinggi yang **masih cocok dengan analyzer 7.7.1** sekaligus memenuhi batas `pubspec.lock` (`dart >=3.11.0-0`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Setup sekali di mesin baru
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
dart pub global activate fvm
|
||||||
|
```
|
||||||
|
|
||||||
|
Tambahkan folder binari pub ke PATH agar perintah `fvm` dikenali:
|
||||||
|
`%LOCALAPPDATA%\Pub\Cache\bin`
|
||||||
|
|
||||||
|
Lalu unduh SDK-nya (±1 GB, sekali saja):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
fvm install 3.41.9
|
||||||
|
fvm list # verifikasi
|
||||||
|
```
|
||||||
|
|
||||||
|
SDK tersimpan di `%USERPROFILE%\fvm\versions\3.41.9` dan **tidak** mengubah Flutter global.
|
||||||
|
|
||||||
|
> Kita sengaja **tidak** menjalankan `fvm use`, supaya repo tidak punya `.fvmrc`/`.fvm/`
|
||||||
|
> dan IDE tetap memakai Flutter 3.47 untuk menjalankan aplikasi.
|
||||||
|
> Kalau lebih suka pin per-project, jalankan `fvm use 3.41.9` lalu pakai `fvm dart run build_runner ...`,
|
||||||
|
> dan tambahkan `.fvm/` ke `.gitignore`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Perintah harian
|
||||||
|
|
||||||
|
Semua contoh memakai variabel `$FVM` dari bagian TL;DR.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# build sekali (paling sering dipakai)
|
||||||
|
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||||
|
|
||||||
|
# mode watch saat banyak mengubah anotasi
|
||||||
|
& "$FVM\dart.bat" run build_runner watch --delete-conflicting-outputs
|
||||||
|
|
||||||
|
# hanya membersihkan output generated
|
||||||
|
& "$FVM\dart.bat" run build_runner clean
|
||||||
|
```
|
||||||
|
|
||||||
|
Wajib generate ulang setiap kali mengubah/menambah file dengan anotasi:
|
||||||
|
|
||||||
|
| Anotasi | Generator | Output |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `@freezed` | freezed | `*.freezed.dart` |
|
||||||
|
| `@JsonSerializable` / `fromJson` di DTO | json_serializable | `*.g.dart` |
|
||||||
|
| `@injectable`, `@LazySingleton` | injectable_generator | `lib/injection.config.dart` |
|
||||||
|
| `@RoutePage()` | auto_route_generator | `lib/presentation/router/app_router.gr.dart` |
|
||||||
|
| asset baru di `assets/` | flutter_gen_runner | `lib/presentation/components/assets/assets.gen.dart` |
|
||||||
|
|
||||||
|
### Localization (i18n) — tidak lewat build_runner
|
||||||
|
|
||||||
|
`flutter gen-l10n` memakai tooling Flutter, bukan analyzer, jadi **aman dijalankan dengan Flutter 3.47**:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
flutter gen-l10n
|
||||||
|
```
|
||||||
|
|
||||||
|
Jalankan setiap kali `lib/l10n/app_id.arb` / `app_en.arb` berubah. Hasilnya: `lib/l10n/app_localizations*.dart`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Aturan penting soal `--delete-conflicting-outputs`
|
||||||
|
|
||||||
|
Flag ini **menghapus dulu** semua file generated (±55 file `*.freezed.dart` / `*.g.dart`) sebelum membuat ulang.
|
||||||
|
Kalau proses dibatalkan di tengah jalan, project akan penuh error karena file-nya sudah hilang.
|
||||||
|
|
||||||
|
Pemulihan (semua file generated ikut ter-commit di git):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git status --porcelain | grep -E "^ D" | sed 's/^ D //' | while read -r f; do git checkout -- "$f"; done
|
||||||
|
```
|
||||||
|
|
||||||
|
Tips: jangan pipe output build ke `tail`/`head` — outputnya jadi ter-buffer sampai proses selesai,
|
||||||
|
sehingga terlihat seperti *hang* padahal sedang jalan.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
| Gejala | Penyebab | Solusi |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `Missing implementation of visitDotShorthandPropertyAccess` | codegen dijalankan dengan Flutter global 3.47 | pakai SDK FVM 3.41.9 |
|
||||||
|
| `Failed to update packages` + dump stack VM | `flutter pub run build_runner` / `fvm spawn ... pub run` | pakai `dart.bat run build_runner`, jangan `flutter pub run` |
|
||||||
|
| Ratusan error “isn't defined” di IDE, file `*.freezed.dart` hilang | build dibatalkan setelah `--delete-conflicting-outputs` | restore lewat `git checkout` (lihat di atas) |
|
||||||
|
| `pub get` gagal / versi paket bergeser | `pubspec.lock` di-resolve oleh SDK berbeda | jalankan `flutter pub get` dengan SDK global setelah codegen selesai |
|
||||||
|
| Build terasa lama di run pertama | asset graph baru dibuat dari nol | wajar, ±90–120 detik; run berikutnya inkremental |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Rencana jangka panjang
|
||||||
|
|
||||||
|
Perbaikan permanen = upgrade toolchain codegen supaya jalan native di Dart 3.13:
|
||||||
|
|
||||||
|
- `freezed` 2.5.8 → 3.x, `freezed_annotation` 2.4.x → 3.x
|
||||||
|
- `injectable` 2.x → 3.x, `injectable_generator` 2.7 → 3.x
|
||||||
|
- `auto_route` 9.x → 11.x, `auto_route_generator` 9.x → 10.x
|
||||||
|
- `build_runner` → 2.16.x, `json_serializable` → 6.14.x (analyzer ikut naik ke 13.x)
|
||||||
|
|
||||||
|
Konsekuensinya breaking dan cukup besar, jadi perlu dijadwalkan sendiri:
|
||||||
|
|
||||||
|
- freezed 3 **menghapus** `.map()` / `.when()` / `.maybeWhen()` / `.maybeMap()` → ±49 pemakaian (mayoritas di handler event BLoC) harus diganti pattern matching Dart 3 (`switch`).
|
||||||
|
- ±98 file dengan `@freezed` harus dideklarasikan `abstract class` atau `sealed class`.
|
||||||
|
- Migrasi konfigurasi router (auto_route 11) dan DI (injectable 3).
|
||||||
|
|
||||||
|
Selama migrasi itu belum dikerjakan, gunakan alur FVM di dokumen ini.
|
||||||
@@ -21,6 +21,6 @@
|
|||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
<string>12.0</string>
|
<string>15.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Uncomment this line to define a global platform for your project
|
# Uncomment this line to define a global platform for your project
|
||||||
platform :ios, '14.0'
|
platform :ios, '15.0'
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
@@ -40,7 +40,7 @@ post_install do |installer|
|
|||||||
installer.pods_project.targets.each do |target|
|
installer.pods_project.targets.each do |target|
|
||||||
flutter_additional_ios_build_settings(target)
|
flutter_additional_ios_build_settings(target)
|
||||||
target.build_configurations.each do |config|
|
target.build_configurations.each do |config|
|
||||||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
|
||||||
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
|
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
|
||||||
# Disable code signing for all Pod targets — only Runner needs signing
|
# Disable code signing for all Pod targets — only Runner needs signing
|
||||||
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
||||||
|
|||||||
@@ -476,7 +476,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
@@ -495,7 +495,7 @@
|
|||||||
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -607,7 +607,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@@ -658,7 +658,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
@@ -679,7 +679,7 @@
|
|||||||
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -703,7 +703,7 @@
|
|||||||
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 654 KiB After Width: | Height: | Size: 652 KiB |
|
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 622 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 20 KiB |
@@ -5,7 +5,7 @@
|
|||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>Enaklo Owner</string>
|
<string>Grow Food</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
android: "launcher_icon"
|
android: "launcher_icon"
|
||||||
ios: true
|
ios: true
|
||||||
image_path: "assets/images/logo.png"
|
image_path: "assets/images/ic_launcher.png"
|
||||||
remove_alpha_ios: true
|
remove_alpha_ios: true
|
||||||
min_sdk_android: 21 # android min sdk min:16, default 21
|
min_sdk_android: 21 # android min sdk min:16, default 21
|
||||||
adaptive_icon_background: "#ffffff"
|
adaptive_icon_background: "#ffffff"
|
||||||
adaptive_icon_foreground: "assets/images/logo.png"
|
adaptive_icon_foreground: "assets/images/ic_launcher.png"
|
||||||
web:
|
web:
|
||||||
generate: true
|
generate: true
|
||||||
image_path: "assets/images/logo.png"
|
image_path: "assets/images/ic_launcher.png"
|
||||||
windows:
|
windows:
|
||||||
generate: true
|
generate: true
|
||||||
image_path: "assets/images/logo.png"
|
image_path: "assets/images/ic_launcher.png"
|
||||||
icon_size: 48
|
icon_size: 48
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ class CategoryAnalyticLoaderBloc
|
|||||||
Emitter<CategoryAnalyticLoaderState> emit,
|
Emitter<CategoryAnalyticLoaderState> emit,
|
||||||
) {
|
) {
|
||||||
return event.map(
|
return event.map(
|
||||||
|
rangeDateChanged: (e) async {
|
||||||
|
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||||
|
},
|
||||||
fetched: (e) async {
|
fetched: (e) async {
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
@@ -34,8 +37,8 @@ class CategoryAnalyticLoaderBloc
|
|||||||
);
|
);
|
||||||
|
|
||||||
final result = await _repository.getCategory(
|
final result = await _repository.getCategory(
|
||||||
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
|
dateFrom: state.dateFrom,
|
||||||
dateTo: DateTime.now(),
|
dateTo: state.dateTo,
|
||||||
);
|
);
|
||||||
|
|
||||||
var data = result.fold(
|
var data = result.fold(
|
||||||
|
|||||||
@@ -19,27 +19,34 @@ final _privateConstructorUsedError = UnsupportedError(
|
|||||||
mixin _$CategoryAnalyticLoaderEvent {
|
mixin _$CategoryAnalyticLoaderEvent {
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
required TResult Function() fetched,
|
required TResult Function() fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult? Function()? fetched,
|
TResult? Function()? fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult Function()? fetched,
|
TResult Function()? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
required TResult Function(_Fetched value) fetched,
|
required TResult Function(_Fetched value) fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult? Function(_Fetched value)? fetched,
|
TResult? Function(_Fetched value)? fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult Function(_Fetched value)? fetched,
|
TResult Function(_Fetched value)? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@@ -74,6 +81,165 @@ class _$CategoryAnalyticLoaderEventCopyWithImpl<
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$RangeDateChangedImplCopyWith(
|
||||||
|
_$RangeDateChangedImpl value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) then,
|
||||||
|
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$CategoryAnalyticLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||||
|
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl(
|
||||||
|
_$RangeDateChangedImpl _value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CategoryAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||||
|
return _then(
|
||||||
|
_$RangeDateChangedImpl(
|
||||||
|
null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||||
|
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CategoryAnalyticLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RangeDateChangedImpl &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||||
|
|
||||||
|
/// Create a copy of CategoryAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RangeDateChanged implements CategoryAnalyticLoaderEvent {
|
||||||
|
const factory _RangeDateChanged(
|
||||||
|
final DateTime dateFrom,
|
||||||
|
final DateTime dateTo,
|
||||||
|
) = _$RangeDateChangedImpl;
|
||||||
|
|
||||||
|
DateTime get dateFrom;
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of CategoryAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||||
factory _$$FetchedImplCopyWith(
|
factory _$$FetchedImplCopyWith(
|
||||||
@@ -116,19 +282,27 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
return fetched();
|
return fetched();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
return fetched?.call();
|
return fetched?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult Function()? fetched,
|
TResult Function()? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@@ -141,6 +315,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
required TResult Function(_Fetched value) fetched,
|
required TResult Function(_Fetched value) fetched,
|
||||||
}) {
|
}) {
|
||||||
return fetched(this);
|
return fetched(this);
|
||||||
@@ -149,6 +324,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult? Function(_Fetched value)? fetched,
|
TResult? Function(_Fetched value)? fetched,
|
||||||
}) {
|
}) {
|
||||||
return fetched?.call(this);
|
return fetched?.call(this);
|
||||||
@@ -157,6 +333,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult Function(_Fetched value)? fetched,
|
TResult Function(_Fetched value)? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@@ -177,6 +354,8 @@ mixin _$CategoryAnalyticLoaderState {
|
|||||||
Option<AnalyticFailure> get failureOptionCategoryAnalytic =>
|
Option<AnalyticFailure> get failureOptionCategoryAnalytic =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
bool get isFetching => throw _privateConstructorUsedError;
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Create a copy of CategoryAnalyticLoaderState
|
/// Create a copy of CategoryAnalyticLoaderState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -200,6 +379,8 @@ abstract class $CategoryAnalyticLoaderStateCopyWith<$Res> {
|
|||||||
CategoryAnalytic categoryAnalytic,
|
CategoryAnalytic categoryAnalytic,
|
||||||
Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
||||||
bool isFetching,
|
bool isFetching,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
$CategoryAnalyticCopyWith<$Res> get categoryAnalytic;
|
$CategoryAnalyticCopyWith<$Res> get categoryAnalytic;
|
||||||
@@ -226,6 +407,8 @@ class _$CategoryAnalyticLoaderStateCopyWithImpl<
|
|||||||
Object? categoryAnalytic = null,
|
Object? categoryAnalytic = null,
|
||||||
Object? failureOptionCategoryAnalytic = null,
|
Object? failureOptionCategoryAnalytic = null,
|
||||||
Object? isFetching = null,
|
Object? isFetching = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_value.copyWith(
|
_value.copyWith(
|
||||||
@@ -241,6 +424,14 @@ class _$CategoryAnalyticLoaderStateCopyWithImpl<
|
|||||||
? _value.isFetching
|
? _value.isFetching
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
)
|
)
|
||||||
as $Val,
|
as $Val,
|
||||||
);
|
);
|
||||||
@@ -270,6 +461,8 @@ abstract class _$$CategoryAnalyticLoaderStateImplCopyWith<$Res>
|
|||||||
CategoryAnalytic categoryAnalytic,
|
CategoryAnalytic categoryAnalytic,
|
||||||
Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
||||||
bool isFetching,
|
bool isFetching,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -297,6 +490,8 @@ class __$$CategoryAnalyticLoaderStateImplCopyWithImpl<$Res>
|
|||||||
Object? categoryAnalytic = null,
|
Object? categoryAnalytic = null,
|
||||||
Object? failureOptionCategoryAnalytic = null,
|
Object? failureOptionCategoryAnalytic = null,
|
||||||
Object? isFetching = null,
|
Object? isFetching = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_$CategoryAnalyticLoaderStateImpl(
|
_$CategoryAnalyticLoaderStateImpl(
|
||||||
@@ -312,6 +507,14 @@ class __$$CategoryAnalyticLoaderStateImplCopyWithImpl<$Res>
|
|||||||
? _value.isFetching
|
? _value.isFetching
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -325,6 +528,8 @@ class _$CategoryAnalyticLoaderStateImpl
|
|||||||
required this.categoryAnalytic,
|
required this.categoryAnalytic,
|
||||||
required this.failureOptionCategoryAnalytic,
|
required this.failureOptionCategoryAnalytic,
|
||||||
this.isFetching = false,
|
this.isFetching = false,
|
||||||
|
required this.dateFrom,
|
||||||
|
required this.dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -334,10 +539,14 @@ class _$CategoryAnalyticLoaderStateImpl
|
|||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
final bool isFetching;
|
final bool isFetching;
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'CategoryAnalyticLoaderState(categoryAnalytic: $categoryAnalytic, failureOptionCategoryAnalytic: $failureOptionCategoryAnalytic, isFetching: $isFetching)';
|
return 'CategoryAnalyticLoaderState(categoryAnalytic: $categoryAnalytic, failureOptionCategoryAnalytic: $failureOptionCategoryAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -354,7 +563,10 @@ class _$CategoryAnalyticLoaderStateImpl
|
|||||||
other.failureOptionCategoryAnalytic ==
|
other.failureOptionCategoryAnalytic ==
|
||||||
failureOptionCategoryAnalytic) &&
|
failureOptionCategoryAnalytic) &&
|
||||||
(identical(other.isFetching, isFetching) ||
|
(identical(other.isFetching, isFetching) ||
|
||||||
other.isFetching == isFetching));
|
other.isFetching == isFetching) &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -363,6 +575,8 @@ class _$CategoryAnalyticLoaderStateImpl
|
|||||||
categoryAnalytic,
|
categoryAnalytic,
|
||||||
failureOptionCategoryAnalytic,
|
failureOptionCategoryAnalytic,
|
||||||
isFetching,
|
isFetching,
|
||||||
|
dateFrom,
|
||||||
|
dateTo,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Create a copy of CategoryAnalyticLoaderState
|
/// Create a copy of CategoryAnalyticLoaderState
|
||||||
@@ -383,6 +597,8 @@ abstract class _CategoryAnalyticLoaderState
|
|||||||
required final CategoryAnalytic categoryAnalytic,
|
required final CategoryAnalytic categoryAnalytic,
|
||||||
required final Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
required final Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
||||||
final bool isFetching,
|
final bool isFetching,
|
||||||
|
required final DateTime dateFrom,
|
||||||
|
required final DateTime dateTo,
|
||||||
}) = _$CategoryAnalyticLoaderStateImpl;
|
}) = _$CategoryAnalyticLoaderStateImpl;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -391,6 +607,10 @@ abstract class _CategoryAnalyticLoaderState
|
|||||||
Option<AnalyticFailure> get failureOptionCategoryAnalytic;
|
Option<AnalyticFailure> get failureOptionCategoryAnalytic;
|
||||||
@override
|
@override
|
||||||
bool get isFetching;
|
bool get isFetching;
|
||||||
|
@override
|
||||||
|
DateTime get dateFrom;
|
||||||
|
@override
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
/// Create a copy of CategoryAnalyticLoaderState
|
/// Create a copy of CategoryAnalyticLoaderState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@@ -2,5 +2,9 @@ part of 'category_analytic_loader_bloc.dart';
|
|||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class CategoryAnalyticLoaderEvent with _$CategoryAnalyticLoaderEvent {
|
class CategoryAnalyticLoaderEvent with _$CategoryAnalyticLoaderEvent {
|
||||||
|
const factory CategoryAnalyticLoaderEvent.rangeDateChanged(
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
) = _RangeDateChanged;
|
||||||
const factory CategoryAnalyticLoaderEvent.fetched() = _Fetched;
|
const factory CategoryAnalyticLoaderEvent.fetched() = _Fetched;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,14 @@ class CategoryAnalyticLoaderState with _$CategoryAnalyticLoaderState {
|
|||||||
required CategoryAnalytic categoryAnalytic,
|
required CategoryAnalytic categoryAnalytic,
|
||||||
required Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
required Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
||||||
@Default(false) bool isFetching,
|
@Default(false) bool isFetching,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
}) = _CategoryAnalyticLoaderState;
|
}) = _CategoryAnalyticLoaderState;
|
||||||
|
|
||||||
factory CategoryAnalyticLoaderState.initial() => CategoryAnalyticLoaderState(
|
factory CategoryAnalyticLoaderState.initial() => CategoryAnalyticLoaderState(
|
||||||
categoryAnalytic: CategoryAnalytic.empty(),
|
categoryAnalytic: CategoryAnalytic.empty(),
|
||||||
failureOptionCategoryAnalytic: none(),
|
failureOptionCategoryAnalytic: none(),
|
||||||
|
dateFrom: DateTime.now(),
|
||||||
|
dateTo: DateTime.now(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../domain/analytic/analytic.dart';
|
||||||
|
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||||
|
|
||||||
|
part 'exclusive_summary_loader_event.dart';
|
||||||
|
part 'exclusive_summary_loader_state.dart';
|
||||||
|
part 'exclusive_summary_loader_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class ExclusiveSummaryLoaderBloc
|
||||||
|
extends Bloc<ExclusiveSummaryLoaderEvent, ExclusiveSummaryLoaderState> {
|
||||||
|
final IAnalyticRepository _repository;
|
||||||
|
|
||||||
|
ExclusiveSummaryLoaderBloc(this._repository)
|
||||||
|
: super(ExclusiveSummaryLoaderState.initial()) {
|
||||||
|
on<ExclusiveSummaryLoaderEvent>(_onEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onEvent(
|
||||||
|
ExclusiveSummaryLoaderEvent event,
|
||||||
|
Emitter<ExclusiveSummaryLoaderState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
rangeDateChanged: (e) async {
|
||||||
|
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||||
|
},
|
||||||
|
fetched: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isFetching: true,
|
||||||
|
failureOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final result = await _repository.getExclusiveSummary(
|
||||||
|
dateFrom: state.dateFrom,
|
||||||
|
dateTo: state.dateTo,
|
||||||
|
);
|
||||||
|
|
||||||
|
final data = result.fold(
|
||||||
|
(f) => state.copyWith(failureOption: optionOf(f)),
|
||||||
|
(summary) => state.copyWith(exclusiveSummary: summary),
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(data.copyWith(isFetching: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,617 @@
|
|||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'exclusive_summary_loader_bloc.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||||
|
);
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ExclusiveSummaryLoaderEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ExclusiveSummaryLoaderEventCopyWith<$Res> {
|
||||||
|
factory $ExclusiveSummaryLoaderEventCopyWith(
|
||||||
|
ExclusiveSummaryLoaderEvent value,
|
||||||
|
$Res Function(ExclusiveSummaryLoaderEvent) then,
|
||||||
|
) =
|
||||||
|
_$ExclusiveSummaryLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
ExclusiveSummaryLoaderEvent
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ExclusiveSummaryLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends ExclusiveSummaryLoaderEvent
|
||||||
|
>
|
||||||
|
implements $ExclusiveSummaryLoaderEventCopyWith<$Res> {
|
||||||
|
_$ExclusiveSummaryLoaderEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$RangeDateChangedImplCopyWith(
|
||||||
|
_$RangeDateChangedImpl value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) then,
|
||||||
|
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$ExclusiveSummaryLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||||
|
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl(
|
||||||
|
_$RangeDateChangedImpl _value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||||
|
return _then(
|
||||||
|
_$RangeDateChangedImpl(
|
||||||
|
null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||||
|
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ExclusiveSummaryLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RangeDateChangedImpl &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RangeDateChanged implements ExclusiveSummaryLoaderEvent {
|
||||||
|
const factory _RangeDateChanged(
|
||||||
|
final DateTime dateFrom,
|
||||||
|
final DateTime dateTo,
|
||||||
|
) = _$RangeDateChangedImpl;
|
||||||
|
|
||||||
|
DateTime get dateFrom;
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||||
|
factory _$$FetchedImplCopyWith(
|
||||||
|
_$FetchedImpl value,
|
||||||
|
$Res Function(_$FetchedImpl) then,
|
||||||
|
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$FetchedImplCopyWithImpl<$Res>
|
||||||
|
extends _$ExclusiveSummaryLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||||
|
implements _$$FetchedImplCopyWith<$Res> {
|
||||||
|
__$$FetchedImplCopyWithImpl(
|
||||||
|
_$FetchedImpl _value,
|
||||||
|
$Res Function(_$FetchedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$FetchedImpl implements _Fetched {
|
||||||
|
const _$FetchedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ExclusiveSummaryLoaderEvent.fetched()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
|
return fetched();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
|
return fetched?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return fetched?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Fetched implements ExclusiveSummaryLoaderEvent {
|
||||||
|
const factory _Fetched() = _$FetchedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ExclusiveSummaryLoaderState {
|
||||||
|
ExclusiveSummary get exclusiveSummary => throw _privateConstructorUsedError;
|
||||||
|
Option<AnalyticFailure> get failureOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$ExclusiveSummaryLoaderStateCopyWith<ExclusiveSummaryLoaderState>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ExclusiveSummaryLoaderStateCopyWith<$Res> {
|
||||||
|
factory $ExclusiveSummaryLoaderStateCopyWith(
|
||||||
|
ExclusiveSummaryLoaderState value,
|
||||||
|
$Res Function(ExclusiveSummaryLoaderState) then,
|
||||||
|
) =
|
||||||
|
_$ExclusiveSummaryLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
ExclusiveSummaryLoaderState
|
||||||
|
>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
ExclusiveSummary exclusiveSummary,
|
||||||
|
Option<AnalyticFailure> failureOption,
|
||||||
|
bool isFetching,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
});
|
||||||
|
|
||||||
|
$ExclusiveSummaryCopyWith<$Res> get exclusiveSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ExclusiveSummaryLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends ExclusiveSummaryLoaderState
|
||||||
|
>
|
||||||
|
implements $ExclusiveSummaryLoaderStateCopyWith<$Res> {
|
||||||
|
_$ExclusiveSummaryLoaderStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? exclusiveSummary = null,
|
||||||
|
Object? failureOption = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
exclusiveSummary: null == exclusiveSummary
|
||||||
|
? _value.exclusiveSummary
|
||||||
|
: exclusiveSummary // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ExclusiveSummary,
|
||||||
|
failureOption: null == failureOption
|
||||||
|
? _value.failureOption
|
||||||
|
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<AnalyticFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ExclusiveSummaryCopyWith<$Res> get exclusiveSummary {
|
||||||
|
return $ExclusiveSummaryCopyWith<$Res>(_value.exclusiveSummary, (value) {
|
||||||
|
return _then(_value.copyWith(exclusiveSummary: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ExclusiveSummaryLoaderStateImplCopyWith<$Res>
|
||||||
|
implements $ExclusiveSummaryLoaderStateCopyWith<$Res> {
|
||||||
|
factory _$$ExclusiveSummaryLoaderStateImplCopyWith(
|
||||||
|
_$ExclusiveSummaryLoaderStateImpl value,
|
||||||
|
$Res Function(_$ExclusiveSummaryLoaderStateImpl) then,
|
||||||
|
) = __$$ExclusiveSummaryLoaderStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
ExclusiveSummary exclusiveSummary,
|
||||||
|
Option<AnalyticFailure> failureOption,
|
||||||
|
bool isFetching,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$ExclusiveSummaryCopyWith<$Res> get exclusiveSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ExclusiveSummaryLoaderStateImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$ExclusiveSummaryLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
_$ExclusiveSummaryLoaderStateImpl
|
||||||
|
>
|
||||||
|
implements _$$ExclusiveSummaryLoaderStateImplCopyWith<$Res> {
|
||||||
|
__$$ExclusiveSummaryLoaderStateImplCopyWithImpl(
|
||||||
|
_$ExclusiveSummaryLoaderStateImpl _value,
|
||||||
|
$Res Function(_$ExclusiveSummaryLoaderStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? exclusiveSummary = null,
|
||||||
|
Object? failureOption = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$ExclusiveSummaryLoaderStateImpl(
|
||||||
|
exclusiveSummary: null == exclusiveSummary
|
||||||
|
? _value.exclusiveSummary
|
||||||
|
: exclusiveSummary // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ExclusiveSummary,
|
||||||
|
failureOption: null == failureOption
|
||||||
|
? _value.failureOption
|
||||||
|
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<AnalyticFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ExclusiveSummaryLoaderStateImpl
|
||||||
|
implements _ExclusiveSummaryLoaderState {
|
||||||
|
const _$ExclusiveSummaryLoaderStateImpl({
|
||||||
|
required this.exclusiveSummary,
|
||||||
|
required this.failureOption,
|
||||||
|
this.isFetching = false,
|
||||||
|
required this.dateFrom,
|
||||||
|
required this.dateTo,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final ExclusiveSummary exclusiveSummary;
|
||||||
|
@override
|
||||||
|
final Option<AnalyticFailure> failureOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isFetching;
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ExclusiveSummaryLoaderState(exclusiveSummary: $exclusiveSummary, failureOption: $failureOption, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ExclusiveSummaryLoaderStateImpl &&
|
||||||
|
(identical(other.exclusiveSummary, exclusiveSummary) ||
|
||||||
|
other.exclusiveSummary == exclusiveSummary) &&
|
||||||
|
(identical(other.failureOption, failureOption) ||
|
||||||
|
other.failureOption == failureOption) &&
|
||||||
|
(identical(other.isFetching, isFetching) ||
|
||||||
|
other.isFetching == isFetching) &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
exclusiveSummary,
|
||||||
|
failureOption,
|
||||||
|
isFetching,
|
||||||
|
dateFrom,
|
||||||
|
dateTo,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ExclusiveSummaryLoaderStateImplCopyWith<_$ExclusiveSummaryLoaderStateImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$ExclusiveSummaryLoaderStateImplCopyWithImpl<
|
||||||
|
_$ExclusiveSummaryLoaderStateImpl
|
||||||
|
>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ExclusiveSummaryLoaderState
|
||||||
|
implements ExclusiveSummaryLoaderState {
|
||||||
|
const factory _ExclusiveSummaryLoaderState({
|
||||||
|
required final ExclusiveSummary exclusiveSummary,
|
||||||
|
required final Option<AnalyticFailure> failureOption,
|
||||||
|
final bool isFetching,
|
||||||
|
required final DateTime dateFrom,
|
||||||
|
required final DateTime dateTo,
|
||||||
|
}) = _$ExclusiveSummaryLoaderStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
ExclusiveSummary get exclusiveSummary;
|
||||||
|
@override
|
||||||
|
Option<AnalyticFailure> get failureOption;
|
||||||
|
@override
|
||||||
|
bool get isFetching;
|
||||||
|
@override
|
||||||
|
DateTime get dateFrom;
|
||||||
|
@override
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of ExclusiveSummaryLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$ExclusiveSummaryLoaderStateImplCopyWith<_$ExclusiveSummaryLoaderStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
part of 'exclusive_summary_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryLoaderEvent with _$ExclusiveSummaryLoaderEvent {
|
||||||
|
const factory ExclusiveSummaryLoaderEvent.rangeDateChanged(
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
) = _RangeDateChanged;
|
||||||
|
|
||||||
|
const factory ExclusiveSummaryLoaderEvent.fetched() = _Fetched;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
part of 'exclusive_summary_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryLoaderState with _$ExclusiveSummaryLoaderState {
|
||||||
|
const factory ExclusiveSummaryLoaderState({
|
||||||
|
required ExclusiveSummary exclusiveSummary,
|
||||||
|
required Option<AnalyticFailure> failureOption,
|
||||||
|
@Default(false) bool isFetching,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
}) = _ExclusiveSummaryLoaderState;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryLoaderState.initial() {
|
||||||
|
final now = DateTime.now();
|
||||||
|
return ExclusiveSummaryLoaderState(
|
||||||
|
exclusiveSummary: ExclusiveSummary.empty(),
|
||||||
|
failureOption: none(),
|
||||||
|
dateFrom: DateTime(now.year, now.month, 1),
|
||||||
|
dateTo: DateTime(now.year, now.month + 1, 0),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,9 @@ class PaymentMethodAnalyticLoaderBloc
|
|||||||
Emitter<PaymentMethodAnalyticLoaderState> emit,
|
Emitter<PaymentMethodAnalyticLoaderState> emit,
|
||||||
) {
|
) {
|
||||||
return event.map(
|
return event.map(
|
||||||
|
rangeDateChanged: (e) async {
|
||||||
|
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||||
|
},
|
||||||
fetched: (e) async {
|
fetched: (e) async {
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
@@ -37,8 +40,8 @@ class PaymentMethodAnalyticLoaderBloc
|
|||||||
);
|
);
|
||||||
|
|
||||||
final result = await _repository.getPaymentMethod(
|
final result = await _repository.getPaymentMethod(
|
||||||
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
|
dateFrom: state.dateFrom,
|
||||||
dateTo: DateTime.now(),
|
dateTo: state.dateTo,
|
||||||
);
|
);
|
||||||
|
|
||||||
var data = result.fold(
|
var data = result.fold(
|
||||||
|
|||||||
@@ -19,27 +19,34 @@ final _privateConstructorUsedError = UnsupportedError(
|
|||||||
mixin _$PaymentMethodAnalyticLoaderEvent {
|
mixin _$PaymentMethodAnalyticLoaderEvent {
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
required TResult Function() fetched,
|
required TResult Function() fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult? Function()? fetched,
|
TResult? Function()? fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult Function()? fetched,
|
TResult Function()? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
required TResult Function(_Fetched value) fetched,
|
required TResult Function(_Fetched value) fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult? Function(_Fetched value)? fetched,
|
TResult? Function(_Fetched value)? fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult Function(_Fetched value)? fetched,
|
TResult Function(_Fetched value)? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@@ -74,6 +81,168 @@ class _$PaymentMethodAnalyticLoaderEventCopyWithImpl<
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$RangeDateChangedImplCopyWith(
|
||||||
|
_$RangeDateChangedImpl value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) then,
|
||||||
|
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$PaymentMethodAnalyticLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
_$RangeDateChangedImpl
|
||||||
|
>
|
||||||
|
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl(
|
||||||
|
_$RangeDateChangedImpl _value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of PaymentMethodAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||||
|
return _then(
|
||||||
|
_$RangeDateChangedImpl(
|
||||||
|
null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||||
|
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'PaymentMethodAnalyticLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RangeDateChangedImpl &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||||
|
|
||||||
|
/// Create a copy of PaymentMethodAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RangeDateChanged implements PaymentMethodAnalyticLoaderEvent {
|
||||||
|
const factory _RangeDateChanged(
|
||||||
|
final DateTime dateFrom,
|
||||||
|
final DateTime dateTo,
|
||||||
|
) = _$RangeDateChangedImpl;
|
||||||
|
|
||||||
|
DateTime get dateFrom;
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of PaymentMethodAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||||
factory _$$FetchedImplCopyWith(
|
factory _$$FetchedImplCopyWith(
|
||||||
@@ -116,19 +285,27 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
return fetched();
|
return fetched();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
return fetched?.call();
|
return fetched?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult Function()? fetched,
|
TResult Function()? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@@ -141,6 +318,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
required TResult Function(_Fetched value) fetched,
|
required TResult Function(_Fetched value) fetched,
|
||||||
}) {
|
}) {
|
||||||
return fetched(this);
|
return fetched(this);
|
||||||
@@ -149,6 +327,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult? Function(_Fetched value)? fetched,
|
TResult? Function(_Fetched value)? fetched,
|
||||||
}) {
|
}) {
|
||||||
return fetched?.call(this);
|
return fetched?.call(this);
|
||||||
@@ -157,6 +336,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult Function(_Fetched value)? fetched,
|
TResult Function(_Fetched value)? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@@ -178,6 +358,8 @@ mixin _$PaymentMethodAnalyticLoaderState {
|
|||||||
Option<AnalyticFailure> get failureOptionPaymentMethodAnalytic =>
|
Option<AnalyticFailure> get failureOptionPaymentMethodAnalytic =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
bool get isFetching => throw _privateConstructorUsedError;
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -201,6 +383,8 @@ abstract class $PaymentMethodAnalyticLoaderStateCopyWith<$Res> {
|
|||||||
PaymentMethodAnalytic paymentMethodAnalytic,
|
PaymentMethodAnalytic paymentMethodAnalytic,
|
||||||
Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
||||||
bool isFetching,
|
bool isFetching,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
$PaymentMethodAnalyticCopyWith<$Res> get paymentMethodAnalytic;
|
$PaymentMethodAnalyticCopyWith<$Res> get paymentMethodAnalytic;
|
||||||
@@ -227,6 +411,8 @@ class _$PaymentMethodAnalyticLoaderStateCopyWithImpl<
|
|||||||
Object? paymentMethodAnalytic = null,
|
Object? paymentMethodAnalytic = null,
|
||||||
Object? failureOptionPaymentMethodAnalytic = null,
|
Object? failureOptionPaymentMethodAnalytic = null,
|
||||||
Object? isFetching = null,
|
Object? isFetching = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_value.copyWith(
|
_value.copyWith(
|
||||||
@@ -243,6 +429,14 @@ class _$PaymentMethodAnalyticLoaderStateCopyWithImpl<
|
|||||||
? _value.isFetching
|
? _value.isFetching
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
)
|
)
|
||||||
as $Val,
|
as $Val,
|
||||||
);
|
);
|
||||||
@@ -274,6 +468,8 @@ abstract class _$$PaymentMethodAnalyticLoaderStateImplCopyWith<$Res>
|
|||||||
PaymentMethodAnalytic paymentMethodAnalytic,
|
PaymentMethodAnalytic paymentMethodAnalytic,
|
||||||
Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
||||||
bool isFetching,
|
bool isFetching,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -301,6 +497,8 @@ class __$$PaymentMethodAnalyticLoaderStateImplCopyWithImpl<$Res>
|
|||||||
Object? paymentMethodAnalytic = null,
|
Object? paymentMethodAnalytic = null,
|
||||||
Object? failureOptionPaymentMethodAnalytic = null,
|
Object? failureOptionPaymentMethodAnalytic = null,
|
||||||
Object? isFetching = null,
|
Object? isFetching = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_$PaymentMethodAnalyticLoaderStateImpl(
|
_$PaymentMethodAnalyticLoaderStateImpl(
|
||||||
@@ -317,6 +515,14 @@ class __$$PaymentMethodAnalyticLoaderStateImplCopyWithImpl<$Res>
|
|||||||
? _value.isFetching
|
? _value.isFetching
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -330,6 +536,8 @@ class _$PaymentMethodAnalyticLoaderStateImpl
|
|||||||
required this.paymentMethodAnalytic,
|
required this.paymentMethodAnalytic,
|
||||||
required this.failureOptionPaymentMethodAnalytic,
|
required this.failureOptionPaymentMethodAnalytic,
|
||||||
this.isFetching = false,
|
this.isFetching = false,
|
||||||
|
required this.dateFrom,
|
||||||
|
required this.dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -339,10 +547,14 @@ class _$PaymentMethodAnalyticLoaderStateImpl
|
|||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
final bool isFetching;
|
final bool isFetching;
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'PaymentMethodAnalyticLoaderState(paymentMethodAnalytic: $paymentMethodAnalytic, failureOptionPaymentMethodAnalytic: $failureOptionPaymentMethodAnalytic, isFetching: $isFetching)';
|
return 'PaymentMethodAnalyticLoaderState(paymentMethodAnalytic: $paymentMethodAnalytic, failureOptionPaymentMethodAnalytic: $failureOptionPaymentMethodAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -359,7 +571,10 @@ class _$PaymentMethodAnalyticLoaderStateImpl
|
|||||||
other.failureOptionPaymentMethodAnalytic ==
|
other.failureOptionPaymentMethodAnalytic ==
|
||||||
failureOptionPaymentMethodAnalytic) &&
|
failureOptionPaymentMethodAnalytic) &&
|
||||||
(identical(other.isFetching, isFetching) ||
|
(identical(other.isFetching, isFetching) ||
|
||||||
other.isFetching == isFetching));
|
other.isFetching == isFetching) &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -368,6 +583,8 @@ class _$PaymentMethodAnalyticLoaderStateImpl
|
|||||||
paymentMethodAnalytic,
|
paymentMethodAnalytic,
|
||||||
failureOptionPaymentMethodAnalytic,
|
failureOptionPaymentMethodAnalytic,
|
||||||
isFetching,
|
isFetching,
|
||||||
|
dateFrom,
|
||||||
|
dateTo,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||||
@@ -390,6 +607,8 @@ abstract class _PaymentMethodAnalyticLoaderState
|
|||||||
required final PaymentMethodAnalytic paymentMethodAnalytic,
|
required final PaymentMethodAnalytic paymentMethodAnalytic,
|
||||||
required final Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
required final Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
||||||
final bool isFetching,
|
final bool isFetching,
|
||||||
|
required final DateTime dateFrom,
|
||||||
|
required final DateTime dateTo,
|
||||||
}) = _$PaymentMethodAnalyticLoaderStateImpl;
|
}) = _$PaymentMethodAnalyticLoaderStateImpl;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -398,6 +617,10 @@ abstract class _PaymentMethodAnalyticLoaderState
|
|||||||
Option<AnalyticFailure> get failureOptionPaymentMethodAnalytic;
|
Option<AnalyticFailure> get failureOptionPaymentMethodAnalytic;
|
||||||
@override
|
@override
|
||||||
bool get isFetching;
|
bool get isFetching;
|
||||||
|
@override
|
||||||
|
DateTime get dateFrom;
|
||||||
|
@override
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@@ -2,5 +2,9 @@ part of 'payment_method_analytic_loader_bloc.dart';
|
|||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class PaymentMethodAnalyticLoaderEvent with _$PaymentMethodAnalyticLoaderEvent {
|
class PaymentMethodAnalyticLoaderEvent with _$PaymentMethodAnalyticLoaderEvent {
|
||||||
|
const factory PaymentMethodAnalyticLoaderEvent.rangeDateChanged(
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
) = _RangeDateChanged;
|
||||||
const factory PaymentMethodAnalyticLoaderEvent.fetched() = _Fetched;
|
const factory PaymentMethodAnalyticLoaderEvent.fetched() = _Fetched;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,15 @@ class PaymentMethodAnalyticLoaderState with _$PaymentMethodAnalyticLoaderState {
|
|||||||
required PaymentMethodAnalytic paymentMethodAnalytic,
|
required PaymentMethodAnalytic paymentMethodAnalytic,
|
||||||
required Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
required Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
||||||
@Default(false) bool isFetching,
|
@Default(false) bool isFetching,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
}) = _PaymentMethodAnalyticLoaderState;
|
}) = _PaymentMethodAnalyticLoaderState;
|
||||||
|
|
||||||
factory PaymentMethodAnalyticLoaderState.initial() =>
|
factory PaymentMethodAnalyticLoaderState.initial() =>
|
||||||
PaymentMethodAnalyticLoaderState(
|
PaymentMethodAnalyticLoaderState(
|
||||||
paymentMethodAnalytic: PaymentMethodAnalytic.empty(),
|
paymentMethodAnalytic: PaymentMethodAnalytic.empty(),
|
||||||
failureOptionPaymentMethodAnalytic: none(),
|
failureOptionPaymentMethodAnalytic: none(),
|
||||||
|
dateFrom: DateTime.now(),
|
||||||
|
dateTo: DateTime.now(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ProductAnalyticLoaderState with _$ProductAnalyticLoaderState {
|
|||||||
factory ProductAnalyticLoaderState.initial() => ProductAnalyticLoaderState(
|
factory ProductAnalyticLoaderState.initial() => ProductAnalyticLoaderState(
|
||||||
productAnalytic: ProductAnalytic.empty(),
|
productAnalytic: ProductAnalytic.empty(),
|
||||||
failureOptionProductAnalytic: none(),
|
failureOptionProductAnalytic: none(),
|
||||||
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
|
dateFrom: DateTime.now(),
|
||||||
dateTo: DateTime.now(),
|
dateTo: DateTime.now(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../domain/analytic/analytic.dart';
|
||||||
|
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||||
|
|
||||||
|
part 'profit_sharing_detail_loader_event.dart';
|
||||||
|
part 'profit_sharing_detail_loader_state.dart';
|
||||||
|
part 'profit_sharing_detail_loader_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class ProfitSharingDetailLoaderBloc
|
||||||
|
extends
|
||||||
|
Bloc<ProfitSharingDetailLoaderEvent, ProfitSharingDetailLoaderState> {
|
||||||
|
final IAnalyticRepository _repository;
|
||||||
|
|
||||||
|
ProfitSharingDetailLoaderBloc(this._repository)
|
||||||
|
: super(ProfitSharingDetailLoaderState.initial()) {
|
||||||
|
on<ProfitSharingDetailLoaderEvent>(_onProfitSharingDetailLoaderEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onProfitSharingDetailLoaderEvent(
|
||||||
|
ProfitSharingDetailLoaderEvent event,
|
||||||
|
Emitter<ProfitSharingDetailLoaderState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
expandedCategoryChanged: (e) async {
|
||||||
|
final isSame = state.expandedCategoryId == e.categoryId;
|
||||||
|
emit(state.copyWith(expandedCategoryId: isSame ? '' : e.categoryId));
|
||||||
|
},
|
||||||
|
fetched: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isFetching: true,
|
||||||
|
failureOption: none(),
|
||||||
|
parentCategoryId: e.parentCategoryId,
|
||||||
|
dateFrom: e.dateFrom,
|
||||||
|
dateTo: e.dateTo,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final result = await _repository.getProfitSharingDetail(
|
||||||
|
parentCategoryId: e.parentCategoryId,
|
||||||
|
dateFrom: e.dateFrom,
|
||||||
|
dateTo: e.dateTo,
|
||||||
|
);
|
||||||
|
|
||||||
|
final newState = result.fold(
|
||||||
|
(f) => state.copyWith(failureOption: optionOf(f)),
|
||||||
|
(detail) => state.copyWith(
|
||||||
|
detail: detail,
|
||||||
|
// Sub kategori pertama langsung terbuka supaya produknya kelihatan.
|
||||||
|
expandedCategoryId: detail.categories.isEmpty
|
||||||
|
? ''
|
||||||
|
: detail.categories.first.categoryId,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(newState.copyWith(isFetching: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,772 @@
|
|||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'profit_sharing_detail_loader_bloc.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||||
|
);
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ProfitSharingDetailLoaderEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)
|
||||||
|
fetched,
|
||||||
|
required TResult Function(String categoryId) expandedCategoryChanged,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)?
|
||||||
|
fetched,
|
||||||
|
TResult? Function(String categoryId)? expandedCategoryChanged,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)?
|
||||||
|
fetched,
|
||||||
|
TResult Function(String categoryId)? expandedCategoryChanged,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
required TResult Function(_ExpandedCategoryChanged value)
|
||||||
|
expandedCategoryChanged,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
TResult? Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
TResult Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ProfitSharingDetailLoaderEventCopyWith<$Res> {
|
||||||
|
factory $ProfitSharingDetailLoaderEventCopyWith(
|
||||||
|
ProfitSharingDetailLoaderEvent value,
|
||||||
|
$Res Function(ProfitSharingDetailLoaderEvent) then,
|
||||||
|
) =
|
||||||
|
_$ProfitSharingDetailLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
ProfitSharingDetailLoaderEvent
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ProfitSharingDetailLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends ProfitSharingDetailLoaderEvent
|
||||||
|
>
|
||||||
|
implements $ProfitSharingDetailLoaderEventCopyWith<$Res> {
|
||||||
|
_$ProfitSharingDetailLoaderEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||||
|
factory _$$FetchedImplCopyWith(
|
||||||
|
_$FetchedImpl value,
|
||||||
|
$Res Function(_$FetchedImpl) then,
|
||||||
|
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String parentCategoryId, DateTime dateFrom, DateTime dateTo});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$FetchedImplCopyWithImpl<$Res>
|
||||||
|
extends _$ProfitSharingDetailLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||||
|
implements _$$FetchedImplCopyWith<$Res> {
|
||||||
|
__$$FetchedImplCopyWithImpl(
|
||||||
|
_$FetchedImpl _value,
|
||||||
|
$Res Function(_$FetchedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? parentCategoryId = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$FetchedImpl(
|
||||||
|
parentCategoryId: null == parentCategoryId
|
||||||
|
? _value.parentCategoryId
|
||||||
|
: parentCategoryId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$FetchedImpl implements _Fetched {
|
||||||
|
const _$FetchedImpl({
|
||||||
|
required this.parentCategoryId,
|
||||||
|
required this.dateFrom,
|
||||||
|
required this.dateTo,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String parentCategoryId;
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProfitSharingDetailLoaderEvent.fetched(parentCategoryId: $parentCategoryId, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$FetchedImpl &&
|
||||||
|
(identical(other.parentCategoryId, parentCategoryId) ||
|
||||||
|
other.parentCategoryId == parentCategoryId) &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, parentCategoryId, dateFrom, dateTo);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$FetchedImplCopyWith<_$FetchedImpl> get copyWith =>
|
||||||
|
__$$FetchedImplCopyWithImpl<_$FetchedImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)
|
||||||
|
fetched,
|
||||||
|
required TResult Function(String categoryId) expandedCategoryChanged,
|
||||||
|
}) {
|
||||||
|
return fetched(parentCategoryId, dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)?
|
||||||
|
fetched,
|
||||||
|
TResult? Function(String categoryId)? expandedCategoryChanged,
|
||||||
|
}) {
|
||||||
|
return fetched?.call(parentCategoryId, dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)?
|
||||||
|
fetched,
|
||||||
|
TResult Function(String categoryId)? expandedCategoryChanged,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched(parentCategoryId, dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
required TResult Function(_ExpandedCategoryChanged value)
|
||||||
|
expandedCategoryChanged,
|
||||||
|
}) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
TResult? Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||||
|
}) {
|
||||||
|
return fetched?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
TResult Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Fetched implements ProfitSharingDetailLoaderEvent {
|
||||||
|
const factory _Fetched({
|
||||||
|
required final String parentCategoryId,
|
||||||
|
required final DateTime dateFrom,
|
||||||
|
required final DateTime dateTo,
|
||||||
|
}) = _$FetchedImpl;
|
||||||
|
|
||||||
|
String get parentCategoryId;
|
||||||
|
DateTime get dateFrom;
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$FetchedImplCopyWith<_$FetchedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ExpandedCategoryChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$ExpandedCategoryChangedImplCopyWith(
|
||||||
|
_$ExpandedCategoryChangedImpl value,
|
||||||
|
$Res Function(_$ExpandedCategoryChangedImpl) then,
|
||||||
|
) = __$$ExpandedCategoryChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String categoryId});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ExpandedCategoryChangedImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$ProfitSharingDetailLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
_$ExpandedCategoryChangedImpl
|
||||||
|
>
|
||||||
|
implements _$$ExpandedCategoryChangedImplCopyWith<$Res> {
|
||||||
|
__$$ExpandedCategoryChangedImplCopyWithImpl(
|
||||||
|
_$ExpandedCategoryChangedImpl _value,
|
||||||
|
$Res Function(_$ExpandedCategoryChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? categoryId = null}) {
|
||||||
|
return _then(
|
||||||
|
_$ExpandedCategoryChangedImpl(
|
||||||
|
null == categoryId
|
||||||
|
? _value.categoryId
|
||||||
|
: categoryId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ExpandedCategoryChangedImpl implements _ExpandedCategoryChanged {
|
||||||
|
const _$ExpandedCategoryChangedImpl(this.categoryId);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String categoryId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProfitSharingDetailLoaderEvent.expandedCategoryChanged(categoryId: $categoryId)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ExpandedCategoryChangedImpl &&
|
||||||
|
(identical(other.categoryId, categoryId) ||
|
||||||
|
other.categoryId == categoryId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, categoryId);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ExpandedCategoryChangedImplCopyWith<_$ExpandedCategoryChangedImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$ExpandedCategoryChangedImplCopyWithImpl<
|
||||||
|
_$ExpandedCategoryChangedImpl
|
||||||
|
>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)
|
||||||
|
fetched,
|
||||||
|
required TResult Function(String categoryId) expandedCategoryChanged,
|
||||||
|
}) {
|
||||||
|
return expandedCategoryChanged(categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)?
|
||||||
|
fetched,
|
||||||
|
TResult? Function(String categoryId)? expandedCategoryChanged,
|
||||||
|
}) {
|
||||||
|
return expandedCategoryChanged?.call(categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(
|
||||||
|
String parentCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
)?
|
||||||
|
fetched,
|
||||||
|
TResult Function(String categoryId)? expandedCategoryChanged,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (expandedCategoryChanged != null) {
|
||||||
|
return expandedCategoryChanged(categoryId);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
required TResult Function(_ExpandedCategoryChanged value)
|
||||||
|
expandedCategoryChanged,
|
||||||
|
}) {
|
||||||
|
return expandedCategoryChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
TResult? Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||||
|
}) {
|
||||||
|
return expandedCategoryChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
TResult Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (expandedCategoryChanged != null) {
|
||||||
|
return expandedCategoryChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ExpandedCategoryChanged
|
||||||
|
implements ProfitSharingDetailLoaderEvent {
|
||||||
|
const factory _ExpandedCategoryChanged(final String categoryId) =
|
||||||
|
_$ExpandedCategoryChangedImpl;
|
||||||
|
|
||||||
|
String get categoryId;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$ExpandedCategoryChangedImplCopyWith<_$ExpandedCategoryChangedImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ProfitSharingDetailLoaderState {
|
||||||
|
ProfitSharingDetail get detail => throw _privateConstructorUsedError;
|
||||||
|
Option<AnalyticFailure> get failureOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
String get parentCategoryId => throw _privateConstructorUsedError;
|
||||||
|
String get expandedCategoryId => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$ProfitSharingDetailLoaderStateCopyWith<ProfitSharingDetailLoaderState>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ProfitSharingDetailLoaderStateCopyWith<$Res> {
|
||||||
|
factory $ProfitSharingDetailLoaderStateCopyWith(
|
||||||
|
ProfitSharingDetailLoaderState value,
|
||||||
|
$Res Function(ProfitSharingDetailLoaderState) then,
|
||||||
|
) =
|
||||||
|
_$ProfitSharingDetailLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
ProfitSharingDetailLoaderState
|
||||||
|
>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
ProfitSharingDetail detail,
|
||||||
|
Option<AnalyticFailure> failureOption,
|
||||||
|
bool isFetching,
|
||||||
|
String parentCategoryId,
|
||||||
|
String expandedCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
});
|
||||||
|
|
||||||
|
$ProfitSharingDetailCopyWith<$Res> get detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ProfitSharingDetailLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends ProfitSharingDetailLoaderState
|
||||||
|
>
|
||||||
|
implements $ProfitSharingDetailLoaderStateCopyWith<$Res> {
|
||||||
|
_$ProfitSharingDetailLoaderStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? detail = null,
|
||||||
|
Object? failureOption = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
Object? parentCategoryId = null,
|
||||||
|
Object? expandedCategoryId = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
detail: null == detail
|
||||||
|
? _value.detail
|
||||||
|
: detail // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProfitSharingDetail,
|
||||||
|
failureOption: null == failureOption
|
||||||
|
? _value.failureOption
|
||||||
|
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<AnalyticFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
parentCategoryId: null == parentCategoryId
|
||||||
|
? _value.parentCategoryId
|
||||||
|
: parentCategoryId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
expandedCategoryId: null == expandedCategoryId
|
||||||
|
? _value.expandedCategoryId
|
||||||
|
: expandedCategoryId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ProfitSharingDetailCopyWith<$Res> get detail {
|
||||||
|
return $ProfitSharingDetailCopyWith<$Res>(_value.detail, (value) {
|
||||||
|
return _then(_value.copyWith(detail: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ProfitSharingDetailLoaderStateImplCopyWith<$Res>
|
||||||
|
implements $ProfitSharingDetailLoaderStateCopyWith<$Res> {
|
||||||
|
factory _$$ProfitSharingDetailLoaderStateImplCopyWith(
|
||||||
|
_$ProfitSharingDetailLoaderStateImpl value,
|
||||||
|
$Res Function(_$ProfitSharingDetailLoaderStateImpl) then,
|
||||||
|
) = __$$ProfitSharingDetailLoaderStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
ProfitSharingDetail detail,
|
||||||
|
Option<AnalyticFailure> failureOption,
|
||||||
|
bool isFetching,
|
||||||
|
String parentCategoryId,
|
||||||
|
String expandedCategoryId,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$ProfitSharingDetailCopyWith<$Res> get detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ProfitSharingDetailLoaderStateImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$ProfitSharingDetailLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
_$ProfitSharingDetailLoaderStateImpl
|
||||||
|
>
|
||||||
|
implements _$$ProfitSharingDetailLoaderStateImplCopyWith<$Res> {
|
||||||
|
__$$ProfitSharingDetailLoaderStateImplCopyWithImpl(
|
||||||
|
_$ProfitSharingDetailLoaderStateImpl _value,
|
||||||
|
$Res Function(_$ProfitSharingDetailLoaderStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? detail = null,
|
||||||
|
Object? failureOption = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
Object? parentCategoryId = null,
|
||||||
|
Object? expandedCategoryId = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$ProfitSharingDetailLoaderStateImpl(
|
||||||
|
detail: null == detail
|
||||||
|
? _value.detail
|
||||||
|
: detail // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProfitSharingDetail,
|
||||||
|
failureOption: null == failureOption
|
||||||
|
? _value.failureOption
|
||||||
|
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<AnalyticFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
parentCategoryId: null == parentCategoryId
|
||||||
|
? _value.parentCategoryId
|
||||||
|
: parentCategoryId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
expandedCategoryId: null == expandedCategoryId
|
||||||
|
? _value.expandedCategoryId
|
||||||
|
: expandedCategoryId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ProfitSharingDetailLoaderStateImpl
|
||||||
|
extends _ProfitSharingDetailLoaderState {
|
||||||
|
const _$ProfitSharingDetailLoaderStateImpl({
|
||||||
|
required this.detail,
|
||||||
|
required this.failureOption,
|
||||||
|
this.isFetching = false,
|
||||||
|
this.parentCategoryId = '',
|
||||||
|
this.expandedCategoryId = '',
|
||||||
|
required this.dateFrom,
|
||||||
|
required this.dateTo,
|
||||||
|
}) : super._();
|
||||||
|
|
||||||
|
@override
|
||||||
|
final ProfitSharingDetail detail;
|
||||||
|
@override
|
||||||
|
final Option<AnalyticFailure> failureOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isFetching;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final String parentCategoryId;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final String expandedCategoryId;
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProfitSharingDetailLoaderState(detail: $detail, failureOption: $failureOption, isFetching: $isFetching, parentCategoryId: $parentCategoryId, expandedCategoryId: $expandedCategoryId, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ProfitSharingDetailLoaderStateImpl &&
|
||||||
|
(identical(other.detail, detail) || other.detail == detail) &&
|
||||||
|
(identical(other.failureOption, failureOption) ||
|
||||||
|
other.failureOption == failureOption) &&
|
||||||
|
(identical(other.isFetching, isFetching) ||
|
||||||
|
other.isFetching == isFetching) &&
|
||||||
|
(identical(other.parentCategoryId, parentCategoryId) ||
|
||||||
|
other.parentCategoryId == parentCategoryId) &&
|
||||||
|
(identical(other.expandedCategoryId, expandedCategoryId) ||
|
||||||
|
other.expandedCategoryId == expandedCategoryId) &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
detail,
|
||||||
|
failureOption,
|
||||||
|
isFetching,
|
||||||
|
parentCategoryId,
|
||||||
|
expandedCategoryId,
|
||||||
|
dateFrom,
|
||||||
|
dateTo,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ProfitSharingDetailLoaderStateImplCopyWith<
|
||||||
|
_$ProfitSharingDetailLoaderStateImpl
|
||||||
|
>
|
||||||
|
get copyWith =>
|
||||||
|
__$$ProfitSharingDetailLoaderStateImplCopyWithImpl<
|
||||||
|
_$ProfitSharingDetailLoaderStateImpl
|
||||||
|
>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ProfitSharingDetailLoaderState
|
||||||
|
extends ProfitSharingDetailLoaderState {
|
||||||
|
const factory _ProfitSharingDetailLoaderState({
|
||||||
|
required final ProfitSharingDetail detail,
|
||||||
|
required final Option<AnalyticFailure> failureOption,
|
||||||
|
final bool isFetching,
|
||||||
|
final String parentCategoryId,
|
||||||
|
final String expandedCategoryId,
|
||||||
|
required final DateTime dateFrom,
|
||||||
|
required final DateTime dateTo,
|
||||||
|
}) = _$ProfitSharingDetailLoaderStateImpl;
|
||||||
|
const _ProfitSharingDetailLoaderState._() : super._();
|
||||||
|
|
||||||
|
@override
|
||||||
|
ProfitSharingDetail get detail;
|
||||||
|
@override
|
||||||
|
Option<AnalyticFailure> get failureOption;
|
||||||
|
@override
|
||||||
|
bool get isFetching;
|
||||||
|
@override
|
||||||
|
String get parentCategoryId;
|
||||||
|
@override
|
||||||
|
String get expandedCategoryId;
|
||||||
|
@override
|
||||||
|
DateTime get dateFrom;
|
||||||
|
@override
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingDetailLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$ProfitSharingDetailLoaderStateImplCopyWith<
|
||||||
|
_$ProfitSharingDetailLoaderStateImpl
|
||||||
|
>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
part of 'profit_sharing_detail_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingDetailLoaderEvent with _$ProfitSharingDetailLoaderEvent {
|
||||||
|
const factory ProfitSharingDetailLoaderEvent.fetched({
|
||||||
|
required String parentCategoryId,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
}) = _Fetched;
|
||||||
|
|
||||||
|
/// Buka/tutup daftar produk pada satu sub kategori.
|
||||||
|
const factory ProfitSharingDetailLoaderEvent.expandedCategoryChanged(
|
||||||
|
String categoryId,
|
||||||
|
) = _ExpandedCategoryChanged;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
part of 'profit_sharing_detail_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingDetailLoaderState with _$ProfitSharingDetailLoaderState {
|
||||||
|
const ProfitSharingDetailLoaderState._();
|
||||||
|
|
||||||
|
const factory ProfitSharingDetailLoaderState({
|
||||||
|
required ProfitSharingDetail detail,
|
||||||
|
required Option<AnalyticFailure> failureOption,
|
||||||
|
@Default(false) bool isFetching,
|
||||||
|
@Default('') String parentCategoryId,
|
||||||
|
@Default('') String expandedCategoryId,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
}) = _ProfitSharingDetailLoaderState;
|
||||||
|
|
||||||
|
factory ProfitSharingDetailLoaderState.initial() {
|
||||||
|
final now = DateTime.now();
|
||||||
|
return ProfitSharingDetailLoaderState(
|
||||||
|
detail: ProfitSharingDetail.empty(),
|
||||||
|
failureOption: none(),
|
||||||
|
dateFrom: DateTime(now.year, now.month, 1),
|
||||||
|
dateTo: DateTime(now.year, now.month + 1, 0),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isExpanded(String categoryId) => expandedCategoryId == categoryId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../domain/analytic/analytic.dart';
|
||||||
|
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||||
|
|
||||||
|
part 'profit_sharing_loader_event.dart';
|
||||||
|
part 'profit_sharing_loader_state.dart';
|
||||||
|
part 'profit_sharing_loader_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class ProfitSharingLoaderBloc
|
||||||
|
extends Bloc<ProfitSharingLoaderEvent, ProfitSharingLoaderState> {
|
||||||
|
final IAnalyticRepository _repository;
|
||||||
|
|
||||||
|
ProfitSharingLoaderBloc(this._repository)
|
||||||
|
: super(ProfitSharingLoaderState.initial()) {
|
||||||
|
on<ProfitSharingLoaderEvent>(_onProfitSharingLoaderEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onProfitSharingLoaderEvent(
|
||||||
|
ProfitSharingLoaderEvent event,
|
||||||
|
Emitter<ProfitSharingLoaderState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
rangeDateChanged: (e) async {
|
||||||
|
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||||
|
},
|
||||||
|
periodTypeChanged: (e) async {
|
||||||
|
emit(state.copyWith(periodType: e.periodType));
|
||||||
|
},
|
||||||
|
fetched: (e) async {
|
||||||
|
emit(state.copyWith(isFetching: true, failureOption: none()));
|
||||||
|
|
||||||
|
final result = await _repository.getProfitSharing(
|
||||||
|
dateFrom: state.dateFrom,
|
||||||
|
dateTo: state.dateTo,
|
||||||
|
);
|
||||||
|
|
||||||
|
final newState = result.fold(
|
||||||
|
(f) => state.copyWith(failureOption: optionOf(f)),
|
||||||
|
(profitSharing) => state.copyWith(profitSharing: profitSharing),
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(newState.copyWith(isFetching: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,807 @@
|
|||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'profit_sharing_loader_bloc.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||||
|
);
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ProfitSharingLoaderEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function(ProfitSharingPeriodType periodType)
|
||||||
|
periodTypeChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function(ProfitSharingPeriodType periodType)? periodTypeChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function(ProfitSharingPeriodType periodType)? periodTypeChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_PeriodTypeChanged value) periodTypeChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_PeriodTypeChanged value)? periodTypeChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_PeriodTypeChanged value)? periodTypeChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ProfitSharingLoaderEventCopyWith<$Res> {
|
||||||
|
factory $ProfitSharingLoaderEventCopyWith(
|
||||||
|
ProfitSharingLoaderEvent value,
|
||||||
|
$Res Function(ProfitSharingLoaderEvent) then,
|
||||||
|
) = _$ProfitSharingLoaderEventCopyWithImpl<$Res, ProfitSharingLoaderEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ProfitSharingLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends ProfitSharingLoaderEvent
|
||||||
|
>
|
||||||
|
implements $ProfitSharingLoaderEventCopyWith<$Res> {
|
||||||
|
_$ProfitSharingLoaderEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$RangeDateChangedImplCopyWith(
|
||||||
|
_$RangeDateChangedImpl value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) then,
|
||||||
|
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$ProfitSharingLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||||
|
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl(
|
||||||
|
_$RangeDateChangedImpl _value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||||
|
return _then(
|
||||||
|
_$RangeDateChangedImpl(
|
||||||
|
null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||||
|
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProfitSharingLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RangeDateChangedImpl &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function(ProfitSharingPeriodType periodType)
|
||||||
|
periodTypeChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function(ProfitSharingPeriodType periodType)? periodTypeChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function(ProfitSharingPeriodType periodType)? periodTypeChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_PeriodTypeChanged value) periodTypeChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_PeriodTypeChanged value)? periodTypeChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_PeriodTypeChanged value)? periodTypeChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RangeDateChanged implements ProfitSharingLoaderEvent {
|
||||||
|
const factory _RangeDateChanged(
|
||||||
|
final DateTime dateFrom,
|
||||||
|
final DateTime dateTo,
|
||||||
|
) = _$RangeDateChangedImpl;
|
||||||
|
|
||||||
|
DateTime get dateFrom;
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$PeriodTypeChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$PeriodTypeChangedImplCopyWith(
|
||||||
|
_$PeriodTypeChangedImpl value,
|
||||||
|
$Res Function(_$PeriodTypeChangedImpl) then,
|
||||||
|
) = __$$PeriodTypeChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({ProfitSharingPeriodType periodType});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$PeriodTypeChangedImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$ProfitSharingLoaderEventCopyWithImpl<$Res, _$PeriodTypeChangedImpl>
|
||||||
|
implements _$$PeriodTypeChangedImplCopyWith<$Res> {
|
||||||
|
__$$PeriodTypeChangedImplCopyWithImpl(
|
||||||
|
_$PeriodTypeChangedImpl _value,
|
||||||
|
$Res Function(_$PeriodTypeChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? periodType = null}) {
|
||||||
|
return _then(
|
||||||
|
_$PeriodTypeChangedImpl(
|
||||||
|
null == periodType
|
||||||
|
? _value.periodType
|
||||||
|
: periodType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProfitSharingPeriodType,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$PeriodTypeChangedImpl implements _PeriodTypeChanged {
|
||||||
|
const _$PeriodTypeChangedImpl(this.periodType);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final ProfitSharingPeriodType periodType;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProfitSharingLoaderEvent.periodTypeChanged(periodType: $periodType)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$PeriodTypeChangedImpl &&
|
||||||
|
(identical(other.periodType, periodType) ||
|
||||||
|
other.periodType == periodType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, periodType);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$PeriodTypeChangedImplCopyWith<_$PeriodTypeChangedImpl> get copyWith =>
|
||||||
|
__$$PeriodTypeChangedImplCopyWithImpl<_$PeriodTypeChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function(ProfitSharingPeriodType periodType)
|
||||||
|
periodTypeChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
|
return periodTypeChanged(periodType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function(ProfitSharingPeriodType periodType)? periodTypeChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
|
return periodTypeChanged?.call(periodType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function(ProfitSharingPeriodType periodType)? periodTypeChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (periodTypeChanged != null) {
|
||||||
|
return periodTypeChanged(periodType);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_PeriodTypeChanged value) periodTypeChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return periodTypeChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_PeriodTypeChanged value)? periodTypeChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return periodTypeChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_PeriodTypeChanged value)? periodTypeChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (periodTypeChanged != null) {
|
||||||
|
return periodTypeChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _PeriodTypeChanged implements ProfitSharingLoaderEvent {
|
||||||
|
const factory _PeriodTypeChanged(final ProfitSharingPeriodType periodType) =
|
||||||
|
_$PeriodTypeChangedImpl;
|
||||||
|
|
||||||
|
ProfitSharingPeriodType get periodType;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$PeriodTypeChangedImplCopyWith<_$PeriodTypeChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||||
|
factory _$$FetchedImplCopyWith(
|
||||||
|
_$FetchedImpl value,
|
||||||
|
$Res Function(_$FetchedImpl) then,
|
||||||
|
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$FetchedImplCopyWithImpl<$Res>
|
||||||
|
extends _$ProfitSharingLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||||
|
implements _$$FetchedImplCopyWith<$Res> {
|
||||||
|
__$$FetchedImplCopyWithImpl(
|
||||||
|
_$FetchedImpl _value,
|
||||||
|
$Res Function(_$FetchedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$FetchedImpl implements _Fetched {
|
||||||
|
const _$FetchedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProfitSharingLoaderEvent.fetched()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function(ProfitSharingPeriodType periodType)
|
||||||
|
periodTypeChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
|
return fetched();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function(ProfitSharingPeriodType periodType)? periodTypeChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
|
return fetched?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function(ProfitSharingPeriodType periodType)? periodTypeChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_PeriodTypeChanged value) periodTypeChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_PeriodTypeChanged value)? periodTypeChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return fetched?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_PeriodTypeChanged value)? periodTypeChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Fetched implements ProfitSharingLoaderEvent {
|
||||||
|
const factory _Fetched() = _$FetchedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ProfitSharingLoaderState {
|
||||||
|
ProfitSharing get profitSharing => throw _privateConstructorUsedError;
|
||||||
|
Option<AnalyticFailure> get failureOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
ProfitSharingPeriodType get periodType => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$ProfitSharingLoaderStateCopyWith<ProfitSharingLoaderState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ProfitSharingLoaderStateCopyWith<$Res> {
|
||||||
|
factory $ProfitSharingLoaderStateCopyWith(
|
||||||
|
ProfitSharingLoaderState value,
|
||||||
|
$Res Function(ProfitSharingLoaderState) then,
|
||||||
|
) = _$ProfitSharingLoaderStateCopyWithImpl<$Res, ProfitSharingLoaderState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
ProfitSharing profitSharing,
|
||||||
|
Option<AnalyticFailure> failureOption,
|
||||||
|
bool isFetching,
|
||||||
|
ProfitSharingPeriodType periodType,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
});
|
||||||
|
|
||||||
|
$ProfitSharingCopyWith<$Res> get profitSharing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ProfitSharingLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends ProfitSharingLoaderState
|
||||||
|
>
|
||||||
|
implements $ProfitSharingLoaderStateCopyWith<$Res> {
|
||||||
|
_$ProfitSharingLoaderStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? profitSharing = null,
|
||||||
|
Object? failureOption = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
Object? periodType = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
profitSharing: null == profitSharing
|
||||||
|
? _value.profitSharing
|
||||||
|
: profitSharing // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProfitSharing,
|
||||||
|
failureOption: null == failureOption
|
||||||
|
? _value.failureOption
|
||||||
|
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<AnalyticFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
periodType: null == periodType
|
||||||
|
? _value.periodType
|
||||||
|
: periodType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProfitSharingPeriodType,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ProfitSharingCopyWith<$Res> get profitSharing {
|
||||||
|
return $ProfitSharingCopyWith<$Res>(_value.profitSharing, (value) {
|
||||||
|
return _then(_value.copyWith(profitSharing: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ProfitSharingLoaderStateImplCopyWith<$Res>
|
||||||
|
implements $ProfitSharingLoaderStateCopyWith<$Res> {
|
||||||
|
factory _$$ProfitSharingLoaderStateImplCopyWith(
|
||||||
|
_$ProfitSharingLoaderStateImpl value,
|
||||||
|
$Res Function(_$ProfitSharingLoaderStateImpl) then,
|
||||||
|
) = __$$ProfitSharingLoaderStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
ProfitSharing profitSharing,
|
||||||
|
Option<AnalyticFailure> failureOption,
|
||||||
|
bool isFetching,
|
||||||
|
ProfitSharingPeriodType periodType,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$ProfitSharingCopyWith<$Res> get profitSharing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ProfitSharingLoaderStateImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$ProfitSharingLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
_$ProfitSharingLoaderStateImpl
|
||||||
|
>
|
||||||
|
implements _$$ProfitSharingLoaderStateImplCopyWith<$Res> {
|
||||||
|
__$$ProfitSharingLoaderStateImplCopyWithImpl(
|
||||||
|
_$ProfitSharingLoaderStateImpl _value,
|
||||||
|
$Res Function(_$ProfitSharingLoaderStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? profitSharing = null,
|
||||||
|
Object? failureOption = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
Object? periodType = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$ProfitSharingLoaderStateImpl(
|
||||||
|
profitSharing: null == profitSharing
|
||||||
|
? _value.profitSharing
|
||||||
|
: profitSharing // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProfitSharing,
|
||||||
|
failureOption: null == failureOption
|
||||||
|
? _value.failureOption
|
||||||
|
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<AnalyticFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
periodType: null == periodType
|
||||||
|
? _value.periodType
|
||||||
|
: periodType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProfitSharingPeriodType,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ProfitSharingLoaderStateImpl extends _ProfitSharingLoaderState {
|
||||||
|
const _$ProfitSharingLoaderStateImpl({
|
||||||
|
required this.profitSharing,
|
||||||
|
required this.failureOption,
|
||||||
|
this.isFetching = false,
|
||||||
|
this.periodType = ProfitSharingPeriodType.weekly,
|
||||||
|
required this.dateFrom,
|
||||||
|
required this.dateTo,
|
||||||
|
}) : super._();
|
||||||
|
|
||||||
|
@override
|
||||||
|
final ProfitSharing profitSharing;
|
||||||
|
@override
|
||||||
|
final Option<AnalyticFailure> failureOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isFetching;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final ProfitSharingPeriodType periodType;
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProfitSharingLoaderState(profitSharing: $profitSharing, failureOption: $failureOption, isFetching: $isFetching, periodType: $periodType, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ProfitSharingLoaderStateImpl &&
|
||||||
|
(identical(other.profitSharing, profitSharing) ||
|
||||||
|
other.profitSharing == profitSharing) &&
|
||||||
|
(identical(other.failureOption, failureOption) ||
|
||||||
|
other.failureOption == failureOption) &&
|
||||||
|
(identical(other.isFetching, isFetching) ||
|
||||||
|
other.isFetching == isFetching) &&
|
||||||
|
(identical(other.periodType, periodType) ||
|
||||||
|
other.periodType == periodType) &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
profitSharing,
|
||||||
|
failureOption,
|
||||||
|
isFetching,
|
||||||
|
periodType,
|
||||||
|
dateFrom,
|
||||||
|
dateTo,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ProfitSharingLoaderStateImplCopyWith<_$ProfitSharingLoaderStateImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$ProfitSharingLoaderStateImplCopyWithImpl<
|
||||||
|
_$ProfitSharingLoaderStateImpl
|
||||||
|
>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ProfitSharingLoaderState extends ProfitSharingLoaderState {
|
||||||
|
const factory _ProfitSharingLoaderState({
|
||||||
|
required final ProfitSharing profitSharing,
|
||||||
|
required final Option<AnalyticFailure> failureOption,
|
||||||
|
final bool isFetching,
|
||||||
|
final ProfitSharingPeriodType periodType,
|
||||||
|
required final DateTime dateFrom,
|
||||||
|
required final DateTime dateTo,
|
||||||
|
}) = _$ProfitSharingLoaderStateImpl;
|
||||||
|
const _ProfitSharingLoaderState._() : super._();
|
||||||
|
|
||||||
|
@override
|
||||||
|
ProfitSharing get profitSharing;
|
||||||
|
@override
|
||||||
|
Option<AnalyticFailure> get failureOption;
|
||||||
|
@override
|
||||||
|
bool get isFetching;
|
||||||
|
@override
|
||||||
|
ProfitSharingPeriodType get periodType;
|
||||||
|
@override
|
||||||
|
DateTime get dateFrom;
|
||||||
|
@override
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of ProfitSharingLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$ProfitSharingLoaderStateImplCopyWith<_$ProfitSharingLoaderStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
part of 'profit_sharing_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingLoaderEvent with _$ProfitSharingLoaderEvent {
|
||||||
|
const factory ProfitSharingLoaderEvent.rangeDateChanged(
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
) = _RangeDateChanged;
|
||||||
|
const factory ProfitSharingLoaderEvent.periodTypeChanged(
|
||||||
|
ProfitSharingPeriodType periodType,
|
||||||
|
) = _PeriodTypeChanged;
|
||||||
|
const factory ProfitSharingLoaderEvent.fetched() = _Fetched;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
part of 'profit_sharing_loader_bloc.dart';
|
||||||
|
|
||||||
|
/// Tampilan rincian bagi hasil: per minggu atau per bulan.
|
||||||
|
enum ProfitSharingPeriodType { weekly, monthly }
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingLoaderState with _$ProfitSharingLoaderState {
|
||||||
|
const ProfitSharingLoaderState._();
|
||||||
|
|
||||||
|
const factory ProfitSharingLoaderState({
|
||||||
|
required ProfitSharing profitSharing,
|
||||||
|
required Option<AnalyticFailure> failureOption,
|
||||||
|
@Default(false) bool isFetching,
|
||||||
|
@Default(ProfitSharingPeriodType.weekly) ProfitSharingPeriodType periodType,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
}) = _ProfitSharingLoaderState;
|
||||||
|
|
||||||
|
factory ProfitSharingLoaderState.initial() {
|
||||||
|
final now = DateTime.now();
|
||||||
|
return ProfitSharingLoaderState(
|
||||||
|
profitSharing: ProfitSharing.empty(),
|
||||||
|
failureOption: none(),
|
||||||
|
dateFrom: DateTime(now.year, now.month, 1),
|
||||||
|
dateTo: DateTime(now.year, now.month + 1, 0),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Baris periode sesuai tab yang dipilih, periode kosong disembunyikan.
|
||||||
|
List<ProfitSharingPeriod> get periods {
|
||||||
|
final budget = profitSharing.budget;
|
||||||
|
final list = periodType == ProfitSharingPeriodType.weekly
|
||||||
|
? budget.weekly
|
||||||
|
: budget.monthly;
|
||||||
|
return list.where((e) => e.hasRevenue).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@ class PurchasingAnalyticLoaderBloc
|
|||||||
dateFrom: state.dateFrom,
|
dateFrom: state.dateFrom,
|
||||||
dateTo: state.dateTo,
|
dateTo: state.dateTo,
|
||||||
outletId: state.outletId,
|
outletId: state.outletId,
|
||||||
|
groupBy: state.groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
final newState = result.fold(
|
final newState = result.fold(
|
||||||
|
|||||||
@@ -529,6 +529,7 @@ mixin _$PurchasingAnalyticLoaderState {
|
|||||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||||
String? get outletId => throw _privateConstructorUsedError;
|
String? get outletId => throw _privateConstructorUsedError;
|
||||||
|
String get groupBy => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Create a copy of PurchasingAnalyticLoaderState
|
/// Create a copy of PurchasingAnalyticLoaderState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -555,6 +556,7 @@ abstract class $PurchasingAnalyticLoaderStateCopyWith<$Res> {
|
|||||||
DateTime dateFrom,
|
DateTime dateFrom,
|
||||||
DateTime dateTo,
|
DateTime dateTo,
|
||||||
String? outletId,
|
String? outletId,
|
||||||
|
String groupBy,
|
||||||
});
|
});
|
||||||
|
|
||||||
$PurchasingAnalyticCopyWith<$Res> get purchasing;
|
$PurchasingAnalyticCopyWith<$Res> get purchasing;
|
||||||
@@ -584,6 +586,7 @@ class _$PurchasingAnalyticLoaderStateCopyWithImpl<
|
|||||||
Object? dateFrom = null,
|
Object? dateFrom = null,
|
||||||
Object? dateTo = null,
|
Object? dateTo = null,
|
||||||
Object? outletId = freezed,
|
Object? outletId = freezed,
|
||||||
|
Object? groupBy = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_value.copyWith(
|
_value.copyWith(
|
||||||
@@ -611,6 +614,10 @@ class _$PurchasingAnalyticLoaderStateCopyWithImpl<
|
|||||||
? _value.outletId
|
? _value.outletId
|
||||||
: outletId // ignore: cast_nullable_to_non_nullable
|
: outletId // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
|
groupBy: null == groupBy
|
||||||
|
? _value.groupBy
|
||||||
|
: groupBy // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
)
|
)
|
||||||
as $Val,
|
as $Val,
|
||||||
);
|
);
|
||||||
@@ -643,6 +650,7 @@ abstract class _$$PurchasingAnalyticLoaderStateImplCopyWith<$Res>
|
|||||||
DateTime dateFrom,
|
DateTime dateFrom,
|
||||||
DateTime dateTo,
|
DateTime dateTo,
|
||||||
String? outletId,
|
String? outletId,
|
||||||
|
String groupBy,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -673,6 +681,7 @@ class __$$PurchasingAnalyticLoaderStateImplCopyWithImpl<$Res>
|
|||||||
Object? dateFrom = null,
|
Object? dateFrom = null,
|
||||||
Object? dateTo = null,
|
Object? dateTo = null,
|
||||||
Object? outletId = freezed,
|
Object? outletId = freezed,
|
||||||
|
Object? groupBy = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_$PurchasingAnalyticLoaderStateImpl(
|
_$PurchasingAnalyticLoaderStateImpl(
|
||||||
@@ -700,6 +709,10 @@ class __$$PurchasingAnalyticLoaderStateImplCopyWithImpl<$Res>
|
|||||||
? _value.outletId
|
? _value.outletId
|
||||||
: outletId // ignore: cast_nullable_to_non_nullable
|
: outletId // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
|
groupBy: null == groupBy
|
||||||
|
? _value.groupBy
|
||||||
|
: groupBy // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -716,6 +729,7 @@ class _$PurchasingAnalyticLoaderStateImpl
|
|||||||
required this.dateFrom,
|
required this.dateFrom,
|
||||||
required this.dateTo,
|
required this.dateTo,
|
||||||
this.outletId,
|
this.outletId,
|
||||||
|
this.groupBy = 'day',
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -731,10 +745,13 @@ class _$PurchasingAnalyticLoaderStateImpl
|
|||||||
final DateTime dateTo;
|
final DateTime dateTo;
|
||||||
@override
|
@override
|
||||||
final String? outletId;
|
final String? outletId;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final String groupBy;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'PurchasingAnalyticLoaderState(purchasing: $purchasing, failureOptionPurchasing: $failureOptionPurchasing, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo, outletId: $outletId)';
|
return 'PurchasingAnalyticLoaderState(purchasing: $purchasing, failureOptionPurchasing: $failureOptionPurchasing, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo, outletId: $outletId, groupBy: $groupBy)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -755,7 +772,8 @@ class _$PurchasingAnalyticLoaderStateImpl
|
|||||||
other.dateFrom == dateFrom) &&
|
other.dateFrom == dateFrom) &&
|
||||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo) &&
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo) &&
|
||||||
(identical(other.outletId, outletId) ||
|
(identical(other.outletId, outletId) ||
|
||||||
other.outletId == outletId));
|
other.outletId == outletId) &&
|
||||||
|
(identical(other.groupBy, groupBy) || other.groupBy == groupBy));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -767,6 +785,7 @@ class _$PurchasingAnalyticLoaderStateImpl
|
|||||||
dateFrom,
|
dateFrom,
|
||||||
dateTo,
|
dateTo,
|
||||||
outletId,
|
outletId,
|
||||||
|
groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Create a copy of PurchasingAnalyticLoaderState
|
/// Create a copy of PurchasingAnalyticLoaderState
|
||||||
@@ -792,6 +811,7 @@ abstract class _PurchasingAnalyticLoaderState
|
|||||||
required final DateTime dateFrom,
|
required final DateTime dateFrom,
|
||||||
required final DateTime dateTo,
|
required final DateTime dateTo,
|
||||||
final String? outletId,
|
final String? outletId,
|
||||||
|
final String groupBy,
|
||||||
}) = _$PurchasingAnalyticLoaderStateImpl;
|
}) = _$PurchasingAnalyticLoaderStateImpl;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -806,6 +826,8 @@ abstract class _PurchasingAnalyticLoaderState
|
|||||||
DateTime get dateTo;
|
DateTime get dateTo;
|
||||||
@override
|
@override
|
||||||
String? get outletId;
|
String? get outletId;
|
||||||
|
@override
|
||||||
|
String get groupBy;
|
||||||
|
|
||||||
/// Create a copy of PurchasingAnalyticLoaderState
|
/// Create a copy of PurchasingAnalyticLoaderState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class PurchasingAnalyticLoaderState with _$PurchasingAnalyticLoaderState {
|
|||||||
required DateTime dateFrom,
|
required DateTime dateFrom,
|
||||||
required DateTime dateTo,
|
required DateTime dateTo,
|
||||||
String? outletId,
|
String? outletId,
|
||||||
|
@Default('day') String groupBy,
|
||||||
}) = _PurchasingAnalyticLoaderState;
|
}) = _PurchasingAnalyticLoaderState;
|
||||||
|
|
||||||
factory PurchasingAnalyticLoaderState.initial() =>
|
factory PurchasingAnalyticLoaderState.initial() =>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class SalesLoaderState with _$SalesLoaderState {
|
|||||||
factory SalesLoaderState.initial() => SalesLoaderState(
|
factory SalesLoaderState.initial() => SalesLoaderState(
|
||||||
sales: SalesAnalytic.empty(),
|
sales: SalesAnalytic.empty(),
|
||||||
failureOptionSales: none(),
|
failureOptionSales: none(),
|
||||||
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
|
dateFrom: DateTime.now(),
|
||||||
dateTo: DateTime.now(),
|
dateTo: DateTime.now(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ class OrderLoaderState with _$OrderLoaderState {
|
|||||||
failureOptionOrder: none(),
|
failureOptionOrder: none(),
|
||||||
dateFrom: DateTime.now(),
|
dateFrom: DateTime.now(),
|
||||||
dateTo: DateTime.now(),
|
dateTo: DateTime.now(),
|
||||||
status: 'all',
|
status: 'pending',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,25 @@ class SelectedOutletBloc
|
|||||||
return event.map(
|
return event.map(
|
||||||
loaded: (e) async {
|
loaded: (e) async {
|
||||||
final savedId = _localDataProvider.getSelectedOutletId();
|
final savedId = _localDataProvider.getSelectedOutletId();
|
||||||
|
final savedName = _localDataProvider.getSelectedOutletName();
|
||||||
|
|
||||||
|
if (savedId != null && savedName != null) {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
selectedOutletId: savedId,
|
||||||
|
selectedOutlet: Outlet.empty().copyWith(
|
||||||
|
id: savedId,
|
||||||
|
name: savedName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
emit(state.copyWith(selectedOutletId: savedId));
|
emit(state.copyWith(selectedOutletId: savedId));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
selected: (e) async {
|
selected: (e) async {
|
||||||
await _localDataProvider.saveSelectedOutletId(e.outlet.id);
|
await _localDataProvider.saveSelectedOutletId(e.outlet.id);
|
||||||
|
await _localDataProvider.saveSelectedOutletName(e.outlet.name);
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
selectedOutlet: e.outlet,
|
selectedOutlet: e.outlet,
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ class LocalStorageKey {
|
|||||||
static const String token = 'token';
|
static const String token = 'token';
|
||||||
static const String user = 'user';
|
static const String user = 'user';
|
||||||
static const String selectedOutletId = 'selected_outlet_id';
|
static const String selectedOutletId = 'selected_outlet_id';
|
||||||
|
static const String selectedOutletName = 'selected_outlet_name';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,7 @@ extension IntegerExt on int {
|
|||||||
symbol: 'Rp. ',
|
symbol: 'Rp. ',
|
||||||
decimalDigits: 0,
|
decimalDigits: 0,
|
||||||
).format(this);
|
).format(this);
|
||||||
|
|
||||||
|
/// Format ribuan tanpa simbol mata uang, contoh: 1.639
|
||||||
|
String get thousandFormat => NumberFormat.decimalPattern('id').format(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ part 'app_value.dart';
|
|||||||
class ThemeApp {
|
class ThemeApp {
|
||||||
static ThemeData get theme => ThemeData(
|
static ThemeData get theme => ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: AppColor.primary,
|
||||||
|
primary: AppColor.primary,
|
||||||
|
brightness: Brightness.light,
|
||||||
|
),
|
||||||
scaffoldBackgroundColor: AppColor.background,
|
scaffoldBackgroundColor: AppColor.background,
|
||||||
fontFamily: FontFamily.quicksand,
|
fontFamily: FontFamily.quicksand,
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
@@ -67,6 +72,7 @@ class ThemeApp {
|
|||||||
),
|
),
|
||||||
bottomSheetTheme: BottomSheetThemeData(
|
bottomSheetTheme: BottomSheetThemeData(
|
||||||
backgroundColor: AppColor.white,
|
backgroundColor: AppColor.white,
|
||||||
)
|
surfaceTintColor: Colors.transparent,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,12 @@ class ApiPath {
|
|||||||
static const String dashboardAnalytic = '/api/v1/analytics/dashboard';
|
static const String dashboardAnalytic = '/api/v1/analytics/dashboard';
|
||||||
static const String productAnalytic = '/api/v1/analytics/products';
|
static const String productAnalytic = '/api/v1/analytics/products';
|
||||||
static const String paymentMethodAnalytic =
|
static const String paymentMethodAnalytic =
|
||||||
'/api/v1/analytics/paymentMethods';
|
'/api/v1/analytics/payment-methods';
|
||||||
static const String purchasingAnalytic = '/api/v1/analytics/purchasing';
|
static const String purchasingAnalytic = '/api/v1/analytics/purchasing';
|
||||||
|
static const String exclusiveSummaryAnalytic =
|
||||||
|
'/api/v1/analytics/exclusive-summary/period';
|
||||||
|
static const String parentCategoryAnalytic =
|
||||||
|
'/api/v1/analytics/parent-categories';
|
||||||
|
|
||||||
// Inventory
|
// Inventory
|
||||||
static const String inventoryReportDetail =
|
static const String inventoryReportDetail =
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ part 'entities/dashboard_analytic_entity.dart';
|
|||||||
part 'entities/product_analytic_entity.dart';
|
part 'entities/product_analytic_entity.dart';
|
||||||
part 'entities/payment_method_analytic_entity.dart';
|
part 'entities/payment_method_analytic_entity.dart';
|
||||||
part 'entities/purchasing_analytic_entity.dart';
|
part 'entities/purchasing_analytic_entity.dart';
|
||||||
|
part 'entities/exclusive_summary_entity.dart';
|
||||||
|
part 'entities/profit_sharing_entity.dart';
|
||||||
part 'failures/analytic_failure.dart';
|
part 'failures/analytic_failure.dart';
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class CategoryAnalytic with _$CategoryAnalytic {
|
|||||||
const factory CategoryAnalytic({
|
const factory CategoryAnalytic({
|
||||||
required String organizationId,
|
required String organizationId,
|
||||||
required String outletId,
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
required String dateFrom,
|
required String dateFrom,
|
||||||
required String dateTo,
|
required String dateTo,
|
||||||
required List<CategoryAnalyticItem> data,
|
required List<CategoryAnalyticItem> data,
|
||||||
@@ -13,6 +14,7 @@ class CategoryAnalytic with _$CategoryAnalytic {
|
|||||||
factory CategoryAnalytic.empty() => const CategoryAnalytic(
|
factory CategoryAnalytic.empty() => const CategoryAnalytic(
|
||||||
organizationId: "",
|
organizationId: "",
|
||||||
outletId: "",
|
outletId: "",
|
||||||
|
outletName: "",
|
||||||
dateFrom: "",
|
dateFrom: "",
|
||||||
dateTo: "",
|
dateTo: "",
|
||||||
data: [],
|
data: [],
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class DashboardAnalytic with _$DashboardAnalytic {
|
|||||||
const factory DashboardAnalytic({
|
const factory DashboardAnalytic({
|
||||||
required String organizationId,
|
required String organizationId,
|
||||||
required String outletId,
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
required String dateFrom,
|
required String dateFrom,
|
||||||
required String dateTo,
|
required String dateTo,
|
||||||
required DashboardOverview overview,
|
required DashboardOverview overview,
|
||||||
@@ -16,6 +17,7 @@ class DashboardAnalytic with _$DashboardAnalytic {
|
|||||||
factory DashboardAnalytic.empty() => DashboardAnalytic(
|
factory DashboardAnalytic.empty() => DashboardAnalytic(
|
||||||
organizationId: '',
|
organizationId: '',
|
||||||
outletId: '',
|
outletId: '',
|
||||||
|
outletName: '',
|
||||||
dateFrom: '',
|
dateFrom: '',
|
||||||
dateTo: '',
|
dateTo: '',
|
||||||
overview: DashboardOverview.empty(),
|
overview: DashboardOverview.empty(),
|
||||||
@@ -34,6 +36,9 @@ class DashboardOverview with _$DashboardOverview {
|
|||||||
required int totalCustomers,
|
required int totalCustomers,
|
||||||
required int voidedOrders,
|
required int voidedOrders,
|
||||||
required int refundedOrders,
|
required int refundedOrders,
|
||||||
|
required int totalItemSold,
|
||||||
|
required int totalLowStock,
|
||||||
|
required int totalProductActive,
|
||||||
}) = _DashboardOverview;
|
}) = _DashboardOverview;
|
||||||
|
|
||||||
factory DashboardOverview.empty() => const DashboardOverview(
|
factory DashboardOverview.empty() => const DashboardOverview(
|
||||||
@@ -43,6 +48,9 @@ class DashboardOverview with _$DashboardOverview {
|
|||||||
totalCustomers: 0,
|
totalCustomers: 0,
|
||||||
voidedOrders: 0,
|
voidedOrders: 0,
|
||||||
refundedOrders: 0,
|
refundedOrders: 0,
|
||||||
|
totalItemSold: 0,
|
||||||
|
totalLowStock: 0,
|
||||||
|
totalProductActive: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
part of '../analytic.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummary with _$ExclusiveSummary {
|
||||||
|
const factory ExclusiveSummary({
|
||||||
|
required String organizationId,
|
||||||
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
|
required ExclusiveSummaryPeriod period,
|
||||||
|
required ExclusiveSummarySummary summary,
|
||||||
|
required ExclusiveSummaryReimburse reimburse,
|
||||||
|
required List<ExclusiveSummaryBreakdown> hppBreakdown,
|
||||||
|
required List<ExclusiveSummaryBreakdown> operationalExpenseBreakdown,
|
||||||
|
required List<ExclusiveSummaryDaily> dailySummary,
|
||||||
|
required List<ExclusiveSummaryTransaction> dailyTransactions,
|
||||||
|
}) = _ExclusiveSummary;
|
||||||
|
|
||||||
|
factory ExclusiveSummary.empty() => ExclusiveSummary(
|
||||||
|
organizationId: '',
|
||||||
|
outletId: '',
|
||||||
|
outletName: '',
|
||||||
|
period: ExclusiveSummaryPeriod.empty(),
|
||||||
|
summary: ExclusiveSummarySummary.empty(),
|
||||||
|
reimburse: ExclusiveSummaryReimburse.empty(),
|
||||||
|
hppBreakdown: [],
|
||||||
|
operationalExpenseBreakdown: [],
|
||||||
|
dailySummary: [],
|
||||||
|
dailyTransactions: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryPeriod with _$ExclusiveSummaryPeriod {
|
||||||
|
const factory ExclusiveSummaryPeriod({
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
}) = _ExclusiveSummaryPeriod;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryPeriod.empty() => ExclusiveSummaryPeriod(
|
||||||
|
dateFrom: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
dateTo: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummarySummary with _$ExclusiveSummarySummary {
|
||||||
|
const factory ExclusiveSummarySummary({
|
||||||
|
required int sales,
|
||||||
|
required int hpp,
|
||||||
|
required int grossProfit,
|
||||||
|
required int salaryTotal,
|
||||||
|
required int salaryDw,
|
||||||
|
required int salaryStaff,
|
||||||
|
required int salaryOther,
|
||||||
|
required int otherOperationalExpenses,
|
||||||
|
required int operationalExpensesTotal,
|
||||||
|
required int totalCost,
|
||||||
|
required int netProfit,
|
||||||
|
}) = _ExclusiveSummarySummary;
|
||||||
|
|
||||||
|
factory ExclusiveSummarySummary.empty() => const ExclusiveSummarySummary(
|
||||||
|
sales: 0,
|
||||||
|
hpp: 0,
|
||||||
|
grossProfit: 0,
|
||||||
|
salaryTotal: 0,
|
||||||
|
salaryDw: 0,
|
||||||
|
salaryStaff: 0,
|
||||||
|
salaryOther: 0,
|
||||||
|
otherOperationalExpenses: 0,
|
||||||
|
operationalExpensesTotal: 0,
|
||||||
|
totalCost: 0,
|
||||||
|
netProfit: 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryReimburse with _$ExclusiveSummaryReimburse {
|
||||||
|
const factory ExclusiveSummaryReimburse({
|
||||||
|
required int totalCost,
|
||||||
|
required int excludedSalaryStaff,
|
||||||
|
required int totalReimburse,
|
||||||
|
}) = _ExclusiveSummaryReimburse;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryReimburse.empty() => const ExclusiveSummaryReimburse(
|
||||||
|
totalCost: 0,
|
||||||
|
excludedSalaryStaff: 0,
|
||||||
|
totalReimburse: 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryBreakdown with _$ExclusiveSummaryBreakdown {
|
||||||
|
const factory ExclusiveSummaryBreakdown({
|
||||||
|
required String categoryCode,
|
||||||
|
required String categoryName,
|
||||||
|
required int amount,
|
||||||
|
required double percentage,
|
||||||
|
}) = _ExclusiveSummaryBreakdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryDaily with _$ExclusiveSummaryDaily {
|
||||||
|
const factory ExclusiveSummaryDaily({
|
||||||
|
required DateTime date,
|
||||||
|
required int transactionCount,
|
||||||
|
required int totalCost,
|
||||||
|
}) = _ExclusiveSummaryDaily;
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryTransaction with _$ExclusiveSummaryTransaction {
|
||||||
|
const factory ExclusiveSummaryTransaction({
|
||||||
|
required DateTime date,
|
||||||
|
required String categoryCode,
|
||||||
|
required String categoryName,
|
||||||
|
required String description,
|
||||||
|
required int amount,
|
||||||
|
required String source,
|
||||||
|
}) = _ExclusiveSummaryTransaction;
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ class PaymentMethodAnalytic with _$PaymentMethodAnalytic {
|
|||||||
const factory PaymentMethodAnalytic({
|
const factory PaymentMethodAnalytic({
|
||||||
required String organizationId,
|
required String organizationId,
|
||||||
required String outletId,
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
required String dateFrom,
|
required String dateFrom,
|
||||||
required String dateTo,
|
required String dateTo,
|
||||||
required String groupBy,
|
required String groupBy,
|
||||||
@@ -15,6 +16,7 @@ class PaymentMethodAnalytic with _$PaymentMethodAnalytic {
|
|||||||
factory PaymentMethodAnalytic.empty() => PaymentMethodAnalytic(
|
factory PaymentMethodAnalytic.empty() => PaymentMethodAnalytic(
|
||||||
organizationId: '',
|
organizationId: '',
|
||||||
outletId: '',
|
outletId: '',
|
||||||
|
outletName: '',
|
||||||
dateFrom: '',
|
dateFrom: '',
|
||||||
dateTo: '',
|
dateTo: '',
|
||||||
groupBy: '',
|
groupBy: '',
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class ProductAnalytic with _$ProductAnalytic {
|
|||||||
const factory ProductAnalytic({
|
const factory ProductAnalytic({
|
||||||
required String organizationId,
|
required String organizationId,
|
||||||
required String outletId,
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
required String dateFrom,
|
required String dateFrom,
|
||||||
required String dateTo,
|
required String dateTo,
|
||||||
required List<ProductAnalyticData> data,
|
required List<ProductAnalyticData> data,
|
||||||
@@ -13,6 +14,7 @@ class ProductAnalytic with _$ProductAnalytic {
|
|||||||
factory ProductAnalytic.empty() => const ProductAnalytic(
|
factory ProductAnalytic.empty() => const ProductAnalytic(
|
||||||
organizationId: '',
|
organizationId: '',
|
||||||
outletId: '',
|
outletId: '',
|
||||||
|
outletName: '',
|
||||||
dateFrom: '',
|
dateFrom: '',
|
||||||
dateTo: '',
|
dateTo: '',
|
||||||
data: [],
|
data: [],
|
||||||
@@ -24,22 +26,40 @@ class ProductAnalyticData with _$ProductAnalyticData {
|
|||||||
const factory ProductAnalyticData({
|
const factory ProductAnalyticData({
|
||||||
required String productId,
|
required String productId,
|
||||||
required String productName,
|
required String productName,
|
||||||
|
required String productSku,
|
||||||
|
required int productPrice,
|
||||||
required String categoryId,
|
required String categoryId,
|
||||||
required String categoryName,
|
required String categoryName,
|
||||||
|
required int categoryOrder,
|
||||||
required int quantitySold,
|
required int quantitySold,
|
||||||
required int revenue,
|
required int revenue,
|
||||||
required double averagePrice,
|
required double averagePrice,
|
||||||
required int orderCount,
|
required int orderCount,
|
||||||
|
required int standardHppPerUnit,
|
||||||
|
required int standardHppTotal,
|
||||||
|
required int fifoHppPerUnit,
|
||||||
|
required int fifoHppTotal,
|
||||||
|
required int movingAverageHppPerUnit,
|
||||||
|
required int movingAverageHppTotal,
|
||||||
}) = _ProductAnalyticData;
|
}) = _ProductAnalyticData;
|
||||||
|
|
||||||
factory ProductAnalyticData.empty() => const ProductAnalyticData(
|
factory ProductAnalyticData.empty() => const ProductAnalyticData(
|
||||||
productId: '',
|
productId: '',
|
||||||
productName: '',
|
productName: '',
|
||||||
|
productSku: '',
|
||||||
|
productPrice: 0,
|
||||||
categoryId: '',
|
categoryId: '',
|
||||||
categoryName: '',
|
categoryName: '',
|
||||||
|
categoryOrder: 0,
|
||||||
quantitySold: 0,
|
quantitySold: 0,
|
||||||
revenue: 0,
|
revenue: 0,
|
||||||
averagePrice: 0.0,
|
averagePrice: 0.0,
|
||||||
orderCount: 0,
|
orderCount: 0,
|
||||||
|
standardHppPerUnit: 0,
|
||||||
|
standardHppTotal: 0,
|
||||||
|
fifoHppPerUnit: 0,
|
||||||
|
fifoHppTotal: 0,
|
||||||
|
movingAverageHppPerUnit: 0,
|
||||||
|
movingAverageHppTotal: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,22 +4,34 @@ part of '../analytic.dart';
|
|||||||
class ProfitLossAnalytic with _$ProfitLossAnalytic {
|
class ProfitLossAnalytic with _$ProfitLossAnalytic {
|
||||||
const factory ProfitLossAnalytic({
|
const factory ProfitLossAnalytic({
|
||||||
required String organizationId,
|
required String organizationId,
|
||||||
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
required String dateFrom,
|
required String dateFrom,
|
||||||
required String dateTo,
|
required String dateTo,
|
||||||
required String groupBy,
|
required String groupBy,
|
||||||
required ProfitLossSummary summary,
|
required ProfitLossSummary summary,
|
||||||
required List<ProfitLossDailyData> data,
|
required List<ProfitLossDailyData> data,
|
||||||
required List<ProfitLossProductData> productData,
|
required List<ProfitLossProductData> productData,
|
||||||
|
required List<ProfitLossMainSummaryItem> mainSummary,
|
||||||
|
required ProfitLossPurchasing purchasing,
|
||||||
|
required List<ProfitLossOperationalExpense> operationalExpenses,
|
||||||
|
required int operationalExpensesTotal,
|
||||||
}) = _ProfitLossAnalytic;
|
}) = _ProfitLossAnalytic;
|
||||||
|
|
||||||
factory ProfitLossAnalytic.empty() => ProfitLossAnalytic(
|
factory ProfitLossAnalytic.empty() => ProfitLossAnalytic(
|
||||||
organizationId: '',
|
organizationId: '',
|
||||||
|
outletId: '',
|
||||||
|
outletName: '',
|
||||||
dateFrom: '',
|
dateFrom: '',
|
||||||
dateTo: '',
|
dateTo: '',
|
||||||
groupBy: '',
|
groupBy: '',
|
||||||
summary: ProfitLossSummary.empty(),
|
summary: ProfitLossSummary.empty(),
|
||||||
data: [],
|
data: [],
|
||||||
productData: [],
|
productData: [],
|
||||||
|
mainSummary: [],
|
||||||
|
purchasing: ProfitLossPurchasing.empty(),
|
||||||
|
operationalExpenses: [],
|
||||||
|
operationalExpensesTotal: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,3 +127,79 @@ class ProfitLossProductData with _$ProfitLossProductData {
|
|||||||
profitPerUnit: 0,
|
profitPerUnit: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitLossMainSummaryItem with _$ProfitLossMainSummaryItem {
|
||||||
|
const factory ProfitLossMainSummaryItem({
|
||||||
|
required String id,
|
||||||
|
required String label,
|
||||||
|
required bool isBold,
|
||||||
|
required int todayNominal,
|
||||||
|
required double todayPct,
|
||||||
|
required int mtdNominal,
|
||||||
|
required double mtdPct,
|
||||||
|
@Default([]) List<ProfitLossMainSummaryItem> subItems,
|
||||||
|
}) = _ProfitLossMainSummaryItem;
|
||||||
|
|
||||||
|
factory ProfitLossMainSummaryItem.empty() => const ProfitLossMainSummaryItem(
|
||||||
|
id: '',
|
||||||
|
label: '',
|
||||||
|
isBold: false,
|
||||||
|
todayNominal: 0,
|
||||||
|
todayPct: 0,
|
||||||
|
mtdNominal: 0,
|
||||||
|
mtdPct: 0,
|
||||||
|
subItems: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitLossPurchasing with _$ProfitLossPurchasing {
|
||||||
|
const factory ProfitLossPurchasing({
|
||||||
|
required int todayTotal,
|
||||||
|
required int mtdTotal,
|
||||||
|
required int todayRawMaterial,
|
||||||
|
required int mtdRawMaterial,
|
||||||
|
required int todayExpense,
|
||||||
|
required int mtdExpense,
|
||||||
|
@Default([]) List<ProfitLossPurchasingItem> items,
|
||||||
|
}) = _ProfitLossPurchasing;
|
||||||
|
|
||||||
|
factory ProfitLossPurchasing.empty() => const ProfitLossPurchasing(
|
||||||
|
todayTotal: 0,
|
||||||
|
mtdTotal: 0,
|
||||||
|
todayRawMaterial: 0,
|
||||||
|
mtdRawMaterial: 0,
|
||||||
|
todayExpense: 0,
|
||||||
|
mtdExpense: 0,
|
||||||
|
items: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitLossPurchasingItem with _$ProfitLossPurchasingItem {
|
||||||
|
const factory ProfitLossPurchasingItem({
|
||||||
|
required String date,
|
||||||
|
required String item,
|
||||||
|
required int quantity,
|
||||||
|
required int nominal,
|
||||||
|
}) = _ProfitLossPurchasingItem;
|
||||||
|
|
||||||
|
factory ProfitLossPurchasingItem.empty() => const ProfitLossPurchasingItem(
|
||||||
|
date: '',
|
||||||
|
item: '',
|
||||||
|
quantity: 0,
|
||||||
|
nominal: 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitLossOperationalExpense with _$ProfitLossOperationalExpense {
|
||||||
|
const factory ProfitLossOperationalExpense({
|
||||||
|
required String item,
|
||||||
|
required int nominal,
|
||||||
|
}) = _ProfitLossOperationalExpense;
|
||||||
|
|
||||||
|
factory ProfitLossOperationalExpense.empty() =>
|
||||||
|
const ProfitLossOperationalExpense(item: '', nominal: 0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,219 @@
|
|||||||
|
part of '../analytic.dart';
|
||||||
|
|
||||||
|
/// Bagi hasil (profit sharing) berdasarkan omzet per parent category.
|
||||||
|
@freezed
|
||||||
|
class ProfitSharing with _$ProfitSharing {
|
||||||
|
const factory ProfitSharing({
|
||||||
|
required String organizationId,
|
||||||
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
required List<ProfitSharingCategory> categories,
|
||||||
|
required ProfitSharingBudget budget,
|
||||||
|
}) = _ProfitSharing;
|
||||||
|
|
||||||
|
factory ProfitSharing.empty() => ProfitSharing(
|
||||||
|
organizationId: '',
|
||||||
|
outletId: '',
|
||||||
|
outletName: '',
|
||||||
|
dateFrom: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
dateTo: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
categories: [],
|
||||||
|
budget: ProfitSharingBudget.empty(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingCategory with _$ProfitSharingCategory {
|
||||||
|
const ProfitSharingCategory._();
|
||||||
|
|
||||||
|
const factory ProfitSharingCategory({
|
||||||
|
required String parentCategoryId,
|
||||||
|
required String parentCategoryName,
|
||||||
|
required int totalRevenue,
|
||||||
|
required int totalQuantity,
|
||||||
|
required int categoryCount,
|
||||||
|
required int productCount,
|
||||||
|
required int orderCount,
|
||||||
|
required int totalStandardHpp,
|
||||||
|
required int totalFifoHpp,
|
||||||
|
required int totalMovingAverageHpp,
|
||||||
|
}) = _ProfitSharingCategory;
|
||||||
|
|
||||||
|
factory ProfitSharingCategory.empty() => const ProfitSharingCategory(
|
||||||
|
parentCategoryId: '',
|
||||||
|
parentCategoryName: '',
|
||||||
|
totalRevenue: 0,
|
||||||
|
totalQuantity: 0,
|
||||||
|
categoryCount: 0,
|
||||||
|
productCount: 0,
|
||||||
|
orderCount: 0,
|
||||||
|
totalStandardHpp: 0,
|
||||||
|
totalFifoHpp: 0,
|
||||||
|
totalMovingAverageHpp: 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Laba kotor memakai HPP standar (acuan yang dipakai di laporan laba rugi).
|
||||||
|
int get grossProfit => totalRevenue - totalStandardHpp;
|
||||||
|
|
||||||
|
double get grossMargin =>
|
||||||
|
totalRevenue == 0 ? 0 : (grossProfit / totalRevenue) * 100;
|
||||||
|
|
||||||
|
/// % HPP standar terhadap omzet.
|
||||||
|
double get standardHppPercentage =>
|
||||||
|
totalRevenue == 0 ? 0 : (totalStandardHpp / totalRevenue) * 100;
|
||||||
|
|
||||||
|
/// % HPP riil (FIFO) terhadap omzet — dipakai untuk status kesehatan margin.
|
||||||
|
double get realHppPercentage =>
|
||||||
|
totalRevenue == 0 ? 0 : (totalFifoHpp / totalRevenue) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingBudget with _$ProfitSharingBudget {
|
||||||
|
const factory ProfitSharingBudget({
|
||||||
|
required ProfitSharingPercentage percentages,
|
||||||
|
required DateTime cutOffFrom,
|
||||||
|
required DateTime cutOffTo,
|
||||||
|
required ProfitSharingPeriod total,
|
||||||
|
required List<ProfitSharingPeriod> weekly,
|
||||||
|
required List<ProfitSharingPeriod> monthly,
|
||||||
|
}) = _ProfitSharingBudget;
|
||||||
|
|
||||||
|
factory ProfitSharingBudget.empty() => ProfitSharingBudget(
|
||||||
|
percentages: ProfitSharingPercentage.empty(),
|
||||||
|
cutOffFrom: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
cutOffTo: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
total: ProfitSharingPeriod.empty(),
|
||||||
|
weekly: [],
|
||||||
|
monthly: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingPercentage with _$ProfitSharingPercentage {
|
||||||
|
const factory ProfitSharingPercentage({
|
||||||
|
required double purchase,
|
||||||
|
required double owner,
|
||||||
|
required double team,
|
||||||
|
}) = _ProfitSharingPercentage;
|
||||||
|
|
||||||
|
factory ProfitSharingPercentage.empty() =>
|
||||||
|
const ProfitSharingPercentage(purchase: 0, owner: 0, team: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Satu baris periode bagi hasil. Dipakai untuk total, mingguan, dan bulanan.
|
||||||
|
/// [month] dan [weekCount] hanya terisi untuk data bulanan.
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingPeriod with _$ProfitSharingPeriod {
|
||||||
|
const ProfitSharingPeriod._();
|
||||||
|
|
||||||
|
const factory ProfitSharingPeriod({
|
||||||
|
required DateTime periodStart,
|
||||||
|
required DateTime periodEnd,
|
||||||
|
required int revenue,
|
||||||
|
required int orderCount,
|
||||||
|
required int limitPurchase,
|
||||||
|
required int limitOwner,
|
||||||
|
required int limitTeam,
|
||||||
|
@Default('') String month,
|
||||||
|
@Default(0) int weekCount,
|
||||||
|
}) = _ProfitSharingPeriod;
|
||||||
|
|
||||||
|
factory ProfitSharingPeriod.empty() => ProfitSharingPeriod(
|
||||||
|
periodStart: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
periodEnd: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
revenue: 0,
|
||||||
|
orderCount: 0,
|
||||||
|
limitPurchase: 0,
|
||||||
|
limitOwner: 0,
|
||||||
|
limitTeam: 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
bool get hasRevenue => revenue > 0;
|
||||||
|
|
||||||
|
int get averageOrderValue => orderCount == 0 ? 0 : revenue ~/ orderCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Rincian satu kategori induk: ringkasan, sub kategori beserta produknya,
|
||||||
|
/// dan bagi hasil khusus kategori tersebut.
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingDetail with _$ProfitSharingDetail {
|
||||||
|
const factory ProfitSharingDetail({
|
||||||
|
required String organizationId,
|
||||||
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
required String parentCategoryId,
|
||||||
|
required String parentCategoryName,
|
||||||
|
required ProfitSharingCategory summary,
|
||||||
|
required List<ProfitSharingSubCategory> categories,
|
||||||
|
required ProfitSharingBudget budget,
|
||||||
|
}) = _ProfitSharingDetail;
|
||||||
|
|
||||||
|
factory ProfitSharingDetail.empty() => ProfitSharingDetail(
|
||||||
|
organizationId: '',
|
||||||
|
outletId: '',
|
||||||
|
outletName: '',
|
||||||
|
dateFrom: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
dateTo: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
parentCategoryId: '',
|
||||||
|
parentCategoryName: '',
|
||||||
|
summary: ProfitSharingCategory.empty(),
|
||||||
|
categories: [],
|
||||||
|
budget: ProfitSharingBudget.empty(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingSubCategory with _$ProfitSharingSubCategory {
|
||||||
|
const ProfitSharingSubCategory._();
|
||||||
|
|
||||||
|
const factory ProfitSharingSubCategory({
|
||||||
|
required String categoryId,
|
||||||
|
required String categoryName,
|
||||||
|
required int totalRevenue,
|
||||||
|
required int totalQuantity,
|
||||||
|
required int productCount,
|
||||||
|
required int orderCount,
|
||||||
|
required int totalStandardHpp,
|
||||||
|
required int totalFifoHpp,
|
||||||
|
required int totalMovingAverageHpp,
|
||||||
|
required List<ProfitSharingProduct> products,
|
||||||
|
}) = _ProfitSharingSubCategory;
|
||||||
|
|
||||||
|
double get standardHppPercentage =>
|
||||||
|
totalRevenue == 0 ? 0 : (totalStandardHpp / totalRevenue) * 100;
|
||||||
|
|
||||||
|
double get realHppPercentage =>
|
||||||
|
totalRevenue == 0 ? 0 : (totalFifoHpp / totalRevenue) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProfitSharingProduct with _$ProfitSharingProduct {
|
||||||
|
const ProfitSharingProduct._();
|
||||||
|
|
||||||
|
const factory ProfitSharingProduct({
|
||||||
|
required String productId,
|
||||||
|
required String productName,
|
||||||
|
required String productSku,
|
||||||
|
required int productPrice,
|
||||||
|
required int quantitySold,
|
||||||
|
required int revenue,
|
||||||
|
required double averagePrice,
|
||||||
|
required int orderCount,
|
||||||
|
required double standardHppPerUnit,
|
||||||
|
required int standardHppTotal,
|
||||||
|
required double fifoHppPerUnit,
|
||||||
|
required int fifoHppTotal,
|
||||||
|
required double movingAverageHppPerUnit,
|
||||||
|
required int movingAverageHppTotal,
|
||||||
|
}) = _ProfitSharingProduct;
|
||||||
|
|
||||||
|
double get standardHppPercentage =>
|
||||||
|
revenue == 0 ? 0 : (standardHppTotal / revenue) * 100;
|
||||||
|
|
||||||
|
double get realHppPercentage =>
|
||||||
|
revenue == 0 ? 0 : (fifoHppTotal / revenue) * 100;
|
||||||
|
}
|
||||||
@@ -33,7 +33,11 @@ class PurchasingAnalytic with _$PurchasingAnalytic {
|
|||||||
class PurchasingAnalyticSummary with _$PurchasingAnalyticSummary {
|
class PurchasingAnalyticSummary with _$PurchasingAnalyticSummary {
|
||||||
const factory PurchasingAnalyticSummary({
|
const factory PurchasingAnalyticSummary({
|
||||||
required int totalPurchases,
|
required int totalPurchases,
|
||||||
|
required int rawMaterialPurchases,
|
||||||
|
required int expensePurchases,
|
||||||
required int totalPurchaseOrders,
|
required int totalPurchaseOrders,
|
||||||
|
required int rawMaterialPurchaseOrders,
|
||||||
|
required int expenseCount,
|
||||||
required int totalQuantity,
|
required int totalQuantity,
|
||||||
required double averagePurchaseOrderValue,
|
required double averagePurchaseOrderValue,
|
||||||
required int totalIngredients,
|
required int totalIngredients,
|
||||||
@@ -43,7 +47,11 @@ class PurchasingAnalyticSummary with _$PurchasingAnalyticSummary {
|
|||||||
factory PurchasingAnalyticSummary.empty() =>
|
factory PurchasingAnalyticSummary.empty() =>
|
||||||
const PurchasingAnalyticSummary(
|
const PurchasingAnalyticSummary(
|
||||||
totalPurchases: 0,
|
totalPurchases: 0,
|
||||||
|
rawMaterialPurchases: 0,
|
||||||
|
expensePurchases: 0,
|
||||||
totalPurchaseOrders: 0,
|
totalPurchaseOrders: 0,
|
||||||
|
rawMaterialPurchaseOrders: 0,
|
||||||
|
expenseCount: 0,
|
||||||
totalQuantity: 0,
|
totalQuantity: 0,
|
||||||
averagePurchaseOrderValue: 0,
|
averagePurchaseOrderValue: 0,
|
||||||
totalIngredients: 0,
|
totalIngredients: 0,
|
||||||
@@ -56,7 +64,11 @@ class PurchasingAnalyticData with _$PurchasingAnalyticData {
|
|||||||
const factory PurchasingAnalyticData({
|
const factory PurchasingAnalyticData({
|
||||||
required DateTime date,
|
required DateTime date,
|
||||||
required int purchases,
|
required int purchases,
|
||||||
|
required int rawMaterialPurchases,
|
||||||
|
required int expensePurchases,
|
||||||
required int purchaseOrders,
|
required int purchaseOrders,
|
||||||
|
required int rawMaterialPurchaseOrders,
|
||||||
|
required int expenseCount,
|
||||||
required int quantity,
|
required int quantity,
|
||||||
required int ingredients,
|
required int ingredients,
|
||||||
required int vendors,
|
required int vendors,
|
||||||
@@ -65,7 +77,11 @@ class PurchasingAnalyticData with _$PurchasingAnalyticData {
|
|||||||
factory PurchasingAnalyticData.empty() => PurchasingAnalyticData(
|
factory PurchasingAnalyticData.empty() => PurchasingAnalyticData(
|
||||||
date: DateTime.fromMillisecondsSinceEpoch(0),
|
date: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
purchases: 0,
|
purchases: 0,
|
||||||
|
rawMaterialPurchases: 0,
|
||||||
|
expensePurchases: 0,
|
||||||
purchaseOrders: 0,
|
purchaseOrders: 0,
|
||||||
|
rawMaterialPurchaseOrders: 0,
|
||||||
|
expenseCount: 0,
|
||||||
quantity: 0,
|
quantity: 0,
|
||||||
ingredients: 0,
|
ingredients: 0,
|
||||||
vendors: 0,
|
vendors: 0,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class SalesAnalytic with _$SalesAnalytic {
|
|||||||
const factory SalesAnalytic({
|
const factory SalesAnalytic({
|
||||||
required String organizationId,
|
required String organizationId,
|
||||||
required String outletId,
|
required String outletId,
|
||||||
|
required String outletName,
|
||||||
required DateTime dateFrom,
|
required DateTime dateFrom,
|
||||||
required DateTime dateTo,
|
required DateTime dateTo,
|
||||||
required String groupBy,
|
required String groupBy,
|
||||||
@@ -15,6 +16,7 @@ class SalesAnalytic with _$SalesAnalytic {
|
|||||||
factory SalesAnalytic.empty() => SalesAnalytic(
|
factory SalesAnalytic.empty() => SalesAnalytic(
|
||||||
organizationId: '',
|
organizationId: '',
|
||||||
outletId: '',
|
outletId: '',
|
||||||
|
outletName: '',
|
||||||
dateFrom: DateTime.fromMillisecondsSinceEpoch(0),
|
dateFrom: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
dateTo: DateTime.fromMillisecondsSinceEpoch(0),
|
dateTo: DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
groupBy: '',
|
groupBy: '',
|
||||||
|
|||||||
@@ -49,5 +49,26 @@ abstract class IAnalyticRepository {
|
|||||||
required DateTime dateFrom,
|
required DateTime dateFrom,
|
||||||
required DateTime dateTo,
|
required DateTime dateTo,
|
||||||
String? outletId,
|
String? outletId,
|
||||||
|
String groupBy = 'day',
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<Either<AnalyticFailure, ExclusiveSummary>> getExclusiveSummary({
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
String? outletId,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<Either<AnalyticFailure, ProfitSharing>> getProfitSharing({
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
String? outletId,
|
||||||
|
String groupBy = 'day',
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<Either<AnalyticFailure, ProfitSharingDetail>> getProfitSharingDetail({
|
||||||
|
required String parentCategoryId,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
String? outletId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ abstract class Env {
|
|||||||
@dev
|
@dev
|
||||||
class DevEnv implements Env {
|
class DevEnv implements Env {
|
||||||
@override
|
@override
|
||||||
String get baseUrl => 'https://api-pos.apskel.id'; // example value
|
String get baseUrl => 'https://enaklo-pos-api.altru.id'; // example value
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable(as: Env)
|
@Injectable(as: Env)
|
||||||
@prod
|
@prod
|
||||||
class ProdEnv implements Env {
|
class ProdEnv implements Env {
|
||||||
@override
|
@override
|
||||||
String get baseUrl => 'https://api-pos.apskel.id';
|
String get baseUrl => 'https://enaklo-pos-api.altru.id';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,3 +13,5 @@ part 'dto/dashboard_analytic_dto.dart';
|
|||||||
part 'dto/product_analytic_dto.dart';
|
part 'dto/product_analytic_dto.dart';
|
||||||
part 'dto/payment_method_analytic_dto.dart';
|
part 'dto/payment_method_analytic_dto.dart';
|
||||||
part 'dto/purchasing_analytic_dto.dart';
|
part 'dto/purchasing_analytic_dto.dart';
|
||||||
|
part 'dto/exclusive_summary_dto.dart';
|
||||||
|
part 'dto/profit_sharing_dto.dart';
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ _$SalesAnalyticDtoImpl _$$SalesAnalyticDtoImplFromJson(
|
|||||||
) => _$SalesAnalyticDtoImpl(
|
) => _$SalesAnalyticDtoImpl(
|
||||||
organizationId: json['organization_id'] as String?,
|
organizationId: json['organization_id'] as String?,
|
||||||
outletId: json['outlet_id'] as String?,
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
dateFrom: json['date_from'] == null
|
dateFrom: json['date_from'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['date_from'] as String),
|
: DateTime.parse(json['date_from'] as String),
|
||||||
@@ -33,6 +34,7 @@ Map<String, dynamic> _$$SalesAnalyticDtoImplToJson(
|
|||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'organization_id': instance.organizationId,
|
'organization_id': instance.organizationId,
|
||||||
'outlet_id': instance.outletId,
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
'date_from': instance.dateFrom?.toIso8601String(),
|
'date_from': instance.dateFrom?.toIso8601String(),
|
||||||
'date_to': instance.dateTo?.toIso8601String(),
|
'date_to': instance.dateTo?.toIso8601String(),
|
||||||
'group_by': instance.groupBy,
|
'group_by': instance.groupBy,
|
||||||
@@ -92,6 +94,8 @@ _$ProfitLossAnalyticDtoImpl _$$ProfitLossAnalyticDtoImplFromJson(
|
|||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _$ProfitLossAnalyticDtoImpl(
|
) => _$ProfitLossAnalyticDtoImpl(
|
||||||
organizationId: json['organization_id'] as String?,
|
organizationId: json['organization_id'] as String?,
|
||||||
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
dateFrom: json['date_from'] as String?,
|
dateFrom: json['date_from'] as String?,
|
||||||
dateTo: json['date_to'] as String?,
|
dateTo: json['date_to'] as String?,
|
||||||
groupBy: json['group_by'] as String?,
|
groupBy: json['group_by'] as String?,
|
||||||
@@ -104,18 +108,42 @@ _$ProfitLossAnalyticDtoImpl _$$ProfitLossAnalyticDtoImplFromJson(
|
|||||||
productData: (json['product_data'] as List<dynamic>?)
|
productData: (json['product_data'] as List<dynamic>?)
|
||||||
?.map((e) => ProfitLossProductDataDto.fromJson(e as Map<String, dynamic>))
|
?.map((e) => ProfitLossProductDataDto.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
mainSummary: (json['main_summary'] as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) => ProfitLossMainSummaryItemDto.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
purchasing: json['purchasing'] == null
|
||||||
|
? null
|
||||||
|
: ProfitLossPurchasingDto.fromJson(
|
||||||
|
json['purchasing'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
operationalExpenses: (json['operational_expenses'] as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) =>
|
||||||
|
ProfitLossOperationalExpenseDto.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
operationalExpensesTotal: (json['operational_expenses_total'] as num?)
|
||||||
|
?.toInt(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$ProfitLossAnalyticDtoImplToJson(
|
Map<String, dynamic> _$$ProfitLossAnalyticDtoImplToJson(
|
||||||
_$ProfitLossAnalyticDtoImpl instance,
|
_$ProfitLossAnalyticDtoImpl instance,
|
||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'organization_id': instance.organizationId,
|
'organization_id': instance.organizationId,
|
||||||
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
'date_from': instance.dateFrom,
|
'date_from': instance.dateFrom,
|
||||||
'date_to': instance.dateTo,
|
'date_to': instance.dateTo,
|
||||||
'group_by': instance.groupBy,
|
'group_by': instance.groupBy,
|
||||||
'summary': instance.summary,
|
'summary': instance.summary,
|
||||||
'data': instance.data,
|
'data': instance.data,
|
||||||
'product_data': instance.productData,
|
'product_data': instance.productData,
|
||||||
|
'main_summary': instance.mainSummary,
|
||||||
|
'purchasing': instance.purchasing,
|
||||||
|
'operational_expenses': instance.operationalExpenses,
|
||||||
|
'operational_expenses_total': instance.operationalExpensesTotal,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$ProfitLossSummaryDtoImpl _$$ProfitLossSummaryDtoImplFromJson(
|
_$ProfitLossSummaryDtoImpl _$$ProfitLossSummaryDtoImplFromJson(
|
||||||
@@ -214,11 +242,99 @@ Map<String, dynamic> _$$ProfitLossProductDataDtoImplToJson(
|
|||||||
'profit_per_unit': instance.profitPerUnit,
|
'profit_per_unit': instance.profitPerUnit,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_$ProfitLossMainSummaryItemDtoImpl _$$ProfitLossMainSummaryItemDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitLossMainSummaryItemDtoImpl(
|
||||||
|
id: json['id'] as String?,
|
||||||
|
label: json['label'] as String?,
|
||||||
|
isBold: json['is_bold'] as bool?,
|
||||||
|
todayNominal: (json['today_nominal'] as num?)?.toInt(),
|
||||||
|
todayPct: (json['today_pct'] as num?)?.toDouble(),
|
||||||
|
mtdNominal: (json['mtd_nominal'] as num?)?.toInt(),
|
||||||
|
mtdPct: (json['mtd_pct'] as num?)?.toDouble(),
|
||||||
|
subItems: (json['sub_items'] as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) => ProfitLossMainSummaryItemDto.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitLossMainSummaryItemDtoImplToJson(
|
||||||
|
_$ProfitLossMainSummaryItemDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'label': instance.label,
|
||||||
|
'is_bold': instance.isBold,
|
||||||
|
'today_nominal': instance.todayNominal,
|
||||||
|
'today_pct': instance.todayPct,
|
||||||
|
'mtd_nominal': instance.mtdNominal,
|
||||||
|
'mtd_pct': instance.mtdPct,
|
||||||
|
'sub_items': instance.subItems,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitLossPurchasingDtoImpl _$$ProfitLossPurchasingDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitLossPurchasingDtoImpl(
|
||||||
|
todayTotal: (json['today_total'] as num?)?.toInt(),
|
||||||
|
mtdTotal: (json['mtd_total'] as num?)?.toInt(),
|
||||||
|
todayRawMaterial: (json['today_raw_material'] as num?)?.toInt(),
|
||||||
|
mtdRawMaterial: (json['mtd_raw_material'] as num?)?.toInt(),
|
||||||
|
todayExpense: (json['today_expense'] as num?)?.toInt(),
|
||||||
|
mtdExpense: (json['mtd_expense'] as num?)?.toInt(),
|
||||||
|
items: (json['items'] as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) => ProfitLossPurchasingItemDto.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitLossPurchasingDtoImplToJson(
|
||||||
|
_$ProfitLossPurchasingDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'today_total': instance.todayTotal,
|
||||||
|
'mtd_total': instance.mtdTotal,
|
||||||
|
'today_raw_material': instance.todayRawMaterial,
|
||||||
|
'mtd_raw_material': instance.mtdRawMaterial,
|
||||||
|
'today_expense': instance.todayExpense,
|
||||||
|
'mtd_expense': instance.mtdExpense,
|
||||||
|
'items': instance.items,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitLossPurchasingItemDtoImpl _$$ProfitLossPurchasingItemDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitLossPurchasingItemDtoImpl(
|
||||||
|
date: json['date'] as String?,
|
||||||
|
item: json['item'] as String?,
|
||||||
|
quantity: (json['quantity'] as num?)?.toInt(),
|
||||||
|
nominal: (json['nominal'] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitLossPurchasingItemDtoImplToJson(
|
||||||
|
_$ProfitLossPurchasingItemDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'date': instance.date,
|
||||||
|
'item': instance.item,
|
||||||
|
'quantity': instance.quantity,
|
||||||
|
'nominal': instance.nominal,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitLossOperationalExpenseDtoImpl
|
||||||
|
_$$ProfitLossOperationalExpenseDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ProfitLossOperationalExpenseDtoImpl(
|
||||||
|
item: json['item'] as String?,
|
||||||
|
nominal: (json['nominal'] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitLossOperationalExpenseDtoImplToJson(
|
||||||
|
_$ProfitLossOperationalExpenseDtoImpl instance,
|
||||||
|
) => <String, dynamic>{'item': instance.item, 'nominal': instance.nominal};
|
||||||
|
|
||||||
_$CategoryAnalyticDtoImpl _$$CategoryAnalyticDtoImplFromJson(
|
_$CategoryAnalyticDtoImpl _$$CategoryAnalyticDtoImplFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _$CategoryAnalyticDtoImpl(
|
) => _$CategoryAnalyticDtoImpl(
|
||||||
organizationId: json['organization_id'] as String?,
|
organizationId: json['organization_id'] as String?,
|
||||||
outletId: json['outlet_id'] as String?,
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
dateFrom: json['date_from'] as String?,
|
dateFrom: json['date_from'] as String?,
|
||||||
dateTo: json['date_to'] as String?,
|
dateTo: json['date_to'] as String?,
|
||||||
data: (json['data'] as List<dynamic>?)
|
data: (json['data'] as List<dynamic>?)
|
||||||
@@ -231,6 +347,7 @@ Map<String, dynamic> _$$CategoryAnalyticDtoImplToJson(
|
|||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'organization_id': instance.organizationId,
|
'organization_id': instance.organizationId,
|
||||||
'outlet_id': instance.outletId,
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
'date_from': instance.dateFrom,
|
'date_from': instance.dateFrom,
|
||||||
'date_to': instance.dateTo,
|
'date_to': instance.dateTo,
|
||||||
'data': instance.data,
|
'data': instance.data,
|
||||||
@@ -391,6 +508,7 @@ _$DashboardAnalyticDtoImpl _$$DashboardAnalyticDtoImplFromJson(
|
|||||||
) => _$DashboardAnalyticDtoImpl(
|
) => _$DashboardAnalyticDtoImpl(
|
||||||
organizationId: json['organization_id'] as String?,
|
organizationId: json['organization_id'] as String?,
|
||||||
outletId: json['outlet_id'] as String?,
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
dateFrom: json['date_from'] as String?,
|
dateFrom: json['date_from'] as String?,
|
||||||
dateTo: json['date_to'] as String?,
|
dateTo: json['date_to'] as String?,
|
||||||
overview: json['overview'] == null
|
overview: json['overview'] == null
|
||||||
@@ -414,6 +532,7 @@ Map<String, dynamic> _$$DashboardAnalyticDtoImplToJson(
|
|||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'organization_id': instance.organizationId,
|
'organization_id': instance.organizationId,
|
||||||
'outlet_id': instance.outletId,
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
'date_from': instance.dateFrom,
|
'date_from': instance.dateFrom,
|
||||||
'date_to': instance.dateTo,
|
'date_to': instance.dateTo,
|
||||||
'overview': instance.overview,
|
'overview': instance.overview,
|
||||||
@@ -431,6 +550,9 @@ _$DashboardOverviewDtoImpl _$$DashboardOverviewDtoImplFromJson(
|
|||||||
totalCustomers: (json['total_customers'] as num?)?.toInt(),
|
totalCustomers: (json['total_customers'] as num?)?.toInt(),
|
||||||
voidedOrders: (json['voided_orders'] as num?)?.toInt(),
|
voidedOrders: (json['voided_orders'] as num?)?.toInt(),
|
||||||
refundedOrders: (json['refunded_orders'] as num?)?.toInt(),
|
refundedOrders: (json['refunded_orders'] as num?)?.toInt(),
|
||||||
|
totalItemSold: (json['total_item_sold'] as num?)?.toInt(),
|
||||||
|
totalLowStock: (json['total_low_stock'] as num?)?.toInt(),
|
||||||
|
totalProductActive: (json['total_product_active'] as num?)?.toInt(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$DashboardOverviewDtoImplToJson(
|
Map<String, dynamic> _$$DashboardOverviewDtoImplToJson(
|
||||||
@@ -442,6 +564,9 @@ Map<String, dynamic> _$$DashboardOverviewDtoImplToJson(
|
|||||||
'total_customers': instance.totalCustomers,
|
'total_customers': instance.totalCustomers,
|
||||||
'voided_orders': instance.voidedOrders,
|
'voided_orders': instance.voidedOrders,
|
||||||
'refunded_orders': instance.refundedOrders,
|
'refunded_orders': instance.refundedOrders,
|
||||||
|
'total_item_sold': instance.totalItemSold,
|
||||||
|
'total_low_stock': instance.totalLowStock,
|
||||||
|
'total_product_active': instance.totalProductActive,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$DashboardTopProductDtoImpl _$$DashboardTopProductDtoImplFromJson(
|
_$DashboardTopProductDtoImpl _$$DashboardTopProductDtoImplFromJson(
|
||||||
@@ -523,6 +648,7 @@ _$ProductAnalyticDtoImpl _$$ProductAnalyticDtoImplFromJson(
|
|||||||
) => _$ProductAnalyticDtoImpl(
|
) => _$ProductAnalyticDtoImpl(
|
||||||
organizationId: json['organization_id'] as String?,
|
organizationId: json['organization_id'] as String?,
|
||||||
outletId: json['outlet_id'] as String?,
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
dateFrom: json['date_from'] as String?,
|
dateFrom: json['date_from'] as String?,
|
||||||
dateTo: json['date_to'] as String?,
|
dateTo: json['date_to'] as String?,
|
||||||
data: (json['data'] as List<dynamic>?)
|
data: (json['data'] as List<dynamic>?)
|
||||||
@@ -535,6 +661,7 @@ Map<String, dynamic> _$$ProductAnalyticDtoImplToJson(
|
|||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'organization_id': instance.organizationId,
|
'organization_id': instance.organizationId,
|
||||||
'outlet_id': instance.outletId,
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
'date_from': instance.dateFrom,
|
'date_from': instance.dateFrom,
|
||||||
'date_to': instance.dateTo,
|
'date_to': instance.dateTo,
|
||||||
'data': instance.data,
|
'data': instance.data,
|
||||||
@@ -545,12 +672,22 @@ _$ProductAnalyticDataDtoImpl _$$ProductAnalyticDataDtoImplFromJson(
|
|||||||
) => _$ProductAnalyticDataDtoImpl(
|
) => _$ProductAnalyticDataDtoImpl(
|
||||||
productId: json['product_id'] as String?,
|
productId: json['product_id'] as String?,
|
||||||
productName: json['product_name'] as String?,
|
productName: json['product_name'] as String?,
|
||||||
|
productSku: json['product_sku'] as String?,
|
||||||
|
productPrice: (json['product_price'] as num?)?.toInt(),
|
||||||
categoryId: json['category_id'] as String?,
|
categoryId: json['category_id'] as String?,
|
||||||
categoryName: json['category_name'] as String?,
|
categoryName: json['category_name'] as String?,
|
||||||
|
categoryOrder: (json['category_order'] as num?)?.toInt(),
|
||||||
quantitySold: (json['quantity_sold'] as num?)?.toInt(),
|
quantitySold: (json['quantity_sold'] as num?)?.toInt(),
|
||||||
revenue: (json['revenue'] as num?)?.toInt(),
|
revenue: (json['revenue'] as num?)?.toInt(),
|
||||||
averagePrice: (json['average_price'] as num?)?.toDouble(),
|
averagePrice: (json['average_price'] as num?)?.toDouble(),
|
||||||
orderCount: (json['order_count'] as num?)?.toInt(),
|
orderCount: (json['order_count'] as num?)?.toInt(),
|
||||||
|
standardHppPerUnit: (json['standard_hpp_per_unit'] as num?)?.toInt(),
|
||||||
|
standardHppTotal: (json['standard_hpp_total'] as num?)?.toInt(),
|
||||||
|
fifoHppPerUnit: (json['fifo_hpp_per_unit'] as num?)?.toInt(),
|
||||||
|
fifoHppTotal: (json['fifo_hpp_total'] as num?)?.toInt(),
|
||||||
|
movingAverageHppPerUnit: (json['moving_average_hpp_per_unit'] as num?)
|
||||||
|
?.toInt(),
|
||||||
|
movingAverageHppTotal: (json['moving_average_hpp_total'] as num?)?.toInt(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$ProductAnalyticDataDtoImplToJson(
|
Map<String, dynamic> _$$ProductAnalyticDataDtoImplToJson(
|
||||||
@@ -558,12 +695,21 @@ Map<String, dynamic> _$$ProductAnalyticDataDtoImplToJson(
|
|||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'product_id': instance.productId,
|
'product_id': instance.productId,
|
||||||
'product_name': instance.productName,
|
'product_name': instance.productName,
|
||||||
|
'product_sku': instance.productSku,
|
||||||
|
'product_price': instance.productPrice,
|
||||||
'category_id': instance.categoryId,
|
'category_id': instance.categoryId,
|
||||||
'category_name': instance.categoryName,
|
'category_name': instance.categoryName,
|
||||||
|
'category_order': instance.categoryOrder,
|
||||||
'quantity_sold': instance.quantitySold,
|
'quantity_sold': instance.quantitySold,
|
||||||
'revenue': instance.revenue,
|
'revenue': instance.revenue,
|
||||||
'average_price': instance.averagePrice,
|
'average_price': instance.averagePrice,
|
||||||
'order_count': instance.orderCount,
|
'order_count': instance.orderCount,
|
||||||
|
'standard_hpp_per_unit': instance.standardHppPerUnit,
|
||||||
|
'standard_hpp_total': instance.standardHppTotal,
|
||||||
|
'fifo_hpp_per_unit': instance.fifoHppPerUnit,
|
||||||
|
'fifo_hpp_total': instance.fifoHppTotal,
|
||||||
|
'moving_average_hpp_per_unit': instance.movingAverageHppPerUnit,
|
||||||
|
'moving_average_hpp_total': instance.movingAverageHppTotal,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$PaymentMethodAnalyticDtoImpl _$$PaymentMethodAnalyticDtoImplFromJson(
|
_$PaymentMethodAnalyticDtoImpl _$$PaymentMethodAnalyticDtoImplFromJson(
|
||||||
@@ -571,6 +717,7 @@ _$PaymentMethodAnalyticDtoImpl _$$PaymentMethodAnalyticDtoImplFromJson(
|
|||||||
) => _$PaymentMethodAnalyticDtoImpl(
|
) => _$PaymentMethodAnalyticDtoImpl(
|
||||||
organizationId: json['organization_id'] as String?,
|
organizationId: json['organization_id'] as String?,
|
||||||
outletId: json['outlet_id'] as String?,
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
dateFrom: json['date_from'] as String?,
|
dateFrom: json['date_from'] as String?,
|
||||||
dateTo: json['date_to'] as String?,
|
dateTo: json['date_to'] as String?,
|
||||||
groupBy: json['group_by'] as String?,
|
groupBy: json['group_by'] as String?,
|
||||||
@@ -589,6 +736,7 @@ Map<String, dynamic> _$$PaymentMethodAnalyticDtoImplToJson(
|
|||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'organization_id': instance.organizationId,
|
'organization_id': instance.organizationId,
|
||||||
'outlet_id': instance.outletId,
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
'date_from': instance.dateFrom,
|
'date_from': instance.dateFrom,
|
||||||
'date_to': instance.dateTo,
|
'date_to': instance.dateTo,
|
||||||
'group_by': instance.groupBy,
|
'group_by': instance.groupBy,
|
||||||
@@ -690,7 +838,11 @@ _$PurchasingAnalyticSummaryDtoImpl _$$PurchasingAnalyticSummaryDtoImplFromJson(
|
|||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _$PurchasingAnalyticSummaryDtoImpl(
|
) => _$PurchasingAnalyticSummaryDtoImpl(
|
||||||
totalPurchases: json['total_purchases'] as num?,
|
totalPurchases: json['total_purchases'] as num?,
|
||||||
|
rawMaterialPurchases: json['raw_material_purchases'] as num?,
|
||||||
|
expensePurchases: json['expense_purchases'] as num?,
|
||||||
totalPurchaseOrders: json['total_purchase_orders'] as num?,
|
totalPurchaseOrders: json['total_purchase_orders'] as num?,
|
||||||
|
rawMaterialPurchaseOrders: json['raw_material_purchase_orders'] as num?,
|
||||||
|
expenseCount: json['expense_count'] as num?,
|
||||||
totalQuantity: json['total_quantity'] as num?,
|
totalQuantity: json['total_quantity'] as num?,
|
||||||
averagePurchaseOrderValue: json['average_purchase_order_value'] as num?,
|
averagePurchaseOrderValue: json['average_purchase_order_value'] as num?,
|
||||||
totalIngredients: json['total_ingredients'] as num?,
|
totalIngredients: json['total_ingredients'] as num?,
|
||||||
@@ -701,7 +853,11 @@ Map<String, dynamic> _$$PurchasingAnalyticSummaryDtoImplToJson(
|
|||||||
_$PurchasingAnalyticSummaryDtoImpl instance,
|
_$PurchasingAnalyticSummaryDtoImpl instance,
|
||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'total_purchases': instance.totalPurchases,
|
'total_purchases': instance.totalPurchases,
|
||||||
|
'raw_material_purchases': instance.rawMaterialPurchases,
|
||||||
|
'expense_purchases': instance.expensePurchases,
|
||||||
'total_purchase_orders': instance.totalPurchaseOrders,
|
'total_purchase_orders': instance.totalPurchaseOrders,
|
||||||
|
'raw_material_purchase_orders': instance.rawMaterialPurchaseOrders,
|
||||||
|
'expense_count': instance.expenseCount,
|
||||||
'total_quantity': instance.totalQuantity,
|
'total_quantity': instance.totalQuantity,
|
||||||
'average_purchase_order_value': instance.averagePurchaseOrderValue,
|
'average_purchase_order_value': instance.averagePurchaseOrderValue,
|
||||||
'total_ingredients': instance.totalIngredients,
|
'total_ingredients': instance.totalIngredients,
|
||||||
@@ -713,7 +869,11 @@ _$PurchasingAnalyticDataDtoImpl _$$PurchasingAnalyticDataDtoImplFromJson(
|
|||||||
) => _$PurchasingAnalyticDataDtoImpl(
|
) => _$PurchasingAnalyticDataDtoImpl(
|
||||||
date: json['date'] == null ? null : DateTime.parse(json['date'] as String),
|
date: json['date'] == null ? null : DateTime.parse(json['date'] as String),
|
||||||
purchases: json['purchases'] as num?,
|
purchases: json['purchases'] as num?,
|
||||||
|
rawMaterialPurchases: json['raw_material_purchases'] as num?,
|
||||||
|
expensePurchases: json['expense_purchases'] as num?,
|
||||||
purchaseOrders: json['purchase_orders'] as num?,
|
purchaseOrders: json['purchase_orders'] as num?,
|
||||||
|
rawMaterialPurchaseOrders: json['raw_material_purchase_orders'] as num?,
|
||||||
|
expenseCount: json['expense_count'] as num?,
|
||||||
quantity: json['quantity'] as num?,
|
quantity: json['quantity'] as num?,
|
||||||
ingredients: json['ingredients'] as num?,
|
ingredients: json['ingredients'] as num?,
|
||||||
vendors: json['vendors'] as num?,
|
vendors: json['vendors'] as num?,
|
||||||
@@ -724,7 +884,11 @@ Map<String, dynamic> _$$PurchasingAnalyticDataDtoImplToJson(
|
|||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'date': instance.date?.toIso8601String(),
|
'date': instance.date?.toIso8601String(),
|
||||||
'purchases': instance.purchases,
|
'purchases': instance.purchases,
|
||||||
|
'raw_material_purchases': instance.rawMaterialPurchases,
|
||||||
|
'expense_purchases': instance.expensePurchases,
|
||||||
'purchase_orders': instance.purchaseOrders,
|
'purchase_orders': instance.purchaseOrders,
|
||||||
|
'raw_material_purchase_orders': instance.rawMaterialPurchaseOrders,
|
||||||
|
'expense_count': instance.expenseCount,
|
||||||
'quantity': instance.quantity,
|
'quantity': instance.quantity,
|
||||||
'ingredients': instance.ingredients,
|
'ingredients': instance.ingredients,
|
||||||
'vendors': instance.vendors,
|
'vendors': instance.vendors,
|
||||||
@@ -773,3 +937,473 @@ Map<String, dynamic> _$$PurchasingVendorDataDtoImplToJson(
|
|||||||
'ingredient_count': instance.ingredientCount,
|
'ingredient_count': instance.ingredientCount,
|
||||||
'quantity': instance.quantity,
|
'quantity': instance.quantity,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_$ExclusiveSummaryDtoImpl _$$ExclusiveSummaryDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ExclusiveSummaryDtoImpl(
|
||||||
|
organizationId: json['organization_id'] as String?,
|
||||||
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
|
period: json['period'] == null
|
||||||
|
? null
|
||||||
|
: ExclusiveSummaryPeriodDto.fromJson(
|
||||||
|
json['period'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
summary: json['summary'] == null
|
||||||
|
? null
|
||||||
|
: ExclusiveSummarySummaryDto.fromJson(
|
||||||
|
json['summary'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
reimburse: json['reimburse'] == null
|
||||||
|
? null
|
||||||
|
: ExclusiveSummaryReimburseDto.fromJson(
|
||||||
|
json['reimburse'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
hppBreakdown: (json['hpp_breakdown'] as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) => ExclusiveSummaryBreakdownDto.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
operationalExpenseBreakdown:
|
||||||
|
(json['operational_expense_breakdown'] as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) => ExclusiveSummaryBreakdownDto.fromJson(
|
||||||
|
e as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
dailySummary: (json['daily_summary'] as List<dynamic>?)
|
||||||
|
?.map((e) => ExclusiveSummaryDailyDto.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
dailyTransactions: (json['daily_transactions'] as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) =>
|
||||||
|
ExclusiveSummaryTransactionDto.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ExclusiveSummaryDtoImplToJson(
|
||||||
|
_$ExclusiveSummaryDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'organization_id': instance.organizationId,
|
||||||
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
|
'period': instance.period,
|
||||||
|
'summary': instance.summary,
|
||||||
|
'reimburse': instance.reimburse,
|
||||||
|
'hpp_breakdown': instance.hppBreakdown,
|
||||||
|
'operational_expense_breakdown': instance.operationalExpenseBreakdown,
|
||||||
|
'daily_summary': instance.dailySummary,
|
||||||
|
'daily_transactions': instance.dailyTransactions,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ExclusiveSummaryPeriodDtoImpl _$$ExclusiveSummaryPeriodDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ExclusiveSummaryPeriodDtoImpl(
|
||||||
|
dateFrom: json['date_from'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['date_from'] as String),
|
||||||
|
dateTo: json['date_to'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['date_to'] as String),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ExclusiveSummaryPeriodDtoImplToJson(
|
||||||
|
_$ExclusiveSummaryPeriodDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'date_from': instance.dateFrom?.toIso8601String(),
|
||||||
|
'date_to': instance.dateTo?.toIso8601String(),
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ExclusiveSummarySummaryDtoImpl _$$ExclusiveSummarySummaryDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ExclusiveSummarySummaryDtoImpl(
|
||||||
|
sales: json['sales'] as num?,
|
||||||
|
hpp: json['hpp'] as num?,
|
||||||
|
grossProfit: json['gross_profit'] as num?,
|
||||||
|
salaryTotal: json['salary_total'] as num?,
|
||||||
|
salaryDw: json['salary_dw'] as num?,
|
||||||
|
salaryStaff: json['salary_staff'] as num?,
|
||||||
|
salaryOther: json['salary_other'] as num?,
|
||||||
|
otherOperationalExpenses: json['other_operational_expenses'] as num?,
|
||||||
|
operationalExpensesTotal: json['operational_expenses_total'] as num?,
|
||||||
|
totalCost: json['total_cost'] as num?,
|
||||||
|
netProfit: json['net_profit'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ExclusiveSummarySummaryDtoImplToJson(
|
||||||
|
_$ExclusiveSummarySummaryDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'sales': instance.sales,
|
||||||
|
'hpp': instance.hpp,
|
||||||
|
'gross_profit': instance.grossProfit,
|
||||||
|
'salary_total': instance.salaryTotal,
|
||||||
|
'salary_dw': instance.salaryDw,
|
||||||
|
'salary_staff': instance.salaryStaff,
|
||||||
|
'salary_other': instance.salaryOther,
|
||||||
|
'other_operational_expenses': instance.otherOperationalExpenses,
|
||||||
|
'operational_expenses_total': instance.operationalExpensesTotal,
|
||||||
|
'total_cost': instance.totalCost,
|
||||||
|
'net_profit': instance.netProfit,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ExclusiveSummaryReimburseDtoImpl _$$ExclusiveSummaryReimburseDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ExclusiveSummaryReimburseDtoImpl(
|
||||||
|
totalCost: json['total_cost'] as num?,
|
||||||
|
excludedSalaryStaff: json['excluded_salary_staff'] as num?,
|
||||||
|
totalReimburse: json['total_reimburse'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ExclusiveSummaryReimburseDtoImplToJson(
|
||||||
|
_$ExclusiveSummaryReimburseDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'total_cost': instance.totalCost,
|
||||||
|
'excluded_salary_staff': instance.excludedSalaryStaff,
|
||||||
|
'total_reimburse': instance.totalReimburse,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ExclusiveSummaryBreakdownDtoImpl _$$ExclusiveSummaryBreakdownDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ExclusiveSummaryBreakdownDtoImpl(
|
||||||
|
categoryCode: json['category_code'] as String?,
|
||||||
|
categoryName: json['category_name'] as String?,
|
||||||
|
amount: json['amount'] as num?,
|
||||||
|
percentage: json['percentage'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ExclusiveSummaryBreakdownDtoImplToJson(
|
||||||
|
_$ExclusiveSummaryBreakdownDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'category_code': instance.categoryCode,
|
||||||
|
'category_name': instance.categoryName,
|
||||||
|
'amount': instance.amount,
|
||||||
|
'percentage': instance.percentage,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ExclusiveSummaryDailyDtoImpl _$$ExclusiveSummaryDailyDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ExclusiveSummaryDailyDtoImpl(
|
||||||
|
date: json['date'] == null ? null : DateTime.parse(json['date'] as String),
|
||||||
|
transactionCount: json['transaction_count'] as num?,
|
||||||
|
totalCost: json['total_cost'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ExclusiveSummaryDailyDtoImplToJson(
|
||||||
|
_$ExclusiveSummaryDailyDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'date': instance.date?.toIso8601String(),
|
||||||
|
'transaction_count': instance.transactionCount,
|
||||||
|
'total_cost': instance.totalCost,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ExclusiveSummaryTransactionDtoImpl
|
||||||
|
_$$ExclusiveSummaryTransactionDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ExclusiveSummaryTransactionDtoImpl(
|
||||||
|
date: json['date'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['date'] as String),
|
||||||
|
categoryCode: json['category_code'] as String?,
|
||||||
|
categoryName: json['category_name'] as String?,
|
||||||
|
description: json['description'] as String?,
|
||||||
|
amount: json['amount'] as num?,
|
||||||
|
source: json['source'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ExclusiveSummaryTransactionDtoImplToJson(
|
||||||
|
_$ExclusiveSummaryTransactionDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'date': instance.date?.toIso8601String(),
|
||||||
|
'category_code': instance.categoryCode,
|
||||||
|
'category_name': instance.categoryName,
|
||||||
|
'description': instance.description,
|
||||||
|
'amount': instance.amount,
|
||||||
|
'source': instance.source,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingDtoImpl _$$ProfitSharingDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingDtoImpl(
|
||||||
|
organizationId: json['organization_id'] as String?,
|
||||||
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
|
dateFrom: json['date_from'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['date_from'] as String),
|
||||||
|
dateTo: json['date_to'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['date_to'] as String),
|
||||||
|
data: (json['data'] as List<dynamic>?)
|
||||||
|
?.map((e) => ProfitSharingCategoryDto.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
budget: json['budget'] == null
|
||||||
|
? null
|
||||||
|
: ProfitSharingBudgetDto.fromJson(json['budget'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingDtoImplToJson(
|
||||||
|
_$ProfitSharingDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'organization_id': instance.organizationId,
|
||||||
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
|
'date_from': instance.dateFrom?.toIso8601String(),
|
||||||
|
'date_to': instance.dateTo?.toIso8601String(),
|
||||||
|
'data': instance.data,
|
||||||
|
'budget': instance.budget,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingCategoryDtoImpl _$$ProfitSharingCategoryDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingCategoryDtoImpl(
|
||||||
|
parentCategoryId: json['parent_category_id'] as String?,
|
||||||
|
parentCategoryName: json['parent_category_name'] as String?,
|
||||||
|
totalRevenue: json['total_revenue'] as num?,
|
||||||
|
totalQuantity: json['total_quantity'] as num?,
|
||||||
|
categoryCount: json['category_count'] as num?,
|
||||||
|
productCount: json['product_count'] as num?,
|
||||||
|
orderCount: json['order_count'] as num?,
|
||||||
|
totalStandardHpp: json['total_standard_hpp'] as num?,
|
||||||
|
totalFifoHpp: json['total_fifo_hpp'] as num?,
|
||||||
|
totalMovingAverageHpp: json['total_moving_average_hpp'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingCategoryDtoImplToJson(
|
||||||
|
_$ProfitSharingCategoryDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'parent_category_id': instance.parentCategoryId,
|
||||||
|
'parent_category_name': instance.parentCategoryName,
|
||||||
|
'total_revenue': instance.totalRevenue,
|
||||||
|
'total_quantity': instance.totalQuantity,
|
||||||
|
'category_count': instance.categoryCount,
|
||||||
|
'product_count': instance.productCount,
|
||||||
|
'order_count': instance.orderCount,
|
||||||
|
'total_standard_hpp': instance.totalStandardHpp,
|
||||||
|
'total_fifo_hpp': instance.totalFifoHpp,
|
||||||
|
'total_moving_average_hpp': instance.totalMovingAverageHpp,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingBudgetDtoImpl _$$ProfitSharingBudgetDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingBudgetDtoImpl(
|
||||||
|
percentages: json['percentages'] == null
|
||||||
|
? null
|
||||||
|
: ProfitSharingPercentageDto.fromJson(
|
||||||
|
json['percentages'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
cutOffFrom: json['cut_off_from'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['cut_off_from'] as String),
|
||||||
|
cutOffTo: json['cut_off_to'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['cut_off_to'] as String),
|
||||||
|
total: json['total'] == null
|
||||||
|
? null
|
||||||
|
: ProfitSharingPeriodDto.fromJson(json['total'] as Map<String, dynamic>),
|
||||||
|
weekly: (json['weekly'] as List<dynamic>?)
|
||||||
|
?.map((e) => ProfitSharingPeriodDto.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
monthly: (json['monthly'] as List<dynamic>?)
|
||||||
|
?.map((e) => ProfitSharingPeriodDto.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingBudgetDtoImplToJson(
|
||||||
|
_$ProfitSharingBudgetDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'percentages': instance.percentages,
|
||||||
|
'cut_off_from': instance.cutOffFrom?.toIso8601String(),
|
||||||
|
'cut_off_to': instance.cutOffTo?.toIso8601String(),
|
||||||
|
'total': instance.total,
|
||||||
|
'weekly': instance.weekly,
|
||||||
|
'monthly': instance.monthly,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingPercentageDtoImpl _$$ProfitSharingPercentageDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingPercentageDtoImpl(
|
||||||
|
purchase: json['purchase'] as num?,
|
||||||
|
owner: json['owner'] as num?,
|
||||||
|
team: json['team'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingPercentageDtoImplToJson(
|
||||||
|
_$ProfitSharingPercentageDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'purchase': instance.purchase,
|
||||||
|
'owner': instance.owner,
|
||||||
|
'team': instance.team,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingPeriodDtoImpl _$$ProfitSharingPeriodDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingPeriodDtoImpl(
|
||||||
|
periodStart: json['period_start'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['period_start'] as String),
|
||||||
|
periodEnd: json['period_end'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['period_end'] as String),
|
||||||
|
revenue: json['revenue'] as num?,
|
||||||
|
orderCount: json['order_count'] as num?,
|
||||||
|
limitPurchase: json['limit_purchase'] as num?,
|
||||||
|
limitOwner: json['limit_owner'] as num?,
|
||||||
|
limitTeam: json['limit_team'] as num?,
|
||||||
|
month: json['month'] as String?,
|
||||||
|
weekCount: json['week_count'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingPeriodDtoImplToJson(
|
||||||
|
_$ProfitSharingPeriodDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'period_start': instance.periodStart?.toIso8601String(),
|
||||||
|
'period_end': instance.periodEnd?.toIso8601String(),
|
||||||
|
'revenue': instance.revenue,
|
||||||
|
'order_count': instance.orderCount,
|
||||||
|
'limit_purchase': instance.limitPurchase,
|
||||||
|
'limit_owner': instance.limitOwner,
|
||||||
|
'limit_team': instance.limitTeam,
|
||||||
|
'month': instance.month,
|
||||||
|
'week_count': instance.weekCount,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingDetailDtoImpl _$$ProfitSharingDetailDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingDetailDtoImpl(
|
||||||
|
organizationId: json['organization_id'] as String?,
|
||||||
|
outletId: json['outlet_id'] as String?,
|
||||||
|
outletName: json['outlet_name'] as String?,
|
||||||
|
dateFrom: json['date_from'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['date_from'] as String),
|
||||||
|
dateTo: json['date_to'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['date_to'] as String),
|
||||||
|
parentCategoryId: json['parent_category_id'] as String?,
|
||||||
|
parentCategoryName: json['parent_category_name'] as String?,
|
||||||
|
summary: json['summary'] == null
|
||||||
|
? null
|
||||||
|
: ProfitSharingSummaryDto.fromJson(
|
||||||
|
json['summary'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
categories: (json['categories'] as List<dynamic>?)
|
||||||
|
?.map(
|
||||||
|
(e) => ProfitSharingSubCategoryDto.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
budget: json['budget'] == null
|
||||||
|
? null
|
||||||
|
: ProfitSharingBudgetDto.fromJson(json['budget'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingDetailDtoImplToJson(
|
||||||
|
_$ProfitSharingDetailDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'organization_id': instance.organizationId,
|
||||||
|
'outlet_id': instance.outletId,
|
||||||
|
'outlet_name': instance.outletName,
|
||||||
|
'date_from': instance.dateFrom?.toIso8601String(),
|
||||||
|
'date_to': instance.dateTo?.toIso8601String(),
|
||||||
|
'parent_category_id': instance.parentCategoryId,
|
||||||
|
'parent_category_name': instance.parentCategoryName,
|
||||||
|
'summary': instance.summary,
|
||||||
|
'categories': instance.categories,
|
||||||
|
'budget': instance.budget,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingSummaryDtoImpl _$$ProfitSharingSummaryDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingSummaryDtoImpl(
|
||||||
|
totalRevenue: json['total_revenue'] as num?,
|
||||||
|
totalQuantity: json['total_quantity'] as num?,
|
||||||
|
categoryCount: json['category_count'] as num?,
|
||||||
|
productCount: json['product_count'] as num?,
|
||||||
|
orderCount: json['order_count'] as num?,
|
||||||
|
totalStandardHpp: json['total_standard_hpp'] as num?,
|
||||||
|
totalFifoHpp: json['total_fifo_hpp'] as num?,
|
||||||
|
totalMovingAverageHpp: json['total_moving_average_hpp'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingSummaryDtoImplToJson(
|
||||||
|
_$ProfitSharingSummaryDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'total_revenue': instance.totalRevenue,
|
||||||
|
'total_quantity': instance.totalQuantity,
|
||||||
|
'category_count': instance.categoryCount,
|
||||||
|
'product_count': instance.productCount,
|
||||||
|
'order_count': instance.orderCount,
|
||||||
|
'total_standard_hpp': instance.totalStandardHpp,
|
||||||
|
'total_fifo_hpp': instance.totalFifoHpp,
|
||||||
|
'total_moving_average_hpp': instance.totalMovingAverageHpp,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingSubCategoryDtoImpl _$$ProfitSharingSubCategoryDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingSubCategoryDtoImpl(
|
||||||
|
categoryId: json['category_id'] as String?,
|
||||||
|
categoryName: json['category_name'] as String?,
|
||||||
|
totalRevenue: json['total_revenue'] as num?,
|
||||||
|
totalQuantity: json['total_quantity'] as num?,
|
||||||
|
productCount: json['product_count'] as num?,
|
||||||
|
orderCount: json['order_count'] as num?,
|
||||||
|
totalStandardHpp: json['total_standard_hpp'] as num?,
|
||||||
|
totalFifoHpp: json['total_fifo_hpp'] as num?,
|
||||||
|
totalMovingAverageHpp: json['total_moving_average_hpp'] as num?,
|
||||||
|
products: (json['products'] as List<dynamic>?)
|
||||||
|
?.map((e) => ProfitSharingProductDto.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingSubCategoryDtoImplToJson(
|
||||||
|
_$ProfitSharingSubCategoryDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'category_id': instance.categoryId,
|
||||||
|
'category_name': instance.categoryName,
|
||||||
|
'total_revenue': instance.totalRevenue,
|
||||||
|
'total_quantity': instance.totalQuantity,
|
||||||
|
'product_count': instance.productCount,
|
||||||
|
'order_count': instance.orderCount,
|
||||||
|
'total_standard_hpp': instance.totalStandardHpp,
|
||||||
|
'total_fifo_hpp': instance.totalFifoHpp,
|
||||||
|
'total_moving_average_hpp': instance.totalMovingAverageHpp,
|
||||||
|
'products': instance.products,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ProfitSharingProductDtoImpl _$$ProfitSharingProductDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$ProfitSharingProductDtoImpl(
|
||||||
|
productId: json['product_id'] as String?,
|
||||||
|
productName: json['product_name'] as String?,
|
||||||
|
productSku: json['product_sku'] as String?,
|
||||||
|
productPrice: json['product_price'] as num?,
|
||||||
|
quantitySold: json['quantity_sold'] as num?,
|
||||||
|
revenue: json['revenue'] as num?,
|
||||||
|
averagePrice: json['average_price'] as num?,
|
||||||
|
orderCount: json['order_count'] as num?,
|
||||||
|
standardHppPerUnit: json['standard_hpp_per_unit'] as num?,
|
||||||
|
standardHppTotal: json['standard_hpp_total'] as num?,
|
||||||
|
fifoHppPerUnit: json['fifo_hpp_per_unit'] as num?,
|
||||||
|
fifoHppTotal: json['fifo_hpp_total'] as num?,
|
||||||
|
movingAverageHppPerUnit: json['moving_average_hpp_per_unit'] as num?,
|
||||||
|
movingAverageHppTotal: json['moving_average_hpp_total'] as num?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ProfitSharingProductDtoImplToJson(
|
||||||
|
_$ProfitSharingProductDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'product_id': instance.productId,
|
||||||
|
'product_name': instance.productName,
|
||||||
|
'product_sku': instance.productSku,
|
||||||
|
'product_price': instance.productPrice,
|
||||||
|
'quantity_sold': instance.quantitySold,
|
||||||
|
'revenue': instance.revenue,
|
||||||
|
'average_price': instance.averagePrice,
|
||||||
|
'order_count': instance.orderCount,
|
||||||
|
'standard_hpp_per_unit': instance.standardHppPerUnit,
|
||||||
|
'standard_hpp_total': instance.standardHppTotal,
|
||||||
|
'fifo_hpp_per_unit': instance.fifoHppPerUnit,
|
||||||
|
'fifo_hpp_total': instance.fifoHppTotal,
|
||||||
|
'moving_average_hpp_per_unit': instance.movingAverageHppPerUnit,
|
||||||
|
'moving_average_hpp_total': instance.movingAverageHppTotal,
|
||||||
|
};
|
||||||
|
|||||||
@@ -236,11 +236,13 @@ class AnalyticRemoteDataProvider {
|
|||||||
required DateTime dateFrom,
|
required DateTime dateFrom,
|
||||||
required DateTime dateTo,
|
required DateTime dateTo,
|
||||||
String? outletId,
|
String? outletId,
|
||||||
|
String groupBy = 'day',
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final Map<String, dynamic> params = {
|
final Map<String, dynamic> params = {
|
||||||
'date_from': dateFrom.toServerDate,
|
'date_from': dateFrom.toServerDate,
|
||||||
'date_to': dateTo.toServerDate,
|
'date_to': dateTo.toServerDate,
|
||||||
|
'group_by': groupBy,
|
||||||
};
|
};
|
||||||
if (outletId != null) params['outlet_id'] = outletId;
|
if (outletId != null) params['outlet_id'] = outletId;
|
||||||
|
|
||||||
@@ -262,4 +264,105 @@ class AnalyticRemoteDataProvider {
|
|||||||
return DC.error(AnalyticFailure.serverError(e));
|
return DC.error(AnalyticFailure.serverError(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<DC<AnalyticFailure, ExclusiveSummaryDto>> fetchExclusiveSummary({
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
String? outletId,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final Map<String, dynamic> params = {
|
||||||
|
'date_from': dateFrom.toServerDate,
|
||||||
|
'date_to': dateTo.toServerDate,
|
||||||
|
};
|
||||||
|
if (outletId != null) params['outlet_id'] = outletId;
|
||||||
|
|
||||||
|
final response = await _apiClient.get(
|
||||||
|
ApiPath.exclusiveSummaryAnalytic,
|
||||||
|
params: params,
|
||||||
|
headers: getAuthorizationHeader(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['data'] == null) {
|
||||||
|
return DC.error(AnalyticFailure.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = ExclusiveSummaryDto.fromJson(response.data['data']);
|
||||||
|
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log('fetchExclusiveSummaryError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return DC.error(AnalyticFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DC<AnalyticFailure, ProfitSharingDto>> fetchProfitSharing({
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
String? outletId,
|
||||||
|
String groupBy = 'day',
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final Map<String, dynamic> params = {
|
||||||
|
'date_from': dateFrom.toServerDate,
|
||||||
|
'date_to': dateTo.toServerDate,
|
||||||
|
'group_by': groupBy,
|
||||||
|
};
|
||||||
|
if (outletId != null) params['outlet_id'] = outletId;
|
||||||
|
|
||||||
|
final response = await _apiClient.get(
|
||||||
|
ApiPath.parentCategoryAnalytic,
|
||||||
|
params: params,
|
||||||
|
headers: getAuthorizationHeader(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['data'] == null) {
|
||||||
|
return DC.error(AnalyticFailure.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = ProfitSharingDto.fromJson(response.data['data']);
|
||||||
|
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log('fetchProfitSharingError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return DC.error(AnalyticFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DC<AnalyticFailure, ProfitSharingDetailDto>> fetchProfitSharingDetail({
|
||||||
|
required String parentCategoryId,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
|
String? outletId,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final Map<String, dynamic> params = {
|
||||||
|
'date_from': dateFrom.toServerDate,
|
||||||
|
'date_to': dateTo.toServerDate,
|
||||||
|
};
|
||||||
|
if (outletId != null) params['outlet_id'] = outletId;
|
||||||
|
|
||||||
|
final response = await _apiClient.get(
|
||||||
|
'${ApiPath.parentCategoryAnalytic}/$parentCategoryId',
|
||||||
|
params: params,
|
||||||
|
headers: getAuthorizationHeader(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['data'] == null) {
|
||||||
|
return DC.error(AnalyticFailure.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = ProfitSharingDetailDto.fromJson(response.data['data']);
|
||||||
|
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log(
|
||||||
|
'fetchProfitSharingDetailError',
|
||||||
|
name: _logName,
|
||||||
|
error: e,
|
||||||
|
stackTrace: s,
|
||||||
|
);
|
||||||
|
return DC.error(AnalyticFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ class CategoryAnalyticDto with _$CategoryAnalyticDto {
|
|||||||
const factory CategoryAnalyticDto({
|
const factory CategoryAnalyticDto({
|
||||||
@JsonKey(name: 'organization_id') String? organizationId,
|
@JsonKey(name: 'organization_id') String? organizationId,
|
||||||
@JsonKey(name: 'outlet_id') String? outletId,
|
@JsonKey(name: 'outlet_id') String? outletId,
|
||||||
|
@JsonKey(name: 'outlet_name') String? outletName,
|
||||||
@JsonKey(name: 'date_from') String? dateFrom,
|
@JsonKey(name: 'date_from') String? dateFrom,
|
||||||
@JsonKey(name: 'date_to') String? dateTo,
|
@JsonKey(name: 'date_to') String? dateTo,
|
||||||
@JsonKey(name: 'data') List<CategoryAnalyticItemDto>? data,
|
@JsonKey(name: 'data') List<CategoryAnalyticItemDto>? data,
|
||||||
@@ -18,6 +19,7 @@ class CategoryAnalyticDto with _$CategoryAnalyticDto {
|
|||||||
CategoryAnalytic toDomain() => CategoryAnalytic(
|
CategoryAnalytic toDomain() => CategoryAnalytic(
|
||||||
organizationId: organizationId ?? "",
|
organizationId: organizationId ?? "",
|
||||||
outletId: outletId ?? "",
|
outletId: outletId ?? "",
|
||||||
|
outletName: outletName ?? "",
|
||||||
dateFrom: dateFrom ?? "",
|
dateFrom: dateFrom ?? "",
|
||||||
dateTo: dateTo ?? "",
|
dateTo: dateTo ?? "",
|
||||||
data: data?.map((e) => e.toDomain()).toList() ?? [],
|
data: data?.map((e) => e.toDomain()).toList() ?? [],
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ class DashboardAnalyticDto with _$DashboardAnalyticDto {
|
|||||||
const factory DashboardAnalyticDto({
|
const factory DashboardAnalyticDto({
|
||||||
@JsonKey(name: 'organization_id') String? organizationId,
|
@JsonKey(name: 'organization_id') String? organizationId,
|
||||||
@JsonKey(name: 'outlet_id') String? outletId,
|
@JsonKey(name: 'outlet_id') String? outletId,
|
||||||
|
@JsonKey(name: 'outlet_name') String? outletName,
|
||||||
@JsonKey(name: 'date_from') String? dateFrom,
|
@JsonKey(name: 'date_from') String? dateFrom,
|
||||||
@JsonKey(name: 'date_to') String? dateTo,
|
@JsonKey(name: 'date_to') String? dateTo,
|
||||||
@JsonKey(name: 'overview') DashboardOverviewDto? overview,
|
@JsonKey(name: 'overview') DashboardOverviewDto? overview,
|
||||||
@@ -22,6 +23,7 @@ class DashboardAnalyticDto with _$DashboardAnalyticDto {
|
|||||||
DashboardAnalytic toDomain() => DashboardAnalytic(
|
DashboardAnalytic toDomain() => DashboardAnalytic(
|
||||||
organizationId: organizationId ?? '',
|
organizationId: organizationId ?? '',
|
||||||
outletId: outletId ?? '',
|
outletId: outletId ?? '',
|
||||||
|
outletName: outletName ?? '',
|
||||||
dateFrom: dateFrom ?? '',
|
dateFrom: dateFrom ?? '',
|
||||||
dateTo: dateTo ?? '',
|
dateTo: dateTo ?? '',
|
||||||
overview: overview?.toDomain() ?? DashboardOverview.empty(),
|
overview: overview?.toDomain() ?? DashboardOverview.empty(),
|
||||||
@@ -42,6 +44,9 @@ class DashboardOverviewDto with _$DashboardOverviewDto {
|
|||||||
@JsonKey(name: 'total_customers') int? totalCustomers,
|
@JsonKey(name: 'total_customers') int? totalCustomers,
|
||||||
@JsonKey(name: 'voided_orders') int? voidedOrders,
|
@JsonKey(name: 'voided_orders') int? voidedOrders,
|
||||||
@JsonKey(name: 'refunded_orders') int? refundedOrders,
|
@JsonKey(name: 'refunded_orders') int? refundedOrders,
|
||||||
|
@JsonKey(name: 'total_item_sold') int? totalItemSold,
|
||||||
|
@JsonKey(name: 'total_low_stock') int? totalLowStock,
|
||||||
|
@JsonKey(name: 'total_product_active') int? totalProductActive,
|
||||||
}) = _DashboardOverviewDto;
|
}) = _DashboardOverviewDto;
|
||||||
|
|
||||||
factory DashboardOverviewDto.fromJson(Map<String, dynamic> json) =>
|
factory DashboardOverviewDto.fromJson(Map<String, dynamic> json) =>
|
||||||
@@ -54,6 +59,9 @@ class DashboardOverviewDto with _$DashboardOverviewDto {
|
|||||||
totalCustomers: totalCustomers ?? 0,
|
totalCustomers: totalCustomers ?? 0,
|
||||||
voidedOrders: voidedOrders ?? 0,
|
voidedOrders: voidedOrders ?? 0,
|
||||||
refundedOrders: refundedOrders ?? 0,
|
refundedOrders: refundedOrders ?? 0,
|
||||||
|
totalItemSold: totalItemSold ?? 0,
|
||||||
|
totalLowStock: totalLowStock ?? 0,
|
||||||
|
totalProductActive: totalProductActive ?? 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,183 @@
|
|||||||
|
part of '../analytic_dtos.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryDto with _$ExclusiveSummaryDto {
|
||||||
|
const ExclusiveSummaryDto._();
|
||||||
|
|
||||||
|
const factory ExclusiveSummaryDto({
|
||||||
|
@JsonKey(name: 'organization_id') String? organizationId,
|
||||||
|
@JsonKey(name: 'outlet_id') String? outletId,
|
||||||
|
@JsonKey(name: 'outlet_name') String? outletName,
|
||||||
|
@JsonKey(name: 'period') ExclusiveSummaryPeriodDto? period,
|
||||||
|
@JsonKey(name: 'summary') ExclusiveSummarySummaryDto? summary,
|
||||||
|
@JsonKey(name: 'reimburse') ExclusiveSummaryReimburseDto? reimburse,
|
||||||
|
@JsonKey(name: 'hpp_breakdown')
|
||||||
|
List<ExclusiveSummaryBreakdownDto>? hppBreakdown,
|
||||||
|
@JsonKey(name: 'operational_expense_breakdown')
|
||||||
|
List<ExclusiveSummaryBreakdownDto>? operationalExpenseBreakdown,
|
||||||
|
@JsonKey(name: 'daily_summary')
|
||||||
|
List<ExclusiveSummaryDailyDto>? dailySummary,
|
||||||
|
@JsonKey(name: 'daily_transactions')
|
||||||
|
List<ExclusiveSummaryTransactionDto>? dailyTransactions,
|
||||||
|
}) = _ExclusiveSummaryDto;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ExclusiveSummaryDtoFromJson(json);
|
||||||
|
|
||||||
|
ExclusiveSummary toDomain() => ExclusiveSummary(
|
||||||
|
organizationId: organizationId ?? '',
|
||||||
|
outletId: outletId ?? '',
|
||||||
|
outletName: outletName ?? '',
|
||||||
|
period: period?.toDomain() ?? ExclusiveSummaryPeriod.empty(),
|
||||||
|
summary: summary?.toDomain() ?? ExclusiveSummarySummary.empty(),
|
||||||
|
reimburse: reimburse?.toDomain() ?? ExclusiveSummaryReimburse.empty(),
|
||||||
|
hppBreakdown: hppBreakdown?.map((e) => e.toDomain()).toList() ?? [],
|
||||||
|
operationalExpenseBreakdown:
|
||||||
|
operationalExpenseBreakdown?.map((e) => e.toDomain()).toList() ?? [],
|
||||||
|
dailySummary: dailySummary?.map((e) => e.toDomain()).toList() ?? [],
|
||||||
|
dailyTransactions:
|
||||||
|
dailyTransactions?.map((e) => e.toDomain()).toList() ?? [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryPeriodDto with _$ExclusiveSummaryPeriodDto {
|
||||||
|
const ExclusiveSummaryPeriodDto._();
|
||||||
|
|
||||||
|
const factory ExclusiveSummaryPeriodDto({
|
||||||
|
@JsonKey(name: 'date_from') DateTime? dateFrom,
|
||||||
|
@JsonKey(name: 'date_to') DateTime? dateTo,
|
||||||
|
}) = _ExclusiveSummaryPeriodDto;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryPeriodDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ExclusiveSummaryPeriodDtoFromJson(json);
|
||||||
|
|
||||||
|
ExclusiveSummaryPeriod toDomain() => ExclusiveSummaryPeriod(
|
||||||
|
dateFrom: dateFrom ?? DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
dateTo: dateTo ?? DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummarySummaryDto with _$ExclusiveSummarySummaryDto {
|
||||||
|
const ExclusiveSummarySummaryDto._();
|
||||||
|
|
||||||
|
const factory ExclusiveSummarySummaryDto({
|
||||||
|
@JsonKey(name: 'sales') num? sales,
|
||||||
|
@JsonKey(name: 'hpp') num? hpp,
|
||||||
|
@JsonKey(name: 'gross_profit') num? grossProfit,
|
||||||
|
@JsonKey(name: 'salary_total') num? salaryTotal,
|
||||||
|
@JsonKey(name: 'salary_dw') num? salaryDw,
|
||||||
|
@JsonKey(name: 'salary_staff') num? salaryStaff,
|
||||||
|
@JsonKey(name: 'salary_other') num? salaryOther,
|
||||||
|
@JsonKey(name: 'other_operational_expenses') num? otherOperationalExpenses,
|
||||||
|
@JsonKey(name: 'operational_expenses_total') num? operationalExpensesTotal,
|
||||||
|
@JsonKey(name: 'total_cost') num? totalCost,
|
||||||
|
@JsonKey(name: 'net_profit') num? netProfit,
|
||||||
|
}) = _ExclusiveSummarySummaryDto;
|
||||||
|
|
||||||
|
factory ExclusiveSummarySummaryDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ExclusiveSummarySummaryDtoFromJson(json);
|
||||||
|
|
||||||
|
ExclusiveSummarySummary toDomain() => ExclusiveSummarySummary(
|
||||||
|
sales: sales?.toInt() ?? 0,
|
||||||
|
hpp: hpp?.toInt() ?? 0,
|
||||||
|
grossProfit: grossProfit?.toInt() ?? 0,
|
||||||
|
salaryTotal: salaryTotal?.toInt() ?? 0,
|
||||||
|
salaryDw: salaryDw?.toInt() ?? 0,
|
||||||
|
salaryStaff: salaryStaff?.toInt() ?? 0,
|
||||||
|
salaryOther: salaryOther?.toInt() ?? 0,
|
||||||
|
otherOperationalExpenses: otherOperationalExpenses?.toInt() ?? 0,
|
||||||
|
operationalExpensesTotal: operationalExpensesTotal?.toInt() ?? 0,
|
||||||
|
totalCost: totalCost?.toInt() ?? 0,
|
||||||
|
netProfit: netProfit?.toInt() ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryReimburseDto with _$ExclusiveSummaryReimburseDto {
|
||||||
|
const ExclusiveSummaryReimburseDto._();
|
||||||
|
|
||||||
|
const factory ExclusiveSummaryReimburseDto({
|
||||||
|
@JsonKey(name: 'total_cost') num? totalCost,
|
||||||
|
@JsonKey(name: 'excluded_salary_staff') num? excludedSalaryStaff,
|
||||||
|
@JsonKey(name: 'total_reimburse') num? totalReimburse,
|
||||||
|
}) = _ExclusiveSummaryReimburseDto;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryReimburseDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ExclusiveSummaryReimburseDtoFromJson(json);
|
||||||
|
|
||||||
|
ExclusiveSummaryReimburse toDomain() => ExclusiveSummaryReimburse(
|
||||||
|
totalCost: totalCost?.toInt() ?? 0,
|
||||||
|
excludedSalaryStaff: excludedSalaryStaff?.toInt() ?? 0,
|
||||||
|
totalReimburse: totalReimburse?.toInt() ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryBreakdownDto with _$ExclusiveSummaryBreakdownDto {
|
||||||
|
const ExclusiveSummaryBreakdownDto._();
|
||||||
|
|
||||||
|
const factory ExclusiveSummaryBreakdownDto({
|
||||||
|
@JsonKey(name: 'category_code') String? categoryCode,
|
||||||
|
@JsonKey(name: 'category_name') String? categoryName,
|
||||||
|
@JsonKey(name: 'amount') num? amount,
|
||||||
|
@JsonKey(name: 'percentage') num? percentage,
|
||||||
|
}) = _ExclusiveSummaryBreakdownDto;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryBreakdownDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ExclusiveSummaryBreakdownDtoFromJson(json);
|
||||||
|
|
||||||
|
ExclusiveSummaryBreakdown toDomain() => ExclusiveSummaryBreakdown(
|
||||||
|
categoryCode: categoryCode ?? '',
|
||||||
|
categoryName: categoryName ?? '',
|
||||||
|
amount: amount?.toInt() ?? 0,
|
||||||
|
percentage: percentage?.toDouble() ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryDailyDto with _$ExclusiveSummaryDailyDto {
|
||||||
|
const ExclusiveSummaryDailyDto._();
|
||||||
|
|
||||||
|
const factory ExclusiveSummaryDailyDto({
|
||||||
|
@JsonKey(name: 'date') DateTime? date,
|
||||||
|
@JsonKey(name: 'transaction_count') num? transactionCount,
|
||||||
|
@JsonKey(name: 'total_cost') num? totalCost,
|
||||||
|
}) = _ExclusiveSummaryDailyDto;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryDailyDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ExclusiveSummaryDailyDtoFromJson(json);
|
||||||
|
|
||||||
|
ExclusiveSummaryDaily toDomain() => ExclusiveSummaryDaily(
|
||||||
|
date: date ?? DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
transactionCount: transactionCount?.toInt() ?? 0,
|
||||||
|
totalCost: totalCost?.toInt() ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ExclusiveSummaryTransactionDto with _$ExclusiveSummaryTransactionDto {
|
||||||
|
const ExclusiveSummaryTransactionDto._();
|
||||||
|
|
||||||
|
const factory ExclusiveSummaryTransactionDto({
|
||||||
|
@JsonKey(name: 'date') DateTime? date,
|
||||||
|
@JsonKey(name: 'category_code') String? categoryCode,
|
||||||
|
@JsonKey(name: 'category_name') String? categoryName,
|
||||||
|
@JsonKey(name: 'description') String? description,
|
||||||
|
@JsonKey(name: 'amount') num? amount,
|
||||||
|
@JsonKey(name: 'source') String? source,
|
||||||
|
}) = _ExclusiveSummaryTransactionDto;
|
||||||
|
|
||||||
|
factory ExclusiveSummaryTransactionDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ExclusiveSummaryTransactionDtoFromJson(json);
|
||||||
|
|
||||||
|
ExclusiveSummaryTransaction toDomain() => ExclusiveSummaryTransaction(
|
||||||
|
date: date ?? DateTime.fromMillisecondsSinceEpoch(0),
|
||||||
|
categoryCode: categoryCode ?? '',
|
||||||
|
categoryName: categoryName ?? '',
|
||||||
|
description: description ?? '',
|
||||||
|
amount: amount?.toInt() ?? 0,
|
||||||
|
source: source ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||