ae08b946f6
- Updated TendersRepository and TendersService to support cursor-based pagination. - Modified TendersViewModel to manage pagination state and handle API responses more effectively. - Replaced existing pagination UI components with a new WindowedPagination widget across desktop, mobile, and tablet views. - Improved notification handling in the UI to reflect the presence of notifications dynamically. - Adjusted main tenders slider to ensure proper rendering based on the current page index.
54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import 'package:tm_app/core/utils/logger.dart';
|
|
|
|
class TendersApi {
|
|
static const String tenders = '/api/v1/tenders';
|
|
static String getTenders({
|
|
required int limit,
|
|
int? offset,
|
|
String? cursor,
|
|
String? query,
|
|
String? sortBy,
|
|
String? sortOrder,
|
|
String? publicationDateFrom,
|
|
String? publicationDateTo,
|
|
}) {
|
|
String url = '$tenders?limit=$limit';
|
|
if (cursor != null && cursor.isNotEmpty) {
|
|
url += '&cursor=${Uri.encodeComponent(cursor)}';
|
|
} else if (offset != null) {
|
|
url += '&offset=$offset';
|
|
}
|
|
if (query != null && query.isNotEmpty) {
|
|
url += '&q=${Uri.encodeComponent(query)}';
|
|
}
|
|
if (sortBy != null && sortBy.isNotEmpty) {
|
|
url += '&sort_by=$sortBy';
|
|
}
|
|
if (sortOrder != null && sortOrder.isNotEmpty) {
|
|
url += '&sort_order=$sortOrder';
|
|
}
|
|
if (publicationDateFrom != null && publicationDateFrom.isNotEmpty) {
|
|
url += '&publication_date_from=$publicationDateFrom';
|
|
}
|
|
if (publicationDateTo != null && publicationDateTo.isNotEmpty) {
|
|
url += '&publication_date_to=$publicationDateTo';
|
|
}
|
|
AppLogger().logWarning('🔍 Tenders API: $url');
|
|
return url;
|
|
}
|
|
|
|
static const String feedbackTender = '/api/v1/feedback/tender';
|
|
static String getFeedbackForTender({required String tenderId}) {
|
|
return '$feedbackTender/$tenderId';
|
|
}
|
|
|
|
static const String feedback = '/api/v1/feedback';
|
|
|
|
static const String tenderApprovals = '/api/v1/tender-approvals';
|
|
|
|
static const String tenderApprovalsTender = '/api/v1/tender-approvals/tender';
|
|
static String getTenderApprovalById({required String tenderId}) {
|
|
return '$tenderApprovalsTender/$tenderId';
|
|
}
|
|
}
|