fixed issues

This commit is contained in:
Vaibhav Surve 2025-12-12 17:29:03 +05:30
parent fc099cccb5
commit 0fa5a85d79
10 changed files with 41 additions and 23 deletions

View File

@ -228,6 +228,7 @@ class DashboardController extends GetxController {
fetchMasterData(), fetchMasterData(),
fetchCollectionOverview(), fetchCollectionOverview(),
fetchPurchaseInvoiceOverview(), fetchPurchaseInvoiceOverview(),
fetchTodaysAttendance(projectId),
]); ]);
} }

View File

@ -1,9 +1,9 @@
class ApiEndpoints { class ApiEndpoints {
static const String baseUrl = "https://stageapi.marcoaiot.com/api"; // static const String baseUrl = "https://stageapi.marcoaiot.com/api";
// static const String baseUrl = "https://api.marcoaiot.com/api"; // static const String baseUrl = "https://api.marcoaiot.com/api";
// static const String baseUrl = "https://devapi.marcoaiot.com/api"; // static const String baseUrl = "https://devapi.marcoaiot.com/api";
// static const String baseUrl = "https://mapi.marcoaiot.com/api"; // static const String baseUrl = "https://mapi.marcoaiot.com/api";
// static const String baseUrl = "https://api.onfieldwork.com/api"; static const String baseUrl = "https://api.onfieldwork.com/api";
static const String getMasterCurrencies = "/Master/currencies/list"; static const String getMasterCurrencies = "/Master/currencies/list";

View File

@ -114,6 +114,12 @@ class ApiService {
level: LogLevel.debug); level: LogLevel.debug);
if (body.isEmpty) { if (body.isEmpty) {
if (response.statusCode == 204) {
_log("Successful operation with 204 No Content for [$label]");
return returnFullResponse
? {'success': true, 'message': 'No Content'}
: null;
}
_log("Empty response body for [$label]"); _log("Empty response body for [$label]");
return null; return null;
} }
@ -127,8 +133,10 @@ class ApiService {
return null; return null;
} }
// Handle non-200 or failure scenarios // Define success status codes: 200 OK, 201 Created.
if (response.statusCode != 200 || const successCodes = [200, 201];
// Handle non-success scenarios
if (!successCodes.contains(response.statusCode) ||
decryptedJson is! Map || decryptedJson is! Map ||
decryptedJson['success'] != true) { decryptedJson['success'] != true) {
final message = decryptedJson is Map final message = decryptedJson is Map

View File

@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:on_field_work/controller/project_controller.dart';
import 'package:on_field_work/helpers/services/auth_service.dart'; import 'package:on_field_work/helpers/services/auth_service.dart';
import 'package:on_field_work/helpers/services/localizations/language.dart'; import 'package:on_field_work/helpers/services/localizations/language.dart';
import 'package:on_field_work/helpers/theme/theme_customizer.dart'; import 'package:on_field_work/helpers/theme/theme_customizer.dart';
@ -139,6 +138,7 @@ class LocalStorage {
print("Logout API error: $e"); print("Logout API error: $e");
} }
// Remove all stored values
await removeLoggedInUser(); await removeLoggedInUser();
await removeToken(_jwtTokenKey); await removeToken(_jwtTokenKey);
await removeToken(_refreshTokenKey); await removeToken(_refreshTokenKey);
@ -153,10 +153,9 @@ class LocalStorage {
await preferences.remove(_themeCustomizerKey); await preferences.remove(_themeCustomizerKey);
await preferences.remove('selectedProjectId'); await preferences.remove('selectedProjectId');
if (Get.isRegistered<ProjectController>()) { // Clear all GetX controllers
Get.find<ProjectController>().clearProjects(); Get.deleteAll(force: true);
} // Navigate to login
Get.offAllNamed('/auth/login-option'); Get.offAllNamed('/auth/login-option');
} }

View File

@ -18,7 +18,12 @@ class ThemeOption {
final List<ThemeOption> themeOptions = [ final List<ThemeOption> themeOptions = [
ThemeOption( ThemeOption(
"Theme 1", Colors.red, Colors.red, Colors.red, ColorThemeType.red), "Theme 1",
const Color(0xFFC92226),
const Color(0xFFC92226),
const Color(0xFFC92226),
ColorThemeType.red,
),
ThemeOption( ThemeOption(
"Theme 2", "Theme 2",
const Color(0xFF49BF3C), const Color(0xFF49BF3C),

View File

@ -1068,8 +1068,10 @@ static Widget _buildDetailRowSkeleton({
} }
static Widget documentSkeletonLoader() { static Widget documentSkeletonLoader() {
return Column( return ListView.builder(
children: List.generate(5, (index) { padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 0),
itemCount: 5,
itemBuilder: (context, index) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -1160,7 +1162,7 @@ static Widget _buildDetailRowSkeleton({
), ),
], ],
); );
}), },
); );
} }

View File

@ -35,11 +35,13 @@ class _UserDocumentFilterBottomSheetState
if (filterData == null) return const SizedBox.shrink(); if (filterData == null) return const SizedBox.shrink();
final hasFilters = [ final hasFilters = [
filterData.uploadedBy, filterData.uploadedBy,
filterData.documentCategory, filterData.documentCategory,
filterData.documentType, filterData.documentType,
filterData.documentTag, filterData.documentTag,
].any((list) => list.isNotEmpty); ].any((list) => list.isNotEmpty) ||
docController.startDate.value != null ||
docController.endDate.value != null;
return BaseBottomSheet( return BaseBottomSheet(
title: 'Filter Documents', title: 'Filter Documents',
@ -53,8 +55,8 @@ class _UserDocumentFilterBottomSheetState
'documentTypeIds': docController.selectedType.toList(), 'documentTypeIds': docController.selectedType.toList(),
'documentTagIds': docController.selectedTag.toList(), 'documentTagIds': docController.selectedTag.toList(),
'isUploadedAt': docController.isUploadedAt.value, 'isUploadedAt': docController.isUploadedAt.value,
'startDate': docController.startDate.value, 'startDate': docController.startDate.value?.toIso8601String(),
'endDate': docController.endDate.value, 'endDate': docController.endDate.value?.toIso8601String(),
if (docController.isVerified.value != null) if (docController.isVerified.value != null)
'isVerified': docController.isVerified.value, 'isVerified': docController.isVerified.value,
}; };

View File

@ -41,7 +41,7 @@ class ReimbursementBottomSheet extends StatefulWidget {
class _ReimbursementBottomSheetState extends State<ReimbursementBottomSheet> { class _ReimbursementBottomSheetState extends State<ReimbursementBottomSheet> {
final ExpenseDetailController controller = final ExpenseDetailController controller =
Get.find<ExpenseDetailController>(); Get.put(ExpenseDetailController());
final TextEditingController commentCtrl = TextEditingController(); final TextEditingController commentCtrl = TextEditingController();
final TextEditingController txnCtrl = TextEditingController(); final TextEditingController txnCtrl = TextEditingController();

View File

@ -526,6 +526,7 @@ class _EmployeeDetailPageState extends State<EmployeeDetailPage> with UIMixin {
label: MyText( label: MyText(
'Assign to Project', 'Assign to Project',
fontSize: 14, fontSize: 14,
color: Colors.white,
fontWeight: 500, fontWeight: 500,
), ),
); );

View File

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+19 version: 1.0.1+20
environment: environment:
sdk: ^3.5.3 sdk: ^3.5.3