diff --git a/lib/helpers/services/api_service.dart b/lib/helpers/services/api_service.dart index 9b8e2b0..968ad90 100644 --- a/lib/helpers/services/api_service.dart +++ b/lib/helpers/services/api_service.dart @@ -319,7 +319,7 @@ class ApiService { try { // PATCH request is usually similar to PUT, but with http.patch String? token = await _getToken(); - if (token == null) return false; + if (token == null) return false; final uri = Uri.parse("${ApiEndpoints.baseUrl}$endpoint"); @@ -504,11 +504,6 @@ class ApiService { } /// Get details of a single service project - /// Get details of a single service project - static Future getServiceProjectDetailApi( - String projectId) async { - final endpoint = "${ApiEndpoints.getServiceProjectDetail}/$projectId"; - logSafe("Fetching details for Service Project ID: $projectId"); static Future getServiceProjectDetailApi( String projectId) async { final endpoint = "${ApiEndpoints.getServiceProjectDetail}/$projectId"; @@ -524,11 +519,6 @@ class ApiService { ); return null; } - if (response == null) { - logSafe("Service Project Detail request failed: null response", - level: LogLevel.error); - return null; - } final jsonResponse = _parseResponseForAllData( response, @@ -548,14 +538,6 @@ class ApiService { level: LogLevel.debug, ); } - if (jsonResponse != null) { - return ServiceProjectDetailModel.fromJson(jsonResponse); - } - } catch (e, stack) { - logSafe("Exception during getServiceProjectDetailApi: $e", - level: LogLevel.error); - logSafe("StackTrace: $stack", level: LogLevel.debug); - } return null; } @@ -2821,7 +2803,7 @@ class ApiService { return false; } - + static Future?> getDirectoryComments( String contactId, { bool active = true, diff --git a/lib/view/employees/employee_detail_screen.dart b/lib/view/employees/employee_detail_screen.dart index 16af71e..3177f8c 100644 --- a/lib/view/employees/employee_detail_screen.dart +++ b/lib/view/employees/employee_detail_screen.dart @@ -179,7 +179,7 @@ class _EmployeeDetailPageState extends State with UIMixin { final employee = controller.selectedEmployeeDetails.value; if (employee == null) { - return const Center(child: MyText("No employee details found.")); + return Center(child: MyText("No employee details found.")); } return SafeArea( diff --git a/lib/view/service_project/service_project_details_screen.dart b/lib/view/service_project/service_project_details_screen.dart index 33f6311..7c1b7a7 100644 --- a/lib/view/service_project/service_project_details_screen.dart +++ b/lib/view/service_project/service_project_details_screen.dart @@ -315,154 +315,7 @@ class _ServiceProjectDetailsScreenState ); } - Widget _buildJobsTab() { - return Obx(() { - if (controller.isJobLoading.value && controller.jobList.isEmpty) { - return const Center(child: CircularProgressIndicator()); - } - if (controller.jobErrorMessage.value.isNotEmpty && - controller.jobList.isEmpty) { - return Center( - child: MyText.bodyMedium(controller.jobErrorMessage.value)); - } - - if (controller.jobList.isEmpty) { - return Center(child: MyText.bodyMedium("No jobs found")); - } - - return ListView.separated( - controller: _jobScrollController, - padding: const EdgeInsets.fromLTRB(12, 12, 12, 80), - itemCount: controller.jobList.length + 1, - separatorBuilder: (_, __) => const SizedBox(height: 12), - itemBuilder: (context, index) { - if (index == controller.jobList.length) { - return controller.hasMoreJobs.value - ? const Padding( - padding: EdgeInsets.symmetric(vertical: 16), - child: Center(child: CircularProgressIndicator()), - ) - : const SizedBox.shrink(); - } - - final job = controller.jobList[index]; - return Card( - elevation: 3, - shadowColor: Colors.black26, - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Job Title - MyText.titleMedium(job.title, fontWeight: 700), - MySpacing.height(6), - - // Job Description - MyText.bodySmall( - job.description.isNotEmpty - ? job.description - : "No description provided", - color: Colors.grey[700], - ), - - // Tags - if (job.tags != null && job.tags!.isNotEmpty) - Padding( - padding: const EdgeInsets.only(top: 2), - child: Wrap( - spacing: 2, - runSpacing: 4, - children: job.tags!.map((tag) { - return Chip( - label: Text( - tag.name, - style: const TextStyle(fontSize: 12), - ), - backgroundColor: Colors.grey[200], - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), - ), - ); - }).toList(), - ), - ), - - MySpacing.height(8), - - // Assignees & Status - Row( - children: [ - if (job.assignees != null && job.assignees!.isNotEmpty) - ...job.assignees!.map((assignee) { - return Padding( - padding: const EdgeInsets.only(right: 6), - child: CircleAvatar( - radius: 12, - backgroundImage: assignee.photo.isNotEmpty - ? NetworkImage(assignee.photo) - : null, - child: assignee.photo.isEmpty - ? Text(assignee.firstName[0]) - : null, - ), - ); - }).toList(), - ], - ), - - MySpacing.height(8), - - // Date Row with Status Chip - Row( - children: [ - // Dates (same as existing) - const Icon(Icons.calendar_today_outlined, - size: 14, color: Colors.grey), - MySpacing.width(4), - Text( - "${DateTimeUtils.convertUtcToLocal(job.startDate, format: 'dd MMM yyyy')} to " - "${DateTimeUtils.convertUtcToLocal(job.dueDate, format: 'dd MMM yyyy')}", - style: - const TextStyle(fontSize: 12, color: Colors.grey), - ), - - const Spacer(), - - // Status Chip - Container( - padding: const EdgeInsets.symmetric( - horizontal: 8, vertical: 4), - decoration: BoxDecoration( - color: job.status.name.toLowerCase() == 'completed' - ? Colors.green[100] - : Colors.orange[100], - borderRadius: BorderRadius.circular(5), - ), - child: Text( - job.status.displayName, - style: TextStyle( - fontSize: 12, - color: job.status.name.toLowerCase() == 'completed' - ? Colors.green[800] - : Colors.orange[800], - fontWeight: FontWeight.w600, - ), - ), - ), - ], - ), - ], - ), - ), - ); - }, - ); - }); - } Widget _buildJobsTab() { return Obx(() {