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(),
fetchCollectionOverview(),
fetchPurchaseInvoiceOverview(),
fetchTodaysAttendance(projectId),
]);
}

View File

@ -1,9 +1,9 @@
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://devapi.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";

View File

@ -114,6 +114,12 @@ class ApiService {
level: LogLevel.debug);
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]");
return null;
}
@ -127,8 +133,10 @@ class ApiService {
return null;
}
// Handle non-200 or failure scenarios
if (response.statusCode != 200 ||
// Define success status codes: 200 OK, 201 Created.
const successCodes = [200, 201];
// Handle non-success scenarios
if (!successCodes.contains(response.statusCode) ||
decryptedJson is! Map ||
decryptedJson['success'] != true) {
final message = decryptedJson is Map

View File

@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:get/get.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/localizations/language.dart';
import 'package:on_field_work/helpers/theme/theme_customizer.dart';
@ -139,6 +138,7 @@ class LocalStorage {
print("Logout API error: $e");
}
// Remove all stored values
await removeLoggedInUser();
await removeToken(_jwtTokenKey);
await removeToken(_refreshTokenKey);
@ -147,16 +147,15 @@ class LocalStorage {
await removeMpinToken();
await removeIsMpin();
await removeMenus();
await removeRecentTenantId();
await removeRecentTenantId();
await preferences.remove("mpin_verified");
await preferences.remove(_languageKey);
await preferences.remove(_themeCustomizerKey);
await preferences.remove('selectedProjectId');
if (Get.isRegistered<ProjectController>()) {
Get.find<ProjectController>().clearProjects();
}
// Clear all GetX controllers
Get.deleteAll(force: true);
// Navigate to login
Get.offAllNamed('/auth/login-option');
}

View File

@ -18,7 +18,12 @@ class ThemeOption {
final List<ThemeOption> themeOptions = [
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(
"Theme 2",
const Color(0xFF49BF3C),

View File

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

View File

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

View File

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

View File

@ -526,6 +526,7 @@ class _EmployeeDetailPageState extends State<EmployeeDetailPage> with UIMixin {
label: MyText(
'Assign to Project',
fontSize: 14,
color: Colors.white,
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
# 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.
version: 1.0.0+19
version: 1.0.1+20
environment:
sdk: ^3.5.3