feat : sale in the province edit and delete

This commit is contained in:
MrM
2025-06-27 19:13:06 +03:30
parent 751d48c02e
commit 7bb19a7ffc
4 changed files with 226 additions and 63 deletions

View File

@@ -1,3 +1,4 @@
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
@@ -81,6 +82,19 @@ abstract class ChickenRepository {
required SubmitStewardAllocation request,
});
Future<void> deleteStewardAllocation({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> updateStewardAllocation({
required String token,
required ConformAllocation request,
});
Future<StewardFreeBarDashboard?> getStewardDashboard({
required String token,
required String stratDate,

View File

@@ -1,3 +1,4 @@
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart';
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
@@ -112,11 +113,11 @@ class ChickenRepositoryImpl implements ChickenRepository {
}) async {
var res = await _httpClient.get(
'/steward-allocation/',
queryParameters:queryParameters,
queryParameters: queryParameters,
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) => PaginationModel<AllocatedMadeModel>.fromJson(
json,
(json) => AllocatedMadeModel.fromJson(json as Map<String, dynamic>),
(json) => AllocatedMadeModel.fromJson(json as Map<String, dynamic>),
),
);
return res.data;
@@ -207,6 +208,30 @@ class ChickenRepositoryImpl implements ChickenRepository {
);
}
@override
Future<void> deleteStewardAllocation({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
await _httpClient.delete(
'/steward-allocation/0/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
);
}
@override
Future<void> updateStewardAllocation({
required String token,
required ConformAllocation request,
}) async {
await _httpClient.put(
'/steward-allocation/0/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: request.toJson(),
);
}
@override
Future<StewardFreeBarDashboard?> getStewardDashboard({
required String token,