Added getStates in home
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:tm_app/data/services/model/home/home_request/home_request_model.
|
|||||||
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
||||||
import 'package:tm_app/data/services/model/recommended_tenders_response/recommended_tenders_response.dart';
|
import 'package:tm_app/data/services/model/recommended_tenders_response/recommended_tenders_response.dart';
|
||||||
import 'package:tm_app/data/services/model/tender_approvals_response/tender_approvals_response.dart';
|
import 'package:tm_app/data/services/model/tender_approvals_response/tender_approvals_response.dart';
|
||||||
|
import 'package:tm_app/data/services/model/tender_approvals_state_response/tender_approvals_state_response.dart';
|
||||||
|
|
||||||
class HomeRepository {
|
class HomeRepository {
|
||||||
HomeRepository({required HomeService homeService})
|
HomeRepository({required HomeService homeService})
|
||||||
@@ -24,5 +25,8 @@ class HomeRepository {
|
|||||||
}
|
}
|
||||||
Future<Result<TenderApprovalsResponse>> getYourTenders() {
|
Future<Result<TenderApprovalsResponse>> getYourTenders() {
|
||||||
return _homeService.getYourTenders();
|
return _homeService.getYourTenders();
|
||||||
|
}
|
||||||
|
Future<Result<TenderApprovalsStateResponse>> getTendersApprovalsState() {
|
||||||
|
return _homeService.getTendersApprovalsState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ import 'package:tm_app/data/services/model/home/home_request/home_request_model.
|
|||||||
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
||||||
import 'package:tm_app/data/services/model/recommended_tenders_response/recommended_tenders_response.dart';
|
import 'package:tm_app/data/services/model/recommended_tenders_response/recommended_tenders_response.dart';
|
||||||
import 'package:tm_app/data/services/model/tender_approvals_response/tender_approvals_response.dart';
|
import 'package:tm_app/data/services/model/tender_approvals_response/tender_approvals_response.dart';
|
||||||
|
import 'package:tm_app/data/services/model/tender_approvals_state_response/tender_approvals_state_response.dart';
|
||||||
|
|
||||||
import '../../core/network/network_manager.dart';
|
import '../../core/network/network_manager.dart';
|
||||||
|
|
||||||
class HomeService {
|
class HomeService {
|
||||||
HomeService({required NetworkManager networkManager})
|
HomeService({required NetworkManager networkManager})
|
||||||
: _networkManager = networkManager;
|
: _networkManager = networkManager;
|
||||||
final NetworkManager _networkManager;
|
final NetworkManager _networkManager;
|
||||||
|
|
||||||
Future<Result<HomeResponseModel>> getHome({
|
Future<Result<HomeResponseModel>> getHome({
|
||||||
@@ -51,21 +52,25 @@ class HomeService {
|
|||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
Future<Result<TenderApprovalsResponse>> getYourTenders() async {
|
|
||||||
try {
|
|
||||||
final result = await _networkManager.makeRequest(
|
|
||||||
'/api/v1/tender-approvals',
|
|
||||||
(json) => TenderApprovalsResponse.fromJson(json),
|
|
||||||
method: 'GET',
|
|
||||||
);
|
|
||||||
|
|
||||||
return result;
|
Future<Result<TenderApprovalsResponse>> getYourTenders() async {
|
||||||
} on DioException catch (e) {
|
final result = await _networkManager.makeRequest(
|
||||||
appLogger.error('get approved tenders failed: $e');
|
'/api/v1/tender-approvals',
|
||||||
return Result.error(e);
|
(json) => TenderApprovalsResponse.fromJson(json),
|
||||||
} on Exception catch (e, stackTrace) {
|
method: 'GET',
|
||||||
appLogger.error('get approved tenders failed: $e', stackTrace: stackTrace);
|
);
|
||||||
return Result.error(Exception(e));
|
|
||||||
}
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Result<TenderApprovalsStateResponse>>
|
||||||
|
getTendersApprovalsState() async {
|
||||||
|
final result = await _networkManager.makeRequest(
|
||||||
|
'/api/v1/tender-approvals/stats',
|
||||||
|
(json) => TenderApprovalsStateResponse.fromJson(json),
|
||||||
|
method: 'GET',
|
||||||
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// ignore_for_file: invalid_annotation_target
|
||||||
|
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'tender_approvals_state_data.freezed.dart';
|
||||||
|
part 'tender_approvals_state_data.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class TenderApprovalsStateData with _$TenderApprovalsStateData {
|
||||||
|
@JsonSerializable(explicitToJson: true)
|
||||||
|
const factory TenderApprovalsStateData({
|
||||||
|
@JsonKey(name: 'company_id') required String? companyId,
|
||||||
|
@JsonKey(name: 'total_approvals') required int? totalApprovals,
|
||||||
|
@JsonKey(name: 'approved_tenders') required int? approvedTenders,
|
||||||
|
@JsonKey(name: 'rejected_tenders') required int? rejectedTenders,
|
||||||
|
@JsonKey(name: 'self_apply_count') required int? selfApplyCount,
|
||||||
|
@JsonKey(name: 'partnership_count') required int? partnershipCount,
|
||||||
|
@JsonKey(name: 'approvals_by_status') required ApprovalsByStatus? approvalsByStatus,
|
||||||
|
@JsonKey(name: 'approvals_by_submission') required ApprovalsBySubmission? approvalsBySubmission,
|
||||||
|
@JsonKey(name: 'last_updated') required int? lastUpdated,
|
||||||
|
}) = _TenderApprovalsStateData;
|
||||||
|
|
||||||
|
factory TenderApprovalsStateData.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$TenderApprovalsStateDataFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class ApprovalsByStatus with _$ApprovalsByStatus {
|
||||||
|
const factory ApprovalsByStatus({
|
||||||
|
@JsonKey(name: 'approved') required int? approved,
|
||||||
|
@JsonKey(name: 'rejected') required int? rejected,
|
||||||
|
}) = _ApprovalsByStatus;
|
||||||
|
|
||||||
|
factory ApprovalsByStatus.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ApprovalsByStatusFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class ApprovalsBySubmission with _$ApprovalsBySubmission {
|
||||||
|
const factory ApprovalsBySubmission({
|
||||||
|
@JsonKey(name: 'partnership') required int? partnership,
|
||||||
|
@JsonKey(name: 'self-apply') required int? selfApply,
|
||||||
|
}) = _ApprovalsBySubmission;
|
||||||
|
|
||||||
|
factory ApprovalsBySubmission.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ApprovalsBySubmissionFromJson(json);
|
||||||
|
}
|
||||||
+881
@@ -0,0 +1,881 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'tender_approvals_state_data.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$TenderApprovalsStateData {
|
||||||
|
|
||||||
|
@JsonKey(name: 'company_id') String? get companyId;@JsonKey(name: 'total_approvals') int? get totalApprovals;@JsonKey(name: 'approved_tenders') int? get approvedTenders;@JsonKey(name: 'rejected_tenders') int? get rejectedTenders;@JsonKey(name: 'self_apply_count') int? get selfApplyCount;@JsonKey(name: 'partnership_count') int? get partnershipCount;@JsonKey(name: 'approvals_by_status') ApprovalsByStatus? get approvalsByStatus;@JsonKey(name: 'approvals_by_submission') ApprovalsBySubmission? get approvalsBySubmission;@JsonKey(name: 'last_updated') int? get lastUpdated;
|
||||||
|
/// Create a copy of TenderApprovalsStateData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$TenderApprovalsStateDataCopyWith<TenderApprovalsStateData> get copyWith => _$TenderApprovalsStateDataCopyWithImpl<TenderApprovalsStateData>(this as TenderApprovalsStateData, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this TenderApprovalsStateData to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is TenderApprovalsStateData&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.totalApprovals, totalApprovals) || other.totalApprovals == totalApprovals)&&(identical(other.approvedTenders, approvedTenders) || other.approvedTenders == approvedTenders)&&(identical(other.rejectedTenders, rejectedTenders) || other.rejectedTenders == rejectedTenders)&&(identical(other.selfApplyCount, selfApplyCount) || other.selfApplyCount == selfApplyCount)&&(identical(other.partnershipCount, partnershipCount) || other.partnershipCount == partnershipCount)&&(identical(other.approvalsByStatus, approvalsByStatus) || other.approvalsByStatus == approvalsByStatus)&&(identical(other.approvalsBySubmission, approvalsBySubmission) || other.approvalsBySubmission == approvalsBySubmission)&&(identical(other.lastUpdated, lastUpdated) || other.lastUpdated == lastUpdated));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,companyId,totalApprovals,approvedTenders,rejectedTenders,selfApplyCount,partnershipCount,approvalsByStatus,approvalsBySubmission,lastUpdated);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'TenderApprovalsStateData(companyId: $companyId, totalApprovals: $totalApprovals, approvedTenders: $approvedTenders, rejectedTenders: $rejectedTenders, selfApplyCount: $selfApplyCount, partnershipCount: $partnershipCount, approvalsByStatus: $approvalsByStatus, approvalsBySubmission: $approvalsBySubmission, lastUpdated: $lastUpdated)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $TenderApprovalsStateDataCopyWith<$Res> {
|
||||||
|
factory $TenderApprovalsStateDataCopyWith(TenderApprovalsStateData value, $Res Function(TenderApprovalsStateData) _then) = _$TenderApprovalsStateDataCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'company_id') String? companyId,@JsonKey(name: 'total_approvals') int? totalApprovals,@JsonKey(name: 'approved_tenders') int? approvedTenders,@JsonKey(name: 'rejected_tenders') int? rejectedTenders,@JsonKey(name: 'self_apply_count') int? selfApplyCount,@JsonKey(name: 'partnership_count') int? partnershipCount,@JsonKey(name: 'approvals_by_status') ApprovalsByStatus? approvalsByStatus,@JsonKey(name: 'approvals_by_submission') ApprovalsBySubmission? approvalsBySubmission,@JsonKey(name: 'last_updated') int? lastUpdated
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$ApprovalsByStatusCopyWith<$Res>? get approvalsByStatus;$ApprovalsBySubmissionCopyWith<$Res>? get approvalsBySubmission;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$TenderApprovalsStateDataCopyWithImpl<$Res>
|
||||||
|
implements $TenderApprovalsStateDataCopyWith<$Res> {
|
||||||
|
_$TenderApprovalsStateDataCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final TenderApprovalsStateData _self;
|
||||||
|
final $Res Function(TenderApprovalsStateData) _then;
|
||||||
|
|
||||||
|
/// Create a copy of TenderApprovalsStateData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? companyId = freezed,Object? totalApprovals = freezed,Object? approvedTenders = freezed,Object? rejectedTenders = freezed,Object? selfApplyCount = freezed,Object? partnershipCount = freezed,Object? approvalsByStatus = freezed,Object? approvalsBySubmission = freezed,Object? lastUpdated = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
companyId: freezed == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,totalApprovals: freezed == totalApprovals ? _self.totalApprovals : totalApprovals // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,approvedTenders: freezed == approvedTenders ? _self.approvedTenders : approvedTenders // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,rejectedTenders: freezed == rejectedTenders ? _self.rejectedTenders : rejectedTenders // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,selfApplyCount: freezed == selfApplyCount ? _self.selfApplyCount : selfApplyCount // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,partnershipCount: freezed == partnershipCount ? _self.partnershipCount : partnershipCount // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,approvalsByStatus: freezed == approvalsByStatus ? _self.approvalsByStatus : approvalsByStatus // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ApprovalsByStatus?,approvalsBySubmission: freezed == approvalsBySubmission ? _self.approvalsBySubmission : approvalsBySubmission // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ApprovalsBySubmission?,lastUpdated: freezed == lastUpdated ? _self.lastUpdated : lastUpdated // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
/// Create a copy of TenderApprovalsStateData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ApprovalsByStatusCopyWith<$Res>? get approvalsByStatus {
|
||||||
|
if (_self.approvalsByStatus == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ApprovalsByStatusCopyWith<$Res>(_self.approvalsByStatus!, (value) {
|
||||||
|
return _then(_self.copyWith(approvalsByStatus: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of TenderApprovalsStateData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ApprovalsBySubmissionCopyWith<$Res>? get approvalsBySubmission {
|
||||||
|
if (_self.approvalsBySubmission == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ApprovalsBySubmissionCopyWith<$Res>(_self.approvalsBySubmission!, (value) {
|
||||||
|
return _then(_self.copyWith(approvalsBySubmission: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [TenderApprovalsStateData].
|
||||||
|
extension TenderApprovalsStateDataPatterns on TenderApprovalsStateData {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _TenderApprovalsStateData value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateData() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _TenderApprovalsStateData value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateData():
|
||||||
|
return $default(_that);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _TenderApprovalsStateData value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateData() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@JsonKey(name: 'company_id') String? companyId, @JsonKey(name: 'total_approvals') int? totalApprovals, @JsonKey(name: 'approved_tenders') int? approvedTenders, @JsonKey(name: 'rejected_tenders') int? rejectedTenders, @JsonKey(name: 'self_apply_count') int? selfApplyCount, @JsonKey(name: 'partnership_count') int? partnershipCount, @JsonKey(name: 'approvals_by_status') ApprovalsByStatus? approvalsByStatus, @JsonKey(name: 'approvals_by_submission') ApprovalsBySubmission? approvalsBySubmission, @JsonKey(name: 'last_updated') int? lastUpdated)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateData() when $default != null:
|
||||||
|
return $default(_that.companyId,_that.totalApprovals,_that.approvedTenders,_that.rejectedTenders,_that.selfApplyCount,_that.partnershipCount,_that.approvalsByStatus,_that.approvalsBySubmission,_that.lastUpdated);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@JsonKey(name: 'company_id') String? companyId, @JsonKey(name: 'total_approvals') int? totalApprovals, @JsonKey(name: 'approved_tenders') int? approvedTenders, @JsonKey(name: 'rejected_tenders') int? rejectedTenders, @JsonKey(name: 'self_apply_count') int? selfApplyCount, @JsonKey(name: 'partnership_count') int? partnershipCount, @JsonKey(name: 'approvals_by_status') ApprovalsByStatus? approvalsByStatus, @JsonKey(name: 'approvals_by_submission') ApprovalsBySubmission? approvalsBySubmission, @JsonKey(name: 'last_updated') int? lastUpdated) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateData():
|
||||||
|
return $default(_that.companyId,_that.totalApprovals,_that.approvedTenders,_that.rejectedTenders,_that.selfApplyCount,_that.partnershipCount,_that.approvalsByStatus,_that.approvalsBySubmission,_that.lastUpdated);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@JsonKey(name: 'company_id') String? companyId, @JsonKey(name: 'total_approvals') int? totalApprovals, @JsonKey(name: 'approved_tenders') int? approvedTenders, @JsonKey(name: 'rejected_tenders') int? rejectedTenders, @JsonKey(name: 'self_apply_count') int? selfApplyCount, @JsonKey(name: 'partnership_count') int? partnershipCount, @JsonKey(name: 'approvals_by_status') ApprovalsByStatus? approvalsByStatus, @JsonKey(name: 'approvals_by_submission') ApprovalsBySubmission? approvalsBySubmission, @JsonKey(name: 'last_updated') int? lastUpdated)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateData() when $default != null:
|
||||||
|
return $default(_that.companyId,_that.totalApprovals,_that.approvedTenders,_that.rejectedTenders,_that.selfApplyCount,_that.partnershipCount,_that.approvalsByStatus,_that.approvalsBySubmission,_that.lastUpdated);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
@JsonSerializable(explicitToJson: true)
|
||||||
|
class _TenderApprovalsStateData implements TenderApprovalsStateData {
|
||||||
|
const _TenderApprovalsStateData({@JsonKey(name: 'company_id') required this.companyId, @JsonKey(name: 'total_approvals') required this.totalApprovals, @JsonKey(name: 'approved_tenders') required this.approvedTenders, @JsonKey(name: 'rejected_tenders') required this.rejectedTenders, @JsonKey(name: 'self_apply_count') required this.selfApplyCount, @JsonKey(name: 'partnership_count') required this.partnershipCount, @JsonKey(name: 'approvals_by_status') required this.approvalsByStatus, @JsonKey(name: 'approvals_by_submission') required this.approvalsBySubmission, @JsonKey(name: 'last_updated') required this.lastUpdated});
|
||||||
|
factory _TenderApprovalsStateData.fromJson(Map<String, dynamic> json) => _$TenderApprovalsStateDataFromJson(json);
|
||||||
|
|
||||||
|
@override@JsonKey(name: 'company_id') final String? companyId;
|
||||||
|
@override@JsonKey(name: 'total_approvals') final int? totalApprovals;
|
||||||
|
@override@JsonKey(name: 'approved_tenders') final int? approvedTenders;
|
||||||
|
@override@JsonKey(name: 'rejected_tenders') final int? rejectedTenders;
|
||||||
|
@override@JsonKey(name: 'self_apply_count') final int? selfApplyCount;
|
||||||
|
@override@JsonKey(name: 'partnership_count') final int? partnershipCount;
|
||||||
|
@override@JsonKey(name: 'approvals_by_status') final ApprovalsByStatus? approvalsByStatus;
|
||||||
|
@override@JsonKey(name: 'approvals_by_submission') final ApprovalsBySubmission? approvalsBySubmission;
|
||||||
|
@override@JsonKey(name: 'last_updated') final int? lastUpdated;
|
||||||
|
|
||||||
|
/// Create a copy of TenderApprovalsStateData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$TenderApprovalsStateDataCopyWith<_TenderApprovalsStateData> get copyWith => __$TenderApprovalsStateDataCopyWithImpl<_TenderApprovalsStateData>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$TenderApprovalsStateDataToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TenderApprovalsStateData&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.totalApprovals, totalApprovals) || other.totalApprovals == totalApprovals)&&(identical(other.approvedTenders, approvedTenders) || other.approvedTenders == approvedTenders)&&(identical(other.rejectedTenders, rejectedTenders) || other.rejectedTenders == rejectedTenders)&&(identical(other.selfApplyCount, selfApplyCount) || other.selfApplyCount == selfApplyCount)&&(identical(other.partnershipCount, partnershipCount) || other.partnershipCount == partnershipCount)&&(identical(other.approvalsByStatus, approvalsByStatus) || other.approvalsByStatus == approvalsByStatus)&&(identical(other.approvalsBySubmission, approvalsBySubmission) || other.approvalsBySubmission == approvalsBySubmission)&&(identical(other.lastUpdated, lastUpdated) || other.lastUpdated == lastUpdated));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,companyId,totalApprovals,approvedTenders,rejectedTenders,selfApplyCount,partnershipCount,approvalsByStatus,approvalsBySubmission,lastUpdated);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'TenderApprovalsStateData(companyId: $companyId, totalApprovals: $totalApprovals, approvedTenders: $approvedTenders, rejectedTenders: $rejectedTenders, selfApplyCount: $selfApplyCount, partnershipCount: $partnershipCount, approvalsByStatus: $approvalsByStatus, approvalsBySubmission: $approvalsBySubmission, lastUpdated: $lastUpdated)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$TenderApprovalsStateDataCopyWith<$Res> implements $TenderApprovalsStateDataCopyWith<$Res> {
|
||||||
|
factory _$TenderApprovalsStateDataCopyWith(_TenderApprovalsStateData value, $Res Function(_TenderApprovalsStateData) _then) = __$TenderApprovalsStateDataCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'company_id') String? companyId,@JsonKey(name: 'total_approvals') int? totalApprovals,@JsonKey(name: 'approved_tenders') int? approvedTenders,@JsonKey(name: 'rejected_tenders') int? rejectedTenders,@JsonKey(name: 'self_apply_count') int? selfApplyCount,@JsonKey(name: 'partnership_count') int? partnershipCount,@JsonKey(name: 'approvals_by_status') ApprovalsByStatus? approvalsByStatus,@JsonKey(name: 'approvals_by_submission') ApprovalsBySubmission? approvalsBySubmission,@JsonKey(name: 'last_updated') int? lastUpdated
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@override $ApprovalsByStatusCopyWith<$Res>? get approvalsByStatus;@override $ApprovalsBySubmissionCopyWith<$Res>? get approvalsBySubmission;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$TenderApprovalsStateDataCopyWithImpl<$Res>
|
||||||
|
implements _$TenderApprovalsStateDataCopyWith<$Res> {
|
||||||
|
__$TenderApprovalsStateDataCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _TenderApprovalsStateData _self;
|
||||||
|
final $Res Function(_TenderApprovalsStateData) _then;
|
||||||
|
|
||||||
|
/// Create a copy of TenderApprovalsStateData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? companyId = freezed,Object? totalApprovals = freezed,Object? approvedTenders = freezed,Object? rejectedTenders = freezed,Object? selfApplyCount = freezed,Object? partnershipCount = freezed,Object? approvalsByStatus = freezed,Object? approvalsBySubmission = freezed,Object? lastUpdated = freezed,}) {
|
||||||
|
return _then(_TenderApprovalsStateData(
|
||||||
|
companyId: freezed == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,totalApprovals: freezed == totalApprovals ? _self.totalApprovals : totalApprovals // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,approvedTenders: freezed == approvedTenders ? _self.approvedTenders : approvedTenders // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,rejectedTenders: freezed == rejectedTenders ? _self.rejectedTenders : rejectedTenders // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,selfApplyCount: freezed == selfApplyCount ? _self.selfApplyCount : selfApplyCount // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,partnershipCount: freezed == partnershipCount ? _self.partnershipCount : partnershipCount // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,approvalsByStatus: freezed == approvalsByStatus ? _self.approvalsByStatus : approvalsByStatus // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ApprovalsByStatus?,approvalsBySubmission: freezed == approvalsBySubmission ? _self.approvalsBySubmission : approvalsBySubmission // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ApprovalsBySubmission?,lastUpdated: freezed == lastUpdated ? _self.lastUpdated : lastUpdated // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of TenderApprovalsStateData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ApprovalsByStatusCopyWith<$Res>? get approvalsByStatus {
|
||||||
|
if (_self.approvalsByStatus == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ApprovalsByStatusCopyWith<$Res>(_self.approvalsByStatus!, (value) {
|
||||||
|
return _then(_self.copyWith(approvalsByStatus: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of TenderApprovalsStateData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ApprovalsBySubmissionCopyWith<$Res>? get approvalsBySubmission {
|
||||||
|
if (_self.approvalsBySubmission == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ApprovalsBySubmissionCopyWith<$Res>(_self.approvalsBySubmission!, (value) {
|
||||||
|
return _then(_self.copyWith(approvalsBySubmission: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ApprovalsByStatus {
|
||||||
|
|
||||||
|
@JsonKey(name: 'approved') int? get approved;@JsonKey(name: 'rejected') int? get rejected;
|
||||||
|
/// Create a copy of ApprovalsByStatus
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ApprovalsByStatusCopyWith<ApprovalsByStatus> get copyWith => _$ApprovalsByStatusCopyWithImpl<ApprovalsByStatus>(this as ApprovalsByStatus, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this ApprovalsByStatus to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is ApprovalsByStatus&&(identical(other.approved, approved) || other.approved == approved)&&(identical(other.rejected, rejected) || other.rejected == rejected));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,approved,rejected);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ApprovalsByStatus(approved: $approved, rejected: $rejected)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $ApprovalsByStatusCopyWith<$Res> {
|
||||||
|
factory $ApprovalsByStatusCopyWith(ApprovalsByStatus value, $Res Function(ApprovalsByStatus) _then) = _$ApprovalsByStatusCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'approved') int? approved,@JsonKey(name: 'rejected') int? rejected
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$ApprovalsByStatusCopyWithImpl<$Res>
|
||||||
|
implements $ApprovalsByStatusCopyWith<$Res> {
|
||||||
|
_$ApprovalsByStatusCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final ApprovalsByStatus _self;
|
||||||
|
final $Res Function(ApprovalsByStatus) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ApprovalsByStatus
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? approved = freezed,Object? rejected = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
approved: freezed == approved ? _self.approved : approved // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,rejected: freezed == rejected ? _self.rejected : rejected // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [ApprovalsByStatus].
|
||||||
|
extension ApprovalsByStatusPatterns on ApprovalsByStatus {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ApprovalsByStatus value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsByStatus() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ApprovalsByStatus value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsByStatus():
|
||||||
|
return $default(_that);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ApprovalsByStatus value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsByStatus() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@JsonKey(name: 'approved') int? approved, @JsonKey(name: 'rejected') int? rejected)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsByStatus() when $default != null:
|
||||||
|
return $default(_that.approved,_that.rejected);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@JsonKey(name: 'approved') int? approved, @JsonKey(name: 'rejected') int? rejected) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsByStatus():
|
||||||
|
return $default(_that.approved,_that.rejected);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@JsonKey(name: 'approved') int? approved, @JsonKey(name: 'rejected') int? rejected)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsByStatus() when $default != null:
|
||||||
|
return $default(_that.approved,_that.rejected);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _ApprovalsByStatus implements ApprovalsByStatus {
|
||||||
|
const _ApprovalsByStatus({@JsonKey(name: 'approved') required this.approved, @JsonKey(name: 'rejected') required this.rejected});
|
||||||
|
factory _ApprovalsByStatus.fromJson(Map<String, dynamic> json) => _$ApprovalsByStatusFromJson(json);
|
||||||
|
|
||||||
|
@override@JsonKey(name: 'approved') final int? approved;
|
||||||
|
@override@JsonKey(name: 'rejected') final int? rejected;
|
||||||
|
|
||||||
|
/// Create a copy of ApprovalsByStatus
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$ApprovalsByStatusCopyWith<_ApprovalsByStatus> get copyWith => __$ApprovalsByStatusCopyWithImpl<_ApprovalsByStatus>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$ApprovalsByStatusToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApprovalsByStatus&&(identical(other.approved, approved) || other.approved == approved)&&(identical(other.rejected, rejected) || other.rejected == rejected));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,approved,rejected);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ApprovalsByStatus(approved: $approved, rejected: $rejected)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$ApprovalsByStatusCopyWith<$Res> implements $ApprovalsByStatusCopyWith<$Res> {
|
||||||
|
factory _$ApprovalsByStatusCopyWith(_ApprovalsByStatus value, $Res Function(_ApprovalsByStatus) _then) = __$ApprovalsByStatusCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'approved') int? approved,@JsonKey(name: 'rejected') int? rejected
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$ApprovalsByStatusCopyWithImpl<$Res>
|
||||||
|
implements _$ApprovalsByStatusCopyWith<$Res> {
|
||||||
|
__$ApprovalsByStatusCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _ApprovalsByStatus _self;
|
||||||
|
final $Res Function(_ApprovalsByStatus) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ApprovalsByStatus
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? approved = freezed,Object? rejected = freezed,}) {
|
||||||
|
return _then(_ApprovalsByStatus(
|
||||||
|
approved: freezed == approved ? _self.approved : approved // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,rejected: freezed == rejected ? _self.rejected : rejected // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ApprovalsBySubmission {
|
||||||
|
|
||||||
|
@JsonKey(name: 'partnership') int? get partnership;@JsonKey(name: 'self-apply') int? get selfApply;
|
||||||
|
/// Create a copy of ApprovalsBySubmission
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ApprovalsBySubmissionCopyWith<ApprovalsBySubmission> get copyWith => _$ApprovalsBySubmissionCopyWithImpl<ApprovalsBySubmission>(this as ApprovalsBySubmission, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this ApprovalsBySubmission to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is ApprovalsBySubmission&&(identical(other.partnership, partnership) || other.partnership == partnership)&&(identical(other.selfApply, selfApply) || other.selfApply == selfApply));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,partnership,selfApply);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ApprovalsBySubmission(partnership: $partnership, selfApply: $selfApply)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $ApprovalsBySubmissionCopyWith<$Res> {
|
||||||
|
factory $ApprovalsBySubmissionCopyWith(ApprovalsBySubmission value, $Res Function(ApprovalsBySubmission) _then) = _$ApprovalsBySubmissionCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'partnership') int? partnership,@JsonKey(name: 'self-apply') int? selfApply
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$ApprovalsBySubmissionCopyWithImpl<$Res>
|
||||||
|
implements $ApprovalsBySubmissionCopyWith<$Res> {
|
||||||
|
_$ApprovalsBySubmissionCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final ApprovalsBySubmission _self;
|
||||||
|
final $Res Function(ApprovalsBySubmission) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ApprovalsBySubmission
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? partnership = freezed,Object? selfApply = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
partnership: freezed == partnership ? _self.partnership : partnership // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,selfApply: freezed == selfApply ? _self.selfApply : selfApply // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [ApprovalsBySubmission].
|
||||||
|
extension ApprovalsBySubmissionPatterns on ApprovalsBySubmission {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ApprovalsBySubmission value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsBySubmission() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ApprovalsBySubmission value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsBySubmission():
|
||||||
|
return $default(_that);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ApprovalsBySubmission value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsBySubmission() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@JsonKey(name: 'partnership') int? partnership, @JsonKey(name: 'self-apply') int? selfApply)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsBySubmission() when $default != null:
|
||||||
|
return $default(_that.partnership,_that.selfApply);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@JsonKey(name: 'partnership') int? partnership, @JsonKey(name: 'self-apply') int? selfApply) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsBySubmission():
|
||||||
|
return $default(_that.partnership,_that.selfApply);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@JsonKey(name: 'partnership') int? partnership, @JsonKey(name: 'self-apply') int? selfApply)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ApprovalsBySubmission() when $default != null:
|
||||||
|
return $default(_that.partnership,_that.selfApply);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _ApprovalsBySubmission implements ApprovalsBySubmission {
|
||||||
|
const _ApprovalsBySubmission({@JsonKey(name: 'partnership') required this.partnership, @JsonKey(name: 'self-apply') required this.selfApply});
|
||||||
|
factory _ApprovalsBySubmission.fromJson(Map<String, dynamic> json) => _$ApprovalsBySubmissionFromJson(json);
|
||||||
|
|
||||||
|
@override@JsonKey(name: 'partnership') final int? partnership;
|
||||||
|
@override@JsonKey(name: 'self-apply') final int? selfApply;
|
||||||
|
|
||||||
|
/// Create a copy of ApprovalsBySubmission
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$ApprovalsBySubmissionCopyWith<_ApprovalsBySubmission> get copyWith => __$ApprovalsBySubmissionCopyWithImpl<_ApprovalsBySubmission>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$ApprovalsBySubmissionToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApprovalsBySubmission&&(identical(other.partnership, partnership) || other.partnership == partnership)&&(identical(other.selfApply, selfApply) || other.selfApply == selfApply));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,partnership,selfApply);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ApprovalsBySubmission(partnership: $partnership, selfApply: $selfApply)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$ApprovalsBySubmissionCopyWith<$Res> implements $ApprovalsBySubmissionCopyWith<$Res> {
|
||||||
|
factory _$ApprovalsBySubmissionCopyWith(_ApprovalsBySubmission value, $Res Function(_ApprovalsBySubmission) _then) = __$ApprovalsBySubmissionCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'partnership') int? partnership,@JsonKey(name: 'self-apply') int? selfApply
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$ApprovalsBySubmissionCopyWithImpl<$Res>
|
||||||
|
implements _$ApprovalsBySubmissionCopyWith<$Res> {
|
||||||
|
__$ApprovalsBySubmissionCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _ApprovalsBySubmission _self;
|
||||||
|
final $Res Function(_ApprovalsBySubmission) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ApprovalsBySubmission
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? partnership = freezed,Object? selfApply = freezed,}) {
|
||||||
|
return _then(_ApprovalsBySubmission(
|
||||||
|
partnership: freezed == partnership ? _self.partnership : partnership // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,selfApply: freezed == selfApply ? _self.selfApply : selfApply // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'tender_approvals_state_data.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_TenderApprovalsStateData _$TenderApprovalsStateDataFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _TenderApprovalsStateData(
|
||||||
|
companyId: json['company_id'] as String?,
|
||||||
|
totalApprovals: (json['total_approvals'] as num?)?.toInt(),
|
||||||
|
approvedTenders: (json['approved_tenders'] as num?)?.toInt(),
|
||||||
|
rejectedTenders: (json['rejected_tenders'] as num?)?.toInt(),
|
||||||
|
selfApplyCount: (json['self_apply_count'] as num?)?.toInt(),
|
||||||
|
partnershipCount: (json['partnership_count'] as num?)?.toInt(),
|
||||||
|
approvalsByStatus:
|
||||||
|
json['approvals_by_status'] == null
|
||||||
|
? null
|
||||||
|
: ApprovalsByStatus.fromJson(
|
||||||
|
json['approvals_by_status'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
approvalsBySubmission:
|
||||||
|
json['approvals_by_submission'] == null
|
||||||
|
? null
|
||||||
|
: ApprovalsBySubmission.fromJson(
|
||||||
|
json['approvals_by_submission'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
lastUpdated: (json['last_updated'] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$TenderApprovalsStateDataToJson(
|
||||||
|
_TenderApprovalsStateData instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'company_id': instance.companyId,
|
||||||
|
'total_approvals': instance.totalApprovals,
|
||||||
|
'approved_tenders': instance.approvedTenders,
|
||||||
|
'rejected_tenders': instance.rejectedTenders,
|
||||||
|
'self_apply_count': instance.selfApplyCount,
|
||||||
|
'partnership_count': instance.partnershipCount,
|
||||||
|
'approvals_by_status': instance.approvalsByStatus?.toJson(),
|
||||||
|
'approvals_by_submission': instance.approvalsBySubmission?.toJson(),
|
||||||
|
'last_updated': instance.lastUpdated,
|
||||||
|
};
|
||||||
|
|
||||||
|
_ApprovalsByStatus _$ApprovalsByStatusFromJson(Map<String, dynamic> json) =>
|
||||||
|
_ApprovalsByStatus(
|
||||||
|
approved: (json['approved'] as num?)?.toInt(),
|
||||||
|
rejected: (json['rejected'] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$ApprovalsByStatusToJson(_ApprovalsByStatus instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'approved': instance.approved,
|
||||||
|
'rejected': instance.rejected,
|
||||||
|
};
|
||||||
|
|
||||||
|
_ApprovalsBySubmission _$ApprovalsBySubmissionFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _ApprovalsBySubmission(
|
||||||
|
partnership: (json['partnership'] as num?)?.toInt(),
|
||||||
|
selfApply: (json['self-apply'] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$ApprovalsBySubmissionToJson(
|
||||||
|
_ApprovalsBySubmission instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'partnership': instance.partnership,
|
||||||
|
'self-apply': instance.selfApply,
|
||||||
|
};
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
// ignore_for_file: invalid_annotation_target
|
||||||
|
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:tm_app/data/services/model/error/error_model.dart';
|
||||||
|
import 'package:tm_app/data/services/model/tender_approvals_state_data/tender_approvals_state_data.dart';
|
||||||
|
|
||||||
|
part 'tender_approvals_state_response.freezed.dart';
|
||||||
|
part 'tender_approvals_state_response.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class TenderApprovalsStateResponse with _$TenderApprovalsStateResponse {
|
||||||
|
@JsonSerializable(explicitToJson: true)
|
||||||
|
const factory TenderApprovalsStateResponse({
|
||||||
|
@JsonKey(name: 'success') required bool? success,
|
||||||
|
@JsonKey(name: 'message') required String? message,
|
||||||
|
@JsonKey(name: 'error') ErrorModel? error,
|
||||||
|
@JsonKey(name: 'data') TenderApprovalsStateData? data,
|
||||||
|
}) = _TenderApprovalsStateResponse;
|
||||||
|
|
||||||
|
factory TenderApprovalsStateResponse.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$TenderApprovalsStateResponseFromJson(json);
|
||||||
|
}
|
||||||
+334
@@ -0,0 +1,334 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'tender_approvals_state_response.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$TenderApprovalsStateResponse {
|
||||||
|
|
||||||
|
@JsonKey(name: "success") bool? get success;@JsonKey(name: "message") String? get message;@JsonKey(name: "error") ErrorModel? get error;@JsonKey(name: "data") TenderApprovalsStateData? get data;
|
||||||
|
/// Create a copy of TenderApprovalsStateResponse
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$TenderApprovalsStateResponseCopyWith<TenderApprovalsStateResponse> get copyWith => _$TenderApprovalsStateResponseCopyWithImpl<TenderApprovalsStateResponse>(this as TenderApprovalsStateResponse, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this TenderApprovalsStateResponse to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is TenderApprovalsStateResponse&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&(identical(other.error, error) || other.error == error)&&(identical(other.data, data) || other.data == data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,success,message,error,data);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'TenderApprovalsStateResponse(success: $success, message: $message, error: $error, data: $data)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $TenderApprovalsStateResponseCopyWith<$Res> {
|
||||||
|
factory $TenderApprovalsStateResponseCopyWith(TenderApprovalsStateResponse value, $Res Function(TenderApprovalsStateResponse) _then) = _$TenderApprovalsStateResponseCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: "success") bool? success,@JsonKey(name: "message") String? message,@JsonKey(name: "error") ErrorModel? error,@JsonKey(name: "data") TenderApprovalsStateData? data
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$ErrorModelCopyWith<$Res>? get error;$TenderApprovalsStateDataCopyWith<$Res>? get data;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$TenderApprovalsStateResponseCopyWithImpl<$Res>
|
||||||
|
implements $TenderApprovalsStateResponseCopyWith<$Res> {
|
||||||
|
_$TenderApprovalsStateResponseCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final TenderApprovalsStateResponse _self;
|
||||||
|
final $Res Function(TenderApprovalsStateResponse) _then;
|
||||||
|
|
||||||
|
/// Create a copy of TenderApprovalsStateResponse
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? success = freezed,Object? message = freezed,Object? error = freezed,Object? data = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ErrorModel?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as TenderApprovalsStateData?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
/// Create a copy of TenderApprovalsStateResponse
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ErrorModelCopyWith<$Res>? get error {
|
||||||
|
if (_self.error == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
|
||||||
|
return _then(_self.copyWith(error: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of TenderApprovalsStateResponse
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$TenderApprovalsStateDataCopyWith<$Res>? get data {
|
||||||
|
if (_self.data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $TenderApprovalsStateDataCopyWith<$Res>(_self.data!, (value) {
|
||||||
|
return _then(_self.copyWith(data: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [TenderApprovalsStateResponse].
|
||||||
|
extension TenderApprovalsStateResponsePatterns on TenderApprovalsStateResponse {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _TenderApprovalsStateResponse value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateResponse() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _TenderApprovalsStateResponse value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateResponse():
|
||||||
|
return $default(_that);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _TenderApprovalsStateResponse value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateResponse() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@JsonKey(name: "success") bool? success, @JsonKey(name: "message") String? message, @JsonKey(name: "error") ErrorModel? error, @JsonKey(name: "data") TenderApprovalsStateData? data)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateResponse() when $default != null:
|
||||||
|
return $default(_that.success,_that.message,_that.error,_that.data);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@JsonKey(name: "success") bool? success, @JsonKey(name: "message") String? message, @JsonKey(name: "error") ErrorModel? error, @JsonKey(name: "data") TenderApprovalsStateData? data) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateResponse():
|
||||||
|
return $default(_that.success,_that.message,_that.error,_that.data);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@JsonKey(name: "success") bool? success, @JsonKey(name: "message") String? message, @JsonKey(name: "error") ErrorModel? error, @JsonKey(name: "data") TenderApprovalsStateData? data)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderApprovalsStateResponse() when $default != null:
|
||||||
|
return $default(_that.success,_that.message,_that.error,_that.data);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
@JsonSerializable(explicitToJson: true)
|
||||||
|
class _TenderApprovalsStateResponse implements TenderApprovalsStateResponse {
|
||||||
|
const _TenderApprovalsStateResponse({@JsonKey(name: "success") required this.success, @JsonKey(name: "message") required this.message, @JsonKey(name: "error") this.error, @JsonKey(name: "data") this.data});
|
||||||
|
factory _TenderApprovalsStateResponse.fromJson(Map<String, dynamic> json) => _$TenderApprovalsStateResponseFromJson(json);
|
||||||
|
|
||||||
|
@override@JsonKey(name: "success") final bool? success;
|
||||||
|
@override@JsonKey(name: "message") final String? message;
|
||||||
|
@override@JsonKey(name: "error") final ErrorModel? error;
|
||||||
|
@override@JsonKey(name: "data") final TenderApprovalsStateData? data;
|
||||||
|
|
||||||
|
/// Create a copy of TenderApprovalsStateResponse
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$TenderApprovalsStateResponseCopyWith<_TenderApprovalsStateResponse> get copyWith => __$TenderApprovalsStateResponseCopyWithImpl<_TenderApprovalsStateResponse>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$TenderApprovalsStateResponseToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TenderApprovalsStateResponse&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&(identical(other.error, error) || other.error == error)&&(identical(other.data, data) || other.data == data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,success,message,error,data);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'TenderApprovalsStateResponse(success: $success, message: $message, error: $error, data: $data)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$TenderApprovalsStateResponseCopyWith<$Res> implements $TenderApprovalsStateResponseCopyWith<$Res> {
|
||||||
|
factory _$TenderApprovalsStateResponseCopyWith(_TenderApprovalsStateResponse value, $Res Function(_TenderApprovalsStateResponse) _then) = __$TenderApprovalsStateResponseCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: "success") bool? success,@JsonKey(name: "message") String? message,@JsonKey(name: "error") ErrorModel? error,@JsonKey(name: "data") TenderApprovalsStateData? data
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@override $ErrorModelCopyWith<$Res>? get error;@override $TenderApprovalsStateDataCopyWith<$Res>? get data;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$TenderApprovalsStateResponseCopyWithImpl<$Res>
|
||||||
|
implements _$TenderApprovalsStateResponseCopyWith<$Res> {
|
||||||
|
__$TenderApprovalsStateResponseCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _TenderApprovalsStateResponse _self;
|
||||||
|
final $Res Function(_TenderApprovalsStateResponse) _then;
|
||||||
|
|
||||||
|
/// Create a copy of TenderApprovalsStateResponse
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? success = freezed,Object? message = freezed,Object? error = freezed,Object? data = freezed,}) {
|
||||||
|
return _then(_TenderApprovalsStateResponse(
|
||||||
|
success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ErrorModel?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as TenderApprovalsStateData?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of TenderApprovalsStateResponse
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ErrorModelCopyWith<$Res>? get error {
|
||||||
|
if (_self.error == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
|
||||||
|
return _then(_self.copyWith(error: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of TenderApprovalsStateResponse
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$TenderApprovalsStateDataCopyWith<$Res>? get data {
|
||||||
|
if (_self.data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $TenderApprovalsStateDataCopyWith<$Res>(_self.data!, (value) {
|
||||||
|
return _then(_self.copyWith(data: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'tender_approvals_state_response.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_TenderApprovalsStateResponse _$TenderApprovalsStateResponseFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _TenderApprovalsStateResponse(
|
||||||
|
success: json['success'] as bool?,
|
||||||
|
message: json['message'] as String?,
|
||||||
|
error:
|
||||||
|
json['error'] == null
|
||||||
|
? null
|
||||||
|
: ErrorModel.fromJson(json['error'] as Map<String, dynamic>),
|
||||||
|
data:
|
||||||
|
json['data'] == null
|
||||||
|
? null
|
||||||
|
: TenderApprovalsStateData.fromJson(
|
||||||
|
json['data'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$TenderApprovalsStateResponseToJson(
|
||||||
|
_TenderApprovalsStateResponse instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'success': instance.success,
|
||||||
|
'message': instance.message,
|
||||||
|
'error': instance.error?.toJson(),
|
||||||
|
'data': instance.data?.toJson(),
|
||||||
|
};
|
||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:tm_app/core/utils/result.dart';
|
import 'package:tm_app/core/utils/result.dart';
|
||||||
import 'package:tm_app/data/services/model/home/home_request/home_request_model.dart';
|
import 'package:tm_app/data/services/model/home/home_request/home_request_model.dart';
|
||||||
import 'package:tm_app/data/services/model/recommended_tenders_response/recommended_tenders_response.dart';
|
import 'package:tm_app/data/services/model/recommended_tenders_response/recommended_tenders_response.dart';
|
||||||
|
import 'package:tm_app/data/services/model/tender_approvals_state_response/tender_approvals_state_response.dart';
|
||||||
import 'package:tm_app/data/services/model/tender_approvals_response/tender_approvals_response.dart';
|
import 'package:tm_app/data/services/model/tender_approvals_response/tender_approvals_response.dart';
|
||||||
import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
|
import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ class HomeViewModel with ChangeNotifier {
|
|||||||
: _homeRepository = homeRepository {
|
: _homeRepository = homeRepository {
|
||||||
getHome(homeRequestModel: HomeRequestModel(id: '1'));
|
getHome(homeRequestModel: HomeRequestModel(id: '1'));
|
||||||
getYourTenders();
|
getYourTenders();
|
||||||
|
getApprovedStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
@@ -27,6 +29,8 @@ class HomeViewModel with ChangeNotifier {
|
|||||||
HomeResponseModel? get homeResponse => _homeResponse;
|
HomeResponseModel? get homeResponse => _homeResponse;
|
||||||
|
|
||||||
RecommendedTendersResponse? _recommendedTendersResponse;
|
RecommendedTendersResponse? _recommendedTendersResponse;
|
||||||
|
TenderApprovalsStateResponse? tenderApprovalsStateResponse;
|
||||||
|
|
||||||
final List<TenderData> _tenders = [];
|
final List<TenderData> _tenders = [];
|
||||||
final int _pageSize = 20;
|
final int _pageSize = 20;
|
||||||
int _currentPage = 0;
|
int _currentPage = 0;
|
||||||
@@ -128,6 +132,25 @@ class HomeViewModel with ChangeNotifier {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_isLoading = false;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
Future<void> getApprovedStates() async {
|
||||||
|
_isLoading = true;
|
||||||
|
_errorMessage = null;
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
final result = await _homeRepository.getTendersApprovalsState();
|
||||||
|
|
||||||
|
switch (result) {
|
||||||
|
case Ok<TenderApprovalsStateResponse>():
|
||||||
|
tenderApprovalsStateResponse = result.value;
|
||||||
|
break;
|
||||||
|
case Error<TenderApprovalsStateResponse>():
|
||||||
|
_errorMessage = result.error.toString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:tm_app/core/constants/strings.dart';
|
|||||||
import 'package:tm_app/core/routes/app_routes.dart';
|
import 'package:tm_app/core/routes/app_routes.dart';
|
||||||
import 'package:tm_app/core/theme/colors.dart';
|
import 'package:tm_app/core/theme/colors.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
import 'package:tm_app/data/services/model/tender_approvals_state_response/tender_approvals_state_response.dart';
|
||||||
import 'package:tm_app/view_models/home_view_model.dart';
|
import 'package:tm_app/view_models/home_view_model.dart';
|
||||||
import 'package:tm_app/views/home/widgets/notification_card.dart';
|
import 'package:tm_app/views/home/widgets/notification_card.dart';
|
||||||
|
|
||||||
@@ -35,9 +35,12 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
SizedBox(height: 55),
|
SizedBox(height: 55),
|
||||||
SizedBox(width: 780, child: NotificationCard()),
|
SizedBox(width: 780, child: NotificationCard()),
|
||||||
SizedBox(height: 40.0),
|
SizedBox(height: 40.0),
|
||||||
_progressBarsRow(homeViewModel.homeResponse!),
|
_progressBarsRow(homeViewModel.tenderApprovalsStateResponse!),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_firstTenderCardsRow(context, homeViewModel.homeResponse!),
|
_firstTenderCardsRow(
|
||||||
|
context,
|
||||||
|
homeViewModel.tenderApprovalsStateResponse!,
|
||||||
|
),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_yourTenderText(),
|
_yourTenderText(),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
@@ -50,41 +53,50 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow(HomeResponseModel homeResponse) {
|
Widget _progressBarsRow(
|
||||||
|
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
||||||
|
) {
|
||||||
|
final partnership =
|
||||||
|
tenderApprovalsStateResponse.data!.partnershipCount ?? 0;
|
||||||
|
final selfApply = tenderApprovalsStateResponse.data!.selfApplyCount ?? 0;
|
||||||
|
final total = (partnership + selfApply);
|
||||||
|
|
||||||
|
final partnershipPercent = total > 0 ? (partnership / total) * 100 : 0;
|
||||||
|
final selfApplyPercent = total > 0 ? (selfApply / total) * 100 : 0;
|
||||||
return Row(
|
return Row(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: double.parse(homeResponse.partnership ?? '0'),
|
value: double.parse('$partnershipPercent'),
|
||||||
amount: homeResponse.partnership ?? '0',
|
amount: partnership.toString(),
|
||||||
circularProgressIndicatorWidth: 176,
|
circularProgressIndicatorWidth: 176,
|
||||||
circularProgressIndicatorHeight: 176,
|
circularProgressIndicatorHeight: 176,
|
||||||
),
|
),
|
||||||
SizedBox(width: 106),
|
SizedBox(width: 106),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: double.parse(homeResponse.selfApply ?? '0'),
|
value: double.parse(selfApplyPercent.toString()),
|
||||||
amount: homeResponse.selfApply ?? '0',
|
amount: selfApply.toString(),
|
||||||
circularProgressIndicatorWidth: 176,
|
circularProgressIndicatorWidth: 176,
|
||||||
circularProgressIndicatorHeight: 176,
|
circularProgressIndicatorHeight: 176,
|
||||||
),
|
),
|
||||||
SizedBox(width: 106),
|
SizedBox(width: 106),
|
||||||
ProgressBarColumn(
|
// ProgressBarColumn(
|
||||||
text: AppStrings.contracting,
|
// text: AppStrings.contracting,
|
||||||
value: double.parse(homeResponse.contracting ?? '0'),
|
// value: double.parse(homeResponse.contracting ?? '0'),
|
||||||
amount: homeResponse.contracting ?? '0',
|
// amount: homeResponse.contracting ?? '0',
|
||||||
circularProgressIndicatorWidth: 176,
|
// circularProgressIndicatorWidth: 176,
|
||||||
circularProgressIndicatorHeight: 176,
|
// circularProgressIndicatorHeight: 176,
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _firstTenderCardsRow(
|
Widget _firstTenderCardsRow(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
HomeResponseModel homeResponse,
|
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
||||||
) {
|
) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -93,7 +105,12 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary20,
|
backgroundColor: AppColors.primary20,
|
||||||
iconPath: 'assets/icons/arrows.svg',
|
iconPath: 'assets/icons/arrows.svg',
|
||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount: homeResponse.tenderSubmitted ?? '0',
|
amount:
|
||||||
|
tenderApprovalsStateResponse
|
||||||
|
.data!
|
||||||
|
.approvalsBySubmission!
|
||||||
|
.selfApply
|
||||||
|
.toString(),
|
||||||
textColor: Color(0xFF0164FF),
|
textColor: Color(0xFF0164FF),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: 178,
|
width: 178,
|
||||||
@@ -107,7 +124,7 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary10,
|
backgroundColor: AppColors.primary10,
|
||||||
iconPath: 'assets/icons/thumb.svg',
|
iconPath: 'assets/icons/thumb.svg',
|
||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: homeResponse.approvedTenders ?? '0',
|
amount: tenderApprovalsStateResponse.data!.approvedTenders.toString(),
|
||||||
textColor: Color(0xFF24848E),
|
textColor: Color(0xFF24848E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: 178,
|
width: 178,
|
||||||
@@ -117,29 +134,29 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
TenderCard(
|
// TenderCard(
|
||||||
backgroundColor: AppColors.orange10,
|
// backgroundColor: AppColors.orange10,
|
||||||
iconPath: 'assets/icons/shield.svg',
|
// iconPath: 'assets/icons/shield.svg',
|
||||||
title: AppStrings.tenderValue,
|
// title: AppStrings.tenderValue,
|
||||||
amount: homeResponse.tenderValue ?? '0',
|
// amount: homeResponse.tenderValue ?? '0',
|
||||||
textColor: Color(0xFFE5821E),
|
// textColor: Color(0xFFE5821E),
|
||||||
enableTap: true,
|
// enableTap: true,
|
||||||
width: 178,
|
// width: 178,
|
||||||
height: 148,
|
// height: 148,
|
||||||
onTap: () {},
|
// onTap: () {},
|
||||||
),
|
// ),
|
||||||
SizedBox(width: 10),
|
// SizedBox(width: 10),
|
||||||
TenderCard(
|
// TenderCard(
|
||||||
backgroundColor: AppColors.grey10,
|
// backgroundColor: AppColors.grey10,
|
||||||
iconPath: 'assets/icons/edit.svg',
|
// iconPath: 'assets/icons/edit.svg',
|
||||||
title: AppStrings.thunderStatus,
|
// title: AppStrings.thunderStatus,
|
||||||
amount: homeResponse.thunderStatus ?? '0',
|
// amount: homeResponse.thunderStatus ?? '0',
|
||||||
textColor: Color(0xFF9E9E9E),
|
// textColor: Color(0xFF9E9E9E),
|
||||||
enableTap: false,
|
// enableTap: false,
|
||||||
width: 178,
|
// width: 178,
|
||||||
height: 148,
|
// height: 148,
|
||||||
onTap: () {},
|
// onTap: () {},
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:tm_app/core/routes/app_routes.dart';
|
|||||||
import 'package:tm_app/core/theme/colors.dart';
|
import 'package:tm_app/core/theme/colors.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
||||||
|
import 'package:tm_app/data/services/model/tender_approvals_state_response/tender_approvals_state_response.dart';
|
||||||
import 'package:tm_app/view_models/home_view_model.dart';
|
import 'package:tm_app/view_models/home_view_model.dart';
|
||||||
import 'package:tm_app/views/home/widgets/notification_card.dart';
|
import 'package:tm_app/views/home/widgets/notification_card.dart';
|
||||||
import 'package:tm_app/views/shared/tender_app_bar.dart';
|
import 'package:tm_app/views/shared/tender_app_bar.dart';
|
||||||
@@ -39,11 +40,14 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
SizedBox(height: 18.0.h()),
|
SizedBox(height: 18.0.h()),
|
||||||
NotificationCard(),
|
NotificationCard(),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_progressBarsRow(homeViewModel.homeResponse!),
|
_progressBarsRow(homeViewModel.tenderApprovalsStateResponse!),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_firstTenderCardsRow(context, homeViewModel.homeResponse!),
|
_firstTenderCardsRow(
|
||||||
|
context,
|
||||||
|
homeViewModel.tenderApprovalsStateResponse!,
|
||||||
|
),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
_secondTenderCardsRow(homeViewModel.homeResponse!),
|
// _secondTenderCardsRow(homeViewModel.homeResponse!),
|
||||||
SizedBox(height: 40.0.h()),
|
SizedBox(height: 40.0.h()),
|
||||||
_yourTenderText(homeViewModel),
|
_yourTenderText(homeViewModel),
|
||||||
_bottomListView(homeViewModel),
|
_bottomListView(homeViewModel),
|
||||||
@@ -59,27 +63,41 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow(HomeResponseModel homeResponse) {
|
Widget _progressBarsRow(
|
||||||
|
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
||||||
|
) {
|
||||||
|
final partnership =
|
||||||
|
tenderApprovalsStateResponse.data!.partnershipCount ?? 0;
|
||||||
|
final selfApply = tenderApprovalsStateResponse.data!.selfApplyCount ?? 0;
|
||||||
|
final total = (partnership + selfApply);
|
||||||
|
|
||||||
|
final partnershipPercent = total > 0 ? (partnership / total) * 100 : 0;
|
||||||
|
final selfApplyPercent = total > 0 ? (selfApply / total) * 100 : 0;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
|
Spacer(),
|
||||||
|
SizedBox(width: 20.0.w()),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: double.parse(homeResponse.partnership ?? '0'),
|
value: double.parse('$partnershipPercent'),
|
||||||
amount: '${homeResponse.partnership}%',
|
amount: partnership.toString(),
|
||||||
),
|
),
|
||||||
|
Spacer(),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: double.parse(homeResponse.selfApply ?? '0'),
|
value: double.parse(selfApplyPercent.toString()),
|
||||||
amount: homeResponse.selfApply ?? '0',
|
amount: selfApply.toString(),
|
||||||
),
|
|
||||||
ProgressBarColumn(
|
|
||||||
text: AppStrings.contracting,
|
|
||||||
value: double.parse(homeResponse.contracting ?? '0'),
|
|
||||||
amount: homeResponse.contracting ?? '0',
|
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 20.0.w()),
|
||||||
|
Spacer(),
|
||||||
|
// ProgressBarColumn(
|
||||||
|
// text: AppStrings.contracting,
|
||||||
|
// value: double.parse(tenderApprovalsStateResponse.data.contracting ?? '0'),
|
||||||
|
// amount: tenderApprovalsStateResponse.data.contracting ?? '0',
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -87,7 +105,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _firstTenderCardsRow(
|
Widget _firstTenderCardsRow(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
HomeResponseModel homeResponse,
|
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
||||||
) {
|
) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
@@ -98,7 +116,12 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary20,
|
backgroundColor: AppColors.primary20,
|
||||||
iconPath: AssetsManager.arrows,
|
iconPath: AssetsManager.arrows,
|
||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount: homeResponse.tenderSubmitted ?? '0',
|
amount:
|
||||||
|
tenderApprovalsStateResponse
|
||||||
|
.data!
|
||||||
|
.approvalsBySubmission!
|
||||||
|
.selfApply
|
||||||
|
.toString(),
|
||||||
textColor: Color(0xFF0164FF),
|
textColor: Color(0xFF0164FF),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -109,7 +132,8 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary10,
|
backgroundColor: AppColors.primary10,
|
||||||
iconPath: AssetsManager.thumb,
|
iconPath: AssetsManager.thumb,
|
||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: homeResponse.approvedTenders ?? '0',
|
amount:
|
||||||
|
tenderApprovalsStateResponse.data!.approvedTenders.toString(),
|
||||||
textColor: Color(0xFF24848E),
|
textColor: Color(0xFF24848E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -121,6 +145,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore: unused_element
|
||||||
Widget _secondTenderCardsRow(HomeResponseModel homeResponse) {
|
Widget _secondTenderCardsRow(HomeResponseModel homeResponse) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
@@ -151,11 +176,11 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _yourTenderText(HomeViewModel homeViewModel) {
|
Widget _yourTenderText(HomeViewModel homeViewModel) {
|
||||||
final isYourTenders = homeViewModel.data?.data?.isNotEmpty ?? false;
|
final isYourTenders = homeViewModel.data?.data?.isNotEmpty ?? false;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
child: Text(
|
child: Text(
|
||||||
isYourTenders ? AppStrings.yourTenders : AppStrings.recommendedTenders,
|
isYourTenders ? AppStrings.yourTenders : AppStrings.recommendedTenders,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0.sp(),
|
fontSize: 18.0.sp(),
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:tm_app/core/routes/app_routes.dart';
|
|||||||
import 'package:tm_app/core/theme/colors.dart';
|
import 'package:tm_app/core/theme/colors.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
||||||
|
import 'package:tm_app/data/services/model/tender_approvals_state_response/tender_approvals_state_response.dart';
|
||||||
import 'package:tm_app/view_models/home_view_model.dart';
|
import 'package:tm_app/view_models/home_view_model.dart';
|
||||||
import 'package:tm_app/views/home/widgets/notification_card.dart';
|
import 'package:tm_app/views/home/widgets/notification_card.dart';
|
||||||
|
|
||||||
@@ -41,11 +42,14 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
NotificationCard(),
|
NotificationCard(),
|
||||||
SizedBox(height: 40.0.h()),
|
SizedBox(height: 40.0.h()),
|
||||||
_progressBarsRow(homeViewModel.homeResponse!),
|
_progressBarsRow(homeViewModel.tenderApprovalsStateResponse!),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_firstTenderCardsRow(context, homeViewModel.homeResponse!),
|
_firstTenderCardsRow(
|
||||||
|
context,
|
||||||
|
homeViewModel.tenderApprovalsStateResponse!,
|
||||||
|
),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
_secondTenderCardsRow(homeViewModel.homeResponse!),
|
//_secondTenderCardsRow(homeViewModel.homeResponse!),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_yourTenderText(),
|
_yourTenderText(),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
@@ -59,41 +63,53 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow(HomeResponseModel homeResponse) {
|
Widget _progressBarsRow(
|
||||||
|
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
||||||
|
) {
|
||||||
|
final partnership =
|
||||||
|
tenderApprovalsStateResponse.data!.partnershipCount ?? 0;
|
||||||
|
final selfApply = tenderApprovalsStateResponse.data!.selfApplyCount ?? 0;
|
||||||
|
final total = (partnership + selfApply);
|
||||||
|
|
||||||
|
final partnershipPercent = total > 0 ? (partnership / total) * 100 : 0;
|
||||||
|
final selfApplyPercent = total > 0 ? (selfApply / total) * 100 : 0;
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
|
Spacer(),
|
||||||
|
SizedBox(width: 20.0.w()),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: double.parse(homeResponse.partnership ?? '0'),
|
value: double.parse('$partnershipPercent'),
|
||||||
amount: homeResponse.partnership ?? '0',
|
amount: partnership.toString(),
|
||||||
circularProgressIndicatorWidth: 176.0,
|
circularProgressIndicatorWidth: 176.0,
|
||||||
circularProgressIndicatorHeight: 176.0,
|
circularProgressIndicatorHeight: 176.0,
|
||||||
strokeWidth: 8.0,
|
strokeWidth: 8.0,
|
||||||
),
|
),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: double.parse(homeResponse.selfApply ?? '0'),
|
value: double.parse(selfApplyPercent.toString()),
|
||||||
amount: homeResponse.selfApply ?? '0',
|
amount: selfApply.toString(),
|
||||||
circularProgressIndicatorWidth: 176.0,
|
|
||||||
circularProgressIndicatorHeight: 176.0,
|
|
||||||
strokeWidth: 8.0,
|
|
||||||
),
|
|
||||||
ProgressBarColumn(
|
|
||||||
text: AppStrings.contracting,
|
|
||||||
value: double.parse(homeResponse.contracting ?? '0'),
|
|
||||||
amount: homeResponse.contracting ?? '0',
|
|
||||||
circularProgressIndicatorWidth: 176.0,
|
circularProgressIndicatorWidth: 176.0,
|
||||||
circularProgressIndicatorHeight: 176.0,
|
circularProgressIndicatorHeight: 176.0,
|
||||||
strokeWidth: 8.0,
|
strokeWidth: 8.0,
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 20.0.w()),
|
||||||
|
Spacer(),
|
||||||
|
// ProgressBarColumn(
|
||||||
|
// text: AppStrings.contracting,
|
||||||
|
// value: double.parse(homeResponse.contracting ?? '0'),
|
||||||
|
// amount: homeResponse.contracting ?? '0',
|
||||||
|
// circularProgressIndicatorWidth: 176.0,
|
||||||
|
// circularProgressIndicatorHeight: 176.0,
|
||||||
|
// strokeWidth: 8.0,
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _firstTenderCardsRow(
|
Widget _firstTenderCardsRow(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
HomeResponseModel homeResponse,
|
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
||||||
) {
|
) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
@@ -103,7 +119,12 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary20,
|
backgroundColor: AppColors.primary20,
|
||||||
iconPath: 'assets/icons/arrows.svg',
|
iconPath: 'assets/icons/arrows.svg',
|
||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount: homeResponse.tenderSubmitted ?? '0',
|
amount:
|
||||||
|
tenderApprovalsStateResponse
|
||||||
|
.data!
|
||||||
|
.approvalsBySubmission!
|
||||||
|
.selfApply
|
||||||
|
.toString(),
|
||||||
textColor: Color(0xFF0164FF),
|
textColor: Color(0xFF0164FF),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -119,7 +140,9 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary10,
|
backgroundColor: AppColors.primary10,
|
||||||
iconPath: 'assets/icons/thumb.svg',
|
iconPath: 'assets/icons/thumb.svg',
|
||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: homeResponse.approvedTenders ?? '0',
|
amount:
|
||||||
|
tenderApprovalsStateResponse.data!.approvedTenders.toString(),
|
||||||
|
|
||||||
textColor: Color(0xFF24848E),
|
textColor: Color(0xFF24848E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -133,6 +156,7 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore: unused_element
|
||||||
Widget _secondTenderCardsRow(HomeResponseModel homeResponse) {
|
Widget _secondTenderCardsRow(HomeResponseModel homeResponse) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
|||||||
Reference in New Issue
Block a user