Compare commits
51 Commits
192c322816
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ff7b3b505 | ||
|
|
2a14f82b72 | ||
|
|
2dadcc5ce1 | ||
|
|
27798cc234 | ||
|
|
e1c9f818d2 | ||
|
|
cae04b3ae7 | ||
|
|
9fb4ba621b | ||
|
|
19d9a3dc2d | ||
|
|
fc9b5e967f | ||
|
|
211ebdf1d8 | ||
|
|
359c31a4d4 | ||
|
|
49a41d24eb | ||
|
|
12bd70479c | ||
|
|
e62c466155 | ||
|
|
250c453413 | ||
|
|
4ecb236532 | ||
|
|
50aed06aad | ||
|
|
5e3e1401c1 | ||
|
|
9e7bda32f2 | ||
|
|
65f6f825a6 | ||
|
|
440b474504 | ||
|
|
ed6cc4cebc | ||
|
|
6e7e848ad6 | ||
|
|
b6cb9e865a | ||
|
|
ba04576750 | ||
|
|
dc8e60f589 | ||
|
|
88ac2f2f07 | ||
|
|
a07f165f0c | ||
|
|
3741239d83 | ||
|
|
7ef12fa83a | ||
|
|
5e9b0cb562 | ||
|
|
84669ac89c | ||
|
|
039dfb9fb5 | ||
|
|
c3b5653420 | ||
|
|
1851d60038 | ||
|
|
75d6507719 | ||
|
|
354df3ad01 | ||
|
|
42d91a5a99 | ||
|
|
06b0834822 | ||
|
|
4913a4e04b | ||
|
|
f2f95849d4 | ||
|
|
dc85157758 | ||
|
|
1fcef52d5e | ||
|
|
0708ed7d6f | ||
|
|
54cb7d0fdd | ||
|
|
73ad2fc80c | ||
|
|
841d77d886 | ||
|
|
03a7b7940a | ||
|
|
fc4711a18e | ||
|
|
0dda402246 | ||
|
|
a5eb95fa64 |
@@ -420,7 +420,7 @@ ref.watch(userProvider).when(
|
|||||||
|
|
||||||
data: (user) => UserView(user),
|
data: (user) => UserView(user),
|
||||||
|
|
||||||
loading: () => CircularProgressIndicator(),
|
loading: () => const CustomLoadingIndicator(),
|
||||||
|
|
||||||
error: (error, stack) => ErrorView(error),
|
error: (error, stack) => ErrorView(error),
|
||||||
|
|
||||||
@@ -443,7 +443,7 @@ switch (userState) {
|
|||||||
|
|
||||||
case AsyncLoading():
|
case AsyncLoading():
|
||||||
|
|
||||||
return CircularProgressIndicator();
|
return const CustomLoadingIndicator();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
256
APP_SETTINGS.md
Normal file
256
APP_SETTINGS.md
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
# App Settings & Theme System
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The app uses a centralized `AppSettingsBox` (Hive) for storing all app-level settings. This includes theme preferences, language settings, notification preferences, and other user configurations.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## AppSettingsBox
|
||||||
|
|
||||||
|
**Location**: `lib/core/database/app_settings_box.dart`
|
||||||
|
|
||||||
|
### Initialization
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// In main.dart - call before runApp()
|
||||||
|
await AppSettingsBox.init();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Storage Keys
|
||||||
|
|
||||||
|
| Key | Type | Default | Description |
|
||||||
|
|-----|------|---------|-------------|
|
||||||
|
| **Theme** |
|
||||||
|
| `seed_color_id` | String | `'blue'` | Selected theme color ID |
|
||||||
|
| `theme_mode` | int | `0` | 0=system, 1=light, 2=dark |
|
||||||
|
| **Language** |
|
||||||
|
| `language_code` | String | `'vi'` | Language code (vi, en) |
|
||||||
|
| **Notifications** |
|
||||||
|
| `notifications_enabled` | bool | `true` | Master notification toggle |
|
||||||
|
| `order_notifications` | bool | `true` | Order status notifications |
|
||||||
|
| `promotion_notifications` | bool | `true` | Promotion notifications |
|
||||||
|
| `chat_notifications` | bool | `true` | Chat message notifications |
|
||||||
|
| **User Preferences** |
|
||||||
|
| `onboarding_completed` | bool | `false` | Onboarding flow completed |
|
||||||
|
| `biometric_enabled` | bool | `false` | Biometric login enabled |
|
||||||
|
| `remember_login` | bool | `false` | Remember login credentials |
|
||||||
|
| **App State** |
|
||||||
|
| `last_sync_time` | String | - | Last data sync timestamp |
|
||||||
|
| `app_version` | String | - | Last launched app version |
|
||||||
|
| `first_launch_date` | String | - | First app launch date |
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// Generic get/set
|
||||||
|
AppSettingsBox.get<String>('key', defaultValue: 'default');
|
||||||
|
await AppSettingsBox.set('key', value);
|
||||||
|
|
||||||
|
// Helper methods
|
||||||
|
AppSettingsBox.getSeedColorId(); // Returns 'blue', 'teal', etc.
|
||||||
|
await AppSettingsBox.setSeedColorId('teal');
|
||||||
|
|
||||||
|
AppSettingsBox.getThemeModeIndex(); // Returns 0, 1, or 2
|
||||||
|
await AppSettingsBox.setThemeModeIndex(1);
|
||||||
|
|
||||||
|
AppSettingsBox.getLanguageCode(); // Returns 'vi' or 'en'
|
||||||
|
await AppSettingsBox.setLanguageCode('en');
|
||||||
|
|
||||||
|
AppSettingsBox.areNotificationsEnabled(); // Returns true/false
|
||||||
|
AppSettingsBox.isOnboardingCompleted();
|
||||||
|
AppSettingsBox.isBiometricEnabled();
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Theme System
|
||||||
|
|
||||||
|
### Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
colors.dart → Seed color options & status colors
|
||||||
|
app_theme.dart → ThemeData generation from seed color
|
||||||
|
theme_provider.dart → Riverpod state management
|
||||||
|
```
|
||||||
|
|
||||||
|
### Available Seed Colors
|
||||||
|
|
||||||
|
| ID | Name | Color |
|
||||||
|
|----|------|-------|
|
||||||
|
| `blue` | Xanh dương | `#005B9A` (default) |
|
||||||
|
| `teal` | Xanh ngọc | `#009688` |
|
||||||
|
| `green` | Xanh lá | `#4CAF50` |
|
||||||
|
| `purple` | Tím | `#673AB7` |
|
||||||
|
| `indigo` | Chàm | `#3F51B5` |
|
||||||
|
| `orange` | Cam | `#FF5722` |
|
||||||
|
| `red` | Đỏ | `#E53935` |
|
||||||
|
| `pink` | Hồng | `#E91E63` |
|
||||||
|
|
||||||
|
### Providers
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// Main theme settings provider (persisted)
|
||||||
|
themeSettingsProvider
|
||||||
|
|
||||||
|
// Convenience providers
|
||||||
|
currentSeedColorProvider // Color - current seed color
|
||||||
|
seedColorOptionsProvider // List<SeedColorOption> - all options
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage in App
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// app.dart - Dynamic theme
|
||||||
|
class MyApp extends ConsumerWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final settings = ref.watch(themeSettingsProvider);
|
||||||
|
|
||||||
|
return MaterialApp(
|
||||||
|
theme: AppTheme.lightTheme(settings.seedColor),
|
||||||
|
darkTheme: AppTheme.darkTheme(settings.seedColor),
|
||||||
|
themeMode: settings.themeMode,
|
||||||
|
// ...
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Changing Theme
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// Change seed color
|
||||||
|
ref.read(themeSettingsProvider.notifier).setSeedColor('teal');
|
||||||
|
|
||||||
|
// Change theme mode
|
||||||
|
ref.read(themeSettingsProvider.notifier).setThemeMode(ThemeMode.dark);
|
||||||
|
|
||||||
|
// Toggle light/dark
|
||||||
|
ref.read(themeSettingsProvider.notifier).toggleThemeMode();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Color Picker Widget Example
|
||||||
|
|
||||||
|
```dart
|
||||||
|
class ColorPickerWidget extends ConsumerWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final options = ref.watch(seedColorOptionsProvider);
|
||||||
|
final current = ref.watch(themeSettingsProvider);
|
||||||
|
|
||||||
|
return Wrap(
|
||||||
|
spacing: 8,
|
||||||
|
children: options.map((option) {
|
||||||
|
final isSelected = option.id == current.seedColorId;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => ref
|
||||||
|
.read(themeSettingsProvider.notifier)
|
||||||
|
.setSeedColor(option.id),
|
||||||
|
child: Container(
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: option.color,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: isSelected
|
||||||
|
? Border.all(color: Colors.white, width: 3)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
child: isSelected
|
||||||
|
? const Icon(Icons.check, color: Colors.white)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Using ColorScheme
|
||||||
|
|
||||||
|
With the `fromSeed()` approach, always use `Theme.of(context).colorScheme` for colors:
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// Via context extension (recommended)
|
||||||
|
final cs = context.colorScheme;
|
||||||
|
|
||||||
|
// Common color usage
|
||||||
|
cs.primary // Main brand color (buttons, links)
|
||||||
|
cs.onPrimary // Text/icons on primary color
|
||||||
|
cs.primaryContainer // Softer brand background
|
||||||
|
cs.onPrimaryContainer // Text on primaryContainer
|
||||||
|
|
||||||
|
cs.secondary // Secondary accent
|
||||||
|
cs.tertiary // Third accent color
|
||||||
|
|
||||||
|
cs.surface // Card/container backgrounds
|
||||||
|
cs.onSurface // Primary text color
|
||||||
|
cs.onSurfaceVariant // Secondary text color
|
||||||
|
|
||||||
|
cs.outline // Borders, dividers
|
||||||
|
cs.outlineVariant // Lighter borders
|
||||||
|
|
||||||
|
cs.error // Error states
|
||||||
|
cs.onError // Text on error
|
||||||
|
|
||||||
|
// Example widget
|
||||||
|
Container(
|
||||||
|
color: cs.primaryContainer,
|
||||||
|
child: Text(
|
||||||
|
'Hello',
|
||||||
|
style: TextStyle(color: cs.onPrimaryContainer),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Status Colors (Fixed)
|
||||||
|
|
||||||
|
These colors don't change with theme (from backend):
|
||||||
|
|
||||||
|
```dart
|
||||||
|
AppColors.success // #28a745 - Green
|
||||||
|
AppColors.warning // #ffc107 - Yellow
|
||||||
|
AppColors.danger // #dc3545 - Red
|
||||||
|
AppColors.info // #17a2b8 - Blue
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Files Reference
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|------|---------|
|
||||||
|
| `lib/core/database/app_settings_box.dart` | Hive storage for all app settings |
|
||||||
|
| `lib/core/theme/colors.dart` | Seed colors, status colors, gradients |
|
||||||
|
| `lib/core/theme/app_theme.dart` | ThemeData generation |
|
||||||
|
| `lib/core/theme/theme_provider.dart` | Riverpod providers for theme |
|
||||||
|
| `lib/core/theme/typography.dart` | Text styles |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Initialization Order
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// main.dart
|
||||||
|
Future<void> main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
// 1. Initialize Hive
|
||||||
|
await Hive.initFlutter();
|
||||||
|
|
||||||
|
// 2. Initialize AppSettingsBox
|
||||||
|
await AppSettingsBox.init();
|
||||||
|
|
||||||
|
// 3. Initialize other boxes...
|
||||||
|
|
||||||
|
runApp(
|
||||||
|
ProviderScope(
|
||||||
|
child: MyApp(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
59
CITY_WARD_IMPLEMENTATION.md
Normal file
59
CITY_WARD_IMPLEMENTATION.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# City and Ward API Implementation - Complete Guide
|
||||||
|
|
||||||
|
## Files Created ✅
|
||||||
|
|
||||||
|
1. ✅ `lib/features/account/domain/entities/city.dart`
|
||||||
|
2. ✅ `lib/features/account/domain/entities/ward.dart`
|
||||||
|
3. ✅ `lib/features/account/data/models/city_model.dart`
|
||||||
|
4. ✅ `lib/features/account/data/models/ward_model.dart`
|
||||||
|
5. ✅ Updated `lib/core/constants/storage_constants.dart`
|
||||||
|
- Added `cityBox` and `wardBox`
|
||||||
|
- Added `cityModel = 31` and `wardModel = 32`
|
||||||
|
- Shifted all enum IDs by +2
|
||||||
|
|
||||||
|
## Implementation Status
|
||||||
|
|
||||||
|
### Completed:
|
||||||
|
- ✅ Domain entities (City, Ward)
|
||||||
|
- ✅ Hive models with type adapters
|
||||||
|
- ✅ Storage constants updated
|
||||||
|
- ✅ Build runner generated .g.dart files
|
||||||
|
|
||||||
|
### Remaining (Need to implement):
|
||||||
|
|
||||||
|
1. **Remote Datasource** - `lib/features/account/data/datasources/location_remote_datasource.dart`
|
||||||
|
2. **Local Datasource** - `lib/features/account/data/datasources/location_local_datasource.dart`
|
||||||
|
3. **Repository Interface** - `lib/features/account/domain/repositories/location_repository.dart`
|
||||||
|
4. **Repository Implementation** - `lib/features/account/data/repositories/location_repository_impl.dart`
|
||||||
|
5. **Providers** - `lib/features/account/presentation/providers/location_provider.dart`
|
||||||
|
6. **Update AddressFormPage** to use the providers
|
||||||
|
|
||||||
|
## API Endpoints (from docs/auth.sh)
|
||||||
|
|
||||||
|
### Get Cities:
|
||||||
|
```bash
|
||||||
|
POST /api/method/frappe.client.get_list
|
||||||
|
Body: {
|
||||||
|
"doctype": "City",
|
||||||
|
"fields": ["city_name","name","code"],
|
||||||
|
"limit_page_length": 0
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get Wards (filtered by city):
|
||||||
|
```bash
|
||||||
|
POST /api/method/frappe.client.get_list
|
||||||
|
Body: {
|
||||||
|
"doctype": "Ward",
|
||||||
|
"fields": ["ward_name","name","code"],
|
||||||
|
"filters": {"city": "96"},
|
||||||
|
"limit_page_length": 0
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Offline-First Strategy
|
||||||
|
|
||||||
|
1. **Cities**: Cache in Hive, refresh from API periodically
|
||||||
|
2. **Wards**: Load from API when city selected, cache per city
|
||||||
|
|
||||||
|
Would you like me to generate the remaining implementation files now?
|
||||||
478
CLAUDE.md
478
CLAUDE.md
@@ -29,6 +29,13 @@ All Dart code examples, patterns, and snippets are maintained in **CODE_EXAMPLES
|
|||||||
- Localization setup
|
- Localization setup
|
||||||
- Deployment configurations
|
- Deployment configurations
|
||||||
|
|
||||||
|
### 🎨 App Settings & Theme:
|
||||||
|
See **[APP_SETTINGS.md](APP_SETTINGS.md)** for:
|
||||||
|
- AppSettingsBox (Hive) - centralized app settings storage
|
||||||
|
- Theme system with dynamic seed colors
|
||||||
|
- ColorScheme usage guide
|
||||||
|
- Available seed color options
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🤖 SUBAGENT DELEGATION SYSTEM 🤖
|
## 🤖 SUBAGENT DELEGATION SYSTEM 🤖
|
||||||
@@ -123,441 +130,46 @@ When working with Hive boxes, always use `Box<dynamic>` in data sources and appl
|
|||||||
|
|
||||||
## Worker App Project Structure
|
## Worker App Project Structure
|
||||||
|
|
||||||
|
**See [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md)** for the complete project structure with all features, folders, and files.
|
||||||
|
|
||||||
|
### Vietnamese Currency Formatting
|
||||||
|
|
||||||
|
**IMPORTANT: Always use `toVNCurrency()` extension for displaying Vietnamese currency.**
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// Import the extension
|
||||||
|
import 'package:worker/core/utils/extensions.dart';
|
||||||
|
|
||||||
|
// Usage examples:
|
||||||
|
final price = 1500000;
|
||||||
|
Text(price.toVNCurrency()); // Output: "1.500.000 đ"
|
||||||
|
|
||||||
|
final total = 25000000.5;
|
||||||
|
Text(total.toVNCurrency()); // Output: "25.000.001 đ" (rounded)
|
||||||
|
|
||||||
|
// In widgets:
|
||||||
|
Text(
|
||||||
|
product.price.toVNCurrency(),
|
||||||
|
style: AppTextStyle.bodyLarge.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: AppColors.primary,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
// For order totals, cart summaries, payment amounts:
|
||||||
|
Text('Tổng tiền: ${order.totalAmount.toVNCurrency()}')
|
||||||
```
|
```
|
||||||
lib/
|
|
||||||
core/
|
|
||||||
constants/
|
|
||||||
api_constants.dart # API endpoints, timeouts
|
|
||||||
app_constants.dart # App config, defaults, loyalty tiers
|
|
||||||
ui_constants.dart # Spacing, sizes, colors
|
|
||||||
storage_constants.dart # Hive box names, keys
|
|
||||||
theme/
|
|
||||||
app_theme.dart # Material 3 theme (primary blue #005B9A)
|
|
||||||
colors.dart # Brand color schemes
|
|
||||||
typography.dart # Roboto text styles
|
|
||||||
network/
|
|
||||||
dio_client.dart # HTTP client setup
|
|
||||||
api_interceptor.dart # Auth token, logging interceptors
|
|
||||||
network_info.dart # Connectivity status
|
|
||||||
errors/
|
|
||||||
exceptions.dart # Custom exceptions
|
|
||||||
failures.dart # Failure classes
|
|
||||||
utils/
|
|
||||||
formatters.dart # Currency, date, phone formatters
|
|
||||||
validators.dart # Form validation (Vietnamese phone, email)
|
|
||||||
extensions.dart # Dart extensions
|
|
||||||
qr_generator.dart # QR code generation for member cards
|
|
||||||
widgets/
|
|
||||||
custom_button.dart # Primary, secondary buttons
|
|
||||||
loading_indicator.dart # Loading states
|
|
||||||
error_widget.dart # Error displays
|
|
||||||
empty_state.dart # Empty list UI
|
|
||||||
bottom_nav_bar.dart # Main bottom navigation
|
|
||||||
floating_chat_button.dart # FAB for chat
|
|
||||||
|
|
||||||
features/
|
**DO NOT use:**
|
||||||
auth/
|
- `NumberFormat` directly for VND
|
||||||
data/
|
- Manual string formatting like `'${price.toString()} đ'`
|
||||||
datasources/
|
- Other currency formatters
|
||||||
auth_remote_datasource.dart # Login, OTP, register APIs
|
|
||||||
auth_local_datasource.dart # Token storage
|
|
||||||
models/
|
|
||||||
user_model.dart # User with tier info
|
|
||||||
otp_response_model.dart
|
|
||||||
repositories/
|
|
||||||
auth_repository_impl.dart
|
|
||||||
domain/
|
|
||||||
entities/
|
|
||||||
user.dart # id, name, phone, email, tier, points
|
|
||||||
repositories/
|
|
||||||
auth_repository.dart
|
|
||||||
usecases/
|
|
||||||
login_with_phone.dart
|
|
||||||
verify_otp.dart
|
|
||||||
register_user.dart
|
|
||||||
logout.dart
|
|
||||||
get_current_user.dart
|
|
||||||
presentation/
|
|
||||||
providers/
|
|
||||||
auth_provider.dart
|
|
||||||
otp_timer_provider.dart
|
|
||||||
pages/
|
|
||||||
login_page.dart # Phone input
|
|
||||||
otp_verification_page.dart # 6-digit OTP
|
|
||||||
register_page.dart # Full registration form
|
|
||||||
widgets/
|
|
||||||
phone_input_field.dart
|
|
||||||
otp_input_field.dart # Auto-focus 6 digits
|
|
||||||
user_type_selector.dart # Contractor/Architect/etc
|
|
||||||
|
|
||||||
home/
|
**The `toVNCurrency()` extension:**
|
||||||
data/
|
- Formats with dot (.) as thousand separator
|
||||||
datasources/
|
- Appends " đ" suffix
|
||||||
member_card_local_datasource.dart
|
- Rounds to nearest integer
|
||||||
models/
|
- Handles both `int` and `double` values
|
||||||
member_card_model.dart
|
|
||||||
presentation/
|
|
||||||
providers/
|
|
||||||
member_card_provider.dart
|
|
||||||
pages:
|
|
||||||
home_page.dart # Main dashboard
|
|
||||||
widgets:
|
|
||||||
diamond_member_card.dart # Gradient card with QR
|
|
||||||
platinum_member_card.dart
|
|
||||||
gold_member_card.dart
|
|
||||||
quick_action_grid.dart
|
|
||||||
|
|
||||||
loyalty/
|
|
||||||
data/
|
|
||||||
datasources:
|
|
||||||
loyalty_remote_datasource.dart
|
|
||||||
loyalty_local_datasource.dart
|
|
||||||
models:
|
|
||||||
loyalty_points_model.dart
|
|
||||||
loyalty_transaction_model.dart
|
|
||||||
reward_model.dart
|
|
||||||
gift_model.dart
|
|
||||||
referral_model.dart
|
|
||||||
repositories:
|
|
||||||
loyalty_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
loyalty_points.dart # currentPoints, tier, nextTierPoints
|
|
||||||
loyalty_transaction.dart # id, type, amount, description, date
|
|
||||||
reward.dart # id, title, pointsCost, image, expiry
|
|
||||||
gift.dart # id, code, status, validFrom, validTo
|
|
||||||
referral.dart # code, link, totalReferrals, pointsEarned
|
|
||||||
repositories:
|
|
||||||
loyalty_repository.dart
|
|
||||||
usecases:
|
|
||||||
get_loyalty_points.dart
|
|
||||||
get_points_history.dart
|
|
||||||
redeem_reward.dart
|
|
||||||
get_available_rewards.dart
|
|
||||||
get_my_gifts.dart
|
|
||||||
get_referral_info.dart
|
|
||||||
share_referral.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
loyalty_points_provider.dart
|
|
||||||
points_history_provider.dart
|
|
||||||
rewards_provider.dart
|
|
||||||
gifts_provider.dart
|
|
||||||
referral_provider.dart
|
|
||||||
pages:
|
|
||||||
loyalty_page.dart # Progress bar, tier info
|
|
||||||
rewards_page.dart # Grid of redeemable rewards
|
|
||||||
points_history_page.dart # Transaction list
|
|
||||||
referral_page.dart # Referral link & code
|
|
||||||
my_gifts_page.dart # Tabs: Active/Used/Expired
|
|
||||||
widgets:
|
|
||||||
tier_progress_bar.dart
|
|
||||||
points_badge.dart
|
|
||||||
reward_card.dart
|
|
||||||
gift_card.dart
|
|
||||||
referral_share_sheet.dart
|
|
||||||
|
|
||||||
products/
|
|
||||||
data:
|
|
||||||
datasources:
|
|
||||||
product_remote_datasource.dart
|
|
||||||
product_local_datasource.dart
|
|
||||||
models:
|
|
||||||
product_model.dart # Tile/construction products
|
|
||||||
category_model.dart
|
|
||||||
repositories:
|
|
||||||
product_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
product.dart # id, name, sku, price, images, category
|
|
||||||
category.dart
|
|
||||||
repositories:
|
|
||||||
product_repository.dart
|
|
||||||
usecases:
|
|
||||||
get_all_products.dart
|
|
||||||
search_products.dart
|
|
||||||
get_products_by_category.dart
|
|
||||||
get_product_details.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
products_provider.dart
|
|
||||||
product_search_provider.dart
|
|
||||||
categories_provider.dart
|
|
||||||
pages:
|
|
||||||
products_page.dart # Grid with search & filters
|
|
||||||
product_detail_page.dart
|
|
||||||
widgets:
|
|
||||||
product_grid.dart
|
|
||||||
product_card.dart
|
|
||||||
product_search_bar.dart
|
|
||||||
category_filter_chips.dart
|
|
||||||
|
|
||||||
cart/
|
|
||||||
data:
|
|
||||||
datasources:
|
|
||||||
cart_local_datasource.dart # Hive persistence
|
|
||||||
models:
|
|
||||||
cart_item_model.dart
|
|
||||||
repositories:
|
|
||||||
cart_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
cart_item.dart # productId, quantity, price
|
|
||||||
repositories:
|
|
||||||
cart_repository.dart
|
|
||||||
usecases:
|
|
||||||
add_to_cart.dart
|
|
||||||
remove_from_cart.dart
|
|
||||||
update_quantity.dart
|
|
||||||
clear_cart.dart
|
|
||||||
get_cart_items.dart
|
|
||||||
calculate_cart_total.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
cart_provider.dart
|
|
||||||
cart_total_provider.dart
|
|
||||||
pages:
|
|
||||||
cart_page.dart
|
|
||||||
checkout_page.dart
|
|
||||||
order_success_page.dart
|
|
||||||
widgets:
|
|
||||||
cart_item_card.dart
|
|
||||||
cart_summary.dart
|
|
||||||
quantity_selector.dart
|
|
||||||
payment_method_selector.dart
|
|
||||||
|
|
||||||
orders/
|
|
||||||
data:
|
|
||||||
datasources:
|
|
||||||
order_remote_datasource.dart
|
|
||||||
order_local_datasource.dart
|
|
||||||
models:
|
|
||||||
order_model.dart
|
|
||||||
order_item_model.dart
|
|
||||||
payment_model.dart
|
|
||||||
repositories:
|
|
||||||
order_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
order.dart # orderNumber, items, total, status
|
|
||||||
order_item.dart
|
|
||||||
payment.dart
|
|
||||||
repositories:
|
|
||||||
order_repository.dart
|
|
||||||
usecases:
|
|
||||||
create_order.dart
|
|
||||||
get_orders.dart
|
|
||||||
get_order_details.dart
|
|
||||||
get_payments.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
orders_provider.dart
|
|
||||||
order_filter_provider.dart
|
|
||||||
payments_provider.dart
|
|
||||||
pages:
|
|
||||||
orders_page.dart # Tabs by status
|
|
||||||
order_detail_page.dart
|
|
||||||
payments_page.dart
|
|
||||||
widgets:
|
|
||||||
order_card.dart
|
|
||||||
order_status_badge.dart
|
|
||||||
order_timeline.dart
|
|
||||||
payment_card.dart
|
|
||||||
|
|
||||||
projects/
|
|
||||||
data:
|
|
||||||
datasources:
|
|
||||||
project_remote_datasource.dart
|
|
||||||
project_local_datasource.dart
|
|
||||||
models:
|
|
||||||
project_model.dart
|
|
||||||
quote_model.dart
|
|
||||||
repositories:
|
|
||||||
project_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
project.dart # name, client, location, progress, status
|
|
||||||
quote.dart # number, client, amount, validity, status
|
|
||||||
repositories:
|
|
||||||
project_repository.dart
|
|
||||||
usecases:
|
|
||||||
create_project.dart
|
|
||||||
get_projects.dart
|
|
||||||
update_project_progress.dart
|
|
||||||
create_quote.dart
|
|
||||||
get_quotes.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
projects_provider.dart
|
|
||||||
project_form_provider.dart
|
|
||||||
quotes_provider.dart
|
|
||||||
pages:
|
|
||||||
projects_page.dart # List with progress bars
|
|
||||||
project_create_page.dart # Form
|
|
||||||
project_detail_page.dart
|
|
||||||
quotes_page.dart
|
|
||||||
quote_create_page.dart
|
|
||||||
widgets:
|
|
||||||
project_card.dart
|
|
||||||
project_progress_bar.dart
|
|
||||||
quote_card.dart
|
|
||||||
project_form.dart
|
|
||||||
|
|
||||||
chat/
|
|
||||||
data:
|
|
||||||
datasources:
|
|
||||||
chat_remote_datasource.dart # WebSocket/REST
|
|
||||||
chat_local_datasource.dart
|
|
||||||
models:
|
|
||||||
message_model.dart
|
|
||||||
chat_room_model.dart
|
|
||||||
repositories:
|
|
||||||
chat_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
message.dart # id, text, senderId, timestamp, isRead
|
|
||||||
chat_room.dart
|
|
||||||
repositories:
|
|
||||||
chat_repository.dart
|
|
||||||
usecases:
|
|
||||||
send_message.dart
|
|
||||||
get_messages.dart
|
|
||||||
mark_as_read.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
chat_provider.dart
|
|
||||||
messages_provider.dart
|
|
||||||
typing_indicator_provider.dart
|
|
||||||
pages:
|
|
||||||
chat_page.dart
|
|
||||||
widgets:
|
|
||||||
message_bubble.dart
|
|
||||||
message_input.dart
|
|
||||||
typing_indicator.dart
|
|
||||||
chat_app_bar.dart
|
|
||||||
|
|
||||||
account/
|
|
||||||
data:
|
|
||||||
datasources:
|
|
||||||
profile_remote_datasource.dart
|
|
||||||
profile_local_datasource.dart
|
|
||||||
address_datasource.dart
|
|
||||||
models:
|
|
||||||
profile_model.dart
|
|
||||||
address_model.dart
|
|
||||||
repositories:
|
|
||||||
profile_repository_impl.dart
|
|
||||||
address_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
profile.dart # Extended user info
|
|
||||||
address.dart # Delivery addresses
|
|
||||||
repositories:
|
|
||||||
profile_repository.dart
|
|
||||||
address_repository.dart
|
|
||||||
usecases:
|
|
||||||
get_profile.dart
|
|
||||||
update_profile.dart
|
|
||||||
upload_avatar.dart
|
|
||||||
change_password.dart
|
|
||||||
get_addresses.dart
|
|
||||||
add_address.dart
|
|
||||||
update_address.dart
|
|
||||||
delete_address.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
profile_provider.dart
|
|
||||||
avatar_provider.dart
|
|
||||||
addresses_provider.dart
|
|
||||||
pages:
|
|
||||||
account_page.dart # Menu
|
|
||||||
profile_edit_page.dart
|
|
||||||
addresses_page.dart
|
|
||||||
address_form_page.dart
|
|
||||||
password_change_page.dart
|
|
||||||
widgets:
|
|
||||||
profile_header.dart
|
|
||||||
account_menu_item.dart
|
|
||||||
address_card.dart
|
|
||||||
avatar_picker.dart
|
|
||||||
|
|
||||||
promotions/
|
|
||||||
data:
|
|
||||||
datasources:
|
|
||||||
promotion_remote_datasource.dart
|
|
||||||
models:
|
|
||||||
promotion_model.dart
|
|
||||||
repositories:
|
|
||||||
promotion_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
promotion.dart # title, description, discount, validity
|
|
||||||
repositories:
|
|
||||||
promotion_repository.dart
|
|
||||||
usecases:
|
|
||||||
get_active_promotions.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
promotions_provider.dart
|
|
||||||
pages:
|
|
||||||
promotions_page.dart
|
|
||||||
widgets:
|
|
||||||
promotion_card.dart
|
|
||||||
promotion_banner.dart
|
|
||||||
|
|
||||||
notifications/
|
|
||||||
data:
|
|
||||||
datasources:
|
|
||||||
notification_remote_datasource.dart
|
|
||||||
notification_local_datasource.dart
|
|
||||||
models:
|
|
||||||
notification_model.dart
|
|
||||||
repositories:
|
|
||||||
notification_repository_impl.dart
|
|
||||||
domain:
|
|
||||||
entities:
|
|
||||||
notification.dart # title, body, type, isRead, timestamp
|
|
||||||
repositories:
|
|
||||||
notification_repository.dart
|
|
||||||
usecases:
|
|
||||||
get_notifications.dart
|
|
||||||
mark_as_read.dart
|
|
||||||
clear_all.dart
|
|
||||||
presentation:
|
|
||||||
providers:
|
|
||||||
notifications_provider.dart
|
|
||||||
notification_badge_provider.dart
|
|
||||||
pages:
|
|
||||||
notifications_page.dart # Tabs: All/Orders/System/Promos
|
|
||||||
widgets:
|
|
||||||
notification_card.dart
|
|
||||||
notification_badge.dart
|
|
||||||
|
|
||||||
shared/
|
|
||||||
widgets/
|
|
||||||
custom_app_bar.dart
|
|
||||||
gradient_card.dart # For member cards
|
|
||||||
status_badge.dart
|
|
||||||
price_display.dart
|
|
||||||
vietnamese_phone_field.dart
|
|
||||||
date_picker_field.dart
|
|
||||||
|
|
||||||
main.dart
|
|
||||||
app.dart # Root widget with ProviderScope
|
|
||||||
|
|
||||||
test/
|
|
||||||
unit/
|
|
||||||
features/
|
|
||||||
auth/
|
|
||||||
loyalty/
|
|
||||||
products/
|
|
||||||
cart/
|
|
||||||
orders/
|
|
||||||
projects/
|
|
||||||
widget/
|
|
||||||
widgets/
|
|
||||||
integration/
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -1505,5 +1117,5 @@ All recent implementations follow:
|
|||||||
- ✅ AppBar standardization
|
- ✅ AppBar standardization
|
||||||
- ✅ CachedNetworkImage for all remote images
|
- ✅ CachedNetworkImage for all remote images
|
||||||
- ✅ Proper error handling
|
- ✅ Proper error handling
|
||||||
- ✅ Loading states (CircularProgressIndicator)
|
- ✅ Loading states (CustomLoadingIndicator)
|
||||||
- ✅ Empty states with helpful messages
|
- ✅ Empty states with helpful messages
|
||||||
|
|||||||
437
PROJECT_STRUCTURE.md
Normal file
437
PROJECT_STRUCTURE.md
Normal file
@@ -0,0 +1,437 @@
|
|||||||
|
# Worker App Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
lib/
|
||||||
|
core/
|
||||||
|
constants/
|
||||||
|
api_constants.dart # API endpoints, timeouts
|
||||||
|
app_constants.dart # App config, defaults, loyalty tiers
|
||||||
|
ui_constants.dart # Spacing, sizes, colors
|
||||||
|
storage_constants.dart # Hive box names, keys
|
||||||
|
theme/
|
||||||
|
app_theme.dart # Material 3 theme (primary blue #005B9A)
|
||||||
|
colors.dart # Brand color schemes
|
||||||
|
typography.dart # Roboto text styles
|
||||||
|
network/
|
||||||
|
dio_client.dart # HTTP client setup
|
||||||
|
api_interceptor.dart # Auth token, logging interceptors
|
||||||
|
network_info.dart # Connectivity status
|
||||||
|
errors/
|
||||||
|
exceptions.dart # Custom exceptions
|
||||||
|
failures.dart # Failure classes
|
||||||
|
utils/
|
||||||
|
formatters.dart # Currency, date, phone formatters
|
||||||
|
validators.dart # Form validation (Vietnamese phone, email)
|
||||||
|
extensions.dart # Dart extensions
|
||||||
|
qr_generator.dart # QR code generation for member cards
|
||||||
|
widgets/
|
||||||
|
custom_button.dart # Primary, secondary buttons
|
||||||
|
loading_indicator.dart # Loading states
|
||||||
|
error_widget.dart # Error displays
|
||||||
|
empty_state.dart # Empty list UI
|
||||||
|
bottom_nav_bar.dart # Main bottom navigation
|
||||||
|
floating_chat_button.dart # FAB for chat
|
||||||
|
|
||||||
|
features/
|
||||||
|
auth/
|
||||||
|
data/
|
||||||
|
datasources/
|
||||||
|
auth_remote_datasource.dart # Login, OTP, register APIs
|
||||||
|
auth_local_datasource.dart # Token storage
|
||||||
|
models/
|
||||||
|
user_model.dart # User with tier info
|
||||||
|
otp_response_model.dart
|
||||||
|
repositories/
|
||||||
|
auth_repository_impl.dart
|
||||||
|
domain/
|
||||||
|
entities/
|
||||||
|
user.dart # id, name, phone, email, tier, points
|
||||||
|
repositories/
|
||||||
|
auth_repository.dart
|
||||||
|
usecases/
|
||||||
|
login_with_phone.dart
|
||||||
|
verify_otp.dart
|
||||||
|
register_user.dart
|
||||||
|
logout.dart
|
||||||
|
get_current_user.dart
|
||||||
|
presentation/
|
||||||
|
providers/
|
||||||
|
auth_provider.dart
|
||||||
|
otp_timer_provider.dart
|
||||||
|
pages/
|
||||||
|
login_page.dart # Phone input
|
||||||
|
otp_verification_page.dart # 6-digit OTP
|
||||||
|
register_page.dart # Full registration form
|
||||||
|
widgets/
|
||||||
|
phone_input_field.dart
|
||||||
|
otp_input_field.dart # Auto-focus 6 digits
|
||||||
|
user_type_selector.dart # Contractor/Architect/etc
|
||||||
|
|
||||||
|
home/
|
||||||
|
data/
|
||||||
|
datasources/
|
||||||
|
member_card_local_datasource.dart
|
||||||
|
models/
|
||||||
|
member_card_model.dart
|
||||||
|
presentation/
|
||||||
|
providers/
|
||||||
|
member_card_provider.dart
|
||||||
|
pages:
|
||||||
|
home_page.dart # Main dashboard
|
||||||
|
widgets:
|
||||||
|
diamond_member_card.dart # Gradient card with QR
|
||||||
|
platinum_member_card.dart
|
||||||
|
gold_member_card.dart
|
||||||
|
quick_action_grid.dart
|
||||||
|
|
||||||
|
loyalty/
|
||||||
|
data/
|
||||||
|
datasources:
|
||||||
|
loyalty_remote_datasource.dart
|
||||||
|
loyalty_local_datasource.dart
|
||||||
|
models:
|
||||||
|
loyalty_points_model.dart
|
||||||
|
loyalty_transaction_model.dart
|
||||||
|
reward_model.dart
|
||||||
|
gift_model.dart
|
||||||
|
referral_model.dart
|
||||||
|
repositories:
|
||||||
|
loyalty_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
loyalty_points.dart # currentPoints, tier, nextTierPoints
|
||||||
|
loyalty_transaction.dart # id, type, amount, description, date
|
||||||
|
reward.dart # id, title, pointsCost, image, expiry
|
||||||
|
gift.dart # id, code, status, validFrom, validTo
|
||||||
|
referral.dart # code, link, totalReferrals, pointsEarned
|
||||||
|
repositories:
|
||||||
|
loyalty_repository.dart
|
||||||
|
usecases:
|
||||||
|
get_loyalty_points.dart
|
||||||
|
get_points_history.dart
|
||||||
|
redeem_reward.dart
|
||||||
|
get_available_rewards.dart
|
||||||
|
get_my_gifts.dart
|
||||||
|
get_referral_info.dart
|
||||||
|
share_referral.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
loyalty_points_provider.dart
|
||||||
|
points_history_provider.dart
|
||||||
|
rewards_provider.dart
|
||||||
|
gifts_provider.dart
|
||||||
|
referral_provider.dart
|
||||||
|
pages:
|
||||||
|
loyalty_page.dart # Progress bar, tier info
|
||||||
|
rewards_page.dart # Grid of redeemable rewards
|
||||||
|
points_history_page.dart # Transaction list
|
||||||
|
referral_page.dart # Referral link & code
|
||||||
|
my_gifts_page.dart # Tabs: Active/Used/Expired
|
||||||
|
widgets:
|
||||||
|
tier_progress_bar.dart
|
||||||
|
points_badge.dart
|
||||||
|
reward_card.dart
|
||||||
|
gift_card.dart
|
||||||
|
referral_share_sheet.dart
|
||||||
|
|
||||||
|
products/
|
||||||
|
data:
|
||||||
|
datasources:
|
||||||
|
product_remote_datasource.dart
|
||||||
|
product_local_datasource.dart
|
||||||
|
models:
|
||||||
|
product_model.dart # Tile/construction products
|
||||||
|
category_model.dart
|
||||||
|
repositories:
|
||||||
|
product_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
product.dart # id, name, sku, price, images, category
|
||||||
|
category.dart
|
||||||
|
repositories:
|
||||||
|
product_repository.dart
|
||||||
|
usecases:
|
||||||
|
get_all_products.dart
|
||||||
|
search_products.dart
|
||||||
|
get_products_by_category.dart
|
||||||
|
get_product_details.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
products_provider.dart
|
||||||
|
product_search_provider.dart
|
||||||
|
categories_provider.dart
|
||||||
|
pages:
|
||||||
|
products_page.dart # Grid with search & filters
|
||||||
|
product_detail_page.dart
|
||||||
|
widgets:
|
||||||
|
product_grid.dart
|
||||||
|
product_card.dart
|
||||||
|
product_search_bar.dart
|
||||||
|
category_filter_chips.dart
|
||||||
|
|
||||||
|
cart/
|
||||||
|
data:
|
||||||
|
datasources:
|
||||||
|
cart_local_datasource.dart # Hive persistence
|
||||||
|
models:
|
||||||
|
cart_item_model.dart
|
||||||
|
repositories:
|
||||||
|
cart_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
cart_item.dart # productId, quantity, price
|
||||||
|
repositories:
|
||||||
|
cart_repository.dart
|
||||||
|
usecases:
|
||||||
|
add_to_cart.dart
|
||||||
|
remove_from_cart.dart
|
||||||
|
update_quantity.dart
|
||||||
|
clear_cart.dart
|
||||||
|
get_cart_items.dart
|
||||||
|
calculate_cart_total.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
cart_provider.dart
|
||||||
|
cart_total_provider.dart
|
||||||
|
pages:
|
||||||
|
cart_page.dart
|
||||||
|
checkout_page.dart
|
||||||
|
order_success_page.dart
|
||||||
|
widgets:
|
||||||
|
cart_item_card.dart
|
||||||
|
cart_summary.dart
|
||||||
|
quantity_selector.dart
|
||||||
|
payment_method_selector.dart
|
||||||
|
|
||||||
|
orders/
|
||||||
|
data:
|
||||||
|
datasources:
|
||||||
|
order_remote_datasource.dart
|
||||||
|
order_local_datasource.dart
|
||||||
|
models:
|
||||||
|
order_model.dart
|
||||||
|
order_item_model.dart
|
||||||
|
payment_model.dart
|
||||||
|
repositories:
|
||||||
|
order_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
order.dart # orderNumber, items, total, status
|
||||||
|
order_item.dart
|
||||||
|
payment.dart
|
||||||
|
repositories:
|
||||||
|
order_repository.dart
|
||||||
|
usecases:
|
||||||
|
create_order.dart
|
||||||
|
get_orders.dart
|
||||||
|
get_order_details.dart
|
||||||
|
get_payments.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
orders_provider.dart
|
||||||
|
order_filter_provider.dart
|
||||||
|
payments_provider.dart
|
||||||
|
pages:
|
||||||
|
orders_page.dart # Tabs by status
|
||||||
|
order_detail_page.dart
|
||||||
|
payments_page.dart
|
||||||
|
widgets:
|
||||||
|
order_card.dart
|
||||||
|
order_status_badge.dart
|
||||||
|
order_timeline.dart
|
||||||
|
payment_card.dart
|
||||||
|
|
||||||
|
projects/
|
||||||
|
data:
|
||||||
|
datasources:
|
||||||
|
project_remote_datasource.dart
|
||||||
|
project_local_datasource.dart
|
||||||
|
models:
|
||||||
|
project_model.dart
|
||||||
|
quote_model.dart
|
||||||
|
repositories:
|
||||||
|
project_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
project.dart # name, client, location, progress, status
|
||||||
|
quote.dart # number, client, amount, validity, status
|
||||||
|
repositories:
|
||||||
|
project_repository.dart
|
||||||
|
usecases:
|
||||||
|
create_project.dart
|
||||||
|
get_projects.dart
|
||||||
|
update_project_progress.dart
|
||||||
|
create_quote.dart
|
||||||
|
get_quotes.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
projects_provider.dart
|
||||||
|
project_form_provider.dart
|
||||||
|
quotes_provider.dart
|
||||||
|
pages:
|
||||||
|
projects_page.dart # List with progress bars
|
||||||
|
project_create_page.dart # Form
|
||||||
|
project_detail_page.dart
|
||||||
|
quotes_page.dart
|
||||||
|
quote_create_page.dart
|
||||||
|
widgets:
|
||||||
|
project_card.dart
|
||||||
|
project_progress_bar.dart
|
||||||
|
quote_card.dart
|
||||||
|
project_form.dart
|
||||||
|
|
||||||
|
chat/
|
||||||
|
data:
|
||||||
|
datasources:
|
||||||
|
chat_remote_datasource.dart # WebSocket/REST
|
||||||
|
chat_local_datasource.dart
|
||||||
|
models:
|
||||||
|
message_model.dart
|
||||||
|
chat_room_model.dart
|
||||||
|
repositories:
|
||||||
|
chat_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
message.dart # id, text, senderId, timestamp, isRead
|
||||||
|
chat_room.dart
|
||||||
|
repositories:
|
||||||
|
chat_repository.dart
|
||||||
|
usecases:
|
||||||
|
send_message.dart
|
||||||
|
get_messages.dart
|
||||||
|
mark_as_read.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
chat_provider.dart
|
||||||
|
messages_provider.dart
|
||||||
|
typing_indicator_provider.dart
|
||||||
|
pages:
|
||||||
|
chat_page.dart
|
||||||
|
widgets:
|
||||||
|
message_bubble.dart
|
||||||
|
message_input.dart
|
||||||
|
typing_indicator.dart
|
||||||
|
chat_app_bar.dart
|
||||||
|
|
||||||
|
account/
|
||||||
|
data:
|
||||||
|
datasources:
|
||||||
|
profile_remote_datasource.dart
|
||||||
|
profile_local_datasource.dart
|
||||||
|
address_datasource.dart
|
||||||
|
models:
|
||||||
|
profile_model.dart
|
||||||
|
address_model.dart
|
||||||
|
repositories:
|
||||||
|
profile_repository_impl.dart
|
||||||
|
address_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
profile.dart # Extended user info
|
||||||
|
address.dart # Delivery addresses
|
||||||
|
repositories:
|
||||||
|
profile_repository.dart
|
||||||
|
address_repository.dart
|
||||||
|
usecases:
|
||||||
|
get_profile.dart
|
||||||
|
update_profile.dart
|
||||||
|
upload_avatar.dart
|
||||||
|
change_password.dart
|
||||||
|
get_addresses.dart
|
||||||
|
add_address.dart
|
||||||
|
update_address.dart
|
||||||
|
delete_address.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
profile_provider.dart
|
||||||
|
avatar_provider.dart
|
||||||
|
addresses_provider.dart
|
||||||
|
pages:
|
||||||
|
account_page.dart # Menu
|
||||||
|
profile_edit_page.dart
|
||||||
|
addresses_page.dart
|
||||||
|
address_form_page.dart
|
||||||
|
password_change_page.dart
|
||||||
|
widgets:
|
||||||
|
profile_header.dart
|
||||||
|
account_menu_item.dart
|
||||||
|
address_card.dart
|
||||||
|
avatar_picker.dart
|
||||||
|
|
||||||
|
promotions/
|
||||||
|
data:
|
||||||
|
datasources:
|
||||||
|
promotion_remote_datasource.dart
|
||||||
|
models:
|
||||||
|
promotion_model.dart
|
||||||
|
repositories:
|
||||||
|
promotion_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
promotion.dart # title, description, discount, validity
|
||||||
|
repositories:
|
||||||
|
promotion_repository.dart
|
||||||
|
usecases:
|
||||||
|
get_active_promotions.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
promotions_provider.dart
|
||||||
|
pages:
|
||||||
|
promotions_page.dart
|
||||||
|
widgets:
|
||||||
|
promotion_card.dart
|
||||||
|
promotion_banner.dart
|
||||||
|
|
||||||
|
notifications/
|
||||||
|
data:
|
||||||
|
datasources:
|
||||||
|
notification_remote_datasource.dart
|
||||||
|
notification_local_datasource.dart
|
||||||
|
models:
|
||||||
|
notification_model.dart
|
||||||
|
repositories:
|
||||||
|
notification_repository_impl.dart
|
||||||
|
domain:
|
||||||
|
entities:
|
||||||
|
notification.dart # title, body, type, isRead, timestamp
|
||||||
|
repositories:
|
||||||
|
notification_repository.dart
|
||||||
|
usecases:
|
||||||
|
get_notifications.dart
|
||||||
|
mark_as_read.dart
|
||||||
|
clear_all.dart
|
||||||
|
presentation:
|
||||||
|
providers:
|
||||||
|
notifications_provider.dart
|
||||||
|
notification_badge_provider.dart
|
||||||
|
pages:
|
||||||
|
notifications_page.dart # Tabs: All/Orders/System/Promos
|
||||||
|
widgets:
|
||||||
|
notification_card.dart
|
||||||
|
notification_badge.dart
|
||||||
|
|
||||||
|
shared/
|
||||||
|
widgets/
|
||||||
|
custom_app_bar.dart
|
||||||
|
gradient_card.dart # For member cards
|
||||||
|
status_badge.dart
|
||||||
|
price_display.dart
|
||||||
|
vietnamese_phone_field.dart
|
||||||
|
date_picker_field.dart
|
||||||
|
|
||||||
|
main.dart
|
||||||
|
app.dart # Root widget with ProviderScope
|
||||||
|
|
||||||
|
test/
|
||||||
|
unit/
|
||||||
|
features/
|
||||||
|
auth/
|
||||||
|
loyalty/
|
||||||
|
products/
|
||||||
|
cart/
|
||||||
|
orders/
|
||||||
|
projects/
|
||||||
|
widget/
|
||||||
|
widgets/
|
||||||
|
integration/
|
||||||
|
```
|
||||||
@@ -1,10 +1,23 @@
|
|||||||
|
import java.util.Properties
|
||||||
|
import java.io.FileInputStream
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
|
// START: FlutterFire Configuration
|
||||||
|
id("com.google.gms.google-services")
|
||||||
|
// END: FlutterFire Configuration
|
||||||
id("kotlin-android")
|
id("kotlin-android")
|
||||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||||
id("dev.flutter.flutter-gradle-plugin")
|
id("dev.flutter.flutter-gradle-plugin")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load keystore properties for release signing
|
||||||
|
val keystoreProperties = Properties()
|
||||||
|
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||||
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.dbiz.partner"
|
namespace = "com.dbiz.partner"
|
||||||
compileSdk = flutter.compileSdkVersion
|
compileSdk = flutter.compileSdkVersion
|
||||||
@@ -30,11 +43,18 @@ android {
|
|||||||
versionName = flutter.versionName
|
versionName = flutter.versionName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
create("release") {
|
||||||
|
keyAlias = keystoreProperties["keyAlias"] as String?
|
||||||
|
keyPassword = keystoreProperties["keyPassword"] as String?
|
||||||
|
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
|
||||||
|
storePassword = keystoreProperties["storePassword"] as String?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
// TODO: Add your own signing config for the release build.
|
signingConfig = signingConfigs.getByName("release")
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
29
android/app/google-services.json
Normal file
29
android/app/google-services.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "147309310656",
|
||||||
|
"project_id": "dbiz-partner",
|
||||||
|
"storage_bucket": "dbiz-partner.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:147309310656:android:86613d8ffc85576fdc7325",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.dbiz.partner"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyA60iGPuHOQMJUA0m5aSimzevPAiiaB4pE"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="worker"
|
android:label="worker"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ 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.9.1" apply false
|
id("com.android.application") version "8.9.1" apply false
|
||||||
|
// START: FlutterFire Configuration
|
||||||
|
id("com.google.gms.google-services") version("4.3.15") apply false
|
||||||
|
// END: FlutterFire Configuration
|
||||||
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
37
docs/address.sh
Normal file
37
docs/address.sh
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#get list address
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.address.get_list' \
|
||||||
|
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=phuoc; sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_start" : 0,
|
||||||
|
"limit_page_length": 0,
|
||||||
|
"is_default" : false
|
||||||
|
}'
|
||||||
|
|
||||||
|
#update/insert address
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.address.update' \
|
||||||
|
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=phuoc; sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data-raw '{
|
||||||
|
"name": "Công ty Tiến Nguyễn-Billing", // bỏ trống hoặc không truyền để thêm mới
|
||||||
|
"address_title": "Công ty Tiến Nguyễn",
|
||||||
|
"address_line1": "Khu 2, Hoàng Cương, Thanh Ba, Phú Thọ",
|
||||||
|
"phone": "0911111111",
|
||||||
|
"email": "address75675@gmail.com",
|
||||||
|
"fax": null,
|
||||||
|
"tax_code": "12312",
|
||||||
|
"city_code": "96",
|
||||||
|
"ward_code": "32248",
|
||||||
|
"is_default": false
|
||||||
|
}'
|
||||||
|
|
||||||
|
#delete address
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.address.delete' \
|
||||||
|
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=phuoc; sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name": "Công ty Tiến Nguyễn-Billing"
|
||||||
|
}'
|
||||||
12
docs/auth.sh
12
docs/auth.sh
@@ -25,6 +25,18 @@ curl --location 'https://land.dbiz.com//api/method/frappe.client.get_list' \
|
|||||||
"limit_page_length": 0
|
"limit_page_length": 0
|
||||||
}'
|
}'
|
||||||
|
|
||||||
|
GET WARD
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/frappe.client.get_list' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
|
||||||
|
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=phuoc; sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"doctype": "Ward",
|
||||||
|
"fields": ["ward_name","name","code"],
|
||||||
|
"filters": {"city": "96"},
|
||||||
|
"limit_page_length": 0
|
||||||
|
}'
|
||||||
|
|
||||||
GET ROLE
|
GET ROLE
|
||||||
curl --location 'https://land.dbiz.com//api/method/frappe.client.get_list' \
|
curl --location 'https://land.dbiz.com//api/method/frappe.client.get_list' \
|
||||||
--header 'X-Frappe-Csrf-Token: 3d072ea39d245c2340ecc42d0825f6cbb7e674943c9c74346c8e4629' \
|
--header 'X-Frappe-Csrf-Token: 3d072ea39d245c2340ecc42d0825f6cbb7e674943c9c74346c8e4629' \
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ curl --location 'https://land.dbiz.com//api/method/building_material.building_ma
|
|||||||
{
|
{
|
||||||
"item_id": "Bình giữ nhiệt Euroutile",
|
"item_id": "Bình giữ nhiệt Euroutile",
|
||||||
"amount": 3000000,
|
"amount": 3000000,
|
||||||
"quantity" : 5.78
|
"quantity" : 5.78,
|
||||||
|
"conversion_of_sm: 1.5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"item_id": "Gạch ốp Signature SIG.P-8806",
|
"item_id": "Gạch ốp Signature SIG.P-8806",
|
||||||
"amount": 4000000,
|
"amount": 4000000,
|
||||||
"quantity" : 33
|
"quantity" : 33,
|
||||||
|
"conversion_of_sm: 1.5
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}'
|
}'
|
||||||
|
|||||||
81
docs/favorite.sh
Executable file
81
docs/favorite.sh
Executable file
@@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Favorites Feature Simplification Summary
|
||||||
|
# Date: 2025-11-18
|
||||||
|
#
|
||||||
|
# CHANGES MADE:
|
||||||
|
# =============
|
||||||
|
#
|
||||||
|
# 1. Simplified favorites_provider.dart
|
||||||
|
# - Removed old Favorites provider (Set<String> of product IDs)
|
||||||
|
# - Kept only FavoriteProducts provider (List<Product>)
|
||||||
|
# - Helper providers now derive from FavoriteProducts:
|
||||||
|
# * isFavorite(productId) - checks if product is in list
|
||||||
|
# * favoriteCount() - counts products in list
|
||||||
|
# * favoriteProductIds() - maps to list of product IDs
|
||||||
|
# - Add/remove methods now use favoriteProductsProvider.notifier
|
||||||
|
# - No userId filtering - uses authenticated API session
|
||||||
|
#
|
||||||
|
# 2. Updated favorites_page.dart
|
||||||
|
# - Changed clearAll to show "under development" message
|
||||||
|
# - Still watches favoriteProductsProvider (already correct)
|
||||||
|
#
|
||||||
|
# 3. Updated favorite_product_card.dart
|
||||||
|
# - Changed from favoritesProvider.notifier to favoriteProductsProvider.notifier
|
||||||
|
# - Remove favorite now calls the correct provider
|
||||||
|
#
|
||||||
|
# 4. Updated product_detail_page.dart
|
||||||
|
# - Changed toggleFavorite from favoritesProvider.notifier to favoriteProductsProvider.notifier
|
||||||
|
#
|
||||||
|
# KEY BEHAVIORS:
|
||||||
|
# ==============
|
||||||
|
#
|
||||||
|
# - All favorites operations work with Product entities directly
|
||||||
|
# - No userId parameter needed in UI code
|
||||||
|
# - Repository methods still use 'current_user' as dummy userId for backwards compatibility
|
||||||
|
# - API calls use authenticated session (token-based)
|
||||||
|
# - Add/remove operations refresh the products list after success
|
||||||
|
# - Helper providers safely return defaults during loading/error states
|
||||||
|
#
|
||||||
|
# FILES MODIFIED:
|
||||||
|
# ==============
|
||||||
|
# 1. lib/features/favorites/presentation/providers/favorites_provider.dart
|
||||||
|
# 2. lib/features/favorites/presentation/pages/favorites_page.dart
|
||||||
|
# 3. lib/features/favorites/presentation/widgets/favorite_product_card.dart
|
||||||
|
# 4. lib/features/products/presentation/pages/product_detail_page.dart
|
||||||
|
#
|
||||||
|
# ARCHITECTURE:
|
||||||
|
# ============
|
||||||
|
#
|
||||||
|
# Main Provider:
|
||||||
|
# FavoriteProducts (AsyncNotifierProvider<List<Product>>)
|
||||||
|
# ├── build() - loads products from repository
|
||||||
|
# ├── addFavorite(productId) - calls API, refreshes list
|
||||||
|
# ├── removeFavorite(productId) - calls API, refreshes list
|
||||||
|
# ├── toggleFavorite(productId) - adds or removes based on current state
|
||||||
|
# └── refresh() - manual refresh for pull-to-refresh
|
||||||
|
#
|
||||||
|
# Helper Providers (derived from FavoriteProducts):
|
||||||
|
# isFavorite(productId) - bool
|
||||||
|
# favoriteCount() - int
|
||||||
|
# favoriteProductIds() - List<String>
|
||||||
|
#
|
||||||
|
# Data Flow:
|
||||||
|
# UI -> FavoriteProducts.notifier.method() -> Repository -> API
|
||||||
|
# API Response -> Repository caches locally -> Provider updates state
|
||||||
|
# Helper Providers watch FavoriteProducts and derive values
|
||||||
|
#
|
||||||
|
# TESTING:
|
||||||
|
# ========
|
||||||
|
# To verify the changes work:
|
||||||
|
# 1. Add products to favorites from product detail page
|
||||||
|
# 2. View favorites page - should load product list
|
||||||
|
# 3. Remove products from favorites page
|
||||||
|
# 4. Toggle favorites from product cards
|
||||||
|
# 5. Check that favoriteCount updates in real-time
|
||||||
|
# 6. Test offline mode - should use cached products
|
||||||
|
|
||||||
|
echo "Favorites feature simplified successfully!"
|
||||||
|
echo "Main provider: FavoriteProducts (List<Product>)"
|
||||||
|
echo "Helper providers derive from product list"
|
||||||
|
echo "No userId filtering - uses API auth session"
|
||||||
97
docs/invoice.sh
Normal file
97
docs/invoice.sh
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
#get list of invoices
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.invoice.get_list' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_page_length" : 0,
|
||||||
|
"limit_start" : 0
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "ACC-SINV-2025-00041",
|
||||||
|
"posting_date": "2025-12-02",
|
||||||
|
"status": "Chưa thanh toán",
|
||||||
|
"status_color": "Danger",
|
||||||
|
"order_id": null,
|
||||||
|
"grand_total": 486400.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ACC-SINV-2025-00026",
|
||||||
|
"posting_date": "2025-11-25",
|
||||||
|
"status": "Đã trả",
|
||||||
|
"status_color": "Success",
|
||||||
|
"order_id": "SAL-ORD-2025-00119",
|
||||||
|
"grand_total": 1153433.6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ACC-SINV-2025-00025",
|
||||||
|
"posting_date": "2025-11-24",
|
||||||
|
"status": "Đã trả",
|
||||||
|
"status_color": "Success",
|
||||||
|
"order_id": "SAL-ORD-2025-00104",
|
||||||
|
"grand_total": 3580257.894
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#get invoice detail
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.invoice.get_detail' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name" : "ACC-SINV-2025-00041"
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"name": "ACC-SINV-2025-00041",
|
||||||
|
"posting_date": "2025-12-02",
|
||||||
|
"status": "Chưa thanh toán",
|
||||||
|
"status_color": "Danger",
|
||||||
|
"customer_name": "Ha Duy Lam",
|
||||||
|
"order_id": null,
|
||||||
|
"seller_info": {
|
||||||
|
"phone": "0243 543 0726",
|
||||||
|
"email": "info@viglacera.com.vn",
|
||||||
|
"fax": "(024) 3553 6671",
|
||||||
|
"tax_code": "0105908818",
|
||||||
|
"company_name": "Công Ty Cổ Phần Kinh Doanh Gạch Ốp Lát Viglacera",
|
||||||
|
"address_line1": "Tầng 2 tòa nhà Viglacera, số 1 đại lộ Thăng Long",
|
||||||
|
"city_code": "01",
|
||||||
|
"ward_code": "00637",
|
||||||
|
"city_name": "Thành phố Hà Nội",
|
||||||
|
"ward_name": "Phường Đại Mỗ"
|
||||||
|
},
|
||||||
|
"buyer_info": {
|
||||||
|
"name": "phuoc-thanh toán",
|
||||||
|
"address_title": "phuoc",
|
||||||
|
"address_line1": "123 tt",
|
||||||
|
"phone": "0985225855",
|
||||||
|
"email": null,
|
||||||
|
"fax": null,
|
||||||
|
"tax_code": null,
|
||||||
|
"city_code": "75",
|
||||||
|
"ward_code": "25252",
|
||||||
|
"city_name": "Tỉnh Đồng Nai",
|
||||||
|
"ward_name": "Xã Phú Riềng"
|
||||||
|
},
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"item_name": "Hội An HOA E01",
|
||||||
|
"item_code": "HOA E01",
|
||||||
|
"qty": 1.0,
|
||||||
|
"rate": 486400.0,
|
||||||
|
"amount": 486400.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"total": 486400.0,
|
||||||
|
"discount_amount": 0.0,
|
||||||
|
"grand_total": 486400.0
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -219,7 +219,7 @@ class _CartPageState extends ConsumerState<CartPage> {
|
|||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: _isSyncing
|
child: _isSyncing
|
||||||
? CircularProgressIndicator() // Show loading while syncing
|
? const CustomLoadingIndicator() // Show loading while syncing
|
||||||
: Text('Tiến hành đặt hàng'),
|
: Text('Tiến hành đặt hàng'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -768,5 +768,5 @@ end
|
|||||||
- ✅ Vietnamese localization
|
- ✅ Vietnamese localization
|
||||||
- ✅ CachedNetworkImage for all remote images
|
- ✅ CachedNetworkImage for all remote images
|
||||||
- ✅ Proper error handling
|
- ✅ Proper error handling
|
||||||
- ✅ Loading states (CircularProgressIndicator)
|
- ✅ Loading states (CustomLoadingIndicator)
|
||||||
- ✅ Empty states with helpful messages
|
- ✅ Empty states with helpful messages
|
||||||
@@ -257,7 +257,7 @@ int stars = apiRatingToStars(0.8); // 4
|
|||||||
- Added date formatting function (`_formatDate`)
|
- Added date formatting function (`_formatDate`)
|
||||||
|
|
||||||
**States**:
|
**States**:
|
||||||
1. **Loading**: Shows CircularProgressIndicator
|
1. **Loading**: Shows CustomLoadingIndicator
|
||||||
2. **Error**: Shows error icon and message
|
2. **Error**: Shows error icon and message
|
||||||
3. **Empty**: Shows "Chưa có đánh giá nào" with call-to-action
|
3. **Empty**: Shows "Chưa có đánh giá nào" with call-to-action
|
||||||
4. **Data**: Shows rating overview and review list
|
4. **Data**: Shows rating overview and review list
|
||||||
@@ -553,7 +553,7 @@ Widget build(BuildContext context, WidgetRef ref) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
loading: () => CircularProgressIndicator(),
|
loading: () => const CustomLoadingIndicator(),
|
||||||
error: (error, stack) => Text('Error: $error'),
|
error: (error, stack) => Text('Error: $error'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ RatingProvider CountProvider in UI components)
|
|||||||
```
|
```
|
||||||
1. Initial State (Loading)
|
1. Initial State (Loading)
|
||||||
├─► productReviewsProvider returns AsyncValue.loading()
|
├─► productReviewsProvider returns AsyncValue.loading()
|
||||||
└─► UI shows CircularProgressIndicator
|
└─► UI shows CustomLoadingIndicator
|
||||||
|
|
||||||
2. Loading State → Data State
|
2. Loading State → Data State
|
||||||
├─► API call succeeds
|
├─► API call succeeds
|
||||||
@@ -60,7 +60,7 @@ class ReviewsListPage extends ConsumerWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
loading: () => const Center(
|
loading: () => const Center(
|
||||||
child: CircularProgressIndicator(),
|
child: const CustomLoadingIndicator(),
|
||||||
),
|
),
|
||||||
error: (error, stack) => Center(
|
error: (error, stack) => Center(
|
||||||
child: Text('Error: $error'),
|
child: Text('Error: $error'),
|
||||||
@@ -263,7 +263,7 @@ class _SimpleReviewFormState extends ConsumerState<SimpleReviewForm> {
|
|||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: _isSubmitting ? null : _submitReview,
|
onPressed: _isSubmitting ? null : _submitReview,
|
||||||
child: _isSubmitting
|
child: _isSubmitting
|
||||||
? const CircularProgressIndicator()
|
? const const CustomLoadingIndicator()
|
||||||
: const Text('Submit Review'),
|
: const Text('Submit Review'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -351,7 +351,7 @@ class _PaginatedReviewsListState
|
|||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: _isLoading
|
child: _isLoading
|
||||||
? const CircularProgressIndicator()
|
? const const CustomLoadingIndicator()
|
||||||
: ElevatedButton(
|
: ElevatedButton(
|
||||||
onPressed: _loadMoreReviews,
|
onPressed: _loadMoreReviews,
|
||||||
child: const Text('Load More'),
|
child: const Text('Load More'),
|
||||||
@@ -430,7 +430,7 @@ class RefreshableReviewsList extends ConsumerWidget {
|
|||||||
Center(
|
Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(40),
|
padding: EdgeInsets.all(40),
|
||||||
child: CircularProgressIndicator(),
|
child: const CustomLoadingIndicator(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -540,7 +540,7 @@ class _FilteredReviewsListState extends ConsumerState<FilteredReviewsList> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
loading: () => const Center(
|
loading: () => const Center(
|
||||||
child: CircularProgressIndicator(),
|
child: const CustomLoadingIndicator(),
|
||||||
),
|
),
|
||||||
error: (error, stack) => Center(
|
error: (error, stack) => Center(
|
||||||
child: Text('Error: $error'),
|
child: Text('Error: $error'),
|
||||||
@@ -662,7 +662,7 @@ class ReviewsWithRetry extends ConsumerWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
loading: () => const Center(
|
loading: () => const Center(
|
||||||
child: CircularProgressIndicator(),
|
child: const CustomLoadingIndicator(),
|
||||||
),
|
),
|
||||||
error: (error, stack) => Center(
|
error: (error, stack) => Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -30,7 +30,7 @@ final reviewsAsync = ref.watch(productReviewsProvider(itemId));
|
|||||||
|
|
||||||
reviewsAsync.when(
|
reviewsAsync.when(
|
||||||
data: (reviews) => /* show reviews */,
|
data: (reviews) => /* show reviews */,
|
||||||
loading: () => CircularProgressIndicator(),
|
loading: () => const CustomLoadingIndicator(),
|
||||||
error: (error, stack) => /* show error */,
|
error: (error, stack) => /* show error */,
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
266
docs/md/favorites_api_integration.md
Normal file
266
docs/md/favorites_api_integration.md
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
# Favorites API Integration - Implementation Summary
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
Successfully integrated the Frappe ERPNext favorites/wishlist API with the Worker app using an **online-first approach**. The implementation follows clean architecture principles with proper separation of concerns.
|
||||||
|
|
||||||
|
## API Endpoints (from docs/favorite.sh)
|
||||||
|
|
||||||
|
### 1. Get Favorites List
|
||||||
|
```
|
||||||
|
POST /api/method/building_material.building_material.api.item_wishlist.get_list
|
||||||
|
Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Add to Favorites
|
||||||
|
```
|
||||||
|
POST /api/method/building_material.building_material.api.item_wishlist.add_to_wishlist
|
||||||
|
Body: { "item_id": "GIB20 G04" }
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Remove from Favorites
|
||||||
|
```
|
||||||
|
POST /api/method/building_material.building_material.api.item_wishlist.remove_from_wishlist
|
||||||
|
Body: { "item_id": "GIB20 G04" }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation Architecture
|
||||||
|
|
||||||
|
### Files Created/Modified
|
||||||
|
|
||||||
|
#### 1. API Constants
|
||||||
|
**File**: `lib/core/constants/api_constants.dart`
|
||||||
|
- Added favorites endpoints:
|
||||||
|
- `getFavorites`
|
||||||
|
- `addToFavorites`
|
||||||
|
- `removeFromFavorites`
|
||||||
|
|
||||||
|
#### 2. Remote DataSource
|
||||||
|
**File**: `lib/features/favorites/data/datasources/favorites_remote_datasource.dart`
|
||||||
|
- `getFavorites()` - Fetch all favorites from API
|
||||||
|
- `addToFavorites(itemId)` - Add item to wishlist
|
||||||
|
- `removeFromFavorites(itemId)` - Remove item from wishlist
|
||||||
|
- Proper error handling with custom exceptions
|
||||||
|
- Maps API response to `FavoriteModel`
|
||||||
|
|
||||||
|
#### 3. Domain Repository Interface
|
||||||
|
**File**: `lib/features/favorites/domain/repositories/favorites_repository.dart`
|
||||||
|
- Defines contract for favorites operations
|
||||||
|
- Documents online-first approach
|
||||||
|
- Methods: `getFavorites`, `addFavorite`, `removeFavorite`, `isFavorite`, `getFavoriteCount`, `clearFavorites`, `syncFavorites`
|
||||||
|
|
||||||
|
#### 4. Repository Implementation
|
||||||
|
**File**: `lib/features/favorites/data/repositories/favorites_repository_impl.dart`
|
||||||
|
- **Online-first strategy**:
|
||||||
|
1. Try API call when connected
|
||||||
|
2. Update local cache with API response
|
||||||
|
3. Fall back to local cache on network errors
|
||||||
|
4. Queue changes for sync when offline
|
||||||
|
|
||||||
|
**Key Methods**:
|
||||||
|
- `getFavorites()` - Fetches from API, caches locally, falls back to cache
|
||||||
|
- `addFavorite()` - Adds via API, caches locally, queues offline changes
|
||||||
|
- `removeFavorite()` - Removes via API, updates cache, queues offline changes
|
||||||
|
- `syncFavorites()` - Syncs pending changes when connection restored
|
||||||
|
|
||||||
|
#### 5. Provider Updates
|
||||||
|
**File**: `lib/features/favorites/presentation/providers/favorites_provider.dart`
|
||||||
|
|
||||||
|
**New Providers**:
|
||||||
|
- `favoritesRemoteDataSourceProvider` - Remote API datasource
|
||||||
|
- `favoritesRepositoryProvider` - Repository with online-first approach
|
||||||
|
|
||||||
|
**Updated Favorites Provider**:
|
||||||
|
- Now uses repository instead of direct local datasource
|
||||||
|
- Supports online-first operations
|
||||||
|
- Auto-syncs with API on refresh
|
||||||
|
- Maintains backward compatibility with existing UI
|
||||||
|
|
||||||
|
## Online-First Flow
|
||||||
|
|
||||||
|
### Adding a Favorite
|
||||||
|
```
|
||||||
|
User taps favorite icon
|
||||||
|
↓
|
||||||
|
Check network connectivity
|
||||||
|
↓
|
||||||
|
If ONLINE:
|
||||||
|
→ Call API to add favorite
|
||||||
|
→ Cache result locally
|
||||||
|
→ Update UI state
|
||||||
|
↓
|
||||||
|
If OFFLINE:
|
||||||
|
→ Add to local cache immediately
|
||||||
|
→ Queue for sync (TODO)
|
||||||
|
→ Update UI state
|
||||||
|
→ Sync when connection restored
|
||||||
|
```
|
||||||
|
|
||||||
|
### Loading Favorites
|
||||||
|
```
|
||||||
|
App loads favorites page
|
||||||
|
↓
|
||||||
|
Check network connectivity
|
||||||
|
↓
|
||||||
|
If ONLINE:
|
||||||
|
→ Fetch from API
|
||||||
|
→ Update local cache
|
||||||
|
→ Display results
|
||||||
|
↓
|
||||||
|
If API FAILS:
|
||||||
|
→ Fall back to local cache
|
||||||
|
→ Display cached data
|
||||||
|
↓
|
||||||
|
If OFFLINE:
|
||||||
|
→ Load from local cache
|
||||||
|
→ Display cached data
|
||||||
|
```
|
||||||
|
|
||||||
|
### Removing a Favorite
|
||||||
|
```
|
||||||
|
User removes favorite
|
||||||
|
↓
|
||||||
|
Check network connectivity
|
||||||
|
↓
|
||||||
|
If ONLINE:
|
||||||
|
→ Call API to remove
|
||||||
|
→ Update local cache
|
||||||
|
→ Update UI state
|
||||||
|
↓
|
||||||
|
If OFFLINE:
|
||||||
|
→ Remove from cache immediately
|
||||||
|
→ Queue for sync (TODO)
|
||||||
|
→ Update UI state
|
||||||
|
→ Sync when connection restored
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Handling
|
||||||
|
|
||||||
|
### Network Errors
|
||||||
|
- `NetworkException` - Connection issues, timeouts
|
||||||
|
- Falls back to local cache
|
||||||
|
- Shows cached data to user
|
||||||
|
|
||||||
|
### Server Errors
|
||||||
|
- `ServerException` - 500 errors, invalid responses
|
||||||
|
- Falls back to local cache
|
||||||
|
- Logs error for debugging
|
||||||
|
|
||||||
|
### Authentication Errors
|
||||||
|
- `UnauthorizedException` - 401/403 errors
|
||||||
|
- Prompts user to re-login
|
||||||
|
- Does not fall back to cache
|
||||||
|
|
||||||
|
## Offline Queue (Future Enhancement)
|
||||||
|
|
||||||
|
### TODO: Implement Sync Queue
|
||||||
|
Currently, offline changes are persisted locally but not automatically synced when connection is restored.
|
||||||
|
|
||||||
|
**Future Implementation**:
|
||||||
|
1. Create offline queue datasource
|
||||||
|
2. Queue failed API calls with payload
|
||||||
|
3. Process queue on connection restore
|
||||||
|
4. Handle conflicts (item deleted on server, etc.)
|
||||||
|
5. Show sync status to user
|
||||||
|
|
||||||
|
**Files to Create**:
|
||||||
|
- `lib/core/sync/offline_queue_datasource.dart`
|
||||||
|
- `lib/core/sync/sync_manager.dart`
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
### Unit Tests (TODO)
|
||||||
|
- `test/features/favorites/data/datasources/favorites_remote_datasource_test.dart`
|
||||||
|
- `test/features/favorites/data/repositories/favorites_repository_impl_test.dart`
|
||||||
|
- `test/features/favorites/presentation/providers/favorites_provider_test.dart`
|
||||||
|
|
||||||
|
### Integration Tests (TODO)
|
||||||
|
- Test online-first flow
|
||||||
|
- Test offline fallback
|
||||||
|
- Test sync after reconnection
|
||||||
|
|
||||||
|
## Usage Example
|
||||||
|
|
||||||
|
### In UI Code
|
||||||
|
```dart
|
||||||
|
// Add favorite
|
||||||
|
ref.read(favoritesProvider.notifier).addFavorite(productId);
|
||||||
|
|
||||||
|
// Remove favorite
|
||||||
|
ref.read(favoritesProvider.notifier).removeFavorite(productId);
|
||||||
|
|
||||||
|
// Check if favorited
|
||||||
|
final isFav = ref.watch(isFavoriteProvider(productId));
|
||||||
|
|
||||||
|
// Refresh from API
|
||||||
|
ref.read(favoritesProvider.notifier).refresh();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Benefits of This Implementation
|
||||||
|
|
||||||
|
1. **Online-First** - Always uses fresh data when available
|
||||||
|
2. **Offline Support** - Works without network, syncs later
|
||||||
|
3. **Fast UI** - Immediate feedback from local cache
|
||||||
|
4. **Error Resilient** - Graceful fallback on failures
|
||||||
|
5. **Clean Architecture** - Easy to test and maintain
|
||||||
|
6. **Type Safe** - Full Dart/Flutter type checking
|
||||||
|
|
||||||
|
## API Response Format
|
||||||
|
|
||||||
|
### Get Favorites Response
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "GIB20 G04",
|
||||||
|
"item_code": "GIB20 G04",
|
||||||
|
"item_name": "Gibellina GIB20 G04",
|
||||||
|
"item_group_name": "OUTDOOR [20mm]",
|
||||||
|
"custom_link_360": "https://...",
|
||||||
|
"thumbnail": "https://...",
|
||||||
|
"price": 0,
|
||||||
|
"currency": "",
|
||||||
|
"conversion_of_sm": 5.5556
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Add/Remove Response
|
||||||
|
Standard Frappe response with status code 200 on success.
|
||||||
|
|
||||||
|
## Configuration Required
|
||||||
|
|
||||||
|
### Authentication
|
||||||
|
The API requires:
|
||||||
|
- `Cookie` header with `sid` (session ID)
|
||||||
|
- `X-Frappe-Csrf-Token` header
|
||||||
|
|
||||||
|
These are automatically added by the `AuthInterceptor` in `lib/core/network/api_interceptor.dart`.
|
||||||
|
|
||||||
|
### Base URL
|
||||||
|
Set in `lib/core/constants/api_constants.dart`:
|
||||||
|
```dart
|
||||||
|
static const String baseUrl = 'https://land.dbiz.com';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
1. **Test with real API** - Verify endpoints with actual backend
|
||||||
|
2. **Implement sync queue** - Handle offline changes properly
|
||||||
|
3. **Add error UI feedback** - Show sync status, errors to user
|
||||||
|
4. **Write unit tests** - Test all datasources and repository
|
||||||
|
5. **Add analytics** - Track favorite actions for insights
|
||||||
|
6. **Optimize caching** - Fine-tune cache expiration strategy
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Current implementation uses hardcoded `userId = 'user_001'` (line 32 in favorites_provider.dart)
|
||||||
|
- TODO: Integrate with actual auth provider when available
|
||||||
|
- Offline queue sync is not yet implemented - changes are cached locally but not automatically synced
|
||||||
|
- All API calls use POST method as per Frappe ERPNext convention
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Implementation Date**: December 2024
|
||||||
|
**Status**: ✅ Complete - Ready for Testing
|
||||||
|
**Breaking Changes**: None - Backward compatible with existing UI
|
||||||
198
docs/md/favorites_loading_fix.md
Normal file
198
docs/md/favorites_loading_fix.md
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
# Favorites Page - Loading State Fix
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
Users were seeing the empty state ("Chưa có sản phẩm yêu thích") flash briefly before the actual favorites data loaded, even when they had favorites. This created a poor user experience.
|
||||||
|
|
||||||
|
## Root Cause
|
||||||
|
The `favoriteProductsProvider` is an async provider that:
|
||||||
|
1. Loads favorites from API/cache
|
||||||
|
2. Fetches all products
|
||||||
|
3. Filters to get favorite products
|
||||||
|
|
||||||
|
During this process, the provider goes through these states:
|
||||||
|
- **Loading** → Returns empty list [] → Shows loading skeleton
|
||||||
|
- **Data** → If products.isEmpty → Shows empty state ❌ **FLASH**
|
||||||
|
- **Data** → Returns actual products → Shows grid
|
||||||
|
|
||||||
|
The flash happened because when the provider rebuilt, it momentarily returned an empty list before the actual data arrived.
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
### 1. Added `ref.keepAlive()` to Providers
|
||||||
|
```dart
|
||||||
|
@riverpod
|
||||||
|
class Favorites extends _$Favorites {
|
||||||
|
@override
|
||||||
|
Future<Set<String>> build() async {
|
||||||
|
ref.keepAlive(); // ← Prevents provider disposal
|
||||||
|
// ... rest of code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
Future<List<Product>> favoriteProducts(Ref ref) async {
|
||||||
|
ref.keepAlive(); // ← Keeps previous data in memory
|
||||||
|
// ... rest of code
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits**:
|
||||||
|
- Prevents state from being disposed when widget rebuilds
|
||||||
|
- Keeps previous data available via `favoriteProductsAsync.valueOrNull`
|
||||||
|
- Reduces unnecessary API calls
|
||||||
|
|
||||||
|
### 2. Smart Loading State Logic
|
||||||
|
|
||||||
|
```dart
|
||||||
|
loading: () {
|
||||||
|
// 1. Check for previous data first
|
||||||
|
final previousValue = favoriteProductsAsync.valueOrNull;
|
||||||
|
|
||||||
|
// 2. If we have previous data, show it while loading
|
||||||
|
if (previousValue != null && previousValue.isNotEmpty) {
|
||||||
|
return Stack([
|
||||||
|
_FavoritesGrid(products: previousValue), // Show old data
|
||||||
|
LoadingIndicator(), // Small loading badge on top
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Use favoriteCount as a hint
|
||||||
|
if (favoriteCount > 0) {
|
||||||
|
return LoadingState(); // Show skeleton
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. No data, show skeleton (not empty state)
|
||||||
|
return LoadingState();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Data State - Only Show Empty When Actually Empty
|
||||||
|
|
||||||
|
```dart
|
||||||
|
data: (products) {
|
||||||
|
// Only show empty state when data is actually empty
|
||||||
|
if (products.isEmpty) {
|
||||||
|
return const _EmptyState();
|
||||||
|
}
|
||||||
|
|
||||||
|
return RefreshIndicator(
|
||||||
|
child: _FavoritesGrid(products: products),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## User Experience Flow
|
||||||
|
|
||||||
|
### Before Fix ❌
|
||||||
|
```
|
||||||
|
User opens favorites page
|
||||||
|
↓
|
||||||
|
Loading skeleton shows (0.1s)
|
||||||
|
↓
|
||||||
|
Empty state flashes (0.2s) ⚡ BAD UX
|
||||||
|
↓
|
||||||
|
Favorites grid appears
|
||||||
|
```
|
||||||
|
|
||||||
|
### After Fix ✅
|
||||||
|
```
|
||||||
|
User opens favorites page
|
||||||
|
↓
|
||||||
|
Loading skeleton shows (0.3s)
|
||||||
|
↓
|
||||||
|
Favorites grid appears smoothly
|
||||||
|
```
|
||||||
|
|
||||||
|
**OR** if returning to page:
|
||||||
|
```
|
||||||
|
User opens favorites page (2nd time)
|
||||||
|
↓
|
||||||
|
Previous favorites show immediately
|
||||||
|
↓
|
||||||
|
Small "Đang tải..." badge appears at top
|
||||||
|
↓
|
||||||
|
Updated favorites appear (if changed)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Benefits
|
||||||
|
|
||||||
|
### 1. Better Offline Support
|
||||||
|
- When offline, previous data stays visible
|
||||||
|
- Shows error banner on top instead of hiding content
|
||||||
|
- User can still browse cached favorites
|
||||||
|
|
||||||
|
### 2. Faster Perceived Performance
|
||||||
|
- Instant display of previous data
|
||||||
|
- Users don't see empty states during reloads
|
||||||
|
- Smoother transitions
|
||||||
|
|
||||||
|
### 3. Error Handling
|
||||||
|
```dart
|
||||||
|
error: (error, stackTrace) {
|
||||||
|
final previousValue = favoriteProductsAsync.valueOrNull;
|
||||||
|
|
||||||
|
// Show previous data with error message
|
||||||
|
if (previousValue != null && previousValue.isNotEmpty) {
|
||||||
|
return Stack([
|
||||||
|
_FavoritesGrid(products: previousValue),
|
||||||
|
ErrorBanner(onRetry: ...),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// No previous data, show full error state
|
||||||
|
return _ErrorState();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Files Modified
|
||||||
|
|
||||||
|
1. **lib/features/favorites/presentation/providers/favorites_provider.dart**
|
||||||
|
- Added `ref.keepAlive()` to `Favorites` class (line 81)
|
||||||
|
- Added `ref.keepAlive()` to `favoriteProducts` provider (line 271)
|
||||||
|
|
||||||
|
2. **lib/features/favorites/presentation/pages/favorites_page.dart**
|
||||||
|
- Enhanced loading state logic (lines 138-193)
|
||||||
|
- Added previous value checking
|
||||||
|
- Added favoriteCount hint logic
|
||||||
|
|
||||||
|
## Testing Checklist
|
||||||
|
|
||||||
|
- [x] No empty state flash on first load
|
||||||
|
- [x] Smooth loading with skeleton
|
||||||
|
- [x] Previous data shown on subsequent visits
|
||||||
|
- [x] Loading indicator overlay when refreshing
|
||||||
|
- [ ] Test with slow network (3G)
|
||||||
|
- [ ] Test with offline mode
|
||||||
|
- [ ] Test with errors during load
|
||||||
|
|
||||||
|
## Performance Impact
|
||||||
|
|
||||||
|
✅ **Positive**:
|
||||||
|
- Reduced state rebuilds
|
||||||
|
- Better memory management with keepAlive
|
||||||
|
- Fewer API calls on navigation
|
||||||
|
|
||||||
|
⚠️ **Watch**:
|
||||||
|
- Memory usage (keepAlive keeps data in memory)
|
||||||
|
- Can manually dispose with `ref.invalidate()` if needed
|
||||||
|
|
||||||
|
## Future Improvements
|
||||||
|
|
||||||
|
1. **Add shimmer duration control**
|
||||||
|
- Minimum shimmer display time to prevent flash
|
||||||
|
- Smooth fade transition from skeleton to content
|
||||||
|
|
||||||
|
2. **Progressive loading**
|
||||||
|
- Show cached data first
|
||||||
|
- Overlay with "Updating..." badge
|
||||||
|
- Fade in updated items
|
||||||
|
|
||||||
|
3. **Prefetch on app launch**
|
||||||
|
- Load favorites in background
|
||||||
|
- Data ready before user navigates to page
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Status**: ✅ Implemented
|
||||||
|
**Impact**: High - Significantly improves perceived performance
|
||||||
|
**Breaking Changes**: None
|
||||||
81
docs/md/order_model_update_summary.md
Normal file
81
docs/md/order_model_update_summary.md
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# Order Model API Integration Update
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
Updated OrderModel and orders_provider to match the simplified API response structure from the ERPNext/Frappe backend.
|
||||||
|
|
||||||
|
## API Response Structure
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "SAL-ORD-2025-00107",
|
||||||
|
"transaction_date": "2025-11-24",
|
||||||
|
"delivery_date": "2025-11-24",
|
||||||
|
"address": "123 add dad",
|
||||||
|
"grand_total": 3355443.2,
|
||||||
|
"status": "Chờ phê duyệt",
|
||||||
|
"status_color": "Warning"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Changes Made
|
||||||
|
|
||||||
|
### 1. OrderModel (`lib/features/orders/data/models/order_model.dart`)
|
||||||
|
**New Fields Added:**
|
||||||
|
- `statusColor` (HiveField 18): Stores API status color (Warning, Success, Danger, etc.)
|
||||||
|
- `transactionDate` (HiveField 19): Transaction date from API
|
||||||
|
- `addressString` (HiveField 20): Simple string address from API
|
||||||
|
|
||||||
|
**Updated Methods:**
|
||||||
|
- `fromJson()`: Made fields more nullable, added new field mappings
|
||||||
|
- `toJson()`: Added new fields to output
|
||||||
|
- Constructor: Added new optional parameters
|
||||||
|
|
||||||
|
### 2. Orders Provider (`lib/features/orders/presentation/providers/orders_provider.dart`)
|
||||||
|
**API Field Mapping:**
|
||||||
|
```dart
|
||||||
|
{
|
||||||
|
'order_id': json['name'],
|
||||||
|
'order_number': json['name'],
|
||||||
|
'status': _mapStatusFromApi(json['status']),
|
||||||
|
'total_amount': json['grand_total'],
|
||||||
|
'final_amount': json['grand_total'],
|
||||||
|
'expected_delivery_date': json['delivery_date'],
|
||||||
|
'transaction_date': json['transaction_date'],
|
||||||
|
'address_string': json['address'],
|
||||||
|
'status_color': json['status_color'],
|
||||||
|
'created_at': json['transaction_date'],
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Status Mapping:**
|
||||||
|
- "Chờ phê duyệt" / "Pending approval" → `pending`
|
||||||
|
- "Đang xử lý" / "Processing" → `processing`
|
||||||
|
- "Đang giao" / "Shipped" → `shipped`
|
||||||
|
- "Hoàn thành" / "Completed" → `completed`
|
||||||
|
- "Đã hủy" / "Cancelled" / "Rejected" → `cancelled`
|
||||||
|
|
||||||
|
### 3. Order Card Widget (`lib/features/orders/presentation/widgets/order_card.dart`)
|
||||||
|
**Display Updates:**
|
||||||
|
- Uses `transactionDate` if available, falls back to `createdAt`
|
||||||
|
- Uses `addressString` directly from API instead of parsing JSON
|
||||||
|
|
||||||
|
## Benefits
|
||||||
|
1. **Simpler mapping**: Direct field mapping without complex transformations
|
||||||
|
2. **API consistency**: Matches actual backend response structure
|
||||||
|
3. **Better performance**: No need to parse JSON addresses for list view
|
||||||
|
4. **Status colors**: API-provided colors ensure UI consistency with backend
|
||||||
|
|
||||||
|
## API Endpoint
|
||||||
|
```
|
||||||
|
POST /api/method/building_material.building_material.api.sales_order.get_list
|
||||||
|
Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing Notes
|
||||||
|
- Ensure API returns all expected fields
|
||||||
|
- Verify Vietnamese status strings are correctly mapped
|
||||||
|
- Check that dates are in ISO format (YYYY-MM-DD)
|
||||||
|
- Confirm status_color values match StatusColor enum (Warning, Success, Danger, Info, Secondary)
|
||||||
290
docs/order.sh
Normal file
290
docs/order.sh
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
|
||||||
|
#Get list of order status
|
||||||
|
curl --location --request POST 'https://land.dbiz.com//api/method/building_material.building_material.api.sales_order.get_order_status_list' \
|
||||||
|
--header 'Cookie: sid=a98c0b426abd8af3b0fd92407ef96937acda888a9a63bf3c580447d4; full_name=Hsadqdqwed; sid=42d89a7465571e04e0ee47a5bb1dd73563ff4f30ef9f7370ed490275; system_user=no; user_id=123%40gmail.com; user_image=/files/avatar_0987654321_1763631288.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a2bc5e9342441ff895ad2781e99a4c3fae4cad1250ae40c51f90067a' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data ''
|
||||||
|
|
||||||
|
#Response list of order status
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"status": "Pending approval",
|
||||||
|
"label": "Chờ phê duyệt",
|
||||||
|
"color": "Warning",
|
||||||
|
"index": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"status": "Processing",
|
||||||
|
"label": "Đang xử lý",
|
||||||
|
"color": "Warning",
|
||||||
|
"index": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"status": "Completed",
|
||||||
|
"label": "Hoàn thành",
|
||||||
|
"color": "Success",
|
||||||
|
"index": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"status": "Rejected",
|
||||||
|
"label": "Từ chối",
|
||||||
|
"color": "Danger",
|
||||||
|
"index": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"status": "Cancelled",
|
||||||
|
"label": "HỦY BỎ",
|
||||||
|
"color": "Danger",
|
||||||
|
"index": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#get payment list
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/frappe.client.get_list' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a2bc5e9342441ff895ad2781e99a4c3fae4cad1250ae40c51f90067a' \
|
||||||
|
--header 'Cookie: sid=a98c0b426abd8af3b0fd92407ef96937acda888a9a63bf3c580447d4; full_name=phuoc; sid=a98c0b426abd8af3b0fd92407ef96937acda888a9a63bf3c580447d4; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"doctype": "Payment Terms Template",
|
||||||
|
"fields": ["name","custom_description"],
|
||||||
|
"limit_page_length": 0
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response payment list
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "Thanh toán hoàn toàn",
|
||||||
|
"custom_description": "Thanh toán ngay được chiết khấu 2%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Thanh toán trả trước",
|
||||||
|
"custom_description": "Trả trước (≥20%), còn lại thanh toán trong vòng 30 ngày"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#create order
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.sales_order.save' \
|
||||||
|
--header 'Cookie: sid=a98c0b426abd8af3b0fd92407ef96937acda888a9a63bf3c580447d4; full_name=phuoc; sid=c0f46dc2ed23d58c013daa7d1813b36caf04555472b792cdb74e0d61; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a2bc5e9342441ff895ad2781e99a4c3fae4cad1250ae40c51f90067a' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"transaction_date": "2025-11-20", // Ngày tạo
|
||||||
|
"delivery_date": "2025-11-20", // Ngày dự kiến giao
|
||||||
|
"shipping_address_name": "Lam Address-Billing",
|
||||||
|
"customer_address": "Lam Address-Billing",
|
||||||
|
"description": "Order description", // Ghi chú
|
||||||
|
"payment_terms" : "Thanh toán hoàn toàn", // Lấy name từ GET PAYMENT TERM
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"item_id": "HOA E02",
|
||||||
|
"qty_entered": 2, // SỐ lượng User tự nhập
|
||||||
|
"primary_qty" : 2.56, // SỐ lượng sau khi quy đổi
|
||||||
|
"price_entered": 10000 // Đơn giá
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}'
|
||||||
|
|
||||||
|
#create order response
|
||||||
|
Response: {message: {success: true, message: Sales Order created successfully, data: {name: SAL-ORD-2025-00078, status_color: Warning, status: Chờ phê duyệt, grand_total: 589824.0}}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#gen qrcode
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.v1.qrcode.generate' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"order_id" : "SAL-ORD-2025-00048"
|
||||||
|
}'
|
||||||
|
|
||||||
|
#gen qrcode response
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"qr_code": "00020101021238540010A00000072701240006970422011008490428160208QRIBFTTA53037045802VN62220818SAL-ORD-2025-00048630430F4",
|
||||||
|
"amount": null,
|
||||||
|
"transaction_id": "SAL-ORD-2025-00048",
|
||||||
|
"bank_info": {
|
||||||
|
"bank_name": "MB Bank",
|
||||||
|
"account_no": "0849042816",
|
||||||
|
"account_name": "NGUYEN MINH CHAU"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#upload bill
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/upload_file' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--form 'file=@"/C:/Users/tiennld/Downloads/logo_crm.png"' \
|
||||||
|
--form 'is_private="1"' \
|
||||||
|
--form 'folder="Home/Attachments"' \
|
||||||
|
--form 'doctype="Sales Order"' \
|
||||||
|
--form 'docname="SAL-ORD-2025-00058-1"' \
|
||||||
|
--form 'optimize="true"'
|
||||||
|
|
||||||
|
|
||||||
|
#get list order
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.sales_order.get_list' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_start" : 0,
|
||||||
|
"limit_page_length" : 0
|
||||||
|
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response list order
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "SAL-ORD-2025-00107",
|
||||||
|
"transaction_date": "2025-11-24",
|
||||||
|
"delivery_date": "2025-11-24",
|
||||||
|
"address": "123 add dad",
|
||||||
|
"grand_total": 3355443.2,
|
||||||
|
"status": "Chờ phê duyệt",
|
||||||
|
"status_color": "Warning"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SAL-ORD-2025-00106",
|
||||||
|
"transaction_date": "2025-11-24",
|
||||||
|
"delivery_date": "2025-11-24",
|
||||||
|
"address": "123 add dad",
|
||||||
|
"grand_total": 3355443.2,
|
||||||
|
"status": "Chờ phê duyệt",
|
||||||
|
"status_color": "Warning"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#order detail
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.sales_order.get_detail' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name" : "SAL-ORD-2025-00058-1"
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response order detail
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"order": {
|
||||||
|
"name": "SAL-ORD-2025-00107",
|
||||||
|
"customer": "test - 1",
|
||||||
|
"transaction_date": "2025-11-24",
|
||||||
|
"delivery_date": "2025-11-24",
|
||||||
|
"status": "Chờ phê duyệt",
|
||||||
|
"status_color": "Warning",
|
||||||
|
"total_qty": 2.56,
|
||||||
|
"total": 3355443.2,
|
||||||
|
"grand_total": 3355443.2,
|
||||||
|
"total_remaining": 0,
|
||||||
|
"description": "Order from mobile app",
|
||||||
|
"contract_request": false,
|
||||||
|
"ignore_pricing_rule": false,
|
||||||
|
"rejection_reason": null,
|
||||||
|
"is_allow_cancel": true
|
||||||
|
},
|
||||||
|
"billing_address": {
|
||||||
|
"name": "phuoc-Billing-3",
|
||||||
|
"address_title": "phuoc",
|
||||||
|
"address_line1": "123 add dad",
|
||||||
|
"phone": "0123123123",
|
||||||
|
"email": "123@gmail.com",
|
||||||
|
"fax": null,
|
||||||
|
"tax_code": "064521840",
|
||||||
|
"city_code": "19",
|
||||||
|
"ward_code": "01936",
|
||||||
|
"city_name": "Tỉnh Thái Nguyên",
|
||||||
|
"ward_name": "Xã Nà Phặc",
|
||||||
|
"is_allow_edit": true
|
||||||
|
},
|
||||||
|
"shipping_address": {
|
||||||
|
"name": "phuoc-Billing-3",
|
||||||
|
"address_title": "phuoc",
|
||||||
|
"address_line1": "123 add dad",
|
||||||
|
"phone": "0123123123",
|
||||||
|
"email": "123@gmail.com",
|
||||||
|
"fax": null,
|
||||||
|
"tax_code": "064521840",
|
||||||
|
"city_code": "19",
|
||||||
|
"ward_code": "01936",
|
||||||
|
"city_name": "Tỉnh Thái Nguyên",
|
||||||
|
"ward_name": "Xã Nà Phặc",
|
||||||
|
"is_allow_edit": true
|
||||||
|
},
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "9crv0j6d4t",
|
||||||
|
"item_code": "HOA E01",
|
||||||
|
"item_name": "Hội An HOA E01",
|
||||||
|
"description": "Hội An HOA E01",
|
||||||
|
"qty_entered": 0.0,
|
||||||
|
"qty_of_sm": 2.56,
|
||||||
|
"qty_of_nos": 4.0,
|
||||||
|
"conversion_factor": 1.5625,
|
||||||
|
"price": 1310720.0,
|
||||||
|
"total_amount": 3355443.2,
|
||||||
|
"delivery_date": "2025-11-24",
|
||||||
|
"thumbnail": "https://land.dbiz.com/files/HOA-E01-f1.jpg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"payment_terms": {
|
||||||
|
"name": "Thanh toán hoàn toàn",
|
||||||
|
"description": "Thanh toán ngay được chiết khấu 2%"
|
||||||
|
},
|
||||||
|
"timeline": [
|
||||||
|
{
|
||||||
|
"label": "Đã tạo đơn",
|
||||||
|
"value": "2025-11-24 14:46:07",
|
||||||
|
"status": "Success"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Chờ phê duyệt",
|
||||||
|
"value": null,
|
||||||
|
"status": "Warning"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Đơn đang xử lý",
|
||||||
|
"value": "Prepare goods and transport",
|
||||||
|
"status": "Secondary"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Hoàn thành",
|
||||||
|
"value": null,
|
||||||
|
"status": "Secondary"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"payments": [],
|
||||||
|
"invoices": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#update address order
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.sales_order.update' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name" : "SAL-ORD-2025-00053",
|
||||||
|
"shipping_address_name": "Công ty Tiến Nguyễn 2-thanh toán",
|
||||||
|
"customer_address": "Nguyễn Lê Duy Ti-Billing"
|
||||||
|
}'
|
||||||
|
|
||||||
|
#cancel order
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.sales_order.cancel' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name" : "SAL-ORD-2025-00054"
|
||||||
|
}'
|
||||||
68
docs/payment.sh
Normal file
68
docs/payment.sh
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#get list payments
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.payment.get_list' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_page_length" : 0,
|
||||||
|
"limit_start" : 0
|
||||||
|
|
||||||
|
}'
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "ACC-PAY-2025-00020",
|
||||||
|
"posting_date": "2025-11-25",
|
||||||
|
"paid_amount": 1130365.328,
|
||||||
|
"mode_of_payment": null,
|
||||||
|
"invoice_id": null,
|
||||||
|
"order_id": "SAL-ORD-2025-00120"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ACC-PAY-2025-00019",
|
||||||
|
"posting_date": "2025-11-25",
|
||||||
|
"paid_amount": 1153434.0,
|
||||||
|
"mode_of_payment": "Chuyển khoản",
|
||||||
|
"invoice_id": "ACC-SINV-2025-00026",
|
||||||
|
"order_id": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ACC-PAY-2025-00018",
|
||||||
|
"posting_date": "2025-11-24",
|
||||||
|
"paid_amount": 2580258.0,
|
||||||
|
"mode_of_payment": null,
|
||||||
|
"invoice_id": "ACC-SINV-2025-00025",
|
||||||
|
"order_id": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ACC-PAY-2025-00017",
|
||||||
|
"posting_date": "2025-11-24",
|
||||||
|
"paid_amount": 1000000.0,
|
||||||
|
"mode_of_payment": null,
|
||||||
|
"invoice_id": "ACC-SINV-2025-00025",
|
||||||
|
"order_id": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#get payment detail
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.payment.get_detail' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name" : "ACC-PAY-2025-00020"
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"name": "ACC-PAY-2025-00020",
|
||||||
|
"posting_date": "2025-11-25",
|
||||||
|
"paid_amount": 1130365.328,
|
||||||
|
"mode_of_payment": null,
|
||||||
|
"invoice_id": null,
|
||||||
|
"order_id": "SAL-ORD-2025-00120"
|
||||||
|
}
|
||||||
|
}
|
||||||
22
docs/price.sh
Normal file
22
docs/price.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#get price list
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.pricing.get_pricing_info' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"pricing_type" : "PRICE_LIST",
|
||||||
|
"limit_page_length" : 0,
|
||||||
|
"limit_start" : 0
|
||||||
|
}'
|
||||||
|
//note: PRICING_RULE = Chính sách giá,PRICE_LIST= bảng giá
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"title": "EUROTILE",
|
||||||
|
"file_url": "https://land.dbiz.com/private/files/City.xlsx",
|
||||||
|
"updated_at": "2025-11-26 11:36:43"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -8,6 +8,25 @@ curl --location 'https://land.dbiz.com//api/method/building_material.building_ma
|
|||||||
"limit_page_length": 0
|
"limit_page_length": 0
|
||||||
}'
|
}'
|
||||||
|
|
||||||
|
get product final version
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.item.get_list' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
|
||||||
|
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=phuoc; sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_start" : 0,
|
||||||
|
"limit_page_length": 0,
|
||||||
|
"item_group" : ["CẨM THẠCH [ Marble ]"],
|
||||||
|
"brand" : ["TEST 1"],
|
||||||
|
"item_attribute" : [
|
||||||
|
{
|
||||||
|
"attribute": "Màu sắc",
|
||||||
|
"attribute_value" : "Nhạt"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"search_keyword" : "chề lính"
|
||||||
|
}'
|
||||||
|
|
||||||
get product attribute list
|
get product attribute list
|
||||||
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.item_attribute.get_list' \
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.item_attribute.get_list' \
|
||||||
--header 'X-Frappe-Csrf-Token: 13c271e0e58dcad9bcc0053cad0057540eb0675bb7052c2cc1a815b2' \
|
--header 'X-Frappe-Csrf-Token: 13c271e0e58dcad9bcc0053cad0057540eb0675bb7052c2cc1a815b2' \
|
||||||
@@ -37,7 +56,7 @@ curl --location 'https://land.dbiz.com//api/method/frappe.client.get_list' \
|
|||||||
--data '{
|
--data '{
|
||||||
"doctype": "Item Group",
|
"doctype": "Item Group",
|
||||||
"fields": ["item_group_name","name"],
|
"fields": ["item_group_name","name"],
|
||||||
"filters": {"is_group": 0},
|
"filters": {"is_group": 0, "custom_published" : 1},
|
||||||
"limit_page_length": 0
|
"limit_page_length": 0
|
||||||
}'
|
}'
|
||||||
|
|
||||||
|
|||||||
190
docs/projects.sh
Normal file
190
docs/projects.sh
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
#get status list
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.project.get_project_status_list' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_start": 0,
|
||||||
|
"limit_page_length": 0
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"status": "Pending approval",
|
||||||
|
"label": "Chờ phê duyệt",
|
||||||
|
"color": "Warning",
|
||||||
|
"index": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"status": "Approved",
|
||||||
|
"label": "Đã được phê duyệt",
|
||||||
|
"color": "Success",
|
||||||
|
"index": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"status": "Rejected",
|
||||||
|
"label": "Từ chối",
|
||||||
|
"color": "Danger",
|
||||||
|
"index": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"status": "Cancelled",
|
||||||
|
"label": "HỦY BỎ",
|
||||||
|
"color": "Danger",
|
||||||
|
"index": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#get project list
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.project.get_list' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_start": 0,
|
||||||
|
"limit_page_length": 0
|
||||||
|
}'
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "p9ti8veq2g",
|
||||||
|
"designed_area": "Sunrise Villa Phase 355",
|
||||||
|
"design_area": 350.5,
|
||||||
|
"request_date": "2025-11-26 09:30:00",
|
||||||
|
"status": "Đã được phê duyệt",
|
||||||
|
"reason_for_rejection": null,
|
||||||
|
"status_color": "Success"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#get project progress
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/frappe.client.get_list' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"doctype": "Progress of construction",
|
||||||
|
"fields": ["name","status"],
|
||||||
|
"order_by": "number_of_display asc",
|
||||||
|
"limit_page_length": 0
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "h6n0hat3o2",
|
||||||
|
"status": "Chưa khởi công"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "k1mr565o91",
|
||||||
|
"status": "Khởi công móng"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "2obpqokr8q",
|
||||||
|
"status": "Đang phần thô"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "i5qkovb09j",
|
||||||
|
"status": "Đang hoàn thiện"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "kdj1jjlr28",
|
||||||
|
"status": "Cất nóc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "254e3ealdf",
|
||||||
|
"status": "Hoàn thiện"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#create new project
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.project.save' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name": "p9ti8veq2g",
|
||||||
|
"designed_area": "Sunrise Villa Phase 355",
|
||||||
|
"address_of_project": "123 Đường Võ Văn Kiệt, Quận 2, TP.HCM",
|
||||||
|
"project_owner": "Nguyễn Văn A",
|
||||||
|
"design_firm": "Studio Green",
|
||||||
|
"contruction_contractor": "CTCP Xây Dựng Minh Phú",
|
||||||
|
"design_area": 350.5,
|
||||||
|
"products_included_in_the_design": "Gạch ốp lát, sơn ngoại thất, \nkhóa thông minh",
|
||||||
|
"project_progress": "h6n0hat3o2",
|
||||||
|
"expected_commencement_date": "2026-01-15",
|
||||||
|
"description": "Yêu cầu phối màu mới cho khu vực hồ bơi",
|
||||||
|
"request_date": "2025-11-26 09:30:00"
|
||||||
|
}'
|
||||||
|
|
||||||
|
#upload image file for project
|
||||||
|
#docname is the project name returned from create new project
|
||||||
|
#file is the local path of the file to be uploaded
|
||||||
|
#other parameters can be kept as is
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/upload_file' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--form 'file=@"/C:/Users/tiennld/Downloads/76369094c7604b3e1271.jpg"' \
|
||||||
|
--form 'is_private="1"' \
|
||||||
|
--form 'folder="Home/Attachments"' \
|
||||||
|
--form 'doctype="Architectural Project"' \
|
||||||
|
--form 'docname="p9ti8veq2g"' \
|
||||||
|
--form 'optimize="true"'
|
||||||
|
|
||||||
|
#delete image file of project
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/frappe.desk.form.utils.remove_attach' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--form 'fid="67803d2e95"' \ #file id to be deleted
|
||||||
|
--form 'dt="Architectural Project"' \ #doctye
|
||||||
|
--form 'dn="p9ti8veq2g"' #docname
|
||||||
|
|
||||||
|
#get detail of a project
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.project.get_detail' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name": "#DA00011"
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"success": true,
|
||||||
|
"data": {
|
||||||
|
"name": "#DA00011",
|
||||||
|
"designed_area": "f67gg7",
|
||||||
|
"address_of_project": "7fucuv",
|
||||||
|
"project_owner": "cycu",
|
||||||
|
"design_firm": null,
|
||||||
|
"contruction_contractor": null,
|
||||||
|
"design_area": 2585.0,
|
||||||
|
"products_included_in_the_design": "thy",
|
||||||
|
"project_progress": "k1mr565o91",
|
||||||
|
"expected_commencement_date": "2025-11-30",
|
||||||
|
"description": null,
|
||||||
|
"request_date": "2025-11-27 16:51:54",
|
||||||
|
"workflow_state": "Pending approval",
|
||||||
|
"reason_for_rejection": null,
|
||||||
|
"status": "Chờ phê duyệt",
|
||||||
|
"status_color": "Warning",
|
||||||
|
"is_allow_modify": true,
|
||||||
|
"is_allow_cancel": true,
|
||||||
|
"files_list": [
|
||||||
|
{
|
||||||
|
"name": "0068d2403c",
|
||||||
|
"file_url": "https://land.dbiz.com/private/files/image_picker_32BD79E6-7A71-448E-A5DF-6DA7D12A1303-66894-000015E4259DBB5B.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
108
docs/request.sh
Normal file
108
docs/request.sh
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
#get list
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.design_request.get_list' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_start": 0,
|
||||||
|
"limit_page_length": 0
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "ISS-2025-00005",
|
||||||
|
"subject": "Nhà phố 2 tầng",
|
||||||
|
"description": "<div class=\"ql-editor read-mode\"><p>Diện tích: 150m2</p><p>Khu vực: Quận 1, TP.HCM</p><p>Phong cách mong muốn: Hiện đại</p><p>Ngân sách dự kiến: 500 triệu</p><p>Yêu cầu chi tiết: Cần thiết kế phòng khách rộng, 3 phòng ngủ</p></div>",
|
||||||
|
"dateline": "2025-12-31",
|
||||||
|
"status": "Từ chối",
|
||||||
|
"status_color": "Danger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ISS-2025-00004",
|
||||||
|
"subject": "Nhà phố 2 tầng",
|
||||||
|
"description": "<div class=\"ql-editor read-mode\"><p>Diện tích: 150</p><p>Khu vực: Quận 1, TP.HCM</p><p>Phong cách mong muốn: Hiện đại</p><p>Ngân sách dự kiến: 500 triệu</p><p>Yêu cầu chi tiết: Cần thiết kế phòng khách rộng, 3 phòng ngủ</p></div>",
|
||||||
|
"dateline": "2025-12-31",
|
||||||
|
"status": "Chờ phê duyệt",
|
||||||
|
"status_color": "Warning"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ISS-2025-00003",
|
||||||
|
"subject": "Nhà phố 2 tầng",
|
||||||
|
"description": "<div class=\"ql-editor read-mode\"><p>Diện tích: 150 m²</p><p>Khu vực: Quận 1, TP.HCM</p><p>Phong cách mong muốn: Hiện đại</p><p>Ngân sách dự kiến: 500 triệu</p><p>Yêu cầu chi tiết: Cần thiết kế phòng khách rộng, 3 phòng ngủ</p></div>",
|
||||||
|
"dateline": "2025-12-31",
|
||||||
|
"status": "Chờ phê duyệt",
|
||||||
|
"status_color": "Warning"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ISS-2025-00002",
|
||||||
|
"subject": "Nhà phố 2 tầng",
|
||||||
|
"description": "<div class=\"ql-editor read-mode\"><p>Diện tích: 150 m²</p><p>Khu vực: Quận 1, TP.HCM</p><p>Phong cách mong muốn: Hiện đại</p><p>Ngân sách dự kiến: 500 triệu</p><p>Yêu cầu chi tiết: Cần thiết kế phòng khách rộng, 3 phòng ngủ</p></div>",
|
||||||
|
"dateline": "2025-12-31",
|
||||||
|
"status": "Hoàn thành",
|
||||||
|
"status_color": "Success"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#get detail
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.design_request.get_detail' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name" : "ISS-2025-00005"
|
||||||
|
}'
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"name": "ISS-2025-00005",
|
||||||
|
"subject": "Nhà phố 2 tầng",
|
||||||
|
"description": "<div class=\"ql-editor read-mode\"><p>Diện tích: 150m2</p><p>Khu vực: Quận 1, TP.HCM</p><p>Phong cách mong muốn: Hiện đại</p><p>Ngân sách dự kiến: 500 triệu</p><p>Yêu cầu chi tiết: Cần thiết kế phòng khách rộng, 3 phòng ngủ</p></div>",
|
||||||
|
"dateline": "2025-12-31",
|
||||||
|
"status": "Từ chối",
|
||||||
|
"status_color": "Danger",
|
||||||
|
"files_list": [
|
||||||
|
{
|
||||||
|
"name": "433f777958",
|
||||||
|
"file_url": "https://land.dbiz.com/files/b0d6423a04ce8890d1df.jpg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#create new design request
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.design_request.create' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"subject": "Nhà phố 2 tầng",
|
||||||
|
"area": "150",
|
||||||
|
"region": "Quận 1, TP.HCM",
|
||||||
|
"desired_style": "Hiện đại",
|
||||||
|
"estimated_budget": "500 triệu",
|
||||||
|
"detailed_requirements": "Cần thiết kế phòng khách rộng, 3 phòng ngủ",
|
||||||
|
"dateline": "2025-12-31"
|
||||||
|
}'
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"success": true,
|
||||||
|
"data": {
|
||||||
|
"name": "ISS-2025-00006"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#upload file
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/upload_file' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--form 'file=@"/C:/Users/tiennld/Downloads/b0d6423a04ce8890d1df.jpg"' \
|
||||||
|
--form 'is_private="0"' \
|
||||||
|
--form 'folder="Home/Attachments"' \
|
||||||
|
--form 'doctype="Issue"' \
|
||||||
|
--form 'docname="ISS-2025-00005"' \
|
||||||
|
--form 'optimize="true"'
|
||||||
61
docs/sample_project.sh
Normal file
61
docs/sample_project.sh
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#get list
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.sample_project.get_list' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"limit_page_length" : 0,
|
||||||
|
"limit_start" : 0
|
||||||
|
|
||||||
|
}'
|
||||||
|
|
||||||
|
#response
|
||||||
|
{
|
||||||
|
"message": [
|
||||||
|
{
|
||||||
|
"name": "PROJ-0001",
|
||||||
|
"project_name": "Căn hộ Studio",
|
||||||
|
"notes": "<div class=\"ql-editor read-mode\"><p>Thiết kế hiện đại cho căn hộ studio 35m², tối ưu không gian sống với gạch men cao cấp và màu sắc hài hòa. Sử dụng gạch granite nhập khẩu cho khu vực phòng khách và gạch ceramic chống thấm cho khu vực ẩm ướt.</p></div>",
|
||||||
|
"link": "https://vr.house3d.com/web/panorama-player/H00179549",
|
||||||
|
"thumbnail": "https://land.dbiz.com//private/files/photo-1600596542815-ffad4c1539a9.jpg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#GET DETAIL OF A SAMPLE PROJECT
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.sample_project.get_detail' \
|
||||||
|
--header 'Cookie: sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; full_name=Ha%20Duy%20Lam; sid=a0cbe3ea6f9a7e9cf083bbe3139eada68d2357eac0167bcc66cda17d; system_user=yes; user_id=lamhd%40gmail.com; user_image=/files/avatar_0986788766_1763627962.jpg' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: 6ff3be4d1f887dbebf86ba4502b05d94b30c0b0569de49b74a7171a9' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name" : "PROJ-0001"
|
||||||
|
}'
|
||||||
|
|
||||||
|
#RESPONSE
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"name": "PROJ-0001",
|
||||||
|
"project_name": "Căn hộ Studio",
|
||||||
|
"notes": "<div class=\"ql-editor read-mode\"><p>Thiết kế hiện đại cho căn hộ studio 35m², tối ưu không gian sống với gạch men cao cấp và màu sắc hài hòa. Sử dụng gạch granite nhập khẩu cho khu vực phòng khách và gạch ceramic chống thấm cho khu vực ẩm ướt.</p></div>",
|
||||||
|
"link": "https://vr.house3d.com/web/panorama-player/H00179549",
|
||||||
|
"thumbnail": "https://land.dbiz.com/private/files/photo-1600596542815-ffad4c1539a9.jpg",
|
||||||
|
"files_list": [
|
||||||
|
{
|
||||||
|
"name": "1fe604db77",
|
||||||
|
"file_url": "https://land.dbiz.com/private/files/photo-1600596542815-ffad4c1539a9.jpg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "0e3d2714ee",
|
||||||
|
"file_url": "https://land.dbiz.com/files/main_img.jpg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fd7970daa3",
|
||||||
|
"file_url": "https://land.dbiz.com/files/project_img_0.jpg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "a42fbef956",
|
||||||
|
"file_url": "https://land.dbiz.com/files/project_img_1.jpg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
43
docs/user.sh
Normal file
43
docs/user.sh
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#get user info
|
||||||
|
curl --location --request POST 'https://land.dbiz.com//api/method/building_material.building_material.api.user.get_user_info' \
|
||||||
|
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=phuoc; sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
|
||||||
|
--data ''
|
||||||
|
|
||||||
|
#response user info
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"full_name": "phuoc",
|
||||||
|
"phone": "0978113710",
|
||||||
|
"email": "vodanh.2901@gmail.com",
|
||||||
|
"date_of_birth": null,
|
||||||
|
"gender": null,
|
||||||
|
"avatar": "https://secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8?d=404&s=200",
|
||||||
|
"company_name": "phuoc",
|
||||||
|
"tax_code": null,
|
||||||
|
"id_card_front": null,
|
||||||
|
"id_card_back": null,
|
||||||
|
"certificates": [],
|
||||||
|
"membership_status": "Đã được phê duyệt",
|
||||||
|
"membership_status_color": "Success",
|
||||||
|
"is_verified": true,
|
||||||
|
"credential_display": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#update user info
|
||||||
|
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.user.update_user_info' \
|
||||||
|
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=phuoc; sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; system_user=no; user_id=vodanh.2901%40gmail.com; user_image=https%3A//secure.gravatar.com/avatar/753a0e2601b9bd87aed417e2ad123bf8%3Fd%3D404%26s%3D200' \
|
||||||
|
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"full_name" : "Ha Duy Lam",
|
||||||
|
"date_of_birth" : "2025-12-30",
|
||||||
|
"gender" : "Male",
|
||||||
|
"company_name" : "Ha Duy Lam",
|
||||||
|
"tax_code" : "0912313232",
|
||||||
|
"avatar_base64": null,
|
||||||
|
"id_card_front_base64: null,
|
||||||
|
"id_card_back_base64: null,
|
||||||
|
"certificates_base64": []
|
||||||
|
}'
|
||||||
1
firebase.json
Normal file
1
firebase.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"flutter":{"platforms":{"android":{"default":{"projectId":"dbiz-partner","appId":"1:147309310656:android:86613d8ffc85576fdc7325","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"dbiz-partner","appId":"1:147309310656:ios:aa59724d2c6b4620dc7325","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"dbiz-partner","configurations":{"android":"1:147309310656:android:86613d8ffc85576fdc7325","ios":"1:147309310656:ios:aa59724d2c6b4620dc7325"}}}}}}
|
||||||
521
html/address-create.html
Normal file
521
html/address-create.html
Normal file
@@ -0,0 +1,521 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="vi">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Thêm địa chỉ mới - EuroTile Worker</title>
|
||||||
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
|
</head>
|
||||||
|
<body class="bg-gray-50">
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="header">
|
||||||
|
<a href="addresses.html" class="back-button">
|
||||||
|
<i class="fas fa-arrow-left"></i>
|
||||||
|
</a>
|
||||||
|
<h1 class="header-title">Thêm địa chỉ mới</h1>
|
||||||
|
<button class="back-button" onclick="openInfoModal()">
|
||||||
|
<i class="fas fa-info-circle"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container max-w-3xl mx-auto px-4 py-6" style="padding-bottom: 100px;">
|
||||||
|
<form id="addressForm" onsubmit="handleSubmit(event)">
|
||||||
|
|
||||||
|
<!-- Contact Information -->
|
||||||
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-4">
|
||||||
|
<h3 class="text-base font-semibold text-gray-900 mb-4 flex items-center gap-2">
|
||||||
|
<i class="fas fa-user text-blue-600"></i>
|
||||||
|
Thông tin liên hệ
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="form-group mb-4">
|
||||||
|
<label class="form-label block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Họ và tên <span class="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<i class="fas fa-user absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
|
||||||
|
<input type="text"
|
||||||
|
id="fullName"
|
||||||
|
class="form-input w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition"
|
||||||
|
placeholder="Nhập họ và tên người nhận"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-4">
|
||||||
|
<label class="form-label block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Số điện thoại <span class="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<i class="fas fa-phone absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
|
||||||
|
<input type="tel"
|
||||||
|
id="phone"
|
||||||
|
class="form-input w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition"
|
||||||
|
placeholder="Nhập số điện thoại"
|
||||||
|
pattern="[0-9]{10,11}"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-gray-500 mt-1">Định dạng: 10-11 số</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-4">
|
||||||
|
<label class="form-label block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Email <span class="text-red-500"></span>
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<i class="fas fa-phone absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
|
||||||
|
<input type="tel"
|
||||||
|
id="phone"
|
||||||
|
class="form-input w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition"
|
||||||
|
placeholder="Nhập email"
|
||||||
|
pattern="[0-9]{10,11}"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-4">
|
||||||
|
<label class="form-label block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Mã số thuế <span class="text-red-500"></span>
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<i class="fas fa-phone absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
|
||||||
|
<input type="tel"
|
||||||
|
id="phone"
|
||||||
|
class="form-input w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition"
|
||||||
|
placeholder="Nhập mã số thuế"
|
||||||
|
pattern="[0-9]{10,11}"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Address Information -->
|
||||||
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-4">
|
||||||
|
<h3 class="text-base font-semibold text-gray-900 mb-4 flex items-center gap-2">
|
||||||
|
<i class="fas fa-map-marker-alt text-blue-600"></i>
|
||||||
|
Địa chỉ giao hàng
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="form-group mb-4">
|
||||||
|
<label class="form-label block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Tỉnh/Thành phố <span class="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<select id="province"
|
||||||
|
class="form-select w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition appearance-none bg-white"
|
||||||
|
onchange="updateDistricts()"
|
||||||
|
required>
|
||||||
|
<option value="">-- Chọn Tỉnh/Thành phố --</option>
|
||||||
|
<option value="hanoi">Hà Nội</option>
|
||||||
|
<option value="hcm">TP. Hồ Chí Minh</option>
|
||||||
|
<option value="danang">Đà Nẵng</option>
|
||||||
|
<option value="haiphong">Hải Phòng</option>
|
||||||
|
<option value="cantho">Cần Thơ</option>
|
||||||
|
<option value="binhduong">Bình Dương</option>
|
||||||
|
<option value="dongnai">Đồng Nai</option>
|
||||||
|
<option value="vungtau">Bà Rịa - Vũng Tàu</option>
|
||||||
|
<option value="nhatrang">Khánh Hòa</option>
|
||||||
|
</select>
|
||||||
|
<i class="fas fa-chevron-down absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 pointer-events-none"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-4">
|
||||||
|
<label class="form-label block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Phường/Xã <span class="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<select id="district"
|
||||||
|
class="form-select w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition appearance-none bg-white"
|
||||||
|
onchange="updateWards()"
|
||||||
|
required
|
||||||
|
disabled>
|
||||||
|
<option value="">-- Chọn Phường/Xã --</option>
|
||||||
|
</select>
|
||||||
|
<i class="fas fa-chevron-down absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 pointer-events-none"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div class="form-group mb-4">
|
||||||
|
<label class="form-label block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Phường/Xã <span class="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<select id="ward"
|
||||||
|
class="form-select w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition appearance-none bg-white"
|
||||||
|
required
|
||||||
|
disabled>
|
||||||
|
<option value="">-- Chọn Phường/Xã --</option>
|
||||||
|
</select>
|
||||||
|
<i class="fas fa-chevron-down absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 pointer-events-none"></i>
|
||||||
|
</div>
|
||||||
|
</div>-->
|
||||||
|
|
||||||
|
<div class="form-group mb-4">
|
||||||
|
<label class="form-label block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Địa chỉ cụ thể <span class="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<textarea id="addressDetail"
|
||||||
|
class="form-textarea w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition resize-none"
|
||||||
|
rows="3"
|
||||||
|
placeholder="Số nhà, tên đường, khu vực..."
|
||||||
|
required></textarea>
|
||||||
|
<p class="text-xs text-gray-500 mt-1">Ví dụ: 123 Nguyễn Huệ, Khu phố 5</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Default Address Option -->
|
||||||
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-4">
|
||||||
|
<label class="flex items-center cursor-pointer">
|
||||||
|
<input type="checkbox"
|
||||||
|
id="isDefault"
|
||||||
|
class="form-checkbox h-5 w-5 text-blue-600 rounded border-gray-300 focus:ring-2 focus:ring-blue-500">
|
||||||
|
<span class="ml-3 text-sm font-medium text-gray-900">Đặt làm địa chỉ mặc định</span>
|
||||||
|
</label>
|
||||||
|
<p class="text-xs text-gray-500 mt-2 ml-8">
|
||||||
|
Địa chỉ này sẽ được sử dụng làm mặc định khi đặt hàng
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Info Note -->
|
||||||
|
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4">
|
||||||
|
<div class="flex gap-3">
|
||||||
|
<i class="fas fa-info-circle text-blue-600 text-lg flex-shrink-0 mt-0.5"></i>
|
||||||
|
<div class="text-sm text-blue-800">
|
||||||
|
<strong>Lưu ý:</strong> Vui lòng kiểm tra kỹ thông tin địa chỉ để đảm bảo giao hàng chính xác.
|
||||||
|
Bạn có thể chỉnh sửa hoặc xóa địa chỉ này sau khi lưu.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Sticky Footer with Save Button -->
|
||||||
|
<div class="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 shadow-lg z-50">
|
||||||
|
<div class="max-w-3xl mx-auto px-4 py-4">
|
||||||
|
<button type="submit"
|
||||||
|
form="addressForm"
|
||||||
|
id="saveBtn"
|
||||||
|
class="w-full bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white font-semibold py-4 px-6 rounded-lg shadow-lg transition-all duration-200 hover:shadow-xl hover:-translate-y-0.5 flex items-center justify-center gap-2">
|
||||||
|
<i class="fas fa-save"></i>
|
||||||
|
<span>Lưu địa chỉ</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Custom form styles */
|
||||||
|
.form-input:focus,
|
||||||
|
.form-select:focus,
|
||||||
|
.form-textarea:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-select {
|
||||||
|
background-image: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-checkbox:checked {
|
||||||
|
background-color: #2563eb;
|
||||||
|
/*border-color: #2563eb;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disabled state */
|
||||||
|
.form-select:disabled {
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Animation */
|
||||||
|
@keyframes slideDown {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
animation: slideDown 0.3s ease-out;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Address data structure (simulated - in real app this comes from API)
|
||||||
|
const addressData = {
|
||||||
|
hanoi: {
|
||||||
|
name: "Hà Nội",
|
||||||
|
districts: {
|
||||||
|
"hoan-kiem": {
|
||||||
|
name: "Hoàn Kiếm",
|
||||||
|
wards: ["Hàng Bạc", "Hàng Bài", "Hàng Bồ", "Hàng Đào", "Hàng Gai"]
|
||||||
|
},
|
||||||
|
"ba-dinh": {
|
||||||
|
name: "Ba Đình",
|
||||||
|
wards: ["Điện Biên", "Đội Cấn", "Giảng Võ", "Kim Mã", "Ngọc Hà"]
|
||||||
|
},
|
||||||
|
"dong-da": {
|
||||||
|
name: "Đống Đa",
|
||||||
|
wards: ["Cát Linh", "Hàng Bột", "Khâm Thiên", "Láng Hạ", "Ô Chợ Dừa"]
|
||||||
|
},
|
||||||
|
"cau-giay": {
|
||||||
|
name: "Cầu Giấy",
|
||||||
|
wards: ["Dịch Vọng", "Mai Dịch", "Nghĩa Đô", "Quan Hoa", "Yên Hòa"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hcm: {
|
||||||
|
name: "TP. Hồ Chí Minh",
|
||||||
|
districts: {
|
||||||
|
"quan-1": {
|
||||||
|
name: "Quận 1",
|
||||||
|
wards: ["Bến Nghé", "Bến Thành", "Cô Giang", "Đa Kao", "Nguyễn Thái Bình"]
|
||||||
|
},
|
||||||
|
"quan-3": {
|
||||||
|
name: "Quận 3",
|
||||||
|
wards: ["Võ Thị Sáu", "Phường 1", "Phường 2", "Phường 3", "Phường 4"]
|
||||||
|
},
|
||||||
|
"quan-5": {
|
||||||
|
name: "Quận 5",
|
||||||
|
wards: ["Phường 1", "Phường 2", "Phường 3", "Phường 4", "Phường 5"]
|
||||||
|
},
|
||||||
|
"quan-7": {
|
||||||
|
name: "Quận 7",
|
||||||
|
wards: ["Tân Phong", "Tân Phú", "Tân Quy", "Tân Thuận Đông", "Tân Thuận Tây"]
|
||||||
|
},
|
||||||
|
"binh-thanh": {
|
||||||
|
name: "Bình Thạnh",
|
||||||
|
wards: ["Phường 1", "Phường 2", "Phường 3", "Phường 5", "Phường 7"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
danang: {
|
||||||
|
name: "Đà Nẵng",
|
||||||
|
districts: {
|
||||||
|
"hai-chau": {
|
||||||
|
name: "Hải Châu",
|
||||||
|
wards: ["Hải Châu 1", "Hải Châu 2", "Nam Dương", "Phước Ninh", "Thạch Thang"]
|
||||||
|
},
|
||||||
|
"thanh-khe": {
|
||||||
|
name: "Thanh Khê",
|
||||||
|
wards: ["An Khê", "Chính Gián", "Tam Thuận", "Tân Chính", "Thạc Gián"]
|
||||||
|
},
|
||||||
|
"son-tra": {
|
||||||
|
name: "Sơn Trà",
|
||||||
|
wards: ["An Hải Bắc", "An Hải Đông", "Mân Thái", "Nại Hiên Đông", "Phước Mỹ"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update districts when province changes
|
||||||
|
function updateDistricts() {
|
||||||
|
const provinceSelect = document.getElementById('province');
|
||||||
|
const districtSelect = document.getElementById('district');
|
||||||
|
const wardSelect = document.getElementById('ward');
|
||||||
|
|
||||||
|
const selectedProvince = provinceSelect.value;
|
||||||
|
|
||||||
|
// Reset district and ward
|
||||||
|
districtSelect.innerHTML = '<option value="">-- Chọn Quận/Huyện --</option>';
|
||||||
|
wardSelect.innerHTML = '<option value="">-- Chọn Phường/Xã --</option>';
|
||||||
|
wardSelect.disabled = true;
|
||||||
|
|
||||||
|
if (selectedProvince && addressData[selectedProvince]) {
|
||||||
|
const districts = addressData[selectedProvince].districts;
|
||||||
|
|
||||||
|
// Enable district select
|
||||||
|
districtSelect.disabled = false;
|
||||||
|
|
||||||
|
// Populate districts
|
||||||
|
Object.keys(districts).forEach(districtKey => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = districtKey;
|
||||||
|
option.textContent = districts[districtKey].name;
|
||||||
|
districtSelect.appendChild(option);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
districtSelect.disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update wards when district changes
|
||||||
|
function updateWards() {
|
||||||
|
const provinceSelect = document.getElementById('province');
|
||||||
|
const districtSelect = document.getElementById('district');
|
||||||
|
const wardSelect = document.getElementById('ward');
|
||||||
|
|
||||||
|
const selectedProvince = provinceSelect.value;
|
||||||
|
const selectedDistrict = districtSelect.value;
|
||||||
|
|
||||||
|
// Reset ward
|
||||||
|
wardSelect.innerHTML = '<option value="">-- Chọn Phường/Xã --</option>';
|
||||||
|
|
||||||
|
if (selectedProvince && selectedDistrict && addressData[selectedProvince]) {
|
||||||
|
const district = addressData[selectedProvince].districts[selectedDistrict];
|
||||||
|
|
||||||
|
if (district && district.wards) {
|
||||||
|
// Enable ward select
|
||||||
|
wardSelect.disabled = false;
|
||||||
|
|
||||||
|
// Populate wards
|
||||||
|
district.wards.forEach(ward => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = ward.toLowerCase().replace(/\s+/g, '-');
|
||||||
|
option.textContent = ward;
|
||||||
|
wardSelect.appendChild(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wardSelect.disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle form submission
|
||||||
|
function handleSubmit(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Get form values
|
||||||
|
const formData = {
|
||||||
|
fullName: document.getElementById('fullName').value,
|
||||||
|
phone: document.getElementById('phone').value,
|
||||||
|
province: document.getElementById('province').value,
|
||||||
|
provinceName: document.getElementById('province').selectedOptions[0].text,
|
||||||
|
district: document.getElementById('district').value,
|
||||||
|
districtName: document.getElementById('district').selectedOptions[0].text,
|
||||||
|
ward: document.getElementById('ward').value,
|
||||||
|
wardName: document.getElementById('ward').selectedOptions[0].text,
|
||||||
|
addressDetail: document.getElementById('addressDetail').value,
|
||||||
|
isDefault: document.getElementById('isDefault').checked
|
||||||
|
};
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
if (!formData.province || !formData.district || !formData.ward) {
|
||||||
|
showToast('Vui lòng chọn đầy đủ Tỉnh/Thành phố, Quận/Huyện, Phường/Xã', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show loading
|
||||||
|
const saveBtn = document.getElementById('saveBtn');
|
||||||
|
const originalContent = saveBtn.innerHTML;
|
||||||
|
saveBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> <span>Đang lưu...</span>';
|
||||||
|
saveBtn.disabled = true;
|
||||||
|
|
||||||
|
// Simulate API call
|
||||||
|
setTimeout(() => {
|
||||||
|
// Save to localStorage (simulated)
|
||||||
|
let addresses = JSON.parse(localStorage.getItem('savedAddresses') || '[]');
|
||||||
|
|
||||||
|
// If this is default, remove default from others
|
||||||
|
if (formData.isDefault) {
|
||||||
|
addresses = addresses.map(addr => ({...addr, isDefault: false}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new address
|
||||||
|
addresses.push({
|
||||||
|
id: Date.now(),
|
||||||
|
...formData,
|
||||||
|
createdAt: new Date().toISOString()
|
||||||
|
});
|
||||||
|
|
||||||
|
localStorage.setItem('savedAddresses', JSON.stringify(addresses));
|
||||||
|
|
||||||
|
// Reset button
|
||||||
|
saveBtn.innerHTML = originalContent;
|
||||||
|
saveBtn.disabled = false;
|
||||||
|
|
||||||
|
// Show success and redirect
|
||||||
|
showToast('Đã lưu địa chỉ thành công!', 'success');
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = 'addresses.html';
|
||||||
|
}, 1000);
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toast notification
|
||||||
|
function showToast(message, type = 'success') {
|
||||||
|
const colors = {
|
||||||
|
success: '#10b981',
|
||||||
|
error: '#ef4444',
|
||||||
|
warning: '#f59e0b',
|
||||||
|
info: '#3b82f6'
|
||||||
|
};
|
||||||
|
|
||||||
|
const icons = {
|
||||||
|
success: 'fa-check-circle',
|
||||||
|
error: 'fa-exclamation-circle',
|
||||||
|
warning: 'fa-exclamation-triangle',
|
||||||
|
info: 'fa-info-circle'
|
||||||
|
};
|
||||||
|
|
||||||
|
const toast = document.createElement('div');
|
||||||
|
toast.innerHTML = `
|
||||||
|
<i class="fas ${icons[type]}"></i>
|
||||||
|
<span>${message}</span>
|
||||||
|
`;
|
||||||
|
toast.style.cssText = `
|
||||||
|
position: fixed;
|
||||||
|
top: 80px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: ${colors[type]};
|
||||||
|
color: white;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||||
|
z-index: 10000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
animation: slideDown 0.3s ease;
|
||||||
|
max-width: 90%;
|
||||||
|
`;
|
||||||
|
|
||||||
|
document.body.appendChild(toast);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.style.animation = 'slideUp 0.3s ease';
|
||||||
|
setTimeout(() => {
|
||||||
|
document.body.removeChild(toast);
|
||||||
|
}, 300);
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add animation styles
|
||||||
|
const style = document.createElement('style');
|
||||||
|
style.textContent = `
|
||||||
|
@keyframes slideDown {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(-50%, -20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes slideUp {
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(-50%, -20px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
document.head.appendChild(style);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -3,11 +3,69 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Địa chỉ đã lưu - EuroTile Worker</title>
|
<title>Địa chỉ của bạn - EuroTile Worker</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<link rel="stylesheet" href="assets/css/style.css">
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
</head>
|
</head>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.modal-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0,0,0,0.5);
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 500px;
|
||||||
|
animation: slideUp 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideUp {
|
||||||
|
from { transform: translateY(20px); opacity: 0; }
|
||||||
|
to { transform: translateY(0); opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
padding: 20px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
padding: 20px;
|
||||||
|
border-top: 1px solid #e5e7eb;
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: 20px;
|
||||||
|
color: #6b7280;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
@@ -15,12 +73,38 @@
|
|||||||
<a href="account.html" class="back-button">
|
<a href="account.html" class="back-button">
|
||||||
<i class="fas fa-arrow-left"></i>
|
<i class="fas fa-arrow-left"></i>
|
||||||
</a>
|
</a>
|
||||||
<h1 class="header-title">Địa chỉ đã lưu</h1>
|
<h1 class="header-title">Địa chỉ của bạn</h1>
|
||||||
<button class="back-button" onclick="addAddress()">
|
<button class="back-button" onclick="openInfoModal()">
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-info-circle"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Info Modal -->
|
||||||
|
<div id="infoModal" class="modal-overlay" style="display: none;">
|
||||||
|
<div class="modal-content info-modal">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-title" style="font-weight: bold;">Hướng dẫn sử dụng</h3>
|
||||||
|
<button class="modal-close" onclick="closeInfoModal()">
|
||||||
|
<i class="fas fa-times"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Đây là nội dung hướng dẫn sử dụng cho tính năng Đổi quà tặng:</p>
|
||||||
|
<ul class="list-disc ml-6 mt-3">
|
||||||
|
<li>Sử dụng điểm tích lũy của bạn để đổi các phần quà giá trị trong danh mục.</li>
|
||||||
|
<li>Bấm vào một phần quà để xem chi tiết và điều kiện áp dụng.</li>
|
||||||
|
<li>Khi xác nhận đổi quà, bạn có thể chọn "Nhận hàng tại Showroom".</li>
|
||||||
|
<li>Nếu chọn "Nhận hàng tại Showroom", bạn sẽ cần chọn Showroom bạn muốn đến nhận từ danh sách thả xuống.</li>
|
||||||
|
<li>Quà đã đổi sẽ được chuyển vào mục "Quà của tôi" (trong trang Hội viên).</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-primary" onclick="closeInfoModal()">Đóng</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Address List -->
|
<!-- Address List -->
|
||||||
<div class="address-list">
|
<div class="address-list">
|
||||||
@@ -93,7 +177,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Add New Address Button -->
|
<!-- Add New Address Button -->
|
||||||
<button class="btn btn-primary w-100 mt-3" onclick="addAddress()">
|
<button class="btn btn-primary w-100 mt-3" onclick="window.location.href='address-create.html'">
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
Thêm địa chỉ mới
|
Thêm địa chỉ mới
|
||||||
</button>
|
</button>
|
||||||
@@ -133,6 +217,25 @@
|
|||||||
|
|
||||||
alert('Đã đặt làm địa chỉ mặc định');
|
alert('Đã đặt làm địa chỉ mặc định');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openInfoModal() {
|
||||||
|
document.getElementById('infoModal').style.display = 'flex';
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeInfoModal() {
|
||||||
|
document.getElementById('infoModal').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function viewOrderDetail(orderId) {
|
||||||
|
window.location.href = `order-detail.html?id=${orderId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close modal when clicking outside
|
||||||
|
document.addEventListener('click', function(e) {
|
||||||
|
if (e.target.classList.contains('modal-overlay')) {
|
||||||
|
e.target.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -4,12 +4,13 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Đặt hàng - EuroTile Worker</title>
|
<title>Đặt hàng - EuroTile Worker</title>
|
||||||
<!--<script src="https://cdn.tailwindcss.com"></script>-->
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<link rel="stylesheet" href="assets/css/style.css">
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="bg-gray-50">
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
|
<!-- Header -->
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a href="cart.html" class="back-button">
|
<a href="cart.html" class="back-button">
|
||||||
@@ -19,312 +20,383 @@
|
|||||||
<div style="width: 32px;"></div>
|
<div style="width: 32px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container max-w-4xl mx-auto px-4 py-6" style="padding-bottom: 120px;">
|
||||||
<!-- Delivery Info -->
|
|
||||||
<div class="card">
|
<!-- Card 1: Thông tin giao hàng -->
|
||||||
<h3 class="card-title">Thông tin giao hàng</h3>
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-4">
|
||||||
<div class="form-group">
|
<h3 class="text-base font-semibold text-gray-900 mb-4 flex items-center gap-2">
|
||||||
<label class="form-label">Họ và tên người nhận</label>
|
<i class="fas fa-shipping-fast text-blue-600"></i>
|
||||||
<input type="text" class="form-input" value="La Nguyen Quynh">
|
Thông tin giao hàng
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<!-- Address Section -->
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Địa chỉ nhận hàng
|
||||||
|
</label>
|
||||||
|
<a href="addresses.html" class="block border border-gray-200 rounded-lg p-3 hover:border-blue-500 hover:bg-blue-50 transition group">
|
||||||
|
<div class="flex items-start justify-between">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="font-semibold text-gray-900 mb-1">Hoàng Minh Hiệp</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-1">0347302911</div>
|
||||||
|
<div class="text-sm text-gray-600">
|
||||||
|
123 Đường Võ Văn Ngân, Phường Linh Chiểu,
|
||||||
|
Thành phố Thủ Đức, TP.HCM
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label class="form-label">Số điện thoại</label>
|
<i class="fas fa-chevron-right text-gray-400 group-hover:text-blue-600 mt-1"></i>
|
||||||
<input type="tel" class="form-input" value="0983441099">
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--<div class="form-group">
|
<!-- Pickup Date -->
|
||||||
<label class="form-label">Địa chỉ giao hàng</label>
|
<div class="mb-4">
|
||||||
<textarea class="form-input" rows="3">123 Nguyễn Trãi, Quận 1, TP.HCM</textarea>
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
</div>-->
|
Ngày lấy hàng
|
||||||
<div class="form-group">
|
</label>
|
||||||
<label class="form-label">Tỉnh/Thành phố</label>
|
<div class="relative">
|
||||||
<select class="form-input" id="provinceSelect">
|
<i class="fas fa-calendar-alt absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
|
||||||
<option value="">Chọn tỉnh/thành phố</option>
|
<input type="date"
|
||||||
<option value="hcm" selected>TP. Hồ Chí Minh</option>
|
id="pickupDate"
|
||||||
<option value="hanoi">Hà Nội</option>
|
class="w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition">
|
||||||
<option value="danang">Đà Nẵng</option>
|
|
||||||
<option value="binhduong">Bình Dương</option>
|
|
||||||
<option value="dongai">Đồng Nai</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Xã/Phường</label>
|
|
||||||
<select class="form-input" id="wardSelect">
|
|
||||||
<option value="">Chọn xã/phường</option>
|
|
||||||
<option value="ward1" selected>Phường 1</option>
|
|
||||||
<option value="ward2">Phường 2</option>
|
|
||||||
<option value="ward3">Phường 3</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Địa chỉ cụ thể</label>
|
|
||||||
<input type="text" class="form-input" value="123 Nguyễn Trãi" placeholder="Số nhà, tên đường">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Ngày lấy hàng</label>
|
|
||||||
<input type="date" class="form-input" id="pickupDate">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Ghi chú</label>
|
|
||||||
<input type="text" class="form-input" placeholder="Ví dụ: Thời gian yêu cầu giao hàng">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Note -->
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Ghi chú
|
||||||
|
</label>
|
||||||
|
<textarea id="orderNote"
|
||||||
|
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition resize-none"
|
||||||
|
rows="2"
|
||||||
|
placeholder="Ví dụ: Thời gian yêu cầu giao hàng, lưu ý đặc biệt..."></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Invoice Information -->
|
<!-- Card 2: Phát hành hóa đơn -->
|
||||||
<div class="card">
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-4">
|
||||||
<div class="form-group" style="height:24px;">
|
<div class="flex items-center justify-between mb-4">
|
||||||
<label class="checkbox-label" style="font-size:16px;">
|
<h3 class="text-base font-semibold text-gray-900 flex items-center gap-2">
|
||||||
<input type="checkbox" id="invoiceCheckbox" onchange="toggleInvoiceInfo()">
|
<i class="fas fa-file-invoice text-blue-600"></i>
|
||||||
<span class="checkmark"></span>
|
|
||||||
Phát hành hóa đơn
|
Phát hành hóa đơn
|
||||||
|
</h3>
|
||||||
|
<label class="relative inline-flex items-center cursor-pointer">
|
||||||
|
<input type="checkbox"
|
||||||
|
id="invoiceCheckbox"
|
||||||
|
class="sr-only peer"
|
||||||
|
onchange="toggleInvoiceInfo()">
|
||||||
|
<div class="w-11 h-6 bg-gray-300 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="invoiceInfoCard" class="invoice-info-card" style="display: none;">
|
<!-- Invoice Information (Hidden by default) -->
|
||||||
<h4 class="invoice-title">Thông tin hóa đơn</h4>
|
<div id="invoiceInfoCard" class="hidden">
|
||||||
<div class="form-group">
|
<div class="border-t border-gray-200 pt-4">
|
||||||
<label class="form-label">Tên người mua</label>
|
<a href="addresses.html" class="block border border-gray-200 rounded-lg p-3 hover:border-blue-500 hover:bg-blue-50 transition group">
|
||||||
<input type="text" class="form-input" id="buyerName" placeholder="Tên công ty/cá nhân">
|
<div class="flex items-start justify-between">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="font-semibold text-gray-900 mb-1">Công ty TNHH Xây dựng Minh Long</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-0.5">Mã số thuế: 0134000687</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-0.5">Số điện thoại: 0339797979</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-0.5">Email: minhlong.org@gmail.com</div>
|
||||||
|
<div class="text-sm text-gray-600">
|
||||||
|
Địa chỉ: 11 Đường Hoàng Hữu Nam, Phường Linh Chiểu,
|
||||||
|
Thành phố Thủ Đức, TP.HCM
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Mã số thuế</label>
|
|
||||||
<input type="text" class="form-input" id="taxCode" placeholder="Mã số thuế">
|
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="form-group">
|
<i class="fas fa-chevron-right text-gray-400 group-hover:text-blue-600 mt-1"></i>
|
||||||
<label class="form-label">Tên công ty</label>
|
|
||||||
<input type="text" class="form-input" id="companyName" placeholder="Tên công ty/tổ chức">
|
|
||||||
</div>-->
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Địa chỉ</label>
|
|
||||||
<input type="text" class="form-input" id="companyAddress" placeholder="Địa chỉ">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</a>
|
||||||
<label class="form-label">Email nhận hóa đơn</label>
|
|
||||||
<input type="email" class="form-input" id="invoiceEmail" placeholder="email@company.com">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Số điện thoại</label>
|
|
||||||
<input type="tel" class="form-input" id="invoicePhone" placeholder="Số điện thoại liên hệ">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Card 3: Phương thức thanh toán -->
|
||||||
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-4" id="paymentMethodCard">
|
||||||
|
<h3 class="text-base font-semibold text-gray-900 mb-4 flex items-center gap-2">
|
||||||
|
<i class="fas fa-credit-card text-blue-600"></i>
|
||||||
|
Phương thức thanh toán
|
||||||
|
</h3>
|
||||||
|
|
||||||
<!-- Payment Method -->
|
<label class="flex items-center p-3 border border-gray-200 rounded-lg mb-3 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition">
|
||||||
<div class="card">
|
<input type="radio" name="payment" value="full" checked class="w-4 h-4 text-blue-600 focus:ring-blue-500">
|
||||||
<h3 class="card-title">Phương thức thanh toán</h3>
|
<div class="ml-3 flex-1">
|
||||||
<label class="list-item" style="cursor: pointer;">
|
<div class="flex items-center gap-2">
|
||||||
<input type="radio" name="payment" checked style="margin-right: 12px;">
|
<i class="fas fa-money-check-alt text-gray-600"></i>
|
||||||
<div class="list-item-icon">
|
<div class="font-medium text-gray-900">Thanh toán hoàn toàn</div>
|
||||||
<i class="fas fa-money-check-alt"></i>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="list-item-content">
|
<div class="text-sm text-gray-500 mt-0.5">Thanh toán qua tài khoản ngân hàng</div>
|
||||||
<div class="list-item-title">Thanh toán hoàn toàn</div>
|
|
||||||
<div class="list-item-subtitle">Thanh toán qua tài khoản ngân hàng</div>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<label class="list-item" style="cursor: pointer;">
|
|
||||||
<input type="radio" name="payment" style="margin-right: 12px;">
|
<label class="flex items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition">
|
||||||
<div class="list-item-icon">
|
<input type="radio" name="payment" value="partial" class="w-4 h-4 text-blue-600 focus:ring-blue-500">
|
||||||
<i class="fas fa-hand-holding-usd"></i>
|
<div class="ml-3 flex-1">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<i class="fas fa-hand-holding-usd text-gray-600"></i>
|
||||||
|
<div class="font-medium text-gray-900">Thanh toán một phần</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="list-item-content">
|
<div class="text-sm text-gray-500 mt-0.5">Trả trước (≥20%), còn lại thanh toán trong vòng 30 ngày</div>
|
||||||
<div class="list-item-title">Thanh toán một phần</div>
|
|
||||||
<div class="list-item-subtitle">Trả trước(≥20%), còn lại thanh toán trong vòng 30 ngày</div>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Discount Code -->
|
<!-- Card 4: Mã giảm giá -->
|
||||||
<div class="card">
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-4">
|
||||||
<div class="form-group" style="margin-bottom: 8px;">
|
<h3 class="text-base font-semibold text-gray-900 mb-3 flex items-center gap-2">
|
||||||
<label class="form-label">Mã giảm giá</label>
|
<i class="fas fa-ticket-alt text-blue-600"></i>
|
||||||
<div style="display: flex; gap: 8px;">
|
Mã giảm giá
|
||||||
<input type="text" class="form-input" style="flex: 1;" placeholder="Nhập mã giảm giá">
|
</h3>
|
||||||
<button class="btn btn-primary">Áp dụng</button>
|
|
||||||
</div>
|
<div class="flex gap-2 mb-3">
|
||||||
</div>
|
<input type="text"
|
||||||
<p class="text-small text-success">
|
class="flex-1 px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition"
|
||||||
<i class="fas fa-check-circle"></i> Bạn được giảm 15% (hạng Diamond)
|
placeholder="Nhập mã giảm giá">
|
||||||
</p>
|
<button class="px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-lg transition">
|
||||||
|
Áp dụng
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Order Summary -->
|
<div class="flex items-center gap-2 p-3 bg-green-50 border border-green-200 rounded-lg text-green-800 text-sm">
|
||||||
<div class="card">
|
<i class="fas fa-check-circle"></i>
|
||||||
<h3 class="card-title">Tóm tắt đơn hàng</h3>
|
<span>Bạn được giảm 15% (hạng Diamond)</span>
|
||||||
<div class="d-flex justify-between mb-2">
|
|
||||||
<div>
|
|
||||||
<div>Gạch men cao cấp</div>
|
|
||||||
<div class="text-small text-muted">10 m² (28 viên / 10.08 m²)</div>
|
|
||||||
</div>
|
|
||||||
<span>4.536.000đ</span>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex justify-between mb-2">
|
|
||||||
<div>
|
|
||||||
<div>Gạch granite nhập khẩu 1200x1200</div>
|
|
||||||
<div class="text-small text-muted">(11 viên / 15.84 m²)</div>
|
|
||||||
</div>
|
|
||||||
<span>10.771.200đ</span>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex justify-between mb-2">
|
|
||||||
<div>
|
|
||||||
<div>Gạch mosaic trang trí</div>
|
|
||||||
<div class="text-small text-muted">(5 viên / 5.625 m²)</div>
|
|
||||||
</div>
|
|
||||||
<span>1.800.000đ</span>
|
|
||||||
</div>
|
|
||||||
<hr style="margin: 12px 0;">
|
|
||||||
<div class="d-flex justify-between mb-2">
|
|
||||||
<span>Tạm tính</span>
|
|
||||||
<span>17.107.200đ</span>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex justify-between mb-2">
|
|
||||||
<span>Giảm giá Diamond</span>
|
|
||||||
<span class="text-success">-2.566.000đ</span>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex justify-between mb-2">
|
|
||||||
<span>Phí vận chuyển</span>
|
|
||||||
<span>Miễn phí</span>
|
|
||||||
</div>
|
|
||||||
<hr style="margin: 12px 0;">
|
|
||||||
<div class="d-flex justify-between">
|
|
||||||
<span class="text-bold" style="font-size: 16px;">Tổng thanh toán</span>
|
|
||||||
<span class="text-bold text-primary" style="font-size: 18px;">14.541.120đ</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Card 5: Tóm tắt đơn hàng -->
|
||||||
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-4">
|
||||||
|
<h3 class="text-base font-semibold text-gray-900 mb-4 flex items-center gap-2">
|
||||||
|
<i class="fas fa-shopping-cart text-blue-600"></i>
|
||||||
|
Tóm tắt đơn hàng
|
||||||
|
</h3>
|
||||||
|
|
||||||
<!-- Price Negotiation -->
|
<!-- Product Items -->
|
||||||
<div class="negotiation-checkbox">
|
<div class="space-y-3 mb-4">
|
||||||
<label class="checkbox-label">
|
<div class="flex justify-between items-start pb-3 border-b border-gray-100">
|
||||||
<input type="checkbox" id="negotiationCheckbox" onchange="toggleNegotiation()">
|
<div class="flex-1">
|
||||||
<span>Yêu cầu đàm phán giá</span>
|
<div class="font-medium text-gray-900">Gạch men cao cấp 60x60</div>
|
||||||
</label>
|
<div class="text-sm text-gray-500 mt-0.5">10 m² (28 viên / 10.08 m²)</div>
|
||||||
<div class="negotiation-info">
|
</div>
|
||||||
|
<div class="font-semibold text-gray-900">4.536.000đ</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-between items-start pb-3 border-b border-gray-100">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="font-medium text-gray-900">Gạch granite nhập khẩu 1200x1200</div>
|
||||||
|
<div class="text-sm text-gray-500 mt-0.5">15 m² (11 viên / 15.84 m²)</div>
|
||||||
|
</div>
|
||||||
|
<div class="font-semibold text-gray-900">10.771.200đ</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-between items-start pb-3 border-b border-gray-100">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="font-medium text-gray-900">Gạch mosaic trang trí 750x1500</div>
|
||||||
|
<div class="text-sm text-gray-500 mt-0.5">5 m² (5 viên / 5.625 m²)</div>
|
||||||
|
</div>
|
||||||
|
<div class="font-semibold text-gray-900">1.800.000đ</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Summary -->
|
||||||
|
<div class="space-y-2 pt-3 border-t border-gray-200">
|
||||||
|
<div class="flex justify-between text-sm">
|
||||||
|
<span class="text-gray-600">Tạm tính</span>
|
||||||
|
<span class="text-gray-900">17.107.200đ</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between text-sm">
|
||||||
|
<span class="text-gray-600">Giảm giá Diamond</span>
|
||||||
|
<span class="text-green-600 font-medium">-2.566.000đ</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between text-sm">
|
||||||
|
<span class="text-gray-600">Phí vận chuyển</span>
|
||||||
|
<span class="text-gray-900">Miễn phí</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Total -->
|
||||||
|
<div class="flex justify-between items-center pt-4 mt-4 border-t-2 border-gray-300">
|
||||||
|
<span class="text-lg font-semibold text-gray-900">Tổng thanh toán</span>
|
||||||
|
<span class="text-2xl font-bold text-blue-600">14.541.120đ</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Card 6: Tùy chọn đàm phán giá -->
|
||||||
|
<div class="bg-yellow-50 border-2 border-yellow-300 rounded-lg p-4 mb-4">
|
||||||
|
<label class="flex items-start cursor-pointer">
|
||||||
|
<input type="checkbox"
|
||||||
|
id="negotiationCheckbox"
|
||||||
|
class="mt-1 w-5 h-5 text-yellow-600 rounded focus:ring-yellow-500"
|
||||||
|
onchange="toggleNegotiation()">
|
||||||
|
<div class="ml-3 flex-1">
|
||||||
|
<div class="font-semibold text-yellow-900 mb-1">Yêu cầu đàm phán giá</div>
|
||||||
|
<div class="text-sm text-yellow-800">
|
||||||
Chọn tùy chọn này nếu bạn muốn đàm phán giá với nhân viên bán hàng trước khi thanh toán.
|
Chọn tùy chọn này nếu bạn muốn đàm phán giá với nhân viên bán hàng trước khi thanh toán.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Terms -->
|
||||||
<!-- Place Order Button -->
|
<div class="text-center text-sm text-gray-600 mb-4">
|
||||||
<div style="margin-bottom: 24px;">
|
|
||||||
<a href="payment-qr.html" class="btn btn-primary btn-block btn-submit">
|
|
||||||
<i class="fas fa-check-circle"></i> Hoàn tất đặt hàng
|
|
||||||
</a>
|
|
||||||
<p class="text-center text-small text-muted mt-2">
|
|
||||||
Bằng cách đặt hàng, bạn đồng ý với
|
Bằng cách đặt hàng, bạn đồng ý với
|
||||||
<a href="#" class="text-primary">Điều khoản & Điều kiện</a>
|
<a href="#" class="text-blue-600 hover:underline">Điều khoản & Điều kiện</a>
|
||||||
</p>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Sticky Footer -->
|
||||||
|
<div class="fixed bottom-0 left-0 right-0 bg-white border-t-2 border-gray-200 shadow-lg z-50">
|
||||||
|
<div class="max-w-4xl mx-auto px-4 py-4">
|
||||||
|
<button id="submitBtn"
|
||||||
|
onclick="handleSubmit()"
|
||||||
|
class="w-full bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white font-bold py-4 px-6 rounded-lg shadow-lg transition-all duration-200 hover:shadow-xl hover:-translate-y-0.5 flex items-center justify-center gap-2">
|
||||||
|
<i class="fas fa-check-circle text-xl"></i>
|
||||||
|
<span id="submitBtnText">Hoàn tất đặt hàng</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
|
||||||
.invoice-info-card {
|
|
||||||
margin-top: 16px;
|
|
||||||
padding: 16px;
|
|
||||||
background: #f8f9fa;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid #e5e7eb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.invoice-title {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
color: #374151;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-label {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-label input[type="checkbox"] {
|
|
||||||
margin-right: 8px;
|
|
||||||
transform: scale(1.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.negotiation-checkbox {
|
|
||||||
margin: 16px 0;
|
|
||||||
padding: 16px;
|
|
||||||
background: #fef3c7;
|
|
||||||
border: 1px solid #f59e0b;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.negotiation-info {
|
|
||||||
font-size: 13px;
|
|
||||||
color: #92400e;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.payment-method-section.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Set default pickup date to tomorrow
|
// Toggle invoice info
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
const tomorrow = new Date();
|
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
||||||
const dateString = tomorrow.toISOString().split('T')[0];
|
|
||||||
document.getElementById('pickupDate').value = dateString;
|
|
||||||
});
|
|
||||||
|
|
||||||
function toggleInvoiceInfo() {
|
function toggleInvoiceInfo() {
|
||||||
const checkbox = document.getElementById('invoiceCheckbox');
|
const checkbox = document.getElementById('invoiceCheckbox');
|
||||||
const invoiceCard = document.getElementById('invoiceInfoCard');
|
const invoiceCard = document.getElementById('invoiceInfoCard');
|
||||||
|
|
||||||
if (checkbox.checked) {
|
if (checkbox.checked) {
|
||||||
invoiceCard.style.display = 'block';
|
invoiceCard.classList.remove('hidden');
|
||||||
|
invoiceCard.classList.add('animate-slideDown');
|
||||||
} else {
|
} else {
|
||||||
invoiceCard.style.display = 'none';
|
invoiceCard.classList.add('hidden');
|
||||||
|
invoiceCard.classList.remove('animate-slideDown');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Toggle negotiation
|
||||||
function toggleNegotiation() {
|
function toggleNegotiation() {
|
||||||
const checkbox = document.getElementById('negotiationCheckbox');
|
const checkbox = document.getElementById('negotiationCheckbox');
|
||||||
const paymentSection = document.querySelector('.card:has(.list-item)');
|
const paymentMethodCard = document.getElementById('paymentMethodCard');
|
||||||
// Payment method section
|
const submitBtnText = document.getElementById('submitBtnText');
|
||||||
const submitBtn = document.querySelector('.btn-submit');
|
|
||||||
|
|
||||||
if (checkbox.checked) {
|
if (checkbox.checked) {
|
||||||
paymentSection.classList.add('hidden');
|
paymentMethodCard.classList.add('opacity-50', 'pointer-events-none');
|
||||||
submitBtn.innerHTML = '<i class="fas fa-handshake"></i> Gửi Yêu cầu & Đàm phán';
|
submitBtnText.textContent = 'Gửi Yêu cầu & Đàm phán';
|
||||||
} else {
|
} else {
|
||||||
paymentSection.classList.remove('hidden');
|
paymentMethodCard.classList.remove('opacity-50', 'pointer-events-none');
|
||||||
submitBtn.innerHTML = '<i class="fas fa-check-circle"></i> Hoàn tất đặt hàng';
|
submitBtnText.textContent = 'Hoàn tất đặt hàng';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleNegotiation() {
|
// Handle submit
|
||||||
const checkbox = document.getElementById('negotiationCheckbox');
|
function handleSubmit() {
|
||||||
const paymentMethods = document.querySelectorAll('.card')[2]; // Payment method section is 3rd card
|
const negotiationCheckbox = document.getElementById('negotiationCheckbox');
|
||||||
const submitBtn = document.querySelector('.btn-submit');
|
|
||||||
|
|
||||||
if (checkbox.checked) {
|
if (negotiationCheckbox.checked) {
|
||||||
paymentMethods.style.display = 'none';
|
// Navigate to negotiation page
|
||||||
submitBtn.innerHTML = '<i class="fas fa-handshake"></i> Gửi Yêu cầu & Đàm phán';
|
showToast('Đang gửi yêu cầu đàm phán...', 'info');
|
||||||
submitBtn.href = '#'; // Don't redirect to order success
|
setTimeout(() => {
|
||||||
submitBtn.onclick = function(e) {
|
window.location.href = 'order-success.html?type=negotiation';
|
||||||
e.preventDefault();
|
}, 1000);
|
||||||
alert('Yêu cầu đàm phán đã được gửi! Nhân viên bán hàng sẽ liên hệ với bạn sớm.');
|
} else {
|
||||||
window.location.href = 'order-dam-phan.html';
|
// Navigate to payment page
|
||||||
|
showToast('Đang xử lý đơn hàng...', 'info');
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = 'payment-qr.html';
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set minimum date for pickup
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const pickupDateInput = document.getElementById('pickupDate');
|
||||||
|
const today = new Date();
|
||||||
|
const tomorrow = new Date(today);
|
||||||
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||||
|
|
||||||
|
const minDate = tomorrow.toISOString().split('T')[0];
|
||||||
|
pickupDateInput.min = minDate;
|
||||||
|
pickupDateInput.value = minDate;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Toast notification
|
||||||
|
function showToast(message, type = 'success') {
|
||||||
|
const colors = {
|
||||||
|
success: '#10b981',
|
||||||
|
error: '#ef4444',
|
||||||
|
warning: '#f59e0b',
|
||||||
|
info: '#3b82f6'
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
paymentMethods.style.display = 'block';
|
|
||||||
submitBtn.innerHTML = '<i class="fas fa-check-circle"></i> Hoàn tất đặt hàng';
|
|
||||||
submitBtn.href = 'payment-qr.html';
|
|
||||||
submitBtn.onclick = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
const icons = {
|
||||||
|
success: 'fa-check-circle',
|
||||||
|
error: 'fa-exclamation-circle',
|
||||||
|
warning: 'fa-exclamation-triangle',
|
||||||
|
info: 'fa-info-circle'
|
||||||
|
};
|
||||||
|
|
||||||
|
const toast = document.createElement('div');
|
||||||
|
toast.innerHTML = `
|
||||||
|
<i class="fas ${icons[type]}"></i>
|
||||||
|
<span>${message}</span>
|
||||||
|
`;
|
||||||
|
toast.style.cssText = `
|
||||||
|
position: fixed;
|
||||||
|
top: 80px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: ${colors[type]};
|
||||||
|
color: white;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||||
|
z-index: 10000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
animation: slideDown 0.3s ease;
|
||||||
|
max-width: 90%;
|
||||||
|
`;
|
||||||
|
|
||||||
|
document.body.appendChild(toast);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.style.animation = 'slideUp 0.3s ease';
|
||||||
|
setTimeout(() => {
|
||||||
|
document.body.removeChild(toast);
|
||||||
|
}, 300);
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Animation styles
|
||||||
|
const style = document.createElement('style');
|
||||||
|
style.textContent = `
|
||||||
|
@keyframes slideDown {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(-50%, -20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes slideUp {
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(-50%, -20px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.animate-slideDown {
|
||||||
|
animation: slideDown 0.3s ease;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
document.head.appendChild(style);
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -49,6 +49,8 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
background: #d1fae5;
|
||||||
|
color: #065f46;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-pending {
|
.status-pending {
|
||||||
@@ -66,32 +68,93 @@
|
|||||||
color: #065f46;
|
color: #065f46;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-grid {
|
/* Description List Styles */
|
||||||
display: grid;
|
.description-list {
|
||||||
grid-template-columns: 1fr 1fr;
|
display: flex;
|
||||||
gap: 16px;
|
flex-direction: column;
|
||||||
margin-bottom: 24px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-item {
|
.description-item {
|
||||||
text-align: center;
|
display: flex;
|
||||||
padding: 16px 12px;
|
border-bottom: 1px solid #f3f4f6;
|
||||||
background: #f8fafc;
|
padding-bottom: 12px;
|
||||||
border-radius: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-label {
|
.description-item:last-child {
|
||||||
font-size: 12px;
|
border-bottom: none;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description-label {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 120px;
|
||||||
|
font-size: 13px;
|
||||||
color: #6b7280;
|
color: #6b7280;
|
||||||
font-weight: 600;
|
font-weight: 500;
|
||||||
text-transform: uppercase;
|
padding-top: 2px;
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-value {
|
.description-value {
|
||||||
font-size: 16px;
|
flex: 1;
|
||||||
font-weight: 700;
|
font-size: 15px;
|
||||||
color: #1f2937;
|
color: #1f2937;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Floor Plan Styles */
|
||||||
|
.floor-plan-container {
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.floor-plan-thumbnail {
|
||||||
|
position: relative;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.floor-plan-thumbnail:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.floor-plan-image {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.floor-plan-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 91, 154, 0.85);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.floor-plan-thumbnail:hover .floor-plan-overlay {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.floor-plan-overlay i {
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.floor-plan-overlay span {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-section {
|
.detail-section {
|
||||||
@@ -302,17 +365,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.info-grid {
|
.description-item {
|
||||||
grid-template-columns: 1fr;
|
flex-direction: column;
|
||||||
gap: 12px;
|
gap: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-item {
|
.description-label {
|
||||||
display: flex;
|
width: auto;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
text-align: left;
|
|
||||||
padding: 12px 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-buttons {
|
.action-buttons {
|
||||||
@@ -343,26 +402,30 @@
|
|||||||
<span class="status-badge" id="status-badge">Hoàn thành</span>
|
<span class="status-badge" id="status-badge">Hoàn thành</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Project Info Grid -->
|
<!-- Project Info - Simple Description List -->
|
||||||
<div class="info-grid">
|
<div class="detail-section" style="margin-bottom: 0;">
|
||||||
<div class="info-item">
|
<dl class="description-list">
|
||||||
<div class="info-label">Diện tích</div>
|
|
||||||
<div class="info-value" id="project-area">120m²</div>
|
|
||||||
</div>
|
|
||||||
<div class="info-item">
|
|
||||||
<div class="info-label">Phong cách</div>
|
|
||||||
<div class="info-value" id="project-style">Hiện đại</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="info-grid">
|
<div class="detail-section">
|
||||||
<div class="info-item">
|
<h3 class="section-title">
|
||||||
<div class="info-label">Ngân sách</div>
|
<i class="fas fa-info-circle" style="color: #2563eb;"></i>
|
||||||
<div class="info-value" id="project-budget">300-500 triệu</div>
|
Thông tin thiết kế
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<dl class="description-list">
|
||||||
|
<div class="description-item">
|
||||||
|
<dt class="description-label">Tên công trình:</dt>
|
||||||
|
<dd class="description-value" id="project-name">Thiết kế nhà phố 3 tầng - Anh Minh (Quận 7)</dd>
|
||||||
|
</div>
|
||||||
|
<div class="description-item">
|
||||||
|
<dt class="description-label">Mô tả chi tiết:</dt>
|
||||||
|
<dd class="description-value" id="project-notes">
|
||||||
|
Diện tích: 85 m² <br>
|
||||||
|
Khu vực: Hồ Chí Minh <br>
|
||||||
|
Phong cách mong muốn: Hiện đại <br>
|
||||||
|
Ngân sách dự kiến: Trao đổi trực tiếp <br>
|
||||||
|
Yêu cầu chi tiết: Thiết kế với 4 phòng ngủ, 3 phòng tắm, phòng khách rộng rãi và khu bếp mở. Ưu tiên sử dụng gạch men màu sáng để tạo cảm giác thoáng đãng.
|
||||||
</div>
|
</div>
|
||||||
<div class="info-item">
|
|
||||||
<div class="info-label">Trạng thái</div>
|
|
||||||
<div class="info-value" id="project-status">Đã hoàn thành</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -379,40 +442,8 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Project Details -->
|
<!-- Floor Plan Image -->
|
||||||
<div class="detail-card">
|
<div class="detail-card">
|
||||||
<div class="detail-section">
|
|
||||||
<h3 class="section-title">
|
|
||||||
<i class="fas fa-info-circle" style="color: #2563eb;"></i>
|
|
||||||
Thông tin dự án
|
|
||||||
</h3>
|
|
||||||
<div class="section-content">
|
|
||||||
<p><strong>Tên dự án:</strong> <span id="project-name">Thiết kế nhà phố 3 tầng - Anh Minh (Quận 7)</span></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="detail-section">
|
|
||||||
<h3 class="section-title">
|
|
||||||
<i class="fas fa-edit" style="color: #2563eb;"></i>
|
|
||||||
Mô tả yêu cầu
|
|
||||||
</h3>
|
|
||||||
<div class="section-content" id="project-description">
|
|
||||||
Thiết kế nhà phố 3 tầng phong cách hiện đại với 4 phòng ngủ, 3 phòng tắm, phòng khách rộng rãi và khu bếp mở.
|
|
||||||
Ưu tiên sử dụng gạch men màu sáng để tạo cảm giác thoáng đãng. Tầng 1: garage, phòng khách, bếp.
|
|
||||||
Tầng 2: 2 phòng ngủ, 2 phòng tắm. Tầng 3: phòng ngủ master, phòng làm việc, sân thượng.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="detail-section">
|
|
||||||
<h3 class="section-title">
|
|
||||||
<i class="fas fa-phone" style="color: #2563eb;"></i>
|
|
||||||
Thông tin liên hệ
|
|
||||||
</h3>
|
|
||||||
<div class="section-content" id="contact-info">
|
|
||||||
SĐT: 0901234567 | Email: minh.nguyen@email.com
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="detail-section">
|
<div class="detail-section">
|
||||||
<h3 class="section-title">
|
<h3 class="section-title">
|
||||||
<i class="fas fa-paperclip" style="color: #2563eb;"></i>
|
<i class="fas fa-paperclip" style="color: #2563eb;"></i>
|
||||||
@@ -440,7 +471,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Status Timeline -->
|
<!-- Status Timeline -->
|
||||||
<div class="detail-card">
|
<!--<div class="detail-card">
|
||||||
<h3 class="section-title">
|
<h3 class="section-title">
|
||||||
<i class="fas fa-history" style="color: #2563eb;"></i>
|
<i class="fas fa-history" style="color: #2563eb;"></i>
|
||||||
Lịch sử trạng thái
|
Lịch sử trạng thái
|
||||||
@@ -491,14 +522,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
<!-- Action Buttons -->
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<button class="btn btn-secondary" onclick="editRequest()">
|
<!--<button class="btn btn-secondary" onclick="editRequest()">
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
Chỉnh sửa
|
Chỉnh sửa
|
||||||
</button>
|
</button>-->
|
||||||
<button class="btn btn-primary" onclick="contactSupport()">
|
<button class="btn btn-primary" onclick="contactSupport()">
|
||||||
<i class="fas fa-comments"></i>
|
<i class="fas fa-comments"></i>
|
||||||
Liên hệ
|
Liên hệ
|
||||||
@@ -536,28 +567,26 @@
|
|||||||
const requestDatabase = {
|
const requestDatabase = {
|
||||||
'YC001': {
|
'YC001': {
|
||||||
id: 'YC001',
|
id: 'YC001',
|
||||||
|
status: 'completed',
|
||||||
|
statusText: 'Đã hoàn thành',
|
||||||
name: 'Thiết kế nhà phố 3 tầng - Anh Minh (Quận 7)',
|
name: 'Thiết kế nhà phố 3 tầng - Anh Minh (Quận 7)',
|
||||||
area: '120m²',
|
area: '120m²',
|
||||||
style: 'Hiện đại',
|
style: 'Hiện đại',
|
||||||
budget: '300-500 triệu',
|
budget: '300-500 triệu',
|
||||||
status: 'completed',
|
notes: 'Ưu tiên sử dụng gạch men màu sáng để tạo cảm giác thoáng đãng.',
|
||||||
statusText: 'Đã hoàn thành',
|
|
||||||
description: 'Thiết kế nhà phố 3 tầng phong cách hiện đại với 4 phòng ngủ, 3 phòng tắm, phòng khách rộng rãi và khu bếp mở. Ưu tiên sử dụng gạch men màu sáng để tạo cảm giác thoáng đãng. Tầng 1: garage, phòng khách, bếp. Tầng 2: 2 phòng ngủ, 2 phòng tắm. Tầng 3: phòng ngủ master, phòng làm việc, sân thượng.',
|
|
||||||
contact: 'SĐT: 0901234567 | Email: minh.nguyen@email.com',
|
|
||||||
createdDate: '20/10/2024',
|
createdDate: '20/10/2024',
|
||||||
files: ['mat-bang-hien-tai.jpg', 'ban-ve-kien-truc.dwg'],
|
files: ['mat-bang-hien-tai.jpg', 'ban-ve-kien-truc.dwg'],
|
||||||
designLink: 'https://example.com/3d-design/YC001'
|
designLink: 'https://example.com/3d-design/YC001'
|
||||||
},
|
},
|
||||||
'YC002': {
|
'YC002': {
|
||||||
id: 'YC002',
|
id: 'YC002',
|
||||||
|
status: 'designing',
|
||||||
|
statusText: 'Đang thiết kế',
|
||||||
name: 'Cải tạo căn hộ chung cư - Chị Lan (Quận 2)',
|
name: 'Cải tạo căn hộ chung cư - Chị Lan (Quận 2)',
|
||||||
area: '85m²',
|
area: '85m²',
|
||||||
style: 'Scandinavian',
|
style: 'Scandinavian',
|
||||||
budget: '100-300 triệu',
|
budget: '100-300 triệu',
|
||||||
status: 'designing',
|
notes: 'Tối ưu không gian lưu trữ, sử dụng gạch men màu sáng và gỗ tự nhiên.',
|
||||||
statusText: 'Đang thiết kế',
|
|
||||||
description: 'Cải tạo căn hộ chung cư 3PN theo phong cách Scandinavian. Tối ưu không gian lưu trữ, sử dụng gạch men màu sáng và gỗ tự nhiên.',
|
|
||||||
contact: 'SĐT: 0987654321',
|
|
||||||
createdDate: '25/10/2024',
|
createdDate: '25/10/2024',
|
||||||
files: ['hinh-anh-hien-trang.jpg'],
|
files: ['hinh-anh-hien-trang.jpg'],
|
||||||
designLink: null
|
designLink: null
|
||||||
@@ -565,13 +594,12 @@
|
|||||||
'YC003': {
|
'YC003': {
|
||||||
id: 'YC003',
|
id: 'YC003',
|
||||||
name: 'Thiết kế biệt thự 2 tầng - Anh Đức (Bình Dương)',
|
name: 'Thiết kế biệt thự 2 tầng - Anh Đức (Bình Dương)',
|
||||||
|
status: 'pending',
|
||||||
|
statusText: 'Chờ tiếp nhận',
|
||||||
area: '200m²',
|
area: '200m²',
|
||||||
style: 'Luxury',
|
style: 'Luxury',
|
||||||
budget: 'Trên 1 tỷ',
|
budget: 'Trên 1 tỷ',
|
||||||
status: 'pending',
|
notes: 'Thiết kế biệt thự có hồ bơi và sân vườn, 5 phòng ngủ, garage 2 xe.',
|
||||||
statusText: 'Chờ tiếp nhận',
|
|
||||||
description: 'Thiết kế biệt thự 2 tầng phong cách luxury với hồ bơi và sân vườn. 5 phòng ngủ, 4 phòng tắm, phòng giải trí và garage 2 xe.',
|
|
||||||
contact: 'SĐT: 0923456789 | Email: duc.le@gmail.com',
|
|
||||||
createdDate: '28/10/2024',
|
createdDate: '28/10/2024',
|
||||||
files: ['mat-bang-dat.pdf', 'y-tuong-thiet-ke.jpg'],
|
files: ['mat-bang-dat.pdf', 'y-tuong-thiet-ke.jpg'],
|
||||||
designLink: null
|
designLink: null
|
||||||
@@ -615,10 +643,8 @@
|
|||||||
document.getElementById('project-name').textContent = request.name;
|
document.getElementById('project-name').textContent = request.name;
|
||||||
document.getElementById('project-area').textContent = request.area;
|
document.getElementById('project-area').textContent = request.area;
|
||||||
document.getElementById('project-style').textContent = request.style;
|
document.getElementById('project-style').textContent = request.style;
|
||||||
document.getElementById('project-budget').textContent = request.budget;
|
document.getElementById('project-budget').textContent = request.budget + ' VNĐ';
|
||||||
document.getElementById('project-status').textContent = request.statusText;
|
document.getElementById('project-notes').textContent = request.notes || 'Không có ghi chú đặc biệt';
|
||||||
document.getElementById('project-description').textContent = request.description;
|
|
||||||
document.getElementById('contact-info').textContent = request.contact;
|
|
||||||
|
|
||||||
// Update status badge
|
// Update status badge
|
||||||
const statusBadge = document.getElementById('status-badge');
|
const statusBadge = document.getElementById('status-badge');
|
||||||
@@ -633,8 +659,7 @@
|
|||||||
completionHighlight.style.display = 'none';
|
completionHighlight.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update files list
|
// Floor plan image - removed files list
|
||||||
updateFilesList(request.files);
|
|
||||||
|
|
||||||
// Update page title
|
// Update page title
|
||||||
document.title = `${request.id} - Chi tiết Yêu cầu Thiết kế`;
|
document.title = `${request.id} - Chi tiết Yêu cầu Thiết kế`;
|
||||||
@@ -643,37 +668,12 @@
|
|||||||
window.currentDesignLink = request.designLink;
|
window.currentDesignLink = request.designLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFilesList(files) {
|
function viewFloorPlan() {
|
||||||
const filesList = document.getElementById('files-list');
|
// In real app, open lightbox or full-screen image viewer
|
||||||
|
const img = document.querySelector('.floor-plan-image');
|
||||||
if (!files || files.length === 0) {
|
if (img && img.src) {
|
||||||
filesList.innerHTML = '<p style="color: #6b7280; font-style: italic;">Không có tài liệu đính kèm</p>';
|
window.open(img.src, '_blank');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filesList.innerHTML = files.map(fileName => {
|
|
||||||
const fileIcon = getFileIcon(fileName);
|
|
||||||
return `
|
|
||||||
<div class="file-item">
|
|
||||||
<div class="file-icon">
|
|
||||||
<i class="${fileIcon}"></i>
|
|
||||||
</div>
|
|
||||||
<div class="file-info">
|
|
||||||
<div class="file-name">${fileName}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}).join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileIcon(fileName) {
|
|
||||||
const extension = fileName.toLowerCase().split('.').pop();
|
|
||||||
|
|
||||||
if (['jpg', 'jpeg', 'png', 'gif'].includes(extension)) return 'fas fa-image';
|
|
||||||
if (extension === 'pdf') return 'fas fa-file-pdf';
|
|
||||||
if (extension === 'dwg') return 'fas fa-drafting-compass';
|
|
||||||
if (['doc', 'docx'].includes(extension)) return 'fas fa-file-word';
|
|
||||||
return 'fas fa-file';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewDesign3D() {
|
function viewDesign3D() {
|
||||||
|
|||||||
632
html/invoice-detail.html
Normal file
632
html/invoice-detail.html
Normal file
@@ -0,0 +1,632 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="vi">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Chi tiết Hóa đơn - EuroTile Worker</title>
|
||||||
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
|
<style>
|
||||||
|
.invoice-container {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: #f8fafc;
|
||||||
|
min-height: 100vh;
|
||||||
|
padding-bottom: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-content {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Invoice Header */
|
||||||
|
.invoice-header-section {
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
border-bottom: 2px solid #e5e7eb;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-logo {
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
|
||||||
|
border-radius: 12px;
|
||||||
|
margin: 0 auto 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: white;
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-number {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #2563eb;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-meta {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-meta-item {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-meta-label {
|
||||||
|
color: #6b7280;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-meta-value {
|
||||||
|
color: #1f2937;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Company Info */
|
||||||
|
.company-info-section {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 24px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-info-block h3 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-info-block p {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #6b7280;
|
||||||
|
line-height: 1.6;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-info-block p strong {
|
||||||
|
color: #1f2937;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Products Table */
|
||||||
|
.products-section h3 {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-table thead {
|
||||||
|
background: #f8fafc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-table th {
|
||||||
|
padding: 12px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #6b7280;
|
||||||
|
border-bottom: 2px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-table th:last-child,
|
||||||
|
.products-table td:last-child {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-table td {
|
||||||
|
padding: 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #1f2937;
|
||||||
|
border-bottom: 1px solid #f3f4f6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-table tbody tr:hover {
|
||||||
|
background: #f8fafc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-name {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-sku {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Summary */
|
||||||
|
.invoice-summary {
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 16px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 8px 0;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row.total {
|
||||||
|
border-top: 2px solid #e5e7eb;
|
||||||
|
padding-top: 16px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-label {
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-value {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row.total .summary-label,
|
||||||
|
.summary-row.total .summary-value {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row.total .summary-value {
|
||||||
|
color: #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Notes */
|
||||||
|
.invoice-notes {
|
||||||
|
margin-top: 24px;
|
||||||
|
padding-top: 24px;
|
||||||
|
border-top: 1px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-notes h4 {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-notes p {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #6b7280;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Status Badge */
|
||||||
|
.status-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-paid {
|
||||||
|
background: #d1fae5;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-unpaid {
|
||||||
|
background: #fef3c7;
|
||||||
|
color: #d97706;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-partial {
|
||||||
|
background: #e0e7ff;
|
||||||
|
color: #3730a3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sticky Footer Actions */
|
||||||
|
.invoice-actions {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: white;
|
||||||
|
border-top: 2px solid #e5e7eb;
|
||||||
|
padding: 16px 20px;
|
||||||
|
box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
|
||||||
|
z-index: 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-actions-content {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
padding: 14px 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
border: none;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: white;
|
||||||
|
color: #374151;
|
||||||
|
border: 2px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
border-color: #2563eb;
|
||||||
|
color: #2563eb;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Toast Notification */
|
||||||
|
.toast {
|
||||||
|
position: fixed;
|
||||||
|
top: 80px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: #1f2937;
|
||||||
|
color: white;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 16px rgba(0,0,0,0.2);
|
||||||
|
z-index: 1000;
|
||||||
|
display: none;
|
||||||
|
animation: slideDown 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast.show {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast.success {
|
||||||
|
background: #065f46;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast.error {
|
||||||
|
background: #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideDown {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-50%) translateY(-20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateX(-50%) translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.invoice-content {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-card {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-info-section {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-table {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-table th,
|
||||||
|
.products-table td {
|
||||||
|
padding: 8px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-actions-content {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="header">
|
||||||
|
<a href="invoice-list.html" class="back-button">
|
||||||
|
<i class="fas fa-arrow-left"></i>
|
||||||
|
</a>
|
||||||
|
<h1 class="header-title">Chi tiết Hóa đơn</h1>
|
||||||
|
<button class="header-action-btn" onclick="shareInvoice()">
|
||||||
|
<i class="fas fa-share-alt"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="invoice-container">
|
||||||
|
<div class="invoice-content">
|
||||||
|
<!-- Invoice Header Card -->
|
||||||
|
<div class="invoice-card">
|
||||||
|
<div class="invoice-header-section">
|
||||||
|
<div class="company-logo">
|
||||||
|
<i class="fas fa-file-invoice-dollar"></i>
|
||||||
|
</div>
|
||||||
|
<h1 class="invoice-title">HÓA ĐƠN GTGT</h1>
|
||||||
|
<div class="invoice-number">#INV20240001</div>
|
||||||
|
<span class="status-badge status-paid">Đã thanh toán</span>
|
||||||
|
|
||||||
|
<div class="invoice-meta">
|
||||||
|
<!--<div class="invoice-meta-item">
|
||||||
|
<div class="invoice-meta-label">Mẫu số:</div>
|
||||||
|
<div class="invoice-meta-value">01GTKT0/001</div>
|
||||||
|
</div>-->
|
||||||
|
<!--<div class="invoice-meta-item">
|
||||||
|
<div class="invoice-meta-label">Ký hiệu:</div>
|
||||||
|
<div class="invoice-meta-value">AA/24E</div>
|
||||||
|
</div>-->
|
||||||
|
<div class="invoice-meta-item">
|
||||||
|
<div class="invoice-meta-label">Ngày xuất:</div>
|
||||||
|
<div class="invoice-meta-value">03/08/2024</div>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-meta-item">
|
||||||
|
<div class="invoice-meta-label">Đơn hàng:</div>
|
||||||
|
<div class="invoice-meta-value">#DH001234</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Company Information -->
|
||||||
|
<div class="company-info-section">
|
||||||
|
<div class="company-info-block">
|
||||||
|
<h3>
|
||||||
|
<i class="fas fa-building text-blue-600"></i>
|
||||||
|
Đơn vị bán hàng
|
||||||
|
</h3>
|
||||||
|
<p><strong>Công ty:</strong> CÔNG TY CP EUROTILE VIỆT NAM</p>
|
||||||
|
<p><strong>Mã số thuế:</strong> 0301234567</p>
|
||||||
|
<p><strong>Địa chỉ:</strong> 123 Đường Nguyễn Văn Linh, Quận 7, TP.HCM</p>
|
||||||
|
<p><strong>Điện thoại:</strong> (028) 1900 1234</p>
|
||||||
|
<p><strong>Email:</strong> sales@eurotile.vn</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="company-info-block">
|
||||||
|
<h3>
|
||||||
|
<i class="fas fa-user-tie text-green-600"></i>
|
||||||
|
Đơn vị mua hàng
|
||||||
|
</h3>
|
||||||
|
<p><strong>Người mua hàng:</strong> Lê Hoàng Hiệp </p>
|
||||||
|
<p><strong>Tên đơn vị:</strong> Công ty TNHH Xây dựng Minh Long</p>
|
||||||
|
<p><strong>Mã số thuế:</strong> 0134000687</p>
|
||||||
|
<p><strong>Địa chỉ:</strong> 11 Đường Hoàng Hữu Nam, Phường Linh Chiểu, TP. Thủ Đức, TP.HCM</p>
|
||||||
|
<p><strong>Điện thoại:</strong> 0339797979</p>
|
||||||
|
<p><strong>Email:</strong> minhlong.org@gmail.com</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Products Section -->
|
||||||
|
<div class="invoice-card products-section">
|
||||||
|
<h3>
|
||||||
|
<i class="fas fa-box-open"></i>
|
||||||
|
Chi tiết hàng hóa
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<table class="products-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 40px;">#</th>
|
||||||
|
<th>Tên hàng hóa</th>
|
||||||
|
<!--<th style="width: 80px;">ĐVT</th>-->
|
||||||
|
<th style="width: 80px;">Số lượng</th>
|
||||||
|
<th style="width: 110px;">Đơn giá</th>
|
||||||
|
<th style="width: 120px;">Thành tiền</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>1</td>
|
||||||
|
<td>
|
||||||
|
<div class="product-name">Gạch Eurotile MỘC LAM E03</div>
|
||||||
|
<div class="product-sku">SKU: ET-ML-E03-60x60</div>
|
||||||
|
</td>
|
||||||
|
<!--<td>m²</td>-->
|
||||||
|
<td>30,12</td>
|
||||||
|
<td>285.000đ</td>
|
||||||
|
<td><strong>8.550.000đ</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>2</td>
|
||||||
|
<td>
|
||||||
|
<div class="product-name">Gạch Eurotile STONE GREY S02</div>
|
||||||
|
<div class="product-sku">SKU: ET-SG-S02-80x80</div>
|
||||||
|
</td>
|
||||||
|
<!--<td>m²</td>-->
|
||||||
|
<td>20,24</td>
|
||||||
|
<td>217.500đ</td>
|
||||||
|
<td><strong>4.350.000đ</strong></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- Invoice Summary -->
|
||||||
|
<div class="invoice-summary">
|
||||||
|
<div class="summary-row">
|
||||||
|
<span class="summary-label">Tổng tiền hàng:</span>
|
||||||
|
<span class="summary-value">12.900.000đ</span>
|
||||||
|
</div>
|
||||||
|
<div class="summary-row">
|
||||||
|
<span class="summary-label">Chiết khấu VIP (1%):</span>
|
||||||
|
<span class="summary-value" style="color: #059669;">-129.000đ</span>
|
||||||
|
</div>
|
||||||
|
<!--<div class="summary-row">
|
||||||
|
<span class="summary-label">Tiền trước thuế:</span>
|
||||||
|
<span class="summary-value">12.771.000đ</span>
|
||||||
|
</div>-->
|
||||||
|
<!--<div class="summary-row">
|
||||||
|
<span class="summary-label">Thuế GTGT (0%):</span>
|
||||||
|
<span class="summary-value">0đ</span>
|
||||||
|
</div>-->
|
||||||
|
<div class="summary-row total">
|
||||||
|
<span class="summary-label">TỔNG THANH TOÁN:</span>
|
||||||
|
<span class="summary-value">12.771.000đ</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Notes -->
|
||||||
|
<!--<div class="invoice-notes">
|
||||||
|
<h4>Ghi chú:</h4>
|
||||||
|
<p>- Số tiền viết bằng chữ: <strong>Mười hai triệu bảy trăm bảy mươi mốt nghìn đồng chẵn.</strong></p>
|
||||||
|
<p>- Hình thức thanh toán: Chuyển khoản ngân hàng</p>
|
||||||
|
<p>- Hóa đơn điện tử đã được ký số và có giá trị pháp lý</p>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<div id="actionButtons" class="action-buttons">
|
||||||
|
<button class="btn btn-secondary" onclick="contactSupport()">
|
||||||
|
<i class="fas fa-comments"></i>
|
||||||
|
Liên hệ hỗ trợ
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Sticky Footer Actions -->
|
||||||
|
<!--<div class="invoice-actions">
|
||||||
|
<div class="invoice-actions-content">
|
||||||
|
<button class="btn btn-secondary" onclick="downloadPDF()">
|
||||||
|
<i class="fas fa-download"></i>
|
||||||
|
Tải xuống PDF
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-primary" onclick="sendEmail()">
|
||||||
|
<i class="fas fa-envelope"></i>
|
||||||
|
Gửi qua Email
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Toast Notification -->
|
||||||
|
<div id="toast" class="toast"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Show toast notification
|
||||||
|
function showToast(message, type = 'success') {
|
||||||
|
const toast = document.getElementById('toast');
|
||||||
|
toast.textContent = message;
|
||||||
|
toast.className = `toast ${type} show`;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.classList.remove('show');
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Download PDF function
|
||||||
|
function downloadPDF() {
|
||||||
|
showToast('Đang tải xuống hóa đơn PDF...', 'success');
|
||||||
|
|
||||||
|
// Simulate PDF download
|
||||||
|
setTimeout(() => {
|
||||||
|
showToast('Hóa đơn đã được tải xuống thành công!', 'success');
|
||||||
|
|
||||||
|
// In a real app, this would trigger actual PDF download
|
||||||
|
// window.location.href = '/api/invoices/INV20240001/download';
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send Email function
|
||||||
|
function sendEmail() {
|
||||||
|
showToast('Đang gửi hóa đơn qua email...', 'success');
|
||||||
|
|
||||||
|
// Simulate email sending
|
||||||
|
setTimeout(() => {
|
||||||
|
showToast('Hóa đơn đã được gửi đến email: minhlong.org@gmail.com', 'success');
|
||||||
|
|
||||||
|
// In a real app, this would call API to send email
|
||||||
|
// fetch('/api/invoices/INV20240001/send-email', { method: 'POST' })
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Share invoice function
|
||||||
|
function shareInvoice() {
|
||||||
|
if (navigator.share) {
|
||||||
|
navigator.share({
|
||||||
|
title: 'Hóa đơn #INV20240001',
|
||||||
|
text: 'Chi tiết hóa đơn EuroTile',
|
||||||
|
url: window.location.href
|
||||||
|
}).catch(err => console.log('Error sharing:', err));
|
||||||
|
} else {
|
||||||
|
// Fallback to copy link
|
||||||
|
navigator.clipboard.writeText(window.location.href);
|
||||||
|
showToast('Đã sao chép link hóa đơn!', 'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get invoice ID from URL parameter
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const invoiceId = urlParams.get('id') || 'INV20240001';
|
||||||
|
|
||||||
|
// Update page with invoice ID (in real app, would fetch from API)
|
||||||
|
document.title = `Chi tiết Hóa đơn #${invoiceId} - EuroTile Worker`;
|
||||||
|
document.querySelector('.invoice-number').textContent = `#${invoiceId}`;
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
351
html/invoice-list.html
Normal file
351
html/invoice-list.html
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="vi">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Hóa đơn đã mua - EuroTile Worker</title>
|
||||||
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
|
<style>
|
||||||
|
.invoices-container {
|
||||||
|
max-width: 480px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: #f8fafc;
|
||||||
|
min-height: calc(100vh - 120px);
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-card:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 16px rgba(0,0,0,0.12);
|
||||||
|
border-color: #2563eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-codes {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-id {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1f2937;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-date {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-status {
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-paid {
|
||||||
|
background: #d1fae5;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-unpaid {
|
||||||
|
background: #fef3c7;
|
||||||
|
color: #d97706;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-partial {
|
||||||
|
background: #e0e7ff;
|
||||||
|
color: #3730a3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-details {
|
||||||
|
padding: 12px 0;
|
||||||
|
border-top: 1px solid #f3f4f6;
|
||||||
|
border-bottom: 1px solid #f3f4f6;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-detail-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-detail-row:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-detail-label {
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-detail-value {
|
||||||
|
color: #1f2937;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-detail-value.total {
|
||||||
|
color: #dc2626;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-company {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #6b7280;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-arrow {
|
||||||
|
color: #9ca3af;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 80px 20px;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state i {
|
||||||
|
font-size: 64px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state h3 {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #374151;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state p {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.invoices-container {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-card {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="header">
|
||||||
|
<a href="account.html" class="back-button">
|
||||||
|
<i class="fas fa-arrow-left"></i>
|
||||||
|
</a>
|
||||||
|
<h1 class="header-title">Hóa đơn đã mua</h1>
|
||||||
|
<div style="width: 32px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="invoices-container">
|
||||||
|
<!-- Invoice Card 1 - Paid -->
|
||||||
|
<div class="invoice-card" onclick="window.location.href='invoice-detail.html?id=INV20240001'">
|
||||||
|
<div class="invoice-header">
|
||||||
|
<div class="invoice-codes">
|
||||||
|
<div class="invoice-id">#INV20240001</div>
|
||||||
|
<div class="invoice-date">Ngày xuất: 03/08/2024</div>
|
||||||
|
</div>
|
||||||
|
<span class="invoice-status status-paid">Đã thanh toán</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="invoice-details">
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Đơn hàng:</span>
|
||||||
|
<span class="invoice-detail-value">#DH001234</span>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Tổng tiền:</span>
|
||||||
|
<span class="invoice-detail-value total">12.771.000đ</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div class="invoice-footer">
|
||||||
|
<div class="invoice-company">
|
||||||
|
<i class="fas fa-building"></i>
|
||||||
|
<span>Lê Hoàng Hiệp</span>
|
||||||
|
</div>
|
||||||
|
<i class="fas fa-chevron-right invoice-arrow"></i>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Invoice Card 2 - Partial -->
|
||||||
|
<div class="invoice-card" onclick="window.location.href='invoice-detail.html?id=INV20240002'">
|
||||||
|
<div class="invoice-header">
|
||||||
|
<div class="invoice-codes">
|
||||||
|
<div class="invoice-id">#INV20240002</div>
|
||||||
|
<div class="invoice-date">Ngày xuất: 15/07/2024</div>
|
||||||
|
</div>
|
||||||
|
<span class="invoice-status status-partial">Thanh toán 1 phần</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="invoice-details">
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Đơn hàng:</span>
|
||||||
|
<span class="invoice-detail-value">#DH001198</span>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Tổng tiền:</span>
|
||||||
|
<span class="invoice-detail-value total">85.600.000đ</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div class="invoice-footer">
|
||||||
|
<div class="invoice-company">
|
||||||
|
<i class="fas fa-building"></i>
|
||||||
|
<span>Công ty TNHH Xây dựng Minh Long</span>
|
||||||
|
</div>
|
||||||
|
<i class="fas fa-chevron-right invoice-arrow"></i>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Invoice Card 3 - Paid -->
|
||||||
|
<div class="invoice-card" onclick="window.location.href='invoice-detail.html?id=INV20240003'">
|
||||||
|
<div class="invoice-header">
|
||||||
|
<div class="invoice-codes">
|
||||||
|
<div class="invoice-id">#INV20240003</div>
|
||||||
|
<div class="invoice-date">Ngày xuất: 25/06/2024</div>
|
||||||
|
</div>
|
||||||
|
<span class="invoice-status status-paid">Đã thanh toán</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="invoice-details">
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Đơn hàng:</span>
|
||||||
|
<span class="invoice-detail-value">#DH001087</span>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Tổng tiền:</span>
|
||||||
|
<span class="invoice-detail-value total">42.500.000đ</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div class="invoice-footer">
|
||||||
|
<div class="invoice-company">
|
||||||
|
<i class="fas fa-building"></i>
|
||||||
|
<span>Công ty TNHH Xây dựng Minh Long</span>
|
||||||
|
</div>
|
||||||
|
<i class="fas fa-chevron-right invoice-arrow"></i>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Invoice Card 4 - Unpaid -->
|
||||||
|
<div class="invoice-card" onclick="window.location.href='invoice-detail.html?id=INV20240004'">
|
||||||
|
<div class="invoice-header">
|
||||||
|
<div class="invoice-codes">
|
||||||
|
<div class="invoice-id">#INV20240004</div>
|
||||||
|
<div class="invoice-date">Ngày xuất: 10/06/2024</div>
|
||||||
|
</div>
|
||||||
|
<span class="invoice-status status-unpaid">Chưa thanh toán</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="invoice-details">
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Đơn hàng:</span>
|
||||||
|
<span class="invoice-detail-value">#DH000945</span>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Tổng tiền:</span>
|
||||||
|
<span class="invoice-detail-value total">28.300.000đ</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div class="invoice-footer">
|
||||||
|
<div class="invoice-company">
|
||||||
|
<i class="fas fa-building"></i>
|
||||||
|
<span>Công ty TNHH Xây dựng Minh Long</span>
|
||||||
|
</div>
|
||||||
|
<i class="fas fa-chevron-right invoice-arrow"></i>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Invoice Card 5 - Paid -->
|
||||||
|
<div class="invoice-card" onclick="window.location.href='invoice-detail.html?id=INV20240005'">
|
||||||
|
<div class="invoice-header">
|
||||||
|
<div class="invoice-codes">
|
||||||
|
<div class="invoice-id">#INV20240005</div>
|
||||||
|
<div class="invoice-date">Ngày xuất: 15/05/2024</div>
|
||||||
|
</div>
|
||||||
|
<span class="invoice-status status-paid">Đã thanh toán</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="invoice-details">
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Đơn hàng:</span>
|
||||||
|
<span class="invoice-detail-value">#DH000821</span>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-detail-row">
|
||||||
|
<span class="invoice-detail-label">Tổng tiền:</span>
|
||||||
|
<span class="invoice-detail-value total">56.750.000đ</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div class="invoice-footer">
|
||||||
|
<div class="invoice-company">
|
||||||
|
<i class="fas fa-building"></i>
|
||||||
|
<span>Công ty TNHH Xây dựng Minh Long</span>
|
||||||
|
</div>
|
||||||
|
<i class="fas fa-chevron-right invoice-arrow"></i>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Add animation to cards on page load
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const cards = document.querySelectorAll('.invoice-card');
|
||||||
|
cards.forEach((card, index) => {
|
||||||
|
card.style.opacity = '0';
|
||||||
|
card.style.transform = 'translateY(20px)';
|
||||||
|
card.style.transition = 'all 0.5s ease';
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
card.style.opacity = '1';
|
||||||
|
card.style.transform = 'translateY(0)';
|
||||||
|
}, index * 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -316,13 +316,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="library-content" onclick="viewLibraryDetail('studio-apartment')">
|
<div class="library-content" onclick="viewLibraryDetail('studio-apartment')">
|
||||||
<h3 class="library-title">Căn hộ Studio</h3>
|
<h3 class="library-title">Căn hộ Studio</h3>
|
||||||
<div class="library-date">
|
<!--<div class="library-date">
|
||||||
<i class="fas fa-calendar-alt"></i>
|
<i class="fas fa-calendar-alt"></i>
|
||||||
<span>Ngày đăng: 15/11/2024</span>
|
<span>Ngày đăng: 15/11/2024</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="library-description">
|
<p class="library-description">
|
||||||
Thiết kế hiện đại cho căn hộ studio 35m², tối ưu không gian sống với gạch men cao cấp và màu sắc hài hòa.
|
Thiết kế hiện đại cho căn hộ studio 35m², tối ưu không gian sống với gạch men cao cấp và màu sắc hài hòa.
|
||||||
</p>
|
</p>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -336,13 +336,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="library-content">
|
<div class="library-content">
|
||||||
<h3 class="library-title">Biệt thự Hiện đại</h3>
|
<h3 class="library-title">Biệt thự Hiện đại</h3>
|
||||||
<div class="library-date">
|
<!--<div class="library-date">
|
||||||
<i class="fas fa-calendar-alt"></i>
|
<i class="fas fa-calendar-alt"></i>
|
||||||
<span>Ngày đăng: 12/11/2024</span>
|
<span>Ngày đăng: 12/11/2024</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="library-description">
|
<p class="library-description">
|
||||||
Biệt thự 3 tầng với phong cách kiến trúc hiện đại, sử dụng gạch granite và ceramic premium tạo điểm nhấn.
|
Biệt thự 3 tầng với phong cách kiến trúc hiện đại, sử dụng gạch granite và ceramic premium tạo điểm nhấn.
|
||||||
</p>
|
</p>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -356,13 +356,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="library-content">
|
<div class="library-content">
|
||||||
<h3 class="library-title">Nhà phố Tối giản</h3>
|
<h3 class="library-title">Nhà phố Tối giản</h3>
|
||||||
<div class="library-date">
|
<!--<div class="library-date">
|
||||||
<i class="fas fa-calendar-alt"></i>
|
<i class="fas fa-calendar-alt"></i>
|
||||||
<span>Ngày đăng: 08/11/2024</span>
|
<span>Ngày đăng: 08/11/2024</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="library-description">
|
<p class="library-description">
|
||||||
Nhà phố 4x15m với thiết kế tối giản, tận dụng ánh sáng tự nhiên và gạch men màu trung tính.
|
Nhà phố 4x15m với thiết kế tối giản, tận dụng ánh sáng tự nhiên và gạch men màu trung tính.
|
||||||
</p>
|
</p>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -376,13 +376,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="library-content">
|
<div class="library-content">
|
||||||
<h3 class="library-title">Chung cư Cao cấp</h3>
|
<h3 class="library-title">Chung cư Cao cấp</h3>
|
||||||
<div class="library-date">
|
<!--<div class="library-date">
|
||||||
<i class="fas fa-calendar-alt"></i>
|
<i class="fas fa-calendar-alt"></i>
|
||||||
<span>Ngày đăng: 05/11/2024</span>
|
<span>Ngày đăng: 05/11/2024</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="library-description">
|
<p class="library-description">
|
||||||
Căn hộ 3PN với nội thất sang trọng, sử dụng gạch marble và ceramic cao cấp nhập khẩu Italy.
|
Căn hộ 3PN với nội thất sang trọng, sử dụng gạch marble và ceramic cao cấp nhập khẩu Italy.
|
||||||
</p>
|
</p>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,14 +16,16 @@
|
|||||||
<i class="fas fa-arrow-left"></i>
|
<i class="fas fa-arrow-left"></i>
|
||||||
</a>
|
</a>
|
||||||
<h1 class="header-title">Chi tiết đơn hàng</h1>
|
<h1 class="header-title">Chi tiết đơn hàng</h1>
|
||||||
<div class="header-actions">
|
<div style="width: 32px;"></div>
|
||||||
|
|
||||||
|
<!--<div class="header-actions">
|
||||||
<button class="header-action-btn" onclick="shareOrder()">
|
<button class="header-action-btn" onclick="shareOrder()">
|
||||||
<i class="fas fa-share"></i>
|
<i class="fas fa-share"></i>
|
||||||
</button>
|
</button>
|
||||||
<button class="header-action-btn" onclick="printOrder()">
|
<button class="header-action-btn" onclick="printOrder()">
|
||||||
<i class="fas fa-print"></i>
|
<i class="fas fa-print"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="order-detail-content" style="padding-bottom: 0px;">
|
<div class="order-detail-content" style="padding-bottom: 0px;">
|
||||||
@@ -46,22 +48,33 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="timeline-item completed">
|
||||||
|
<div class="timeline-icon">
|
||||||
|
<i class="fas fa-check-circle"></i>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="timeline-content">
|
||||||
|
<div class="timeline-title">Xác nhận đơn hàng</div>
|
||||||
|
<div class="timeline-date">03/08/2023 - 10:15</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="timeline-item active">
|
<div class="timeline-item active">
|
||||||
<div class="timeline-icon">
|
<div class="timeline-icon">
|
||||||
<i class="fas fa-cog fa-spin"></i>
|
<i class="fas fa-cog fa-spin"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="timeline-content">
|
<div class="timeline-content">
|
||||||
<div class="timeline-title">Đã xác nhận đơn hàng</div>
|
<div class="timeline-title">Xử lý</div>
|
||||||
<div class="timeline-date">03/08/2023 - 10:15 (Đang xử lý)</div>
|
<div class="timeline-date">Chuẩn bị hàng và vận chuyển</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="timeline-item pending">
|
<div class="timeline-item pending">
|
||||||
<div class="timeline-icon">
|
<div class="timeline-icon">
|
||||||
<i class="fas fa-check-circle"></i>
|
<i class="fas fa-box-open"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="timeline-content">
|
<div class="timeline-content">
|
||||||
<div class="timeline-title">Đã hoàn thành</div>
|
<div class="timeline-title">Hoàn thành</div>
|
||||||
<div class="timeline-date">Dự kiến: 07/08/2023</div>
|
<div class="timeline-date">Dự kiến: 07/08/2023</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -69,11 +82,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Delivery Information Card -->
|
<!-- Delivery Information Card -->
|
||||||
<div class="delivery-info-card">
|
<!--<div class="delivery-info-card">
|
||||||
<h3><i class="fas fa-shipping-fast"></i> Thông tin giao hàng</h3>
|
<h3><i class="fas fa-shipping-fast"></i> Thông tin giao hàng</h3>
|
||||||
|
|
||||||
<div class="delivery-details">
|
<div class="delivery-details">
|
||||||
<!--<div class="delivery-method">
|
<div class="delivery-method">
|
||||||
<div class="delivery-method-icon">
|
<div class="delivery-method-icon">
|
||||||
<i class="fas fa-truck"></i>
|
<i class="fas fa-truck"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -81,16 +94,16 @@
|
|||||||
<div class="method-name">Giao hàng tiêu chuẩn</div>
|
<div class="method-name">Giao hàng tiêu chuẩn</div>
|
||||||
<div class="method-description">Giao trong 3-5 ngày làm việc</div>
|
<div class="method-description">Giao trong 3-5 ngày làm việc</div>
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>
|
||||||
|
|
||||||
<div class="delivery-dates">
|
<div class="delivery-dates">
|
||||||
<!--<div class="date-item">
|
<div class="date-item">
|
||||||
<div class="date-label">
|
<div class="date-label">
|
||||||
<i class="fas fa-calendar-alt"></i>
|
<i class="fas fa-calendar-alt"></i>
|
||||||
Ngày xuất kho
|
Ngày xuất kho
|
||||||
</div>
|
</div>
|
||||||
<div class="date-value confirmed">05/08/2023</div>
|
<div class="date-value confirmed">05/08/2023</div>
|
||||||
</div>-->
|
</div>
|
||||||
|
|
||||||
<div class="date-item">
|
<div class="date-item">
|
||||||
<div class="date-label">
|
<div class="date-label">
|
||||||
@@ -120,55 +133,179 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
<!-- Customer Information -->
|
<!-- Customer Information -->
|
||||||
<div class="customer-info-card">
|
<!--<div class="customer-info-card">
|
||||||
<h3><i class="fas fa-user-circle"></i> Thông tin khách hàng</h3>
|
<h3><i class="fas fa-user-circle"></i> Thông tin khách hàng</h3>-->
|
||||||
<div class="customer-details">
|
<div class="delivery-info-card">
|
||||||
<div class="customer-row">
|
<h3><i class="fas fa-shipping-fast"></i> Thông tin giao hàng</h3>
|
||||||
<span class="customer-label">Tên khách hàng:</span>
|
<!-- Address Section -->
|
||||||
<span class="customer-value">Nguyễn Văn A</span>
|
<!--<div class="mb-4">
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Địa chỉ nhận hàng
|
||||||
|
</label>
|
||||||
|
<a href="addresses.html" class="block border border-gray-200 rounded-lg p-3 hover:border-blue-500 hover:bg-blue-50 transition group">
|
||||||
|
<div class="flex items-start justify-between">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="font-semibold text-gray-900 mb-1">Hoàng Minh Hiệp</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-1">0347302911</div>
|
||||||
|
<div class="text-sm text-gray-600">
|
||||||
|
123 Đường Võ Văn Ngân, Phường Linh Chiểu,
|
||||||
|
Thành phố Thủ Đức, TP.HCM
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Address Section -->
|
||||||
|
<div class="mb-4">
|
||||||
|
|
||||||
|
<!-- Label + Button -->
|
||||||
|
<div class="flex items-center justify-between mb-2">
|
||||||
|
<label class="block text-sm font-medium text-gray-700">
|
||||||
|
Địa chỉ nhận hàng
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="addresses.html"
|
||||||
|
class="text-blue-600 text-sm font-medium hover:underline px-3 py-1 border rounded-lg hover:bg-blue-50">
|
||||||
|
Cập nhật
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Address Box -->
|
||||||
|
<a href="addresses.html"
|
||||||
|
class="block border border-gray-200 rounded-lg p-3 hover:border-blue-500 hover:bg-blue-50 transition group">
|
||||||
|
<div class="flex items-start justify-between">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="font-semibold text-gray-900 mb-1">Hoàng Minh Hiệp</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-1">0347302911</div>
|
||||||
|
<div class="text-sm text-gray-600">
|
||||||
|
123 Đường Võ Văn Ngân, Phường Linh Chiểu,
|
||||||
|
Thành phố Thủ Đức, TP.HCM
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--<div class="customer-row">
|
||||||
|
<span class="customer-label">Ngày lấy hàng:</span>
|
||||||
|
<span class="customer-value">07/08/2025</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="customer-row">
|
<div class="customer-row">
|
||||||
<span class="customer-label">Số điện thoại:</span>
|
<span class="customer-label">Ghi chú:</span>
|
||||||
<span class="customer-value">0901234567</span>
|
<span class="customer-value">Giao hàng trong giờ hành chính. Vui lòng gọi trước 30 phút khi đến giao hàng.</span>
|
||||||
</div>
|
|
||||||
<div class="customer-row">
|
|
||||||
<span class="customer-label">Email:</span>
|
|
||||||
<span class="customer-value">nguyenvana@email.com</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="customer-row">
|
<div class="customer-row">
|
||||||
<span class="customer-label">Loại khách hàng:</span>
|
<span class="customer-label">Loại khách hàng:</span>
|
||||||
<span class="customer-badge vip">DIAMOND</span>
|
<span class="customer-badge vip">DIAMOND</span>
|
||||||
|
</div>-->
|
||||||
|
<!-- Pickup Date -->
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Ngày lấy hàng
|
||||||
|
</label>
|
||||||
|
<div class="font-semibold text-gray-900 mb-1" style="font-weight: 450;">07/08/2025</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- Pickup Date -->
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||||
|
Ghi chú
|
||||||
|
</label>
|
||||||
|
<div class="font-semibold text-gray-900 mb-1" style="font-weight: 450;">Giao hàng trong giờ hành chính. Vui lòng gọi trước 30 phút khi đến giao hàng</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Invoice Information -->
|
<!-- Invoice Information -->
|
||||||
<div class="customer-info-card">
|
<div class="customer-info-card">
|
||||||
<h3><i class="fas fa-file-invoice"></i> Thông tin hóa đơn</h3>
|
<!-- Title + Update Button -->
|
||||||
<div class="customer-details">
|
<div class="flex items-center justify-between mb-3">
|
||||||
|
<h3 class="flex items-center gap-2" style=" margin-bottom: 0px;">
|
||||||
|
<i class="fas fa-file-invoice"></i>
|
||||||
|
Thông tin hóa đơn
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<a href="addresses.html"
|
||||||
|
class="text-blue-600 text-sm font-medium hover:underline px-3 py-1 border rounded-lg hover:bg-blue-50">
|
||||||
|
Cập nhật
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="border-t border-gray-200 pt-4">
|
||||||
|
<a href="addresses.html" class="block border border-gray-200 rounded-lg p-3 hover:border-blue-500 hover:bg-blue-50 transition group">
|
||||||
|
<div class="flex items-start justify-between">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="font-semibold text-gray-900 mb-1">Công ty TNHH Xây dựng Minh Long</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-0.5">Mã số thuế: 0134000687</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-0.5">Số điện thoại: 0339797979</div>
|
||||||
|
<div class="text-sm text-gray-600 mb-0.5">Email: minhlong.org@gmail.com</div>
|
||||||
|
<div class="text-sm text-gray-600">
|
||||||
|
Địa chỉ: 11 Đường Hoàng Hữu Nam, Phường Linh Chiểu,
|
||||||
|
Thành phố Thủ Đức, TP.HCM
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--<div class="customer-details">
|
||||||
<div class="customer-row">
|
<div class="customer-row">
|
||||||
<span class="customer-label">Tên công ty:</span>
|
<span class="customer-label">Tên công ty:</span>
|
||||||
<span class="customer-value">Công ty TNHH Xây dựng ABC</span>
|
<span class="customer-value">Công ty TNHH Xây dựng Minh Long</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="customer-row">
|
<div class="customer-row">
|
||||||
<span class="customer-label">Mã số thuế:</span>
|
<span class="customer-label">Mã số thuế:</span>
|
||||||
<span class="customer-value">0123456789</span>
|
<span class="customer-value">0134000687</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="customer-row">
|
<div class="customer-row">
|
||||||
<span class="customer-label">Địa chỉ công ty:</span>
|
<span class="customer-label">Địa chỉ:</span>
|
||||||
<span class="customer-value">123 Nguyễn Trãi, Quận 1, TP.HCM</span>
|
<span class="customer-value">11 Đường Hoàng Hữu Nam, Phường Linh Chiểu, Thành phố Thủ Đức, TP.HCM</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="customer-row">
|
<div class="customer-row">
|
||||||
<span class="customer-label">Email nhận hóa đơn:</span>
|
<span class="customer-label">Email nhận hóa đơn:</span>
|
||||||
<span class="customer-value">ketoan@abc.com</span>
|
<span class="customer-value">minhlong.org@gmail.com</span>
|
||||||
|
</div>
|
||||||
|
<div class="customer-row">
|
||||||
|
<span class="customer-label">Số điện thoại:</span>
|
||||||
|
<span class="customer-value">0339797979</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="customer-row">
|
<div class="customer-row">
|
||||||
<span class="customer-label">Loại hóa đơn:</span>
|
<span class="customer-label">Loại hóa đơn:</span>
|
||||||
<span class="customer-badge" style="background: #d1ecf1; color: #0c5460;">Hóa đơn VAT</span>
|
<span class="customer-badge" style="background: #d1ecf1; color: #0c5460;">Hóa đơn VAT</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
<!-- Invoices List Block (NEW) -->
|
||||||
|
<div class="delivery-info-card">
|
||||||
|
<h3><i class="fas fa-file-invoice-dollar text-blue-600"></i> Hóa đơn đã xuất</h3>
|
||||||
|
|
||||||
|
<div class="invoices-list">
|
||||||
|
<!-- Invoice Card 1 -->
|
||||||
|
<div class="invoice-item" onclick="window.location.href='invoice-detail.html?id=INV20240001'">
|
||||||
|
<div class="invoice-item-icon">
|
||||||
|
<i class="fas fa-file-invoice"></i>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-item-content">
|
||||||
|
<div class="invoice-item-title">#INV20240001</div>
|
||||||
|
<div class="invoice-item-subtitle">Ngày xuất: 03/08/2024 - 10:00</div>
|
||||||
|
</div>
|
||||||
|
<div class="invoice-item-amount">12.771.000đ</div>
|
||||||
|
<i class="fas fa-chevron-right invoice-item-arrow"></i>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -249,10 +386,11 @@
|
|||||||
<i class="fas fa-credit-card"></i>
|
<i class="fas fa-credit-card"></i>
|
||||||
Phương thức thanh toán:
|
Phương thức thanh toán:
|
||||||
</div>
|
</div>
|
||||||
<div class="payment-value">Chuyển khoản ngân hàng</div>
|
<div class="payment-value">Thanh toán một phần</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="order-notes">
|
|
||||||
|
<!--<div class="order-notes">
|
||||||
<div class="notes-label">
|
<div class="notes-label">
|
||||||
<i class="fas fa-sticky-note"></i>
|
<i class="fas fa-sticky-note"></i>
|
||||||
Ghi chú đơn hàng:
|
Ghi chú đơn hàng:
|
||||||
@@ -260,6 +398,68 @@
|
|||||||
<div class="notes-content">
|
<div class="notes-content">
|
||||||
Giao hàng trong giờ hành chính. Vui lòng gọi trước 30 phút khi đến giao hàng.
|
Giao hàng trong giờ hành chính. Vui lòng gọi trước 30 phút khi đến giao hàng.
|
||||||
</div>
|
</div>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Payment History -->
|
||||||
|
<div class="detail-container">
|
||||||
|
<div class="detail-card">
|
||||||
|
<h3 class="section-title">
|
||||||
|
<i class="fas fa-history" style="color: #2563eb;"></i>
|
||||||
|
Lịch sử thanh toán
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="payment-history" style ="margin-bottom: 0px;" id="payment-history">
|
||||||
|
<!-- Payment Card 1 (Clickable for modal) -->
|
||||||
|
<div class="history-item" onclick="openPaymentModal('PAY20240001', '6.385.500đ', 'Chuyển khoản', '03/08/2024 - 14:30', 'TK20241020001', 'https://placehold.co/600x400/E8F4FD/005B9A/png?text=Bi%C3%AAn+lai+thanh+to%C3%A1n')">
|
||||||
|
<div class="history-icon">
|
||||||
|
<i class="fas fa-check"></i>
|
||||||
|
</div>
|
||||||
|
<div class="history-content">
|
||||||
|
<div class="history-title">#PAY20240001</div>
|
||||||
|
<!--<div class="history-details">Chuyển khoản | Ref: TK20241020001</div>-->
|
||||||
|
<div class="history-date">03/08/2024 - 14:30</div>
|
||||||
|
</div>
|
||||||
|
<div class="history-amount">6.385.500đ</div>
|
||||||
|
<i class="fas fa-chevron-right" style="color: #9ca3af; margin-left: 8px;"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Payment Card 2 -->
|
||||||
|
<div class="history-item" onclick="openPaymentModal('PAY20240002', '6.385.500đ', 'Tiền mặt', '05/08/2024 - 09:15', 'CASH-20240805-001', '')">
|
||||||
|
<div class="history-icon">
|
||||||
|
<i class="fas fa-check"></i>
|
||||||
|
</div>
|
||||||
|
<div class="history-content">
|
||||||
|
<div class="history-title">#PAY20240002</div>
|
||||||
|
<!--<div class="history-details">Tiền mặt | Ref: CASH-20240805-001</div>-->
|
||||||
|
<div class="history-date">05/08/2024 - 09:15</div>
|
||||||
|
</div>
|
||||||
|
<div class="history-amount">6.385.500đ</div>
|
||||||
|
<i class="fas fa-chevron-right" style="color: #9ca3af; margin-left: 8px;"></i>
|
||||||
|
</div>
|
||||||
|
<!-- Payment Summary -->
|
||||||
|
<div class="summary-row">
|
||||||
|
<span>Còn lại:</span>
|
||||||
|
<span class="remaining-amount" id="remaining-amount">10.000.000đ</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<div class="action-buttons">
|
||||||
|
<button class="btn btn-primary" onclick="makePayment()" id="pay-button">
|
||||||
|
<i class="fas fa-credit-card"></i>
|
||||||
|
Thanh toán
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-secondary" onclick="contactSupport()">
|
||||||
|
<i class="fas fa-comments"></i>
|
||||||
|
Liên hệ hỗ trợ
|
||||||
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -276,11 +476,11 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>-->
|
</div>-->
|
||||||
<!-- Floating Action Button -->
|
<!-- Floating Action Button -->
|
||||||
<a href="chat-list.html" class="fab-link">
|
<!--<a href="chat-list.html" class="fab-link">
|
||||||
<button class="fab">
|
<button class="fab">
|
||||||
<i class="fas fa-comments"></i>
|
<i class="fas fa-comments"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>-->
|
||||||
<!--<a href="chat-list.html" class="fab">-->
|
<!--<a href="chat-list.html" class="fab">-->
|
||||||
<!--<button class="fab">-->
|
<!--<button class="fab">-->
|
||||||
<!--<i class="fas fa-comments"></i>-->
|
<!--<i class="fas fa-comments"></i>-->
|
||||||
@@ -683,6 +883,14 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.detail-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Action Buttons */
|
/* Action Buttons */
|
||||||
.order-actions {
|
.order-actions {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -731,6 +939,200 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Mobile Responsiveness */
|
/* Mobile Responsiveness */
|
||||||
|
/* Invoices List Styles */
|
||||||
|
.invoices-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item:hover {
|
||||||
|
border-color: var(--primary-blue);
|
||||||
|
background: #F0F7FF;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item-icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
|
||||||
|
color: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item-content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item-title {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-dark);
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item-subtitle {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item-amount {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #dc2626;
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item-arrow {
|
||||||
|
color: var(--text-light);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-item {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-item:hover {
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 8px;
|
||||||
|
transform: translateX(4px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Payment Modal Styles */
|
||||||
|
.payment-modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 1000;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-modal.active {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-modal-content {
|
||||||
|
background: white;
|
||||||
|
border-radius: 16px;
|
||||||
|
max-width: 500px;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 90vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
animation: slideUp 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-modal-header {
|
||||||
|
padding: 20px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-modal-header h3 {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1f2937;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-modal-close {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #f3f4f6;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-modal-close:hover {
|
||||||
|
background: #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-modal-body {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-detail-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 12px 0;
|
||||||
|
border-bottom: 1px solid #f3f4f6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-detail-row:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-detail-label {
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-detail-value {
|
||||||
|
color: #1f2937;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-detail-value.amount {
|
||||||
|
color: #065f46;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-receipt-image {
|
||||||
|
margin-top: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-receipt-image img {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
@media (max-width: 480px) {
|
||||||
.status-timeline-card,
|
.status-timeline-card,
|
||||||
.delivery-info-card,
|
.delivery-info-card,
|
||||||
@@ -763,7 +1165,7 @@
|
|||||||
.date-item,
|
.date-item,
|
||||||
.customer-row,
|
.customer-row,
|
||||||
.summary-row {
|
.summary-row {
|
||||||
flex-direction: column;
|
/*flex-direction: column;*/
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
}
|
}
|
||||||
@@ -775,10 +1177,393 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.payment-modal-content {
|
||||||
|
margin: 20px;
|
||||||
|
max-height: calc(100vh - 40px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-item-amount {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style>
|
||||||
|
.detail-container {
|
||||||
|
max-width: 480px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px;
|
||||||
|
background: #f8fafc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-id {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-date {
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-overdue {
|
||||||
|
background: #fee2e2;
|
||||||
|
color: #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-unpaid {
|
||||||
|
background: #fef3c7;
|
||||||
|
color: #d97706;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-paid {
|
||||||
|
background: #d1fae5;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-partial {
|
||||||
|
background: #e0e7ff;
|
||||||
|
color: #3730a3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-summary {
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 2px solid #e5e7eb;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remaining-amount {
|
||||||
|
color: #dc2626;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding: 16px;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-image {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
background: #f3f4f6;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-right: 16px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-info {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-name {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-sku {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6b7280;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-details {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-quantity {
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-price {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-history {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 16px;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
background: #d1fae5;
|
||||||
|
color: #065f46;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 16px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-title {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-details {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6b7280;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-date {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-amount {
|
||||||
|
text-align: right;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #065f46;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
padding: 14px 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
border: none;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: white;
|
||||||
|
color: #374151;
|
||||||
|
border: 2px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
border-color: #2563eb;
|
||||||
|
color: #2563eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-download {
|
||||||
|
background: #f3f4f6;
|
||||||
|
color: #374151;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-download:hover {
|
||||||
|
background: #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-section {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-history {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px 20px;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-history i {
|
||||||
|
font-size: 32px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
color: #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.detail-container {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-card {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-buttons {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-details {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row:last-child {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- Payment Detail Modal -->
|
||||||
|
<div id="paymentModal" class="payment-modal">
|
||||||
|
<div class="payment-modal-content">
|
||||||
|
<div class="payment-modal-header">
|
||||||
|
<h3>Chi tiết thanh toán</h3>
|
||||||
|
<button class="payment-modal-close" onclick="closePaymentModal()">
|
||||||
|
<i class="fas fa-times"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="payment-modal-body">
|
||||||
|
<div class="payment-detail-row">
|
||||||
|
<span class="payment-detail-label">Mã giao dịch:</span>
|
||||||
|
<span class="payment-detail-value" id="modal-transaction-id"></span>
|
||||||
|
</div>
|
||||||
|
<div class="payment-detail-row">
|
||||||
|
<span class="payment-detail-label">Thời gian:</span>
|
||||||
|
<span class="payment-detail-value" id="modal-datetime"></span>
|
||||||
|
</div>
|
||||||
|
<div class="payment-detail-row">
|
||||||
|
<span class="payment-detail-label">Phương thức:</span>
|
||||||
|
<span class="payment-detail-value" id="modal-method"></span>
|
||||||
|
</div>
|
||||||
|
<div class="payment-detail-row">
|
||||||
|
<span class="payment-detail-label">Mã tham chiếu:</span>
|
||||||
|
<span class="payment-detail-value" id="modal-reference"></span>
|
||||||
|
</div>
|
||||||
|
<div class="payment-detail-row">
|
||||||
|
<span class="payment-detail-label">Số tiền:</span>
|
||||||
|
<span class="payment-detail-value amount" id="modal-amount"></span>
|
||||||
|
</div>
|
||||||
|
<div id="modal-receipt-container" class="payment-receipt-image" style="display: none;">
|
||||||
|
<img id="modal-receipt-image" src="" alt="Biên lai thanh toán">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function openPaymentModal(transactionId, amount, method, datetime, reference, receiptImage) {
|
||||||
|
document.getElementById('modal-transaction-id').textContent = transactionId;
|
||||||
|
document.getElementById('modal-amount').textContent = amount;
|
||||||
|
document.getElementById('modal-method').textContent = method;
|
||||||
|
document.getElementById('modal-datetime').textContent = datetime;
|
||||||
|
document.getElementById('modal-reference').textContent = reference;
|
||||||
|
|
||||||
|
const receiptContainer = document.getElementById('modal-receipt-container');
|
||||||
|
const receiptImg = document.getElementById('modal-receipt-image');
|
||||||
|
|
||||||
|
if (receiptImage && receiptImage !== '') {
|
||||||
|
receiptImg.src = receiptImage;
|
||||||
|
receiptContainer.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
receiptContainer.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('paymentModal').classList.add('active');
|
||||||
|
document.body.style.overflow = 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
function closePaymentModal() {
|
||||||
|
document.getElementById('paymentModal').classList.remove('active');
|
||||||
|
document.body.style.overflow = 'auto';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close modal when clicking outside
|
||||||
|
document.getElementById('paymentModal')?.addEventListener('click', function(e) {
|
||||||
|
if (e.target === this) {
|
||||||
|
closePaymentModal();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function shareOrder() {
|
function shareOrder() {
|
||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
navigator.share({
|
navigator.share({
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<i class="fas fa-check"></i>
|
<i class="fas fa-check"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 class="success-title">Đặt hàng thành công!</h1>
|
<h1 class="success-title">Tạo đơn hàng thành công!</h1>
|
||||||
<p class="success-message">
|
<p class="success-message">
|
||||||
Cảm ơn bạn đã đặt hàng. Chúng tôi sẽ liên hệ xác nhận trong vòng 24 giờ.
|
Cảm ơn bạn đã đặt hàng. Chúng tôi sẽ liên hệ xác nhận trong vòng 24 giờ.
|
||||||
</p>
|
</p>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Next Steps -->
|
<!-- Next Steps -->
|
||||||
<div class="card">
|
<!-- <div class="card">
|
||||||
<h3 class="card-title">Các bước tiếp theo</h3>
|
<h3 class="card-title">Các bước tiếp theo</h3>
|
||||||
<div style="display: flex; align-items: flex-start; margin-bottom: 12px;">
|
<div style="display: flex; align-items: flex-start; margin-bottom: 12px;">
|
||||||
<div style="width: 24px; height: 24px; background: var(--primary-blue); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-right: 12px; flex-shrink: 0;">1</div>
|
<div style="width: 24px; height: 24px; background: var(--primary-blue); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-right: 12px; flex-shrink: 0;">1</div>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<p class="text-small text-muted">Vận chuyển đến địa chỉ của bạn</p>
|
<p class="text-small text-muted">Vận chuyển đến địa chỉ của bạn</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
<!-- Action Buttons -->
|
||||||
<a href="#" class="btn btn-primary btn-block mb-2">
|
<a href="#" class="btn btn-primary btn-block mb-2">
|
||||||
|
|||||||
@@ -12,9 +12,11 @@
|
|||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a href="checkout.html" class="back-button">
|
<!--<a href="checkout.html" class="back-button">
|
||||||
<i class="fas fa-arrow-left"></i>
|
<i class="fas fa-arrow-left"></i>
|
||||||
</a>
|
</a>-->
|
||||||
|
<div style="width: 32px;"></div>
|
||||||
|
|
||||||
<h1 class="header-title">Thanh toán</h1>
|
<h1 class="header-title">Thanh toán</h1>
|
||||||
<button class="back-button" onclick="openInfoModal()">
|
<button class="back-button" onclick="openInfoModal()">
|
||||||
<i class="fas fa-info-circle"></i>
|
<i class="fas fa-info-circle"></i>
|
||||||
@@ -122,7 +124,7 @@
|
|||||||
|
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
<span class="info-label">Nội dung:</span>
|
<span class="info-label">Nội dung:</span>
|
||||||
<span class="info-value">DH001234 La Nguyen Quynh</span>
|
<span class="info-value">DH001234</span>
|
||||||
<button class="copy-btn" onclick="copyText('DH001234 La Nguyen Quynh')">
|
<button class="copy-btn" onclick="copyText('DH001234 La Nguyen Quynh')">
|
||||||
<i class="fas fa-copy"></i>
|
<i class="fas fa-copy"></i>
|
||||||
</button>
|
</button>
|
||||||
@@ -139,12 +141,15 @@
|
|||||||
|
|
||||||
<!-- Action Buttons -->
|
<!-- Action Buttons -->
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<button class="btn btn-secondary" onclick="confirmPayment()">
|
<!--<button class="btn btn-secondary" onclick="confirmPayment()">
|
||||||
<i class="fas fa-check"></i> Đã thanh toán
|
<i class="fas fa-check"></i> Đã thanh toán
|
||||||
</button>
|
</button>-->
|
||||||
<button class="btn btn-primary" onclick="uploadProof()">
|
<button class="btn btn-primary" onclick="uploadProof()">
|
||||||
<i class="fas fa-camera"></i> Upload bill chuyển khoản
|
<i class="fas fa-camera"></i> Upload bill chuyển khoản
|
||||||
</button>
|
</button>
|
||||||
|
<a href="index.html" class="btn btn-secondary btn-block">
|
||||||
|
<i class="fas fa-home"></i> Quay về trang chủ
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Timer -->
|
<!-- Timer -->
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -4,155 +4,394 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Thông tin cá nhân - EuroTile Worker</title>
|
<title>Thông tin cá nhân - EuroTile Worker</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com/3.4.1"></script>
|
||||||
<link rel="stylesheet" href="assets/css/style.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7fafc;
|
||||||
|
}
|
||||||
|
.form-input, .form-select {
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
transition: border-color 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
.form-input:focus, .form-select:focus {
|
||||||
|
border-color: #3b82f6;
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
|
||||||
|
}
|
||||||
|
.readonly-input {
|
||||||
|
background-color: #f1f5f9;
|
||||||
|
cursor: not-allowed;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
.nav-item.active {
|
||||||
|
color: #3b82f6;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 50;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideDown {
|
||||||
|
from { opacity: 0; transform: translate(-50%, -20px); }
|
||||||
|
to { opacity: 1; transform: translate(-50%, 0); }
|
||||||
|
}
|
||||||
|
@keyframes slideUp {
|
||||||
|
from { opacity: 1; transform: translate(-50%, 0); }
|
||||||
|
to { opacity: 0; transform: translate(-50%, -20px); }
|
||||||
|
}
|
||||||
|
.upload-card.has-file {
|
||||||
|
border-color: #22c55e;
|
||||||
|
background-color: #f0fdf4;
|
||||||
|
}
|
||||||
|
.upload-card.readonly {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="text-gray-800">
|
||||||
|
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="header">
|
<div class="header flex items-center justify-between p-4 border-b border-gray-200">
|
||||||
<a href="account.html" class="back-button">
|
<a href="account.html" class="text-gray-600">
|
||||||
<i class="fas fa-arrow-left"></i>
|
<i class="fas fa-arrow-left text-xl"></i>
|
||||||
</a>
|
</a>
|
||||||
<h1 class="header-title">Thông tin cá nhân</h1>
|
<h1 class="text-lg font-bold" style="margin-right: 97px;">Thông tin cá nhân</h1>
|
||||||
<div style="width: 32px;"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container p-4 pb-24">
|
||||||
<div class="form-container">
|
<form id="profileForm" onsubmit="handleSubmit(event)">
|
||||||
<div class="card">
|
|
||||||
<!-- Profile Picture -->
|
<!-- Avatar Section -->
|
||||||
<div class="profile-avatar-section">
|
<div class="bg-white rounded-xl shadow-sm p-6 flex flex-col items-center">
|
||||||
<div class="profile-avatar">
|
<div class="relative">
|
||||||
<img src="https://placehold.co/100x100/005B9A/FFFFFF/png?text=HMH" alt="Avatar" id="avatarImage">
|
<img src="https://ui-avatars.com/api/?name=Nguyen+Van+A&background=3b82f6&color=fff&size=128"
|
||||||
<button class="avatar-edit-btn" onclick="changeAvatar()">
|
alt="Avatar"
|
||||||
<i class="fas fa-camera"></i>
|
id="avatarImage"
|
||||||
</button>
|
class="w-24 h-24 rounded-full border-4 border-white shadow-lg">
|
||||||
|
<label for="avatarInput" class="absolute -bottom-2 -right-2 w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center text-white cursor-pointer shadow">
|
||||||
|
<i class="fas fa-camera text-sm"></i>
|
||||||
|
</label>
|
||||||
|
<input type="file" id="avatarInput" accept="image/*" class="hidden" onchange="handleAvatarChange(this)">
|
||||||
|
</div>
|
||||||
|
<h2 id="fullNameDisplay" class="text-xl font-bold mt-4">Nguyễn Văn A</h2>
|
||||||
|
<p class="text-gray-500">Thầu thợ</p>
|
||||||
|
<div id="accountStatusCard" class="mt-4">
|
||||||
|
<!-- Dynamic content based on status -->
|
||||||
</div>
|
</div>
|
||||||
<input type="file" id="avatarInput" style="display: none;" accept="image/*">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="profileForm">
|
<!-- Verification Form (Hidden by default) -->
|
||||||
<!-- Full Name -->
|
<div id="verificationFormContainer" class="bg-white rounded-xl shadow-sm mt-4 p-5" style="display: none;">
|
||||||
|
<div class="flex items-center gap-3 border-b pb-3 mb-4">
|
||||||
|
<i class="fas fa-file-check text-blue-500"></i>
|
||||||
|
<h3 class="font-bold text-base">Thông tin xác thực</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info-note bg-blue-50 border-l-4 border-blue-400 text-blue-700 p-4 rounded-md mb-4 text-sm">
|
||||||
|
<i class="fas fa-info-circle mr-2"></i>
|
||||||
|
<strong>Lưu ý:</strong> Vui lòng cung cấp ảnh chụp rõ ràng các giấy tờ xác thực để được phê duyệt nhanh chóng.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">Họ và tên *</label>
|
<label class="form-label font-semibold text-sm mb-2 block">Ảnh mặt trước CCCD/CMND <span class="text-red-500">*</span></label>
|
||||||
<input type="text" class="form-input" value="Hoàng Minh Hiệp" required>
|
<div id="idCardUploadCard" class="upload-card border-2 border-dashed rounded-lg p-6 text-center cursor-pointer bg-gray-50 hover:bg-gray-100" onclick="handleUploadClick('idCardInput')">
|
||||||
|
<div id="idCardPreview" class="upload-content text-gray-500">
|
||||||
|
<i class="fas fa-camera text-2xl"></i>
|
||||||
|
<span class="mt-2 text-sm font-semibold">Chụp ảnh hoặc chọn file</span>
|
||||||
|
<span class="text-xs">JPG, PNG tối đa 5MB</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="file" id="idCardInput" accept="image/*" class="hidden" onchange="handleVerificationFileUpload(this, 'idCardPreview')">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label font-semibold text-sm mb-2 block">Ảnh chứng chỉ hành nghề hoặc GPKD <span class="text-red-500">*</span></label>
|
||||||
|
<div id="certificateUploadCard" class="upload-card border-2 border-dashed rounded-lg p-6 text-center cursor-pointer bg-gray-50 hover:bg-gray-100" onclick="handleUploadClick('certificateInput')">
|
||||||
|
<div id="certificatePreview" class="upload-content text-gray-500">
|
||||||
|
<i class="fas fa-file-certificate text-2xl"></i>
|
||||||
|
<span class="mt-2 text-sm font-semibold">Chụp ảnh hoặc chọn file</span>
|
||||||
|
<span class="text-xs">JPG, PNG tối đa 5MB</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="file" id="certificateInput" accept="image/*" class="hidden" onchange="handleVerificationFileUpload(this, 'certificatePreview')">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Phone -->
|
<div class="grid grid-cols-2 gap-3 mt-6" id="verificationSubmitBtn" style="display: none;">
|
||||||
<div class="form-group">
|
<button type="button" class="w-full bg-gray-200 text-gray-700 font-bold py-2.5 px-4 rounded-lg" onclick="cancelVerification()">Hủy</button>
|
||||||
<label class="form-label">Số điện thoại *</label>
|
<button type="button" class="w-full bg-blue-500 text-white font-bold py-2.5 px-4 rounded-lg" onclick="submitVerification()">Gửi xác thực</button>
|
||||||
<input type="tel" class="form-input" value="0347302911" required>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Email -->
|
<!-- Combined Personal Information Section -->
|
||||||
<div class="form-group">
|
<div class="bg-white rounded-xl shadow-sm mt-4 p-5">
|
||||||
<label class="form-label">Email</label>
|
<div class="flex items-center gap-3 border-b pb-3 mb-4">
|
||||||
<input type="email" class="form-input" value="hoanghiep@example.com">
|
<i class="fas fa-user-circle text-blue-500"></i>
|
||||||
|
<h3 class="font-bold text-base">Thông tin cá nhân</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Birth Date -->
|
<div class="space-y-4">
|
||||||
<div class="form-group">
|
<div>
|
||||||
<label class="form-label">Ngày sinh</label>
|
<label class="font-semibold text-sm mb-1 block">Họ và tên <span class="text-red-500">*</span></label>
|
||||||
<input type="date" class="form-input" value="1985-03-15">
|
<input type="text" id="fullName" class="form-input w-full p-2.5 rounded-lg" value="Nguyễn Văn A" placeholder="Nhập họ và tên" required onkeyup="document.getElementById('fullNameDisplay').textContent = this.value">
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
<!-- Gender -->
|
<label class="font-semibold text-sm mb-1 block">Số điện thoại</label>
|
||||||
<div class="form-group">
|
<input type="tel" class="form-input readonly-input w-full p-2.5 rounded-lg" value="0983 441 099" readonly>
|
||||||
<label class="form-label">Giới tính</label>
|
</div>
|
||||||
<select class="form-select">
|
<div>
|
||||||
|
<label class="font-semibold text-sm mb-1 block">Email</label>
|
||||||
|
<input type="email" class="form-input readonly-input w-full p-2.5 rounded-lg" value="nguyenvana@email.com" readonly>
|
||||||
|
</div>
|
||||||
|
<!--<div>
|
||||||
|
<label class="font-semibold text-sm mb-1 block">Vai trò</label>
|
||||||
|
<input class="form-input readonly-input w-full p-2.5 rounded-lg" value="Thầu thợ" disabled>
|
||||||
|
</div>-->
|
||||||
|
<div>
|
||||||
|
<label class="font-semibold text-sm mb-1 block">Ngày sinh</label>
|
||||||
|
<input type="date" id="birthDate" class="form-input w-full p-2.5 rounded-lg" value="1990-05-15">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="font-semibold text-sm mb-1 block">Giới tính</label>
|
||||||
|
<select id="gender" class="form-select w-full p-2.5 rounded-lg bg-white">
|
||||||
<option value="">Chọn giới tính</option>
|
<option value="">Chọn giới tính</option>
|
||||||
<option value="male" selected>Nam</option>
|
<option value="male" selected>Nam</option>
|
||||||
<option value="female">Nữ</option>
|
<option value="female">Nữ</option>
|
||||||
<option value="other">Khác</option>
|
<option value="other">Khác</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
<!-- ID Number -->
|
<label class="font-semibold text-sm mb-1 block">Tên công ty/Cửa hàng</label>
|
||||||
<div class="form-group">
|
<input type="text" id="companyName" class="form-input w-full p-2.5 rounded-lg" value="Gạch ốp lát Phương Nam" placeholder="Nhập tên (không bắt buộc)">
|
||||||
<label class="form-label">Số CMND/CCCD</label>
|
</div>
|
||||||
<input type="text" class="form-input" value="123456789012">
|
<div>
|
||||||
|
<label class="font-semibold text-sm mb-1 block">Mã số thuế</label>
|
||||||
|
<input type="text" id="taxCode" class="form-input w-full p-2.5 rounded-lg" value="0312345678" placeholder="Nhập mã số thuế (không bắt buộc)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ID MST -->
|
<!-- Read-only Fields -->
|
||||||
<div class="form-group">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<label class="form-label">Mã số thuế</label>
|
<div class="bg-blue-50 border-l-4 border-blue-400 text-blue-700 p-3 rounded text-xs">
|
||||||
<input type="text" class="form-input" value="0359837618">
|
<i class="fas fa-info-circle mr-2"></i>
|
||||||
|
Để thay đổi số điện thoại, email hoặc vai trò, vui lòng liên hệ bộ phận hỗ trợ.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Company -->
|
<!-- Action Buttons -->
|
||||||
<div class="form-group">
|
<div class="mt-6">
|
||||||
<label class="form-label">Công ty</label>
|
<button id="submit-btn" type="submit" class="w-full bg-blue-500 text-white font-bold py-3 px-4 rounded-lg shadow-md hover:bg-blue-600 transition-colors">
|
||||||
<input type="text" class="form-input" value="Công ty TNHH Xây dựng ABC">
|
Lưu thay đổi
|
||||||
</div>
|
</button>
|
||||||
|
|
||||||
<!-- Address -->
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Địa chỉ</label>
|
|
||||||
<input type="text" class="form-input" value="123 Man Thiện, Thủ Đức, Hồ Chí Minh">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Position -->
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Chức vụ</label>
|
|
||||||
<select class="form-select">
|
|
||||||
<option value="">Chọn chức vụ</option>
|
|
||||||
<option value="contractor" selected>Thầu thợ</option>
|
|
||||||
<option value="architect">Kiến trúc sư</option>
|
|
||||||
<option value="dealer">Đại lý phân phối</option>
|
|
||||||
<option value="broker">Môi giới</option>
|
|
||||||
<option value="other">Khác</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Experience -->
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Kinh nghiệm (năm)</label>
|
|
||||||
<input type="number" class="form-input" value="10" min="0">
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
|
||||||
<div class="form-actions">
|
|
||||||
<button type="button" class="btn btn-secondary" onclick="history.back()">
|
|
||||||
Hủy bỏ
|
|
||||||
</button>
|
|
||||||
<button type="submit" class="btn btn-primary" onclick="saveProfile()">
|
|
||||||
<i class="fas fa-save"></i>
|
|
||||||
Lưu thay đổi
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function changeAvatar() {
|
let accountStatus = 'chua_xac_thuc';
|
||||||
document.getElementById('avatarInput').click();
|
let verificationData = {
|
||||||
|
idNumber: '079123456789',
|
||||||
|
taxCode: '0312345678',
|
||||||
|
idCardFile: null,
|
||||||
|
certificateFile: null
|
||||||
|
};
|
||||||
|
|
||||||
|
function initializeAccountStatus() {
|
||||||
|
const statusContainer = document.getElementById('accountStatusCard');
|
||||||
|
const verificationFormContainer = document.getElementById('verificationFormContainer');
|
||||||
|
statusContainer.innerHTML = '';
|
||||||
|
|
||||||
|
if (accountStatus === 'chua_xac_thuc') {
|
||||||
|
const unverifiedBadge = document.createElement('div');
|
||||||
|
unverifiedBadge.className = 'flex items-center gap-4';
|
||||||
|
unverifiedBadge.innerHTML = `
|
||||||
|
<div class="inline-flex items-center gap-1.5 bg-red-100 text-red-700 text-xs font-semibold px-2.5 py-1 rounded-full">
|
||||||
|
<i class="fas fa-exclamation-circle"></i>
|
||||||
|
<span>Chưa xác thực</span>
|
||||||
|
</div>
|
||||||
|
<button class="text-blue-500 font-semibold text-sm" onclick="showVerificationForm()">
|
||||||
|
Xác thực ngay <i class="fas fa-arrow-right text-xs"></i>
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
statusContainer.appendChild(unverifiedBadge);
|
||||||
|
verificationFormContainer.style.display = 'none';
|
||||||
|
} else if (accountStatus === 'cho_xac_thuc') {
|
||||||
|
statusContainer.innerHTML = `
|
||||||
|
<div class="inline-flex items-center gap-1.5 bg-yellow-100 text-yellow-800 text-xs font-semibold px-2.5 py-1 rounded-full cursor-pointer" onclick="viewVerificationInfo()">
|
||||||
|
<i class="fas fa-clock"></i>
|
||||||
|
<span>Đang chờ xác thực</span>
|
||||||
|
</div>`;
|
||||||
|
verificationFormContainer.style.display = 'none';
|
||||||
|
} else if (accountStatus === 'da_xac_thuc') {
|
||||||
|
statusContainer.innerHTML = `
|
||||||
|
<div class="inline-flex items-center gap-1.5 bg-green-100 text-green-700 text-xs font-semibold px-2.5 py-1 rounded-full cursor-pointer" onclick="viewVerificationInfo()">
|
||||||
|
<i class="fas fa-check-circle"></i>
|
||||||
|
<span>Đã xác thực</span>
|
||||||
|
</div>`;
|
||||||
|
verificationFormContainer.style.display = 'none';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('avatarInput').addEventListener('change', function(e) {
|
function showVerificationForm() {
|
||||||
if (e.target.files && e.target.files[0]) {
|
const verificationFormContainer = document.getElementById('verificationFormContainer');
|
||||||
const reader = new FileReader();
|
const verificationSubmitBtn = document.getElementById('verificationSubmitBtn');
|
||||||
reader.onload = function(e) {
|
|
||||||
document.getElementById('avatarImage').src = e.target.result;
|
// Clear upload previews
|
||||||
};
|
document.getElementById('idCardPreview').innerHTML = `<i class="fas fa-camera text-2xl"></i><span class="mt-2 text-sm font-semibold">Chụp ảnh hoặc chọn file</span><span class="text-xs">JPG, PNG tối đa 5MB</span>`;
|
||||||
reader.readAsDataURL(e.target.files[0]);
|
document.getElementById('certificatePreview').innerHTML = `<i class="fas fa-file-certificate text-2xl"></i><span class="mt-2 text-sm font-semibold">Chụp ảnh hoặc chọn file</span><span class="text-xs">JPG, PNG tối đa 5MB</span>`;
|
||||||
|
|
||||||
|
const idCard = document.getElementById('idCardUploadCard');
|
||||||
|
const certCard = document.getElementById('certificateUploadCard');
|
||||||
|
idCard.classList.remove('has-file', 'readonly');
|
||||||
|
certCard.classList.remove('has-file', 'readonly');
|
||||||
|
idCard.onclick = () => handleUploadClick('idCardInput');
|
||||||
|
certCard.onclick = () => handleUploadClick('certificateInput');
|
||||||
|
|
||||||
|
verificationFormContainer.style.display = 'block';
|
||||||
|
verificationSubmitBtn.style.display = 'grid';
|
||||||
|
|
||||||
|
setTimeout(() => verificationFormContainer.scrollIntoView({ behavior: 'smooth', block: 'center' }), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
function viewVerificationInfo() {
|
||||||
|
const verificationFormContainer = document.getElementById('verificationFormContainer');
|
||||||
|
const verificationSubmitBtn = document.getElementById('verificationSubmitBtn');
|
||||||
|
|
||||||
|
const idCard = document.getElementById('idCardUploadCard');
|
||||||
|
const certCard = document.getElementById('certificateUploadCard');
|
||||||
|
|
||||||
|
if (verificationData.idCardFile) {
|
||||||
|
document.getElementById('idCardPreview').innerHTML = `<i class="fas fa-check-circle text-3xl text-green-500"></i><span class="mt-2 text-sm font-semibold text-green-600">CCCD_front.jpg</span>`;
|
||||||
|
idCard.classList.add('has-file', 'readonly');
|
||||||
|
idCard.onclick = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verificationData.certificateFile) {
|
||||||
|
document.getElementById('certificatePreview').innerHTML = `<i class="fas fa-check-circle text-3xl text-green-500"></i><span class="mt-2 text-sm font-semibold text-green-600">certificate.jpg</span>`;
|
||||||
|
certCard.classList.add('has-file', 'readonly');
|
||||||
|
certCard.onclick = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
verificationFormContainer.style.display = 'block';
|
||||||
|
verificationSubmitBtn.style.display = 'none';
|
||||||
|
|
||||||
|
setTimeout(() => verificationFormContainer.scrollIntoView({ behavior: 'smooth', block: 'center' }), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelVerification() {
|
||||||
|
document.getElementById('verificationFormContainer').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitVerification() {
|
||||||
|
if (!document.getElementById('idCardInput').files.length) return showToast('Vui lòng upload ảnh CCCD/CMND', 'error');
|
||||||
|
if (!document.getElementById('certificateInput').files.length) return showToast('Vui lòng upload ảnh chứng chỉ', 'error');
|
||||||
|
|
||||||
|
verificationData.idCardFile = document.getElementById('idCardInput').files[0];
|
||||||
|
verificationData.certificateFile = document.getElementById('certificateInput').files[0];
|
||||||
|
|
||||||
|
showToast('Đang gửi thông tin xác thực...', 'info');
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
accountStatus = 'cho_xac_thuc';
|
||||||
|
initializeAccountStatus();
|
||||||
|
document.getElementById('verificationFormContainer').style.display = 'none';
|
||||||
|
showToast('Đã gửi thông tin thành công! Vui lòng chờ duyệt.', 'success');
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUploadClick(inputId) {
|
||||||
|
// Add readonly check
|
||||||
|
const uploadCard = document.getElementById(inputId).parentElement;
|
||||||
|
if (uploadCard.classList.contains('readonly')) return;
|
||||||
|
document.getElementById(inputId).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAvatarChange(input) {
|
||||||
|
const file = input.files[0];
|
||||||
|
if (file) {
|
||||||
|
if (!file.type.startsWith('image/')) return showToast('Vui lòng chọn file hình ảnh (JPG, PNG)', 'error');
|
||||||
|
if (file.size > 5 * 1024 * 1024) return showToast('File không được vượt quá 5MB', 'error');
|
||||||
|
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = e => document.getElementById('avatarImage').src = e.target.result;
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
showToast('Đã chọn ảnh đại diện mới', 'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleVerificationFileUpload(input, previewId) {
|
||||||
|
const file = input.files[0];
|
||||||
|
const previewContainer = document.getElementById(previewId);
|
||||||
|
const uploadCard = previewContainer.parentElement;
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
if (!file.type.startsWith('image/')) return showToast('Vui lòng chọn file hình ảnh (JPG, PNG)', 'error');
|
||||||
|
if (file.size > 5 * 1024 * 1024) return showToast('File không được vượt quá 5MB', 'error');
|
||||||
|
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = e => {
|
||||||
|
previewContainer.innerHTML = `
|
||||||
|
<img src="${e.target.result}" alt="Preview" class="w-full h-24 object-contain rounded-md mb-2">
|
||||||
|
<div class="text-sm font-semibold text-green-600 truncate">${file.name}</div>
|
||||||
|
<div class="text-xs text-gray-500">Nhấn để thay đổi</div>
|
||||||
|
`;
|
||||||
|
uploadCard.classList.add('has-file');
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
showToast('Đã upload file thành công', 'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSubmit(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
if (!document.getElementById('fullName').value) return showToast('Vui lòng nhập họ và tên', 'error');
|
||||||
|
saveProfile();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
function saveProfile() {
|
function saveProfile() {
|
||||||
const form = document.getElementById('profileForm');
|
const submitBtn = document.getElementById('submit-btn');
|
||||||
if (form.checkValidity()) {
|
const originalText = submitBtn.innerHTML;
|
||||||
alert('Thông tin đã được cập nhật thành công!');
|
submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Đang lưu...';
|
||||||
window.location.href = 'account.html';
|
submitBtn.disabled = true;
|
||||||
} else {
|
|
||||||
form.reportValidity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showToast(message, type = 'success') {
|
||||||
|
const colors = { success: 'bg-green-500', error: 'bg-red-500', info: 'bg-blue-500' };
|
||||||
|
const icons = { success: 'fa-check-circle', error: 'fa-exclamation-circle', info: 'fa-info-circle' };
|
||||||
|
|
||||||
|
const toast = document.createElement('div');
|
||||||
|
toast.className = `fixed top-5 left-1/2 -translate-x-1/2 ${colors[type]} text-white py-2 px-5 rounded-lg shadow-lg flex items-center gap-2 text-sm z-[100]`;
|
||||||
|
toast.innerHTML = `<i class="fas ${icons[type]}"></i><span>${message}</span>`;
|
||||||
|
toast.style.animation = 'slideDown 0.3s ease';
|
||||||
|
document.body.appendChild(toast);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.style.animation = 'slideUp 0.3s ease forwards';
|
||||||
|
setTimeout(() => toast.remove(), 300);
|
||||||
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
initializeAccountStatus();
|
||||||
|
|
||||||
|
// FOR TESTING:
|
||||||
|
// accountStatus = 'chua_xac_thuc';
|
||||||
|
// accountStatus = 'cho_xac_thuc';
|
||||||
|
// accountStatus = 'da_xac_thuc';
|
||||||
|
// initializeAccountStatus();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -46,12 +46,22 @@
|
|||||||
<label class="form-label">Đơn vị thiết kế</label>
|
<label class="form-label">Đơn vị thiết kế</label>
|
||||||
<input type="text" class="form-input" id="designUnit" placeholder="Tên đơn vị thiết kế">
|
<input type="text" class="form-input" id="designUnit" placeholder="Tên đơn vị thiết kế">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">Đơn vị thi công</label>
|
||||||
|
<input type="text" class="form-input" id="designUnit" placeholder="Tên đơn vị thi công">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Project Details -->
|
<!-- Project Details -->
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h3 class="card-title">Chi tiết dự án</h3>
|
<h3 class="card-title">Chi tiết dự án</h3>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">Tổng diện tích<span class="text-red-500">*</span></label>
|
||||||
|
<input type="text" class="form-input" id="projectOwner" placeholder="Nhập diện tích m²" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">Sản phẩm đưa vào thiết kế <span class="text-red-500">*</span></label>
|
<label class="form-label">Sản phẩm đưa vào thiết kế <span class="text-red-500">*</span></label>
|
||||||
<textarea class="form-input" id="projectProducts" rows="4" placeholder="Liệt kê các sản phẩm gạch đã sử dụng trong công trình (tên sản phẩm, mã SP, số lượng...)" required></textarea>
|
<textarea class="form-input" id="projectProducts" rows="4" placeholder="Liệt kê các sản phẩm gạch đã sử dụng trong công trình (tên sản phẩm, mã SP, số lượng...)" required></textarea>
|
||||||
@@ -425,7 +435,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function resetForm() {
|
function resetForm() {
|
||||||
if (confirm('Bạn có chắc muốn nhập lại toàn bộ thông tin?')) {
|
if (confirm('Bạn có chắc muốn nhập lại toàn bộ thông tin?')) {
|
||||||
document.getElementById('projectForm').reset();
|
document.getElementById('projectForm').reset();
|
||||||
uploadedFiles = [];
|
uploadedFiles = [];
|
||||||
|
|||||||
13
ios/OneSignalNotificationServiceExtension/Info.plist
Normal file
13
ios/OneSignalNotificationServiceExtension/Info.plist
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NSExtension</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSExtensionPointIdentifier</key>
|
||||||
|
<string>com.apple.usernotifications.service</string>
|
||||||
|
<key>NSExtensionPrincipalClass</key>
|
||||||
|
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import UserNotifications
|
||||||
|
import OneSignalExtension
|
||||||
|
|
||||||
|
class NotificationService: UNNotificationServiceExtension {
|
||||||
|
var contentHandler: ((UNNotificationContent) -> Void)?
|
||||||
|
var receivedRequest: UNNotificationRequest!
|
||||||
|
var bestAttemptContent: UNMutableNotificationContent?
|
||||||
|
|
||||||
|
// Note this extension only runs when `mutable_content` is set
|
||||||
|
// Setting an attachment or action buttons automatically sets the property to true
|
||||||
|
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
||||||
|
self.receivedRequest = request
|
||||||
|
self.contentHandler = contentHandler
|
||||||
|
self.bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
|
||||||
|
|
||||||
|
if let bestAttemptContent = bestAttemptContent {
|
||||||
|
// DEBUGGING: Uncomment the 2 lines below to check this extension is executing
|
||||||
|
// print("Running NotificationServiceExtension")
|
||||||
|
// bestAttemptContent.body = "[Modified] " + bestAttemptContent.body
|
||||||
|
|
||||||
|
OneSignalExtension.didReceiveNotificationExtensionRequest(self.receivedRequest, with: bestAttemptContent, withContentHandler: self.contentHandler)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override func serviceExtensionTimeWillExpire() {
|
||||||
|
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
||||||
|
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
|
||||||
|
OneSignalExtension.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
|
||||||
|
contentHandler(bestAttemptContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>aps-environment</key>
|
||||||
|
<string>development</string>
|
||||||
|
<key>com.apple.security.application-groups</key>
|
||||||
|
<array>
|
||||||
|
<string>group.com.dbiz.partner.onesignal</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
13
ios/Podfile
13
ios/Podfile
@@ -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, '13.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'
|
||||||
@@ -36,8 +36,19 @@ target 'Runner' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# OneSignal Notification Service Extension (OUTSIDE Runner target)
|
||||||
|
target 'OneSignalNotificationServiceExtension' do
|
||||||
|
use_frameworks!
|
||||||
|
pod 'OneSignalXCFramework', '5.2.14'
|
||||||
|
end
|
||||||
|
|
||||||
post_install do |installer|
|
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)
|
||||||
|
|
||||||
|
# Ensure consistent deployment target
|
||||||
|
target.build_configurations.each do |config|
|
||||||
|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
285
ios/Podfile.lock
285
ios/Podfile.lock
@@ -35,72 +35,190 @@ PODS:
|
|||||||
- file_picker (0.0.1):
|
- file_picker (0.0.1):
|
||||||
- DKImagePickerController/PhotoGallery
|
- DKImagePickerController/PhotoGallery
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- Firebase/CoreOnly (12.4.0):
|
||||||
|
- FirebaseCore (~> 12.4.0)
|
||||||
|
- Firebase/Messaging (12.4.0):
|
||||||
|
- Firebase/CoreOnly
|
||||||
|
- FirebaseMessaging (~> 12.4.0)
|
||||||
|
- firebase_analytics (12.0.4):
|
||||||
|
- firebase_core
|
||||||
|
- FirebaseAnalytics (= 12.4.0)
|
||||||
|
- Flutter
|
||||||
|
- firebase_core (4.2.1):
|
||||||
|
- Firebase/CoreOnly (= 12.4.0)
|
||||||
|
- Flutter
|
||||||
|
- firebase_messaging (16.0.4):
|
||||||
|
- Firebase/Messaging (= 12.4.0)
|
||||||
|
- firebase_core
|
||||||
|
- Flutter
|
||||||
|
- FirebaseAnalytics (12.4.0):
|
||||||
|
- FirebaseAnalytics/Default (= 12.4.0)
|
||||||
|
- FirebaseCore (~> 12.4.0)
|
||||||
|
- FirebaseInstallations (~> 12.4.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/Network (~> 8.1)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.1)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- FirebaseAnalytics/Default (12.4.0):
|
||||||
|
- FirebaseCore (~> 12.4.0)
|
||||||
|
- FirebaseInstallations (~> 12.4.0)
|
||||||
|
- GoogleAppMeasurement/Default (= 12.4.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/Network (~> 8.1)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.1)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- FirebaseCore (12.4.0):
|
||||||
|
- FirebaseCoreInternal (~> 12.4.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.1)
|
||||||
|
- GoogleUtilities/Logger (~> 8.1)
|
||||||
|
- FirebaseCoreInternal (12.4.0):
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.1)"
|
||||||
|
- FirebaseInstallations (12.4.0):
|
||||||
|
- FirebaseCore (~> 12.4.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.1)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 8.1)
|
||||||
|
- PromisesObjC (~> 2.4)
|
||||||
|
- FirebaseMessaging (12.4.0):
|
||||||
|
- FirebaseCore (~> 12.4.0)
|
||||||
|
- FirebaseInstallations (~> 12.4.0)
|
||||||
|
- GoogleDataTransport (~> 10.1)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/Environment (~> 8.1)
|
||||||
|
- GoogleUtilities/Reachability (~> 8.1)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 8.1)
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- flutter_secure_storage (6.0.0):
|
- flutter_secure_storage (6.0.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- GoogleDataTransport (9.4.1):
|
- GoogleAdsOnDeviceConversion (3.1.0):
|
||||||
- GoogleUtilities/Environment (~> 7.7)
|
- GoogleUtilities/Environment (~> 8.1)
|
||||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
- GoogleUtilities/Logger (~> 8.1)
|
||||||
- PromisesObjC (< 3.0, >= 1.2)
|
- GoogleUtilities/Network (~> 8.1)
|
||||||
- GoogleMLKit/BarcodeScanning (6.0.0):
|
- nanopb (~> 3.30910.0)
|
||||||
- GoogleMLKit/MLKitCore
|
- GoogleAppMeasurement/Core (12.4.0):
|
||||||
- MLKitBarcodeScanning (~> 5.0.0)
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
|
||||||
- GoogleMLKit/MLKitCore (6.0.0):
|
- GoogleUtilities/MethodSwizzler (~> 8.1)
|
||||||
- MLKitCommon (~> 11.0.0)
|
- GoogleUtilities/Network (~> 8.1)
|
||||||
- GoogleToolboxForMac/Defines (4.2.1)
|
- "GoogleUtilities/NSData+zlib (~> 8.1)"
|
||||||
- GoogleToolboxForMac/Logger (4.2.1):
|
- nanopb (~> 3.30910.0)
|
||||||
- GoogleToolboxForMac/Defines (= 4.2.1)
|
- GoogleAppMeasurement/Default (12.4.0):
|
||||||
- "GoogleToolboxForMac/NSData+zlib (4.2.1)":
|
- GoogleAdsOnDeviceConversion (~> 3.1.0)
|
||||||
- GoogleToolboxForMac/Defines (= 4.2.1)
|
- GoogleAppMeasurement/Core (= 12.4.0)
|
||||||
- GoogleUtilities/Environment (7.13.3):
|
- GoogleAppMeasurement/IdentitySupport (= 12.4.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/Network (~> 8.1)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.1)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- GoogleAppMeasurement/IdentitySupport (12.4.0):
|
||||||
|
- GoogleAppMeasurement/Core (= 12.4.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.1)
|
||||||
|
- GoogleUtilities/Network (~> 8.1)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.1)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- GoogleDataTransport (10.1.0):
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- PromisesObjC (~> 2.4)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (8.1.0):
|
||||||
|
- GoogleUtilities/Environment
|
||||||
|
- GoogleUtilities/Logger
|
||||||
|
- GoogleUtilities/Network
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- PromisesObjC (< 3.0, >= 1.2)
|
- GoogleUtilities/Environment (8.1.0):
|
||||||
- GoogleUtilities/Logger (7.13.3):
|
- GoogleUtilities/Privacy
|
||||||
|
- GoogleUtilities/Logger (8.1.0):
|
||||||
- GoogleUtilities/Environment
|
- GoogleUtilities/Environment
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- GoogleUtilities/Privacy (7.13.3)
|
- GoogleUtilities/MethodSwizzler (8.1.0):
|
||||||
- GoogleUtilities/UserDefaults (7.13.3):
|
|
||||||
- GoogleUtilities/Logger
|
- GoogleUtilities/Logger
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- GoogleUtilitiesComponents (1.1.0):
|
- GoogleUtilities/Network (8.1.0):
|
||||||
- GoogleUtilities/Logger
|
- GoogleUtilities/Logger
|
||||||
- GTMSessionFetcher/Core (3.5.0)
|
- "GoogleUtilities/NSData+zlib"
|
||||||
|
- GoogleUtilities/Privacy
|
||||||
|
- GoogleUtilities/Reachability
|
||||||
|
- "GoogleUtilities/NSData+zlib (8.1.0)":
|
||||||
|
- GoogleUtilities/Privacy
|
||||||
|
- GoogleUtilities/Privacy (8.1.0)
|
||||||
|
- GoogleUtilities/Reachability (8.1.0):
|
||||||
|
- GoogleUtilities/Logger
|
||||||
|
- GoogleUtilities/Privacy
|
||||||
|
- GoogleUtilities/UserDefaults (8.1.0):
|
||||||
|
- GoogleUtilities/Logger
|
||||||
|
- GoogleUtilities/Privacy
|
||||||
- image_picker_ios (0.0.1):
|
- image_picker_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- integration_test (0.0.1):
|
- integration_test (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- MLImage (1.0.0-beta5)
|
- mobile_scanner (7.0.0):
|
||||||
- MLKitBarcodeScanning (5.0.0):
|
- Flutter
|
||||||
- MLKitCommon (~> 11.0)
|
- FlutterMacOS
|
||||||
- MLKitVision (~> 7.0)
|
- nanopb (3.30910.0):
|
||||||
- MLKitCommon (11.0.0):
|
- nanopb/decode (= 3.30910.0)
|
||||||
- GoogleDataTransport (< 10.0, >= 9.4.1)
|
- nanopb/encode (= 3.30910.0)
|
||||||
- GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1)
|
- nanopb/decode (3.30910.0)
|
||||||
- "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)"
|
- nanopb/encode (3.30910.0)
|
||||||
- GoogleUtilities/UserDefaults (< 8.0, >= 7.13.0)
|
- onesignal_flutter (5.3.4):
|
||||||
- GoogleUtilitiesComponents (~> 1.0)
|
- Flutter
|
||||||
- GTMSessionFetcher/Core (< 4.0, >= 3.3.2)
|
- OneSignalXCFramework (= 5.2.14)
|
||||||
- MLKitVision (7.0.0):
|
- OneSignalXCFramework (5.2.14):
|
||||||
- GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1)
|
- OneSignalXCFramework/OneSignalComplete (= 5.2.14)
|
||||||
- "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)"
|
- OneSignalXCFramework/OneSignal (5.2.14):
|
||||||
- GTMSessionFetcher/Core (< 4.0, >= 3.3.2)
|
- OneSignalXCFramework/OneSignalCore
|
||||||
- MLImage (= 1.0.0-beta5)
|
- OneSignalXCFramework/OneSignalExtension
|
||||||
- MLKitCommon (~> 11.0)
|
- OneSignalXCFramework/OneSignalLiveActivities
|
||||||
- mobile_scanner (5.2.3):
|
- OneSignalXCFramework/OneSignalNotifications
|
||||||
|
- OneSignalXCFramework/OneSignalOSCore
|
||||||
|
- OneSignalXCFramework/OneSignalOutcomes
|
||||||
|
- OneSignalXCFramework/OneSignalUser
|
||||||
|
- OneSignalXCFramework/OneSignalComplete (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignal
|
||||||
|
- OneSignalXCFramework/OneSignalInAppMessages
|
||||||
|
- OneSignalXCFramework/OneSignalLocation
|
||||||
|
- OneSignalXCFramework/OneSignalCore (5.2.14)
|
||||||
|
- OneSignalXCFramework/OneSignalExtension (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignalCore
|
||||||
|
- OneSignalXCFramework/OneSignalOutcomes
|
||||||
|
- OneSignalXCFramework/OneSignalInAppMessages (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignalCore
|
||||||
|
- OneSignalXCFramework/OneSignalNotifications
|
||||||
|
- OneSignalXCFramework/OneSignalOSCore
|
||||||
|
- OneSignalXCFramework/OneSignalOutcomes
|
||||||
|
- OneSignalXCFramework/OneSignalUser
|
||||||
|
- OneSignalXCFramework/OneSignalLiveActivities (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignalCore
|
||||||
|
- OneSignalXCFramework/OneSignalOSCore
|
||||||
|
- OneSignalXCFramework/OneSignalUser
|
||||||
|
- OneSignalXCFramework/OneSignalLocation (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignalCore
|
||||||
|
- OneSignalXCFramework/OneSignalNotifications
|
||||||
|
- OneSignalXCFramework/OneSignalOSCore
|
||||||
|
- OneSignalXCFramework/OneSignalUser
|
||||||
|
- OneSignalXCFramework/OneSignalNotifications (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignalCore
|
||||||
|
- OneSignalXCFramework/OneSignalExtension
|
||||||
|
- OneSignalXCFramework/OneSignalOutcomes
|
||||||
|
- OneSignalXCFramework/OneSignalOSCore (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignalCore
|
||||||
|
- OneSignalXCFramework/OneSignalOutcomes (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignalCore
|
||||||
|
- OneSignalXCFramework/OneSignalUser (5.2.14):
|
||||||
|
- OneSignalXCFramework/OneSignalCore
|
||||||
|
- OneSignalXCFramework/OneSignalNotifications
|
||||||
|
- OneSignalXCFramework/OneSignalOSCore
|
||||||
|
- OneSignalXCFramework/OneSignalOutcomes
|
||||||
|
- open_file_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- GoogleMLKit/BarcodeScanning (~> 6.0.0)
|
|
||||||
- nanopb (2.30910.0):
|
|
||||||
- nanopb/decode (= 2.30910.0)
|
|
||||||
- nanopb/encode (= 2.30910.0)
|
|
||||||
- nanopb/decode (2.30910.0)
|
|
||||||
- nanopb/encode (2.30910.0)
|
|
||||||
- path_provider_foundation (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- PromisesObjC (2.4.0)
|
- PromisesObjC (2.4.0)
|
||||||
- SDWebImage (5.21.2):
|
- SDWebImage (5.21.4):
|
||||||
- SDWebImage/Core (= 5.21.2)
|
- SDWebImage/Core (= 5.21.4)
|
||||||
- SDWebImage/Core (5.21.2)
|
- SDWebImage/Core (5.21.4)
|
||||||
- share_plus (0.0.1):
|
- share_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- shared_preferences_foundation (0.0.1):
|
- shared_preferences_foundation (0.0.1):
|
||||||
@@ -116,11 +234,17 @@ PODS:
|
|||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||||
|
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
|
||||||
|
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
||||||
|
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||||
- integration_test (from `.symlinks/plugins/integration_test/ios`)
|
- integration_test (from `.symlinks/plugins/integration_test/ios`)
|
||||||
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
|
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`)
|
||||||
|
- onesignal_flutter (from `.symlinks/plugins/onesignal_flutter/ios`)
|
||||||
|
- OneSignalXCFramework (= 5.2.14)
|
||||||
|
- open_file_ios (from `.symlinks/plugins/open_file_ios/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||||
@@ -131,17 +255,18 @@ SPEC REPOS:
|
|||||||
trunk:
|
trunk:
|
||||||
- DKImagePickerController
|
- DKImagePickerController
|
||||||
- DKPhotoGallery
|
- DKPhotoGallery
|
||||||
|
- Firebase
|
||||||
|
- FirebaseAnalytics
|
||||||
|
- FirebaseCore
|
||||||
|
- FirebaseCoreInternal
|
||||||
|
- FirebaseInstallations
|
||||||
|
- FirebaseMessaging
|
||||||
|
- GoogleAdsOnDeviceConversion
|
||||||
|
- GoogleAppMeasurement
|
||||||
- GoogleDataTransport
|
- GoogleDataTransport
|
||||||
- GoogleMLKit
|
|
||||||
- GoogleToolboxForMac
|
|
||||||
- GoogleUtilities
|
- GoogleUtilities
|
||||||
- GoogleUtilitiesComponents
|
|
||||||
- GTMSessionFetcher
|
|
||||||
- MLImage
|
|
||||||
- MLKitBarcodeScanning
|
|
||||||
- MLKitCommon
|
|
||||||
- MLKitVision
|
|
||||||
- nanopb
|
- nanopb
|
||||||
|
- OneSignalXCFramework
|
||||||
- PromisesObjC
|
- PromisesObjC
|
||||||
- SDWebImage
|
- SDWebImage
|
||||||
- SwiftyGif
|
- SwiftyGif
|
||||||
@@ -151,6 +276,12 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||||
file_picker:
|
file_picker:
|
||||||
:path: ".symlinks/plugins/file_picker/ios"
|
:path: ".symlinks/plugins/file_picker/ios"
|
||||||
|
firebase_analytics:
|
||||||
|
:path: ".symlinks/plugins/firebase_analytics/ios"
|
||||||
|
firebase_core:
|
||||||
|
:path: ".symlinks/plugins/firebase_core/ios"
|
||||||
|
firebase_messaging:
|
||||||
|
:path: ".symlinks/plugins/firebase_messaging/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
flutter_secure_storage:
|
flutter_secure_storage:
|
||||||
@@ -160,7 +291,11 @@ EXTERNAL SOURCES:
|
|||||||
integration_test:
|
integration_test:
|
||||||
:path: ".symlinks/plugins/integration_test/ios"
|
:path: ".symlinks/plugins/integration_test/ios"
|
||||||
mobile_scanner:
|
mobile_scanner:
|
||||||
:path: ".symlinks/plugins/mobile_scanner/ios"
|
:path: ".symlinks/plugins/mobile_scanner/darwin"
|
||||||
|
onesignal_flutter:
|
||||||
|
:path: ".symlinks/plugins/onesignal_flutter/ios"
|
||||||
|
open_file_ios:
|
||||||
|
:path: ".symlinks/plugins/open_file_ios/ios"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
share_plus:
|
share_plus:
|
||||||
@@ -177,31 +312,37 @@ SPEC CHECKSUMS:
|
|||||||
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
|
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
|
||||||
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
|
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
|
||||||
file_picker: b159e0c068aef54932bb15dc9fd1571818edaf49
|
file_picker: b159e0c068aef54932bb15dc9fd1571818edaf49
|
||||||
|
Firebase: f07b15ae5a6ec0f93713e30b923d9970d144af3e
|
||||||
|
firebase_analytics: 2b372cc13c077de5f1ac37e232bacd5bacb41963
|
||||||
|
firebase_core: e6b8bb503b7d1d9856e698d4f193f7b414e6bf1f
|
||||||
|
firebase_messaging: fc7b6af84f4cd885a4999f51ea69ef20f380d70d
|
||||||
|
FirebaseAnalytics: 0fc2b20091f0ddd21bf73397cf8f0eb5346dc24f
|
||||||
|
FirebaseCore: bb595f3114953664e3c1dc032f008a244147cfd3
|
||||||
|
FirebaseCoreInternal: d7f5a043c2cd01a08103ab586587c1468047bca6
|
||||||
|
FirebaseInstallations: ae9f4902cb5bf1d0c5eaa31ec1f4e5495a0714e2
|
||||||
|
FirebaseMessaging: d33971b7bb252745ea6cd31ab190d1a1df4b8ed5
|
||||||
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
|
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
|
||||||
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
|
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
|
||||||
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
|
GoogleAdsOnDeviceConversion: e03a386840803ea7eef3fd22a061930142c039c1
|
||||||
GoogleMLKit: 97ac7af399057e99182ee8edfa8249e3226a4065
|
GoogleAppMeasurement: 1e718274b7e015cefd846ac1fcf7820c70dc017d
|
||||||
GoogleToolboxForMac: d1a2cbf009c453f4d6ded37c105e2f67a32206d8
|
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
|
||||||
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
|
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
|
||||||
GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe
|
|
||||||
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
|
|
||||||
image_picker_ios: 4f2f91b01abdb52842a8e277617df877e40f905b
|
image_picker_ios: 4f2f91b01abdb52842a8e277617df877e40f905b
|
||||||
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
|
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
|
||||||
MLImage: 1824212150da33ef225fbd3dc49f184cf611046c
|
mobile_scanner: 77265f3dc8d580810e91849d4a0811a90467ed5e
|
||||||
MLKitBarcodeScanning: 10ca0845a6d15f2f6e911f682a1998b68b973e8b
|
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
|
||||||
MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1
|
onesignal_flutter: f69ff09eeaf41cea4b7a841de5a61e79e7fd9a5a
|
||||||
MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1
|
OneSignalXCFramework: 7112f3e89563e41ebc23fe807788f11985ac541c
|
||||||
mobile_scanner: 96e91f2e1fb396bb7df8da40429ba8dfad664740
|
open_file_ios: 461db5853723763573e140de3193656f91990d9e
|
||||||
nanopb: 438bc412db1928dac798aa6fd75726007be04262
|
|
||||||
path_provider_foundation: 0b743cbb62d8e47eab856f09262bb8c1ddcfe6ba
|
path_provider_foundation: 0b743cbb62d8e47eab856f09262bb8c1ddcfe6ba
|
||||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||||
SDWebImage: 9f177d83116802728e122410fb25ad88f5c7608a
|
SDWebImage: d0184764be51240d49c761c37f53dd017e1ccaaf
|
||||||
share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
|
share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
|
||||||
shared_preferences_foundation: 5086985c1d43c5ba4d5e69a4e8083a389e2909e6
|
shared_preferences_foundation: 5086985c1d43c5ba4d5e69a4e8083a389e2909e6
|
||||||
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
|
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
|
||||||
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
|
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
|
||||||
url_launcher_ios: bb13df5870e8c4234ca12609d04010a21be43dfa
|
url_launcher_ios: bb13df5870e8c4234ca12609d04010a21be43dfa
|
||||||
|
|
||||||
PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e
|
PODFILE CHECKSUM: d8ed968486e3d2e023338569c014e9285ba7bc53
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
|
|||||||
@@ -10,12 +10,15 @@
|
|||||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||||
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
|
41D57CDF80C517B01729B4E6 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D94728EBD25906AAA78A0D5 /* GoogleService-Info.plist */; };
|
||||||
|
48D410762ED7067500A8B931 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 48D4106F2ED7067500A8B931 /* OneSignalNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
58215889146B2DBBD9C81410 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2545A56CA7C5FCC88F0D6DF7 /* Pods_Runner.framework */; };
|
58215889146B2DBBD9C81410 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2545A56CA7C5FCC88F0D6DF7 /* Pods_Runner.framework */; };
|
||||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||||
AB1F84BC849C548E4DA2D9A4 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23D173C6FEE4F53025C06238 /* Pods_RunnerTests.framework */; };
|
AB1F84BC849C548E4DA2D9A4 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23D173C6FEE4F53025C06238 /* Pods_RunnerTests.framework */; };
|
||||||
|
E88379F7C7DF9A2FA2741EC2 /* Pods_OneSignalNotificationServiceExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC689749C1B738DA836BE8F2 /* Pods_OneSignalNotificationServiceExtension.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@@ -26,9 +29,27 @@
|
|||||||
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
||||||
remoteInfo = Runner;
|
remoteInfo = Runner;
|
||||||
};
|
};
|
||||||
|
48D410742ED7067500A8B931 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 48D4106E2ED7067500A8B931;
|
||||||
|
remoteInfo = OneSignalNotificationServiceExtension;
|
||||||
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
48D4107C2ED7067500A8B931 /* Embed Foundation Extensions */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
dstPath = "";
|
||||||
|
dstSubfolderSpec = 13;
|
||||||
|
files = (
|
||||||
|
48D410762ED7067500A8B931 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */,
|
||||||
|
);
|
||||||
|
name = "Embed Foundation Extensions";
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -43,14 +64,20 @@
|
|||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
01651DC8E3A322D39483596C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
|
01651DC8E3A322D39483596C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
055EB8AF0F56FE3029E6507E /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.release.xcconfig"; path = "Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
18121E1016DEC4038E74F1F0 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
|
18121E1016DEC4038E74F1F0 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
1D94728EBD25906AAA78A0D5 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
|
||||||
23D173C6FEE4F53025C06238 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
23D173C6FEE4F53025C06238 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
2545A56CA7C5FCC88F0D6DF7 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
2545A56CA7C5FCC88F0D6DF7 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
|
4720F73E5117230A69E1B4A0 /* Pods-OneSignalNotificationServiceExtension.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.profile.xcconfig"; path = "Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
48D4106A2ED7062D00A8B931 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||||
|
48D4106F2ED7067500A8B931 /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
5B101E50F7EDE4E6F1714DD8 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.debug.xcconfig"; path = "Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||||
@@ -65,9 +92,43 @@
|
|||||||
A2165E7BD4BCB2253391F0B0 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
A2165E7BD4BCB2253391F0B0 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
B234409A1C87269651420659 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
B234409A1C87269651420659 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
C436CF2D08FCD6AFF7811DE0 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
|
C436CF2D08FCD6AFF7811DE0 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
FC689749C1B738DA836BE8F2 /* Pods_OneSignalNotificationServiceExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OneSignalNotificationServiceExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||||
|
48D410772ED7067500A8B931 /* Exceptions for "OneSignalNotificationServiceExtension" folder in "OneSignalNotificationServiceExtension" target */ = {
|
||||||
|
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
||||||
|
membershipExceptions = (
|
||||||
|
Info.plist,
|
||||||
|
);
|
||||||
|
target = 48D4106E2ED7067500A8B931 /* OneSignalNotificationServiceExtension */;
|
||||||
|
};
|
||||||
|
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||||
|
|
||||||
|
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
48D410702ED7067500A8B931 /* OneSignalNotificationServiceExtension */ = {
|
||||||
|
isa = PBXFileSystemSynchronizedRootGroup;
|
||||||
|
exceptions = (
|
||||||
|
48D410772ED7067500A8B931 /* Exceptions for "OneSignalNotificationServiceExtension" folder in "OneSignalNotificationServiceExtension" target */,
|
||||||
|
);
|
||||||
|
explicitFileTypes = {
|
||||||
|
};
|
||||||
|
explicitFolders = (
|
||||||
|
);
|
||||||
|
path = OneSignalNotificationServiceExtension;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
48D4106C2ED7067500A8B931 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
E88379F7C7DF9A2FA2741EC2 /* Pods_OneSignalNotificationServiceExtension.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
61A54C58DE898B1B550583E8 /* Frameworks */ = {
|
61A54C58DE898B1B550583E8 /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -111,10 +172,12 @@
|
|||||||
children = (
|
children = (
|
||||||
9740EEB11CF90186004384FC /* Flutter */,
|
9740EEB11CF90186004384FC /* Flutter */,
|
||||||
97C146F01CF9000F007C117D /* Runner */,
|
97C146F01CF9000F007C117D /* Runner */,
|
||||||
|
48D410702ED7067500A8B931 /* OneSignalNotificationServiceExtension */,
|
||||||
97C146EF1CF9000F007C117D /* Products */,
|
97C146EF1CF9000F007C117D /* Products */,
|
||||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||||
D39C332D04678D8C49EEA401 /* Pods */,
|
D39C332D04678D8C49EEA401 /* Pods */,
|
||||||
E0C416BADC6D23D3F5D8CCA9 /* Frameworks */,
|
E0C416BADC6D23D3F5D8CCA9 /* Frameworks */,
|
||||||
|
1D94728EBD25906AAA78A0D5 /* GoogleService-Info.plist */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -123,6 +186,7 @@
|
|||||||
children = (
|
children = (
|
||||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
|
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
|
||||||
|
48D4106F2ED7067500A8B931 /* OneSignalNotificationServiceExtension.appex */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -130,6 +194,7 @@
|
|||||||
97C146F01CF9000F007C117D /* Runner */ = {
|
97C146F01CF9000F007C117D /* Runner */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
48D4106A2ED7062D00A8B931 /* Runner.entitlements */,
|
||||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||||
@@ -151,6 +216,9 @@
|
|||||||
C436CF2D08FCD6AFF7811DE0 /* Pods-RunnerTests.debug.xcconfig */,
|
C436CF2D08FCD6AFF7811DE0 /* Pods-RunnerTests.debug.xcconfig */,
|
||||||
01651DC8E3A322D39483596C /* Pods-RunnerTests.release.xcconfig */,
|
01651DC8E3A322D39483596C /* Pods-RunnerTests.release.xcconfig */,
|
||||||
18121E1016DEC4038E74F1F0 /* Pods-RunnerTests.profile.xcconfig */,
|
18121E1016DEC4038E74F1F0 /* Pods-RunnerTests.profile.xcconfig */,
|
||||||
|
5B101E50F7EDE4E6F1714DD8 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */,
|
||||||
|
055EB8AF0F56FE3029E6507E /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */,
|
||||||
|
4720F73E5117230A69E1B4A0 /* Pods-OneSignalNotificationServiceExtension.profile.xcconfig */,
|
||||||
);
|
);
|
||||||
path = Pods;
|
path = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -160,6 +228,7 @@
|
|||||||
children = (
|
children = (
|
||||||
2545A56CA7C5FCC88F0D6DF7 /* Pods_Runner.framework */,
|
2545A56CA7C5FCC88F0D6DF7 /* Pods_Runner.framework */,
|
||||||
23D173C6FEE4F53025C06238 /* Pods_RunnerTests.framework */,
|
23D173C6FEE4F53025C06238 /* Pods_RunnerTests.framework */,
|
||||||
|
FC689749C1B738DA836BE8F2 /* Pods_OneSignalNotificationServiceExtension.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -186,11 +255,33 @@
|
|||||||
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
|
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
|
||||||
productType = "com.apple.product-type.bundle.unit-test";
|
productType = "com.apple.product-type.bundle.unit-test";
|
||||||
};
|
};
|
||||||
|
48D4106E2ED7067500A8B931 /* OneSignalNotificationServiceExtension */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 48D410782ED7067500A8B931 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */;
|
||||||
|
buildPhases = (
|
||||||
|
D2C3589E1C02A832F759D563 /* [CP] Check Pods Manifest.lock */,
|
||||||
|
48D4106B2ED7067500A8B931 /* Sources */,
|
||||||
|
48D4106C2ED7067500A8B931 /* Frameworks */,
|
||||||
|
48D4106D2ED7067500A8B931 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
fileSystemSynchronizedGroups = (
|
||||||
|
48D410702ED7067500A8B931 /* OneSignalNotificationServiceExtension */,
|
||||||
|
);
|
||||||
|
name = OneSignalNotificationServiceExtension;
|
||||||
|
productName = OneSignalNotificationServiceExtension;
|
||||||
|
productReference = 48D4106F2ED7067500A8B931 /* OneSignalNotificationServiceExtension.appex */;
|
||||||
|
productType = "com.apple.product-type.app-extension";
|
||||||
|
};
|
||||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
6FF008E9F6081D18F1331B43 /* [CP] Check Pods Manifest.lock */,
|
6FF008E9F6081D18F1331B43 /* [CP] Check Pods Manifest.lock */,
|
||||||
|
48D4107C2ED7067500A8B931 /* Embed Foundation Extensions */,
|
||||||
9740EEB61CF901F6004384FC /* Run Script */,
|
9740EEB61CF901F6004384FC /* Run Script */,
|
||||||
97C146EA1CF9000F007C117D /* Sources */,
|
97C146EA1CF9000F007C117D /* Sources */,
|
||||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||||
@@ -203,6 +294,7 @@
|
|||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
48D410752ED7067500A8B931 /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
name = Runner;
|
name = Runner;
|
||||||
productName = Runner;
|
productName = Runner;
|
||||||
@@ -216,6 +308,7 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
BuildIndependentTargetsInParallel = YES;
|
BuildIndependentTargetsInParallel = YES;
|
||||||
|
LastSwiftUpdateCheck = 1640;
|
||||||
LastUpgradeCheck = 1510;
|
LastUpgradeCheck = 1510;
|
||||||
ORGANIZATIONNAME = "";
|
ORGANIZATIONNAME = "";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
@@ -223,6 +316,9 @@
|
|||||||
CreatedOnToolsVersion = 14.0;
|
CreatedOnToolsVersion = 14.0;
|
||||||
TestTargetID = 97C146ED1CF9000F007C117D;
|
TestTargetID = 97C146ED1CF9000F007C117D;
|
||||||
};
|
};
|
||||||
|
48D4106E2ED7067500A8B931 = {
|
||||||
|
CreatedOnToolsVersion = 16.4;
|
||||||
|
};
|
||||||
97C146ED1CF9000F007C117D = {
|
97C146ED1CF9000F007C117D = {
|
||||||
CreatedOnToolsVersion = 7.3.1;
|
CreatedOnToolsVersion = 7.3.1;
|
||||||
LastSwiftMigration = 1100;
|
LastSwiftMigration = 1100;
|
||||||
@@ -244,6 +340,7 @@
|
|||||||
targets = (
|
targets = (
|
||||||
97C146ED1CF9000F007C117D /* Runner */,
|
97C146ED1CF9000F007C117D /* Runner */,
|
||||||
331C8080294A63A400263BE5 /* RunnerTests */,
|
331C8080294A63A400263BE5 /* RunnerTests */,
|
||||||
|
48D4106E2ED7067500A8B931 /* OneSignalNotificationServiceExtension */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
@@ -256,6 +353,13 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
48D4106D2ED7067500A8B931 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -264,6 +368,7 @@
|
|||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||||
|
41D57CDF80C517B01729B4E6 /* GoogleService-Info.plist in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -379,6 +484,28 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||||
};
|
};
|
||||||
|
D2C3589E1C02A832F759D563 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||||
|
"${PODS_ROOT}/Manifest.lock",
|
||||||
|
);
|
||||||
|
name = "[CP] Check Pods Manifest.lock";
|
||||||
|
outputFileListPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
"$(DERIVED_FILE_DIR)/Pods-OneSignalNotificationServiceExtension-checkManifestLockResult.txt",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
@@ -390,6 +517,13 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
48D4106B2ED7067500A8B931 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -407,6 +541,11 @@
|
|||||||
target = 97C146ED1CF9000F007C117D /* Runner */;
|
target = 97C146ED1CF9000F007C117D /* Runner */;
|
||||||
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
48D410752ED7067500A8B931 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 48D4106E2ED7067500A8B931 /* OneSignalNotificationServiceExtension */;
|
||||||
|
targetProxy = 48D410742ED7067500A8B931 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
/* End PBXTargetDependency section */
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
/* Begin PBXVariantGroup section */
|
||||||
@@ -487,6 +626,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
@@ -554,6 +694,123 @@
|
|||||||
};
|
};
|
||||||
name = Profile;
|
name = Profile;
|
||||||
};
|
};
|
||||||
|
48D410792ED7067500A8B931 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 5B101E50F7EDE4E6F1714DD8 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 13;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.dbiz.partner.OneSignalNotificationServiceExtension;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
48D4107A2ED7067500A8B931 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 055EB8AF0F56FE3029E6507E /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 13;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.dbiz.partner.OneSignalNotificationServiceExtension;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
48D4107B2ED7067500A8B931 /* Profile */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 4720F73E5117230A69E1B4A0 /* Pods-OneSignalNotificationServiceExtension.profile.xcconfig */;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 13;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.dbiz.partner.OneSignalNotificationServiceExtension;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Profile;
|
||||||
|
};
|
||||||
97C147031CF9000F007C117D /* Debug */ = {
|
97C147031CF9000F007C117D /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
@@ -671,6 +928,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
@@ -695,6 +953,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
DEVELOPMENT_TEAM = 9R5X2DM2C8;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
@@ -725,6 +984,16 @@
|
|||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
|
48D410782ED7067500A8B931 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
48D410792ED7067500A8B931 /* Debug */,
|
||||||
|
48D4107A2ED7067500A8B931 /* Release */,
|
||||||
|
48D4107B2ED7067500A8B931 /* Profile */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
|
|||||||
@@ -73,6 +73,12 @@
|
|||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
|
<CommandLineArguments>
|
||||||
|
<CommandLineArgument
|
||||||
|
argument = "-FIRDebugEnabled"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</CommandLineArgument>
|
||||||
|
</CommandLineArguments>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Profile"
|
buildConfiguration = "Profile"
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ import UIKit
|
|||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
|
// #if DEBUG
|
||||||
|
// var args = ProcessInfo.processInfo.arguments
|
||||||
|
// args.append("-FIRDebugEnabled")
|
||||||
|
// ProcessInfo.processInfo.setValue(args, forKey: "arguments")
|
||||||
|
// #endif
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
}
|
}
|
||||||
|
|||||||
30
ios/Runner/GoogleService-Info.plist
Normal file
30
ios/Runner/GoogleService-Info.plist
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>API_KEY</key>
|
||||||
|
<string>AIzaSyAMgNFpkK0ss_uzNl51OqGyQHd0vFc9SxQ</string>
|
||||||
|
<key>GCM_SENDER_ID</key>
|
||||||
|
<string>147309310656</string>
|
||||||
|
<key>PLIST_VERSION</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>BUNDLE_ID</key>
|
||||||
|
<string>com.dbiz.partner</string>
|
||||||
|
<key>PROJECT_ID</key>
|
||||||
|
<string>dbiz-partner</string>
|
||||||
|
<key>STORAGE_BUCKET</key>
|
||||||
|
<string>dbiz-partner.firebasestorage.app</string>
|
||||||
|
<key>IS_ADS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_GCM_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_SIGNIN_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>GOOGLE_APP_ID</key>
|
||||||
|
<string>1:147309310656:ios:aa59724d2c6b4620dc7325</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
|
<true/>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
@@ -22,16 +24,28 @@
|
|||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
|
<false/>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>NSCameraUsageDescription</key>
|
||||||
|
<string>Ứng dụng cần quyền truy cập camera để quét mã QR và chụp ảnh giấy tờ xác thực (CCCD/CMND, chứng chỉ hành nghề)</string>
|
||||||
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
|
<string>Ứng dụng cần quyền truy cập microphone để ghi âm video nếu cần</string>
|
||||||
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
<string>Ứng dụng cần quyền truy cập thư viện ảnh để chọn ảnh giấy tờ xác thực và mã QR từ thiết bị của bạn</string>
|
||||||
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
|
<string>Ứng dụng sử dụng vị trí để cải thiện trải nghiệm và đề xuất showroom gần bạn</string>
|
||||||
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
|
<true/>
|
||||||
|
<key>UIBackgroundModes</key>
|
||||||
|
<array>
|
||||||
|
<string>remote-notification</string>
|
||||||
|
</array>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
<key>UIMainStoryboardFile</key>
|
<key>UIMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>NSCameraUsageDescription</key>
|
|
||||||
<string>This app needs camera access to scan QR codes</string>
|
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
|
||||||
<string>This app needs photos access to get QR code from photo library</string>
|
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
@@ -45,11 +59,5 @@
|
|||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
|
||||||
<true/>
|
|
||||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
|
||||||
<true/>
|
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
|
||||||
<false/>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
12
ios/Runner/Runner.entitlements
Normal file
12
ios/Runner/Runner.entitlements
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>aps-environment</key>
|
||||||
|
<string>development</string>
|
||||||
|
<key>com.apple.security.application-groups</key>
|
||||||
|
<array>
|
||||||
|
<string>group.com.dbiz.partner.onesignal</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
12
lib/app.dart
12
lib/app.dart
@@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
|
|
||||||
import 'package:worker/core/router/app_router.dart';
|
import 'package:worker/core/router/app_router.dart';
|
||||||
import 'package:worker/core/theme/app_theme.dart';
|
import 'package:worker/core/theme/app_theme.dart';
|
||||||
|
import 'package:worker/core/theme/theme_provider.dart';
|
||||||
import 'package:worker/generated/l10n/app_localizations.dart';
|
import 'package:worker/generated/l10n/app_localizations.dart';
|
||||||
|
|
||||||
/// Root application widget for Worker Mobile App
|
/// Root application widget for Worker Mobile App
|
||||||
@@ -22,6 +23,9 @@ class WorkerApp extends ConsumerWidget {
|
|||||||
// Watch router provider to get auth-aware router
|
// Watch router provider to get auth-aware router
|
||||||
final router = ref.watch(routerProvider);
|
final router = ref.watch(routerProvider);
|
||||||
|
|
||||||
|
// Watch theme settings for dynamic theming
|
||||||
|
final themeSettings = ref.watch(themeSettingsProvider);
|
||||||
|
|
||||||
return MaterialApp.router(
|
return MaterialApp.router(
|
||||||
// ==================== App Configuration ====================
|
// ==================== App Configuration ====================
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
@@ -33,10 +37,10 @@ class WorkerApp extends ConsumerWidget {
|
|||||||
routerConfig: router,
|
routerConfig: router,
|
||||||
|
|
||||||
// ==================== Theme Configuration ====================
|
// ==================== Theme Configuration ====================
|
||||||
// Material 3 theme with brand colors (Primary Blue: #005B9A)
|
// Material 3 theme with dynamic seed color from settings
|
||||||
theme: AppTheme.lightTheme(),
|
theme: AppTheme.lightTheme(themeSettings.seedColor),
|
||||||
darkTheme: AppTheme.darkTheme(),
|
darkTheme: AppTheme.darkTheme(themeSettings.seedColor),
|
||||||
themeMode: ThemeMode.light, // TODO: Make this configurable from settings
|
themeMode: themeSettings.themeMode,
|
||||||
// ==================== Localization Configuration ====================
|
// ==================== Localization Configuration ====================
|
||||||
// Support for Vietnamese (primary) and English (secondary)
|
// Support for Vietnamese (primary) and English (secondary)
|
||||||
localizationsDelegates: const [
|
localizationsDelegates: const [
|
||||||
|
|||||||
@@ -145,6 +145,25 @@ class ApiConstants {
|
|||||||
/// Body: { "method": "whatsapp|telegram|sms" }
|
/// Body: { "method": "whatsapp|telegram|sms" }
|
||||||
static const String shareReferral = '/loyalty/referral/share';
|
static const String shareReferral = '/loyalty/referral/share';
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Favorites/Wishlist Endpoints (Frappe ERPNext)
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Get favorite/wishlist items for current user
|
||||||
|
/// POST /api/method/building_material.building_material.api.item_wishlist.get_list
|
||||||
|
/// Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
static const String getFavorites = '/building_material.building_material.api.item_wishlist.get_list';
|
||||||
|
|
||||||
|
/// Add item to wishlist
|
||||||
|
/// POST /api/method/building_material.building_material.api.item_wishlist.add_to_wishlist
|
||||||
|
/// Body: { "item_id": "GIB20 G04" }
|
||||||
|
static const String addToFavorites = '/building_material.building_material.api.item_wishlist.add_to_wishlist';
|
||||||
|
|
||||||
|
/// Remove item from wishlist
|
||||||
|
/// POST /api/method/building_material.building_material.api.item_wishlist.remove_from_wishlist
|
||||||
|
/// Body: { "item_id": "GIB20 G04" }
|
||||||
|
static const String removeFromFavorites = '/building_material.building_material.api.item_wishlist.remove_from_wishlist';
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Product Endpoints
|
// Product Endpoints
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -192,12 +211,51 @@ class ApiConstants {
|
|||||||
// Order Endpoints
|
// Order Endpoints
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
/// Create new order
|
/// Get order status list (requires sid and csrf_token)
|
||||||
/// POST /orders
|
/// POST /api/method/building_material.building_material.api.sales_order.get_order_status_list
|
||||||
/// Body: { "items": [...], "deliveryAddress": {...}, "paymentMethod": "..." }
|
/// Returns: { "message": [{ "status": "...", "label": "...", "color": "...", "index": 0 }] }
|
||||||
static const String createOrder = '/orders';
|
static const String getOrderStatusList = '/building_material.building_material.api.sales_order.get_order_status_list';
|
||||||
|
|
||||||
/// Get user's orders
|
/// Create new order (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.sales_order.save
|
||||||
|
/// Body: { "transaction_date": "...", "delivery_date": "...", "items": [...], ... }
|
||||||
|
static const String createOrder = '/building_material.building_material.api.sales_order.save';
|
||||||
|
|
||||||
|
/// Generate QR code for payment (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.v1.qrcode.generate
|
||||||
|
/// Body: { "order_id": "SAL-ORD-2025-00048" }
|
||||||
|
/// Returns: { "message": { "qr_code": "...", "amount": null, "transaction_id": "...", "bank_info": {...} } }
|
||||||
|
static const String generateQrCode = '/building_material.building_material.api.v1.qrcode.generate';
|
||||||
|
|
||||||
|
/// Upload file (bill/invoice/attachment) (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/upload_file
|
||||||
|
/// Form-data: { "file": File, "is_private": "1", "folder": "Home/Attachments", "doctype": "Sales Order", "docname": "SAL-ORD-2025-00058-1", "optimize": "true" }
|
||||||
|
/// Returns: { "message": { "file_url": "...", "file_name": "...", ... } }
|
||||||
|
static const String uploadFile = '/upload_file';
|
||||||
|
|
||||||
|
/// Get list of orders (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.sales_order.get_list
|
||||||
|
/// Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
/// Returns: { "message": [...] }
|
||||||
|
static const String getOrdersList = '/building_material.building_material.api.sales_order.get_list';
|
||||||
|
|
||||||
|
/// Get order details (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.sales_order.get_detail
|
||||||
|
/// Body: { "name": "SAL-ORD-2025-00058-1" }
|
||||||
|
/// Returns: { "message": {...} }
|
||||||
|
static const String getOrderDetail = '/building_material.building_material.api.sales_order.get_detail';
|
||||||
|
|
||||||
|
/// Update order address (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.sales_order.update
|
||||||
|
/// Body: { "name": "SAL-ORD-2025-00053", "shipping_address_name": "...", "customer_address": "..." }
|
||||||
|
static const String updateOrder = '/building_material.building_material.api.sales_order.update';
|
||||||
|
|
||||||
|
/// Cancel order (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.sales_order.cancel
|
||||||
|
/// Body: { "name": "SAL-ORD-2025-00054" }
|
||||||
|
static const String cancelOrder = '/building_material.building_material.api.sales_order.cancel';
|
||||||
|
|
||||||
|
/// Get user's orders (legacy endpoint - may be deprecated)
|
||||||
/// GET /orders?status={status}&page={page}&limit={limit}
|
/// GET /orders?status={status}&page={page}&limit={limit}
|
||||||
static const String getOrders = '/orders';
|
static const String getOrders = '/orders';
|
||||||
|
|
||||||
@@ -205,10 +263,6 @@ class ApiConstants {
|
|||||||
/// GET /orders/{orderId}
|
/// GET /orders/{orderId}
|
||||||
static const String getOrderDetails = '/orders';
|
static const String getOrderDetails = '/orders';
|
||||||
|
|
||||||
/// Cancel order
|
|
||||||
/// POST /orders/{orderId}/cancel
|
|
||||||
static const String cancelOrder = '/orders';
|
|
||||||
|
|
||||||
/// Get payment transactions
|
/// Get payment transactions
|
||||||
/// GET /payments?page={page}&limit={limit}
|
/// GET /payments?page={page}&limit={limit}
|
||||||
static const String getPayments = '/payments';
|
static const String getPayments = '/payments';
|
||||||
@@ -217,32 +271,144 @@ class ApiConstants {
|
|||||||
/// GET /payments/{paymentId}
|
/// GET /payments/{paymentId}
|
||||||
static const String getPaymentDetails = '/payments';
|
static const String getPaymentDetails = '/payments';
|
||||||
|
|
||||||
|
/// Get payment list (Frappe API)
|
||||||
|
/// POST /api/method/building_material.building_material.api.payment.get_list
|
||||||
|
/// Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
static const String getPaymentList =
|
||||||
|
'/building_material.building_material.api.payment.get_list';
|
||||||
|
|
||||||
|
/// Get payment detail (Frappe API)
|
||||||
|
/// POST /api/method/building_material.building_material.api.payment.get_detail
|
||||||
|
/// Body: { "name": "ACC-PAY-2025-00020" }
|
||||||
|
static const String getPaymentDetail =
|
||||||
|
'/building_material.building_material.api.payment.get_detail';
|
||||||
|
|
||||||
|
/// Get invoice list (Frappe API)
|
||||||
|
/// POST /api/method/building_material.building_material.api.invoice.get_list
|
||||||
|
/// Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
static const String getInvoiceList =
|
||||||
|
'/building_material.building_material.api.invoice.get_list';
|
||||||
|
|
||||||
|
/// Get invoice detail (Frappe API)
|
||||||
|
/// POST /api/method/building_material.building_material.api.invoice.get_detail
|
||||||
|
/// Body: { "name": "ACC-SINV-2025-00041" }
|
||||||
|
static const String getInvoiceDetail =
|
||||||
|
'/building_material.building_material.api.invoice.get_detail';
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Project Endpoints
|
// Project Endpoints (Frappe ERPNext)
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
/// Create new project
|
/// Get project status list (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.project.get_project_status_list
|
||||||
|
/// Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
/// Returns: { "message": [{ "status": "...", "label": "...", "color": "...", "index": 0 }] }
|
||||||
|
static const String getProjectStatusList =
|
||||||
|
'/building_material.building_material.api.project.get_project_status_list';
|
||||||
|
|
||||||
|
/// Get list of project submissions (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.project.get_list
|
||||||
|
/// Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
/// Returns: { "message": [{ "name": "...", "designed_area": "...", "design_area": 0, ... }] }
|
||||||
|
static const String getProjectList =
|
||||||
|
'/building_material.building_material.api.project.get_list';
|
||||||
|
|
||||||
|
/// Save (create/update) project submission
|
||||||
|
/// POST /api/method/building_material.building_material.api.project.save
|
||||||
|
/// Body: {
|
||||||
|
/// "name": "...", // optional for new, required for update
|
||||||
|
/// "designed_area": "Project Name",
|
||||||
|
/// "address_of_project": "...",
|
||||||
|
/// "project_owner": "...",
|
||||||
|
/// "design_firm": "...",
|
||||||
|
/// "contruction_contractor": "...",
|
||||||
|
/// "design_area": 350.5,
|
||||||
|
/// "products_included_in_the_design": "...",
|
||||||
|
/// "project_progress": "progress_id", // from ProjectProgress.id
|
||||||
|
/// "expected_commencement_date": "2026-01-15",
|
||||||
|
/// "description": "...",
|
||||||
|
/// "request_date": "2025-11-26 09:30:00"
|
||||||
|
/// }
|
||||||
|
static const String saveProject =
|
||||||
|
'/building_material.building_material.api.project.save';
|
||||||
|
|
||||||
|
/// Get project detail (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.project.get_detail
|
||||||
|
/// Body: { "name": "#DA00011" }
|
||||||
|
/// Returns: Full project detail with all fields
|
||||||
|
static const String getProjectDetail =
|
||||||
|
'/building_material.building_material.api.project.get_detail';
|
||||||
|
|
||||||
|
/// Delete project file/attachment (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/frappe.desk.form.utils.remove_attach
|
||||||
|
/// Form-data: { "fid": "file_id", "dt": "Architectural Project", "dn": "project_name" }
|
||||||
|
static const String removeProjectFile = '/frappe.desk.form.utils.remove_attach';
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Sample Project / Model House Endpoints (Frappe ERPNext)
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Get list of sample/model house projects (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.sample_project.get_list
|
||||||
|
/// Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
/// Returns: { "message": [{ "name": "...", "project_name": "...", "notes": "...", "link": "...", "thumbnail": "..." }] }
|
||||||
|
static const String getSampleProjectList =
|
||||||
|
'/building_material.building_material.api.sample_project.get_list';
|
||||||
|
|
||||||
|
/// Get detail of a sample/model house project (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.sample_project.get_detail
|
||||||
|
/// Body: { "name": "PROJ-0001" }
|
||||||
|
/// Returns: { "message": { "name": "...", "project_name": "...", "notes": "...", "link": "...", "thumbnail": "...", "files_list": [...] } }
|
||||||
|
static const String getSampleProjectDetail =
|
||||||
|
'/building_material.building_material.api.sample_project.get_detail';
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Design Request Endpoints (Frappe ERPNext)
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Get list of design requests (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.design_request.get_list
|
||||||
|
/// Body: { "limit_start": 0, "limit_page_length": 0 }
|
||||||
|
/// Returns: { "message": [{ "name": "...", "subject": "...", "description": "...", "dateline": "...", "status": "...", "status_color": "..." }] }
|
||||||
|
static const String getDesignRequestList =
|
||||||
|
'/building_material.building_material.api.design_request.get_list';
|
||||||
|
|
||||||
|
/// Get detail of a design request (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.design_request.get_detail
|
||||||
|
/// Body: { "name": "ISS-2025-00005" }
|
||||||
|
/// Returns: { "message": { "name": "...", "subject": "...", "description": "...", "dateline": "...", "status": "...", "status_color": "...", "files_list": [...] } }
|
||||||
|
static const String getDesignRequestDetail =
|
||||||
|
'/building_material.building_material.api.design_request.get_detail';
|
||||||
|
|
||||||
|
/// Create a new design request (requires sid and csrf_token)
|
||||||
|
/// POST /api/method/building_material.building_material.api.design_request.create
|
||||||
|
/// Body: { "subject": "...", "area": "...", "region": "...", "desired_style": "...", "estimated_budget": "...", "detailed_requirements": "...", "dateline": "..." }
|
||||||
|
/// Returns: { "message": { "success": true, "data": { "name": "ISS-2025-00006" } } }
|
||||||
|
static const String createDesignRequest =
|
||||||
|
'/building_material.building_material.api.design_request.create';
|
||||||
|
|
||||||
|
/// Create new project (legacy endpoint - may be deprecated)
|
||||||
/// POST /projects
|
/// POST /projects
|
||||||
static const String createProject = '/projects';
|
static const String createProject = '/projects';
|
||||||
|
|
||||||
/// Get user's projects
|
/// Get user's projects (legacy endpoint - may be deprecated)
|
||||||
/// GET /projects?status={status}&page={page}&limit={limit}
|
/// GET /projects?status={status}&page={page}&limit={limit}
|
||||||
static const String getProjects = '/projects';
|
static const String getProjects = '/projects';
|
||||||
|
|
||||||
/// Get project details by ID
|
/// Get project details by ID (legacy endpoint - may be deprecated)
|
||||||
/// GET /projects/{projectId}
|
/// GET /projects/{projectId}
|
||||||
static const String getProjectDetails = '/projects';
|
static const String getProjectDetails = '/projects';
|
||||||
|
|
||||||
/// Update project
|
/// Update project (legacy endpoint - may be deprecated)
|
||||||
/// PUT /projects/{projectId}
|
/// PUT /projects/{projectId}
|
||||||
static const String updateProject = '/projects';
|
static const String updateProject = '/projects';
|
||||||
|
|
||||||
/// Update project progress
|
/// Update project progress (legacy endpoint - may be deprecated)
|
||||||
/// PATCH /projects/{projectId}/progress
|
/// PATCH /projects/{projectId}/progress
|
||||||
/// Body: { "progress": 75 }
|
/// Body: { "progress": 75 }
|
||||||
static const String updateProjectProgress = '/projects';
|
static const String updateProjectProgress = '/projects';
|
||||||
|
|
||||||
/// Delete project
|
/// Delete project (legacy endpoint - may be deprecated)
|
||||||
/// DELETE /projects/{projectId}
|
/// DELETE /projects/{projectId}
|
||||||
static const String deleteProject = '/projects';
|
static const String deleteProject = '/projects';
|
||||||
|
|
||||||
|
|||||||
@@ -51,12 +51,25 @@ class HiveBoxNames {
|
|||||||
/// Address book
|
/// Address book
|
||||||
static const String addressBox = 'address_box';
|
static const String addressBox = 'address_box';
|
||||||
|
|
||||||
/// Favorite products
|
/// Favorite products data (cached from wishlist API)
|
||||||
static const String favoriteBox = 'favorite_box';
|
static const String favoriteProductsBox = 'favorite_products_box';
|
||||||
|
|
||||||
/// Offline request queue for failed API calls
|
/// Offline request queue for failed API calls
|
||||||
static const String offlineQueueBox = 'offline_queue_box';
|
static const String offlineQueueBox = 'offline_queue_box';
|
||||||
|
|
||||||
|
/// City and Ward boxes for location data
|
||||||
|
static const String cityBox = 'city_box';
|
||||||
|
static const String wardBox = 'ward_box';
|
||||||
|
|
||||||
|
/// Order status list cache
|
||||||
|
static const String orderStatusBox = 'order_status_box';
|
||||||
|
|
||||||
|
/// Project status list cache
|
||||||
|
static const String projectStatusBox = 'project_status_box';
|
||||||
|
|
||||||
|
/// Project progress list cache (construction stages)
|
||||||
|
static const String projectProgressBox = 'project_progress_box';
|
||||||
|
|
||||||
/// Get all box names for initialization
|
/// Get all box names for initialization
|
||||||
static List<String> get allBoxes => [
|
static List<String> get allBoxes => [
|
||||||
userBox,
|
userBox,
|
||||||
@@ -67,12 +80,17 @@ class HiveBoxNames {
|
|||||||
quotes,
|
quotes,
|
||||||
loyaltyBox,
|
loyaltyBox,
|
||||||
rewardsBox,
|
rewardsBox,
|
||||||
|
cityBox,
|
||||||
|
wardBox,
|
||||||
|
orderStatusBox,
|
||||||
|
projectStatusBox,
|
||||||
|
projectProgressBox,
|
||||||
settingsBox,
|
settingsBox,
|
||||||
cacheBox,
|
cacheBox,
|
||||||
syncStateBox,
|
syncStateBox,
|
||||||
notificationBox,
|
notificationBox,
|
||||||
addressBox,
|
addressBox,
|
||||||
favoriteBox,
|
favoriteProductsBox,
|
||||||
offlineQueueBox,
|
offlineQueueBox,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -114,7 +132,7 @@ class HiveTypeIds {
|
|||||||
static const int chatRoomModel = 18;
|
static const int chatRoomModel = 18;
|
||||||
static const int messageModel = 19;
|
static const int messageModel = 19;
|
||||||
|
|
||||||
// Extended Models (20-29)
|
// Extended Models (20-30)
|
||||||
static const int notificationModel = 20;
|
static const int notificationModel = 20;
|
||||||
static const int showroomModel = 21;
|
static const int showroomModel = 21;
|
||||||
static const int showroomProductModel = 22;
|
static const int showroomProductModel = 22;
|
||||||
@@ -125,30 +143,36 @@ class HiveTypeIds {
|
|||||||
static const int categoryModel = 27;
|
static const int categoryModel = 27;
|
||||||
static const int favoriteModel = 28;
|
static const int favoriteModel = 28;
|
||||||
static const int businessUnitModel = 29;
|
static const int businessUnitModel = 29;
|
||||||
|
static const int addressModel = 30;
|
||||||
|
static const int cityModel = 31;
|
||||||
|
static const int wardModel = 32;
|
||||||
|
static const int orderStatusModel = 62;
|
||||||
|
static const int projectStatusModel = 63;
|
||||||
|
static const int projectProgressModel = 64;
|
||||||
|
|
||||||
// Enums (30-59)
|
// Enums (33-61)
|
||||||
static const int userRole = 30;
|
static const int userRole = 33;
|
||||||
static const int userStatus = 31;
|
static const int userStatus = 34;
|
||||||
static const int loyaltyTier = 32;
|
static const int loyaltyTier = 35;
|
||||||
static const int orderStatus = 33;
|
static const int orderStatus = 36;
|
||||||
static const int invoiceType = 34;
|
static const int invoiceType = 37;
|
||||||
static const int invoiceStatus = 35;
|
static const int invoiceStatus = 38;
|
||||||
static const int paymentMethod = 36;
|
static const int paymentMethod = 39;
|
||||||
static const int paymentStatus = 37;
|
static const int paymentStatus = 40;
|
||||||
static const int entryType = 38;
|
static const int entryType = 41;
|
||||||
static const int entrySource = 39;
|
static const int entrySource = 42;
|
||||||
static const int complaintStatus = 40;
|
static const int complaintStatus = 43;
|
||||||
static const int giftCategory = 41;
|
static const int giftCategory = 44;
|
||||||
static const int giftStatus = 42;
|
static const int giftStatus = 45;
|
||||||
static const int pointsStatus = 43;
|
static const int pointsStatus = 46;
|
||||||
static const int projectType = 44;
|
static const int projectType = 47;
|
||||||
static const int submissionStatus = 45;
|
static const int submissionStatus = 48;
|
||||||
static const int designStatus = 46;
|
static const int designStatus = 49;
|
||||||
static const int quoteStatus = 47;
|
static const int quoteStatus = 50;
|
||||||
static const int roomType = 48;
|
static const int roomType = 51;
|
||||||
static const int contentType = 49;
|
static const int contentType = 52;
|
||||||
static const int reminderType = 50;
|
static const int reminderType = 53;
|
||||||
static const int notificationType = 51;
|
static const int notificationType = 54;
|
||||||
|
|
||||||
// Aliases for backward compatibility and clarity
|
// Aliases for backward compatibility and clarity
|
||||||
static const int memberTier = loyaltyTier; // Alias for loyaltyTier
|
static const int memberTier = loyaltyTier; // Alias for loyaltyTier
|
||||||
@@ -183,7 +207,81 @@ class HiveKeys {
|
|||||||
static const String lastSyncTime = 'last_sync_time';
|
static const String lastSyncTime = 'last_sync_time';
|
||||||
static const String schemaVersion = 'schema_version';
|
static const String schemaVersion = 'schema_version';
|
||||||
static const String encryptionEnabled = 'encryption_enabled';
|
static const String encryptionEnabled = 'encryption_enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Order Status Indices
|
||||||
|
///
|
||||||
|
/// Index values for order statuses stored in Hive.
|
||||||
|
/// These correspond to the index field in OrderStatusModel.
|
||||||
|
/// Use these constants to compare order status by index instead of hardcoded strings.
|
||||||
|
///
|
||||||
|
/// API Response Structure:
|
||||||
|
/// - status: "Pending approval" (English status name)
|
||||||
|
/// - label: "Chờ phê duyệt" (Vietnamese display label)
|
||||||
|
/// - color: "Warning" (Status color indicator)
|
||||||
|
/// - index: 1 (Unique identifier)
|
||||||
|
class OrderStatusIndex {
|
||||||
|
// Private constructor to prevent instantiation
|
||||||
|
OrderStatusIndex._();
|
||||||
|
|
||||||
|
/// Pending approval - "Chờ phê duyệt"
|
||||||
|
/// Color: Warning
|
||||||
|
static const int pendingApproval = 1;
|
||||||
|
|
||||||
|
/// Manager Review - "Manager Review"
|
||||||
|
/// Color: Warning
|
||||||
|
static const int managerReview = 2;
|
||||||
|
|
||||||
|
/// Processing - "Đang xử lý"
|
||||||
|
/// Color: Info
|
||||||
|
static const int processing = 3;
|
||||||
|
|
||||||
|
/// Completed - "Hoàn thành"
|
||||||
|
/// Color: Success
|
||||||
|
static const int completed = 4;
|
||||||
|
|
||||||
|
/// Rejected - "Từ chối"
|
||||||
|
/// Color: Danger
|
||||||
|
static const int rejected = 5;
|
||||||
|
|
||||||
|
/// Cancelled - "HỦY BỎ"
|
||||||
|
/// Color: Danger
|
||||||
|
static const int cancelled = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Project Status Indices
|
||||||
|
///
|
||||||
|
/// Index values for project statuses stored in Hive.
|
||||||
|
/// These correspond to the index field in ProjectStatusModel.
|
||||||
|
///
|
||||||
|
/// API Response Structure:
|
||||||
|
/// - status: "Pending approval" (English status name)
|
||||||
|
/// - label: "Chờ phê duyệt" (Vietnamese display label)
|
||||||
|
/// - color: "Warning" (Status color indicator)
|
||||||
|
/// - index: 1 (Unique identifier)
|
||||||
|
class ProjectStatusIndex {
|
||||||
|
// Private constructor to prevent instantiation
|
||||||
|
ProjectStatusIndex._();
|
||||||
|
|
||||||
|
/// Pending approval - "Chờ phê duyệt"
|
||||||
|
/// Color: Warning
|
||||||
|
static const int pendingApproval = 1;
|
||||||
|
|
||||||
|
/// Approved - "Đã được phê duyệt"
|
||||||
|
/// Color: Success
|
||||||
|
static const int approved = 2;
|
||||||
|
|
||||||
|
/// Rejected - "Từ chối"
|
||||||
|
/// Color: Danger
|
||||||
|
static const int rejected = 3;
|
||||||
|
|
||||||
|
/// Cancelled - "HỦY BỎ"
|
||||||
|
/// Color: Danger
|
||||||
|
static const int cancelled = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Hive Keys (continued)
|
||||||
|
extension HiveKeysContinued on HiveKeys {
|
||||||
// Cache Box Keys
|
// Cache Box Keys
|
||||||
static const String productsCacheKey = 'products_cache';
|
static const String productsCacheKey = 'products_cache';
|
||||||
static const String categoriesCacheKey = 'categories_cache';
|
static const String categoriesCacheKey = 'categories_cache';
|
||||||
|
|||||||
161
lib/core/database/app_settings_box.dart
Normal file
161
lib/core/database/app_settings_box.dart
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
import 'package:hive_ce/hive.dart';
|
||||||
|
|
||||||
|
/// Central app settings storage using Hive
|
||||||
|
///
|
||||||
|
/// This box stores all app-level settings including:
|
||||||
|
/// - Theme settings (seed color, theme mode)
|
||||||
|
/// - Language preferences
|
||||||
|
/// - Notification settings
|
||||||
|
/// - User preferences
|
||||||
|
///
|
||||||
|
/// See APP_SETTINGS.md for complete documentation.
|
||||||
|
class AppSettingsBox {
|
||||||
|
AppSettingsBox._();
|
||||||
|
|
||||||
|
static const String boxName = 'app_settings';
|
||||||
|
|
||||||
|
// ==================== Keys ====================
|
||||||
|
|
||||||
|
// Theme Settings
|
||||||
|
static const String seedColorId = 'seed_color_id';
|
||||||
|
static const String themeMode = 'theme_mode';
|
||||||
|
|
||||||
|
// Language Settings
|
||||||
|
static const String languageCode = 'language_code';
|
||||||
|
|
||||||
|
// Notification Settings
|
||||||
|
static const String notificationsEnabled = 'notifications_enabled';
|
||||||
|
static const String orderNotifications = 'order_notifications';
|
||||||
|
static const String promotionNotifications = 'promotion_notifications';
|
||||||
|
static const String chatNotifications = 'chat_notifications';
|
||||||
|
|
||||||
|
// User Preferences
|
||||||
|
static const String onboardingCompleted = 'onboarding_completed';
|
||||||
|
static const String biometricEnabled = 'biometric_enabled';
|
||||||
|
static const String rememberLogin = 'remember_login';
|
||||||
|
|
||||||
|
// App State
|
||||||
|
static const String lastSyncTime = 'last_sync_time';
|
||||||
|
static const String appVersion = 'app_version';
|
||||||
|
static const String firstLaunchDate = 'first_launch_date';
|
||||||
|
|
||||||
|
// ==================== Box Instance ====================
|
||||||
|
|
||||||
|
static Box<dynamic>? _box;
|
||||||
|
|
||||||
|
/// Get the app settings box instance
|
||||||
|
static Box<dynamic> get box {
|
||||||
|
if (_box == null || !_box!.isOpen) {
|
||||||
|
throw StateError(
|
||||||
|
'AppSettingsBox not initialized. Call AppSettingsBox.init() first.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return _box!;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initialize the app settings box - call before runApp()
|
||||||
|
static Future<void> init() async {
|
||||||
|
_box = await Hive.openBox<dynamic>(boxName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Close the box
|
||||||
|
static Future<void> close() async {
|
||||||
|
await _box?.close();
|
||||||
|
_box = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== Generic Getters/Setters ====================
|
||||||
|
|
||||||
|
/// Get a value from the box
|
||||||
|
static T? get<T>(String key, {T? defaultValue}) {
|
||||||
|
return box.get(key, defaultValue: defaultValue) as T?;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set a value in the box
|
||||||
|
static Future<void> set<T>(String key, T value) async {
|
||||||
|
await box.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Remove a value from the box
|
||||||
|
static Future<void> remove(String key) async {
|
||||||
|
await box.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Check if a key exists
|
||||||
|
static bool has(String key) {
|
||||||
|
return box.containsKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Clear all settings
|
||||||
|
static Future<void> clear() async {
|
||||||
|
await box.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== Theme Helpers ====================
|
||||||
|
|
||||||
|
/// Get seed color ID
|
||||||
|
static String getSeedColorId() {
|
||||||
|
return get<String>(seedColorId, defaultValue: 'blue') ?? 'blue';
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set seed color ID
|
||||||
|
static Future<void> setSeedColorId(String colorId) async {
|
||||||
|
await set(seedColorId, colorId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get theme mode index (0=system, 1=light, 2=dark)
|
||||||
|
static int getThemeModeIndex() {
|
||||||
|
return get<int>(themeMode, defaultValue: 0) ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set theme mode index
|
||||||
|
static Future<void> setThemeModeIndex(int index) async {
|
||||||
|
await set(themeMode, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== Language Helpers ====================
|
||||||
|
|
||||||
|
/// Get language code (vi, en)
|
||||||
|
static String getLanguageCode() {
|
||||||
|
return get<String>(languageCode, defaultValue: 'vi') ?? 'vi';
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set language code
|
||||||
|
static Future<void> setLanguageCode(String code) async {
|
||||||
|
await set(languageCode, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== Notification Helpers ====================
|
||||||
|
|
||||||
|
/// Check if notifications are enabled
|
||||||
|
static bool areNotificationsEnabled() {
|
||||||
|
return get<bool>(notificationsEnabled, defaultValue: true) ?? true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set notifications enabled
|
||||||
|
static Future<void> setNotificationsEnabled(bool enabled) async {
|
||||||
|
await set(notificationsEnabled, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== User Preference Helpers ====================
|
||||||
|
|
||||||
|
/// Check if onboarding is completed
|
||||||
|
static bool isOnboardingCompleted() {
|
||||||
|
return get<bool>(onboardingCompleted, defaultValue: false) ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set onboarding completed
|
||||||
|
static Future<void> setOnboardingCompleted(bool completed) async {
|
||||||
|
await set(onboardingCompleted, completed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Check if biometric is enabled
|
||||||
|
static bool isBiometricEnabled() {
|
||||||
|
return get<bool>(biometricEnabled, defaultValue: false) ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set biometric enabled
|
||||||
|
static Future<void> setBiometricEnabled(bool enabled) async {
|
||||||
|
await set(biometricEnabled, enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:hive_ce_flutter/hive_flutter.dart';
|
||||||
|
|
||||||
import 'package:worker/core/database/database_manager.dart';
|
import 'package:worker/core/database/database_manager.dart';
|
||||||
import 'package:worker/core/database/hive_service.dart';
|
import 'package:worker/core/database/hive_service.dart';
|
||||||
@@ -53,6 +54,9 @@ class HiveInitializer {
|
|||||||
|
|
||||||
final dbManager = DatabaseManager();
|
final dbManager = DatabaseManager();
|
||||||
|
|
||||||
|
// Migration: Delete old favoriteBox (deprecated, replaced with favoriteProductsBox)
|
||||||
|
await _deleteLegacyFavoriteBox(verbose);
|
||||||
|
|
||||||
// Clear expired cache on app start
|
// Clear expired cache on app start
|
||||||
await dbManager.clearExpiredCache();
|
await dbManager.clearExpiredCache();
|
||||||
|
|
||||||
@@ -97,6 +101,33 @@ class HiveInitializer {
|
|||||||
await hiveService.clearUserData();
|
await hiveService.clearUserData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Delete legacy favoriteBox (migration helper)
|
||||||
|
///
|
||||||
|
/// The old favoriteBox stored FavoriteModel which has been removed.
|
||||||
|
/// This method deletes the old box to prevent typeId errors.
|
||||||
|
static Future<void> _deleteLegacyFavoriteBox(bool verbose) async {
|
||||||
|
try {
|
||||||
|
const legacyBoxName = 'favorite_box';
|
||||||
|
|
||||||
|
// Check if the old box exists
|
||||||
|
if (await Hive.boxExists(legacyBoxName)) {
|
||||||
|
if (verbose) {
|
||||||
|
debugPrint('HiveInitializer: Deleting legacy favoriteBox...');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the box from disk
|
||||||
|
await Hive.deleteBoxFromDisk(legacyBoxName);
|
||||||
|
|
||||||
|
if (verbose) {
|
||||||
|
debugPrint('HiveInitializer: Legacy favoriteBox deleted successfully');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('HiveInitializer: Error deleting legacy favoriteBox: $e');
|
||||||
|
// Don't rethrow - this is just a cleanup operation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Get database statistics
|
/// Get database statistics
|
||||||
///
|
///
|
||||||
/// Returns statistics about all Hive boxes.
|
/// Returns statistics about all Hive boxes.
|
||||||
|
|||||||
@@ -102,9 +102,18 @@ class HiveService {
|
|||||||
debugPrint(
|
debugPrint(
|
||||||
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.orderStatus) ? "✓" : "✗"} OrderStatus adapter',
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.orderStatus) ? "✓" : "✗"} OrderStatus adapter',
|
||||||
);
|
);
|
||||||
|
debugPrint(
|
||||||
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.orderStatusModel) ? "✓" : "✗"} OrderStatusModel adapter',
|
||||||
|
);
|
||||||
debugPrint(
|
debugPrint(
|
||||||
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.projectType) ? "✓" : "✗"} ProjectType adapter',
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.projectType) ? "✓" : "✗"} ProjectType adapter',
|
||||||
);
|
);
|
||||||
|
debugPrint(
|
||||||
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.projectStatusModel) ? "✓" : "✗"} ProjectStatusModel adapter',
|
||||||
|
);
|
||||||
|
debugPrint(
|
||||||
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.projectProgressModel) ? "✓" : "✗"} ProjectProgressModel adapter',
|
||||||
|
);
|
||||||
debugPrint(
|
debugPrint(
|
||||||
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.entryType) ? "✓" : "✗"} EntryType adapter',
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.entryType) ? "✓" : "✗"} EntryType adapter',
|
||||||
);
|
);
|
||||||
@@ -129,6 +138,12 @@ class HiveService {
|
|||||||
debugPrint(
|
debugPrint(
|
||||||
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.userModel) ? "✓" : "✗"} UserModel adapter',
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.userModel) ? "✓" : "✗"} UserModel adapter',
|
||||||
);
|
);
|
||||||
|
debugPrint(
|
||||||
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.cityModel) ? "✓" : "✗"} CityModel adapter',
|
||||||
|
);
|
||||||
|
debugPrint(
|
||||||
|
'HiveService: ${Hive.isAdapterRegistered(HiveTypeIds.wardModel) ? "✓" : "✗"} WardModel adapter',
|
||||||
|
);
|
||||||
|
|
||||||
debugPrint('HiveService: Type adapters registered successfully');
|
debugPrint('HiveService: Type adapters registered successfully');
|
||||||
}
|
}
|
||||||
@@ -156,8 +171,21 @@ class HiveService {
|
|||||||
// Notification box (non-sensitive)
|
// Notification box (non-sensitive)
|
||||||
Hive.openBox<dynamic>(HiveBoxNames.notificationBox),
|
Hive.openBox<dynamic>(HiveBoxNames.notificationBox),
|
||||||
|
|
||||||
// Favorites box (non-sensitive)
|
// Favorite products box (non-sensitive) - caches Product entities from wishlist API
|
||||||
Hive.openBox<dynamic>(HiveBoxNames.favoriteBox),
|
Hive.openBox<dynamic>(HiveBoxNames.favoriteProductsBox),
|
||||||
|
|
||||||
|
// Location boxes (non-sensitive) - caches cities and wards for address forms
|
||||||
|
Hive.openBox<dynamic>(HiveBoxNames.cityBox),
|
||||||
|
Hive.openBox<dynamic>(HiveBoxNames.wardBox),
|
||||||
|
|
||||||
|
// Order status box (non-sensitive) - caches order status list from API
|
||||||
|
Hive.openBox<dynamic>(HiveBoxNames.orderStatusBox),
|
||||||
|
|
||||||
|
// Project status box (non-sensitive) - caches project status list from API
|
||||||
|
Hive.openBox<dynamic>(HiveBoxNames.projectStatusBox),
|
||||||
|
|
||||||
|
// Project progress box (non-sensitive) - caches construction progress stages from API
|
||||||
|
Hive.openBox<dynamic>(HiveBoxNames.projectProgressBox),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Open potentially encrypted boxes (sensitive data)
|
// Open potentially encrypted boxes (sensitive data)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ part of 'enums.dart';
|
|||||||
|
|
||||||
class UserRoleAdapter extends TypeAdapter<UserRole> {
|
class UserRoleAdapter extends TypeAdapter<UserRole> {
|
||||||
@override
|
@override
|
||||||
final typeId = 30;
|
final typeId = 33;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
UserRole read(BinaryReader reader) {
|
UserRole read(BinaryReader reader) {
|
||||||
@@ -53,7 +53,7 @@ class UserRoleAdapter extends TypeAdapter<UserRole> {
|
|||||||
|
|
||||||
class UserStatusAdapter extends TypeAdapter<UserStatus> {
|
class UserStatusAdapter extends TypeAdapter<UserStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 31;
|
final typeId = 34;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
UserStatus read(BinaryReader reader) {
|
UserStatus read(BinaryReader reader) {
|
||||||
@@ -98,7 +98,7 @@ class UserStatusAdapter extends TypeAdapter<UserStatus> {
|
|||||||
|
|
||||||
class LoyaltyTierAdapter extends TypeAdapter<LoyaltyTier> {
|
class LoyaltyTierAdapter extends TypeAdapter<LoyaltyTier> {
|
||||||
@override
|
@override
|
||||||
final typeId = 32;
|
final typeId = 35;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LoyaltyTier read(BinaryReader reader) {
|
LoyaltyTier read(BinaryReader reader) {
|
||||||
@@ -151,7 +151,7 @@ class LoyaltyTierAdapter extends TypeAdapter<LoyaltyTier> {
|
|||||||
|
|
||||||
class OrderStatusAdapter extends TypeAdapter<OrderStatus> {
|
class OrderStatusAdapter extends TypeAdapter<OrderStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 33;
|
final typeId = 36;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
OrderStatus read(BinaryReader reader) {
|
OrderStatus read(BinaryReader reader) {
|
||||||
@@ -216,7 +216,7 @@ class OrderStatusAdapter extends TypeAdapter<OrderStatus> {
|
|||||||
|
|
||||||
class InvoiceTypeAdapter extends TypeAdapter<InvoiceType> {
|
class InvoiceTypeAdapter extends TypeAdapter<InvoiceType> {
|
||||||
@override
|
@override
|
||||||
final typeId = 34;
|
final typeId = 37;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvoiceType read(BinaryReader reader) {
|
InvoiceType read(BinaryReader reader) {
|
||||||
@@ -261,7 +261,7 @@ class InvoiceTypeAdapter extends TypeAdapter<InvoiceType> {
|
|||||||
|
|
||||||
class InvoiceStatusAdapter extends TypeAdapter<InvoiceStatus> {
|
class InvoiceStatusAdapter extends TypeAdapter<InvoiceStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 35;
|
final typeId = 38;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvoiceStatus read(BinaryReader reader) {
|
InvoiceStatus read(BinaryReader reader) {
|
||||||
@@ -318,7 +318,7 @@ class InvoiceStatusAdapter extends TypeAdapter<InvoiceStatus> {
|
|||||||
|
|
||||||
class PaymentMethodAdapter extends TypeAdapter<PaymentMethod> {
|
class PaymentMethodAdapter extends TypeAdapter<PaymentMethod> {
|
||||||
@override
|
@override
|
||||||
final typeId = 36;
|
final typeId = 39;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PaymentMethod read(BinaryReader reader) {
|
PaymentMethod read(BinaryReader reader) {
|
||||||
@@ -375,7 +375,7 @@ class PaymentMethodAdapter extends TypeAdapter<PaymentMethod> {
|
|||||||
|
|
||||||
class PaymentStatusAdapter extends TypeAdapter<PaymentStatus> {
|
class PaymentStatusAdapter extends TypeAdapter<PaymentStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 37;
|
final typeId = 40;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PaymentStatus read(BinaryReader reader) {
|
PaymentStatus read(BinaryReader reader) {
|
||||||
@@ -428,7 +428,7 @@ class PaymentStatusAdapter extends TypeAdapter<PaymentStatus> {
|
|||||||
|
|
||||||
class EntryTypeAdapter extends TypeAdapter<EntryType> {
|
class EntryTypeAdapter extends TypeAdapter<EntryType> {
|
||||||
@override
|
@override
|
||||||
final typeId = 38;
|
final typeId = 41;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
EntryType read(BinaryReader reader) {
|
EntryType read(BinaryReader reader) {
|
||||||
@@ -477,7 +477,7 @@ class EntryTypeAdapter extends TypeAdapter<EntryType> {
|
|||||||
|
|
||||||
class EntrySourceAdapter extends TypeAdapter<EntrySource> {
|
class EntrySourceAdapter extends TypeAdapter<EntrySource> {
|
||||||
@override
|
@override
|
||||||
final typeId = 39;
|
final typeId = 42;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
EntrySource read(BinaryReader reader) {
|
EntrySource read(BinaryReader reader) {
|
||||||
@@ -538,7 +538,7 @@ class EntrySourceAdapter extends TypeAdapter<EntrySource> {
|
|||||||
|
|
||||||
class ComplaintStatusAdapter extends TypeAdapter<ComplaintStatus> {
|
class ComplaintStatusAdapter extends TypeAdapter<ComplaintStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 40;
|
final typeId = 43;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ComplaintStatus read(BinaryReader reader) {
|
ComplaintStatus read(BinaryReader reader) {
|
||||||
@@ -587,7 +587,7 @@ class ComplaintStatusAdapter extends TypeAdapter<ComplaintStatus> {
|
|||||||
|
|
||||||
class GiftCategoryAdapter extends TypeAdapter<GiftCategory> {
|
class GiftCategoryAdapter extends TypeAdapter<GiftCategory> {
|
||||||
@override
|
@override
|
||||||
final typeId = 41;
|
final typeId = 44;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GiftCategory read(BinaryReader reader) {
|
GiftCategory read(BinaryReader reader) {
|
||||||
@@ -636,7 +636,7 @@ class GiftCategoryAdapter extends TypeAdapter<GiftCategory> {
|
|||||||
|
|
||||||
class GiftStatusAdapter extends TypeAdapter<GiftStatus> {
|
class GiftStatusAdapter extends TypeAdapter<GiftStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 42;
|
final typeId = 45;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GiftStatus read(BinaryReader reader) {
|
GiftStatus read(BinaryReader reader) {
|
||||||
@@ -681,7 +681,7 @@ class GiftStatusAdapter extends TypeAdapter<GiftStatus> {
|
|||||||
|
|
||||||
class PointsStatusAdapter extends TypeAdapter<PointsStatus> {
|
class PointsStatusAdapter extends TypeAdapter<PointsStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 43;
|
final typeId = 46;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PointsStatus read(BinaryReader reader) {
|
PointsStatus read(BinaryReader reader) {
|
||||||
@@ -722,7 +722,7 @@ class PointsStatusAdapter extends TypeAdapter<PointsStatus> {
|
|||||||
|
|
||||||
class ProjectTypeAdapter extends TypeAdapter<ProjectType> {
|
class ProjectTypeAdapter extends TypeAdapter<ProjectType> {
|
||||||
@override
|
@override
|
||||||
final typeId = 44;
|
final typeId = 47;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ProjectType read(BinaryReader reader) {
|
ProjectType read(BinaryReader reader) {
|
||||||
@@ -779,7 +779,7 @@ class ProjectTypeAdapter extends TypeAdapter<ProjectType> {
|
|||||||
|
|
||||||
class SubmissionStatusAdapter extends TypeAdapter<SubmissionStatus> {
|
class SubmissionStatusAdapter extends TypeAdapter<SubmissionStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 45;
|
final typeId = 48;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
SubmissionStatus read(BinaryReader reader) {
|
SubmissionStatus read(BinaryReader reader) {
|
||||||
@@ -828,7 +828,7 @@ class SubmissionStatusAdapter extends TypeAdapter<SubmissionStatus> {
|
|||||||
|
|
||||||
class DesignStatusAdapter extends TypeAdapter<DesignStatus> {
|
class DesignStatusAdapter extends TypeAdapter<DesignStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 46;
|
final typeId = 49;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DesignStatus read(BinaryReader reader) {
|
DesignStatus read(BinaryReader reader) {
|
||||||
@@ -885,7 +885,7 @@ class DesignStatusAdapter extends TypeAdapter<DesignStatus> {
|
|||||||
|
|
||||||
class QuoteStatusAdapter extends TypeAdapter<QuoteStatus> {
|
class QuoteStatusAdapter extends TypeAdapter<QuoteStatus> {
|
||||||
@override
|
@override
|
||||||
final typeId = 47;
|
final typeId = 50;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
QuoteStatus read(BinaryReader reader) {
|
QuoteStatus read(BinaryReader reader) {
|
||||||
@@ -946,7 +946,7 @@ class QuoteStatusAdapter extends TypeAdapter<QuoteStatus> {
|
|||||||
|
|
||||||
class RoomTypeAdapter extends TypeAdapter<RoomType> {
|
class RoomTypeAdapter extends TypeAdapter<RoomType> {
|
||||||
@override
|
@override
|
||||||
final typeId = 48;
|
final typeId = 51;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RoomType read(BinaryReader reader) {
|
RoomType read(BinaryReader reader) {
|
||||||
@@ -995,7 +995,7 @@ class RoomTypeAdapter extends TypeAdapter<RoomType> {
|
|||||||
|
|
||||||
class ContentTypeAdapter extends TypeAdapter<ContentType> {
|
class ContentTypeAdapter extends TypeAdapter<ContentType> {
|
||||||
@override
|
@override
|
||||||
final typeId = 49;
|
final typeId = 52;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ContentType read(BinaryReader reader) {
|
ContentType read(BinaryReader reader) {
|
||||||
@@ -1056,7 +1056,7 @@ class ContentTypeAdapter extends TypeAdapter<ContentType> {
|
|||||||
|
|
||||||
class ReminderTypeAdapter extends TypeAdapter<ReminderType> {
|
class ReminderTypeAdapter extends TypeAdapter<ReminderType> {
|
||||||
@override
|
@override
|
||||||
final typeId = 50;
|
final typeId = 53;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ReminderType read(BinaryReader reader) {
|
ReminderType read(BinaryReader reader) {
|
||||||
|
|||||||
141
lib/core/enums/status_color.dart
Normal file
141
lib/core/enums/status_color.dart
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
/// Status Color Enum
|
||||||
|
///
|
||||||
|
/// Defines status types with their associated color values.
|
||||||
|
/// Used for status badges, alerts, and other UI elements that need
|
||||||
|
/// consistent color coding across the app.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// Status Color Enum
|
||||||
|
///
|
||||||
|
/// Each status type has an associated color value.
|
||||||
|
enum StatusColor {
|
||||||
|
/// Warning status - Yellow/Orange
|
||||||
|
/// Used for cautionary states, pending actions, or items requiring attention
|
||||||
|
warning(Color(0xFFFFC107)),
|
||||||
|
|
||||||
|
/// Info status - Primary Blue
|
||||||
|
/// Used for informational states, neutral notifications, or general information
|
||||||
|
info(Color(0xFF005B9A)),
|
||||||
|
|
||||||
|
/// Danger status - Red
|
||||||
|
/// Used for error states, critical alerts, or destructive actions
|
||||||
|
danger(Color(0xFFDC3545)),
|
||||||
|
|
||||||
|
/// Success status - Green
|
||||||
|
/// Used for successful operations, completed states, or positive confirmations
|
||||||
|
success(Color(0xFF28A745)),
|
||||||
|
|
||||||
|
/// Secondary status - Light Grey
|
||||||
|
/// Used for secondary information, disabled states, or less important elements
|
||||||
|
secondary(Color(0xFFE5E7EB));
|
||||||
|
|
||||||
|
/// Constructor
|
||||||
|
const StatusColor(this.color);
|
||||||
|
|
||||||
|
/// The color value associated with this status
|
||||||
|
final Color color;
|
||||||
|
|
||||||
|
/// Get a lighter version of the color (with opacity)
|
||||||
|
/// Useful for backgrounds and subtle highlights
|
||||||
|
Color get light => color.withValues(alpha: 0.1);
|
||||||
|
|
||||||
|
/// Get a slightly darker version for borders
|
||||||
|
/// Useful for card borders and dividers
|
||||||
|
Color get border => color.withValues(alpha: 0.3);
|
||||||
|
|
||||||
|
/// Get the color with custom opacity
|
||||||
|
Color withOpacity(double opacity) => color.withValues(alpha: opacity);
|
||||||
|
|
||||||
|
/// Convert from string name (case-insensitive)
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// ```dart
|
||||||
|
/// final status = StatusColor.fromString('warning');
|
||||||
|
/// // Returns StatusColor.warning
|
||||||
|
/// ```
|
||||||
|
static StatusColor? fromString(String name) {
|
||||||
|
try {
|
||||||
|
return StatusColor.values.firstWhere(
|
||||||
|
(e) => e.name.toLowerCase() == name.toLowerCase(),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get status color from order status string
|
||||||
|
///
|
||||||
|
/// Maps common order status strings to appropriate colors.
|
||||||
|
/// Returns null if no mapping exists.
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// ```dart
|
||||||
|
/// final color = StatusColor.fromOrderStatus('Processing');
|
||||||
|
/// // Returns StatusColor.warning
|
||||||
|
/// ```
|
||||||
|
static StatusColor? fromOrderStatus(String status) {
|
||||||
|
final statusLower = status.toLowerCase();
|
||||||
|
|
||||||
|
// Success states
|
||||||
|
if (statusLower.contains('completed') ||
|
||||||
|
statusLower.contains('delivered') ||
|
||||||
|
statusLower.contains('paid') ||
|
||||||
|
statusLower.contains('approved')) {
|
||||||
|
return StatusColor.success;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warning/Pending states
|
||||||
|
if (statusLower.contains('pending') ||
|
||||||
|
statusLower.contains('processing') ||
|
||||||
|
statusLower.contains('shipping') ||
|
||||||
|
statusLower.contains('reviewing')) {
|
||||||
|
return StatusColor.warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Danger/Error states
|
||||||
|
if (statusLower.contains('cancelled') ||
|
||||||
|
statusLower.contains('rejected') ||
|
||||||
|
statusLower.contains('failed') ||
|
||||||
|
statusLower.contains('expired')) {
|
||||||
|
return StatusColor.danger;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info states
|
||||||
|
if (statusLower.contains('draft') ||
|
||||||
|
statusLower.contains('sent') ||
|
||||||
|
statusLower.contains('viewed')) {
|
||||||
|
return StatusColor.info;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get status color from payment status string
|
||||||
|
///
|
||||||
|
/// Maps common payment status strings to appropriate colors.
|
||||||
|
/// Returns null if no mapping exists.
|
||||||
|
static StatusColor? fromPaymentStatus(String status) {
|
||||||
|
final statusLower = status.toLowerCase();
|
||||||
|
|
||||||
|
// Success states
|
||||||
|
if (statusLower.contains('completed') || statusLower.contains('paid')) {
|
||||||
|
return StatusColor.success;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warning/Pending states
|
||||||
|
if (statusLower.contains('pending') || statusLower.contains('processing')) {
|
||||||
|
return StatusColor.warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Danger/Error states
|
||||||
|
if (statusLower.contains('failed') ||
|
||||||
|
statusLower.contains('rejected') ||
|
||||||
|
statusLower.contains('refunded')) {
|
||||||
|
return StatusColor.danger;
|
||||||
|
}
|
||||||
|
|
||||||
|
return StatusColor.info;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ library;
|
|||||||
import 'dart:developer' as developer;
|
import 'dart:developer' as developer;
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
@@ -569,10 +570,10 @@ Future<AuthInterceptor> authInterceptor(Ref ref, Dio dio) async {
|
|||||||
@riverpod
|
@riverpod
|
||||||
LoggingInterceptor loggingInterceptor(Ref ref) {
|
LoggingInterceptor loggingInterceptor(Ref ref) {
|
||||||
// Only enable logging in debug mode
|
// Only enable logging in debug mode
|
||||||
const bool isDebug = true; // TODO: Replace with kDebugMode from Flutter
|
const bool isDebug = kDebugMode; // TODO: Replace with kDebugMode from Flutter
|
||||||
|
|
||||||
return LoggingInterceptor(
|
return LoggingInterceptor(
|
||||||
enableRequestLogging: isDebug,
|
enableRequestLogging: true,
|
||||||
enableResponseLogging: isDebug,
|
enableResponseLogging: isDebug,
|
||||||
enableErrorLogging: isDebug,
|
enableErrorLogging: isDebug,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ final class LoggingInterceptorProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$loggingInterceptorHash() =>
|
String _$loggingInterceptorHash() =>
|
||||||
r'f3dedaeb3152d5188544232f6f270bb6908c2827';
|
r'79e90e0eb78663d2645d2d7c467e01bc18a30551';
|
||||||
|
|
||||||
/// Provider for ErrorTransformerInterceptor
|
/// Provider for ErrorTransformerInterceptor
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,12 @@
|
|||||||
/// - Retry logic
|
/// - Retry logic
|
||||||
library;
|
library;
|
||||||
|
|
||||||
import 'package:curl_logger_dio_interceptor/curl_logger_dio_interceptor.dart';
|
import 'dart:developer' as developer;
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
|
import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
|
||||||
import 'package:dio_cache_interceptor_hive_store/dio_cache_interceptor_hive_store.dart';
|
import 'package:dio_cache_interceptor_hive_store/dio_cache_interceptor_hive_store.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
@@ -238,6 +240,87 @@ class DioClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Custom Curl Logger Interceptor
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Custom Curl Logger that uses debugPrint instead of print
|
||||||
|
class CustomCurlLoggerInterceptor extends Interceptor {
|
||||||
|
@override
|
||||||
|
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||||
|
final curl = _cURLRepresentation(options);
|
||||||
|
// debugPrint(
|
||||||
|
// '╔╣ CURL Request ╠══════════════════════════════════════════════════',
|
||||||
|
// );
|
||||||
|
// debugPrint(curl);
|
||||||
|
// debugPrint(
|
||||||
|
// '╚═════════════════════════════════════════════════════════════════',
|
||||||
|
// );
|
||||||
|
// Also log to dart:developer for better filtering in DevTools
|
||||||
|
developer.log(curl, name: 'DIO_CURL', time: DateTime.now());
|
||||||
|
handler.next(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
String _cURLRepresentation(RequestOptions options) {
|
||||||
|
final components = ['curl --location'];
|
||||||
|
|
||||||
|
// Add method
|
||||||
|
if (options.method.toUpperCase() != 'GET') {
|
||||||
|
components.add('-X ${options.method}');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add headers (INCLUDING Cookie this time!)
|
||||||
|
options.headers.forEach((key, value) {
|
||||||
|
// Escape single quotes in header values
|
||||||
|
final escapedValue = value.toString().replaceAll("'", "'\\''");
|
||||||
|
components.add("--header '$key: $escapedValue'");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add data with proper JSON formatting
|
||||||
|
if (options.data != null) {
|
||||||
|
if (options.data is FormData) {
|
||||||
|
components.add('--data-binary [FormData]');
|
||||||
|
} else {
|
||||||
|
// Convert data to proper JSON string
|
||||||
|
String jsonData;
|
||||||
|
if (options.data is Map || options.data is List) {
|
||||||
|
// Use dart:convert to properly encode JSON
|
||||||
|
jsonData = _jsonEncode(options.data);
|
||||||
|
} else {
|
||||||
|
jsonData = options.data.toString();
|
||||||
|
}
|
||||||
|
// Escape single quotes for shell
|
||||||
|
final escapedData = jsonData.replaceAll("'", "'\\''");
|
||||||
|
components.add("--data '$escapedData'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add URL
|
||||||
|
final uri = options.uri.toString();
|
||||||
|
components.add("'$uri'");
|
||||||
|
|
||||||
|
return components.join(' \\\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Simple JSON encoder (without importing dart:convert in this file)
|
||||||
|
String _jsonEncode(dynamic data) {
|
||||||
|
if (data == null) return 'null';
|
||||||
|
if (data is String) return '"${data.replaceAll('"', r'\"')}"';
|
||||||
|
if (data is num || data is bool) return data.toString();
|
||||||
|
if (data is List) {
|
||||||
|
final items = data.map((e) => _jsonEncode(e)).join(',');
|
||||||
|
return '[$items]';
|
||||||
|
}
|
||||||
|
if (data is Map) {
|
||||||
|
final pairs = data.entries
|
||||||
|
.map((e) => '"${e.key}":${_jsonEncode(e.value)}')
|
||||||
|
.join(',');
|
||||||
|
return '{$pairs}';
|
||||||
|
}
|
||||||
|
return data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Retry Interceptor
|
// Retry Interceptor
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -383,8 +466,9 @@ Future<Dio> dio(Ref ref) async {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
// Add interceptors in order
|
// Add interceptors in order
|
||||||
// 1. Curl interceptor (first to log cURL commands)
|
// 1. Custom Curl interceptor (first to log cURL commands)
|
||||||
..interceptors.add(CurlLoggerDioInterceptor())
|
// Uses debugPrint and developer.log for better visibility
|
||||||
|
..interceptors.add(CustomCurlLoggerInterceptor())
|
||||||
// 2. Logging interceptor
|
// 2. Logging interceptor
|
||||||
..interceptors.add(ref.watch(loggingInterceptorProvider))
|
..interceptors.add(ref.watch(loggingInterceptorProvider))
|
||||||
// 3. Auth interceptor (add tokens to requests)
|
// 3. Auth interceptor (add tokens to requests)
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ final class DioProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$dioHash() => r'40bb4b1008c8259c9db4b19bcee674aa6732810c';
|
String _$dioHash() => r'd15bfe824d6501e5cbd56ff152de978030d97be4';
|
||||||
|
|
||||||
/// Provider for DioClient
|
/// Provider for DioClient
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ Future<User> user(UserRef ref, String id) async {
|
|||||||
final userAsync = ref.watch(userProvider('123'));
|
final userAsync = ref.watch(userProvider('123'));
|
||||||
userAsync.when(
|
userAsync.when(
|
||||||
data: (user) => Text(user.name),
|
data: (user) => Text(user.name),
|
||||||
loading: () => CircularProgressIndicator(),
|
loading: () => const CustomLoadingIndicator(),
|
||||||
error: (e, _) => Text('Error: $e'),
|
error: (e, _) => Text('Error: $e'),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
@@ -202,7 +202,7 @@ final newValue = ref.refresh(userProvider);
|
|||||||
```dart
|
```dart
|
||||||
asyncValue.when(
|
asyncValue.when(
|
||||||
data: (value) => Text(value),
|
data: (value) => Text(value),
|
||||||
loading: () => CircularProgressIndicator(),
|
loading: () => const CustomLoadingIndicator(),
|
||||||
error: (error, stack) => Text('Error: $error'),
|
error: (error, stack) => Text('Error: $error'),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
@@ -215,7 +215,7 @@ switch (asyncValue) {
|
|||||||
case AsyncError(:final error):
|
case AsyncError(:final error):
|
||||||
return Text('Error: $error');
|
return Text('Error: $error');
|
||||||
case AsyncLoading():
|
case AsyncLoading():
|
||||||
return CircularProgressIndicator();
|
return const CustomLoadingIndicator();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Connectivity connectivity(Ref ref) {
|
|||||||
/// final connectivityState = ref.watch(connectivityStreamProvider);
|
/// final connectivityState = ref.watch(connectivityStreamProvider);
|
||||||
/// connectivityState.when(
|
/// connectivityState.when(
|
||||||
/// data: (status) => Text('Status: $status'),
|
/// data: (status) => Text('Status: $status'),
|
||||||
/// loading: () => CircularProgressIndicator(),
|
/// loading: () => const CustomLoadingIndicator(),
|
||||||
/// error: (error, _) => Text('Error: $error'),
|
/// error: (error, _) => Text('Error: $error'),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
@@ -83,7 +83,7 @@ Future<ConnectivityStatus> currentConnectivity(Ref ref) async {
|
|||||||
/// final isOnlineAsync = ref.watch(isOnlineProvider);
|
/// final isOnlineAsync = ref.watch(isOnlineProvider);
|
||||||
/// isOnlineAsync.when(
|
/// isOnlineAsync.when(
|
||||||
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
|
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
|
||||||
/// loading: () => CircularProgressIndicator(),
|
/// loading: () => const CustomLoadingIndicator(),
|
||||||
/// error: (error, _) => Text('Error: $error'),
|
/// error: (error, _) => Text('Error: $error'),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ String _$connectivityHash() => r'6d67af0ea4110f6ee0246dd332f90f8901380eda';
|
|||||||
/// final connectivityState = ref.watch(connectivityStreamProvider);
|
/// final connectivityState = ref.watch(connectivityStreamProvider);
|
||||||
/// connectivityState.when(
|
/// connectivityState.when(
|
||||||
/// data: (status) => Text('Status: $status'),
|
/// data: (status) => Text('Status: $status'),
|
||||||
/// loading: () => CircularProgressIndicator(),
|
/// loading: () => const CustomLoadingIndicator(),
|
||||||
/// error: (error, _) => Text('Error: $error'),
|
/// error: (error, _) => Text('Error: $error'),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
@@ -81,7 +81,7 @@ const connectivityStreamProvider = ConnectivityStreamProvider._();
|
|||||||
/// final connectivityState = ref.watch(connectivityStreamProvider);
|
/// final connectivityState = ref.watch(connectivityStreamProvider);
|
||||||
/// connectivityState.when(
|
/// connectivityState.when(
|
||||||
/// data: (status) => Text('Status: $status'),
|
/// data: (status) => Text('Status: $status'),
|
||||||
/// loading: () => CircularProgressIndicator(),
|
/// loading: () => const CustomLoadingIndicator(),
|
||||||
/// error: (error, _) => Text('Error: $error'),
|
/// error: (error, _) => Text('Error: $error'),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
@@ -104,7 +104,7 @@ final class ConnectivityStreamProvider
|
|||||||
/// final connectivityState = ref.watch(connectivityStreamProvider);
|
/// final connectivityState = ref.watch(connectivityStreamProvider);
|
||||||
/// connectivityState.when(
|
/// connectivityState.when(
|
||||||
/// data: (status) => Text('Status: $status'),
|
/// data: (status) => Text('Status: $status'),
|
||||||
/// loading: () => CircularProgressIndicator(),
|
/// loading: () => const CustomLoadingIndicator(),
|
||||||
/// error: (error, _) => Text('Error: $error'),
|
/// error: (error, _) => Text('Error: $error'),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
@@ -219,7 +219,7 @@ String _$currentConnectivityHash() =>
|
|||||||
/// final isOnlineAsync = ref.watch(isOnlineProvider);
|
/// final isOnlineAsync = ref.watch(isOnlineProvider);
|
||||||
/// isOnlineAsync.when(
|
/// isOnlineAsync.when(
|
||||||
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
|
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
|
||||||
/// loading: () => CircularProgressIndicator(),
|
/// loading: () => const CustomLoadingIndicator(),
|
||||||
/// error: (error, _) => Text('Error: $error'),
|
/// error: (error, _) => Text('Error: $error'),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
@@ -235,7 +235,7 @@ const isOnlineProvider = IsOnlineProvider._();
|
|||||||
/// final isOnlineAsync = ref.watch(isOnlineProvider);
|
/// final isOnlineAsync = ref.watch(isOnlineProvider);
|
||||||
/// isOnlineAsync.when(
|
/// isOnlineAsync.when(
|
||||||
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
|
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
|
||||||
/// loading: () => CircularProgressIndicator(),
|
/// loading: () => const CustomLoadingIndicator(),
|
||||||
/// error: (error, _) => Text('Error: $error'),
|
/// error: (error, _) => Text('Error: $error'),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
@@ -251,7 +251,7 @@ final class IsOnlineProvider
|
|||||||
/// final isOnlineAsync = ref.watch(isOnlineProvider);
|
/// final isOnlineAsync = ref.watch(isOnlineProvider);
|
||||||
/// isOnlineAsync.when(
|
/// isOnlineAsync.when(
|
||||||
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
|
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
|
||||||
/// loading: () => CircularProgressIndicator(),
|
/// loading: () => const CustomLoadingIndicator(),
|
||||||
/// error: (error, _) => Text('Error: $error'),
|
/// error: (error, _) => Text('Error: $error'),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ final version = ref.watch(appVersionProvider);
|
|||||||
final userData = ref.watch(userDataProvider);
|
final userData = ref.watch(userDataProvider);
|
||||||
userData.when(
|
userData.when(
|
||||||
data: (data) => Text(data),
|
data: (data) => Text(data),
|
||||||
loading: () => CircularProgressIndicator(),
|
loading: () => const CustomLoadingIndicator(),
|
||||||
error: (error, stack) => Text('Error: $error'),
|
error: (error, stack) => Text('Error: $error'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ switch (profileState) {
|
|||||||
case AsyncError(:final error):
|
case AsyncError(:final error):
|
||||||
return Text('Error: $error');
|
return Text('Error: $error');
|
||||||
case AsyncLoading():
|
case AsyncLoading():
|
||||||
return CircularProgressIndicator();
|
return const CustomLoadingIndicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ library;
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:worker/core/services/analytics_service.dart';
|
||||||
|
|
||||||
|
import 'package:worker/features/account/domain/entities/address.dart';
|
||||||
|
import 'package:worker/features/account/presentation/pages/address_form_page.dart';
|
||||||
import 'package:worker/features/account/presentation/pages/addresses_page.dart';
|
import 'package:worker/features/account/presentation/pages/addresses_page.dart';
|
||||||
import 'package:worker/features/auth/presentation/providers/auth_provider.dart';
|
|
||||||
import 'package:worker/features/account/presentation/pages/change_password_page.dart';
|
import 'package:worker/features/account/presentation/pages/change_password_page.dart';
|
||||||
import 'package:worker/features/account/presentation/pages/profile_edit_page.dart';
|
import 'package:worker/features/account/presentation/pages/profile_edit_page.dart';
|
||||||
|
import 'package:worker/features/auth/presentation/providers/auth_provider.dart';
|
||||||
import 'package:worker/features/auth/domain/entities/business_unit.dart';
|
import 'package:worker/features/auth/domain/entities/business_unit.dart';
|
||||||
import 'package:worker/features/auth/presentation/pages/business_unit_selection_page.dart';
|
import 'package:worker/features/auth/presentation/pages/business_unit_selection_page.dart';
|
||||||
import 'package:worker/features/auth/presentation/pages/forgot_password_page.dart';
|
import 'package:worker/features/auth/presentation/pages/forgot_password_page.dart';
|
||||||
@@ -25,11 +28,13 @@ import 'package:worker/features/chat/presentation/pages/chat_list_page.dart';
|
|||||||
import 'package:worker/features/favorites/presentation/pages/favorites_page.dart';
|
import 'package:worker/features/favorites/presentation/pages/favorites_page.dart';
|
||||||
import 'package:worker/features/loyalty/presentation/pages/loyalty_page.dart';
|
import 'package:worker/features/loyalty/presentation/pages/loyalty_page.dart';
|
||||||
import 'package:worker/features/loyalty/presentation/pages/points_history_page.dart';
|
import 'package:worker/features/loyalty/presentation/pages/points_history_page.dart';
|
||||||
|
import 'package:worker/features/loyalty/presentation/pages/points_records_page.dart';
|
||||||
import 'package:worker/features/loyalty/presentation/pages/rewards_page.dart';
|
import 'package:worker/features/loyalty/presentation/pages/rewards_page.dart';
|
||||||
import 'package:worker/features/main/presentation/pages/main_scaffold.dart';
|
import 'package:worker/features/main/presentation/pages/main_scaffold.dart';
|
||||||
import 'package:worker/features/news/presentation/pages/news_detail_page.dart';
|
import 'package:worker/features/news/presentation/pages/news_detail_page.dart';
|
||||||
import 'package:worker/features/news/presentation/pages/news_list_page.dart';
|
import 'package:worker/features/news/presentation/pages/news_list_page.dart';
|
||||||
import 'package:worker/features/orders/presentation/pages/order_detail_page.dart';
|
import 'package:worker/features/orders/presentation/pages/order_detail_page.dart';
|
||||||
|
import 'package:worker/features/orders/presentation/pages/order_success_page.dart';
|
||||||
import 'package:worker/features/orders/presentation/pages/orders_page.dart';
|
import 'package:worker/features/orders/presentation/pages/orders_page.dart';
|
||||||
import 'package:worker/features/orders/presentation/pages/payment_detail_page.dart';
|
import 'package:worker/features/orders/presentation/pages/payment_detail_page.dart';
|
||||||
import 'package:worker/features/orders/presentation/pages/payment_qr_page.dart';
|
import 'package:worker/features/orders/presentation/pages/payment_qr_page.dart';
|
||||||
@@ -38,11 +43,18 @@ import 'package:worker/features/price_policy/price_policy.dart';
|
|||||||
import 'package:worker/features/products/presentation/pages/product_detail_page.dart';
|
import 'package:worker/features/products/presentation/pages/product_detail_page.dart';
|
||||||
import 'package:worker/features/products/presentation/pages/products_page.dart';
|
import 'package:worker/features/products/presentation/pages/products_page.dart';
|
||||||
import 'package:worker/features/products/presentation/pages/write_review_page.dart';
|
import 'package:worker/features/products/presentation/pages/write_review_page.dart';
|
||||||
|
import 'package:worker/features/projects/domain/entities/project_submission.dart';
|
||||||
|
import 'package:worker/features/projects/presentation/pages/submission_create_page.dart';
|
||||||
|
import 'package:worker/features/projects/presentation/pages/submissions_page.dart';
|
||||||
import 'package:worker/features/promotions/presentation/pages/promotion_detail_page.dart';
|
import 'package:worker/features/promotions/presentation/pages/promotion_detail_page.dart';
|
||||||
import 'package:worker/features/quotes/presentation/pages/quotes_page.dart';
|
import 'package:worker/features/quotes/presentation/pages/quotes_page.dart';
|
||||||
import 'package:worker/features/showrooms/presentation/pages/design_request_create_page.dart';
|
import 'package:worker/features/showrooms/presentation/pages/design_request_create_page.dart';
|
||||||
import 'package:worker/features/showrooms/presentation/pages/design_request_detail_page.dart';
|
import 'package:worker/features/showrooms/presentation/pages/design_request_detail_page.dart';
|
||||||
|
import 'package:worker/features/showrooms/presentation/pages/model_house_detail_page.dart';
|
||||||
import 'package:worker/features/showrooms/presentation/pages/model_houses_page.dart';
|
import 'package:worker/features/showrooms/presentation/pages/model_houses_page.dart';
|
||||||
|
import 'package:worker/features/account/presentation/pages/theme_settings_page.dart';
|
||||||
|
import 'package:worker/features/invoices/presentation/pages/invoices_page.dart';
|
||||||
|
import 'package:worker/features/invoices/presentation/pages/invoice_detail_page.dart';
|
||||||
|
|
||||||
/// Router Provider
|
/// Router Provider
|
||||||
///
|
///
|
||||||
@@ -53,42 +65,64 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
return GoRouter(
|
return GoRouter(
|
||||||
// Initial route - start with splash screen
|
// Initial route - start with splash screen
|
||||||
initialLocation: RouteNames.splash,
|
initialLocation: RouteNames.splash,
|
||||||
|
observers: [AnalyticsService.observer],
|
||||||
// Redirect based on auth state
|
// Redirect based on auth state
|
||||||
redirect: (context, state) {
|
redirect: (context, state) {
|
||||||
final isLoading = authState.isLoading;
|
final isLoading = authState.isLoading;
|
||||||
final isLoggedIn = authState.value != null;
|
final isLoggedIn = authState.value != null;
|
||||||
final isOnSplashPage = state.matchedLocation == RouteNames.splash;
|
final currentPath = state.matchedLocation;
|
||||||
final isOnLoginPage = state.matchedLocation == RouteNames.login;
|
final targetPath = state.uri.toString();
|
||||||
final isOnForgotPasswordPage = state.matchedLocation == RouteNames.forgotPassword;
|
|
||||||
final isOnRegisterPage = state.matchedLocation == RouteNames.register;
|
// Log redirect attempts for debugging
|
||||||
final isOnBusinessUnitPage =
|
print('🔄 Router redirect check:');
|
||||||
state.matchedLocation == RouteNames.businessUnitSelection;
|
print(' Current: $currentPath');
|
||||||
final isOnOtpPage = state.matchedLocation == RouteNames.otpVerification;
|
print(' Target: $targetPath');
|
||||||
|
print(' isLoading: $isLoading, isLoggedIn: $isLoggedIn');
|
||||||
|
|
||||||
|
final isOnSplashPage = currentPath == RouteNames.splash;
|
||||||
|
final isOnLoginPage = currentPath == RouteNames.login;
|
||||||
|
final isOnForgotPasswordPage = currentPath == RouteNames.forgotPassword;
|
||||||
|
final isOnRegisterPage = currentPath == RouteNames.register;
|
||||||
|
final isOnBusinessUnitPage = currentPath == RouteNames.businessUnitSelection;
|
||||||
|
final isOnOtpPage = currentPath == RouteNames.otpVerification;
|
||||||
final isOnAuthPage =
|
final isOnAuthPage =
|
||||||
isOnLoginPage || isOnForgotPasswordPage || isOnRegisterPage || isOnBusinessUnitPage || isOnOtpPage;
|
isOnLoginPage ||
|
||||||
|
isOnForgotPasswordPage ||
|
||||||
|
isOnRegisterPage ||
|
||||||
|
isOnBusinessUnitPage ||
|
||||||
|
isOnOtpPage;
|
||||||
|
|
||||||
// While loading auth state, show splash screen
|
// While loading auth state, show splash screen
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
if (!isOnSplashPage) {
|
||||||
|
print(' ➡️ Redirecting to splash (loading)');
|
||||||
return RouteNames.splash;
|
return RouteNames.splash;
|
||||||
}
|
}
|
||||||
|
print(' ✓ Already on splash (loading)');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// After loading, redirect from splash to appropriate page
|
// After loading, redirect from splash to appropriate page
|
||||||
if (isOnSplashPage && !isLoading) {
|
if (isOnSplashPage) {
|
||||||
return isLoggedIn ? RouteNames.home : RouteNames.login;
|
final destination = isLoggedIn ? RouteNames.home : RouteNames.login;
|
||||||
|
print(' ➡️ Redirecting from splash to $destination');
|
||||||
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not logged in and not on auth/splash pages, redirect to login
|
// If not logged in and not on auth/splash pages, redirect to login
|
||||||
if (!isLoggedIn && !isOnAuthPage && !isOnSplashPage) {
|
if (!isLoggedIn && !isOnAuthPage) {
|
||||||
|
print(' ➡️ Redirecting to login (not authenticated)');
|
||||||
return RouteNames.login;
|
return RouteNames.login;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If logged in and on login page, redirect to home
|
// If logged in and on login page, redirect to home
|
||||||
if (isLoggedIn && isOnLoginPage) {
|
if (isLoggedIn && isOnLoginPage) {
|
||||||
|
print(' ➡️ Redirecting to home (already logged in)');
|
||||||
return RouteNames.home;
|
return RouteNames.home;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No redirect needed
|
// No redirect needed
|
||||||
|
print(' ✓ No redirect needed');
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -98,16 +132,22 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.splash,
|
path: RouteNames.splash,
|
||||||
name: RouteNames.splash,
|
name: RouteNames.splash,
|
||||||
pageBuilder: (context, state) =>
|
pageBuilder: (context, state) => MaterialPage(
|
||||||
MaterialPage(key: state.pageKey, child: const SplashPage()),
|
key: state.pageKey,
|
||||||
|
name: RouteNames.splash,
|
||||||
|
child: const SplashPage(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Authentication Routes
|
// Authentication Routes
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.login,
|
path: RouteNames.login,
|
||||||
name: RouteNames.login,
|
name: RouteNames.login,
|
||||||
pageBuilder: (context, state) =>
|
pageBuilder: (context, state) => MaterialPage(
|
||||||
MaterialPage(key: state.pageKey, child: const LoginPage()),
|
key: state.pageKey,
|
||||||
|
name: RouteNames.login,
|
||||||
|
child: const LoginPage(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.forgotPassword,
|
path: RouteNames.forgotPassword,
|
||||||
@@ -159,16 +199,22 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.home,
|
path: RouteNames.home,
|
||||||
name: RouteNames.home,
|
name: RouteNames.home,
|
||||||
pageBuilder: (context, state) =>
|
pageBuilder: (context, state) => MaterialPage(
|
||||||
MaterialPage(key: state.pageKey, child: const MainScaffold()),
|
key: state.pageKey,
|
||||||
|
name: 'home',
|
||||||
|
child: const MainScaffold(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Products Route (full screen, no bottom nav)
|
// Products Route (full screen, no bottom nav)
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.products,
|
path: RouteNames.products,
|
||||||
name: RouteNames.products,
|
name: RouteNames.products,
|
||||||
pageBuilder: (context, state) =>
|
pageBuilder: (context, state) => MaterialPage(
|
||||||
MaterialPage(key: state.pageKey, child: const ProductsPage()),
|
key: state.pageKey,
|
||||||
|
name: 'products',
|
||||||
|
child: const ProductsPage(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Product Detail Route
|
// Product Detail Route
|
||||||
@@ -179,6 +225,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
final productId = state.pathParameters['id'];
|
final productId = state.pathParameters['id'];
|
||||||
return MaterialPage(
|
return MaterialPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
|
name: 'product_detail',
|
||||||
child: ProductDetailPage(productId: productId ?? ''),
|
child: ProductDetailPage(productId: productId ?? ''),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -191,6 +238,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
final productId = state.pathParameters['id'];
|
final productId = state.pathParameters['id'];
|
||||||
return MaterialPage(
|
return MaterialPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
|
name: 'write_review',
|
||||||
child: WriteReviewPage(productId: productId ?? ''),
|
child: WriteReviewPage(productId: productId ?? ''),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -206,6 +254,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
final promotionId = state.pathParameters['id'];
|
final promotionId = state.pathParameters['id'];
|
||||||
return MaterialPage(
|
return MaterialPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
|
name: 'promotion_detail',
|
||||||
child: PromotionDetailPage(promotionId: promotionId),
|
child: PromotionDetailPage(promotionId: promotionId),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -215,16 +264,23 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.cart,
|
path: RouteNames.cart,
|
||||||
name: RouteNames.cart,
|
name: RouteNames.cart,
|
||||||
pageBuilder: (context, state) =>
|
pageBuilder: (context, state) => MaterialPage(
|
||||||
MaterialPage(key: state.pageKey, child: const CartPage()),
|
key: state.pageKey,
|
||||||
|
name: 'cart',
|
||||||
|
child: const CartPage(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Checkout Route
|
// Checkout Route
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.checkout,
|
path: RouteNames.checkout,
|
||||||
name: RouteNames.checkout,
|
name: RouteNames.checkout,
|
||||||
pageBuilder: (context, state) =>
|
pageBuilder: (context, state) => MaterialPage(
|
||||||
MaterialPage(key: state.pageKey, child: const CheckoutPage()),
|
key: state.pageKey,
|
||||||
|
child: CheckoutPage(
|
||||||
|
checkoutData: state.extra as Map<String, dynamic>?,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Favorites Route
|
// Favorites Route
|
||||||
@@ -259,6 +315,14 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
MaterialPage(key: state.pageKey, child: const PointsHistoryPage()),
|
MaterialPage(key: state.pageKey, child: const PointsHistoryPage()),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Points Records Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.pointsRecords,
|
||||||
|
name: 'loyalty_points_records',
|
||||||
|
pageBuilder: (context, state) =>
|
||||||
|
MaterialPage(key: state.pageKey, child: const PointsRecordsPage()),
|
||||||
|
),
|
||||||
|
|
||||||
// Orders Route
|
// Orders Route
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.orders,
|
path: RouteNames.orders,
|
||||||
@@ -307,11 +371,53 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
name: RouteNames.paymentQr,
|
name: RouteNames.paymentQr,
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final orderId = state.uri.queryParameters['orderId'] ?? '';
|
final orderId = state.uri.queryParameters['orderId'] ?? '';
|
||||||
final amountStr = state.uri.queryParameters['amount'] ?? '0';
|
|
||||||
final amount = double.tryParse(amountStr) ?? 0.0;
|
|
||||||
return MaterialPage(
|
return MaterialPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: PaymentQrPage(orderId: orderId, amount: amount),
|
child: PaymentQrPage(orderId: orderId),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
// Order Success Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.orderSuccess,
|
||||||
|
name: RouteNames.orderSuccess,
|
||||||
|
pageBuilder: (context, state) {
|
||||||
|
final orderNumber = state.uri.queryParameters['orderNumber'] ?? '';
|
||||||
|
final totalStr = state.uri.queryParameters['total'];
|
||||||
|
final total = totalStr != null ? double.tryParse(totalStr) : null;
|
||||||
|
final paymentMethod = state.uri.queryParameters['paymentMethod'];
|
||||||
|
final isNegotiationStr = state.uri.queryParameters['isNegotiation'];
|
||||||
|
final isNegotiation = isNegotiationStr == 'true';
|
||||||
|
return MaterialPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
child: OrderSuccessPage(
|
||||||
|
orderNumber: orderNumber,
|
||||||
|
total: total,
|
||||||
|
paymentMethod: paymentMethod,
|
||||||
|
isNegotiation: isNegotiation,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
// Submissions Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.submissions,
|
||||||
|
name: RouteNames.submissions,
|
||||||
|
pageBuilder: (context, state) =>
|
||||||
|
MaterialPage(key: state.pageKey, child: const SubmissionsPage()),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Submission Create/Edit Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.submissionCreate,
|
||||||
|
name: RouteNames.submissionCreate,
|
||||||
|
pageBuilder: (context, state) {
|
||||||
|
final submission = state.extra as ProjectSubmission?;
|
||||||
|
return MaterialPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
child: SubmissionCreatePage(submission: submission),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -365,8 +471,26 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.addresses,
|
path: RouteNames.addresses,
|
||||||
name: RouteNames.addresses,
|
name: RouteNames.addresses,
|
||||||
pageBuilder: (context, state) =>
|
pageBuilder: (context, state) {
|
||||||
MaterialPage(key: state.pageKey, child: const AddressesPage()),
|
final extra = state.extra as Map<String, dynamic>?;
|
||||||
|
return MaterialPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
child: AddressesPage(extra: extra),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
// Address Form Route (Create/Edit)
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.addressForm,
|
||||||
|
name: RouteNames.addressForm,
|
||||||
|
pageBuilder: (context, state) {
|
||||||
|
final address = state.extra as Address?;
|
||||||
|
return MaterialPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
child: AddressFormPage(address: address),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
// Change Password Route
|
// Change Password Route
|
||||||
@@ -377,6 +501,35 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
MaterialPage(key: state.pageKey, child: const ChangePasswordPage()),
|
MaterialPage(key: state.pageKey, child: const ChangePasswordPage()),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Theme Settings Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.themeSettings,
|
||||||
|
name: RouteNames.themeSettings,
|
||||||
|
pageBuilder: (context, state) =>
|
||||||
|
MaterialPage(key: state.pageKey, child: const ThemeSettingsPage()),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Invoices Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.invoices,
|
||||||
|
name: RouteNames.invoices,
|
||||||
|
pageBuilder: (context, state) =>
|
||||||
|
MaterialPage(key: state.pageKey, child: const InvoicesPage()),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Invoice Detail Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.invoiceDetail,
|
||||||
|
name: RouteNames.invoiceDetail,
|
||||||
|
pageBuilder: (context, state) {
|
||||||
|
final invoiceId = state.pathParameters['id'];
|
||||||
|
return MaterialPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
child: InvoiceDetailPage(invoiceId: invoiceId ?? ''),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
// Chat List Route
|
// Chat List Route
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.chat,
|
path: RouteNames.chat,
|
||||||
@@ -393,6 +546,19 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
MaterialPage(key: state.pageKey, child: const ModelHousesPage()),
|
MaterialPage(key: state.pageKey, child: const ModelHousesPage()),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Model House Detail Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.modelHouseDetail,
|
||||||
|
name: RouteNames.modelHouseDetail,
|
||||||
|
pageBuilder: (context, state) {
|
||||||
|
final modelId = state.pathParameters['id'];
|
||||||
|
return MaterialPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
child: ModelHouseDetailPage(modelId: modelId ?? ''),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
// Design Request Create Route
|
// Design Request Create Route
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.designRequestCreate,
|
path: RouteNames.designRequestCreate,
|
||||||
@@ -452,7 +618,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// Debug logging (disable in production)
|
// Debug logging (disable in production)
|
||||||
debugLogDiagnostics: true,
|
debugLogDiagnostics: false, // Using custom logs instead
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -473,7 +639,7 @@ class RouteNames {
|
|||||||
// Main Routes
|
// Main Routes
|
||||||
static const String home = '/';
|
static const String home = '/';
|
||||||
static const String products = '/products';
|
static const String products = '/products';
|
||||||
static const String productDetail = '/products/:id';
|
static const String productDetail = '$products/:id';
|
||||||
static const String writeReview = 'write-review';
|
static const String writeReview = 'write-review';
|
||||||
static const String cart = '/cart';
|
static const String cart = '/cart';
|
||||||
static const String favorites = '/favorites';
|
static const String favorites = '/favorites';
|
||||||
@@ -482,37 +648,45 @@ class RouteNames {
|
|||||||
|
|
||||||
// Loyalty Routes
|
// Loyalty Routes
|
||||||
static const String loyalty = '/loyalty';
|
static const String loyalty = '/loyalty';
|
||||||
static const String rewards = '/loyalty/rewards';
|
static const String rewards = '$loyalty/rewards';
|
||||||
static const String pointsHistory = '/loyalty/points-history';
|
static const String pointsHistory = '$loyalty/points-history';
|
||||||
static const String myGifts = '/loyalty/gifts';
|
static const String pointsRecords = '$loyalty/points-records';
|
||||||
static const String referral = '/loyalty/referral';
|
static const String myGifts = '$loyalty/gifts';
|
||||||
|
static const String referral = '$loyalty/referral';
|
||||||
|
|
||||||
// Orders & Payments Routes
|
// Orders & Payments Routes
|
||||||
static const String orders = '/orders';
|
static const String orders = '/orders';
|
||||||
static const String orderDetail = '/orders/:id';
|
static const String orderDetail = '$orders/:id';
|
||||||
static const String payments = '/payments';
|
static const String payments = '/payments';
|
||||||
static const String paymentDetail = '/payments/:id';
|
static const String paymentDetail = '$payments/:id';
|
||||||
static const String paymentQr = '/payment-qr';
|
static const String paymentQr = '/payment-qr';
|
||||||
|
|
||||||
// Projects & Quotes Routes
|
// Projects & Quotes Routes
|
||||||
static const String projects = '/projects';
|
static const String projects = '/projects';
|
||||||
static const String projectDetail = '/projects/:id';
|
static const String projectDetail = '$projects/:id';
|
||||||
static const String projectCreate = '/projects/create';
|
static const String projectCreate = '$projects/create';
|
||||||
|
static const String submissions = '/submissions';
|
||||||
|
static const String submissionCreate = '$submissions/create';
|
||||||
static const String quotes = '/quotes';
|
static const String quotes = '/quotes';
|
||||||
static const String quoteDetail = '/quotes/:id';
|
static const String quoteDetail = '$quotes/:id';
|
||||||
static const String quoteCreate = '/quotes/create';
|
static const String quoteCreate = '$quotes/create';
|
||||||
|
|
||||||
// Account Routes
|
// Account Routes
|
||||||
static const String account = '/account';
|
static const String account = '/account';
|
||||||
static const String profile = '/account/profile';
|
static const String profile = '$account/profile';
|
||||||
static const String addresses = '/account/addresses';
|
static const String addresses = '$account/addresses';
|
||||||
static const String addressForm = '/account/addresses/form';
|
static const String addressForm = '$addresses/form';
|
||||||
static const String changePassword = '/account/change-password';
|
static const String changePassword = '$account/change-password';
|
||||||
static const String settings = '/account/settings';
|
static const String themeSettings = '$account/theme-settings';
|
||||||
|
static const String settings = '$account/settings';
|
||||||
|
|
||||||
|
// Invoice Routes
|
||||||
|
static const String invoices = '/invoices';
|
||||||
|
static const String invoiceDetail = '$invoices/:id';
|
||||||
|
|
||||||
// Promotions & Notifications Routes
|
// Promotions & Notifications Routes
|
||||||
static const String promotions = '/promotions';
|
static const String promotions = '/promotions';
|
||||||
static const String promotionDetail = '/promotions/:id';
|
static const String promotionDetail = '$promotions/:id';
|
||||||
static const String notifications = '/notifications';
|
static const String notifications = '/notifications';
|
||||||
|
|
||||||
// Price Policy Route
|
// Price Policy Route
|
||||||
@@ -520,16 +694,16 @@ class RouteNames {
|
|||||||
|
|
||||||
// News Route
|
// News Route
|
||||||
static const String news = '/news';
|
static const String news = '/news';
|
||||||
static const String newsDetail = '/news/:id';
|
static const String newsDetail = '$news/:id';
|
||||||
|
|
||||||
// Chat Route
|
// Chat Route
|
||||||
static const String chat = '/chat';
|
static const String chat = '/chat';
|
||||||
|
|
||||||
// Model Houses & Design Requests Routes
|
// Model Houses & Design Requests Routes
|
||||||
static const String modelHouses = '/model-houses';
|
static const String modelHouses = '/model-houses';
|
||||||
static const String designRequestCreate =
|
static const String modelHouseDetail = '$modelHouses/:id';
|
||||||
'/model-houses/design-request/create';
|
static const String designRequestCreate = '$modelHouses/design-request/create';
|
||||||
static const String designRequestDetail = '/model-houses/design-request/:id';
|
static const String designRequestDetail = '$modelHouses/design-request/:id';
|
||||||
|
|
||||||
// Authentication Routes
|
// Authentication Routes
|
||||||
static const String splash = '/splash';
|
static const String splash = '/splash';
|
||||||
|
|||||||
362
lib/core/services/analytics_service.dart
Normal file
362
lib/core/services/analytics_service.dart
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
import 'package:firebase_analytics/firebase_analytics.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// Firebase Analytics service for tracking user events across the app.
|
||||||
|
///
|
||||||
|
/// Usage:
|
||||||
|
/// ```dart
|
||||||
|
/// // Log add to cart event
|
||||||
|
/// AnalyticsService.logAddToCart(
|
||||||
|
/// productId: 'SKU123',
|
||||||
|
/// productName: 'Gạch men 60x60',
|
||||||
|
/// price: 150000,
|
||||||
|
/// quantity: 2,
|
||||||
|
/// );
|
||||||
|
/// ```
|
||||||
|
class AnalyticsService {
|
||||||
|
AnalyticsService._();
|
||||||
|
|
||||||
|
static final FirebaseAnalytics _analytics = FirebaseAnalytics.instance;
|
||||||
|
|
||||||
|
/// Get the analytics instance for NavigatorObserver
|
||||||
|
static FirebaseAnalytics get instance => _analytics;
|
||||||
|
|
||||||
|
/// Get the observer for automatic screen tracking in GoRouter
|
||||||
|
static FirebaseAnalyticsObserver get observer => FirebaseAnalyticsObserver(
|
||||||
|
analytics: _analytics,
|
||||||
|
nameExtractor: (settings) {
|
||||||
|
// GoRouter uses the path as the route name
|
||||||
|
final name = settings.name;
|
||||||
|
if (name != null && name.isNotEmpty && name != '/') {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return settings.name ?? '/';
|
||||||
|
},
|
||||||
|
routeFilter: (route) => route is PageRoute,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Log screen view manually
|
||||||
|
static Future<void> logScreenView({
|
||||||
|
required String screenName,
|
||||||
|
String? screenClass,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logScreenView(
|
||||||
|
screenName: screenName,
|
||||||
|
screenClass: screenClass,
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: screen_view - $screenName');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// E-commerce Events
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Log view item event - when user views product detail
|
||||||
|
static Future<void> logViewItem({
|
||||||
|
required String productId,
|
||||||
|
required String productName,
|
||||||
|
required double price,
|
||||||
|
String? brand,
|
||||||
|
String? category,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logViewItem(
|
||||||
|
currency: 'VND',
|
||||||
|
value: price,
|
||||||
|
items: [
|
||||||
|
AnalyticsEventItem(
|
||||||
|
itemId: productId,
|
||||||
|
itemName: productName,
|
||||||
|
price: price,
|
||||||
|
itemBrand: brand,
|
||||||
|
itemCategory: category,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: view_item - $productName');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log add to cart event
|
||||||
|
static Future<void> logAddToCart({
|
||||||
|
required String productId,
|
||||||
|
required String productName,
|
||||||
|
required double price,
|
||||||
|
required int quantity,
|
||||||
|
String? brand,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logAddToCart(
|
||||||
|
currency: 'VND',
|
||||||
|
value: price * quantity,
|
||||||
|
items: [
|
||||||
|
AnalyticsEventItem(
|
||||||
|
itemId: productId,
|
||||||
|
itemName: productName,
|
||||||
|
price: price,
|
||||||
|
quantity: quantity,
|
||||||
|
itemBrand: brand,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: add_to_cart - $productName x$quantity');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log remove from cart event
|
||||||
|
static Future<void> logRemoveFromCart({
|
||||||
|
required String productId,
|
||||||
|
required String productName,
|
||||||
|
required double price,
|
||||||
|
required int quantity,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logRemoveFromCart(
|
||||||
|
currency: 'VND',
|
||||||
|
value: price * quantity,
|
||||||
|
items: [
|
||||||
|
AnalyticsEventItem(
|
||||||
|
itemId: productId,
|
||||||
|
itemName: productName,
|
||||||
|
price: price,
|
||||||
|
quantity: quantity,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: remove_from_cart - $productName');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log view cart event
|
||||||
|
static Future<void> logViewCart({
|
||||||
|
required double cartValue,
|
||||||
|
required List<AnalyticsEventItem> items,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logViewCart(
|
||||||
|
currency: 'VND',
|
||||||
|
value: cartValue,
|
||||||
|
items: items,
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: view_cart - ${items.length} items');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log begin checkout event
|
||||||
|
static Future<void> logBeginCheckout({
|
||||||
|
required double value,
|
||||||
|
required List<AnalyticsEventItem> items,
|
||||||
|
String? coupon,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logBeginCheckout(
|
||||||
|
currency: 'VND',
|
||||||
|
value: value,
|
||||||
|
items: items,
|
||||||
|
coupon: coupon,
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: begin_checkout - $value VND');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log purchase event - when order is completed
|
||||||
|
static Future<void> logPurchase({
|
||||||
|
required String orderId,
|
||||||
|
required double value,
|
||||||
|
required List<AnalyticsEventItem> items,
|
||||||
|
double? shipping,
|
||||||
|
double? tax,
|
||||||
|
String? coupon,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logPurchase(
|
||||||
|
currency: 'VND',
|
||||||
|
transactionId: orderId,
|
||||||
|
value: value,
|
||||||
|
items: items,
|
||||||
|
shipping: shipping,
|
||||||
|
tax: tax,
|
||||||
|
coupon: coupon,
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: purchase - Order $orderId');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Search & Discovery Events
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Log search event
|
||||||
|
static Future<void> logSearch({
|
||||||
|
required String searchTerm,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logSearch(searchTerm: searchTerm);
|
||||||
|
debugPrint('📊 Analytics: search - $searchTerm');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log select item event - when user taps on a product in list
|
||||||
|
static Future<void> logSelectItem({
|
||||||
|
required String productId,
|
||||||
|
required String productName,
|
||||||
|
String? listName,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logSelectItem(
|
||||||
|
itemListName: listName,
|
||||||
|
items: [
|
||||||
|
AnalyticsEventItem(
|
||||||
|
itemId: productId,
|
||||||
|
itemName: productName,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: select_item - $productName');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Loyalty & Rewards Events
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Log earn points event
|
||||||
|
static Future<void> logEarnPoints({
|
||||||
|
required int points,
|
||||||
|
required String source,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logEarnVirtualCurrency(
|
||||||
|
virtualCurrencyName: 'loyalty_points',
|
||||||
|
value: points.toDouble(),
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: earn_points - $points from $source');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log spend points event - when user redeems points
|
||||||
|
static Future<void> logSpendPoints({
|
||||||
|
required int points,
|
||||||
|
required String itemName,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logSpendVirtualCurrency(
|
||||||
|
virtualCurrencyName: 'loyalty_points',
|
||||||
|
value: points.toDouble(),
|
||||||
|
itemName: itemName,
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: spend_points - $points for $itemName');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// User Events
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Log login event
|
||||||
|
static Future<void> logLogin({
|
||||||
|
String? method,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logLogin(loginMethod: method ?? 'phone');
|
||||||
|
debugPrint('📊 Analytics: login - $method');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log sign up event
|
||||||
|
static Future<void> logSignUp({
|
||||||
|
String? method,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logSignUp(signUpMethod: method ?? 'phone');
|
||||||
|
debugPrint('📊 Analytics: sign_up - $method');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Log share event
|
||||||
|
static Future<void> logShare({
|
||||||
|
required String contentType,
|
||||||
|
required String itemId,
|
||||||
|
String? method,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logShare(
|
||||||
|
contentType: contentType,
|
||||||
|
itemId: itemId,
|
||||||
|
method: method ?? 'unknown',
|
||||||
|
);
|
||||||
|
debugPrint('📊 Analytics: share - $contentType $itemId');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Custom Events
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Log custom event
|
||||||
|
static Future<void> logEvent({
|
||||||
|
required String name,
|
||||||
|
Map<String, Object>? parameters,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.logEvent(name: name, parameters: parameters);
|
||||||
|
debugPrint('📊 Analytics: $name');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set user ID for analytics
|
||||||
|
static Future<void> setUserId(String? userId) async {
|
||||||
|
try {
|
||||||
|
await _analytics.setUserId(id: userId);
|
||||||
|
debugPrint('📊 Analytics: setUserId - $userId');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set user property
|
||||||
|
static Future<void> setUserProperty({
|
||||||
|
required String name,
|
||||||
|
required String? value,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _analytics.setUserProperty(name: name, value: value);
|
||||||
|
debugPrint('📊 Analytics: setUserProperty - $name: $value');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('📊 Analytics error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -87,7 +87,7 @@ class FrappeAuthService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final url = '${ApiConstants.baseUrl}${ApiConstants.frappeApiMethod}${ApiConstants.frappeLogin}';
|
const url = '${ApiConstants.baseUrl}${ApiConstants.frappeApiMethod}${ApiConstants.frappeLogin}';
|
||||||
|
|
||||||
// Build cookie header
|
// Build cookie header
|
||||||
final storedSession = await getStoredSession();
|
final storedSession = await getStoredSession();
|
||||||
|
|||||||
@@ -5,62 +5,57 @@ import 'package:worker/core/theme/colors.dart';
|
|||||||
import 'package:worker/core/theme/typography.dart';
|
import 'package:worker/core/theme/typography.dart';
|
||||||
|
|
||||||
/// App theme configuration for Material 3 design system
|
/// App theme configuration for Material 3 design system
|
||||||
/// Provides both light and dark theme variants
|
/// Uses ColorScheme.fromSeed() to auto-generate harmonious colors from brand seed color
|
||||||
class AppTheme {
|
class AppTheme {
|
||||||
// Prevent instantiation
|
|
||||||
AppTheme._();
|
AppTheme._();
|
||||||
|
|
||||||
// ==================== Light Theme ====================
|
// ==================== Light Theme ====================
|
||||||
|
|
||||||
/// Light theme configuration
|
/// Light theme configuration
|
||||||
static ThemeData lightTheme() {
|
/// [seedColor] - Optional custom seed color, defaults to AppColors.defaultSeedColor
|
||||||
|
static ThemeData lightTheme([Color? seedColor]) {
|
||||||
|
final seed = seedColor ?? AppColors.defaultSeedColor;
|
||||||
final ColorScheme colorScheme = ColorScheme.fromSeed(
|
final ColorScheme colorScheme = ColorScheme.fromSeed(
|
||||||
seedColor: AppColors.primaryBlue,
|
seedColor: seed,
|
||||||
brightness: Brightness.light,
|
brightness: Brightness.light,
|
||||||
primary: AppColors.primaryBlue,
|
).copyWith(primary: seed);
|
||||||
secondary: AppColors.lightBlue,
|
|
||||||
tertiary: AppColors.accentCyan,
|
|
||||||
error: AppColors.danger,
|
|
||||||
surface: AppColors.white,
|
|
||||||
background: AppColors.grey50,
|
|
||||||
);
|
|
||||||
|
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme,
|
||||||
fontFamily: AppTypography.fontFamily,
|
fontFamily: AppTypography.fontFamily,
|
||||||
|
|
||||||
// ==================== App Bar Theme ====================
|
// AppBar uses colorScheme colors
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
centerTitle: true,
|
centerTitle: false,
|
||||||
backgroundColor: AppColors.primaryBlue,
|
backgroundColor: colorScheme.surface,
|
||||||
foregroundColor: AppColors.white,
|
foregroundColor: colorScheme.onSurface,
|
||||||
titleTextStyle: AppTypography.titleLarge.copyWith(
|
titleTextStyle: AppTypography.titleLarge.copyWith(
|
||||||
color: AppColors.white,
|
color: colorScheme.onSurface,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
iconTheme: const IconThemeData(color: AppColors.white, size: 24),
|
iconTheme: IconThemeData(color: colorScheme.onSurface, size: 24),
|
||||||
systemOverlayStyle: SystemUiOverlayStyle.light,
|
systemOverlayStyle: SystemUiOverlayStyle.dark,
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Card Theme ====================
|
// Card Theme
|
||||||
cardTheme: const CardThemeData(
|
cardTheme: CardThemeData(
|
||||||
elevation: 2,
|
elevation: 1,
|
||||||
shape: RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
color: AppColors.white,
|
color: colorScheme.surface,
|
||||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Elevated Button Theme ====================
|
// Elevated Button Theme
|
||||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: AppColors.primaryBlue,
|
backgroundColor: colorScheme.primary,
|
||||||
foregroundColor: AppColors.white,
|
foregroundColor: colorScheme.onPrimary,
|
||||||
elevation: 2,
|
elevation: 1,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
textStyle: AppTypography.buttonText,
|
textStyle: AppTypography.buttonText,
|
||||||
@@ -68,21 +63,21 @@ class AppTheme {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Text Button Theme ====================
|
// Text Button Theme
|
||||||
textButtonTheme: TextButtonThemeData(
|
textButtonTheme: TextButtonThemeData(
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
foregroundColor: AppColors.primaryBlue,
|
foregroundColor: colorScheme.primary,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
textStyle: AppTypography.buttonText,
|
textStyle: AppTypography.buttonText,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Outlined Button Theme ====================
|
// Outlined Button Theme
|
||||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||||
style: OutlinedButton.styleFrom(
|
style: OutlinedButton.styleFrom(
|
||||||
foregroundColor: AppColors.primaryBlue,
|
foregroundColor: colorScheme.primary,
|
||||||
side: const BorderSide(color: AppColors.primaryBlue, width: 1.5),
|
side: BorderSide(color: colorScheme.outline, width: 1),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
textStyle: AppTypography.buttonText,
|
textStyle: AppTypography.buttonText,
|
||||||
@@ -90,196 +85,150 @@ class AppTheme {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Input Decoration Theme ====================
|
// Input Decoration Theme
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: AppColors.white,
|
fillColor: colorScheme.surfaceContainerLowest,
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||||
horizontal: 16,
|
|
||||||
vertical: 16,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: AppColors.grey100, width: 1),
|
borderSide: BorderSide(color: colorScheme.outline, width: 1),
|
||||||
),
|
),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: AppColors.grey100, width: 1),
|
borderSide: BorderSide(color: colorScheme.outline, width: 1),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: AppColors.primaryBlue, width: 2),
|
borderSide: BorderSide(color: colorScheme.primary, width: 2),
|
||||||
),
|
),
|
||||||
errorBorder: OutlineInputBorder(
|
errorBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: AppColors.danger, width: 1),
|
borderSide: BorderSide(color: colorScheme.error, width: 1),
|
||||||
),
|
),
|
||||||
focusedErrorBorder: OutlineInputBorder(
|
focusedErrorBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: AppColors.danger, width: 2),
|
borderSide: BorderSide(color: colorScheme.error, width: 2),
|
||||||
),
|
),
|
||||||
labelStyle: AppTypography.bodyMedium.copyWith(color: AppColors.grey500),
|
labelStyle: AppTypography.bodyMedium.copyWith(
|
||||||
hintStyle: AppTypography.bodyMedium.copyWith(color: AppColors.grey500),
|
color: colorScheme.onSurfaceVariant,
|
||||||
errorStyle: AppTypography.bodySmall.copyWith(color: AppColors.danger),
|
),
|
||||||
|
hintStyle: AppTypography.bodyMedium.copyWith(
|
||||||
|
color: colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
errorStyle: AppTypography.bodySmall.copyWith(color: colorScheme.error),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Bottom Navigation Bar Theme ====================
|
// Bottom Navigation Bar Theme
|
||||||
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||||
backgroundColor: AppColors.white,
|
backgroundColor: colorScheme.surface,
|
||||||
selectedItemColor: AppColors.primaryBlue,
|
selectedItemColor: colorScheme.primary,
|
||||||
unselectedItemColor: AppColors.grey500,
|
unselectedItemColor: colorScheme.onSurfaceVariant,
|
||||||
selectedIconTheme: IconThemeData(
|
selectedIconTheme: IconThemeData(size: 28, color: colorScheme.primary),
|
||||||
size: 28,
|
unselectedIconTheme: IconThemeData(
|
||||||
color: AppColors.primaryBlue,
|
size: 24,
|
||||||
|
color: colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
unselectedIconTheme: IconThemeData(size: 24, color: AppColors.grey500),
|
selectedLabelStyle: const TextStyle(
|
||||||
selectedLabelStyle: TextStyle(
|
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontFamily: AppTypography.fontFamily,
|
fontFamily: AppTypography.fontFamily,
|
||||||
),
|
),
|
||||||
unselectedLabelStyle: TextStyle(
|
unselectedLabelStyle: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
fontFamily: AppTypography.fontFamily,
|
fontFamily: AppTypography.fontFamily,
|
||||||
),
|
),
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
elevation: 8,
|
elevation: 3,
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Floating Action Button Theme ====================
|
// Floating Action Button Theme
|
||||||
floatingActionButtonTheme: const FloatingActionButtonThemeData(
|
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||||
backgroundColor: AppColors.accentCyan,
|
backgroundColor: colorScheme.primaryContainer,
|
||||||
foregroundColor: AppColors.white,
|
foregroundColor: colorScheme.onPrimaryContainer,
|
||||||
elevation: 6,
|
elevation: 3,
|
||||||
shape: CircleBorder(),
|
shape: const CircleBorder(),
|
||||||
iconSize: 24,
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Chip Theme ====================
|
// Chip Theme
|
||||||
chipTheme: ChipThemeData(
|
chipTheme: ChipThemeData(
|
||||||
backgroundColor: AppColors.grey50,
|
backgroundColor: colorScheme.surfaceContainerLow,
|
||||||
selectedColor: AppColors.primaryBlue,
|
selectedColor: colorScheme.primaryContainer,
|
||||||
disabledColor: AppColors.grey100,
|
disabledColor: colorScheme.surfaceContainerLowest,
|
||||||
secondarySelectedColor: AppColors.lightBlue,
|
|
||||||
labelStyle: AppTypography.labelMedium,
|
labelStyle: AppTypography.labelMedium,
|
||||||
secondaryLabelStyle: AppTypography.labelMedium.copyWith(
|
|
||||||
color: AppColors.white,
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Dialog Theme ====================
|
// Dialog Theme
|
||||||
dialogTheme:
|
dialogTheme: DialogThemeData(
|
||||||
const DialogThemeData(
|
backgroundColor: colorScheme.surface,
|
||||||
backgroundColor: AppColors.white,
|
elevation: 3,
|
||||||
elevation: 8,
|
shape: const RoundedRectangleBorder(
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
),
|
),
|
||||||
).copyWith(
|
|
||||||
titleTextStyle: AppTypography.headlineMedium.copyWith(
|
titleTextStyle: AppTypography.headlineMedium.copyWith(
|
||||||
color: AppColors.grey900,
|
color: colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
contentTextStyle: AppTypography.bodyLarge.copyWith(
|
contentTextStyle: AppTypography.bodyLarge.copyWith(
|
||||||
color: AppColors.grey900,
|
color: colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Snackbar Theme ====================
|
// Snackbar Theme
|
||||||
snackBarTheme: SnackBarThemeData(
|
snackBarTheme: SnackBarThemeData(
|
||||||
backgroundColor: AppColors.grey900,
|
backgroundColor: colorScheme.inverseSurface,
|
||||||
contentTextStyle: AppTypography.bodyMedium.copyWith(
|
contentTextStyle: AppTypography.bodyMedium.copyWith(
|
||||||
color: AppColors.white,
|
color: colorScheme.onInverseSurface,
|
||||||
),
|
),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
behavior: SnackBarBehavior.floating,
|
behavior: SnackBarBehavior.floating,
|
||||||
elevation: 4,
|
elevation: 3,
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Divider Theme ====================
|
// Divider Theme
|
||||||
dividerTheme: const DividerThemeData(
|
dividerTheme: DividerThemeData(
|
||||||
color: AppColors.grey100,
|
color: colorScheme.outlineVariant,
|
||||||
thickness: 1,
|
thickness: 1,
|
||||||
space: 1,
|
space: 1,
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Icon Theme ====================
|
// Icon Theme
|
||||||
iconTheme: const IconThemeData(color: AppColors.grey900, size: 24),
|
iconTheme: IconThemeData(color: colorScheme.onSurface, size: 24),
|
||||||
|
|
||||||
// ==================== List Tile Theme ====================
|
// List Tile Theme
|
||||||
listTileTheme: ListTileThemeData(
|
listTileTheme: ListTileThemeData(
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
titleTextStyle: AppTypography.titleMedium.copyWith(
|
titleTextStyle: AppTypography.titleMedium.copyWith(
|
||||||
color: AppColors.grey900,
|
color: colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
subtitleTextStyle: AppTypography.bodyMedium.copyWith(
|
subtitleTextStyle: AppTypography.bodyMedium.copyWith(
|
||||||
color: AppColors.grey500,
|
color: colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
iconColor: AppColors.grey500,
|
iconColor: colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Switch Theme ====================
|
// Progress Indicator Theme
|
||||||
switchTheme: SwitchThemeData(
|
progressIndicatorTheme: ProgressIndicatorThemeData(
|
||||||
thumbColor: MaterialStateProperty.resolveWith((states) {
|
color: colorScheme.primary,
|
||||||
if (states.contains(MaterialState.selected)) {
|
linearTrackColor: colorScheme.surfaceContainerHighest,
|
||||||
return AppColors.primaryBlue;
|
circularTrackColor: colorScheme.surfaceContainerHighest,
|
||||||
}
|
|
||||||
return AppColors.grey500;
|
|
||||||
}),
|
|
||||||
trackColor: MaterialStateProperty.resolveWith((states) {
|
|
||||||
if (states.contains(MaterialState.selected)) {
|
|
||||||
return AppColors.lightBlue;
|
|
||||||
}
|
|
||||||
return AppColors.grey100;
|
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Checkbox Theme ====================
|
// Badge Theme
|
||||||
checkboxTheme: CheckboxThemeData(
|
|
||||||
fillColor: MaterialStateProperty.resolveWith((states) {
|
|
||||||
if (states.contains(MaterialState.selected)) {
|
|
||||||
return AppColors.primaryBlue;
|
|
||||||
}
|
|
||||||
return AppColors.white;
|
|
||||||
}),
|
|
||||||
checkColor: MaterialStateProperty.all(AppColors.white),
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
|
|
||||||
),
|
|
||||||
|
|
||||||
// ==================== Radio Theme ====================
|
|
||||||
radioTheme: RadioThemeData(
|
|
||||||
fillColor: MaterialStateProperty.resolveWith((states) {
|
|
||||||
if (states.contains(MaterialState.selected)) {
|
|
||||||
return AppColors.primaryBlue;
|
|
||||||
}
|
|
||||||
return AppColors.grey500;
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
|
|
||||||
// ==================== Progress Indicator Theme ====================
|
|
||||||
progressIndicatorTheme: const ProgressIndicatorThemeData(
|
|
||||||
color: AppColors.primaryBlue,
|
|
||||||
linearTrackColor: AppColors.grey100,
|
|
||||||
circularTrackColor: AppColors.grey100,
|
|
||||||
),
|
|
||||||
|
|
||||||
// ==================== Badge Theme ====================
|
|
||||||
badgeTheme: const BadgeThemeData(
|
badgeTheme: const BadgeThemeData(
|
||||||
backgroundColor: AppColors.danger,
|
backgroundColor: AppColors.danger,
|
||||||
textColor: AppColors.white,
|
textColor: Colors.white,
|
||||||
smallSize: 6,
|
smallSize: 6,
|
||||||
largeSize: 16,
|
largeSize: 16,
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Tab Bar Theme ====================
|
// Tab Bar Theme
|
||||||
tabBarTheme:
|
tabBarTheme: TabBarThemeData(
|
||||||
const TabBarThemeData(
|
labelColor: colorScheme.primary,
|
||||||
labelColor: AppColors.primaryBlue,
|
unselectedLabelColor: colorScheme.onSurfaceVariant,
|
||||||
unselectedLabelColor: AppColors.grey500,
|
indicatorColor: colorScheme.primary,
|
||||||
indicatorColor: AppColors.primaryBlue,
|
|
||||||
).copyWith(
|
|
||||||
labelStyle: AppTypography.labelLarge,
|
labelStyle: AppTypography.labelLarge,
|
||||||
unselectedLabelStyle: AppTypography.labelLarge,
|
unselectedLabelStyle: AppTypography.labelLarge,
|
||||||
),
|
),
|
||||||
@@ -289,54 +238,50 @@ class AppTheme {
|
|||||||
// ==================== Dark Theme ====================
|
// ==================== Dark Theme ====================
|
||||||
|
|
||||||
/// Dark theme configuration
|
/// Dark theme configuration
|
||||||
static ThemeData darkTheme() {
|
/// [seedColor] - Optional custom seed color, defaults to AppColors.defaultSeedColor
|
||||||
|
static ThemeData darkTheme([Color? seedColor]) {
|
||||||
|
final seed = seedColor ?? AppColors.defaultSeedColor;
|
||||||
final ColorScheme colorScheme = ColorScheme.fromSeed(
|
final ColorScheme colorScheme = ColorScheme.fromSeed(
|
||||||
seedColor: AppColors.primaryBlue,
|
seedColor: seed,
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
primary: AppColors.lightBlue,
|
).copyWith(primary: seed);
|
||||||
secondary: AppColors.accentCyan,
|
|
||||||
tertiary: AppColors.primaryBlue,
|
|
||||||
error: AppColors.danger,
|
|
||||||
surface: const Color(0xFF1E1E1E),
|
|
||||||
background: const Color(0xFF121212),
|
|
||||||
);
|
|
||||||
|
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme,
|
||||||
fontFamily: AppTypography.fontFamily,
|
fontFamily: AppTypography.fontFamily,
|
||||||
|
|
||||||
// ==================== App Bar Theme ====================
|
// AppBar Theme
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
centerTitle: true,
|
centerTitle: false,
|
||||||
backgroundColor: const Color(0xFF1E1E1E),
|
backgroundColor: colorScheme.surface,
|
||||||
foregroundColor: AppColors.white,
|
foregroundColor: colorScheme.onSurface,
|
||||||
titleTextStyle: AppTypography.titleLarge.copyWith(
|
titleTextStyle: AppTypography.titleLarge.copyWith(
|
||||||
color: AppColors.white,
|
color: colorScheme.onSurface,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
iconTheme: const IconThemeData(color: AppColors.white, size: 24),
|
iconTheme: IconThemeData(color: colorScheme.onSurface, size: 24),
|
||||||
systemOverlayStyle: SystemUiOverlayStyle.light,
|
systemOverlayStyle: SystemUiOverlayStyle.light,
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Card Theme ====================
|
// Card Theme
|
||||||
cardTheme: const CardThemeData(
|
cardTheme: CardThemeData(
|
||||||
elevation: 2,
|
elevation: 1,
|
||||||
shape: RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
color: Color(0xFF1E1E1E),
|
color: colorScheme.surfaceContainer,
|
||||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Elevated Button Theme ====================
|
// Elevated Button Theme
|
||||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: AppColors.lightBlue,
|
backgroundColor: colorScheme.primary,
|
||||||
foregroundColor: AppColors.white,
|
foregroundColor: colorScheme.onPrimary,
|
||||||
elevation: 2,
|
elevation: 1,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
textStyle: AppTypography.buttonText,
|
textStyle: AppTypography.buttonText,
|
||||||
@@ -344,78 +289,89 @@ class AppTheme {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Input Decoration Theme ====================
|
// Input Decoration Theme
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: const Color(0xFF2A2A2A),
|
fillColor: colorScheme.surfaceContainerHighest,
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||||
horizontal: 16,
|
|
||||||
vertical: 16,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: Color(0xFF3A3A3A), width: 1),
|
borderSide: BorderSide(color: colorScheme.outline, width: 1),
|
||||||
),
|
),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: Color(0xFF3A3A3A), width: 1),
|
borderSide: BorderSide(color: colorScheme.outline, width: 1),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: AppColors.lightBlue, width: 2),
|
borderSide: BorderSide(color: colorScheme.primary, width: 2),
|
||||||
),
|
),
|
||||||
errorBorder: OutlineInputBorder(
|
errorBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: AppColors.danger, width: 1),
|
borderSide: BorderSide(color: colorScheme.error, width: 1),
|
||||||
),
|
),
|
||||||
focusedErrorBorder: OutlineInputBorder(
|
focusedErrorBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: const BorderSide(color: AppColors.danger, width: 2),
|
borderSide: BorderSide(color: colorScheme.error, width: 2),
|
||||||
),
|
),
|
||||||
labelStyle: AppTypography.bodyMedium.copyWith(color: AppColors.grey500),
|
labelStyle: AppTypography.bodyMedium.copyWith(
|
||||||
hintStyle: AppTypography.bodyMedium.copyWith(color: AppColors.grey500),
|
color: colorScheme.onSurfaceVariant,
|
||||||
errorStyle: AppTypography.bodySmall.copyWith(color: AppColors.danger),
|
),
|
||||||
|
hintStyle: AppTypography.bodyMedium.copyWith(
|
||||||
|
color: colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
errorStyle: AppTypography.bodySmall.copyWith(color: colorScheme.error),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Bottom Navigation Bar Theme ====================
|
// Bottom Navigation Bar Theme
|
||||||
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||||
backgroundColor: Color(0xFF1E1E1E),
|
backgroundColor: colorScheme.surface,
|
||||||
selectedItemColor: AppColors.lightBlue,
|
selectedItemColor: colorScheme.primary,
|
||||||
unselectedItemColor: AppColors.grey500,
|
unselectedItemColor: colorScheme.onSurfaceVariant,
|
||||||
selectedIconTheme: IconThemeData(size: 28, color: AppColors.lightBlue),
|
selectedIconTheme: IconThemeData(size: 28, color: colorScheme.primary),
|
||||||
unselectedIconTheme: IconThemeData(size: 24, color: AppColors.grey500),
|
unselectedIconTheme: IconThemeData(
|
||||||
selectedLabelStyle: TextStyle(
|
size: 24,
|
||||||
|
color: colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
selectedLabelStyle: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontFamily: AppTypography.fontFamily,
|
fontFamily: AppTypography.fontFamily,
|
||||||
),
|
),
|
||||||
unselectedLabelStyle: TextStyle(
|
unselectedLabelStyle: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
fontFamily: AppTypography.fontFamily,
|
fontFamily: AppTypography.fontFamily,
|
||||||
),
|
),
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
elevation: 8,
|
elevation: 3,
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Floating Action Button Theme ====================
|
// Floating Action Button Theme
|
||||||
floatingActionButtonTheme: const FloatingActionButtonThemeData(
|
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||||
backgroundColor: AppColors.accentCyan,
|
backgroundColor: colorScheme.primaryContainer,
|
||||||
foregroundColor: AppColors.white,
|
foregroundColor: colorScheme.onPrimaryContainer,
|
||||||
elevation: 6,
|
elevation: 3,
|
||||||
shape: CircleBorder(),
|
shape: const CircleBorder(),
|
||||||
iconSize: 24,
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// ==================== Snackbar Theme ====================
|
// Snackbar Theme
|
||||||
snackBarTheme: SnackBarThemeData(
|
snackBarTheme: SnackBarThemeData(
|
||||||
backgroundColor: const Color(0xFF2A2A2A),
|
backgroundColor: colorScheme.inverseSurface,
|
||||||
contentTextStyle: AppTypography.bodyMedium.copyWith(
|
contentTextStyle: AppTypography.bodyMedium.copyWith(
|
||||||
color: AppColors.white,
|
color: colorScheme.onInverseSurface,
|
||||||
),
|
),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
behavior: SnackBarBehavior.floating,
|
behavior: SnackBarBehavior.floating,
|
||||||
elevation: 4,
|
elevation: 3,
|
||||||
|
),
|
||||||
|
|
||||||
|
// Badge Theme
|
||||||
|
badgeTheme: const BadgeThemeData(
|
||||||
|
backgroundColor: AppColors.danger,
|
||||||
|
textColor: Colors.white,
|
||||||
|
smallSize: 6,
|
||||||
|
largeSize: 16,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,66 +1,164 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// Seed color option for theme customization
|
||||||
|
class SeedColorOption {
|
||||||
|
const SeedColorOption({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.color,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final Color color;
|
||||||
|
}
|
||||||
|
|
||||||
/// App color palette following the Worker app design system.
|
/// App color palette following the Worker app design system.
|
||||||
///
|
///
|
||||||
/// Primary colors are used for main UI elements, tier colors for membership cards,
|
/// Uses Material 3 ColorScheme.fromSeed() for primary/surface colors.
|
||||||
/// status colors for feedback, and neutral colors for text and backgrounds.
|
/// Only status colors and tier gradients are defined here as they come from backend.
|
||||||
|
///
|
||||||
|
/// ## Usage Guide:
|
||||||
|
/// - For themed colors, use `Theme.of(context).colorScheme.xxx`
|
||||||
|
/// - For status colors, use `AppColors.success/warning/danger/info`
|
||||||
|
/// - For tier gradients, use `AppColors.xxxGradient`
|
||||||
|
///
|
||||||
|
/// ## ColorScheme Quick Reference:
|
||||||
|
/// ```dart
|
||||||
|
/// final cs = Theme.of(context).colorScheme;
|
||||||
|
/// cs.primary // Brand color for buttons, links
|
||||||
|
/// cs.onPrimary // Text/icons on primary
|
||||||
|
/// cs.primaryContainer // Softer brand backgrounds
|
||||||
|
/// cs.surface // Card/container backgrounds
|
||||||
|
/// cs.onSurface // Primary text color
|
||||||
|
/// cs.onSurfaceVariant // Secondary text color
|
||||||
|
/// cs.outline // Borders
|
||||||
|
/// cs.error // Error states
|
||||||
|
/// ```
|
||||||
class AppColors {
|
class AppColors {
|
||||||
// Primary Colors
|
AppColors._();
|
||||||
/// Main brand color - Used for primary buttons, app bar, etc.
|
|
||||||
static const primaryBlue = Color(0xFF005B9A);
|
|
||||||
|
|
||||||
/// Light variant of primary color - Used for highlights and accents
|
// ==================== Brand Seed Colors ====================
|
||||||
static const lightBlue = Color(0xFF38B6FF);
|
/// Default brand color - Used as seed for ColorScheme.fromSeed()
|
||||||
|
static const Color defaultSeedColor = Color(0xFF005B9A);
|
||||||
|
|
||||||
/// Accent color for special actions - Used for FAB, links, etc.
|
/// Available seed colors for theme customization
|
||||||
static const accentCyan = Color(0xFF35C6F4);
|
/// User can select one of these to change the app's color scheme
|
||||||
|
static const List<SeedColorOption> seedColorOptions = [
|
||||||
|
SeedColorOption(
|
||||||
|
id: 'blue',
|
||||||
|
name: 'Xanh dương',
|
||||||
|
color: Color(0xFF005B9A),
|
||||||
|
),
|
||||||
|
SeedColorOption(
|
||||||
|
id: 'teal',
|
||||||
|
name: 'Xanh ngọc',
|
||||||
|
color: Color(0xFF009688),
|
||||||
|
),
|
||||||
|
SeedColorOption(
|
||||||
|
id: 'green',
|
||||||
|
name: 'Xanh lá',
|
||||||
|
color: Color(0xFF4CAF50),
|
||||||
|
),
|
||||||
|
SeedColorOption(
|
||||||
|
id: 'purple',
|
||||||
|
name: 'Tím',
|
||||||
|
color: Color(0xFF673AB7),
|
||||||
|
),
|
||||||
|
SeedColorOption(
|
||||||
|
id: 'indigo',
|
||||||
|
name: 'Chàm',
|
||||||
|
color: Color(0xFF3F51B5),
|
||||||
|
),
|
||||||
|
SeedColorOption(
|
||||||
|
id: 'orange',
|
||||||
|
name: 'Cam',
|
||||||
|
color: Color(0xFFFF5722),
|
||||||
|
),
|
||||||
|
SeedColorOption(
|
||||||
|
id: 'red',
|
||||||
|
name: 'Đỏ',
|
||||||
|
color: Color(0xFFE53935),
|
||||||
|
),
|
||||||
|
SeedColorOption(
|
||||||
|
id: 'pink',
|
||||||
|
name: 'Hồng',
|
||||||
|
color: Color(0xFFE91E63),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
// Status Colors
|
/// Get seed color by ID, returns default if not found
|
||||||
|
static Color getSeedColorById(String? id) {
|
||||||
|
if (id == null) return defaultSeedColor;
|
||||||
|
return seedColorOptions
|
||||||
|
.firstWhere(
|
||||||
|
(option) => option.id == id,
|
||||||
|
orElse: () => seedColorOptions.first,
|
||||||
|
)
|
||||||
|
.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== Convenience Aliases (for backward compatibility) ====================
|
||||||
|
// DEPRECATED: Prefer using Theme.of(context).colorScheme instead
|
||||||
|
// These are kept for gradual migration
|
||||||
|
|
||||||
|
/// @Deprecated('Use Theme.of(context).colorScheme.primary instead')
|
||||||
|
static const Color primaryBlue = defaultSeedColor;
|
||||||
|
|
||||||
|
/// Alias for backward compatibility
|
||||||
|
static const Color seedColor = defaultSeedColor;
|
||||||
|
|
||||||
|
/// @Deprecated('Use Theme.of(context).colorScheme.primaryContainer')
|
||||||
|
static const Color lightBlue = Color(0xFF38B6FF);
|
||||||
|
|
||||||
|
/// @Deprecated('Use Theme.of(context).colorScheme.tertiary')
|
||||||
|
static const Color accentCyan = Color(0xFF35C6F4);
|
||||||
|
|
||||||
|
/// @Deprecated('Use Colors.white or colorScheme.surface instead')
|
||||||
|
static const Color white = Colors.white;
|
||||||
|
|
||||||
|
/// @Deprecated('Use Theme.of(context).colorScheme.surfaceContainerLowest')
|
||||||
|
static const Color grey50 = Color(0xFFf8f9fa);
|
||||||
|
|
||||||
|
/// @Deprecated('Use Theme.of(context).colorScheme.outline')
|
||||||
|
static const Color grey100 = Color(0xFFe9ecef);
|
||||||
|
|
||||||
|
/// @Deprecated('Use Theme.of(context).colorScheme.onSurfaceVariant')
|
||||||
|
static const Color grey500 = Color(0xFF6c757d);
|
||||||
|
|
||||||
|
/// @Deprecated('Use Theme.of(context).colorScheme.onSurface')
|
||||||
|
static const Color grey900 = Color(0xFF343a40);
|
||||||
|
|
||||||
|
// ==================== Status Colors (from backend) ====================
|
||||||
/// Success state - Used for completed actions, positive feedback
|
/// Success state - Used for completed actions, positive feedback
|
||||||
static const success = Color(0xFF28a745);
|
static const Color success = Color(0xFF28a745);
|
||||||
|
|
||||||
/// Warning state - Used for caution messages, pending states
|
/// Warning state - Used for caution messages, pending states
|
||||||
static const warning = Color(0xFFffc107);
|
static const Color warning = Color(0xFFffc107);
|
||||||
|
|
||||||
/// Danger/Error state - Used for errors, destructive actions
|
/// Danger/Error state - Used for errors, destructive actions
|
||||||
static const danger = Color(0xFFdc3545);
|
static const Color danger = Color(0xFFdc3545);
|
||||||
|
|
||||||
/// Info state - Used for informational messages
|
/// Info state - Used for informational messages
|
||||||
static const info = Color(0xFF17a2b8);
|
static const Color info = Color(0xFF17a2b8);
|
||||||
|
|
||||||
// Neutral Colors
|
// ==================== Tier Gradients for Membership Cards ====================
|
||||||
/// Lightest background shade
|
|
||||||
static const grey50 = Color(0xFFf8f9fa);
|
|
||||||
|
|
||||||
/// Light background/border shade
|
|
||||||
static const grey100 = Color(0xFFe9ecef);
|
|
||||||
|
|
||||||
/// Medium grey for secondary text
|
|
||||||
static const grey500 = Color(0xFF6c757d);
|
|
||||||
|
|
||||||
/// Dark grey for primary text
|
|
||||||
static const grey900 = Color(0xFF343a40);
|
|
||||||
|
|
||||||
/// Pure white
|
|
||||||
static const white = Color(0xFFFFFFFF);
|
|
||||||
|
|
||||||
// Tier Gradients for Membership Cards
|
|
||||||
/// Diamond tier gradient (purple-blue)
|
/// Diamond tier gradient (purple-blue)
|
||||||
static const diamondGradient = LinearGradient(
|
static const LinearGradient diamondGradient = LinearGradient(
|
||||||
colors: [Color(0xFF4A00E0), Color(0xFF8E2DE2)],
|
colors: [Color(0xFF4A00E0), Color(0xFF8E2DE2)],
|
||||||
begin: Alignment.topLeft,
|
begin: Alignment.topLeft,
|
||||||
end: Alignment.bottomRight,
|
end: Alignment.bottomRight,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Platinum tier gradient (grey-silver)
|
/// Platinum tier gradient (grey-silver)
|
||||||
static const platinumGradient = LinearGradient(
|
static const LinearGradient platinumGradient = LinearGradient(
|
||||||
colors: [Color(0xFF7F8C8D), Color(0xFFBDC3C7)],
|
colors: [Color(0xFF7F8C8D), Color(0xFFBDC3C7)],
|
||||||
begin: Alignment.topLeft,
|
begin: Alignment.topLeft,
|
||||||
end: Alignment.bottomRight,
|
end: Alignment.bottomRight,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Gold tier gradient (yellow-orange)
|
/// Gold tier gradient (yellow-orange)
|
||||||
static const goldGradient = LinearGradient(
|
static const LinearGradient goldGradient = LinearGradient(
|
||||||
colors: [Color(0xFFf7b733), Color(0xFFfc4a1a)],
|
colors: [Color(0xFFf7b733), Color(0xFFfc4a1a)],
|
||||||
begin: Alignment.topLeft,
|
begin: Alignment.topLeft,
|
||||||
end: Alignment.bottomRight,
|
end: Alignment.bottomRight,
|
||||||
|
|||||||
88
lib/core/theme/theme_provider.dart
Normal file
88
lib/core/theme/theme_provider.dart
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
import 'package:worker/core/database/app_settings_box.dart';
|
||||||
|
import 'package:worker/core/theme/colors.dart';
|
||||||
|
|
||||||
|
part 'theme_provider.g.dart';
|
||||||
|
|
||||||
|
/// Theme settings state
|
||||||
|
class ThemeSettings {
|
||||||
|
const ThemeSettings({
|
||||||
|
required this.seedColorId,
|
||||||
|
required this.themeMode,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String seedColorId;
|
||||||
|
final ThemeMode themeMode;
|
||||||
|
|
||||||
|
/// Get the actual Color from the seed color ID
|
||||||
|
Color get seedColor => AppColors.getSeedColorById(seedColorId);
|
||||||
|
|
||||||
|
/// Get the SeedColorOption from the ID
|
||||||
|
SeedColorOption get seedColorOption => AppColors.seedColorOptions.firstWhere(
|
||||||
|
(option) => option.id == seedColorId,
|
||||||
|
orElse: () => AppColors.seedColorOptions.first,
|
||||||
|
);
|
||||||
|
|
||||||
|
ThemeSettings copyWith({
|
||||||
|
String? seedColorId,
|
||||||
|
ThemeMode? themeMode,
|
||||||
|
}) {
|
||||||
|
return ThemeSettings(
|
||||||
|
seedColorId: seedColorId ?? this.seedColorId,
|
||||||
|
themeMode: themeMode ?? this.themeMode,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provider for managing theme settings with Hive persistence
|
||||||
|
/// Uses AppSettingsBox for storage
|
||||||
|
@Riverpod(keepAlive: true)
|
||||||
|
class ThemeSettingsNotifier extends _$ThemeSettingsNotifier {
|
||||||
|
@override
|
||||||
|
ThemeSettings build() {
|
||||||
|
return _loadFromSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeSettings _loadFromSettings() {
|
||||||
|
return ThemeSettings(
|
||||||
|
seedColorId: AppSettingsBox.getSeedColorId(),
|
||||||
|
themeMode: ThemeMode.values[AppSettingsBox.getThemeModeIndex()],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update seed color
|
||||||
|
Future<void> setSeedColor(String colorId) async {
|
||||||
|
await AppSettingsBox.setSeedColorId(colorId);
|
||||||
|
state = state.copyWith(seedColorId: colorId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update theme mode (light/dark/system)
|
||||||
|
Future<void> setThemeMode(ThemeMode mode) async {
|
||||||
|
await AppSettingsBox.setThemeModeIndex(mode.index);
|
||||||
|
state = state.copyWith(themeMode: mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Toggle between light and dark mode
|
||||||
|
Future<void> toggleThemeMode() async {
|
||||||
|
final newMode =
|
||||||
|
state.themeMode == ThemeMode.light ? ThemeMode.dark : ThemeMode.light;
|
||||||
|
await setThemeMode(newMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provider for the current seed color (convenience provider)
|
||||||
|
@riverpod
|
||||||
|
Color currentSeedColor(Ref ref) {
|
||||||
|
return ref.watch(
|
||||||
|
themeSettingsProvider.select((settings) => settings.seedColor),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provider for available seed color options
|
||||||
|
@riverpod
|
||||||
|
List<SeedColorOption> seedColorOptions(Ref ref) {
|
||||||
|
return AppColors.seedColorOptions;
|
||||||
|
}
|
||||||
171
lib/core/theme/theme_provider.g.dart
Normal file
171
lib/core/theme/theme_provider.g.dart
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'theme_provider.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// RiverpodGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
/// Provider for managing theme settings with Hive persistence
|
||||||
|
/// Uses AppSettingsBox for storage
|
||||||
|
|
||||||
|
@ProviderFor(ThemeSettingsNotifier)
|
||||||
|
const themeSettingsProvider = ThemeSettingsNotifierProvider._();
|
||||||
|
|
||||||
|
/// Provider for managing theme settings with Hive persistence
|
||||||
|
/// Uses AppSettingsBox for storage
|
||||||
|
final class ThemeSettingsNotifierProvider
|
||||||
|
extends $NotifierProvider<ThemeSettingsNotifier, ThemeSettings> {
|
||||||
|
/// Provider for managing theme settings with Hive persistence
|
||||||
|
/// Uses AppSettingsBox for storage
|
||||||
|
const ThemeSettingsNotifierProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'themeSettingsProvider',
|
||||||
|
isAutoDispose: false,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$themeSettingsNotifierHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ThemeSettingsNotifier create() => ThemeSettingsNotifier();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(ThemeSettings value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<ThemeSettings>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$themeSettingsNotifierHash() =>
|
||||||
|
r'5befe194684b8c1857302c9573f5eee38199fa97';
|
||||||
|
|
||||||
|
/// Provider for managing theme settings with Hive persistence
|
||||||
|
/// Uses AppSettingsBox for storage
|
||||||
|
|
||||||
|
abstract class _$ThemeSettingsNotifier extends $Notifier<ThemeSettings> {
|
||||||
|
ThemeSettings build();
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build();
|
||||||
|
final ref = this.ref as $Ref<ThemeSettings, ThemeSettings>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<ThemeSettings, ThemeSettings>,
|
||||||
|
ThemeSettings,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provider for the current seed color (convenience provider)
|
||||||
|
|
||||||
|
@ProviderFor(currentSeedColor)
|
||||||
|
const currentSeedColorProvider = CurrentSeedColorProvider._();
|
||||||
|
|
||||||
|
/// Provider for the current seed color (convenience provider)
|
||||||
|
|
||||||
|
final class CurrentSeedColorProvider
|
||||||
|
extends $FunctionalProvider<Color, Color, Color>
|
||||||
|
with $Provider<Color> {
|
||||||
|
/// Provider for the current seed color (convenience provider)
|
||||||
|
const CurrentSeedColorProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'currentSeedColorProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$currentSeedColorHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$ProviderElement<Color> $createElement($ProviderPointer pointer) =>
|
||||||
|
$ProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color create(Ref ref) {
|
||||||
|
return currentSeedColor(ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(Color value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<Color>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$currentSeedColorHash() => r'c6807df84f2ac257b2650b2f1aa04d2572cbde37';
|
||||||
|
|
||||||
|
/// Provider for available seed color options
|
||||||
|
|
||||||
|
@ProviderFor(seedColorOptions)
|
||||||
|
const seedColorOptionsProvider = SeedColorOptionsProvider._();
|
||||||
|
|
||||||
|
/// Provider for available seed color options
|
||||||
|
|
||||||
|
final class SeedColorOptionsProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
List<SeedColorOption>,
|
||||||
|
List<SeedColorOption>,
|
||||||
|
List<SeedColorOption>
|
||||||
|
>
|
||||||
|
with $Provider<List<SeedColorOption>> {
|
||||||
|
/// Provider for available seed color options
|
||||||
|
const SeedColorOptionsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'seedColorOptionsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$seedColorOptionsHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$ProviderElement<List<SeedColorOption>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $ProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<SeedColorOption> create(Ref ref) {
|
||||||
|
return seedColorOptions(ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(List<SeedColorOption> value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<List<SeedColorOption>>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$seedColorOptionsHash() => r'2cb0f7bf9e87394716f44a70b212b4d62f828152';
|
||||||
@@ -7,6 +7,7 @@ library;
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// String Extensions
|
// String Extensions
|
||||||
@@ -422,26 +423,26 @@ extension BuildContextExtensions on BuildContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Navigate to route
|
/// Navigate to route
|
||||||
Future<T?> push<T>(Widget page) {
|
// Future<T?> push<T>(Widget page) {
|
||||||
return Navigator.of(this).push<T>(MaterialPageRoute(builder: (_) => page));
|
// return Navigator.of(this).push<T>(MaterialPageRoute(builder: (_) => page));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// Navigate and replace current route
|
/// Navigate and replace current route
|
||||||
Future<T?> pushReplacement<T>(Widget page) {
|
// Future<T?> pushReplacement<T>(Widget page) {
|
||||||
return Navigator.of(
|
// return Navigator.of(
|
||||||
this,
|
// this,
|
||||||
).pushReplacement<T, void>(MaterialPageRoute(builder: (_) => page));
|
// ).pushReplacement<T, void>(MaterialPageRoute(builder: (_) => page));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// Pop current route
|
/// Pop current route
|
||||||
void pop<T>([T? result]) {
|
// void pop<T>([T? result]) {
|
||||||
Navigator.of(this).pop(result);
|
// GoRouter.of(this).pop(result);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// Pop until first route
|
/// Pop until first route
|
||||||
void popUntilFirst() {
|
// void popUntilFirst() {
|
||||||
Navigator.of(this).popUntil((route) => route.isFirst);
|
// Navigator.of(this).popUntil((route) => route.isFirst);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -466,4 +467,26 @@ extension NumExtensions on num {
|
|||||||
final mod = math.pow(10.0, places);
|
final mod = math.pow(10.0, places);
|
||||||
return ((this * mod).round().toDouble() / mod);
|
return ((this * mod).round().toDouble() / mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Format as Vietnamese currency (đồng)
|
||||||
|
/// Returns formatted string like "1.153.434đ"
|
||||||
|
String get toVNCurrency {
|
||||||
|
final formatter = NumberFormat.currency(
|
||||||
|
locale: 'vi_VN',
|
||||||
|
symbol: 'đ',
|
||||||
|
decimalDigits: 0,
|
||||||
|
);
|
||||||
|
return formatter.format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Format as Vietnamese currency with custom symbol
|
||||||
|
/// Returns formatted string with custom symbol
|
||||||
|
String toCurrency({String symbol = 'đ', int decimalDigits = 0}) {
|
||||||
|
final formatter = NumberFormat.currency(
|
||||||
|
locale: 'vi_VN',
|
||||||
|
symbol: symbol,
|
||||||
|
decimalDigits: decimalDigits,
|
||||||
|
);
|
||||||
|
return formatter.format(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:worker/core/theme/colors.dart';
|
import 'package:worker/core/theme/colors.dart';
|
||||||
|
import 'package:worker/core/widgets/loading_indicator.dart';
|
||||||
|
|
||||||
/// Button variant types for different use cases.
|
/// Button variant types for different use cases.
|
||||||
enum ButtonVariant {
|
enum ButtonVariant {
|
||||||
@@ -106,14 +107,7 @@ class CustomButton extends StatelessWidget {
|
|||||||
/// Builds the button content (text, icon, or loading indicator)
|
/// Builds the button content (text, icon, or loading indicator)
|
||||||
Widget _buildContent() {
|
Widget _buildContent() {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return const SizedBox(
|
return const CustomLoadingIndicator(size: 20, color: Colors.white);
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 2,
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||||
|
|
||||||
import 'package:worker/core/theme/colors.dart';
|
import 'package:worker/core/theme/colors.dart';
|
||||||
|
|
||||||
/// Custom loading indicator widget with optional message text.
|
/// Custom loading indicator widget with optional message text.
|
||||||
///
|
///
|
||||||
/// Displays a centered circular progress indicator with an optional
|
/// Displays a centered three rotating dots animation with an optional
|
||||||
/// message below it. Used for loading states throughout the app.
|
/// message below it. Used for loading states throughout the app.
|
||||||
///
|
///
|
||||||
/// Example usage:
|
/// Example usage:
|
||||||
@@ -32,19 +33,14 @@ class CustomLoadingIndicator extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final colorScheme = Theme.of(context).colorScheme;
|
||||||
return Center(
|
return Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
LoadingAnimationWidget.threeRotatingDots(
|
||||||
width: size,
|
color: color ?? colorScheme.primary,
|
||||||
height: size,
|
size: size,
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 3,
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
|
||||||
color ?? AppColors.primaryBlue,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (message != null) ...[
|
if (message != null) ...[
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|||||||
@@ -0,0 +1,208 @@
|
|||||||
|
/// Address Remote Data Source
|
||||||
|
///
|
||||||
|
/// Handles API calls to Frappe ERPNext address endpoints.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:worker/core/errors/exceptions.dart';
|
||||||
|
import 'package:worker/features/account/data/models/address_model.dart';
|
||||||
|
|
||||||
|
/// Address Remote Data Source
|
||||||
|
///
|
||||||
|
/// Provides methods to interact with address API endpoints.
|
||||||
|
/// Online-only approach - no offline caching.
|
||||||
|
class AddressRemoteDataSource {
|
||||||
|
final Dio _dio;
|
||||||
|
|
||||||
|
AddressRemoteDataSource(this._dio);
|
||||||
|
|
||||||
|
/// Get list of addresses
|
||||||
|
///
|
||||||
|
/// Fetches all addresses for the authenticated user.
|
||||||
|
/// Optionally filter by default address.
|
||||||
|
///
|
||||||
|
/// API: GET /api/method/building_material.building_material.api.address.get_list
|
||||||
|
Future<List<AddressModel>> getAddresses({
|
||||||
|
int limitStart = 0,
|
||||||
|
int limitPageLength = 0,
|
||||||
|
bool? isDefault,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
_debugPrint('Fetching addresses list...');
|
||||||
|
|
||||||
|
final response = await _dio.post(
|
||||||
|
'/api/method/building_material.building_material.api.address.get_list',
|
||||||
|
data: {
|
||||||
|
'limit_start': limitStart,
|
||||||
|
'limit_page_length': limitPageLength,
|
||||||
|
if (isDefault != null) 'is_default': isDefault,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = response.data;
|
||||||
|
_debugPrint('Response data: $data');
|
||||||
|
|
||||||
|
// Extract addresses from response
|
||||||
|
if (data is Map<String, dynamic> && data.containsKey('message')) {
|
||||||
|
final message = data['message'];
|
||||||
|
_debugPrint('Message type: ${message.runtimeType}');
|
||||||
|
|
||||||
|
// Handle array response
|
||||||
|
if (message is List) {
|
||||||
|
_debugPrint('Parsing ${message.length} addresses from list');
|
||||||
|
final addresses = <AddressModel>[];
|
||||||
|
for (var i = 0; i < message.length; i++) {
|
||||||
|
try {
|
||||||
|
final item = message[i] as Map<String, dynamic>;
|
||||||
|
_debugPrint('Parsing address $i: $item');
|
||||||
|
final address = AddressModel.fromJson(item);
|
||||||
|
addresses.add(address);
|
||||||
|
} catch (e) {
|
||||||
|
_debugPrint('Error parsing address $i: $e');
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_debugPrint('Fetched ${addresses.length} addresses');
|
||||||
|
return addresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle object with data field
|
||||||
|
if (message is Map<String, dynamic> && message.containsKey('data')) {
|
||||||
|
final dataList = message['data'] as List;
|
||||||
|
_debugPrint('Parsing ${dataList.length} addresses from data field');
|
||||||
|
final addresses = <AddressModel>[];
|
||||||
|
for (var i = 0; i < dataList.length; i++) {
|
||||||
|
try {
|
||||||
|
final item = dataList[i] as Map<String, dynamic>;
|
||||||
|
_debugPrint('Parsing address $i: $item');
|
||||||
|
final address = AddressModel.fromJson(item);
|
||||||
|
addresses.add(address);
|
||||||
|
} catch (e) {
|
||||||
|
_debugPrint('Error parsing address $i: $e');
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_debugPrint('Fetched ${addresses.length} addresses');
|
||||||
|
return addresses;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw const ServerException('Invalid response format');
|
||||||
|
} else {
|
||||||
|
throw ServerException(
|
||||||
|
'Failed to fetch addresses: ${response.statusCode}',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
_debugPrint('Error fetching addresses: $e');
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create or update address
|
||||||
|
///
|
||||||
|
/// If name is provided (not empty), updates existing address.
|
||||||
|
/// If name is null/empty, creates new address.
|
||||||
|
///
|
||||||
|
/// Per API docs: When name field is null/empty, the API creates a new address.
|
||||||
|
/// When name has a value, the API updates the existing address.
|
||||||
|
///
|
||||||
|
/// API: POST /api/method/building_material.building_material.api.address.update
|
||||||
|
Future<AddressModel> saveAddress(AddressModel address) async {
|
||||||
|
try {
|
||||||
|
final isUpdate = address.name.isNotEmpty;
|
||||||
|
_debugPrint(
|
||||||
|
isUpdate
|
||||||
|
? 'Updating address: ${address.name}'
|
||||||
|
: 'Creating new address',
|
||||||
|
);
|
||||||
|
|
||||||
|
// toJson() already handles setting name to null for creation
|
||||||
|
final data = address.toJson();
|
||||||
|
_debugPrint('Request data: $data');
|
||||||
|
|
||||||
|
final response = await _dio.post(
|
||||||
|
'/api/method/building_material.building_material.api.address.update',
|
||||||
|
data: data,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = response.data;
|
||||||
|
_debugPrint('Response data: $data');
|
||||||
|
|
||||||
|
// Check for API error response (even with 200 status)
|
||||||
|
if (data is Map<String, dynamic> && data.containsKey('message')) {
|
||||||
|
final message = data['message'];
|
||||||
|
|
||||||
|
// Check for error response format
|
||||||
|
if (message is Map<String, dynamic> && message.containsKey('error')) {
|
||||||
|
final error = message['error'] as String;
|
||||||
|
_debugPrint('API error: $error');
|
||||||
|
throw ServerException(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle direct address object
|
||||||
|
if (message is Map<String, dynamic>) {
|
||||||
|
final savedAddress = AddressModel.fromJson(message);
|
||||||
|
_debugPrint('Address saved: ${savedAddress.name}');
|
||||||
|
return savedAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle nested data
|
||||||
|
if (message is Map<String, dynamic> && message.containsKey('data')) {
|
||||||
|
final savedAddress =
|
||||||
|
AddressModel.fromJson(message['data'] as Map<String, dynamic>);
|
||||||
|
_debugPrint('Address saved: ${savedAddress.name}');
|
||||||
|
return savedAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw const ServerException('Invalid response format');
|
||||||
|
} else {
|
||||||
|
throw ServerException(
|
||||||
|
'Failed to save address: ${response.statusCode}',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
_debugPrint('Error saving address: $e');
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Delete address
|
||||||
|
///
|
||||||
|
/// Note: API endpoint for delete not provided in docs.
|
||||||
|
/// This is a placeholder - adjust when endpoint is available.
|
||||||
|
Future<void> deleteAddress(String name) async {
|
||||||
|
try {
|
||||||
|
_debugPrint('Deleting address: $name');
|
||||||
|
|
||||||
|
// TODO: Update with actual delete endpoint when available
|
||||||
|
final response = await _dio.post(
|
||||||
|
'/api/method/building_material.building_material.api.address.delete',
|
||||||
|
data: {'name': name},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
_debugPrint('Address deleted: $name');
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
throw ServerException(
|
||||||
|
'Failed to delete address: ${response.statusCode}',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
_debugPrint('Error deleting address: $e');
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Debug print helper
|
||||||
|
void _debugPrint(String message) {
|
||||||
|
// ignore: avoid_print
|
||||||
|
print('[AddressRemoteDataSource] $message');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
/// Location Local Data Source
|
||||||
|
///
|
||||||
|
/// Handles Hive caching for cities and wards.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:hive_ce/hive.dart';
|
||||||
|
import 'package:worker/core/constants/storage_constants.dart';
|
||||||
|
import 'package:worker/core/database/hive_service.dart';
|
||||||
|
import 'package:worker/features/account/data/models/city_model.dart';
|
||||||
|
import 'package:worker/features/account/data/models/ward_model.dart';
|
||||||
|
|
||||||
|
/// Location Local Data Source
|
||||||
|
///
|
||||||
|
/// Provides offline-first caching for cities and wards using Hive.
|
||||||
|
class LocationLocalDataSource {
|
||||||
|
final HiveService _hiveService;
|
||||||
|
|
||||||
|
LocationLocalDataSource(this._hiveService);
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// CITIES
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Get city box
|
||||||
|
Box<dynamic> get _cityBox => _hiveService.getBox(HiveBoxNames.cityBox);
|
||||||
|
|
||||||
|
/// Get all cached cities
|
||||||
|
List<CityModel> getCities() {
|
||||||
|
try {
|
||||||
|
final cities = _cityBox.values.whereType<CityModel>().toList();
|
||||||
|
return cities;
|
||||||
|
} catch (e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Save cities to cache
|
||||||
|
Future<void> saveCities(List<CityModel> cities) async {
|
||||||
|
try {
|
||||||
|
// Only clear if there are existing cities
|
||||||
|
if (_cityBox.isNotEmpty) {
|
||||||
|
await _cityBox.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final city in cities) {
|
||||||
|
await _cityBox.put(city.code, city);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get city by code
|
||||||
|
CityModel? getCityByCode(String code) {
|
||||||
|
try {
|
||||||
|
return _cityBox.get(code) as CityModel?;
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Check if cities are cached
|
||||||
|
bool hasCities() {
|
||||||
|
return _cityBox.isNotEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// WARDS
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Get ward box
|
||||||
|
Box<dynamic> get _wardBox => _hiveService.getBox(HiveBoxNames.wardBox);
|
||||||
|
|
||||||
|
/// Get cached wards for a city
|
||||||
|
///
|
||||||
|
/// Wards are stored with key: "cityCode_wardCode"
|
||||||
|
List<WardModel> getWards(String cityCode) {
|
||||||
|
try {
|
||||||
|
final wards = _wardBox.values
|
||||||
|
.whereType<WardModel>()
|
||||||
|
.where((ward) {
|
||||||
|
// Check if this ward belongs to the city
|
||||||
|
final key = '${cityCode}_${ward.code}';
|
||||||
|
return _wardBox.containsKey(key);
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return wards;
|
||||||
|
} catch (e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Save wards for a specific city to cache
|
||||||
|
Future<void> saveWards(String cityCode, List<WardModel> wards) async {
|
||||||
|
try {
|
||||||
|
// Remove old wards for this city (only if they exist)
|
||||||
|
final keysToDelete = _wardBox.keys
|
||||||
|
.where((key) => key.toString().startsWith('${cityCode}_'))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (keysToDelete.isNotEmpty) {
|
||||||
|
for (final key in keysToDelete) {
|
||||||
|
await _wardBox.delete(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save new wards
|
||||||
|
for (final ward in wards) {
|
||||||
|
final key = '${cityCode}_${ward.code}';
|
||||||
|
await _wardBox.put(key, ward);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Check if wards are cached for a city
|
||||||
|
bool hasWards(String cityCode) {
|
||||||
|
return _wardBox.keys.any((key) => key.toString().startsWith('${cityCode}_'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Clear all cached data
|
||||||
|
Future<void> clearAll() async {
|
||||||
|
try {
|
||||||
|
// Only clear if boxes are not empty
|
||||||
|
if (_cityBox.isNotEmpty) {
|
||||||
|
await _cityBox.clear();
|
||||||
|
}
|
||||||
|
if (_wardBox.isNotEmpty) {
|
||||||
|
await _wardBox.clear();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/// Location Remote Data Source
|
||||||
|
///
|
||||||
|
/// Handles API calls for cities and wards using Frappe ERPNext client.get_list.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:worker/core/errors/exceptions.dart';
|
||||||
|
import 'package:worker/features/account/data/models/city_model.dart';
|
||||||
|
import 'package:worker/features/account/data/models/ward_model.dart';
|
||||||
|
|
||||||
|
/// Location Remote Data Source
|
||||||
|
///
|
||||||
|
/// Provides methods to fetch cities and wards from API.
|
||||||
|
class LocationRemoteDataSource {
|
||||||
|
final Dio _dio;
|
||||||
|
|
||||||
|
LocationRemoteDataSource(this._dio);
|
||||||
|
|
||||||
|
/// Get all cities
|
||||||
|
///
|
||||||
|
/// API: POST /api/method/frappe.client.get_list
|
||||||
|
Future<List<CityModel>> getCities() async {
|
||||||
|
try {
|
||||||
|
final response = await _dio.post(
|
||||||
|
'/api/method/frappe.client.get_list',
|
||||||
|
data: {
|
||||||
|
'doctype': 'City',
|
||||||
|
'fields': ['city_name', 'name', 'code'],
|
||||||
|
'limit_page_length': 0,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = response.data;
|
||||||
|
|
||||||
|
if (data is Map<String, dynamic> && data.containsKey('message')) {
|
||||||
|
final message = data['message'];
|
||||||
|
|
||||||
|
if (message is List) {
|
||||||
|
final cities = message
|
||||||
|
.map((item) => CityModel.fromJson(item as Map<String, dynamic>))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return cities;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw const ServerException('Invalid response format');
|
||||||
|
} else {
|
||||||
|
throw ServerException('Failed to fetch cities: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get wards for a specific city
|
||||||
|
///
|
||||||
|
/// API: POST /api/method/frappe.client.get_list
|
||||||
|
/// [cityCode] - The city code to filter wards
|
||||||
|
Future<List<WardModel>> getWards(String cityCode) async {
|
||||||
|
try {
|
||||||
|
final response = await _dio.post(
|
||||||
|
'/api/method/frappe.client.get_list',
|
||||||
|
data: {
|
||||||
|
'doctype': 'Ward',
|
||||||
|
'fields': ['ward_name', 'name', 'code'],
|
||||||
|
'filters': {'city': cityCode},
|
||||||
|
'limit_page_length': 0,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = response.data;
|
||||||
|
|
||||||
|
if (data is Map<String, dynamic> && data.containsKey('message')) {
|
||||||
|
final message = data['message'];
|
||||||
|
|
||||||
|
if (message is List) {
|
||||||
|
final wards = message
|
||||||
|
.map((item) => WardModel.fromJson(item as Map<String, dynamic>))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return wards;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw const ServerException('Invalid response format');
|
||||||
|
} else {
|
||||||
|
throw ServerException('Failed to fetch wards: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
/// User Info Remote Data Source
|
||||||
|
///
|
||||||
|
/// Handles API calls for fetching user information.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:worker/core/errors/exceptions.dart';
|
||||||
|
import 'package:worker/core/network/dio_client.dart';
|
||||||
|
import 'package:worker/features/account/data/models/user_info_model.dart';
|
||||||
|
|
||||||
|
/// User Info Remote Data Source
|
||||||
|
///
|
||||||
|
/// Provides methods for:
|
||||||
|
/// - Fetching current user information from API
|
||||||
|
/// - Uses existing Frappe authentication (cookies/tokens)
|
||||||
|
class UserInfoRemoteDataSource {
|
||||||
|
UserInfoRemoteDataSource(this._dioClient);
|
||||||
|
|
||||||
|
final DioClient _dioClient;
|
||||||
|
|
||||||
|
/// Get User Info
|
||||||
|
///
|
||||||
|
/// Fetches the current authenticated user's information.
|
||||||
|
/// Uses existing Frappe session cookies/tokens for authentication.
|
||||||
|
///
|
||||||
|
/// API: POST https://land.dbiz.com/api/method/building_material.building_material.api.user.get_user_info
|
||||||
|
/// Request: Empty POST (no body required)
|
||||||
|
///
|
||||||
|
/// Response structure:
|
||||||
|
/// ```json
|
||||||
|
/// {
|
||||||
|
/// "message": {
|
||||||
|
/// "user_id": "...",
|
||||||
|
/// "full_name": "...",
|
||||||
|
/// "email": "...",
|
||||||
|
/// "phone_number": "...",
|
||||||
|
/// "role": "customer",
|
||||||
|
/// "status": "active",
|
||||||
|
/// "loyalty_tier": "gold",
|
||||||
|
/// "total_points": 1000,
|
||||||
|
/// "available_points": 800,
|
||||||
|
/// "expiring_points": 200,
|
||||||
|
/// // ... other fields
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// Throws:
|
||||||
|
/// - [UnauthorizedException] if user not authenticated (401)
|
||||||
|
/// - [NotFoundException] if endpoint not found (404)
|
||||||
|
/// - [ServerException] if server error occurs (500+)
|
||||||
|
/// - [NetworkException] for other network errors
|
||||||
|
Future<UserInfoModel> getUserInfo() async {
|
||||||
|
try {
|
||||||
|
debugPrint('🔵 [UserInfoDataSource] Fetching user info...');
|
||||||
|
final startTime = DateTime.now();
|
||||||
|
|
||||||
|
// Make POST request with empty body
|
||||||
|
// Authentication is handled by auth interceptor (uses existing session)
|
||||||
|
final response = await _dioClient.post<Map<String, dynamic>>(
|
||||||
|
'/api/method/building_material.building_material.api.user.get_user_info',
|
||||||
|
data: const <String, dynamic>{}, // Empty body as per API spec
|
||||||
|
);
|
||||||
|
|
||||||
|
final duration = DateTime.now().difference(startTime);
|
||||||
|
debugPrint('🟢 [UserInfoDataSource] Response received in ${duration.inMilliseconds}ms');
|
||||||
|
debugPrint('🟢 [UserInfoDataSource] Status: ${response.statusCode}');
|
||||||
|
debugPrint('🟢 [UserInfoDataSource] Data: ${response.data}');
|
||||||
|
|
||||||
|
// Check response status and data
|
||||||
|
if (response.statusCode == 200 && response.data != null) {
|
||||||
|
// Parse response to model
|
||||||
|
final model = UserInfoModel.fromJson(response.data!);
|
||||||
|
debugPrint('✅ [UserInfoDataSource] Successfully parsed user: ${model.fullName}');
|
||||||
|
return model;
|
||||||
|
} else {
|
||||||
|
throw ServerException(
|
||||||
|
'Failed to get user info: ${response.statusCode}',
|
||||||
|
response.statusCode,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} on DioException catch (e) {
|
||||||
|
// Handle specific HTTP status codes
|
||||||
|
if (e.response?.statusCode == 401) {
|
||||||
|
throw const UnauthorizedException(
|
||||||
|
'Session expired. Please login again.',
|
||||||
|
);
|
||||||
|
} else if (e.response?.statusCode == 403) {
|
||||||
|
throw const ForbiddenException();
|
||||||
|
} else if (e.response?.statusCode == 404) {
|
||||||
|
throw NotFoundException('User info endpoint not found');
|
||||||
|
} else if (e.response?.statusCode != null &&
|
||||||
|
e.response!.statusCode! >= 500) {
|
||||||
|
throw ServerException(
|
||||||
|
'Server error: ${e.response?.statusMessage ?? "Unknown error"}',
|
||||||
|
e.response?.statusCode,
|
||||||
|
);
|
||||||
|
} else if (e.type == DioExceptionType.connectionTimeout ||
|
||||||
|
e.type == DioExceptionType.receiveTimeout) {
|
||||||
|
throw const TimeoutException();
|
||||||
|
} else if (e.type == DioExceptionType.connectionError) {
|
||||||
|
throw const NoInternetException();
|
||||||
|
} else {
|
||||||
|
throw NetworkException(
|
||||||
|
e.message ?? 'Failed to get user info',
|
||||||
|
statusCode: e.response?.statusCode,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle unexpected errors
|
||||||
|
if (e is ServerException ||
|
||||||
|
e is UnauthorizedException ||
|
||||||
|
e is NetworkException ||
|
||||||
|
e is NotFoundException) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
throw ServerException('Unexpected error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Refresh User Info
|
||||||
|
///
|
||||||
|
/// Same as getUserInfo but with force refresh parameter.
|
||||||
|
/// Useful when you want to bypass cache and get fresh data.
|
||||||
|
Future<UserInfoModel> refreshUserInfo() async {
|
||||||
|
// For now, same as getUserInfo
|
||||||
|
// Could add cache-busting headers in the future if needed
|
||||||
|
return getUserInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update User Info
|
||||||
|
///
|
||||||
|
/// Updates the current user's profile information.
|
||||||
|
///
|
||||||
|
/// API: POST https://land.dbiz.com/api/method/building_material.building_material.api.user.update_user_info
|
||||||
|
///
|
||||||
|
/// Request body:
|
||||||
|
/// ```json
|
||||||
|
/// {
|
||||||
|
/// "full_name": "...",
|
||||||
|
/// "date_of_birth": "YYYY-MM-DD",
|
||||||
|
/// "gender": "Male/Female",
|
||||||
|
/// "company_name": "...",
|
||||||
|
/// "tax_code": "...",
|
||||||
|
/// "avatar_base64": null | base64_string,
|
||||||
|
/// "id_card_front_base64": null | base64_string,
|
||||||
|
/// "id_card_back_base64": null | base64_string,
|
||||||
|
/// "certificates_base64": [] | [base64_string, ...]
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// Throws:
|
||||||
|
/// - [UnauthorizedException] if user not authenticated (401)
|
||||||
|
/// - [ServerException] if server error occurs (500+)
|
||||||
|
/// - [NetworkException] for other network errors
|
||||||
|
Future<UserInfoModel> updateUserInfo(Map<String, dynamic> data) async {
|
||||||
|
try {
|
||||||
|
debugPrint('🔵 [UserInfoDataSource] Updating user info...');
|
||||||
|
debugPrint('🔵 [UserInfoDataSource] Data: $data');
|
||||||
|
final startTime = DateTime.now();
|
||||||
|
|
||||||
|
// Make POST request with update data
|
||||||
|
final response = await _dioClient.post<Map<String, dynamic>>(
|
||||||
|
'/api/method/building_material.building_material.api.user.update_user_info',
|
||||||
|
data: data,
|
||||||
|
);
|
||||||
|
|
||||||
|
final duration = DateTime.now().difference(startTime);
|
||||||
|
debugPrint('🟢 [UserInfoDataSource] Update response received in ${duration.inMilliseconds}ms');
|
||||||
|
debugPrint('🟢 [UserInfoDataSource] Status: ${response.statusCode}');
|
||||||
|
|
||||||
|
// Check response status
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
// After successful update, fetch fresh user info
|
||||||
|
debugPrint('✅ [UserInfoDataSource] Successfully updated user info');
|
||||||
|
return await getUserInfo();
|
||||||
|
} else {
|
||||||
|
throw ServerException(
|
||||||
|
'Failed to update user info: ${response.statusCode}',
|
||||||
|
response.statusCode,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} on DioException catch (e) {
|
||||||
|
// Handle specific HTTP status codes
|
||||||
|
if (e.response?.statusCode == 401) {
|
||||||
|
throw const UnauthorizedException(
|
||||||
|
'Session expired. Please login again.',
|
||||||
|
);
|
||||||
|
} else if (e.response?.statusCode == 403) {
|
||||||
|
throw const ForbiddenException();
|
||||||
|
} else if (e.response?.statusCode == 404) {
|
||||||
|
throw NotFoundException('Update user info endpoint not found');
|
||||||
|
} else if (e.response?.statusCode != null &&
|
||||||
|
e.response!.statusCode! >= 500) {
|
||||||
|
throw ServerException(
|
||||||
|
'Server error: ${e.response?.statusMessage ?? "Unknown error"}',
|
||||||
|
e.response?.statusCode,
|
||||||
|
);
|
||||||
|
} else if (e.type == DioExceptionType.connectionTimeout ||
|
||||||
|
e.type == DioExceptionType.receiveTimeout) {
|
||||||
|
throw const TimeoutException();
|
||||||
|
} else if (e.type == DioExceptionType.connectionError) {
|
||||||
|
throw const NoInternetException();
|
||||||
|
} else {
|
||||||
|
throw NetworkException(
|
||||||
|
e.message ?? 'Failed to update user info',
|
||||||
|
statusCode: e.response?.statusCode,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle unexpected errors
|
||||||
|
if (e is ServerException ||
|
||||||
|
e is UnauthorizedException ||
|
||||||
|
e is NetworkException ||
|
||||||
|
e is NotFoundException) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
throw ServerException('Unexpected error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
168
lib/features/account/data/models/address_model.dart
Normal file
168
lib/features/account/data/models/address_model.dart
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
/// Address Model
|
||||||
|
///
|
||||||
|
/// Hive model for caching address data from ERPNext API.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:hive_ce/hive.dart';
|
||||||
|
import 'package:worker/core/constants/storage_constants.dart';
|
||||||
|
import 'package:worker/features/account/domain/entities/address.dart';
|
||||||
|
|
||||||
|
part 'address_model.g.dart';
|
||||||
|
|
||||||
|
/// Address Model
|
||||||
|
///
|
||||||
|
/// Hive model for storing address data with ERPNext API compatibility.
|
||||||
|
@HiveType(typeId: HiveTypeIds.addressModel)
|
||||||
|
class AddressModel extends HiveObject {
|
||||||
|
/// Address name (ID in ERPNext)
|
||||||
|
@HiveField(0)
|
||||||
|
String name;
|
||||||
|
|
||||||
|
/// Display title for the address
|
||||||
|
@HiveField(1)
|
||||||
|
String addressTitle;
|
||||||
|
|
||||||
|
/// Address line 1 (street, number, etc.)
|
||||||
|
@HiveField(2)
|
||||||
|
String addressLine1;
|
||||||
|
|
||||||
|
/// Phone number
|
||||||
|
@HiveField(3)
|
||||||
|
String phone;
|
||||||
|
|
||||||
|
/// Email address
|
||||||
|
@HiveField(4)
|
||||||
|
String? email;
|
||||||
|
|
||||||
|
/// Fax number (optional)
|
||||||
|
@HiveField(5)
|
||||||
|
String? fax;
|
||||||
|
|
||||||
|
/// Tax code/ID
|
||||||
|
@HiveField(6)
|
||||||
|
String? taxCode;
|
||||||
|
|
||||||
|
/// City code (from ERPNext location master)
|
||||||
|
@HiveField(7)
|
||||||
|
String cityCode;
|
||||||
|
|
||||||
|
/// Ward code (from ERPNext location master)
|
||||||
|
@HiveField(8)
|
||||||
|
String wardCode;
|
||||||
|
|
||||||
|
/// Whether this is the default address
|
||||||
|
@HiveField(9)
|
||||||
|
bool isDefault;
|
||||||
|
|
||||||
|
/// City name (for display)
|
||||||
|
@HiveField(10)
|
||||||
|
String? cityName;
|
||||||
|
|
||||||
|
/// Ward name (for display)
|
||||||
|
@HiveField(11)
|
||||||
|
String? wardName;
|
||||||
|
|
||||||
|
/// Whether editing this address is allowed
|
||||||
|
@HiveField(12)
|
||||||
|
bool isAllowEdit;
|
||||||
|
|
||||||
|
AddressModel({
|
||||||
|
required this.name,
|
||||||
|
required this.addressTitle,
|
||||||
|
required this.addressLine1,
|
||||||
|
required this.phone,
|
||||||
|
this.email,
|
||||||
|
this.fax,
|
||||||
|
this.taxCode,
|
||||||
|
required this.cityCode,
|
||||||
|
required this.wardCode,
|
||||||
|
this.isDefault = false,
|
||||||
|
this.cityName,
|
||||||
|
this.wardName,
|
||||||
|
this.isAllowEdit = true,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// Create from JSON (API response)
|
||||||
|
factory AddressModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return AddressModel(
|
||||||
|
name: json['name'] as String? ?? '',
|
||||||
|
addressTitle: json['address_title'] as String? ?? '',
|
||||||
|
addressLine1: json['address_line1'] as String? ?? '',
|
||||||
|
phone: json['phone'] as String? ?? '',
|
||||||
|
email: json['email'] as String?,
|
||||||
|
fax: json['fax'] as String?,
|
||||||
|
taxCode: json['tax_code'] as String?,
|
||||||
|
cityCode: json['city_code'] as String? ?? '',
|
||||||
|
wardCode: json['ward_code'] as String? ?? '',
|
||||||
|
isDefault: json['is_default'] == 1 || json['is_default'] == true,
|
||||||
|
cityName: json['city_name'] as String?,
|
||||||
|
wardName: json['ward_name'] as String?,
|
||||||
|
isAllowEdit: json['is_allow_edit'] == 1 || json['is_allow_edit'] == true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert to JSON (API request)
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
// If name is empty, send null to indicate new address creation
|
||||||
|
'name': name.isEmpty ? null : name,
|
||||||
|
'address_title': addressTitle,
|
||||||
|
'address_line1': addressLine1,
|
||||||
|
'phone': phone,
|
||||||
|
if (email != null && email!.isNotEmpty) 'email': email,
|
||||||
|
if (fax != null && fax!.isNotEmpty) 'fax': fax,
|
||||||
|
if (taxCode != null && taxCode!.isNotEmpty) 'tax_code': taxCode,
|
||||||
|
'city_code': cityCode,
|
||||||
|
'ward_code': wardCode,
|
||||||
|
'is_default': isDefault,
|
||||||
|
if (cityName != null && cityName!.isNotEmpty) 'city_name': cityName,
|
||||||
|
if (wardName != null && wardName!.isNotEmpty) 'ward_name': wardName,
|
||||||
|
'is_allow_edit': isAllowEdit,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert to domain entity
|
||||||
|
Address toEntity() {
|
||||||
|
return Address(
|
||||||
|
name: name,
|
||||||
|
addressTitle: addressTitle,
|
||||||
|
addressLine1: addressLine1,
|
||||||
|
phone: phone,
|
||||||
|
email: email,
|
||||||
|
fax: fax,
|
||||||
|
taxCode: taxCode,
|
||||||
|
cityCode: cityCode,
|
||||||
|
wardCode: wardCode,
|
||||||
|
isDefault: isDefault,
|
||||||
|
cityName: cityName,
|
||||||
|
wardName: wardName,
|
||||||
|
isAllowEdit: isAllowEdit,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create from domain entity
|
||||||
|
factory AddressModel.fromEntity(Address entity) {
|
||||||
|
return AddressModel(
|
||||||
|
name: entity.name,
|
||||||
|
addressTitle: entity.addressTitle,
|
||||||
|
addressLine1: entity.addressLine1,
|
||||||
|
phone: entity.phone,
|
||||||
|
email: entity.email,
|
||||||
|
fax: entity.fax,
|
||||||
|
taxCode: entity.taxCode,
|
||||||
|
cityCode: entity.cityCode,
|
||||||
|
wardCode: entity.wardCode,
|
||||||
|
isDefault: entity.isDefault,
|
||||||
|
cityName: entity.cityName,
|
||||||
|
wardName: entity.wardName,
|
||||||
|
isAllowEdit: entity.isAllowEdit,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AddressModel(name: $name, addressTitle: $addressTitle, '
|
||||||
|
'addressLine1: $addressLine1, phone: $phone, isDefault: $isDefault, '
|
||||||
|
'isAllowEdit: $isAllowEdit)';
|
||||||
|
}
|
||||||
|
}
|
||||||
77
lib/features/account/data/models/address_model.g.dart
Normal file
77
lib/features/account/data/models/address_model.g.dart
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'address_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class AddressModelAdapter extends TypeAdapter<AddressModel> {
|
||||||
|
@override
|
||||||
|
final typeId = 30;
|
||||||
|
|
||||||
|
@override
|
||||||
|
AddressModel read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return AddressModel(
|
||||||
|
name: fields[0] as String,
|
||||||
|
addressTitle: fields[1] as String,
|
||||||
|
addressLine1: fields[2] as String,
|
||||||
|
phone: fields[3] as String,
|
||||||
|
email: fields[4] as String?,
|
||||||
|
fax: fields[5] as String?,
|
||||||
|
taxCode: fields[6] as String?,
|
||||||
|
cityCode: fields[7] as String,
|
||||||
|
wardCode: fields[8] as String,
|
||||||
|
isDefault: fields[9] == null ? false : fields[9] as bool,
|
||||||
|
cityName: fields[10] as String?,
|
||||||
|
wardName: fields[11] as String?,
|
||||||
|
isAllowEdit: fields[12] == null ? true : fields[12] as bool,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, AddressModel obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(13)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.name)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.addressTitle)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.addressLine1)
|
||||||
|
..writeByte(3)
|
||||||
|
..write(obj.phone)
|
||||||
|
..writeByte(4)
|
||||||
|
..write(obj.email)
|
||||||
|
..writeByte(5)
|
||||||
|
..write(obj.fax)
|
||||||
|
..writeByte(6)
|
||||||
|
..write(obj.taxCode)
|
||||||
|
..writeByte(7)
|
||||||
|
..write(obj.cityCode)
|
||||||
|
..writeByte(8)
|
||||||
|
..write(obj.wardCode)
|
||||||
|
..writeByte(9)
|
||||||
|
..write(obj.isDefault)
|
||||||
|
..writeByte(10)
|
||||||
|
..write(obj.cityName)
|
||||||
|
..writeByte(11)
|
||||||
|
..write(obj.wardName)
|
||||||
|
..writeByte(12)
|
||||||
|
..write(obj.isAllowEdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is AddressModelAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
73
lib/features/account/data/models/city_model.dart
Normal file
73
lib/features/account/data/models/city_model.dart
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/// City Model
|
||||||
|
///
|
||||||
|
/// Hive model for caching city/province data.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:hive_ce/hive.dart';
|
||||||
|
import 'package:worker/core/constants/storage_constants.dart';
|
||||||
|
import 'package:worker/features/account/domain/entities/city.dart';
|
||||||
|
|
||||||
|
part 'city_model.g.dart';
|
||||||
|
|
||||||
|
/// City Model
|
||||||
|
///
|
||||||
|
/// Hive model for storing city/province data with offline support.
|
||||||
|
@HiveType(typeId: HiveTypeIds.cityModel)
|
||||||
|
class CityModel extends HiveObject {
|
||||||
|
/// Frappe ERPNext name/ID
|
||||||
|
@HiveField(0)
|
||||||
|
String name;
|
||||||
|
|
||||||
|
/// Display name (city_name)
|
||||||
|
@HiveField(1)
|
||||||
|
String cityName;
|
||||||
|
|
||||||
|
/// City code
|
||||||
|
@HiveField(2)
|
||||||
|
String code;
|
||||||
|
|
||||||
|
CityModel({
|
||||||
|
required this.name,
|
||||||
|
required this.cityName,
|
||||||
|
required this.code,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// Create from JSON (API response)
|
||||||
|
factory CityModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return CityModel(
|
||||||
|
name: json['name'] as String? ?? '',
|
||||||
|
cityName: json['city_name'] as String? ?? '',
|
||||||
|
code: json['code'] as String? ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert to JSON (API request)
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'name': name,
|
||||||
|
'city_name': cityName,
|
||||||
|
'code': code,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert to domain entity
|
||||||
|
City toEntity() {
|
||||||
|
return City(
|
||||||
|
name: name,
|
||||||
|
cityName: cityName,
|
||||||
|
code: code,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create from domain entity
|
||||||
|
factory CityModel.fromEntity(City entity) {
|
||||||
|
return CityModel(
|
||||||
|
name: entity.name,
|
||||||
|
cityName: entity.cityName,
|
||||||
|
code: entity.code,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'CityModel(name: $name, cityName: $cityName, code: $code)';
|
||||||
|
}
|
||||||
47
lib/features/account/data/models/city_model.g.dart
Normal file
47
lib/features/account/data/models/city_model.g.dart
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'city_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class CityModelAdapter extends TypeAdapter<CityModel> {
|
||||||
|
@override
|
||||||
|
final typeId = 31;
|
||||||
|
|
||||||
|
@override
|
||||||
|
CityModel read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return CityModel(
|
||||||
|
name: fields[0] as String,
|
||||||
|
cityName: fields[1] as String,
|
||||||
|
code: fields[2] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, CityModel obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.name)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.cityName)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.code);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is CityModelAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
318
lib/features/account/data/models/user_info_model.dart
Normal file
318
lib/features/account/data/models/user_info_model.dart
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
/// User Info Model
|
||||||
|
///
|
||||||
|
/// Data model for user information from API.
|
||||||
|
/// Handles JSON serialization and conversion to domain entity.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:worker/core/database/models/enums.dart';
|
||||||
|
import 'package:worker/features/account/domain/entities/user_info.dart';
|
||||||
|
|
||||||
|
/// User Info Model
|
||||||
|
///
|
||||||
|
/// Maps API response from get_user_info endpoint to UserInfo entity.
|
||||||
|
class UserInfoModel {
|
||||||
|
const UserInfoModel({
|
||||||
|
required this.userId,
|
||||||
|
required this.fullName,
|
||||||
|
this.email,
|
||||||
|
this.phoneNumber,
|
||||||
|
required this.role,
|
||||||
|
required this.status,
|
||||||
|
required this.loyaltyTier,
|
||||||
|
this.totalPoints = 0,
|
||||||
|
this.availablePoints = 0,
|
||||||
|
this.expiringPoints = 0,
|
||||||
|
this.avatarUrl,
|
||||||
|
this.companyName,
|
||||||
|
this.taxId,
|
||||||
|
this.address,
|
||||||
|
this.cccd,
|
||||||
|
this.dateOfBirth,
|
||||||
|
this.gender,
|
||||||
|
this.idCardFront,
|
||||||
|
this.idCardBack,
|
||||||
|
this.certificates = const [],
|
||||||
|
this.membershipStatus,
|
||||||
|
this.membershipStatusColor,
|
||||||
|
this.isVerified = false,
|
||||||
|
this.credentialDisplay = false,
|
||||||
|
this.referralCode,
|
||||||
|
this.erpnextCustomerId,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String userId;
|
||||||
|
final String fullName;
|
||||||
|
final String? email;
|
||||||
|
final String? phoneNumber;
|
||||||
|
final UserRole role;
|
||||||
|
final UserStatus status;
|
||||||
|
final LoyaltyTier loyaltyTier;
|
||||||
|
final int totalPoints;
|
||||||
|
final int availablePoints;
|
||||||
|
final int expiringPoints;
|
||||||
|
final String? avatarUrl;
|
||||||
|
final String? companyName;
|
||||||
|
final String? taxId;
|
||||||
|
final String? address;
|
||||||
|
final String? cccd;
|
||||||
|
final DateTime? dateOfBirth;
|
||||||
|
final String? gender;
|
||||||
|
final String? idCardFront;
|
||||||
|
final String? idCardBack;
|
||||||
|
final List<String> certificates;
|
||||||
|
final String? membershipStatus;
|
||||||
|
final String? membershipStatusColor;
|
||||||
|
final bool isVerified;
|
||||||
|
final bool credentialDisplay;
|
||||||
|
final String? referralCode;
|
||||||
|
final String? erpnextCustomerId;
|
||||||
|
final DateTime? createdAt;
|
||||||
|
final DateTime? updatedAt;
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// JSON SERIALIZATION
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
/// Create UserInfoModel from API JSON response
|
||||||
|
///
|
||||||
|
/// Expected API response structure:
|
||||||
|
/// ```json
|
||||||
|
/// {
|
||||||
|
/// "message": {
|
||||||
|
/// "user_id": "...",
|
||||||
|
/// "full_name": "...",
|
||||||
|
/// "email": "...",
|
||||||
|
/// "phone_number": "...",
|
||||||
|
/// "role": "customer",
|
||||||
|
/// "status": "active",
|
||||||
|
/// "loyalty_tier": "gold",
|
||||||
|
/// "total_points": 1000,
|
||||||
|
/// "available_points": 800,
|
||||||
|
/// "expiring_points": 200,
|
||||||
|
/// "avatar_url": "...",
|
||||||
|
/// "company_name": "...",
|
||||||
|
/// "tax_id": "...",
|
||||||
|
/// "address": "...",
|
||||||
|
/// "cccd": "...",
|
||||||
|
/// "referral_code": "...",
|
||||||
|
/// "erpnext_customer_id": "...",
|
||||||
|
/// "created_at": "...",
|
||||||
|
/// "updated_at": "...",
|
||||||
|
/// "last_login_at": "..."
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
factory UserInfoModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
// API response structure: { "message": { "full_name": "...", ... } }
|
||||||
|
// Data is directly under 'message', not nested in 'data'
|
||||||
|
final data = json['message'] as Map<String, dynamic>? ?? json;
|
||||||
|
|
||||||
|
return UserInfoModel(
|
||||||
|
// Use email as userId since API doesn't provide user_id
|
||||||
|
userId: data['email'] as String? ?? data['phone'] as String? ?? 'unknown',
|
||||||
|
fullName: data['full_name'] as String? ?? '',
|
||||||
|
email: data['email'] as String?,
|
||||||
|
phoneNumber: data['phone'] as String?,
|
||||||
|
// Default values for fields not in this API
|
||||||
|
role: UserRole.customer, // Default to customer
|
||||||
|
status: UserStatus.active, // Default to active
|
||||||
|
loyaltyTier: LoyaltyTier.bronze, // Default to bronze
|
||||||
|
totalPoints: 0,
|
||||||
|
availablePoints: 0,
|
||||||
|
expiringPoints: 0,
|
||||||
|
avatarUrl: data['avatar'] as String?,
|
||||||
|
companyName: data['company_name'] as String?,
|
||||||
|
taxId: data['tax_code'] as String?,
|
||||||
|
address: data['address'] as String?,
|
||||||
|
cccd: null, // CCCD number not in API
|
||||||
|
dateOfBirth: _parseDateTime(data['date_of_birth'] as String?),
|
||||||
|
gender: data['gender'] as String?,
|
||||||
|
idCardFront: data['id_card_front'] as String?,
|
||||||
|
idCardBack: data['id_card_back'] as String?,
|
||||||
|
certificates: (data['certificates'] as List<dynamic>?)
|
||||||
|
?.map((e) => e.toString())
|
||||||
|
.toList() ?? const [],
|
||||||
|
membershipStatus: data['membership_status'] as String?,
|
||||||
|
membershipStatusColor: data['membership_status_color'] as String?,
|
||||||
|
isVerified: data['is_verified'] as bool? ?? false,
|
||||||
|
credentialDisplay: data['credential_display'] as bool? ?? false,
|
||||||
|
referralCode: null,
|
||||||
|
erpnextCustomerId: null,
|
||||||
|
createdAt: DateTime.now(),
|
||||||
|
updatedAt: DateTime.now(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert UserInfoModel to JSON
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'user_id': userId,
|
||||||
|
'full_name': fullName,
|
||||||
|
'email': email,
|
||||||
|
'phone_number': phoneNumber,
|
||||||
|
'role': role.name,
|
||||||
|
'status': status.name,
|
||||||
|
'loyalty_tier': loyaltyTier.name,
|
||||||
|
'total_points': totalPoints,
|
||||||
|
'available_points': availablePoints,
|
||||||
|
'expiring_points': expiringPoints,
|
||||||
|
'avatar_url': avatarUrl,
|
||||||
|
'company_name': companyName,
|
||||||
|
'tax_id': taxId,
|
||||||
|
'address': address,
|
||||||
|
'cccd': cccd,
|
||||||
|
'referral_code': referralCode,
|
||||||
|
'erpnext_customer_id': erpnextCustomerId,
|
||||||
|
'created_at': createdAt?.toIso8601String(),
|
||||||
|
'updated_at': updatedAt?.toIso8601String(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// DOMAIN CONVERSION
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
/// Convert to domain entity
|
||||||
|
UserInfo toEntity() {
|
||||||
|
final now = DateTime.now();
|
||||||
|
return UserInfo(
|
||||||
|
userId: userId,
|
||||||
|
fullName: fullName,
|
||||||
|
email: email,
|
||||||
|
phoneNumber: phoneNumber,
|
||||||
|
role: role,
|
||||||
|
status: status,
|
||||||
|
loyaltyTier: loyaltyTier,
|
||||||
|
totalPoints: totalPoints,
|
||||||
|
availablePoints: availablePoints,
|
||||||
|
expiringPoints: expiringPoints,
|
||||||
|
avatarUrl: avatarUrl,
|
||||||
|
companyName: companyName,
|
||||||
|
taxId: taxId,
|
||||||
|
address: address,
|
||||||
|
cccd: cccd,
|
||||||
|
dateOfBirth: dateOfBirth,
|
||||||
|
gender: gender,
|
||||||
|
idCardFront: idCardFront,
|
||||||
|
idCardBack: idCardBack,
|
||||||
|
certificates: certificates,
|
||||||
|
membershipStatus: membershipStatus,
|
||||||
|
membershipStatusColor: membershipStatusColor,
|
||||||
|
isVerified: isVerified,
|
||||||
|
credentialDisplay: credentialDisplay,
|
||||||
|
referralCode: referralCode,
|
||||||
|
erpnextCustomerId: erpnextCustomerId,
|
||||||
|
createdAt: createdAt ?? now,
|
||||||
|
updatedAt: updatedAt ?? now,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create model from domain entity
|
||||||
|
factory UserInfoModel.fromEntity(UserInfo entity) {
|
||||||
|
return UserInfoModel(
|
||||||
|
userId: entity.userId,
|
||||||
|
fullName: entity.fullName,
|
||||||
|
email: entity.email,
|
||||||
|
phoneNumber: entity.phoneNumber,
|
||||||
|
role: entity.role,
|
||||||
|
status: entity.status,
|
||||||
|
loyaltyTier: entity.loyaltyTier,
|
||||||
|
totalPoints: entity.totalPoints,
|
||||||
|
availablePoints: entity.availablePoints,
|
||||||
|
expiringPoints: entity.expiringPoints,
|
||||||
|
avatarUrl: entity.avatarUrl,
|
||||||
|
companyName: entity.companyName,
|
||||||
|
taxId: entity.taxId,
|
||||||
|
address: entity.address,
|
||||||
|
cccd: entity.cccd,
|
||||||
|
referralCode: entity.referralCode,
|
||||||
|
erpnextCustomerId: entity.erpnextCustomerId,
|
||||||
|
createdAt: entity.createdAt,
|
||||||
|
updatedAt: entity.updatedAt,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// HELPER METHODS
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
/// Parse user role from string
|
||||||
|
static UserRole _parseUserRole(String? role) {
|
||||||
|
if (role == null) return UserRole.customer;
|
||||||
|
|
||||||
|
return UserRole.values.firstWhere(
|
||||||
|
(e) => e.name.toLowerCase() == role.toLowerCase(),
|
||||||
|
orElse: () => UserRole.customer,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Parse user status from string
|
||||||
|
static UserStatus _parseUserStatus(String? status) {
|
||||||
|
if (status == null) return UserStatus.pending;
|
||||||
|
|
||||||
|
// Handle ERPNext status values
|
||||||
|
final normalizedStatus = status.toLowerCase();
|
||||||
|
if (normalizedStatus == 'enabled' || normalizedStatus == 'active') {
|
||||||
|
return UserStatus.active;
|
||||||
|
}
|
||||||
|
if (normalizedStatus == 'disabled' || normalizedStatus == 'inactive') {
|
||||||
|
return UserStatus.suspended;
|
||||||
|
}
|
||||||
|
|
||||||
|
return UserStatus.values.firstWhere(
|
||||||
|
(e) => e.name.toLowerCase() == normalizedStatus,
|
||||||
|
orElse: () => UserStatus.pending,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Parse loyalty tier from string
|
||||||
|
static LoyaltyTier _parseLoyaltyTier(String? tier) {
|
||||||
|
if (tier == null) return LoyaltyTier.bronze;
|
||||||
|
|
||||||
|
return LoyaltyTier.values.firstWhere(
|
||||||
|
(e) => e.name.toLowerCase() == tier.toLowerCase(),
|
||||||
|
orElse: () => LoyaltyTier.bronze,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Parse integer from dynamic value
|
||||||
|
static int _parseInt(dynamic value) {
|
||||||
|
if (value == null) return 0;
|
||||||
|
if (value is int) return value;
|
||||||
|
if (value is double) return value.toInt();
|
||||||
|
if (value is String) return int.tryParse(value) ?? 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Parse DateTime from string
|
||||||
|
static DateTime? _parseDateTime(String? dateString) {
|
||||||
|
if (dateString == null || dateString.isEmpty) return null;
|
||||||
|
try {
|
||||||
|
return DateTime.parse(dateString);
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// EQUALITY
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
|
return other is UserInfoModel && other.userId == userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => userId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'UserInfoModel(userId: $userId, fullName: $fullName, '
|
||||||
|
'tier: $loyaltyTier, points: $totalPoints)';
|
||||||
|
}
|
||||||
|
}
|
||||||
73
lib/features/account/data/models/ward_model.dart
Normal file
73
lib/features/account/data/models/ward_model.dart
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/// Ward Model
|
||||||
|
///
|
||||||
|
/// Hive model for caching ward/district data.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:hive_ce/hive.dart';
|
||||||
|
import 'package:worker/core/constants/storage_constants.dart';
|
||||||
|
import 'package:worker/features/account/domain/entities/ward.dart';
|
||||||
|
|
||||||
|
part 'ward_model.g.dart';
|
||||||
|
|
||||||
|
/// Ward Model
|
||||||
|
///
|
||||||
|
/// Hive model for storing ward/district data with offline support.
|
||||||
|
@HiveType(typeId: HiveTypeIds.wardModel)
|
||||||
|
class WardModel extends HiveObject {
|
||||||
|
/// Frappe ERPNext name/ID
|
||||||
|
@HiveField(0)
|
||||||
|
String name;
|
||||||
|
|
||||||
|
/// Display name (ward_name)
|
||||||
|
@HiveField(1)
|
||||||
|
String wardName;
|
||||||
|
|
||||||
|
/// Ward code
|
||||||
|
@HiveField(2)
|
||||||
|
String code;
|
||||||
|
|
||||||
|
WardModel({
|
||||||
|
required this.name,
|
||||||
|
required this.wardName,
|
||||||
|
required this.code,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// Create from JSON (API response)
|
||||||
|
factory WardModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return WardModel(
|
||||||
|
name: json['name'] as String? ?? '',
|
||||||
|
wardName: json['ward_name'] as String? ?? '',
|
||||||
|
code: json['code'] as String? ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert to JSON (API request)
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'name': name,
|
||||||
|
'ward_name': wardName,
|
||||||
|
'code': code,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert to domain entity
|
||||||
|
Ward toEntity() {
|
||||||
|
return Ward(
|
||||||
|
name: name,
|
||||||
|
wardName: wardName,
|
||||||
|
code: code,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create from domain entity
|
||||||
|
factory WardModel.fromEntity(Ward entity) {
|
||||||
|
return WardModel(
|
||||||
|
name: entity.name,
|
||||||
|
wardName: entity.wardName,
|
||||||
|
code: entity.code,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'WardModel(name: $name, wardName: $wardName, code: $code)';
|
||||||
|
}
|
||||||
47
lib/features/account/data/models/ward_model.g.dart
Normal file
47
lib/features/account/data/models/ward_model.g.dart
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'ward_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class WardModelAdapter extends TypeAdapter<WardModel> {
|
||||||
|
@override
|
||||||
|
final typeId = 32;
|
||||||
|
|
||||||
|
@override
|
||||||
|
WardModel read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return WardModel(
|
||||||
|
name: fields[0] as String,
|
||||||
|
wardName: fields[1] as String,
|
||||||
|
code: fields[2] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, WardModel obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.name)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.wardName)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.code);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is WardModelAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user