fixed issues
This commit is contained in:
parent
9dd66bd297
commit
4d47ee3002
@ -504,11 +504,6 @@ class ApiService {
|
||||
}
|
||||
|
||||
/// Get details of a single service project
|
||||
/// Get details of a single service project
|
||||
static Future<ServiceProjectDetailModel?> getServiceProjectDetailApi(
|
||||
String projectId) async {
|
||||
final endpoint = "${ApiEndpoints.getServiceProjectDetail}/$projectId";
|
||||
logSafe("Fetching details for Service Project ID: $projectId");
|
||||
static Future<ServiceProjectDetailModel?> 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;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ class _EmployeeDetailPageState extends State<EmployeeDetailPage> 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(
|
||||
|
||||
@ -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(() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user