feat: scope filterable fields to agent type and update active filters on selection change

This commit is contained in:
pradeepkumar
2026-04-16 22:32:31 +05:30
parent 436f8fac42
commit 8dafe73425
2 changed files with 32 additions and 3 deletions

View File

@@ -89,10 +89,16 @@ class AgentsRepository {
}
/// Get filterable profile fields: GET /profile-fields/filterable
/// When `agentTypeId` is provided, backend scopes filters to that agent type + globals.
/// Response: { success, data: [...] }
Future<List<FilterableField>> getFilterableFields() async {
Future<List<FilterableField>> getFilterableFields({String? agentTypeId}) async {
try {
final response = await _dio.get(ApiConstants.filterableFields);
final response = await _dio.get(
ApiConstants.filterableFields,
queryParameters: agentTypeId != null && agentTypeId.isNotEmpty
? {'agentTypeId': agentTypeId}
: null,
);
final data = response.data['data'] as List<dynamic>;
return data
.map((e) => FilterableField.fromJson(e as Map<String, dynamic>))