kelola penyewa dan beberapa error fix
@ -1,8 +1,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application
|
||||
android:label="bumrent_app"
|
||||
android:label="BumRent"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
BIN
android/app/src/main/res/mipmap-hdpi/launcher_icon.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
android/app/src/main/res/mipmap-mdpi/launcher_icon.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/app/src/main/res/mipmap-xhdpi/launcher_icon.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/logo_app.png
Normal file
After Width: | Height: | Size: 70 KiB |
@ -427,7 +427,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
@ -484,7 +484,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 181 KiB |
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 610 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 988 B |
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 11 KiB |
@ -5,7 +5,7 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Bumrent App</string>
|
||||
<string>BumRent</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@ -13,7 +13,7 @@
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>bumrent_app</string>
|
||||
<string>BumRent</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
|
@ -19,12 +19,12 @@ class PetugasBumdesBinding extends Bindings {
|
||||
print('Error removing controller: $e');
|
||||
}
|
||||
|
||||
// Gunakan put untuk memastikan controller selalu tersedia dan permanent
|
||||
Get.put<PetugasBumdesDashboardController>(
|
||||
PetugasBumdesDashboardController(),
|
||||
permanent: true,
|
||||
// Gunakan lazyPut untuk memastikan controller hanya diinisialisasi saat dibutuhkan
|
||||
Get.lazyPut<PetugasBumdesDashboardController>(
|
||||
() => PetugasBumdesDashboardController(),
|
||||
fenix: true, // Akan dibuat ulang jika dihapus
|
||||
);
|
||||
|
||||
print('✅ PetugasBumdesDashboardController registered successfully');
|
||||
print('✅ PetugasBumdesDashboardController initialized successfully');
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,15 @@ import '../modules/warga/controllers/warga_dashboard_controller.dart';
|
||||
class WargaBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut<AuthProvider>(() => AuthProvider());
|
||||
Get.lazyPut<WargaDashboardController>(() => WargaDashboardController());
|
||||
// Pastikan AuthProvider teregistrasi
|
||||
if (!Get.isRegistered<AuthProvider>()) {
|
||||
Get.put(AuthProvider());
|
||||
}
|
||||
|
||||
// Gunakan lazyPut untuk memastikan controller hanya diinisialisasi saat dibutuhkan
|
||||
Get.lazyPut<WargaDashboardController>(
|
||||
() => WargaDashboardController(),
|
||||
fenix: true, // Akan dibuat ulang jika dihapus
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +80,18 @@ class AuthProvider extends GetxService {
|
||||
// Clear any cached user data or state
|
||||
// This method is called during logout to ensure all user-related data is cleared
|
||||
debugPrint('Clearing AuthProvider cached data');
|
||||
// Currently, signOut() handles most of the cleanup, but this method can be extended
|
||||
// if additional cleanup is needed in the future
|
||||
|
||||
// Explicitly clear any cached data that might be stored in the provider
|
||||
// This is important to ensure no user data remains after logout or registration
|
||||
try {
|
||||
// Force refresh of the auth state
|
||||
client.auth.refreshSession();
|
||||
|
||||
// Log the cleanup action
|
||||
debugPrint('AuthProvider cached data cleared successfully');
|
||||
} catch (e) {
|
||||
debugPrint('Error clearing AuthProvider cached data: $e');
|
||||
}
|
||||
}
|
||||
|
||||
User? get currentUser => client.auth.currentUser;
|
||||
@ -669,6 +679,25 @@ class AuthProvider extends GetxService {
|
||||
item,
|
||||
);
|
||||
|
||||
// Ensure updated_at is not null, use created_at as fallback
|
||||
if (processedItem['updated_at'] == null &&
|
||||
processedItem['created_at'] != null) {
|
||||
debugPrint('updated_at is null, using created_at as fallback');
|
||||
processedItem['updated_at'] = processedItem['created_at'];
|
||||
} else if (processedItem['updated_at'] == null &&
|
||||
processedItem['created_at'] == null) {
|
||||
// If both are null, use current timestamp as last resort
|
||||
debugPrint(
|
||||
'Both updated_at and created_at are null, using current timestamp',
|
||||
);
|
||||
processedItem['updated_at'] = DateTime.now().toIso8601String();
|
||||
}
|
||||
|
||||
// Debug the updated_at field
|
||||
debugPrint(
|
||||
'updated_at after processing: ${processedItem['updated_at']}',
|
||||
);
|
||||
|
||||
// If aset_id is null and paket_id is not null, fetch package data
|
||||
if (item['aset_id'] == null && item['paket_id'] != null) {
|
||||
final String paketId = item['paket_id'];
|
||||
|
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
||||
import '../../../data/providers/auth_provider.dart';
|
||||
import '../../../routes/app_routes.dart';
|
||||
import 'dart:math';
|
||||
import '../../../modules/warga/controllers/warga_dashboard_controller.dart';
|
||||
|
||||
class AuthController extends GetxController {
|
||||
final AuthProvider _authProvider = Get.find<AuthProvider>();
|
||||
@ -185,7 +186,9 @@ class AuthController extends GetxController {
|
||||
}
|
||||
|
||||
void _navigateToWargaDashboard() {
|
||||
Get.offAllNamed(Routes.WARGA_DASHBOARD);
|
||||
// Navigate to warga dashboard with parameter to indicate it's coming from login
|
||||
// This will trigger an immediate refresh of the data
|
||||
Get.offAllNamed(Routes.WARGA_DASHBOARD, arguments: {'from_login': true});
|
||||
}
|
||||
|
||||
void forgotPassword() async {
|
||||
@ -215,7 +218,7 @@ class AuthController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Link reset password telah dikirim ke email Anda',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green[100],
|
||||
colorText: Colors.green[800],
|
||||
icon: const Icon(Icons.check_circle, color: Colors.green),
|
||||
@ -312,7 +315,18 @@ class AuthController extends GetxController {
|
||||
'register_id': registerId, // Add register_id to the warga_desa table
|
||||
});
|
||||
|
||||
// Registration successful
|
||||
// Reset registration fields BEFORE navigation to ensure clean state
|
||||
resetRegistrationFields();
|
||||
|
||||
// Bersihkan data auth provider untuk memastikan tidak ada data user yang tersimpan
|
||||
_authProvider.clearAuthData();
|
||||
|
||||
// Print debug message
|
||||
print(
|
||||
'Registration successful: Fields and controllers have been cleared',
|
||||
);
|
||||
|
||||
// Registration successful - navigate to success page
|
||||
Get.offNamed(
|
||||
Routes.REGISTRATION_SUCCESS,
|
||||
arguments: {'register_id': registerId},
|
||||
@ -478,4 +492,99 @@ class AuthController extends GetxController {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check registration status by register_id and email
|
||||
Future<Map<String, dynamic>?> checkRegistrationStatus(
|
||||
String registerId,
|
||||
String email,
|
||||
) async {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
|
||||
print('Checking registration status - ID: $registerId, Email: $email');
|
||||
|
||||
// Validasi input
|
||||
if (registerId.isEmpty || email.isEmpty) {
|
||||
print('Invalid input: registerId or email is empty');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Query warga_desa table where register_id and email match
|
||||
final response =
|
||||
await _authProvider.client
|
||||
.from('warga_desa')
|
||||
.select(
|
||||
'*',
|
||||
) // Ensure we select all columns including 'keterangan'
|
||||
.eq('register_id', registerId)
|
||||
.eq('email', email)
|
||||
.maybeSingle();
|
||||
|
||||
// Log response for debugging
|
||||
print('Registration status query response: $response');
|
||||
|
||||
// Validasi hasil query
|
||||
if (response == null) {
|
||||
print('No matching registration found');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (response is Map<String, dynamic> && response.isEmpty) {
|
||||
print('Empty response received');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Jika berhasil, kembalikan data
|
||||
print('Registration found with status: ${response['status']}');
|
||||
return response;
|
||||
} catch (e) {
|
||||
print('Error checking registration status: ${e.toString()}');
|
||||
return null;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset all registration fields
|
||||
void resetRegistrationFields() {
|
||||
// Reset text controllers
|
||||
emailController.clear();
|
||||
passwordController.clear();
|
||||
nameController.clear();
|
||||
confirmPasswordController.clear();
|
||||
|
||||
// Reset form fields
|
||||
email.value = '';
|
||||
password.value = '';
|
||||
nik.value = '';
|
||||
phoneNumber.value = '';
|
||||
selectedRole.value = 'WARGA'; // Reset to default role
|
||||
alamatLengkap.value = '';
|
||||
tanggalLahir.value = null;
|
||||
rtRw.value = '';
|
||||
kelurahan.value = '';
|
||||
kecamatan.value = '';
|
||||
|
||||
// Reset form status
|
||||
isPasswordVisible.value = false;
|
||||
isConfirmPasswordVisible.value = false;
|
||||
errorMessage.value = '';
|
||||
|
||||
// Reset form key if needed
|
||||
if (formKey.currentState != null) {
|
||||
formKey.currentState!.reset();
|
||||
}
|
||||
|
||||
// Bersihkan WargaDashboardController jika terdaftar
|
||||
try {
|
||||
if (Get.isRegistered<WargaDashboardController>()) {
|
||||
print(
|
||||
'Removing WargaDashboardController to ensure clean state after registration',
|
||||
);
|
||||
Get.delete<WargaDashboardController>(force: true);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error removing WargaDashboardController: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ class LoginView extends GetView<AuthController> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Stack(
|
||||
children: [
|
||||
// Background gradient
|
||||
@ -77,9 +77,6 @@ class LoginView extends GetView<AuthController> {
|
||||
SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
physics: const ClampingScrollPhysics(),
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: Column(
|
||||
|
@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../theme/app_colors.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import '../../../routes/app_routes.dart';
|
||||
|
||||
class RegistrationSuccessView extends StatefulWidget {
|
||||
const RegistrationSuccessView({Key? key}) : super(key: key);
|
||||
@ -284,7 +285,7 @@ class _RegistrationSuccessViewState extends State<RegistrationSuccessView>
|
||||
Get.snackbar(
|
||||
'Berhasil Disalin',
|
||||
'Kode registrasi telah disalin ke clipboard',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: AppColors.successLight,
|
||||
colorText: AppColors.success,
|
||||
margin: const EdgeInsets.all(16),
|
||||
@ -329,7 +330,7 @@ class _RegistrationSuccessViewState extends State<RegistrationSuccessView>
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
// Navigate back to login page
|
||||
Get.offAllNamed('/login');
|
||||
Get.offNamed(Routes.LOGIN);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primary,
|
||||
|
@ -2,13 +2,20 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../controllers/auth_controller.dart';
|
||||
import '../../../theme/app_colors.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class RegistrationView extends GetView<AuthController> {
|
||||
const RegistrationView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
// Reset all registration fields when leaving the page
|
||||
controller.resetRegistrationFields();
|
||||
return true;
|
||||
},
|
||||
child: Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
// Background gradient - same as login page
|
||||
@ -97,6 +104,7 @@ class RegistrationView extends GetView<AuthController> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -104,7 +112,11 @@ class RegistrationView extends GetView<AuthController> {
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: InkWell(
|
||||
onTap: () => Get.back(),
|
||||
onTap: () {
|
||||
// Reset all registration fields when going back
|
||||
controller.resetRegistrationFields();
|
||||
Get.back();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
@ -644,7 +656,11 @@ class RegistrationView extends GetView<AuthController> {
|
||||
style: TextStyle(color: AppColors.textSecondary),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Get.back(),
|
||||
onPressed: () {
|
||||
// Reset all registration fields when going back to login
|
||||
controller.resetRegistrationFields();
|
||||
Get.back();
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
),
|
||||
@ -694,7 +710,8 @@ class RegistrationView extends GetView<AuthController> {
|
||||
// Show dialog to check registration status
|
||||
void _showCheckStatusDialog(BuildContext context) {
|
||||
final TextEditingController codeController = TextEditingController();
|
||||
final TextEditingController identifierController = TextEditingController();
|
||||
final TextEditingController emailController = TextEditingController();
|
||||
final authController = Get.find<AuthController>();
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -788,9 +805,9 @@ class RegistrationView extends GetView<AuthController> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Email/NIK/Phone field
|
||||
// Email field
|
||||
Text(
|
||||
'Email/NIK/No HP',
|
||||
'Email',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
@ -799,12 +816,13 @@ class RegistrationView extends GetView<AuthController> {
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: identifierController,
|
||||
controller: emailController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Masukkan email, NIK, atau no HP',
|
||||
hintText: 'Masukkan email yang terdaftar',
|
||||
hintStyle: TextStyle(color: AppColors.textLight),
|
||||
prefixIcon: Icon(
|
||||
Icons.person_outline,
|
||||
Icons.email_outlined,
|
||||
color: AppColors.iconGrey,
|
||||
size: 22,
|
||||
),
|
||||
@ -835,20 +853,99 @@ class RegistrationView extends GetView<AuthController> {
|
||||
width: double.infinity,
|
||||
height: 48,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
// TODO: Implement check status functionality
|
||||
onPressed: () async {
|
||||
// Validasi input
|
||||
if (codeController.text.isEmpty ||
|
||||
emailController.text.isEmpty) {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Kode registrasi dan Email harus diisi',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: AppColors.errorLight,
|
||||
colorText: AppColors.error,
|
||||
icon: Icon(
|
||||
Icons.error_outline,
|
||||
color: AppColors.error,
|
||||
),
|
||||
duration: const Duration(seconds: 3),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Simpan nilai input untuk digunakan nanti
|
||||
final String registerId = codeController.text.trim();
|
||||
final String email = emailController.text.trim();
|
||||
|
||||
print(
|
||||
'Checking registration status for ID: $registerId, Email: $email',
|
||||
);
|
||||
|
||||
// Tutup dialog input
|
||||
Navigator.pop(context);
|
||||
|
||||
// Show a mock response for now
|
||||
// Tampilkan loading indicator
|
||||
Get.dialog(
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
barrierDismissible: false,
|
||||
);
|
||||
|
||||
try {
|
||||
// Cek status pendaftaran
|
||||
final result = await authController
|
||||
.checkRegistrationStatus(registerId, email);
|
||||
|
||||
// Debug log
|
||||
print('Registration status check result: $result');
|
||||
|
||||
// Tutup dialog loading
|
||||
Get.back();
|
||||
|
||||
// Periksa hasil query
|
||||
if (result != null && result.isNotEmpty) {
|
||||
print('Valid result found, showing status dialog');
|
||||
|
||||
// Tambahkan delay kecil untuk memastikan UI diperbarui dengan benar
|
||||
// Ini membantu memastikan dialog status muncul setelah dialog loading ditutup
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
_showRegistrationStatusDialog(result);
|
||||
});
|
||||
} else {
|
||||
print('No result found or empty result');
|
||||
|
||||
// Tampilkan pesan error
|
||||
Get.snackbar(
|
||||
'Status Pendaftaran',
|
||||
'Status pendaftaran sedang diproses. Silakan tunggu konfirmasi lebih lanjut.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: AppColors.infoLight,
|
||||
colorText: AppColors.info,
|
||||
icon: Icon(Icons.info_outline, color: AppColors.info),
|
||||
'Tidak Ditemukan',
|
||||
'Data pendaftaran tidak ditemukan. Pastikan kode registrasi dan email yang dimasukkan benar.',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: AppColors.errorLight,
|
||||
colorText: AppColors.error,
|
||||
icon: Icon(
|
||||
Icons.error_outline,
|
||||
color: AppColors.error,
|
||||
),
|
||||
duration: const Duration(seconds: 4),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
// Tutup dialog loading jika terjadi error
|
||||
Get.back();
|
||||
|
||||
print('Error checking registration status: $e');
|
||||
|
||||
// Tampilkan pesan error
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Terjadi kesalahan saat memeriksa status. Silakan coba lagi nanti.',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: AppColors.errorLight,
|
||||
colorText: AppColors.error,
|
||||
icon: Icon(
|
||||
Icons.error_outline,
|
||||
color: AppColors.error,
|
||||
),
|
||||
duration: const Duration(seconds: 4),
|
||||
);
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.accent,
|
||||
@ -875,6 +972,219 @@ class RegistrationView extends GetView<AuthController> {
|
||||
);
|
||||
}
|
||||
|
||||
// Show dialog with registration status details
|
||||
void _showRegistrationStatusDialog(Map<String, dynamic> data) {
|
||||
// Log data yang diterima untuk debugging
|
||||
print('Showing registration status dialog with data: $data');
|
||||
|
||||
// Validasi data
|
||||
if (data.isEmpty) {
|
||||
print('Error: Empty data received in _showRegistrationStatusDialog');
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Data status pendaftaran tidak valid',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: AppColors.errorLight,
|
||||
colorText: AppColors.error,
|
||||
duration: const Duration(seconds: 3),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final String status = data['status'] ?? 'unknown';
|
||||
final String namaLengkap = data['nama_lengkap'] ?? '';
|
||||
final String keterangan = data['keterangan'] ?? '';
|
||||
|
||||
print('Processing status: $status, nama: $namaLengkap');
|
||||
|
||||
// Define status color and message based on status
|
||||
Color statusColor;
|
||||
String statusMessage;
|
||||
IconData statusIcon;
|
||||
|
||||
switch (status) {
|
||||
case 'pending':
|
||||
statusColor = AppColors.warning;
|
||||
statusMessage =
|
||||
keterangan.isNotEmpty
|
||||
? keterangan
|
||||
: 'Pendaftaran Anda sedang dalam proses verifikasi oleh petugas. Mohon tunggu konfirmasi lebih lanjut.';
|
||||
statusIcon = Icons.hourglass_top;
|
||||
break;
|
||||
case 'active':
|
||||
statusColor = AppColors.success;
|
||||
statusMessage =
|
||||
keterangan.isNotEmpty
|
||||
? keterangan
|
||||
: 'Pendaftaran Anda telah disetujui. Anda dapat login menggunakan email dan password yang telah didaftarkan.';
|
||||
statusIcon = Icons.check_circle;
|
||||
break;
|
||||
case 'dibatalkan':
|
||||
statusColor = AppColors.error;
|
||||
statusMessage =
|
||||
keterangan.isNotEmpty
|
||||
? keterangan
|
||||
: 'Maaf, pendaftaran Anda ditolak. Silakan hubungi admin untuk informasi lebih lanjut.';
|
||||
statusIcon = Icons.cancel;
|
||||
break;
|
||||
case 'suspended':
|
||||
statusColor = AppColors.error;
|
||||
statusMessage =
|
||||
keterangan.isNotEmpty
|
||||
? keterangan
|
||||
: 'Akun Anda saat ini dinonaktifkan. Silakan hubungi admin untuk informasi lebih lanjut.';
|
||||
statusIcon = Icons.block;
|
||||
break;
|
||||
default:
|
||||
statusColor = AppColors.textSecondary;
|
||||
statusMessage =
|
||||
keterangan.isNotEmpty
|
||||
? keterangan
|
||||
: 'Status pendaftaran tidak diketahui. Silakan hubungi admin untuk informasi lebih lanjut.';
|
||||
statusIcon = Icons.help;
|
||||
}
|
||||
|
||||
print('Preparing to show dialog with status: $status, color: $statusColor');
|
||||
|
||||
// Gunakan Get.dialog sebagai pengganti showDialog untuk menghindari masalah context
|
||||
Get.dialog(
|
||||
Dialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: statusColor.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(statusIcon, color: statusColor, size: 40),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'Status Pendaftaran',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
namaLengkap,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: statusColor.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
child: Text(
|
||||
status.toUpperCase(),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: statusColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
statusMessage,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: AppColors.textSecondary,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
|
||||
// Tampilkan informasi tambahan jika ada
|
||||
if (data.containsKey('tanggal_update') &&
|
||||
data['tanggal_update'] != null) ...[
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.infoLight.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info_outline,
|
||||
size: 16,
|
||||
color: AppColors.info,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Informasi Tambahan',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
color: AppColors.info,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Terakhir diperbarui: ${_formatDate(data['tanggal_update'])}',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(height: 24),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Get.back(),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: statusColor,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
child: const Text(
|
||||
'Tutup',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
barrierDismissible: true,
|
||||
);
|
||||
|
||||
print('Dialog setup completed');
|
||||
}
|
||||
|
||||
// New method to build date picker field
|
||||
Widget _buildDateField(BuildContext context) {
|
||||
return GestureDetector(
|
||||
@ -944,4 +1254,24 @@ class RegistrationView extends GetView<AuthController> {
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatDate(dynamic date) {
|
||||
if (date is String) {
|
||||
try {
|
||||
final DateTime parsedDate = DateTime.parse(date);
|
||||
return DateFormat('dd MMM yyyy, HH:mm').format(parsedDate);
|
||||
} catch (e) {
|
||||
return date;
|
||||
}
|
||||
} else if (date is num) {
|
||||
final DateTime parsedDate = DateTime.fromMillisecondsSinceEpoch(
|
||||
date.toInt() * 1000,
|
||||
);
|
||||
return DateFormat('dd MMM yyyy, HH:mm').format(parsedDate);
|
||||
} else if (date is DateTime) {
|
||||
return DateFormat('dd MMM yyyy, HH:mm').format(date);
|
||||
} else {
|
||||
return "Format tanggal tidak diketahui";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class ListPetugasMitraController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Petugas mitra berhasil ditambahkan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class ListPetugasMitraController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Data petugas mitra berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ class ListPetugasMitraController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Petugas mitra berhasil dihapus',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ class ListPetugasMitraController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Status Diperbarui',
|
||||
'Status petugas mitra diubah menjadi ${!currentStatus ? 'Aktif' : 'Nonaktif'}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class PetugasAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error Memuat Data',
|
||||
'Gagal mengambil data aset dari server. Silakan coba lagi nanti.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -258,7 +258,7 @@ class PetugasAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Gagal',
|
||||
'Terjadi kesalahan saat menghapus aset',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -274,7 +274,7 @@ class PetugasAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal menghapus aset: ${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
@ -66,7 +66,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memuat data. Silakan coba lagi.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
@ -92,7 +92,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Rekening Utama',
|
||||
'Rekening ${account['bank_name']} telah dijadikan rekening utama',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Rekening Ditambahkan',
|
||||
'Rekening bank baru telah berhasil ditambahkan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Rekening Diperbarui',
|
||||
'Informasi rekening bank telah berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Tidak Dapat Menghapus',
|
||||
'Rekening utama tidak dapat dihapus. Silakan atur rekening lain sebagai utama terlebih dahulu.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -148,7 +148,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Rekening Dihapus',
|
||||
'Rekening bank telah berhasil dihapus',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -164,7 +164,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Status Diperbarui',
|
||||
'Status mitra telah diubah menjadi ${partner['is_active'] ? 'Aktif' : 'Tidak Aktif'}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Mitra Ditambahkan',
|
||||
'Mitra baru telah berhasil ditambahkan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Mitra Diperbarui',
|
||||
'Informasi mitra telah berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ class PetugasBumdesCbpController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Mitra Dihapus',
|
||||
'Mitra telah berhasil dihapus',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../data/providers/auth_provider.dart';
|
||||
import '../../../routes/app_routes.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
import 'package:bumrent_app/app/data/providers/auth_provider.dart';
|
||||
import 'package:bumrent_app/app/data/providers/aset_provider.dart';
|
||||
import 'package:bumrent_app/app/data/providers/pesanan_provider.dart';
|
||||
import 'package:bumrent_app/app/routes/app_routes.dart';
|
||||
import '../../../services/sewa_service.dart';
|
||||
import '../../../services/service_manager.dart';
|
||||
import '../../../data/models/pembayaran_model.dart';
|
||||
import '../../../services/pembayaran_service.dart';
|
||||
import '../../../data/providers/aset_provider.dart';
|
||||
import '../../../data/providers/pesanan_provider.dart';
|
||||
|
||||
class PetugasBumdesDashboardController extends GetxController {
|
||||
AuthProvider? _authProvider;
|
||||
@ -297,37 +299,56 @@ class PetugasBumdesDashboardController extends GetxController {
|
||||
|
||||
void logout() async {
|
||||
try {
|
||||
// Clear providers data
|
||||
if (_authProvider != null) {
|
||||
// Store login route for navigation
|
||||
final loginRoute = Routes.LOGIN;
|
||||
|
||||
// Sign out from Supabase
|
||||
if (_authProvider != null) {
|
||||
await _authProvider!.signOut();
|
||||
}
|
||||
|
||||
// Clear auth provider data
|
||||
// Navigate to login screen while context is still valid
|
||||
Get.offAllNamed(loginRoute);
|
||||
|
||||
// Clear auth provider data if available
|
||||
if (_authProvider != null) {
|
||||
_authProvider!.clearAuthData();
|
||||
|
||||
// Clear aset provider data
|
||||
try {
|
||||
final asetProvider = Get.find<AsetProvider>();
|
||||
asetProvider.clearCache();
|
||||
} catch (e) {
|
||||
print('Error clearing AsetProvider: $e');
|
||||
}
|
||||
|
||||
// Clear pesanan provider data
|
||||
try {
|
||||
final pesananProvider = Get.find<PesananProvider>();
|
||||
pesananProvider.clearCache();
|
||||
} catch (e) {
|
||||
print('Error clearing PesananProvider: $e');
|
||||
}
|
||||
}
|
||||
// Clear provider caches
|
||||
_clearProviderCaches();
|
||||
|
||||
// Navigate to login screen
|
||||
Get.offAllNamed(Routes.LOGIN);
|
||||
// Clean up GetX controllers but keep navigation intact
|
||||
Get.deleteAll(force: false);
|
||||
} catch (e) {
|
||||
print('Error during logout: $e');
|
||||
// Still try to navigate to login even if sign out fails
|
||||
Get.offAllNamed(Routes.LOGIN);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper method to clear provider caches that need explicit clearing
|
||||
void _clearProviderCaches() {
|
||||
try {
|
||||
// Clear AsetProvider cache
|
||||
if (Get.isRegistered<AsetProvider>()) {
|
||||
final asetProvider = Get.find<AsetProvider>();
|
||||
asetProvider.clearCache();
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error clearing AsetProvider: $e');
|
||||
}
|
||||
|
||||
try {
|
||||
// Clear PesananProvider cache
|
||||
if (Get.isRegistered<PesananProvider>()) {
|
||||
final pesananProvider = Get.find<PesananProvider>();
|
||||
pesananProvider.clearCache();
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error clearing PesananProvider: $e');
|
||||
}
|
||||
|
||||
// Add other providers here that need explicit cache clearing
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class PetugasDetailPenyewaController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Data penyewa tidak ditemukan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -46,7 +46,7 @@ class PetugasDetailPenyewaController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memuat data penyewa',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
@ -203,14 +203,14 @@ class PetugasDetailPenyewaController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Status penyewa berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} catch (e) {
|
||||
print('Error updating penyewa status: $e');
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memperbarui status penyewa',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
|
@ -184,7 +184,7 @@ class PetugasLaporanController extends GetxController {
|
||||
'Gagal membuat laporan: $e',
|
||||
backgroundColor: Colors.red[100],
|
||||
colorText: Colors.red[900],
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
@ -1641,7 +1641,7 @@ class PetugasLaporanController extends GetxController {
|
||||
'Harap generate laporan terlebih dahulu',
|
||||
backgroundColor: Colors.amber[100],
|
||||
colorText: Colors.amber[900],
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1654,7 +1654,7 @@ class PetugasLaporanController extends GetxController {
|
||||
'Harap generate laporan terlebih dahulu',
|
||||
backgroundColor: Colors.amber[100],
|
||||
colorText: Colors.amber[900],
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -1687,7 +1687,7 @@ class PetugasLaporanController extends GetxController {
|
||||
'Laporan disimpan di ${file.path}',
|
||||
backgroundColor: Colors.green[100],
|
||||
colorText: Colors.green[900],
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(seconds: 5),
|
||||
);
|
||||
|
||||
@ -1701,7 +1701,7 @@ class PetugasLaporanController extends GetxController {
|
||||
'Gagal menyimpan laporan: $e',
|
||||
backgroundColor: Colors.red[100],
|
||||
colorText: Colors.red[900],
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1714,7 +1714,7 @@ class PetugasLaporanController extends GetxController {
|
||||
'Harap generate laporan terlebih dahulu',
|
||||
backgroundColor: Colors.amber[100],
|
||||
colorText: Colors.amber[900],
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class PetugasManajemenBumdesController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Rekening utama berhasil diubah',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ class PetugasManajemenBumdesController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Status mitra berhasil diubah',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ class PetugasManajemenBumdesController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Rekening bank berhasil ditambahkan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ class PetugasManajemenBumdesController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Rekening bank berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ class PetugasManajemenBumdesController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Rekening bank berhasil dihapus',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ class PetugasManajemenBumdesController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Mitra berhasil ditambahkan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ class PetugasManajemenBumdesController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Mitra berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ class PetugasManajemenBumdesController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Mitra berhasil dihapus',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class PetugasPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memuat data paket. Silakan coba lagi.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -320,7 +320,7 @@ class PetugasPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Paket baru berhasil ditambahkan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -334,7 +334,7 @@ class PetugasPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal menambahkan paket. Silakan coba lagi.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -373,7 +373,7 @@ class PetugasPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Paket berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -388,7 +388,7 @@ class PetugasPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memperbarui paket. Silakan coba lagi.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -440,7 +440,7 @@ class PetugasPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Gagal',
|
||||
'Terjadi kesalahan saat menghapus paket',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: const Duration(seconds: 3),
|
||||
@ -462,7 +462,7 @@ class PetugasPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal menghapus paket: ${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: const Duration(seconds: 3),
|
||||
|
@ -6,6 +6,7 @@ class PetugasPenyewaController extends GetxController {
|
||||
|
||||
// Reactive variables
|
||||
final isLoading = true.obs;
|
||||
final isRefreshing = false.obs;
|
||||
final penyewaList = <Map<String, dynamic>>[].obs;
|
||||
final filteredPenyewaList = <Map<String, dynamic>>[].obs;
|
||||
final filterStatus = 'all'.obs;
|
||||
@ -30,6 +31,39 @@ class PetugasPenyewaController extends GetxController {
|
||||
fetchPenyewaList();
|
||||
}
|
||||
|
||||
// Method khusus untuk pull-to-refresh yang tidak menampilkan loading spinner penuh layar
|
||||
Future<void> refreshPenyewaList() async {
|
||||
try {
|
||||
isRefreshing.value = true;
|
||||
|
||||
// Get all penyewa data without filtering
|
||||
final data =
|
||||
await _authProvider.client
|
||||
.from('warga_desa')
|
||||
.select(
|
||||
'user_id, nama_lengkap, email, nik, no_hp, avatar, status, keterangan',
|
||||
)
|
||||
as List<dynamic>;
|
||||
|
||||
// Filter out rows where user_id is null
|
||||
final filteredData = data.where((row) => row['user_id'] != null).toList();
|
||||
|
||||
// Get total sewa count for each user
|
||||
final enrichedData = await _enrichWithSewaCount(filteredData);
|
||||
|
||||
penyewaList.value = enrichedData;
|
||||
|
||||
// Apply filters to update filteredPenyewaList
|
||||
applyFilters();
|
||||
|
||||
// Tampilkan pesan sukses
|
||||
} catch (e) {
|
||||
print('Error refreshing penyewa list: $e');
|
||||
} finally {
|
||||
isRefreshing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
void changeTab(int index) {
|
||||
currentTabIndex.value = index;
|
||||
applyFilters();
|
||||
@ -180,14 +214,14 @@ class PetugasPenyewaController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Status penyewa berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} catch (e) {
|
||||
print('Error updating penyewa status: $e');
|
||||
Get.snackbar(
|
||||
'Gagal',
|
||||
'Terjadi kesalahan saat memperbarui status penyewa',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
|
@ -4,6 +4,7 @@ import 'package:get/get.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:bumrent_app/app/data/models/aset_model.dart';
|
||||
import 'package:bumrent_app/app/data/providers/aset_provider.dart';
|
||||
import 'package:bumrent_app/app/routes/app_routes.dart';
|
||||
|
||||
class PetugasTambahAsetController extends GetxController {
|
||||
// Flag to check if in edit mode
|
||||
@ -17,7 +18,9 @@ class PetugasTambahAsetController extends GetxController {
|
||||
try {
|
||||
// Handle edit mode and load data if needed
|
||||
final args = Get.arguments;
|
||||
debugPrint('[DEBUG] PetugasTambahAsetController initialized with args: $args');
|
||||
debugPrint(
|
||||
'[DEBUG] PetugasTambahAsetController initialized with args: $args',
|
||||
);
|
||||
|
||||
if (args != null && args is Map<String, dynamic>) {
|
||||
isEditing.value = args['isEditing'] ?? false;
|
||||
@ -36,11 +39,13 @@ class PetugasTambahAsetController extends GetxController {
|
||||
// Load asset data and await completion
|
||||
await _loadAssetData(assetId);
|
||||
} else {
|
||||
debugPrint('[ERROR] Edit mode but no assetId provided in arguments');
|
||||
debugPrint(
|
||||
'[ERROR] Edit mode but no assetId provided in arguments',
|
||||
);
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'ID Aset tidak ditemukan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
// Optionally navigate back if in edit mode without an ID
|
||||
Future.delayed(Duration.zero, () => Get.back());
|
||||
@ -53,7 +58,9 @@ class PetugasTambahAsetController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
// Default values for new asset when no arguments are passed
|
||||
debugPrint('[DEBUG] No arguments passed, defaulting to add new asset mode');
|
||||
debugPrint(
|
||||
'[DEBUG] No arguments passed, defaulting to add new asset mode',
|
||||
);
|
||||
quantityController.text = '1';
|
||||
unitOfMeasureController.text = 'Unit';
|
||||
}
|
||||
@ -66,7 +73,7 @@ class PetugasTambahAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Terjadi kesalahan saat memuat data',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
@ -118,7 +125,8 @@ class PetugasTambahAsetController extends GetxController {
|
||||
|
||||
// Process each satuan waktu sewa
|
||||
for (var sws in aset.satuanWaktuSewa) {
|
||||
final satuan = sws['nama_satuan_waktu']?.toString().toLowerCase() ?? '';
|
||||
final satuan =
|
||||
sws['nama_satuan_waktu']?.toString().toLowerCase() ?? '';
|
||||
final harga = sws['harga'] as int? ?? 0;
|
||||
final maksimalWaktu = sws['maksimal_waktu'] as int? ?? 24;
|
||||
|
||||
@ -142,7 +150,9 @@ class PetugasTambahAsetController extends GetxController {
|
||||
final allImageUrls = aset.imageUrls.toList();
|
||||
|
||||
// If no imageUrls but has imageUrl, use that as fallback (backward compatibility)
|
||||
if (allImageUrls.isEmpty && aset.imageUrl != null && aset.imageUrl!.isNotEmpty) {
|
||||
if (allImageUrls.isEmpty &&
|
||||
aset.imageUrl != null &&
|
||||
aset.imageUrl!.isNotEmpty) {
|
||||
allImageUrls.add(aset.imageUrl!);
|
||||
}
|
||||
|
||||
@ -162,7 +172,9 @@ class PetugasTambahAsetController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
debugPrint('Total ${networkImageUrls.length} images loaded for asset $assetId');
|
||||
debugPrint(
|
||||
'Total ${networkImageUrls.length} images loaded for asset $assetId',
|
||||
);
|
||||
debugPrint('[DEBUG] Successfully loaded asset data for ID: $assetId');
|
||||
} catch (e, stackTrace) {
|
||||
debugPrint('[ERROR] Failed to load asset data: $e');
|
||||
@ -171,7 +183,7 @@ class PetugasTambahAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memuat data aset: ${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -182,6 +194,7 @@ class PetugasTambahAsetController extends GetxController {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Form controllers
|
||||
final nameController = TextEditingController();
|
||||
final descriptionController = TextEditingController();
|
||||
@ -213,8 +226,6 @@ class PetugasTambahAsetController extends GetxController {
|
||||
final isFormValid = false.obs;
|
||||
final isSubmitting = false.obs;
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// Dispose controllers
|
||||
@ -259,7 +270,6 @@ class PetugasTambahAsetController extends GetxController {
|
||||
validateForm();
|
||||
}
|
||||
|
||||
|
||||
// Create a new asset in Supabase
|
||||
Future<String?> _createAsset(
|
||||
Map<String, dynamic> assetData,
|
||||
@ -350,7 +360,9 @@ class PetugasTambahAsetController extends GetxController {
|
||||
debugPrint('\n🖼️ Processing photos for asset $assetId');
|
||||
debugPrint(' - Network URLs: ${networkImageUrls.length}');
|
||||
debugPrint(' - Local files: ${selectedImages.length}');
|
||||
debugPrint(' - Total unique photos: ${allImageUrls.toSet().length} (before deduplication)');
|
||||
debugPrint(
|
||||
' - Total unique photos: ${allImageUrls.toSet().length} (before deduplication)',
|
||||
);
|
||||
|
||||
try {
|
||||
// Use updateFotoAset which handles both uploading new photos and updating the database
|
||||
@ -360,7 +372,9 @@ class PetugasTambahAsetController extends GetxController {
|
||||
);
|
||||
|
||||
if (!photoSuccess) {
|
||||
debugPrint('⚠️ Some photos might not have been updated for asset $assetId');
|
||||
debugPrint(
|
||||
'⚠️ Some photos might not have been updated for asset $assetId',
|
||||
);
|
||||
// We don't fail the whole update if photo update fails
|
||||
// as the main asset data has been saved successfully
|
||||
} else {
|
||||
@ -377,7 +391,6 @@ class PetugasTambahAsetController extends GetxController {
|
||||
|
||||
debugPrint('\n✅ Asset update completed successfully for ID: $assetId');
|
||||
return true;
|
||||
|
||||
} catch (e, stackTrace) {
|
||||
debugPrint('❌ Error updating asset: $e');
|
||||
debugPrint('Stack trace: $stackTrace');
|
||||
@ -537,16 +550,18 @@ class PetugasTambahAsetController extends GetxController {
|
||||
// Show success message
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
isEditing.value ? 'Aset berhasil diperbarui' : 'Aset berhasil ditambahkan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
isEditing.value
|
||||
? 'Aset berhasil diperbarui'
|
||||
: 'Aset berhasil ditambahkan',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
duration: const Duration(seconds: 3),
|
||||
duration: const Duration(seconds: 2),
|
||||
);
|
||||
|
||||
// Navigate back with success after a short delay
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
Get.back(result: true);
|
||||
// Navigate back with success result instead of using offNamed
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
Get.offNamed(Routes.PETUGAS_ASET);
|
||||
} else {
|
||||
throw Exception('Gagal menyimpan aset');
|
||||
}
|
||||
@ -557,14 +572,13 @@ class PetugasTambahAsetController extends GetxController {
|
||||
'Terjadi kesalahan: ${e.toString()}',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} finally {
|
||||
isSubmitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Example method to upload images (to be implemented with your backend)
|
||||
// Future<List<String>> _uploadImages(List<XFile> images) async {
|
||||
// List<String> urls = [];
|
||||
@ -593,7 +607,7 @@ class PetugasTambahAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal mengambil gambar dari kamera: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -615,7 +629,7 @@ class PetugasTambahAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memilih gambar dari galeri: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -625,7 +639,9 @@ class PetugasTambahAsetController extends GetxController {
|
||||
// For demonstration purposes: add sample image
|
||||
void addSampleImage() {
|
||||
// In a real app, this would open the image picker
|
||||
selectedImages.add(XFile('assets/images/sample_asset_${selectedImages.length + 1}.jpg'));
|
||||
selectedImages.add(
|
||||
XFile('assets/images/sample_asset_${selectedImages.length + 1}.jpg'),
|
||||
);
|
||||
validateForm();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import 'package:bumrent_app/app/data/models/paket_model.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:bumrent_app/app/data/providers/aset_provider.dart';
|
||||
import 'dart:io';
|
||||
import 'package:bumrent_app/app/routes/app_routes.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class PetugasTambahPaketController extends GetxController {
|
||||
@ -47,6 +48,9 @@ class PetugasTambahPaketController extends GetxController {
|
||||
// New RxBool for editing
|
||||
final isEditing = false.obs;
|
||||
|
||||
// New RxBool for viewing (read-only mode)
|
||||
final isViewing = false.obs;
|
||||
|
||||
final timeOptions = {'Per Jam': true.obs, 'Per Hari': false.obs};
|
||||
final pricePerHourController = TextEditingController();
|
||||
final maxHourController = TextEditingController();
|
||||
@ -64,11 +68,13 @@ class PetugasTambahPaketController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
// Ambil flag isEditing dari arguments
|
||||
// Ambil flag isEditing dan isViewing dari arguments
|
||||
isEditing.value =
|
||||
Get.arguments != null && Get.arguments['isEditing'] == true;
|
||||
isViewing.value =
|
||||
Get.arguments != null && Get.arguments['isViewing'] == true;
|
||||
|
||||
if (isEditing.value) {
|
||||
if (isEditing.value || isViewing.value) {
|
||||
final paketArg = Get.arguments['paket'];
|
||||
String? paketId;
|
||||
if (paketArg != null) {
|
||||
@ -230,7 +236,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Pilih aset dan masukkan jumlah',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -251,7 +257,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Jumlah harus lebih dari 0',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -264,7 +270,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Jumlah melebihi stok yang tersedia',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -286,7 +292,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Item berhasil ditambahkan ke paket',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -300,7 +306,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Pilih aset dan masukkan jumlah',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -321,7 +327,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Jumlah harus lebih dari 0',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -349,7 +355,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Jumlah melebihi stok yang tersedia',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -362,7 +368,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Jumlah melebihi stok yang tersedia',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -385,7 +391,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Item berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -402,7 +408,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Dihapus',
|
||||
'Item berhasil dihapus dari paket',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.orange,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -538,13 +544,13 @@ class PetugasTambahPaketController extends GetxController {
|
||||
}
|
||||
|
||||
// Sukses
|
||||
Get.back();
|
||||
Get.offNamed(Routes.PETUGAS_PAKET);
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Paket berhasil diperbarui',
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} else {
|
||||
// --- ADD LOGIC ---
|
||||
@ -611,13 +617,13 @@ class PetugasTambahPaketController extends GetxController {
|
||||
}
|
||||
}
|
||||
// Sukses
|
||||
Get.back();
|
||||
Get.back(result: true);
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Paket berhasil ditambahkan',
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
@ -627,7 +633,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
'Terjadi kesalahan: \\${e.toString()}',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
} finally {
|
||||
isSubmitting.value = false;
|
||||
@ -810,7 +816,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal mengambil gambar dari kamera: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -833,7 +839,7 @@ class PetugasTambahPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memilih gambar dari galeri: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
@ -476,7 +476,7 @@ class ListPetugasMitraView extends GetView<ListPetugasMitraController> {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Harap isi semua data',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -600,7 +600,7 @@ class ListPetugasMitraView extends GetView<ListPetugasMitraController> {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Harap isi semua data',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
@ -203,7 +203,7 @@ class ListTagihanPeriodeView extends GetView<ListTagihanPeriodeController> {
|
||||
backgroundColor: Colors.orange.withOpacity(0.1),
|
||||
colorText: Colors.orange.shade800,
|
||||
duration: const Duration(seconds: 3),
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
margin: const EdgeInsets.all(8),
|
||||
);
|
||||
},
|
||||
|
@ -81,11 +81,15 @@ class _PetugasAsetViewState extends State<PetugasAsetView>
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
// Navigate to PetugasTambahAsetView in add mode
|
||||
// Navigate to PetugasTambahAsetView in add mode and refresh data when returning
|
||||
Get.toNamed(
|
||||
Routes.PETUGAS_TAMBAH_ASET,
|
||||
arguments: {'isEditing': false, 'assetData': null},
|
||||
);
|
||||
)?.then((_) {
|
||||
// Refresh data when returning from tambah_aset page
|
||||
debugPrint('Returning from tambah aset page, refreshing data...');
|
||||
controller.loadAsetData();
|
||||
});
|
||||
},
|
||||
backgroundColor: AppColorsPetugas.babyBlueBright,
|
||||
icon: Icon(Icons.add, color: AppColorsPetugas.blueGrotto),
|
||||
@ -456,7 +460,7 @@ class _PetugasAsetViewState extends State<PetugasAsetView>
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'ID Aset tidak valid',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -467,7 +471,13 @@ class _PetugasAsetViewState extends State<PetugasAsetView>
|
||||
'isEditing': true,
|
||||
'assetId': assetId,
|
||||
},
|
||||
)?.then((_) {
|
||||
// Refresh data when returning from edit page
|
||||
debugPrint(
|
||||
'Returning from edit aset page, refreshing data...',
|
||||
);
|
||||
controller.loadAsetData();
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
@ -670,235 +680,16 @@ class _PetugasAsetViewState extends State<PetugasAsetView>
|
||||
}
|
||||
}
|
||||
|
||||
void _showAddEditAssetDialog(
|
||||
BuildContext context, {
|
||||
Map<String, dynamic>? aset,
|
||||
}) {
|
||||
final isEditing = aset != null;
|
||||
|
||||
// In a real app, this would have proper form handling with controllers
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColorsPetugas.babyBlue,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
isEditing ? Icons.edit : Icons.add,
|
||||
color: AppColorsPetugas.navyBlue,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
isEditing ? 'Edit Aset' : 'Tambah Aset Baru',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColorsPetugas.navyBlue,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Silakan lengkapi form di bawah ini',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColorsPetugas.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Mock form - In a real app this would have actual form fields
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColorsPetugas.babyBlueBright,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColorsPetugas.babyBlue),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Form pengelolaan aset akan ditampilkan di sini dengan field untuk:',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColorsPetugas.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildMockFormField('Nama Aset', 'Contoh: Meja Rapat'),
|
||||
_buildMockFormField('Kategori', 'Pilih kategori aset'),
|
||||
_buildMockFormField(
|
||||
'Harga',
|
||||
'Masukkan harga per unit/periode',
|
||||
),
|
||||
_buildMockFormField(
|
||||
'Satuan',
|
||||
'Contoh: per hari, per bulan',
|
||||
),
|
||||
_buildMockFormField('Stok', 'Jumlah unit tersedia'),
|
||||
_buildMockFormField(
|
||||
'Deskripsi',
|
||||
'Keterangan lengkap aset',
|
||||
),
|
||||
_buildMockToggle(
|
||||
'Status Ketersediaan',
|
||||
isEditing && aset?['tersedia'] == true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Action buttons
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text(
|
||||
'Batal',
|
||||
style: TextStyle(
|
||||
color: AppColorsPetugas.textSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
// In a real app, we would save the form data
|
||||
Get.snackbar(
|
||||
isEditing ? 'Aset Diperbarui' : 'Aset Ditambahkan',
|
||||
isEditing
|
||||
? 'Aset berhasil diperbarui'
|
||||
: 'Aset baru berhasil ditambahkan',
|
||||
backgroundColor: AppColorsPetugas.success,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
margin: const EdgeInsets.all(16),
|
||||
borderRadius: 10,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColorsPetugas.blueGrotto,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 24,
|
||||
vertical: 12,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
child: Text(isEditing ? 'Simpan' : 'Tambah'),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMockFormField(String label, String hint) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColorsPetugas.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColorsPetugas.babyBlue),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
hint,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColorsPetugas.textLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.keyboard_arrow_down,
|
||||
color: AppColorsPetugas.textSecondary,
|
||||
size: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMockToggle(String label, bool value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColorsPetugas.textPrimary,
|
||||
),
|
||||
),
|
||||
Switch(
|
||||
value: value,
|
||||
onChanged: (_) {},
|
||||
activeColor: AppColorsPetugas.blueGrotto,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
void _showAddEditAssetDialog(BuildContext context) {
|
||||
// Navigate to PetugasTambahAsetView in add mode and refresh data when returning
|
||||
Get.toNamed(
|
||||
Routes.PETUGAS_TAMBAH_ASET,
|
||||
arguments: {'isEditing': false, 'assetData': null},
|
||||
)?.then((_) {
|
||||
// Refresh data when returning from tambah_aset page
|
||||
debugPrint('Returning from tambah aset page, refreshing data...');
|
||||
controller.loadAsetData();
|
||||
});
|
||||
}
|
||||
|
||||
void _showDeleteConfirmation(
|
||||
|
@ -1023,7 +1023,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Status sewa telah diubah menjadi SELESAI',
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -1054,7 +1054,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Status sewa telah diubah menjadi DIKEMBALIKAN',
|
||||
backgroundColor: Colors.teal,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -1127,7 +1127,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Status sewa telah diubah menjadi DIBATALKAN',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -1381,7 +1381,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Status pengajuan diubah menjadi Periksa Pembayaran',
|
||||
backgroundColor: Colors.amber.shade700,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
break;
|
||||
|
||||
@ -1394,7 +1394,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Pengajuan sewa aset telah disetujui',
|
||||
backgroundColor: Colors.green.shade600,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
break;
|
||||
|
||||
@ -1407,7 +1407,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Permintaan pembayaran denda telah dikirim',
|
||||
backgroundColor: Colors.deepOrange,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
break;
|
||||
|
||||
@ -1420,7 +1420,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Status pengajuan diubah menjadi Periksa Denda',
|
||||
backgroundColor: Colors.red.shade600,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
break;
|
||||
|
||||
@ -1433,7 +1433,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Aset telah dikembalikan dan sewa telah selesai',
|
||||
backgroundColor: Colors.green.shade600,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
break;
|
||||
|
||||
@ -1476,7 +1476,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Status sewa telah diubah menjadi DIBATALKAN',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -1595,7 +1595,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Status sewa diubah menjadi Dikembalikan',
|
||||
backgroundColor: Colors.teal,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -1628,7 +1628,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Permintaan pembayaran denda telah dikirim',
|
||||
backgroundColor: Colors.deepOrange,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -1661,7 +1661,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Sewa aset telah selesai',
|
||||
backgroundColor: Colors.purple,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
};
|
||||
} else if (status == 'Dikembalikan') {
|
||||
@ -1709,7 +1709,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Sewa aset telah selesai',
|
||||
backgroundColor: Colors.purple,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.task_alt_outlined),
|
||||
@ -1817,7 +1817,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Bukti sewa dalam format PDF sedang diunduh',
|
||||
backgroundColor: AppColorsPetugas.blueGrotto,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -1837,7 +1837,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Bukti sewa dalam format JPG sedang diunduh',
|
||||
backgroundColor: AppColorsPetugas.blueGrotto,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -1857,7 +1857,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Data sewa dalam format XLSX sedang diunduh',
|
||||
backgroundColor: AppColorsPetugas.blueGrotto,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -1963,7 +1963,8 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
width: double.infinity,
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
nominalController.text = sewa.totalTagihan.toString();
|
||||
nominalController.text =
|
||||
sewa.totalTagihan.toInt().toString();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.payments_outlined,
|
||||
@ -2456,7 +2457,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Nominal denda harus diisi',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -2501,7 +2502,7 @@ class _PetugasDetailSewaViewState extends State<PetugasDetailSewaView> {
|
||||
'Permintaan pembayaran denda telah dikirim',
|
||||
backgroundColor: Colors.deepOrange,
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.check_circle),
|
||||
|
@ -567,7 +567,7 @@ class PetugasManajemenBumdesView
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Fitur tambah rekening bank sedang dalam pengembangan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -639,7 +639,7 @@ class PetugasManajemenBumdesView
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Fitur edit rekening bank sedang dalam pengembangan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -689,7 +689,7 @@ class PetugasManajemenBumdesView
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Fitur hapus rekening bank sedang dalam pengembangan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -765,7 +765,7 @@ class PetugasManajemenBumdesView
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Fitur tambah mitra sedang dalam pengembangan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -845,7 +845,7 @@ class PetugasManajemenBumdesView
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Fitur edit mitra sedang dalam pengembangan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -895,7 +895,7 @@ class PetugasManajemenBumdesView
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Fitur hapus mitra sedang dalam pengembangan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
|
@ -55,11 +55,17 @@ class PetugasPaketView extends GetView<PetugasPaketController> {
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed:
|
||||
() => Get.toNamed(
|
||||
onPressed: () async {
|
||||
final result = await Get.toNamed(
|
||||
Routes.PETUGAS_TAMBAH_PAKET,
|
||||
arguments: {'isEditing': false},
|
||||
),
|
||||
);
|
||||
|
||||
// Refresh the package list if a package was added
|
||||
if (result == true) {
|
||||
controller.loadPaketData();
|
||||
}
|
||||
},
|
||||
label: Text(
|
||||
'Tambah Paket',
|
||||
style: TextStyle(
|
||||
@ -142,11 +148,17 @@ class PetugasPaketView extends GetView<PetugasPaketController> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton.icon(
|
||||
onPressed:
|
||||
() => Get.toNamed(
|
||||
onPressed: () async {
|
||||
final result = await Get.toNamed(
|
||||
Routes.PETUGAS_TAMBAH_PAKET,
|
||||
arguments: {'isEditing': false},
|
||||
),
|
||||
);
|
||||
|
||||
// Refresh the package list if a package was added
|
||||
if (result == true) {
|
||||
controller.loadPaketData();
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.add),
|
||||
label: const Text('Tambah Paket'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -376,6 +388,21 @@ class PetugasPaketView extends GetView<PetugasPaketController> {
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final result = await Get.toNamed(
|
||||
Routes.PETUGAS_TAMBAH_PAKET,
|
||||
arguments: {
|
||||
'isEditing': false,
|
||||
'isViewing': true,
|
||||
'paket': paket,
|
||||
},
|
||||
);
|
||||
|
||||
// Refresh the package list if data was modified
|
||||
if (result == true) {
|
||||
controller.loadPaketData();
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
// Paket image or icon
|
||||
|
@ -111,6 +111,27 @@ class _PetugasPenyewaViewState extends State<PetugasPenyewaView>
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
// Tambahkan indikator refresh
|
||||
Obx(
|
||||
() =>
|
||||
controller.isRefreshing.value
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
),
|
||||
drawer: PetugasSideNavbar(controller: dashboardController),
|
||||
drawerEdgeDragWidth: 60,
|
||||
@ -148,7 +169,13 @@ class _PetugasPenyewaViewState extends State<PetugasPenyewaView>
|
||||
}
|
||||
|
||||
if (controller.filteredPenyewaList.isEmpty) {
|
||||
return _buildEmptyState();
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await controller.refreshPenyewaList();
|
||||
},
|
||||
color: AppColorsPetugas.blueGrotto,
|
||||
child: _buildEmptyStateWithScrollView(),
|
||||
);
|
||||
}
|
||||
|
||||
return _buildPenyewaList();
|
||||
@ -282,8 +309,26 @@ class _PetugasPenyewaViewState extends State<PetugasPenyewaView>
|
||||
);
|
||||
}
|
||||
|
||||
// Widget untuk menampilkan empty state dengan ScrollView untuk mendukung RefreshIndicator
|
||||
Widget _buildEmptyStateWithScrollView() {
|
||||
return ListView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(Get.context!).size.height * 0.7,
|
||||
child: _buildEmptyState(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPenyewaList() {
|
||||
return ListView.builder(
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await controller.refreshPenyewaList();
|
||||
},
|
||||
color: AppColorsPetugas.blueGrotto,
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: controller.filteredPenyewaList.length,
|
||||
itemBuilder: (context, index) {
|
||||
@ -315,7 +360,9 @@ class _PetugasPenyewaViewState extends State<PetugasPenyewaView>
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColorsPetugas.babyBlueLight.withOpacity(0.2),
|
||||
color: AppColorsPetugas.babyBlueLight.withOpacity(
|
||||
0.2,
|
||||
),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
@ -327,7 +374,10 @@ class _PetugasPenyewaViewState extends State<PetugasPenyewaView>
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white, width: 2),
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
width: 2,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
@ -424,7 +474,8 @@ class _PetugasPenyewaViewState extends State<PetugasPenyewaView>
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
_buildInfoTile(
|
||||
'Total Sewa',
|
||||
@ -454,7 +505,8 @@ class _PetugasPenyewaViewState extends State<PetugasPenyewaView>
|
||||
// Add "Detail" button for Verifikasi tab
|
||||
if (controller.currentTabIndex.value == 0) ...[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildActionChip(
|
||||
@ -484,6 +536,7 @@ class _PetugasPenyewaViewState extends State<PetugasPenyewaView>
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,9 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
appBar: AppBar(
|
||||
title: Obx(
|
||||
() => Text(
|
||||
controller.isEditing.value ? 'Edit Paket' : 'Tambah Paket',
|
||||
controller.isViewing.value
|
||||
? 'Detail Paket'
|
||||
: (controller.isEditing.value ? 'Edit Paket' : 'Tambah Paket'),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
@ -168,6 +170,7 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
'Item Paket',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
if (!controller.isViewing.value)
|
||||
ElevatedButton.icon(
|
||||
onPressed: () => _showAddItemDialog(),
|
||||
icon: const Icon(Icons.add),
|
||||
@ -208,7 +211,10 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
Text('Stok tersedia: ${item['stok']}'),
|
||||
],
|
||||
),
|
||||
trailing: Row(
|
||||
trailing:
|
||||
controller.isViewing.value
|
||||
? null
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
@ -216,7 +222,9 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
Icons.edit,
|
||||
color: Colors.blue,
|
||||
),
|
||||
onPressed: () => _showEditItemDialog(index),
|
||||
onPressed:
|
||||
() =>
|
||||
_showEditItemDialog(index),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
@ -224,7 +232,9 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
color: Colors.red,
|
||||
),
|
||||
onPressed:
|
||||
() => controller.removeItem(index),
|
||||
() => controller.removeItem(
|
||||
index,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -526,6 +536,9 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
String? prefixText,
|
||||
IconData? prefixIcon,
|
||||
}) {
|
||||
final petugasController =
|
||||
this.controller; // Reference to PetugasTambahPaketController
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@ -539,7 +552,7 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
color: AppColorsPetugas.textPrimary,
|
||||
),
|
||||
),
|
||||
if (isRequired) ...[
|
||||
if (isRequired && !petugasController.isViewing.value) ...[
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'*',
|
||||
@ -553,16 +566,27 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TextFormField(
|
||||
Obx(
|
||||
() => TextFormField(
|
||||
controller: controller,
|
||||
maxLines: maxLines,
|
||||
keyboardType: keyboardType,
|
||||
inputFormatters: inputFormatters,
|
||||
readOnly: petugasController.isViewing.value,
|
||||
style: TextStyle(
|
||||
color:
|
||||
petugasController.isViewing.value
|
||||
? AppColorsPetugas.textSecondary
|
||||
: AppColorsPetugas.textPrimary,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: hint,
|
||||
hintStyle: TextStyle(color: AppColorsPetugas.textLight),
|
||||
filled: true,
|
||||
fillColor: AppColorsPetugas.babyBlueBright,
|
||||
fillColor:
|
||||
petugasController.isViewing.value
|
||||
? AppColorsPetugas.babyBlueLight
|
||||
: AppColorsPetugas.babyBlueBright,
|
||||
prefixText: prefixText,
|
||||
prefixIcon:
|
||||
prefixIcon != null
|
||||
@ -593,6 +617,7 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -646,7 +671,10 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
vertical: 12,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: AppColorsPetugas.babyBlueBright,
|
||||
fillColor:
|
||||
controller.isViewing.value
|
||||
? AppColorsPetugas.babyBlueLight
|
||||
: AppColorsPetugas.babyBlueBright,
|
||||
),
|
||||
items:
|
||||
options.map((option) {
|
||||
@ -661,7 +689,10 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
onChanged:
|
||||
controller.isViewing.value
|
||||
? null // Disable in view-only mode
|
||||
: (value) {
|
||||
if (value != null) onChanged(value);
|
||||
},
|
||||
icon: Icon(
|
||||
@ -717,6 +748,7 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
runSpacing: 12,
|
||||
children: [
|
||||
// Add button
|
||||
if (!controller.isViewing.value)
|
||||
GestureDetector(
|
||||
onTap: _showImageSourceOptions,
|
||||
child: Container(
|
||||
@ -811,7 +843,9 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 4,
|
||||
child: InkWell(
|
||||
child:
|
||||
!controller.isViewing.value
|
||||
? InkWell(
|
||||
onTap: () => controller.removeImage(index),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
@ -825,7 +859,8 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -949,7 +984,33 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
child: Obx(() {
|
||||
// In view-only mode, just show a back button
|
||||
if (controller.isViewing.value) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () => Get.back(),
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
label: const Text('Kembali'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColorsPetugas.blueGrotto,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
textStyle: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// For edit/add mode, show cancel and save buttons
|
||||
return Row(
|
||||
children: [
|
||||
OutlinedButton.icon(
|
||||
onPressed: () => Get.back(),
|
||||
@ -957,7 +1018,10 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
label: const Text('Batal'),
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: AppColorsPetugas.textSecondary,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
horizontal: 16,
|
||||
),
|
||||
side: BorderSide(color: AppColorsPetugas.divider),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
@ -1009,7 +1073,8 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1035,7 +1100,10 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
() => Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () => controller.toggleTimeOption(option),
|
||||
onTap:
|
||||
controller.isViewing.value
|
||||
? null
|
||||
: () => controller.toggleTimeOption(option),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@ -1173,12 +1241,22 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
controller: priceController,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
readOnly: controller.isViewing.value,
|
||||
style: TextStyle(
|
||||
color:
|
||||
controller.isViewing.value
|
||||
? AppColorsPetugas.textSecondary
|
||||
: AppColorsPetugas.textPrimary,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Masukkan harga',
|
||||
hintStyle: TextStyle(color: AppColorsPetugas.textLight),
|
||||
prefixText: 'Rp ',
|
||||
filled: true,
|
||||
fillColor: AppColorsPetugas.babyBlueBright,
|
||||
fillColor:
|
||||
controller.isViewing.value
|
||||
? AppColorsPetugas.babyBlueLight
|
||||
: AppColorsPetugas.babyBlueBright,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 12,
|
||||
@ -1210,11 +1288,21 @@ class PetugasTambahPaketView extends GetView<PetugasTambahPaketController> {
|
||||
controller: maxController,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
readOnly: controller.isViewing.value,
|
||||
style: TextStyle(
|
||||
color:
|
||||
controller.isViewing.value
|
||||
? AppColorsPetugas.textSecondary
|
||||
: AppColorsPetugas.textPrimary,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Opsional',
|
||||
hintStyle: TextStyle(color: AppColorsPetugas.textLight),
|
||||
filled: true,
|
||||
fillColor: AppColorsPetugas.babyBlueBright,
|
||||
fillColor:
|
||||
controller.isViewing.value
|
||||
? AppColorsPetugas.babyBlueLight
|
||||
: AppColorsPetugas.babyBlueBright,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 12,
|
||||
|
@ -41,7 +41,7 @@ class PetugasMitraDashboardController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal keluar dari aplikasi',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class OrderSewaAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
errorMessage.value,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -211,7 +211,7 @@ class OrderSewaAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Tidak dapat menampilkan data - data tidak tersedia',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.amber,
|
||||
colorText: Colors.black,
|
||||
duration: const Duration(seconds: 3),
|
||||
@ -231,6 +231,9 @@ class OrderSewaAsetController extends GetxController {
|
||||
debugPrint('💾 Saved asetId to GetStorage: ${asetId.value}');
|
||||
}
|
||||
|
||||
// Bersihkan data controller
|
||||
clearData();
|
||||
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@ -445,6 +448,9 @@ class OrderSewaAsetController extends GetxController {
|
||||
void onBackPressed() {
|
||||
debugPrint('🔙 Back button pressed in OrderSewaAsetView');
|
||||
|
||||
// Bersihkan data controller sebelum kembali
|
||||
clearData();
|
||||
|
||||
try {
|
||||
// Try to use the navigation service
|
||||
navigationService.backFromOrderSewaAset();
|
||||
@ -2287,7 +2293,7 @@ class OrderSewaAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
message,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -2299,7 +2305,7 @@ class OrderSewaAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
message,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -2767,7 +2773,7 @@ class OrderSewaAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal membuat pesanan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -2777,7 +2783,7 @@ class OrderSewaAsetController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Terjadi kesalahan: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -3537,4 +3543,43 @@ class OrderSewaAsetController extends GetxController {
|
||||
isLoadingBookings(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear controller data
|
||||
void clearData() {
|
||||
aset.value = null;
|
||||
isLoading.value = true;
|
||||
hasError.value = false;
|
||||
errorMessage.value = '';
|
||||
asetId.value = '';
|
||||
isAset.value = true;
|
||||
isPaket.value = false;
|
||||
assetPhotos.clear();
|
||||
currentPhotoIndex.value = 0;
|
||||
isPhotosLoading.value = false;
|
||||
selectedSatuanWaktu.value = null;
|
||||
duration.value = 1;
|
||||
totalPrice.value = 0;
|
||||
jumlahUnit.value = 1;
|
||||
maxUnit.value = 1;
|
||||
selectedDate.value = '';
|
||||
startHour.value = -1;
|
||||
endHour.value = -1;
|
||||
formattedTimeRange.value = '';
|
||||
startDate.value = null;
|
||||
endDate.value = null;
|
||||
formattedDateRange.value = '';
|
||||
bookedDates.clear();
|
||||
isLoadingBookedDates.value = false;
|
||||
maxDayLimit.value = 0;
|
||||
availableHours.clear();
|
||||
bookedHours.clear();
|
||||
selectedHours.clear();
|
||||
bookedHoursList.clear();
|
||||
isLoadingBookings.value = false;
|
||||
hourlyInventory.clear();
|
||||
unavailableDatesForHourly.clear();
|
||||
paketItems.clear();
|
||||
isPaketItemsLoaded.value = false;
|
||||
paketId.value = '';
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memuat data paket',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -152,7 +152,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Terjadi kesalahan saat memuat data paket',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -183,10 +183,16 @@ class OrderSewaPaketController extends GetxController {
|
||||
deskripsi: getPaketDeskripsi(rawPaket),
|
||||
harga: getPaketHarga(rawPaket),
|
||||
kuantitas: getPaketKuantitas(rawPaket),
|
||||
foto: const <String>[], // Initialize with empty list, will be populated later
|
||||
foto:
|
||||
const <
|
||||
String
|
||||
>[], // Initialize with empty list, will be populated later
|
||||
satuanWaktuSewa: getPaketSatuanWaktuSewa(rawPaket),
|
||||
foto_paket: getPaketMainPhoto(rawPaket),
|
||||
images: const <String>[], // Initialize with empty list, will be populated later
|
||||
images:
|
||||
const <
|
||||
String
|
||||
>[], // Initialize with empty list, will be populated later
|
||||
createdAt: DateTime.now(),
|
||||
updatedAt: DateTime.now(),
|
||||
);
|
||||
@ -1030,7 +1036,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Waktu Tidak Tersedia',
|
||||
'Jam ini tidak tersedia karena ada aset dalam paket yang sudah dipesan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.orange,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1114,7 +1120,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Data paket tidak lengkap',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1131,7 +1137,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Silakan pilih waktu sewa',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1174,21 +1180,23 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Pesanan berhasil dibuat',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
||||
// Navigate to payment page
|
||||
if (result && resultData != null && resultData['id'] != null) {
|
||||
navigationService.navigateToPembayaranSewa(resultData['id'].toString());
|
||||
navigationService.navigateToPembayaranSewa(
|
||||
resultData['id'].toString(),
|
||||
);
|
||||
} else if (result) {
|
||||
// If result is true but we don't have an ID, navigate back to sewa aset
|
||||
navigationService.navigateToSewaAset();
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal mendapatkan ID pesanan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1196,7 +1204,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal membuat pesanan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1205,7 +1213,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal membuat pesanan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1215,7 +1223,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Terjadi kesalahan: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1392,7 +1400,7 @@ class OrderSewaPaketController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Peringatan',
|
||||
'Pilih tanggal terlebih dahulu',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.orange,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
@ -378,7 +378,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Pesanan Dibatalkan',
|
||||
'Batas waktu pembayaran telah berakhir',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 5),
|
||||
@ -417,7 +417,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal mengambil foto: ${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -443,7 +443,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memilih foto dari galeri: ${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -459,7 +459,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Mohon unggah bukti pembayaran terlebih dahulu',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -541,7 +541,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Bukti pembayaran berhasil diunggah',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -550,7 +550,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal mengunggah bukti pembayaran: ${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -654,7 +654,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Pembayaran tunai berhasil disubmit',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1090,7 +1090,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Data berhasil diperbarui',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
duration: const Duration(seconds: 2),
|
||||
@ -1104,7 +1104,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memperbarui data',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
@ -305,6 +305,9 @@ class PembayaranSewaController extends GetxController
|
||||
: 0,
|
||||
'status': rentalData['status'] ?? 'MENUNGGU PEMBAYARAN',
|
||||
'created_at': DateTime.now().toString(),
|
||||
'updated_at':
|
||||
DateTime.now()
|
||||
.toString(), // Explicitly set updated_at for countdown
|
||||
'denda': 0, // Default value
|
||||
'keterangan': '', // Default value
|
||||
'image_url': rentalData['imageUrl'],
|
||||
@ -359,13 +362,19 @@ class PembayaranSewaController extends GetxController
|
||||
'price_per_unit': 10000,
|
||||
'total_price': 50000,
|
||||
'status': 'MENUNGGU PEMBAYARAN',
|
||||
'created_at':
|
||||
DateTime.now().toString(), // Use this for countdown calculation
|
||||
'created_at': DateTime.now().toString(),
|
||||
'updated_at':
|
||||
DateTime.now()
|
||||
.toString(), // Explicitly set updated_at for countdown
|
||||
'denda': 20000, // Dummy data for denda
|
||||
'keterangan':
|
||||
'Terjadi kerusakan pada bagian kaki', // Dummy keterangan for denda
|
||||
};
|
||||
|
||||
debugPrint(
|
||||
'DEBUG: Set updated_at in orderDetails: ${orderDetails.value['updated_at']}',
|
||||
);
|
||||
|
||||
// Update the current step based on the status
|
||||
updateCurrentStepBasedOnStatus();
|
||||
|
||||
@ -433,14 +442,27 @@ class PembayaranSewaController extends GetxController
|
||||
if (data['status'] != null &&
|
||||
data['status'].toString().isNotEmpty) {
|
||||
val?['status'] = data['status'];
|
||||
debugPrint(
|
||||
'📊 Order status from sewa_aset: \\${data['status']}',
|
||||
);
|
||||
debugPrint('📊 Order status from sewa_aset: ${data['status']}');
|
||||
}
|
||||
// Tambahkan mapping updated_at
|
||||
|
||||
// Ensure updated_at is always set
|
||||
if (data['updated_at'] != null) {
|
||||
val?['updated_at'] = data['updated_at'];
|
||||
debugPrint(
|
||||
'📅 Using updated_at from database: ${data['updated_at']}',
|
||||
);
|
||||
} else if (data['created_at'] != null) {
|
||||
val?['updated_at'] = data['created_at'];
|
||||
debugPrint(
|
||||
'📅 Using created_at as fallback for updated_at: ${data['created_at']}',
|
||||
);
|
||||
} else {
|
||||
val?['updated_at'] = DateTime.now().toIso8601String();
|
||||
debugPrint(
|
||||
'📅 Using current timestamp as fallback for updated_at',
|
||||
);
|
||||
}
|
||||
|
||||
// Format rental period
|
||||
if (data['waktu_mulai'] != null &&
|
||||
data['waktu_selesai'] != null) {
|
||||
@ -448,12 +470,12 @@ class PembayaranSewaController extends GetxController
|
||||
final startTime = DateTime.parse(data['waktu_mulai']);
|
||||
final endTime = DateTime.parse(data['waktu_selesai']);
|
||||
val?['rental_period'] =
|
||||
'\\${startTime.day}/\\${startTime.month}/\\${startTime.year}, \\${startTime.hour}:\\${startTime.minute.toString().padLeft(2, '0')} - \\${endTime.hour}:\\${endTime.minute.toString().padLeft(2, '0')}';
|
||||
'${startTime.day}/${startTime.month}/${startTime.year}, ${startTime.hour}:${startTime.minute.toString().padLeft(2, '0')} - ${endTime.hour}:${endTime.minute.toString().padLeft(2, '0')}';
|
||||
debugPrint(
|
||||
'✅ Successfully formatted rental period: \\${val?['rental_period']}',
|
||||
'✅ Successfully formatted rental period: ${val?['rental_period']}',
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('❌ Error parsing date: \\${e}');
|
||||
debugPrint('❌ Error parsing date: ${e}');
|
||||
}
|
||||
} else {
|
||||
debugPrint(
|
||||
@ -577,7 +599,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Pesanan Dibatalkan',
|
||||
'Batas waktu pembayaran telah berakhir',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 5),
|
||||
@ -624,7 +646,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal mengambil foto: \\${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -653,7 +675,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memilih foto dari galeri: \\${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -679,7 +701,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Mohon unggah bukti pembayaran terlebih dahulu',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -691,7 +713,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Tidak ada perubahan yang perlu disimpan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.blue,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -843,7 +865,7 @@ class PembayaranSewaController extends GetxController
|
||||
val?['status'] == 'PEMBAYARAN DENDA') {
|
||||
val?['status'] = 'PERIKSA PEMBAYARAN DENDA';
|
||||
} else {
|
||||
val?['status'] = 'MEMERIKSA PEMBAYARAN';
|
||||
val?['status'] = 'PERIKSA PEMBAYARAN';
|
||||
}
|
||||
});
|
||||
|
||||
@ -894,7 +916,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Bukti pembayaran berhasil diunggah',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -903,7 +925,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal mengunggah bukti pembayaran: ${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -930,19 +952,19 @@ class PembayaranSewaController extends GetxController
|
||||
newStatus = 'MENUNGGU PEMBAYARAN';
|
||||
break;
|
||||
case 1:
|
||||
newStatus = 'MEMERIKSA PEMBAYARAN';
|
||||
newStatus = 'PERIKSA PEMBAYARAN';
|
||||
break;
|
||||
case 2:
|
||||
newStatus = 'DITERIMA';
|
||||
break;
|
||||
case 3:
|
||||
newStatus = 'PENGEMBALIAN';
|
||||
newStatus = 'DIKEMBALIKAN';
|
||||
break;
|
||||
case 4:
|
||||
newStatus = 'PEMBAYARAN DENDA';
|
||||
break;
|
||||
case 5:
|
||||
newStatus = 'MEMERIKSA PEMBAYARAN DENDA';
|
||||
newStatus = 'PERIKSA PEMBAYARAN DENDA';
|
||||
break;
|
||||
case 6:
|
||||
newStatus = 'SELESAI';
|
||||
@ -965,7 +987,7 @@ class PembayaranSewaController extends GetxController
|
||||
case 'MENUNGGU PEMBAYARAN':
|
||||
currentStep.value = 0;
|
||||
break;
|
||||
case 'MEMERIKSA PEMBAYARAN':
|
||||
case 'PERIKSA PEMBAYARAN':
|
||||
currentStep.value = 1;
|
||||
break;
|
||||
case 'DITERIMA':
|
||||
@ -974,7 +996,7 @@ class PembayaranSewaController extends GetxController
|
||||
case 'AKTIF':
|
||||
currentStep.value = 3;
|
||||
break;
|
||||
case 'PENGEMBALIAN':
|
||||
case 'DIKEMBALIKAN':
|
||||
currentStep.value = 4;
|
||||
break;
|
||||
case 'PEMBAYARAN DENDA':
|
||||
@ -1003,7 +1025,7 @@ class PembayaranSewaController extends GetxController
|
||||
void submitCashPayment() {
|
||||
// Update order status
|
||||
orderDetails.update((val) {
|
||||
val?['status'] = 'MEMERIKSA PEMBAYARAN';
|
||||
val?['status'] = 'PERIKSA PEMBAYARAN';
|
||||
});
|
||||
|
||||
// Cancel countdown timer as payment has been submitted
|
||||
@ -1013,7 +1035,7 @@ class PembayaranSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Pembayaran tunai berhasil disubmit',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1266,7 +1288,20 @@ class PembayaranSewaController extends GetxController
|
||||
updateCurrentStepBasedOnStatus();
|
||||
|
||||
// Restart countdown timer if needed
|
||||
if (orderDetails.value['status'] == 'MENUNGGU PEMBAYARAN') {
|
||||
if ((orderDetails.value['status'] ?? '').toString().toUpperCase() ==
|
||||
'MENUNGGU PEMBAYARAN') {
|
||||
debugPrint('Status is MENUNGGU PEMBAYARAN, restarting countdown timer');
|
||||
|
||||
// Ensure updated_at is set to current time if refreshing with MENUNGGU PEMBAYARAN status
|
||||
if (orderDetails.value['updated_at'] == null) {
|
||||
orderDetails.update((val) {
|
||||
val?['updated_at'] = DateTime.now().toIso8601String();
|
||||
});
|
||||
debugPrint(
|
||||
'Set updated_at to current time: ${orderDetails.value['updated_at']}',
|
||||
);
|
||||
}
|
||||
|
||||
_countdownTimer?.cancel();
|
||||
startCountdownTimer();
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class SewaAsetController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Terjadi kesalahan saat memuat data aset',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -279,7 +279,7 @@ class SewaAsetController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
message,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -321,7 +321,7 @@ class SewaAsetController extends GetxController
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Pesanan berhasil dibuat',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -383,7 +383,7 @@ class SewaAsetController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Terjadi kesalahan saat memuat data paket',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -429,7 +429,7 @@ class SewaAsetController extends GetxController
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal memuat data paket. Silakan coba lagi nanti.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -470,7 +470,7 @@ class SewaAsetController extends GetxController
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Pesanan paket berhasil dibuat',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
@ -46,30 +46,51 @@ class WargaDashboardController extends GetxController {
|
||||
final dendaAktifCount = 0.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
|
||||
// Set navigation index to Home (0)
|
||||
navigationService.setNavIndex(0);
|
||||
|
||||
// Load user data
|
||||
fetchProfileFromWargaDesa();
|
||||
_loadUserData();
|
||||
// Check if navigation is coming from login
|
||||
final args = Get.arguments;
|
||||
final bool isFromLogin = args != null && args['from_login'] == true;
|
||||
|
||||
// Load sample data
|
||||
_loadSampleData();
|
||||
if (isFromLogin) {
|
||||
print('onInit: Navigation from login detected, prioritizing data fetch');
|
||||
}
|
||||
|
||||
// Load dummy data for bills and penalties
|
||||
loadDummyData();
|
||||
// Verifikasi bahwa pengguna sudah login sebelum melakukan fetch data
|
||||
if (_authProvider.currentUser != null) {
|
||||
// Prioritize loading user profile data first
|
||||
await fetchProfileFromWargaDesa();
|
||||
|
||||
// Load unpaid rentals
|
||||
loadUnpaidRentals();
|
||||
// If the profile data was not loaded successfully, try again after a short delay
|
||||
if (userName.value == 'Pengguna Warga' || userNik.value.isEmpty) {
|
||||
print('onInit: Profile data not loaded, retrying after delay');
|
||||
await Future.delayed(const Duration(milliseconds: 800));
|
||||
await fetchProfileFromWargaDesa();
|
||||
}
|
||||
|
||||
// Debug count sewa_aset by status
|
||||
_debugCountSewaAset();
|
||||
// Load other user data
|
||||
await _loadUserData();
|
||||
|
||||
// Load sewa aktif
|
||||
loadActiveRentals();
|
||||
// Load other data in parallel to speed up the dashboard initialization
|
||||
Future.wait([
|
||||
_loadSampleData(),
|
||||
loadDummyData(),
|
||||
loadUnpaidRentals(),
|
||||
_debugCountSewaAset(),
|
||||
loadActiveRentals(),
|
||||
]).then((_) => print('onInit: All data loaded successfully'));
|
||||
|
||||
// If coming from login, make sure UI is updated
|
||||
if (isFromLogin) {
|
||||
update();
|
||||
}
|
||||
} else {
|
||||
print('onInit: User not logged in, skipping data fetch');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadUserData() async {
|
||||
@ -116,7 +137,7 @@ class WargaDashboardController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void _loadSampleData() {
|
||||
Future<void> _loadSampleData() async {
|
||||
// Clear any existing data
|
||||
activeRentals.clear();
|
||||
|
||||
@ -147,10 +168,37 @@ class WargaDashboardController extends GetxController {
|
||||
navigationService.toSewaAset();
|
||||
}
|
||||
|
||||
void refreshData() {
|
||||
fetchProfileFromWargaDesa();
|
||||
_loadSampleData();
|
||||
loadDummyData();
|
||||
Future<void> refreshData() async {
|
||||
print('refreshData: Refreshing dashboard data');
|
||||
try {
|
||||
// First fetch profile data
|
||||
await fetchProfileFromWargaDesa();
|
||||
await _loadUserData();
|
||||
|
||||
// Then load all other data in parallel
|
||||
await Future.wait([
|
||||
_loadSampleData(),
|
||||
loadDummyData(),
|
||||
loadUnpaidRentals(),
|
||||
loadActiveRentals(),
|
||||
_debugCountSewaAset(),
|
||||
]);
|
||||
|
||||
// Update UI
|
||||
update();
|
||||
print('refreshData: Dashboard data refreshed successfully');
|
||||
} catch (e) {
|
||||
print('refreshData: Error refreshing data: $e');
|
||||
// Show error message to user
|
||||
Get.snackbar(
|
||||
'Perhatian',
|
||||
'Terjadi kesalahan saat memuat data',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red.shade100,
|
||||
colorText: Colors.red.shade900,
|
||||
duration: const Duration(seconds: 3),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void onNavItemTapped(int index) {
|
||||
@ -176,12 +224,14 @@ class WargaDashboardController extends GetxController {
|
||||
Get.toNamed(Routes.WARGA_SEWA, arguments: {'tab': 3});
|
||||
}
|
||||
|
||||
void logout() async {
|
||||
Future<void> logout() async {
|
||||
print('logout: Logging out user');
|
||||
await _authProvider.signOut();
|
||||
navigationService.toLogin();
|
||||
print('logout: User logged out and redirected to login screen');
|
||||
}
|
||||
|
||||
void loadDummyData() {
|
||||
Future<void> loadDummyData() async {
|
||||
// Dummy active bills
|
||||
activeBills.clear();
|
||||
activeBills.add({
|
||||
@ -331,24 +381,77 @@ class WargaDashboardController extends GetxController {
|
||||
Future<void> fetchProfileFromWargaDesa() async {
|
||||
try {
|
||||
final user = _authProvider.currentUser;
|
||||
if (user == null) return;
|
||||
if (user == null) {
|
||||
print(
|
||||
'fetchProfileFromWargaDesa: No current user found, skipping fetch',
|
||||
);
|
||||
return; // Exit early if no user is logged in
|
||||
}
|
||||
|
||||
final userId = user.id;
|
||||
print('fetchProfileFromWargaDesa: Fetching data for user: $userId');
|
||||
|
||||
final data =
|
||||
await _authProvider.client
|
||||
.from('warga_desa')
|
||||
.select('nik, alamat, email, nama_lengkap, no_hp, avatar')
|
||||
.eq('user_id', userId)
|
||||
.maybeSingle();
|
||||
|
||||
if (data != null) {
|
||||
print('fetchProfileFromWargaDesa: Data retrieved successfully');
|
||||
userNik.value = data['nik']?.toString() ?? '';
|
||||
userAddress.value = data['alamat']?.toString() ?? '';
|
||||
userEmail.value = data['email']?.toString() ?? '';
|
||||
userName.value = data['nama_lengkap']?.toString() ?? '';
|
||||
userPhone.value = data['no_hp']?.toString() ?? '';
|
||||
userAvatar.value = data['avatar']?.toString() ?? '';
|
||||
|
||||
// Trigger UI refresh
|
||||
update();
|
||||
print('fetchProfileFromWargaDesa: Profile data updated');
|
||||
} else {
|
||||
print('fetchProfileFromWargaDesa: No data found for user: $userId');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error fetching profile from warga_desa: $e');
|
||||
// If it fails, try again after a delay
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
try {
|
||||
await _retryFetchProfile();
|
||||
} catch (retryError) {
|
||||
print('Retry error fetching profile: $retryError');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helper method to retry fetching profile
|
||||
Future<void> _retryFetchProfile() async {
|
||||
final user = _authProvider.currentUser;
|
||||
if (user == null) {
|
||||
print('_retryFetchProfile: No current user found, skipping retry');
|
||||
return; // Exit early if no user is logged in
|
||||
}
|
||||
|
||||
print('_retryFetchProfile: Retrying fetch for user: ${user.id}');
|
||||
|
||||
final data =
|
||||
await _authProvider.client
|
||||
.from('warga_desa')
|
||||
.select('nik, alamat, email, nama_lengkap, no_hp, avatar')
|
||||
.eq('user_id', user.id)
|
||||
.maybeSingle();
|
||||
|
||||
if (data != null) {
|
||||
print('_retryFetchProfile: Data retrieved successfully on retry');
|
||||
userNik.value = data['nik']?.toString() ?? '';
|
||||
userAddress.value = data['alamat']?.toString() ?? '';
|
||||
userEmail.value = data['email']?.toString() ?? '';
|
||||
userName.value = data['nama_lengkap']?.toString() ?? '';
|
||||
userPhone.value = data['no_hp']?.toString() ?? '';
|
||||
userAvatar.value = data['avatar']?.toString() ?? '';
|
||||
update();
|
||||
print('_retryFetchProfile: Profile data updated');
|
||||
}
|
||||
}
|
||||
|
||||
@ -533,7 +636,7 @@ class WargaDashboardController extends GetxController {
|
||||
Get.snackbar(
|
||||
'Gagal',
|
||||
'Tidak dapat mengakses ${source == ImageSource.camera ? 'kamera' : 'galeri'}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red.shade700,
|
||||
colorText: Colors.white,
|
||||
duration: const Duration(seconds: 3),
|
||||
|
@ -254,10 +254,28 @@ class WargaSewaController extends GetxController
|
||||
|
||||
debugPrint('Fetched ${sewaAsetList.length} sewa_aset records');
|
||||
|
||||
// Debug the structure of the first record if available
|
||||
if (sewaAsetList.isNotEmpty) {
|
||||
debugPrint('Sample sewa_aset record: ${sewaAsetList.first}');
|
||||
debugPrint('updated_at field: ${sewaAsetList.first['updated_at']}');
|
||||
}
|
||||
|
||||
// Process each sewa_aset record
|
||||
for (var sewaAset in sewaAsetList) {
|
||||
final processedData = await _processRentalData(sewaAset);
|
||||
processedData['status'] = sewaAset['status'] ?? 'MENUNGGU PEMBAYARAN';
|
||||
|
||||
// Ensure updated_at is set correctly
|
||||
if (sewaAset['updated_at'] == null &&
|
||||
processedData['status'] == 'MENUNGGU PEMBAYARAN') {
|
||||
// If updated_at is null but status is MENUNGGU PEMBAYARAN, use created_at as fallback
|
||||
processedData['updated_at'] =
|
||||
sewaAset['created_at'] ?? DateTime.now().toIso8601String();
|
||||
debugPrint(
|
||||
'Using created_at as fallback for updated_at: ${processedData['updated_at']}',
|
||||
);
|
||||
}
|
||||
|
||||
rentals.add(processedData);
|
||||
}
|
||||
|
||||
@ -321,7 +339,7 @@ class WargaSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Pesanan berhasil dibatalkan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -337,7 +355,7 @@ class WargaSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Gagal',
|
||||
'Gagal membatalkan pesanan: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -377,7 +395,7 @@ class WargaSewaController extends GetxController
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Navigasi ke halaman pembayaran',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -285,9 +285,10 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
// Handle back button press here
|
||||
handleBackButtonPress();
|
||||
return false; // We handle the navigation ourselves
|
||||
// Bersihkan controller saat pengguna keluar dari halaman dengan tombol back perangkat
|
||||
controller.clearData();
|
||||
debugPrint('🧹 Controller data cleared by WillPopScope');
|
||||
return true;
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.background,
|
||||
@ -474,11 +475,16 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
},
|
||||
// Add onTap handler for the image
|
||||
onTap: () {
|
||||
debugPrint("📸 Image tapped - opening fullscreen viewer");
|
||||
debugPrint(
|
||||
"📸 Image tapped - attempting to open fullscreen viewer",
|
||||
);
|
||||
try {
|
||||
final imageUrl = controller.getCurrentPhotoUrl();
|
||||
if (imageUrl != null && imageUrl.isNotEmpty) {
|
||||
debugPrint("📸 Current image URL: $imageUrl");
|
||||
debugPrint("📸 Total photos: ${controller.assetPhotos.length}");
|
||||
debugPrint(
|
||||
"📸 Total photos: ${controller.assetPhotos.length}",
|
||||
);
|
||||
|
||||
// Extract all image URLs from the assetPhotos collection
|
||||
final List<String> photoUrls = [];
|
||||
@ -495,88 +501,35 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
return;
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder:
|
||||
(context) => Dialog(
|
||||
insetPadding: EdgeInsets.zero,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.black,
|
||||
child: Stack(
|
||||
children: [
|
||||
// Image
|
||||
Center(
|
||||
child: InteractiveViewer(
|
||||
panEnabled: true,
|
||||
boundaryMargin: EdgeInsets.all(80),
|
||||
minScale: 0.5,
|
||||
maxScale: 4,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:
|
||||
photoUrls[controller
|
||||
.currentPhotoIndex
|
||||
.value],
|
||||
fit: BoxFit.contain,
|
||||
placeholder:
|
||||
(context, url) => Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
errorWidget:
|
||||
(context, url, error) => Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.broken_image_rounded,
|
||||
size: 64,
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'Gagal memuat foto',
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Close button
|
||||
Positioned(
|
||||
top: 40,
|
||||
right: 20,
|
||||
child: IconButton(
|
||||
icon: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
debugPrint(
|
||||
"📸 About to navigate to fullscreen viewer with ${photoUrls.length} photos",
|
||||
);
|
||||
|
||||
// Navigate to full screen image viewer using GetX
|
||||
Get.to(
|
||||
() => FullScreenImageViewer(
|
||||
imageUrls: photoUrls,
|
||||
initialIndex: controller.currentPhotoIndex.value,
|
||||
),
|
||||
fullscreenDialog: true,
|
||||
transition: Transition.fade,
|
||||
);
|
||||
|
||||
debugPrint("📸 Navigation initiated");
|
||||
} else {
|
||||
debugPrint("📸 No valid current image URL");
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint("📸 ERROR in image tap handler: $e");
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Failed to open image viewer',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: Colors.red.shade100,
|
||||
colorText: Colors.red.shade900,
|
||||
duration: const Duration(seconds: 2),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
@ -667,6 +620,7 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
|
||||
// Gradient overlay
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
@ -682,11 +636,13 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Zoom indicator overlay
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
right: 16,
|
||||
child: IgnorePointer(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
@ -696,6 +652,7 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
child: Icon(Icons.zoom_in, color: Colors.white, size: 24),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Navigation arrows - only show if we have more than 1 photo
|
||||
Obx(() {
|
||||
@ -1058,7 +1015,95 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
asetId,
|
||||
),
|
||||
builder: (context, snapshot) {
|
||||
return Container(
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
debugPrint(
|
||||
"📸 Package item image tapped - attempting to open fullscreen viewer for asset ID: $asetId",
|
||||
);
|
||||
try {
|
||||
// Get all photos for this asset
|
||||
final photos =
|
||||
await controller
|
||||
.asetProvider
|
||||
.getAsetPhotos(
|
||||
asetId,
|
||||
);
|
||||
if (photos.isEmpty) {
|
||||
debugPrint(
|
||||
"📸 No photos found for asset ID: $asetId",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract valid photo URLs
|
||||
final List<String>
|
||||
photoUrls = [];
|
||||
for (var photo
|
||||
in photos) {
|
||||
final url =
|
||||
photo.fotoAset;
|
||||
if (url.isNotEmpty) {
|
||||
photoUrls.add(url);
|
||||
debugPrint(
|
||||
"📸 Added photo URL: $url",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (photoUrls.isEmpty) {
|
||||
debugPrint(
|
||||
"📸 No valid photo URLs found",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
debugPrint(
|
||||
"📸 About to navigate to fullscreen viewer with ${photoUrls.length} photos",
|
||||
);
|
||||
|
||||
// Navigate to full screen image viewer using GetX
|
||||
Get.to(
|
||||
() =>
|
||||
FullScreenImageViewer(
|
||||
imageUrls:
|
||||
photoUrls,
|
||||
initialIndex: 0,
|
||||
),
|
||||
fullscreenDialog:
|
||||
true,
|
||||
transition:
|
||||
Transition.fade,
|
||||
);
|
||||
|
||||
debugPrint(
|
||||
"📸 Navigation initiated",
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint(
|
||||
"📸 ERROR in package item image tap handler: $e",
|
||||
);
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Failed to open image viewer',
|
||||
snackPosition:
|
||||
SnackPosition
|
||||
.BOTTOM,
|
||||
backgroundColor:
|
||||
Colors
|
||||
.red
|
||||
.shade100,
|
||||
colorText:
|
||||
Colors
|
||||
.red
|
||||
.shade900,
|
||||
duration:
|
||||
const Duration(
|
||||
seconds: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
@ -1128,8 +1173,7 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
Icons
|
||||
.image_not_supported_outlined,
|
||||
color:
|
||||
AppColors
|
||||
.textLight,
|
||||
AppColors.textLight,
|
||||
),
|
||||
),
|
||||
)
|
||||
@ -1140,6 +1184,7 @@ class OrderSewaAsetView extends GetView<OrderSewaAsetController> {
|
||||
AppColors
|
||||
.textLight,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -2458,22 +2503,53 @@ class _FullScreenImageViewerState extends State<FullScreenImageViewer> {
|
||||
for (int i = 0; i < widget.imageUrls.length && i < 3; i++) {
|
||||
debugPrint("📸 Image URL $i: ${widget.imageUrls[i]}");
|
||||
}
|
||||
|
||||
// Hide status bar for immersive view
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
SystemUiMode.manual,
|
||||
overlays: [], // Hide all system UI
|
||||
).catchError((error) {
|
||||
debugPrint("📸 Error setting system UI mode: $error");
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// Restore status bar when exiting
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
SystemUiMode.manual,
|
||||
overlays: SystemUiOverlay.values, // Restore all system UI
|
||||
).catchError((error) {
|
||||
debugPrint("📸 Error restoring system UI mode: $error");
|
||||
});
|
||||
|
||||
pageController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
// Ensure UI is restored on back button press
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
SystemUiMode.manual,
|
||||
overlays: SystemUiOverlay.values,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: Stack(
|
||||
body: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
// Photo Gallery
|
||||
PhotoViewGallery.builder(
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Add tap functionality to close when tapping on image
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: PhotoViewGallery.builder(
|
||||
scrollPhysics: const BouncingScrollPhysics(),
|
||||
builder: (BuildContext context, int index) {
|
||||
final imageUrl = widget.imageUrls[index];
|
||||
@ -2484,26 +2560,58 @@ class _FullScreenImageViewerState extends State<FullScreenImageViewer> {
|
||||
initialScale: PhotoViewComputedScale.contained,
|
||||
minScale: PhotoViewComputedScale.contained * 0.8,
|
||||
maxScale: PhotoViewComputedScale.covered * 2.0,
|
||||
heroAttributes: PhotoViewHeroAttributes(tag: "photo_$index"),
|
||||
heroAttributes: PhotoViewHeroAttributes(
|
||||
tag: "photo_$index",
|
||||
),
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
debugPrint("📸 Error loading image: $error");
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.broken_image_rounded,
|
||||
color: Colors.white70,
|
||||
size: 50,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'Gagal memuat gambar',
|
||||
style: TextStyle(
|
||||
color: Colors.white70,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount: widget.imageUrls.length,
|
||||
loadingBuilder:
|
||||
(context, event) => Center(
|
||||
child: SizedBox(
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
child: Container(
|
||||
width: 40.0,
|
||||
height: 40.0,
|
||||
child: CircularProgressIndicator(
|
||||
value:
|
||||
event == null
|
||||
? 0
|
||||
: event.cumulativeBytesLoaded /
|
||||
event.expectedTotalBytes!,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
(event.expectedTotalBytes ?? 1),
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(
|
||||
Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundDecoration: BoxDecoration(color: Colors.black),
|
||||
),
|
||||
backgroundDecoration: const BoxDecoration(
|
||||
color: Colors.black,
|
||||
),
|
||||
pageController: pageController,
|
||||
onPageChanged: (index) {
|
||||
setState(() {
|
||||
@ -2512,37 +2620,47 @@ class _FullScreenImageViewerState extends State<FullScreenImageViewer> {
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// Close button
|
||||
Positioned(
|
||||
top: 40,
|
||||
top: 20,
|
||||
left: 20,
|
||||
child: IconButton(
|
||||
icon: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.close, color: Colors.white),
|
||||
child: const Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
|
||||
// Image counter
|
||||
Positioned(
|
||||
top: 40,
|
||||
top: 20,
|
||||
right: 20,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Text(
|
||||
'${currentIndex + 1}/${widget.imageUrls.length}',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@ -2551,6 +2669,8 @@ class _FullScreenImageViewerState extends State<FullScreenImageViewer> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +318,7 @@
|
||||
Get.snackbar(
|
||||
'Perhatian',
|
||||
'Pilih jam mulai terlebih dahulu',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: AppColors.warning,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
@ -102,25 +102,25 @@ class PembayaranSewaView extends GetView<PembayaranSewaController> {
|
||||
.toUpperCase();
|
||||
final updatedAtStr =
|
||||
controller.orderDetails.value['updated_at'];
|
||||
print('DEBUG status: ' + status);
|
||||
print(
|
||||
'DEBUG updated_at (raw): ' +
|
||||
(updatedAtStr?.toString() ?? 'NULL'),
|
||||
debugPrint('DEBUG status (batas waktu): $status');
|
||||
debugPrint(
|
||||
'DEBUG updated_at batas waktu (raw): ${updatedAtStr?.toString() ?? 'NULL'}',
|
||||
);
|
||||
if (status == 'MENUNGGU PEMBAYARAN' && updatedAtStr != null) {
|
||||
try {
|
||||
final updatedAt = DateTime.parse(updatedAtStr);
|
||||
print(
|
||||
'DEBUG updated_at (parsed): ' +
|
||||
updatedAt.toIso8601String(),
|
||||
debugPrint(
|
||||
'DEBUG updated_at batas waktu (parsed): ${updatedAt.toIso8601String()}',
|
||||
);
|
||||
return CountdownTimerWidget(updatedAt: updatedAt);
|
||||
} catch (e) {
|
||||
print('ERROR parsing updated_at: ' + e.toString());
|
||||
return Text(
|
||||
'Format tanggal salah',
|
||||
style: TextStyle(color: Colors.red),
|
||||
debugPrint('ERROR parsing updated_at batas waktu: $e');
|
||||
// Fallback to current time if parsing fails
|
||||
final now = DateTime.now();
|
||||
debugPrint(
|
||||
'Using current time as fallback for batas waktu: ${now.toIso8601String()}',
|
||||
);
|
||||
return CountdownTimerWidget(updatedAt: now);
|
||||
}
|
||||
}
|
||||
return SizedBox.shrink();
|
||||
@ -322,25 +322,25 @@ class PembayaranSewaView extends GetView<PembayaranSewaController> {
|
||||
.toUpperCase();
|
||||
final updatedAtStr =
|
||||
controller.orderDetails.value['updated_at'];
|
||||
print('DEBUG status: ' + status);
|
||||
print(
|
||||
'DEBUG updated_at (raw): ' +
|
||||
(updatedAtStr?.toString() ?? 'NULL'),
|
||||
debugPrint('DEBUG status (batas waktu): $status');
|
||||
debugPrint(
|
||||
'DEBUG updated_at batas waktu (raw): ${updatedAtStr?.toString() ?? 'NULL'}',
|
||||
);
|
||||
if (status == 'MENUNGGU PEMBAYARAN' && updatedAtStr != null) {
|
||||
try {
|
||||
final updatedAt = DateTime.parse(updatedAtStr);
|
||||
print(
|
||||
'DEBUG updated_at (parsed): ' +
|
||||
updatedAt.toIso8601String(),
|
||||
debugPrint(
|
||||
'DEBUG updated_at batas waktu (parsed): ${updatedAt.toIso8601String()}',
|
||||
);
|
||||
return CountdownTimerWidget(updatedAt: updatedAt);
|
||||
} catch (e) {
|
||||
print('ERROR parsing updated_at: ' + e.toString());
|
||||
return Text(
|
||||
'Format tanggal salah',
|
||||
style: TextStyle(color: Colors.red),
|
||||
debugPrint('ERROR parsing updated_at batas waktu: $e');
|
||||
// Fallback to current time if parsing fails
|
||||
final now = DateTime.now();
|
||||
debugPrint(
|
||||
'Using current time as fallback for batas waktu: ${now.toIso8601String()}',
|
||||
);
|
||||
return CountdownTimerWidget(updatedAt: now);
|
||||
}
|
||||
}
|
||||
return SizedBox.shrink();
|
||||
@ -363,7 +363,7 @@ class PembayaranSewaView extends GetView<PembayaranSewaController> {
|
||||
'step': 0,
|
||||
},
|
||||
{
|
||||
'title': 'Memeriksa Pembayaran',
|
||||
'title': 'Periksa Pembayaran',
|
||||
'description': 'Pembayaran sedang diverifikasi oleh petugas',
|
||||
'icon': Icons.receipt_long,
|
||||
'step': 1,
|
||||
@ -381,8 +381,8 @@ class PembayaranSewaView extends GetView<PembayaranSewaController> {
|
||||
'step': 3,
|
||||
},
|
||||
{
|
||||
'title': 'Pengembalian',
|
||||
'description': 'Proses pengembalian aset sewa',
|
||||
'title': 'Dikembalikan',
|
||||
'description': 'Aset sudah dikembalikan',
|
||||
'icon': Icons.assignment_return,
|
||||
'step': 4,
|
||||
},
|
||||
@ -2585,9 +2585,8 @@ class _CountdownTimerWidgetState extends State<CountdownTimerWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
print(
|
||||
'DEBUG [CountdownTimerWidget] updatedAt: ' +
|
||||
widget.updatedAt.toIso8601String(),
|
||||
debugPrint(
|
||||
'DEBUG [CountdownTimerWidget] updatedAt: ${widget.updatedAt.toIso8601String()}',
|
||||
);
|
||||
updateRemaining();
|
||||
timer = Timer.periodic(
|
||||
@ -2599,18 +2598,29 @@ class _CountdownTimerWidgetState extends State<CountdownTimerWidget> {
|
||||
void updateRemaining() {
|
||||
final now = DateTime.now();
|
||||
final end = widget.updatedAt.add(const Duration(hours: 1));
|
||||
|
||||
debugPrint('Current time: $now');
|
||||
debugPrint('Deadline: $end');
|
||||
|
||||
setState(() {
|
||||
remaining = end.difference(now);
|
||||
debugPrint('Remaining time: ${remaining.inSeconds} seconds');
|
||||
|
||||
if (remaining.isNegative) {
|
||||
debugPrint('Countdown expired, setting to zero');
|
||||
remaining = Duration.zero;
|
||||
timer?.cancel();
|
||||
if (widget.onTimeout != null) {
|
||||
debugPrint('Calling onTimeout callback');
|
||||
widget.onTimeout?.call();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
debugPrint('CountdownTimerWidget disposed');
|
||||
timer?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
@ -2620,9 +2630,15 @@ class _CountdownTimerWidgetState extends State<CountdownTimerWidget> {
|
||||
if (remaining.inSeconds <= 0) {
|
||||
return Text('Waktu habis', style: TextStyle(color: Colors.red));
|
||||
}
|
||||
|
||||
final h = remaining.inHours;
|
||||
final m = remaining.inMinutes % 60;
|
||||
final s = remaining.inSeconds % 60;
|
||||
|
||||
final timeString =
|
||||
'${h.toString().padLeft(2, '0')}:${m.toString().padLeft(2, '0')}:${s.toString().padLeft(2, '0')}';
|
||||
debugPrint('Rendering countdown: $timeString');
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
@ -2636,7 +2652,7 @@ class _CountdownTimerWidgetState extends State<CountdownTimerWidget> {
|
||||
Icon(Icons.timer_outlined, size: 14, color: Colors.red),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Bayar dalam ${h.toString().padLeft(2, '0')}:${m.toString().padLeft(2, '0')}:${s.toString().padLeft(2, '0')}',
|
||||
'Bayar dalam $timeString',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
@ -1524,7 +1524,7 @@ class SewaAsetView extends GetView<SewaAsetController> {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'ID aset tidak valid',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1754,7 +1754,7 @@ class SewaAsetView extends GetView<SewaAsetController> {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'ID aset tidak valid',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -1801,7 +1801,7 @@ class SewaAsetView extends GetView<SewaAsetController> {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'ID aset tidak valid',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
|
@ -14,6 +14,19 @@ class WargaDashboardView extends GetView<WargaDashboardController> {
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
|
||||
// Check if coming from login and trigger refresh
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final args = Get.arguments;
|
||||
final bool isFromLogin = args != null && args['from_login'] == true;
|
||||
if (isFromLogin) {
|
||||
// Trigger refresh after UI is built
|
||||
controller.refreshData();
|
||||
print(
|
||||
'WargaDashboardView: Auto-refreshed data due to login navigation',
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async => false, // Prevent back navigation
|
||||
child: WargaLayout(
|
||||
|
@ -80,7 +80,7 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
Get.snackbar(
|
||||
'Gagal',
|
||||
'Terjadi kesalahan saat menyimpan foto profil',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -99,7 +99,7 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
Get.snackbar(
|
||||
'Gagal',
|
||||
'Terjadi kesalahan saat menghapus foto profil',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -124,7 +124,7 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
Get.snackbar(
|
||||
'Sukses',
|
||||
'Perubahan berhasil disimpan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -132,7 +132,7 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
Get.snackbar(
|
||||
'Gagal',
|
||||
'Terjadi kesalahan saat menyimpan perubahan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -156,6 +156,9 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
: IconButton(
|
||||
onPressed: () {
|
||||
isEditing.value = true;
|
||||
// Update controllers with current values when entering edit mode
|
||||
nameController.text = controller.userName.value;
|
||||
phoneController.text = controller.userPhone.value;
|
||||
},
|
||||
icon: const Icon(Icons.edit_outlined),
|
||||
tooltip: 'Edit Profil',
|
||||
@ -365,14 +368,6 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
} else {
|
||||
// Set avatar deleted flag
|
||||
isAvatarDeleted.value = true;
|
||||
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Foto profil akan dihapus setelah menekan Simpan',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: Colors.orange.shade700,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.delete_outline, size: 16),
|
||||
@ -468,13 +463,23 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
) {
|
||||
return Column(
|
||||
children: [
|
||||
// Section 1: Data Diri
|
||||
// Section 1: Data Diri - Dengan desain yang lebih modern
|
||||
Card(
|
||||
elevation: 4,
|
||||
elevation: 2,
|
||||
shadowColor: AppColors.primary.withOpacity(0.3),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [Colors.white, AppColors.primary.withOpacity(0.05)],
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
@ -482,12 +487,22 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.person_rounded,
|
||||
color: AppColors.primary,
|
||||
size: 22,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Data Diri',
|
||||
style: TextStyle(
|
||||
@ -496,32 +511,56 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Informasi personal Anda',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (isEditing) ...[
|
||||
const Spacer(),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.orange.shade100,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.edit_note,
|
||||
color: Colors.orange.shade700,
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Mode Edit',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.orange.shade700,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Icon(
|
||||
Icons.edit_note,
|
||||
color: Colors.orange.shade700,
|
||||
size: 18,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 24),
|
||||
// Email - always read-only
|
||||
_buildInfoItemModern(
|
||||
context,
|
||||
icon: Icons.email_rounded,
|
||||
title: 'Email',
|
||||
value: controller.userEmail.value,
|
||||
isVerified: true,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// Nama Lengkap - editable
|
||||
@ -548,16 +587,27 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Section 2: Informasi Warga
|
||||
// Section 2: Informasi Warga - Dengan desain yang lebih modern
|
||||
Card(
|
||||
elevation: 4,
|
||||
elevation: 2,
|
||||
shadowColor: AppColors.accent.withOpacity(0.3),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [Colors.white, AppColors.accent.withOpacity(0.05)],
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
@ -565,35 +615,57 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.accent.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.badge_rounded,
|
||||
color: AppColors.primary,
|
||||
color: AppColors.accent,
|
||||
size: 22,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Informasi Warga',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
color: AppColors.accent,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Detail kependudukan',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildInfoItemModern(
|
||||
context,
|
||||
icon: Icons.credit_card_rounded,
|
||||
title: 'NIK',
|
||||
value: controller.userNik.value,
|
||||
isImportant: true,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoItemModern(
|
||||
context,
|
||||
icon: Icons.calendar_today_rounded,
|
||||
title: 'Tanggal Lahir',
|
||||
value: controller.userTanggalLahir.value,
|
||||
value: formatTanggalLahir(
|
||||
controller.userTanggalLahir.value,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoItemModern(
|
||||
@ -604,6 +676,7 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
isMultiLine: true,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// Tampilkan RT/RW dan Kelurahan/Desa dalam dua baris terpisah
|
||||
_buildInfoItemModern(
|
||||
context,
|
||||
icon: Icons.location_on_rounded,
|
||||
@ -628,6 +701,7 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -638,46 +712,85 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
required String title,
|
||||
required String value,
|
||||
bool isMultiLine = false,
|
||||
bool isImportant = false,
|
||||
bool isVerified = false,
|
||||
bool isCompact = false,
|
||||
}) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade50,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.grey.shade200),
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color:
|
||||
isImportant
|
||||
? AppColors.primary.withOpacity(0.3)
|
||||
: Colors.grey.shade200,
|
||||
width: isImportant ? 1.5 : 1,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.05),
|
||||
blurRadius: 5,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: isCompact ? 12 : 16,
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
isMultiLine ? CrossAxisAlignment.start : CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: EdgeInsets.all(isCompact ? 6 : 8),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary.withOpacity(0.1),
|
||||
color:
|
||||
isImportant
|
||||
? AppColors.primary.withOpacity(0.15)
|
||||
: AppColors.accent.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(icon, color: AppColors.primary, size: 20),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: isImportant ? AppColors.primary : AppColors.accent,
|
||||
size: isCompact ? 16 : 20,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontSize: isCompact ? 12 : 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
),
|
||||
if (isVerified) ...[
|
||||
const SizedBox(width: 4),
|
||||
Icon(Icons.verified, size: 14, color: Colors.green),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
value.isEmpty ? 'Tidak tersedia' : value,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey.shade800,
|
||||
fontSize: isCompact ? 14 : 15,
|
||||
fontWeight: isImportant ? FontWeight.w700 : FontWeight.w600,
|
||||
color:
|
||||
isImportant
|
||||
? AppColors.primary
|
||||
: value.isEmpty
|
||||
? Colors.grey.shade400
|
||||
: Colors.grey.shade800,
|
||||
),
|
||||
maxLines: isMultiLine ? 3 : 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@ -685,6 +798,12 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isImportant)
|
||||
Icon(
|
||||
Icons.priority_high,
|
||||
size: 16,
|
||||
color: AppColors.primary.withOpacity(0.7),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -821,7 +940,7 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
Get.snackbar(
|
||||
'Info',
|
||||
'Fitur Ubah Password akan segera tersedia',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -933,4 +1052,54 @@ class WargaProfileView extends GetView<WargaDashboardController> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Fungsi untuk memformat tanggal lahir ke format Indonesia
|
||||
String formatTanggalLahir(String tanggal) {
|
||||
if (tanggal.isEmpty) return '';
|
||||
|
||||
try {
|
||||
// Coba parse tanggal dari berbagai format yang mungkin
|
||||
DateTime? dateTime;
|
||||
|
||||
// Coba format yyyy-MM-dd
|
||||
if (tanggal.contains('-')) {
|
||||
final parts = tanggal.split('-');
|
||||
if (parts.length == 3) {
|
||||
dateTime = DateTime.tryParse(tanggal);
|
||||
}
|
||||
}
|
||||
// Coba format dd/MM/yyyy
|
||||
else if (tanggal.contains('/')) {
|
||||
final parts = tanggal.split('/');
|
||||
if (parts.length == 3) {
|
||||
dateTime = DateTime.tryParse('${parts[2]}-${parts[1]}-${parts[0]}');
|
||||
}
|
||||
}
|
||||
|
||||
// Jika tidak bisa parse, kembalikan nilai asli
|
||||
if (dateTime == null) return tanggal;
|
||||
|
||||
// Daftar nama bulan dalam bahasa Indonesia
|
||||
final List<String> namaBulan = [
|
||||
'Januari',
|
||||
'Februari',
|
||||
'Maret',
|
||||
'April',
|
||||
'Mei',
|
||||
'Juni',
|
||||
'Juli',
|
||||
'Agustus',
|
||||
'September',
|
||||
'Oktober',
|
||||
'November',
|
||||
'Desember',
|
||||
];
|
||||
|
||||
// Format tanggal ke format Indonesia: dd Bulan yyyy
|
||||
return '${dateTime.day} ${namaBulan[dateTime.month - 1]} ${dateTime.year}';
|
||||
} catch (e) {
|
||||
// Jika ada error, kembalikan nilai asli
|
||||
return tanggal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -570,8 +570,34 @@ class WargaSewaView extends GetView<WargaSewaController> {
|
||||
if ((rental['status'] ?? '').toString().toUpperCase() ==
|
||||
'MENUNGGU PEMBAYARAN' &&
|
||||
rental['updated_at'] != null)
|
||||
CountdownTimerWidget(
|
||||
updatedAt: DateTime.parse(rental['updated_at']),
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final updatedAtStr = rental['updated_at'];
|
||||
debugPrint('DEBUG status: ${rental['status']}');
|
||||
debugPrint('DEBUG updated_at: $updatedAtStr');
|
||||
|
||||
if (updatedAtStr != null) {
|
||||
try {
|
||||
final updatedAt = DateTime.parse(updatedAtStr);
|
||||
debugPrint(
|
||||
'DEBUG parsed updated_at: ${updatedAt.toIso8601String()}',
|
||||
);
|
||||
return CountdownTimerWidget(
|
||||
updatedAt: updatedAt,
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('ERROR parsing updated_at: $e');
|
||||
return Text(
|
||||
'Format tanggal salah',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 12,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
return SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -1856,32 +1882,46 @@ class CountdownTimerWidget extends StatefulWidget {
|
||||
class _CountdownTimerWidgetState extends State<CountdownTimerWidget> {
|
||||
late Duration remaining;
|
||||
Timer? timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
debugPrint(
|
||||
'CountdownTimerWidget initialized with updatedAt: ${widget.updatedAt}',
|
||||
);
|
||||
updateRemaining();
|
||||
timer = Timer.periodic(
|
||||
const Duration(seconds: 1),
|
||||
(_) => updateRemaining(),
|
||||
);
|
||||
print('DEBUG updated_at: ${widget.updatedAt}');
|
||||
}
|
||||
|
||||
void updateRemaining() {
|
||||
final now = DateTime.now();
|
||||
final deadline = widget.updatedAt.add(const Duration(hours: 1));
|
||||
|
||||
debugPrint('Current time: $now');
|
||||
debugPrint('Deadline: $deadline');
|
||||
|
||||
setState(() {
|
||||
remaining = deadline.difference(now);
|
||||
debugPrint('Remaining time: ${remaining.inSeconds} seconds');
|
||||
|
||||
if (remaining.isNegative) {
|
||||
debugPrint('Countdown expired, setting to zero');
|
||||
remaining = Duration.zero;
|
||||
timer?.cancel();
|
||||
if (widget.onTimeout != null) {
|
||||
debugPrint('Calling onTimeout callback');
|
||||
widget.onTimeout?.call();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
debugPrint('CountdownTimerWidget disposed');
|
||||
timer?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
@ -1891,9 +1931,15 @@ class _CountdownTimerWidgetState extends State<CountdownTimerWidget> {
|
||||
if (remaining.inSeconds <= 0) {
|
||||
return Text('Waktu habis', style: TextStyle(color: Colors.red));
|
||||
}
|
||||
|
||||
final h = remaining.inHours;
|
||||
final m = remaining.inMinutes % 60;
|
||||
final s = remaining.inSeconds % 60;
|
||||
|
||||
final timeString =
|
||||
'${h.toString().padLeft(2, '0')}:${m.toString().padLeft(2, '0')}:${s.toString().padLeft(2, '0')}';
|
||||
debugPrint('Rendering countdown: $timeString');
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
@ -1907,7 +1953,7 @@ class _CountdownTimerWidgetState extends State<CountdownTimerWidget> {
|
||||
Icon(Icons.timer_outlined, size: 14, color: Colors.red),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Bayar dalam ${h.toString().padLeft(2, '0')}:${m.toString().padLeft(2, '0')}:${s.toString().padLeft(2, '0')}',
|
||||
'Bayar dalam $timeString',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
@ -41,7 +41,7 @@ class NavigationService extends GetxService {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'ID aset tidak valid',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -63,7 +63,7 @@ class NavigationService extends GetxService {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'ID sewa tidak valid',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -87,7 +87,7 @@ class NavigationService extends GetxService {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'ID paket tidak valid',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
@ -133,7 +133,7 @@ class NavigationService extends GetxService {
|
||||
void toProfile() {
|
||||
debugPrint('🧭 Navigating to Profile');
|
||||
setNavIndex(2); // Profile tab
|
||||
Get.offNamed(Routes.PROFILE);
|
||||
Get.offAllNamed(Routes.PROFILE);
|
||||
}
|
||||
|
||||
/// Navigasi ke dashboard sesuai role
|
||||
|
@ -48,10 +48,6 @@ void main() async {
|
||||
debugPrint('❌ Error initializing auth provider: $e');
|
||||
}
|
||||
|
||||
// Pre-register the dashboard controller to fix dependency issues
|
||||
Get.put(PetugasBumdesDashboardController(), permanent: true);
|
||||
debugPrint('✅ PetugasBumdesDashboardController initialized globally');
|
||||
|
||||
// Register services yang akan digunakan secara global
|
||||
ServiceManager.registerServices();
|
||||
|
||||
|
@ -1,68 +1,68 @@
|
||||
{
|
||||
"images" : [
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"size" : "16x16",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_16.png",
|
||||
"scale" : "1x"
|
||||
"size": "16x16",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_16.png",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"size" : "16x16",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_32.png",
|
||||
"scale" : "2x"
|
||||
"size": "16x16",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_32.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size" : "32x32",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_32.png",
|
||||
"scale" : "1x"
|
||||
"size": "32x32",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_32.png",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"size" : "32x32",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_64.png",
|
||||
"scale" : "2x"
|
||||
"size": "32x32",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_64.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size" : "128x128",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_128.png",
|
||||
"scale" : "1x"
|
||||
"size": "128x128",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_128.png",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"size" : "128x128",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_256.png",
|
||||
"scale" : "2x"
|
||||
"size": "128x128",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_256.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size" : "256x256",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_256.png",
|
||||
"scale" : "1x"
|
||||
"size": "256x256",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_256.png",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"size" : "256x256",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_512.png",
|
||||
"scale" : "2x"
|
||||
"size": "256x256",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_512.png",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_512.png",
|
||||
"scale" : "1x"
|
||||
"size": "512x512",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_512.png",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_1024.png",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"size": "512x512",
|
||||
"idiom": "mac",
|
||||
"filename": "app_icon_1024.png",
|
||||
"scale": "2x"
|
||||
}
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 181 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.8 KiB |
48
pubspec.lock
@ -33,6 +33,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.7"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -97,6 +105,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
checked_yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: checked_yaml
|
||||
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.2"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -270,6 +294,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.5"
|
||||
flutter_launcher_icons:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_launcher_icons
|
||||
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.1"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@ -509,6 +541,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.7"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
jwt_decode:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1146,6 +1186,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.5.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
yet_another_json_isolate:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
22
pubspec.yaml
@ -72,6 +72,28 @@ dev_dependencies:
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^5.0.0
|
||||
|
||||
# App icon generation tool
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
|
||||
# App icon configuration
|
||||
flutter_launcher_icons:
|
||||
android: "launcher_icon"
|
||||
ios: true
|
||||
image_path: "assets/images/logo_app.png"
|
||||
min_sdk_android: 21 # android min sdk min:16, default 21
|
||||
web:
|
||||
generate: true
|
||||
image_path: "assets/images/logo_app.png"
|
||||
background_color: "#ffffff"
|
||||
theme_color: "#ffffff"
|
||||
windows:
|
||||
generate: true
|
||||
image_path: "assets/images/logo_app.png"
|
||||
icon_size: 48 # min:48, max:256, default: 48
|
||||
macos:
|
||||
generate: true
|
||||
image_path: "assets/images/logo_app.png"
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
|
BIN
web/favicon.png
Before Width: | Height: | Size: 917 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 67 KiB |
@ -3,8 +3,8 @@
|
||||
"short_name": "bumrent_app",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#0175C2",
|
||||
"theme_color": "#0175C2",
|
||||
"background_color": "#ffffff",
|
||||
"theme_color": "#ffffff",
|
||||
"description": "A new Flutter project.",
|
||||
"orientation": "portrait-primary",
|
||||
"prefer_related_applications": false,
|
||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 1.9 KiB |