From d0baa455821bf81f107e51bfd9b8e05e63cb9c8c Mon Sep 17 00:00:00 2001 From: roandersonpinheiro Date: Sat, 27 Dec 2025 16:33:28 -0300 Subject: [PATCH 1/4] Fix medical shift edit issues and formatting --- .../lib/core/api/api_result.freezed.dart | 27 +- .../core/api/network_exceptions.freezed.dart | 78 +- .../core/widgets/my_date_input.widget.dart | 42 +- .../core/widgets/my_time_input.widget.dart | 39 +- .../lib/features/home/pages/home_page.dart | 15 +- .../viewmodels/home_viewmodel.dart | 31 +- .../add_medical_shift_request_model.dart | 4 + .../data/models/medical_shift_model.dart | 4 + .../medical_shift_repository_impl.dart | 4 + .../domain/entities/medical_shift_entity.dart | 6 + .../medical_shift_repository.dart | 2 + .../create_medical_shift_usecase.dart | 4 + .../update_medical_shift_usecase.dart | 4 + .../pages/add_medical_shift_page.dart | 103 ++ .../pages/edit_medical_shift_page.dart | 150 ++- .../pages/medical_shifts_page.dart | 31 +- .../pages/widgets/calendar_widget.dart | 33 +- .../create_medical_shift_viewmodel.dart | 8 + .../create_medical_shift_viewmodel.g.dart | 29 + .../update_medical_shift_viewmodel.dart | 119 +- .../update_medical_shift_viewmodel.g.dart | 29 + .../viewmodels/patient_list_viewmodel.dart | 20 +- med_system_app/pubspec.lock | 1124 +++++++++++++++++ med_system_app/pubspec.yaml | 6 +- 24 files changed, 1755 insertions(+), 157 deletions(-) create mode 100644 med_system_app/pubspec.lock diff --git a/med_system_app/lib/core/api/api_result.freezed.dart b/med_system_app/lib/core/api/api_result.freezed.dart index b466328..6f7ba48 100644 --- a/med_system_app/lib/core/api/api_result.freezed.dart +++ b/med_system_app/lib/core/api/api_result.freezed.dart @@ -71,6 +71,9 @@ class _$ResultCopyWithImpl> final $Val _value; // ignore: unused_field final $Res Function($Val) _then; + + /// Create a copy of Result + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -90,6 +93,8 @@ class __$$SuccessImplCopyWithImpl _$SuccessImpl _value, $Res Function(_$SuccessImpl) _then) : super(_value, _then); + /// Create a copy of Result + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -129,7 +134,9 @@ class _$SuccessImpl implements _Success { int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(data)); - @JsonKey(ignore: true) + /// Create a copy of Result + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$SuccessImplCopyWith> get copyWith => @@ -202,7 +209,10 @@ abstract class _Success implements Result { const factory _Success(final T data) = _$SuccessImpl; T get data; - @JsonKey(ignore: true) + + /// Create a copy of Result + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) _$$SuccessImplCopyWith> get copyWith => throw _privateConstructorUsedError; } @@ -226,6 +236,8 @@ class __$$FailureImplCopyWithImpl _$FailureImpl _value, $Res Function(_$FailureImpl) _then) : super(_value, _then); + /// Create a copy of Result + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -239,6 +251,8 @@ class __$$FailureImplCopyWithImpl )); } + /// Create a copy of Result + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $NetworkExceptionsCopyWith<$Res> get error { @@ -272,7 +286,9 @@ class _$FailureImpl implements _Failure { @override int get hashCode => Object.hash(runtimeType, error); - @JsonKey(ignore: true) + /// Create a copy of Result + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$FailureImplCopyWith> get copyWith => @@ -345,7 +361,10 @@ abstract class _Failure implements Result { const factory _Failure(final NetworkExceptions error) = _$FailureImpl; NetworkExceptions get error; - @JsonKey(ignore: true) + + /// Create a copy of Result + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) _$$FailureImplCopyWith> get copyWith => throw _privateConstructorUsedError; } diff --git a/med_system_app/lib/core/api/network_exceptions.freezed.dart b/med_system_app/lib/core/api/network_exceptions.freezed.dart index 96059f8..737c9bf 100644 --- a/med_system_app/lib/core/api/network_exceptions.freezed.dart +++ b/med_system_app/lib/core/api/network_exceptions.freezed.dart @@ -162,6 +162,9 @@ class _$NetworkExceptionsCopyWithImpl<$Res, $Val extends NetworkExceptions> final $Val _value; // ignore: unused_field final $Res Function($Val) _then; + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -178,6 +181,9 @@ class __$$RequestCancelledImplCopyWithImpl<$Res> __$$RequestCancelledImplCopyWithImpl(_$RequestCancelledImpl _value, $Res Function(_$RequestCancelledImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -373,6 +379,8 @@ class __$$UnauthorizedRequestImplCopyWithImpl<$Res> $Res Function(_$UnauthorizedRequestImpl) _then) : super(_value, _then); + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -411,7 +419,9 @@ class _$UnauthorizedRequestImpl implements UnauthorizedRequest { @override int get hashCode => Object.hash(runtimeType, reason); - @JsonKey(ignore: true) + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$UnauthorizedRequestImplCopyWith<_$UnauthorizedRequestImpl> get copyWith => @@ -576,7 +586,10 @@ abstract class UnauthorizedRequest implements NetworkExceptions { _$UnauthorizedRequestImpl; String get reason; - @JsonKey(ignore: true) + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) _$$UnauthorizedRequestImplCopyWith<_$UnauthorizedRequestImpl> get copyWith => throw _privateConstructorUsedError; } @@ -595,6 +608,9 @@ class __$$BadRequestImplCopyWithImpl<$Res> __$$BadRequestImplCopyWithImpl( _$BadRequestImpl _value, $Res Function(_$BadRequestImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -790,6 +806,8 @@ class __$$NotFoundImplCopyWithImpl<$Res> _$NotFoundImpl _value, $Res Function(_$NotFoundImpl) _then) : super(_value, _then); + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -828,7 +846,9 @@ class _$NotFoundImpl implements NotFound { @override int get hashCode => Object.hash(runtimeType, reason); - @JsonKey(ignore: true) + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$NotFoundImplCopyWith<_$NotFoundImpl> get copyWith => @@ -991,7 +1011,10 @@ abstract class NotFound implements NetworkExceptions { const factory NotFound(final String reason) = _$NotFoundImpl; String get reason; - @JsonKey(ignore: true) + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) _$$NotFoundImplCopyWith<_$NotFoundImpl> get copyWith => throw _privateConstructorUsedError; } @@ -1010,6 +1033,9 @@ class __$$MethodNotAllowedImplCopyWithImpl<$Res> __$$MethodNotAllowedImplCopyWithImpl(_$MethodNotAllowedImpl _value, $Res Function(_$MethodNotAllowedImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -1202,6 +1228,9 @@ class __$$NotAcceptableImplCopyWithImpl<$Res> __$$NotAcceptableImplCopyWithImpl( _$NotAcceptableImpl _value, $Res Function(_$NotAcceptableImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -1394,6 +1423,9 @@ class __$$RequestTimeoutImplCopyWithImpl<$Res> __$$RequestTimeoutImplCopyWithImpl( _$RequestTimeoutImpl _value, $Res Function(_$RequestTimeoutImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -1586,6 +1618,9 @@ class __$$SendTimeoutImplCopyWithImpl<$Res> __$$SendTimeoutImplCopyWithImpl( _$SendTimeoutImpl _value, $Res Function(_$SendTimeoutImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -1778,6 +1813,9 @@ class __$$ConflictImplCopyWithImpl<$Res> __$$ConflictImplCopyWithImpl( _$ConflictImpl _value, $Res Function(_$ConflictImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -1970,6 +2008,9 @@ class __$$InternalServerErrorImplCopyWithImpl<$Res> __$$InternalServerErrorImplCopyWithImpl(_$InternalServerErrorImpl _value, $Res Function(_$InternalServerErrorImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -2163,6 +2204,9 @@ class __$$NotImplementedImplCopyWithImpl<$Res> __$$NotImplementedImplCopyWithImpl( _$NotImplementedImpl _value, $Res Function(_$NotImplementedImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -2355,6 +2399,9 @@ class __$$ServiceUnavailableImplCopyWithImpl<$Res> __$$ServiceUnavailableImplCopyWithImpl(_$ServiceUnavailableImpl _value, $Res Function(_$ServiceUnavailableImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -2547,6 +2594,9 @@ class __$$NoInternetConnectionImplCopyWithImpl<$Res> __$$NoInternetConnectionImplCopyWithImpl(_$NoInternetConnectionImpl _value, $Res Function(_$NoInternetConnectionImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -2740,6 +2790,9 @@ class __$$FormatExceptionImplCopyWithImpl<$Res> __$$FormatExceptionImplCopyWithImpl( _$FormatExceptionImpl _value, $Res Function(_$FormatExceptionImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -2932,6 +2985,9 @@ class __$$UnableToProcessImplCopyWithImpl<$Res> __$$UnableToProcessImplCopyWithImpl( _$UnableToProcessImpl _value, $Res Function(_$UnableToProcessImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -3127,6 +3183,8 @@ class __$$DefaultErrorImplCopyWithImpl<$Res> _$DefaultErrorImpl _value, $Res Function(_$DefaultErrorImpl) _then) : super(_value, _then); + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -3165,7 +3223,9 @@ class _$DefaultErrorImpl implements DefaultError { @override int get hashCode => Object.hash(runtimeType, error); - @JsonKey(ignore: true) + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$DefaultErrorImplCopyWith<_$DefaultErrorImpl> get copyWith => @@ -3328,7 +3388,10 @@ abstract class DefaultError implements NetworkExceptions { const factory DefaultError(final String error) = _$DefaultErrorImpl; String get error; - @JsonKey(ignore: true) + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) _$$DefaultErrorImplCopyWith<_$DefaultErrorImpl> get copyWith => throw _privateConstructorUsedError; } @@ -3347,6 +3410,9 @@ class __$$UnexpectedErrorImplCopyWithImpl<$Res> __$$UnexpectedErrorImplCopyWithImpl( _$UnexpectedErrorImpl _value, $Res Function(_$UnexpectedErrorImpl) _then) : super(_value, _then); + + /// Create a copy of NetworkExceptions + /// with the given fields replaced by the non-null parameter values. } /// @nodoc diff --git a/med_system_app/lib/core/widgets/my_date_input.widget.dart b/med_system_app/lib/core/widgets/my_date_input.widget.dart index c30120c..c9613b2 100644 --- a/med_system_app/lib/core/widgets/my_date_input.widget.dart +++ b/med_system_app/lib/core/widgets/my_date_input.widget.dart @@ -7,8 +7,8 @@ class MyInputDate extends StatefulWidget { final Color? fillColor; final Color? borderColor; final Color? textColor; - DateTime? selectedDate; - Function? onChanged; + final DateTime? selectedDate; // Changed to final + final Function? onChanged; // Changed to final MyInputDate({ super.key, @@ -27,20 +27,28 @@ class MyInputDate extends StatefulWidget { } class _MyInputDateState extends State { + DateTime? _internalSelectedDate; + @override void initState() { super.initState(); - if (widget.selectedDate != null && widget.onChanged != null) { - widget.onChanged!(getSelectedDateString()); + _internalSelectedDate = widget.selectedDate; + } + + @override + void didUpdateWidget(MyInputDate oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.selectedDate != oldWidget.selectedDate) { + _internalSelectedDate = widget.selectedDate; } } String getSelectedDateString() { - if (widget.selectedDate == null) return ''; + if (_internalSelectedDate == null) return ''; - String day = widget.selectedDate!.day.toString(); - String month = widget.selectedDate!.month.toString(); - String year = widget.selectedDate!.year.toString(); + String day = _internalSelectedDate!.day.toString().padLeft(2, '0'); // Pad left for better formatting + String month = _internalSelectedDate!.month.toString().padLeft(2, '0'); + String year = _internalSelectedDate!.year.toString(); return '$day/$month/$year'; } @@ -57,7 +65,7 @@ class _MyInputDateState extends State { helpText: 'Selecione a data', locale: const Locale('pt', 'BR'), initialEntryMode: DatePickerEntryMode.calendar, - initialDate: widget.selectedDate ?? + initialDate: _internalSelectedDate ?? DateTime(DateTime.now().year, DateTime.now().month, 1), firstDate: DateTime(2001), lastDate: DateTime(DateTime.now().year + 1), @@ -69,14 +77,16 @@ class _MyInputDateState extends State { }, ); - setState(() { - if (date != null) { - widget.selectedDate = date; - if (widget.onChanged != null) { - widget.onChanged!(getSelectedDateString()); - } + if (date != null) { + setState(() { + _internalSelectedDate = date; + }); + if (widget.onChanged != null) { + // Construct string manually to match getSelectedDateString but simpler or use same helper? + // Using helper method on internal state: + widget.onChanged!(getSelectedDateString()); } - }); + } } @override diff --git a/med_system_app/lib/core/widgets/my_time_input.widget.dart b/med_system_app/lib/core/widgets/my_time_input.widget.dart index 447db5e..509b37f 100644 --- a/med_system_app/lib/core/widgets/my_time_input.widget.dart +++ b/med_system_app/lib/core/widgets/my_time_input.widget.dart @@ -7,8 +7,8 @@ class MyInputTime extends StatefulWidget { final Color? fillColor; final Color? borderColor; final Color? textColor; - TimeOfDay? selectedTime; - Function? onChanged; + final TimeOfDay? selectedTime; // Changed to final + final Function? onChanged; // Changed to final MyInputTime({ super.key, @@ -27,19 +27,28 @@ class MyInputTime extends StatefulWidget { } class _MyInputTimeState extends State { + TimeOfDay? _internalSelectedTime; + @override void initState() { super.initState(); - if (widget.selectedTime != null && widget.onChanged != null) { - widget.onChanged!(getSelectedTimeString()); + _internalSelectedTime = widget.selectedTime; + // Initial onChanged call removed as it might be redundant or override controller/vm logic with old state if vm is trying to set it. + } + + @override + void didUpdateWidget(MyInputTime oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.selectedTime != oldWidget.selectedTime) { + _internalSelectedTime = widget.selectedTime; } } String getSelectedTimeString() { - if (widget.selectedTime == null) return ''; + if (_internalSelectedTime == null) return ''; - String hour = widget.selectedTime!.hour.toString().padLeft(2, '0'); - String minute = widget.selectedTime!.minute.toString().padLeft(2, '0'); + String hour = _internalSelectedTime!.hour.toString().padLeft(2, '0'); + String minute = _internalSelectedTime!.minute.toString().padLeft(2, '0'); return '$hour:$minute'; } @@ -47,7 +56,7 @@ class _MyInputTimeState extends State { Future _selectTime(BuildContext context) async { final time = await showTimePicker( context: context, - initialTime: widget.selectedTime ?? TimeOfDay.now(), + initialTime: _internalSelectedTime ?? TimeOfDay.now(), builder: (BuildContext context, Widget? child) { return Theme( data: Theme.of(context), @@ -56,14 +65,14 @@ class _MyInputTimeState extends State { }, ); - setState(() { - if (time != null) { - widget.selectedTime = time; - if (widget.onChanged != null) { - widget.onChanged!(getSelectedTimeString()); - } + if (time != null) { + setState(() { + _internalSelectedTime = time; + }); + if (widget.onChanged != null) { + widget.onChanged!(getSelectedTimeString()); } - }); + } } @override diff --git a/med_system_app/lib/features/home/pages/home_page.dart b/med_system_app/lib/features/home/pages/home_page.dart index 1986184..902644b 100755 --- a/med_system_app/lib/features/home/pages/home_page.dart +++ b/med_system_app/lib/features/home/pages/home_page.dart @@ -18,6 +18,7 @@ import 'package:distrito_medico/features/medical_shifts/pages/add_medical_shift_ import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:get_it/get_it.dart'; +import 'package:intl/intl.dart'; class HomePage extends StatefulWidget { const HomePage({super.key}); @@ -40,6 +41,8 @@ class _HomePageState extends State { homeViewModel.fetchAllData(); } + + _buildPageBody(BuildContext context) { return Observer(builder: (BuildContext context) { if (homeViewModel.errorMessage != null) { @@ -117,14 +120,14 @@ class _HomePageState extends State { menuItems: homeViewModel.selectedFilter == HomeFilterType.procedures ? menuHomeModel.buildMenuHome( - homeViewModel.totalProcedures.toString(), - homeViewModel.totalPaidProcedures.toString(), - homeViewModel.totalUnpaidProcedures.toString(), + homeViewModel.totalProcedures, + homeViewModel.totalPaidProcedures, + homeViewModel.totalUnpaidProcedures, context) : menuHomeMedicalShiftsaModel.buildMenuHome( - homeViewModel.totalMedicalShifts.toString(), - homeViewModel.totalPaidMedicalShifts.toString(), - homeViewModel.totalUnpaidMedicalShifts.toString(), + homeViewModel.totalMedicalShifts, + homeViewModel.totalPaidMedicalShifts, + homeViewModel.totalUnpaidMedicalShifts, context), ), homeViewModel.selectedFilter == HomeFilterType.procedures diff --git a/med_system_app/lib/features/home/presentation/viewmodels/home_viewmodel.dart b/med_system_app/lib/features/home/presentation/viewmodels/home_viewmodel.dart index e9f8bad..185afe2 100644 --- a/med_system_app/lib/features/home/presentation/viewmodels/home_viewmodel.dart +++ b/med_system_app/lib/features/home/presentation/viewmodels/home_viewmodel.dart @@ -1,3 +1,4 @@ +import 'package:intl/intl.dart'; import 'package:mobx/mobx.dart'; import '../../../../core/errors/failures.dart'; import '../../../event_procedures/domain/entities/event_procedure_entity.dart'; @@ -70,22 +71,40 @@ abstract class _HomeViewModelBase with Store { eventProcedures.isNotEmpty || medicalShifts.isNotEmpty; @computed - String get totalProcedures => _totalProcedures; + String get totalProcedures => _formatCurrency(_totalProcedures); @computed - String get totalPaidProcedures => _totalPaidProcedures; + String get totalPaidProcedures => _formatCurrency(_totalPaidProcedures); @computed - String get totalUnpaidProcedures => _totalUnpaidProcedures; + String get totalUnpaidProcedures => _formatCurrency(_totalUnpaidProcedures); @computed - String get totalMedicalShifts => _totalMedicalShifts; + String get totalMedicalShifts => _formatCurrency(_totalMedicalShifts); @computed - String get totalPaidMedicalShifts => _totalPaidMedicalShifts; + String get totalPaidMedicalShifts => _formatCurrency(_totalPaidMedicalShifts); @computed - String get totalUnpaidMedicalShifts => _totalUnpaidMedicalShifts; + String get totalUnpaidMedicalShifts => _formatCurrency(_totalUnpaidMedicalShifts); + + String _formatCurrency(String value) { + if (value.isEmpty) return 'R\$ 0,00'; + try { + // Remove symbols if present to parse + String cleaned = value.replaceAll(RegExp(r'[R\$\s]'), ''); + if (cleaned.contains(',')) { + // Assume PT-BR input (1.000,00) -> 1000.00 + cleaned = cleaned.replaceAll('.', '').replaceAll(',', '.'); + } + double number = double.parse(cleaned); + // Use NumberFormat from intl package. + // NOTE: Ensure intl is imported. + return NumberFormat.currency(locale: 'pt_BR', symbol: 'R\$').format(number); + } catch (e) { + return value; + } + } diff --git a/med_system_app/lib/features/medical_shifts/data/models/add_medical_shift_request_model.dart b/med_system_app/lib/features/medical_shifts/data/models/add_medical_shift_request_model.dart index 96b651d..3ad9fc3 100644 --- a/med_system_app/lib/features/medical_shifts/data/models/add_medical_shift_request_model.dart +++ b/med_system_app/lib/features/medical_shifts/data/models/add_medical_shift_request_model.dart @@ -5,6 +5,7 @@ class AddMedicalShiftRequestModel { String? startHour; int? amountCents; bool? paid; + String? color; AddMedicalShiftRequestModel({ this.hospitalName, @@ -13,6 +14,7 @@ class AddMedicalShiftRequestModel { this.startHour, this.amountCents, this.paid, + this.color, }); Map toJson() { @@ -23,6 +25,8 @@ class AddMedicalShiftRequestModel { data['start_hour'] = startHour; data['amount_cents'] = amountCents; data['paid'] = paid; + data['color'] = color; return data; } } + diff --git a/med_system_app/lib/features/medical_shifts/data/models/medical_shift_model.dart b/med_system_app/lib/features/medical_shifts/data/models/medical_shift_model.dart index 9b8d766..9bfaabd 100644 --- a/med_system_app/lib/features/medical_shifts/data/models/medical_shift_model.dart +++ b/med_system_app/lib/features/medical_shifts/data/models/medical_shift_model.dart @@ -14,6 +14,7 @@ class MedicalShiftModel extends MedicalShiftEntity { super.date, super.hour, super.medicalShiftRecurrenceId, + super.color, }); factory MedicalShiftModel.fromJson(Map json) { @@ -30,6 +31,7 @@ class MedicalShiftModel extends MedicalShiftEntity { date: json['date'], hour: json['hour'], medicalShiftRecurrenceId: json['medical_shift_recurrence_id'], + color: json['color'], ); } @@ -47,6 +49,8 @@ class MedicalShiftModel extends MedicalShiftEntity { data['date'] = date; data['hour'] = hour; data['medical_shift_recurrence_id'] = medicalShiftRecurrenceId; + data['color'] = color; return data; } } + diff --git a/med_system_app/lib/features/medical_shifts/data/repositories/medical_shift_repository_impl.dart b/med_system_app/lib/features/medical_shifts/data/repositories/medical_shift_repository_impl.dart index 40389ed..95c5bef 100644 --- a/med_system_app/lib/features/medical_shifts/data/repositories/medical_shift_repository_impl.dart +++ b/med_system_app/lib/features/medical_shifts/data/repositories/medical_shift_repository_impl.dart @@ -46,6 +46,7 @@ class MedicalShiftRepositoryImpl implements IMedicalShiftRepository { required String startHour, required double amount, required bool paid, + String? color, }) async { try { final request = AddMedicalShiftRequestModel( @@ -55,6 +56,7 @@ class MedicalShiftRepositoryImpl implements IMedicalShiftRepository { startHour: startHour, amountCents: (amount * 100).toInt(), paid: paid, + color: color, ); final result = await remoteDataSource.createMedicalShift(request); return Right(result); @@ -103,6 +105,7 @@ class MedicalShiftRepositoryImpl implements IMedicalShiftRepository { required String startHour, required double amount, required bool paid, + String? color, }) async { try { final request = AddMedicalShiftRequestModel( @@ -112,6 +115,7 @@ class MedicalShiftRepositoryImpl implements IMedicalShiftRepository { startHour: startHour, amountCents: (amount * 100).toInt(), paid: paid, + color: color, ); final result = await remoteDataSource.editMedicalShift(id, request); return Right(result); diff --git a/med_system_app/lib/features/medical_shifts/domain/entities/medical_shift_entity.dart b/med_system_app/lib/features/medical_shifts/domain/entities/medical_shift_entity.dart index c6523f2..a1da6f9 100644 --- a/med_system_app/lib/features/medical_shifts/domain/entities/medical_shift_entity.dart +++ b/med_system_app/lib/features/medical_shifts/domain/entities/medical_shift_entity.dart @@ -13,6 +13,7 @@ class MedicalShiftEntity extends Equatable { final String? date; final String? hour; final int? medicalShiftRecurrenceId; + final String? color; const MedicalShiftEntity({ this.id, @@ -27,6 +28,7 @@ class MedicalShiftEntity extends Equatable { this.date, this.hour, this.medicalShiftRecurrenceId, + this.color, }); @override @@ -43,6 +45,7 @@ class MedicalShiftEntity extends Equatable { date, hour, medicalShiftRecurrenceId, + color, ]; MedicalShiftEntity copyWith({ @@ -58,6 +61,7 @@ class MedicalShiftEntity extends Equatable { String? date, String? hour, int? medicalShiftRecurrenceId, + String? color, }) { return MedicalShiftEntity( id: id ?? this.id, @@ -73,6 +77,8 @@ class MedicalShiftEntity extends Equatable { hour: hour ?? this.hour, medicalShiftRecurrenceId: medicalShiftRecurrenceId ?? this.medicalShiftRecurrenceId, + color: color ?? this.color, ); } } + diff --git a/med_system_app/lib/features/medical_shifts/domain/repositories/medical_shift_repository.dart b/med_system_app/lib/features/medical_shifts/domain/repositories/medical_shift_repository.dart index 2851224..ee927ba 100644 --- a/med_system_app/lib/features/medical_shifts/domain/repositories/medical_shift_repository.dart +++ b/med_system_app/lib/features/medical_shifts/domain/repositories/medical_shift_repository.dart @@ -19,6 +19,7 @@ abstract class IMedicalShiftRepository { required String startHour, required double amount, required bool paid, + String? color, }); Future> createMedicalShiftRecurrence({ @@ -41,6 +42,7 @@ abstract class IMedicalShiftRepository { required String startHour, required double amount, required bool paid, + String? color, }); Future> deleteMedicalShift({ diff --git a/med_system_app/lib/features/medical_shifts/domain/usecases/create_medical_shift_usecase.dart b/med_system_app/lib/features/medical_shifts/domain/usecases/create_medical_shift_usecase.dart index 1dfc32d..6202f92 100644 --- a/med_system_app/lib/features/medical_shifts/domain/usecases/create_medical_shift_usecase.dart +++ b/med_system_app/lib/features/medical_shifts/domain/usecases/create_medical_shift_usecase.dart @@ -19,6 +19,7 @@ class CreateMedicalShiftUseCase implements UseCase { final GlobalKey _formKey = GlobalKey(); final _viewModel = GetIt.I.get(); final List _disposers = []; + bool _isColorInitialized = false; @override void didChangeDependencies() { @@ -57,6 +59,24 @@ class _AddMedicalShiftPageState extends State { : "Ocorreu um erro ao tentar cadastrar."); } })); + + if (!_isColorInitialized) { + final primary = Theme.of(context).colorScheme.primary; + String hexInt = primary.value.toRadixString(16).padLeft(8, '0').toUpperCase(); + // toRadixString returns ARGB, we want RGB usually for hex codes if opacity isn't key, but format #AARRGGBB is fine if parsed correctly. + // The parser used later is: int.parse(_viewModel.color!.replaceAll('#', '0xFF')) which assumes the stored string is #RRGGBB and replaces # with 0xFF (full opacity). + // So I should store #RRGGBB. + if (hexInt.length == 8) { + hexInt = hexInt.substring(2); + } + String hex = '#$hexInt'; + + // Only set if not already set (e.g. by user navigation back and forth without dispose? but reset is called on initState) + if (_viewModel.color == null) { + _viewModel.setColor(hex); + } + _isColorInitialized = true; + } } @override @@ -603,6 +623,89 @@ class _AddMedicalShiftPageState extends State { const SizedBox( height: 15, ), + // Color Picker + const Align( + alignment: Alignment.centerLeft, + child: Text("Cor do evento", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + )), + ), + const SizedBox(height: 8), + Observer(builder: (_) { + Color currentColor = _viewModel.color != null + ? Color(int.parse(_viewModel.color!.replaceAll('#', '0xFF'))) + : Theme.of(context).colorScheme.primary; + + return GestureDetector( + onTap: () { + showDialog( + context: context, + builder: (BuildContext context) { + Color pickerColor = currentColor; + return AlertDialog( + title: const Text('Escolha uma cor'), + content: SingleChildScrollView( + child: BlockPicker( + pickerColor: pickerColor, + onColorChanged: (Color color) { + pickerColor = color; + }, + ), + ), + actions: [ + TextButton( + child: const Text('Cancelar'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: const Text('Selecionar'), + onPressed: () { + // Format FF0000 -> #000000 + String hex = pickerColor.value.toRadixString(16).padLeft(8, '0').toUpperCase(); + if (hex.length == 8) { + hex = hex.substring(2); + } + String hexColor = '#$hex'; + _viewModel.setColor(hexColor); + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + }, + child: Container( + height: 50, + decoration: BoxDecoration( + color: currentColor, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: Colors.grey), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.palette, color: currentColor.computeLuminance() > 0.5 ? Colors.black : Colors.white), + const SizedBox(width: 8), + Text( + _viewModel.color ?? "Toque para selecionar", + style: TextStyle( + color: currentColor.computeLuminance() > 0.5 ? Colors.black : Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ); + }), + const SizedBox( + height: 15, + ), Center(child: Observer(builder: (_) { return MyButtonWidget( text: 'Cadastrar plantão', diff --git a/med_system_app/lib/features/medical_shifts/pages/edit_medical_shift_page.dart b/med_system_app/lib/features/medical_shifts/pages/edit_medical_shift_page.dart index 6310bb6..41e03d5 100644 --- a/med_system_app/lib/features/medical_shifts/pages/edit_medical_shift_page.dart +++ b/med_system_app/lib/features/medical_shifts/pages/edit_medical_shift_page.dart @@ -14,6 +14,7 @@ import 'package:distrito_medico/features/medical_shifts/pages/widgets/radio_grou import 'package:distrito_medico/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.dart'; import 'package:distrito_medico/features/procedures/util/real_input_format.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_colorpicker/flutter_colorpicker.dart'; import 'package:flutter/services.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:get_it/get_it.dart'; @@ -37,8 +38,8 @@ class _EditMedicalShiftPageState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); - _disposers.add(reaction( - (_) => _viewModel.state, (state) { + _disposers.add( + reaction((_) => _viewModel.state, (state) { if (state == UpdateMedicalShiftState.success) { to( context, @@ -50,8 +51,8 @@ class _EditMedicalShiftPageState extends State { CustomToast.show(context, type: ToastType.error, title: "Editar plantão", - description: _viewModel.errorMessage.isNotEmpty - ? _viewModel.errorMessage + description: _viewModel.errorMessage.isNotEmpty + ? _viewModel.errorMessage : "Ocorreu um erro ao tentar editar plantão."); } })); @@ -126,10 +127,9 @@ class _EditMedicalShiftPageState extends State { if (textEditingValue.text.isEmpty) { return const Iterable.empty(); } else { - return _viewModel.hospitalSuggestions - .where((word) => word - .toLowerCase() - .contains(textEditingValue.text.toLowerCase())); + return _viewModel.hospitalSuggestions.where((word) => word + .toLowerCase() + .contains(textEditingValue.text.toLowerCase())); } }, onSelected: (String selectedHospital) { @@ -143,10 +143,11 @@ class _EditMedicalShiftPageState extends State { // Better to set it once or if different. // For Simplicity in MVVM with TextField, often controller is local and syncs with VM. // Here we can initialize it. - if (controller.text.isEmpty && _viewModel.hospitalName.isNotEmpty) { - controller.text = _viewModel.hospitalName; + if (controller.text.isEmpty && + _viewModel.hospitalName.isNotEmpty) { + controller.text = _viewModel.hospitalName; } - + return TextField( controller: controller, onChanged: _viewModel.setHospitalName, @@ -184,21 +185,25 @@ class _EditMedicalShiftPageState extends State { initialValue: _viewModel.workload, ), const SizedBox(height: 15), - MyInputDate( - onChanged: _viewModel.setStartDate, - label: 'Data início', - // convertStringToDate helper from utils - selectedDate: convertStringToDate(_viewModel.startDate), - textColor: Theme.of(context).colorScheme.primary, - ), + Observer(builder: (_) { + return MyInputDate( + key: ValueKey(_viewModel.startDate), + onChanged: _viewModel.setStartDate, + label: 'Data início', + selectedDate: convertStringToDate(_viewModel.startDate), + textColor: Theme.of(context).colorScheme.primary, + ); + }), const SizedBox(height: 15), - MyInputTime( - label: 'Hora início', - // stringToTimeOfDay helper from utils - selectedTime: stringToTimeOfDay(_viewModel.startHour), - onChanged: _viewModel.setStartHour, - textColor: Theme.of(context).colorScheme.primary, - ), + Observer(builder: (_) { + return MyInputTime( + key: ValueKey(_viewModel.startHour), + label: 'Hora início', + selectedTime: stringToTimeOfDay(_viewModel.startHour), + onChanged: _viewModel.setStartHour, + textColor: Theme.of(context).colorScheme.primary, + ); + }), const SizedBox(height: 15), Autocomplete( optionsBuilder: (TextEditingValue textEditingValue) { @@ -224,10 +229,11 @@ class _EditMedicalShiftPageState extends State { }, fieldViewBuilder: (context, controller, focusNode, onEditingComplete) { - // Format intial amount if (controller.text.isEmpty && _viewModel.amount > 0) { - controller.text = NumberFormat.currency(locale: 'pt_BR', symbol: 'R\$').format(_viewModel.amount); + controller.text = + NumberFormat.currency(locale: 'pt_BR', symbol: 'R\$') + .format(_viewModel.amount); } return TextField( @@ -267,11 +273,99 @@ class _EditMedicalShiftPageState extends State { onChanged: _viewModel.setPaid, ), const SizedBox(height: 15), + // Color Picker + const Text("Cor do evento", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + )), + const SizedBox(height: 8), + Observer(builder: (_) { + Color currentColor = _viewModel.color != null + ? Color( + int.parse(_viewModel.color!.replaceAll('#', '0xFF'))) + : Theme.of(context).colorScheme.primary; + + return GestureDetector( + onTap: () { + showDialog( + context: context, + builder: (BuildContext context) { + Color pickerColor = currentColor; + return AlertDialog( + title: const Text('Escolha uma cor'), + content: SingleChildScrollView( + child: BlockPicker( + pickerColor: pickerColor, + onColorChanged: (Color color) { + pickerColor = color; + }, + ), + ), + actions: [ + TextButton( + child: const Text('Cancelar'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: const Text('Selecionar'), + onPressed: () { + // Format FF0000 -> #000000 + String hex = pickerColor.value + .toRadixString(16) + .padLeft(8, '0') + .toUpperCase(); + if (hex.length == 8) { + hex = hex.substring(2); + } + String hexColor = '#$hex'; + _viewModel.setColor(hexColor); + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + }, + child: Container( + height: 50, + decoration: BoxDecoration( + color: currentColor, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: Colors.grey), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.palette, + color: currentColor.computeLuminance() > 0.5 + ? Colors.black + : Colors.white), + const SizedBox(width: 8), + Text( + _viewModel.color ?? "Toque para selecionar", + style: TextStyle( + color: currentColor.computeLuminance() > 0.5 + ? Colors.black + : Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ); + }), + const SizedBox(height: 15), Center( child: Observer(builder: (_) { return MyButtonWidget( text: 'Salvar alterações', - isLoading: _viewModel.state == UpdateMedicalShiftState.loading, + isLoading: + _viewModel.state == UpdateMedicalShiftState.loading, disabledColor: Colors.grey, onTap: _viewModel.isValidData ? () async { diff --git a/med_system_app/lib/features/medical_shifts/pages/medical_shifts_page.dart b/med_system_app/lib/features/medical_shifts/pages/medical_shifts_page.dart index be21a18..9500f25 100644 --- a/med_system_app/lib/features/medical_shifts/pages/medical_shifts_page.dart +++ b/med_system_app/lib/features/medical_shifts/pages/medical_shifts_page.dart @@ -433,14 +433,29 @@ class _MedicalShiftsPageState extends State { ), ], ), - trailing: Text( - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - color: Theme.of(context) - .colorScheme - .primary), - medicalShift.amountCents ?? ""), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (medicalShift.color != null) + Container( + width: 12, + height: 12, + margin: const EdgeInsets.only(right: 8), + decoration: BoxDecoration( + color: Color(int.parse(medicalShift.color!.replaceAll('#', '0xFF'))), + shape: BoxShape.circle, + ), + ), + Text( + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 12, + color: Theme.of(context) + .colorScheme + .primary), + medicalShift.amountCents ?? ""), + ], + ), ), ); } else { diff --git a/med_system_app/lib/features/medical_shifts/pages/widgets/calendar_widget.dart b/med_system_app/lib/features/medical_shifts/pages/widgets/calendar_widget.dart index e1e5f06..d6b8533 100644 --- a/med_system_app/lib/features/medical_shifts/pages/widgets/calendar_widget.dart +++ b/med_system_app/lib/features/medical_shifts/pages/widgets/calendar_widget.dart @@ -138,23 +138,22 @@ class _CalendarWidgetState extends State { if (dayEvents.isNotEmpty) { return Positioned( bottom: 1, - right: 1, - child: Container( - padding: const EdgeInsets.all(4), - decoration: const BoxDecoration( - color: Colors.red, - shape: BoxShape.circle, - ), - child: dayEvents.length > 1 - ? Text( - '${dayEvents.length}', - style: const TextStyle( - color: Colors.white, - fontSize: 10, - fontWeight: FontWeight.bold, - ), - ) - : null, + child: Row( + mainAxisSize: MainAxisSize.min, + children: dayEvents.take(3).map((event) { + Color color = event.color != null + ? Color(int.parse(event.color!.replaceAll('#', '0xFF'))) + : Colors.red; + return Container( + margin: const EdgeInsets.symmetric(horizontal: 1.0), + width: 7, + height: 7, + decoration: BoxDecoration( + color: color, + shape: BoxShape.circle, + ), + ); + }).toList(), ), ); } diff --git a/med_system_app/lib/features/medical_shifts/presentation/viewmodels/create_medical_shift_viewmodel.dart b/med_system_app/lib/features/medical_shifts/presentation/viewmodels/create_medical_shift_viewmodel.dart index 7ec998d..2acff8c 100644 --- a/med_system_app/lib/features/medical_shifts/presentation/viewmodels/create_medical_shift_viewmodel.dart +++ b/med_system_app/lib/features/medical_shifts/presentation/viewmodels/create_medical_shift_viewmodel.dart @@ -58,6 +58,9 @@ abstract class _CreateMedicalShiftViewModelBase with Store { @observable String? endDate; + @observable + String? color; + @observable CreateMedicalShiftState state = CreateMedicalShiftState.idle; @@ -134,6 +137,9 @@ abstract class _CreateMedicalShiftViewModelBase with Store { @action void setEndDate(String? value) => endDate = value; + @action + void setColor(String? value) => color = value; + @action Future loadSuggestions() async { final hospResult = await getHospitalSuggestionsUseCase(const NoParams()); @@ -157,6 +163,7 @@ abstract class _CreateMedicalShiftViewModelBase with Store { startHour: startHour, amount: amount, paid: paid, + color: color, ); final result = await createMedicalShiftUseCase(params); @@ -212,6 +219,7 @@ abstract class _CreateMedicalShiftViewModelBase with Store { dayOfWeek = null; dayOfMonth = null; endDate = null; + color = null; state = CreateMedicalShiftState.idle; errorMessage = ''; } diff --git a/med_system_app/lib/features/medical_shifts/presentation/viewmodels/create_medical_shift_viewmodel.g.dart b/med_system_app/lib/features/medical_shifts/presentation/viewmodels/create_medical_shift_viewmodel.g.dart index a11b7c0..138a016 100644 --- a/med_system_app/lib/features/medical_shifts/presentation/viewmodels/create_medical_shift_viewmodel.g.dart +++ b/med_system_app/lib/features/medical_shifts/presentation/viewmodels/create_medical_shift_viewmodel.g.dart @@ -193,6 +193,22 @@ mixin _$CreateMedicalShiftViewModel on _CreateMedicalShiftViewModelBase, Store { }); } + late final _$colorAtom = + Atom(name: '_CreateMedicalShiftViewModelBase.color', context: context); + + @override + String? get color { + _$colorAtom.reportRead(); + return super.color; + } + + @override + set color(String? value) { + _$colorAtom.reportWrite(value, super.color, () { + super.color = value; + }); + } + late final _$stateAtom = Atom(name: '_CreateMedicalShiftViewModelBase.state', context: context); @@ -426,6 +442,18 @@ mixin _$CreateMedicalShiftViewModel on _CreateMedicalShiftViewModelBase, Store { } } + @override + void setColor(String? value) { + final _$actionInfo = _$_CreateMedicalShiftViewModelBaseActionController + .startAction(name: '_CreateMedicalShiftViewModelBase.setColor'); + try { + return super.setColor(value); + } finally { + _$_CreateMedicalShiftViewModelBaseActionController + .endAction(_$actionInfo); + } + } + @override void reset() { final _$actionInfo = _$_CreateMedicalShiftViewModelBaseActionController @@ -452,6 +480,7 @@ frequency: ${frequency}, dayOfWeek: ${dayOfWeek}, dayOfMonth: ${dayOfMonth}, endDate: ${endDate}, +color: ${color}, state: ${state}, errorMessage: ${errorMessage}, hospitalSuggestions: ${hospitalSuggestions}, diff --git a/med_system_app/lib/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.dart b/med_system_app/lib/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.dart index 333860d..a71408f 100644 --- a/med_system_app/lib/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.dart +++ b/med_system_app/lib/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.dart @@ -10,7 +10,8 @@ part 'update_medical_shift_viewmodel.g.dart'; enum UpdateMedicalShiftState { idle, loading, success, error } // ignore: library_private_types_in_public_api -class UpdateMedicalShiftViewModel = _UpdateMedicalShiftViewModelBase with _$UpdateMedicalShiftViewModel; +class UpdateMedicalShiftViewModel = _UpdateMedicalShiftViewModelBase + with _$UpdateMedicalShiftViewModel; abstract class _UpdateMedicalShiftViewModelBase with Store { final UpdateMedicalShiftUseCase updateMedicalShiftUseCase; @@ -39,16 +40,19 @@ abstract class _UpdateMedicalShiftViewModelBase with Store { @observable double amount = 0.0; - + // Helper for UI to show amount string, though UI can format double. // Actually UI uses setAmountCents with string. // I should provide getters if needed, but UI formats logic locally in TextField usually. - // But initial value for TextField comes from here. + // But initial value for TextField comes from here. // I'll add a getter for amountString if needed. @observable bool paid = false; + @observable + String? color; + @observable UpdateMedicalShiftState state = UpdateMedicalShiftState.idle; @@ -74,57 +78,78 @@ abstract class _UpdateMedicalShiftViewModelBase with Store { id = entity.id; hospitalName = entity.hospitalName ?? ''; workload = entity.workload ?? ''; - startDate = entity.startDate ?? ''; - startHour = entity.startHour ?? ''; + startDate = entity.startDate ?? entity.date ?? ''; + startHour = entity.startHour ?? entity.hour ?? ''; if (entity.amountCents != null) { - // amountCents in Entity is String e.g. "R$ 1.000,00" or similar? - // Wait, Check entity definition. - // Step 93 `medical_shift_model.dart`: `String? amountCents`. - // `MedicalShiftEntity`: `String? amountCents`. - // Repository `getMedicalShifts` -> `MedicalShiftListModel.fromJson`. - // `MedicalShiftModel.fromJson` sets `amountCents` as String. - // `MedicalShiftRepositoryImpl` uses `(amount * 100).toInt()` for creating. - // But when reading, it reads what? - // `MedicalShiftModel.fromJson` (Step 18 in Step 98 summary, created file): - // `amountCents = json['amount_cents'];` which is dynamic? - // If API returns int (cents), `amountCents` in Model/Entity should probably be int? - // Or is it formatted string "10000"? - // Code in `EditMedicalShiftStore`: - // `editMedicalShiftStore.amountCents` is String. - // `EditMedicalShiftStore`: `setAmountCents(String)` - // `addMedicalShiftStore`: `parseReal` logic. - // Ideally `Entity` has raw data. - // Start of code inspection: `c:\...\medical_shifts\model\medical_shift.model.dart` line 84: - // `amountCents = json['amount_cents'];` - // `String? amountCents;` - // If API returns int, and we assign to String? Dart runtime error if checking type? Or dynamic cast? - // If standard json decode, int to string doesn't happen automatically. - // `MedicalShiftRemoteDataSource`: `return MedicalShiftListModel.fromJson(json.decode(response.body));` - - // I should check `MedicalShiftEntity` definition again. - // Step 98 Summary: line 1 edited file. `MedicalShiftEntity`. I saw lines 1-71. - // I'll check `medical_shift_entity.dart`. + // amountCents in Entity is String e.g. "R$ 1.000,00" or similar? + // Wait, Check entity definition. + // Step 93 `medical_shift_model.dart`: `String? amountCents`. + // `MedicalShiftEntity`: `String? amountCents`. + // Repository `getMedicalShifts` -> `MedicalShiftListModel.fromJson`. + // `MedicalShiftModel.fromJson` sets `amountCents` as String. + // `MedicalShiftRepositoryImpl` uses `(amount * 100).toInt()` for creating. + // But when reading, it reads what? + // `MedicalShiftModel.fromJson` (Step 18 in Step 98 summary, created file): + // `amountCents = json['amount_cents'];` which is dynamic? + // If API returns int (cents), `amountCents` in Model/Entity should probably be int? + // Or is it formatted string "10000"? + // Code in `EditMedicalShiftStore`: + // `editMedicalShiftStore.amountCents` is String. + // `EditMedicalShiftStore`: `setAmountCents(String)` + // `addMedicalShiftStore`: `parseReal` logic. + // Ideally `Entity` has raw data. + // Start of code inspection: `c:\...\medical_shifts\model\medical_shift.model.dart` line 84: + // `amountCents = json['amount_cents'];` + // `String? amountCents;` + // If API returns int, and we assign to String? Dart runtime error if checking type? Or dynamic cast? + // If standard json decode, int to string doesn't happen automatically. + // `MedicalShiftRemoteDataSource`: `return MedicalShiftListModel.fromJson(json.decode(response.body));` + + // I should check `MedicalShiftEntity` definition again. + // Step 98 Summary: line 1 edited file. `MedicalShiftEntity`. I saw lines 1-71. + // I'll check `medical_shift_entity.dart`. } - + // Assuming Entity has amountCents as String (formatted or not). // If it is "R$ 100,00", parsing is hard. // If it is "10000" (cents string), it's easier. - + // I will try to parse it. if (entity.amountCents != null) { - try { - // Remove non-digits - String digits = entity.amountCents!.replaceAll(RegExp(r'[^0-9]'), ''); - int val = int.parse(digits); - amount = val / 100.0; - } catch (e) { - amount = 0.0; - } + try { + // Remove non-digits + String digits = entity.amountCents!.replaceAll(RegExp(r'[^0-9]'), ''); + int val = int.parse(digits); + amount = val / 100.0; + } catch (e) { + amount = 0.0; + } } else { amount = 0.0; } - + paid = entity.paid ?? false; + color = entity.color; + + // Fix Workload Mapping + if (workload == '6h') { + workload = 'six'; + } else if (workload == '12h') { + workload = 'twelve'; + } else if (workload == '24h') { + workload = 'twenty_four'; + } + + // Fix Date Format if needed (yyyy-MM-dd -> dd/MM/yyyy) + if (startDate.contains('-')) { + try { + DateTime parsedDate = DateTime.parse(startDate); + startDate = + "${parsedDate.day.toString().padLeft(2, '0')}/${parsedDate.month.toString().padLeft(2, '0')}/${parsedDate.year}"; + } catch (e) { + // Keep original if parse fails + } + } } @action @@ -152,11 +177,14 @@ abstract class _UpdateMedicalShiftViewModelBase with Store { @action void setPaid(bool value) => paid = value; + @action + void setColor(String? value) => color = value; + @action Future loadSuggestions() async { final hospResult = await getHospitalSuggestionsUseCase(const NoParams()); hospResult.fold((l) {}, (r) => hospitalSuggestions = ObservableList.of(r)); - + final amountResult = await getAmountSuggestionsUseCase(const NoParams()); amountResult.fold((l) {}, (r) => amountSuggestions = ObservableList.of(r)); } @@ -168,7 +196,7 @@ abstract class _UpdateMedicalShiftViewModelBase with Store { state = UpdateMedicalShiftState.error; return; } - + state = UpdateMedicalShiftState.loading; errorMessage = ''; @@ -180,6 +208,7 @@ abstract class _UpdateMedicalShiftViewModelBase with Store { startHour: startHour, amount: amount, paid: paid, + color: color, ); final result = await updateMedicalShiftUseCase(params); diff --git a/med_system_app/lib/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.g.dart b/med_system_app/lib/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.g.dart index 29cb751..5834889 100644 --- a/med_system_app/lib/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.g.dart +++ b/med_system_app/lib/features/medical_shifts/presentation/viewmodels/update_medical_shift_viewmodel.g.dart @@ -113,6 +113,22 @@ mixin _$UpdateMedicalShiftViewModel on _UpdateMedicalShiftViewModelBase, Store { }); } + late final _$colorAtom = + Atom(name: '_UpdateMedicalShiftViewModelBase.color', context: context); + + @override + String? get color { + _$colorAtom.reportRead(); + return super.color; + } + + @override + set color(String? value) { + _$colorAtom.reportWrite(value, super.color, () { + super.color = value; + }); + } + late final _$stateAtom = Atom(name: '_UpdateMedicalShiftViewModelBase.state', context: context); @@ -298,6 +314,18 @@ mixin _$UpdateMedicalShiftViewModel on _UpdateMedicalShiftViewModelBase, Store { } } + @override + void setColor(String? value) { + final _$actionInfo = _$_UpdateMedicalShiftViewModelBaseActionController + .startAction(name: '_UpdateMedicalShiftViewModelBase.setColor'); + try { + return super.setColor(value); + } finally { + _$_UpdateMedicalShiftViewModelBaseActionController + .endAction(_$actionInfo); + } + } + @override String toString() { return ''' @@ -307,6 +335,7 @@ startDate: ${startDate}, startHour: ${startHour}, amount: ${amount}, paid: ${paid}, +color: ${color}, state: ${state}, errorMessage: ${errorMessage}, hospitalSuggestions: ${hospitalSuggestions}, diff --git a/med_system_app/lib/features/patients/presentation/viewmodels/patient_list_viewmodel.dart b/med_system_app/lib/features/patients/presentation/viewmodels/patient_list_viewmodel.dart index 76465ca..c2ce490 100644 --- a/med_system_app/lib/features/patients/presentation/viewmodels/patient_list_viewmodel.dart +++ b/med_system_app/lib/features/patients/presentation/viewmodels/patient_list_viewmodel.dart @@ -62,6 +62,8 @@ abstract class _PatientListViewModelBase with Store { @action Future loadPatients({bool refresh = false}) async { + if (isLoading) return; + if (refresh) { currentPage = 1; patients.clear(); @@ -86,11 +88,23 @@ abstract class _PatientListViewModelBase with Store { if (refresh) { patients.clear(); } - patients.addAll(patientList); + + // Evita duplicação verificando se o item já existe (opcional, mas seguro) + // Ou simplesmente confia na paginação. + // Dado o relato de duplicação, vamos adicionar apenas os novos. + for (var patient in patientList) { + if (!patients.any((p) => p.id == patient.id)) { + patients.add(patient); + } + } + state = PatientListState.success; - if (!refresh) { - currentPage++; + // Só incrementa a página se retornou itens e se a quantidade retornada + // for igual ao perPage (indicando que pode haver mais). + // Como o perPage é 10000, dificilmente entrará aqui, o que é bom pois evita request da pag 2 indevido. + if (patientList.length >= perPage) { + currentPage++; } }, ); diff --git a/med_system_app/pubspec.lock b/med_system_app/pubspec.lock new file mode 100644 index 0000000..21afee0 --- /dev/null +++ b/med_system_app/pubspec.lock @@ -0,0 +1,1124 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 + url: "https://pub.dev" + source: hosted + version: "72.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.2" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 + url: "https://pub.dev" + source: hosted + version: "6.7.0" + archive: + dependency: transitive + description: + name: archive + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" + source: hosted + version: "3.6.1" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + brasil_fields: + dependency: "direct main" + description: + name: brasil_fields + sha256: "6c802e8629d8e5c81af32d611d1cf260d7ecc86b99e27c127f64490bf1606256" + url: "https://pub.dev" + source: hosted + version: "1.15.0" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + url: "https://pub.dev" + source: hosted + version: "2.4.13" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + url: "https://pub.dev" + source: hosted + version: "7.3.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "426cf75afdb23aa74bd4e471704de3f9393f3c7b04c1e2d9c6f1073ae0b8b139" + url: "https://pub.dev" + source: hosted + version: "8.12.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + chopper: + dependency: "direct main" + description: + name: chopper + sha256: "35cde96292178809ca4290f42dbb83d832551333c2b18a2226a2538103ab40d3" + url: "https://pub.dev" + source: hosted + version: "8.3.0" + chopper_generator: + dependency: "direct dev" + description: + name: chopper_generator + sha256: de438569cba1e2a2888e8d91e3c2ac60106574eea7f36823ed0334e96146328a + url: "https://pub.dev" + source: hosted + version: "8.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" + url: "https://pub.dev" + source: hosted + version: "4.10.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + url: "https://pub.dev" + source: hosted + version: "0.3.4+2" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" + url: "https://pub.dev" + source: hosted + version: "2.3.7" + dartz: + dependency: "direct main" + description: + name: dartz + sha256: e6acf34ad2e31b1eb00948692468c30ab48ac8250e0f0df661e29f12dd252168 + url: "https://pub.dev" + source: hosted + version: "0.10.1" + dropdown_search: + dependency: "direct main" + description: + name: dropdown_search + sha256: "55106e8290acaa97ed15bea1fdad82c3cf0c248dd410e651f5a8ac6870f783ab" + url: "https://pub.dev" + source: hosted + version: "5.0.6" + equatable: + dependency: "direct main" + description: + name: equatable + sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7" + url: "https://pub.dev" + source: hosted + version: "2.0.7" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_colorpicker: + dependency: "direct main" + description: + name: flutter_colorpicker + sha256: "969de5f6f9e2a570ac660fb7b501551451ea2a1ab9e2097e89475f60e07816ea" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter_launcher_icons: + dependency: "direct main" + description: + name: flutter_launcher_icons + sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7" + url: "https://pub.dev" + source: hosted + version: "0.14.4" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_mobx: + dependency: "direct main" + description: + name: flutter_mobx + sha256: ba5e93467866a2991259dc51cffd41ef45f695c667c2b8e7b087bf24118b50fe + url: "https://pub.dev" + source: hosted + version: "2.3.0" + flutter_pdfview: + dependency: "direct main" + description: + name: flutter_pdfview + sha256: c0b2cc4ebf461a5a4bb9312a165222475a7d93845c7a0703f4abb7f442eb6d54 + url: "https://pub.dev" + source: hosted + version: "1.4.3" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: da922f2aab2d733db7e011a6bcc4a825b844892d4edd6df83ff156b09a9b2e40 + url: "https://pub.dev" + source: hosted + version: "10.0.0" + flutter_secure_storage_darwin: + dependency: transitive + description: + name: flutter_secure_storage_darwin + sha256: "8878c25136a79def1668c75985e8e193d9d7d095453ec28730da0315dc69aee3" + url: "https://pub.dev" + source: hosted + version: "0.2.0" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: "2b5c76dce569ab752d55a1cee6a2242bcc11fdba927078fb88c503f150767cda" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: "8ceea1223bee3c6ac1a22dabd8feefc550e4729b3675de4b5900f55afcb435d6" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: "6a1137df62b84b54261dca582c1c09ea72f4f9a4b2fcee21b025964132d5d0c3" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: "3b7c8e068875dfd46719ff57c90d8c459c87f2302ed6b00ff006b3c9fcad1613" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + flutter_slidable: + dependency: "direct main" + description: + name: flutter_slidable + sha256: a857de7ea701f276fd6a6c4c67ae885b60729a3449e42766bb0e655171042801 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: d44bf546b13025ec7353091516f6881f1d4c633993cb109c3916c3a0159dadf1 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + freezed: + dependency: "direct main" + description: + name: freezed + sha256: "44c19278dd9d89292cf46e97dc0c1e52ce03275f40a97c5a348e802a924bf40e" + url: "https://pub.dev" + source: hosted + version: "2.5.7" + freezed_annotation: + dependency: "direct main" + description: + name: freezed_annotation + sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + url: "https://pub.dev" + source: hosted + version: "2.4.4" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + get_it: + dependency: "direct main" + description: + name: get_it + sha256: "1d648d2dd2047d7f7450d5727ca24ee435f240385753d90b49650e3cdff32e56" + url: "https://pub.dev" + source: hosted + version: "9.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + image: + dependency: transitive + description: + name: image + sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d + url: "https://pub.dev" + source: hosted + version: "4.3.0" + intl: + dependency: "direct main" + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" + source: hosted + version: "0.7.1" + json_annotation: + dependency: "direct main" + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: c2fcb3920cf2b6ae6845954186420fca40bc0a8abcc84903b7801f17d7050d7c + url: "https://pub.dev" + source: hosted + version: "6.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + logging: + dependency: "direct main" + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + lottie: + dependency: "direct main" + description: + name: lottie + sha256: fa39707f36786707b01eca7626d2c16c32aa603b3f3a146518518458847dc127 + url: "https://pub.dev" + source: hosted + version: "3.2.0" + macros: + dependency: transitive + description: + name: macros + sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" + url: "https://pub.dev" + source: hosted + version: "0.1.2-main.4" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mobx: + dependency: "direct main" + description: + name: mobx + sha256: bf1a90e5bcfd2851fc6984e20eef69557c65d9e4d0a88f5be4cf72c9819ce6b0 + url: "https://pub.dev" + source: hosted + version: "2.5.0" + mobx_codegen: + dependency: "direct dev" + description: + name: mobx_codegen + sha256: "990da80722f7d7c0017dec92040b31545d625b15d40204c36a1e63d167c73cdc" + url: "https://pub.dev" + source: hosted + version: "2.7.0" + mockito: + dependency: "direct main" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" + mocktail: + dependency: "direct dev" + description: + name: mocktail + sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2" + url: "https://pub.dev" + source: hosted + version: "2.2.15" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.dev" + source: hosted + version: "1.5.2" + provider: + dependency: transitive + description: + name: provider + sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" + url: "https://pub.dev" + source: hosted + version: "6.1.5+1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0" + url: "https://pub.dev" + source: hosted + version: "1.4.0" + qs_dart: + dependency: transitive + description: + name: qs_dart + sha256: "27da57e8b394163f96b74bccb6eb6115bfd2585de4b9ad6241bdf1a9797ab54f" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + share_plus: + dependency: "direct main" + description: + name: share_plus + sha256: fce43200aa03ea87b91ce4c3ac79f0cecd52e2a7a56c7a4185023c271fbfa6da + url: "https://pub.dev" + source: hosted + version: "10.1.4" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: cc012a23fc2d479854e6c80150696c4a5f5bb62cb89af4de1c505cf78d0a5d0b + url: "https://pub.dev" + source: hosted + version: "5.0.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + simple_gesture_detector: + dependency: transitive + description: + name: simple_gesture_detector + sha256: ba2cd5af24ff20a0b8d609cec3f40e5b0744d2a71804a2616ae086b9c19d19a3 + url: "https://pub.dev" + source: hosted + version: "0.2.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c" + url: "https://pub.dev" + source: hosted + version: "1.3.5" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + table_calendar: + dependency: "direct main" + description: + name: table_calendar + sha256: b2896b7c86adf3a4d9c911d860120fe3dbe03c85db43b22fd61f14ee78cdbb63 + url: "https://pub.dev" + source: hosted + version: "3.1.3" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + url: "https://pub.dev" + source: hosted + version: "0.7.2" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + uuid: + dependency: transitive + description: + name: uuid + sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8 + url: "https://pub.dev" + source: hosted + version: "4.5.2" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "44cc7104ff32563122a929e4620cf3efd584194eec6d1d913eb5ba593dbcf6de" + url: "https://pub.dev" + source: hosted + version: "1.1.18" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" + url: "https://pub.dev" + source: hosted + version: "1.1.13" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "1b4b9e706a10294258727674a340ae0d6e64a7231980f9f9a3d12e4b42407aad" + url: "https://pub.dev" + source: hosted + version: "1.1.16" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + url: "https://pub.dev" + source: hosted + version: "14.2.5" + watcher: + dependency: transitive + description: + name: watcher + sha256: f52385d4f73589977c80797e60fe51014f7f2b957b5e9a62c3f6ada439889249 + url: "https://pub.dev" + source: hosted + version: "1.2.0" + weak_map: + dependency: transitive + description: + name: weak_map + sha256: "5f8e5d5ce57dc624db5fae814dd689ccae1f17f92b426e52f0a7cbe7f6f4ab97" + url: "https://pub.dev" + source: hosted + version: "4.0.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webview_flutter: + dependency: "direct main" + description: + name: webview_flutter + sha256: "889a0a678e7c793c308c68739996227c9661590605e70b1f6cf6b9a6634f7aec" + url: "https://pub.dev" + source: hosted + version: "4.10.0" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + sha256: "512c26ccc5b8a571fd5d13ec994b7509f142ff6faf85835e243dde3538fdc713" + url: "https://pub.dev" + source: hosted + version: "4.3.2" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + sha256: "7cb32b21825bd65569665c32bb00a34ded5779786d6201f5350979d2d529940d" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + sha256: a3d461fe3467014e05f3ac4962e5fdde2a4bf44c561cb53e9ae5c586600fdbc3 + url: "https://pub.dev" + source: hosted + version: "3.22.0" + win32: + dependency: transitive + description: + name: win32 + sha256: daf97c9d80197ed7b619040e86c8ab9a9dad285e7671ee7390f9180cc828a51e + url: "https://pub.dev" + source: hosted + version: "5.10.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.24.0" diff --git a/med_system_app/pubspec.yaml b/med_system_app/pubspec.yaml index 4b6e05e..b9a086f 100644 --- a/med_system_app/pubspec.yaml +++ b/med_system_app/pubspec.yaml @@ -61,7 +61,8 @@ dependencies: intl: any dartz: ^0.10.1 equatable: ^2.0.5 - win32: 5.5.0 + flutter_colorpicker: ^1.1.0 + dev_dependencies: @@ -153,5 +154,4 @@ flutter: # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages -dependency_overrides: - win32: 5.5.0 + From c31ce0c27a76079cc47a0ed72355078b1912b99c Mon Sep 17 00:00:00 2001 From: roandersonpinheiro Date: Sat, 27 Dec 2025 16:37:13 -0300 Subject: [PATCH 2/4] Downgrade flutter_secure_storage to fix SDK compatibility --- med_system_app/pubspec.lock | 36 ++++++++++++++++++------------------ med_system_app/pubspec.yaml | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/med_system_app/pubspec.lock b/med_system_app/pubspec.lock index 21afee0..f3e0008 100644 --- a/med_system_app/pubspec.lock +++ b/med_system_app/pubspec.lock @@ -340,50 +340,50 @@ packages: dependency: "direct main" description: name: flutter_secure_storage - sha256: da922f2aab2d733db7e011a6bcc4a825b844892d4edd6df83ff156b09a9b2e40 + sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea" url: "https://pub.dev" source: hosted - version: "10.0.0" - flutter_secure_storage_darwin: + version: "9.2.4" + flutter_secure_storage_linux: dependency: transitive description: - name: flutter_secure_storage_darwin - sha256: "8878c25136a79def1668c75985e8e193d9d7d095453ec28730da0315dc69aee3" + name: flutter_secure_storage_linux + sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688 url: "https://pub.dev" source: hosted - version: "0.2.0" - flutter_secure_storage_linux: + version: "1.2.3" + flutter_secure_storage_macos: dependency: transitive description: - name: flutter_secure_storage_linux - sha256: "2b5c76dce569ab752d55a1cee6a2242bcc11fdba927078fb88c503f150767cda" + name: flutter_secure_storage_macos + sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.1.3" flutter_secure_storage_platform_interface: dependency: transitive description: name: flutter_secure_storage_platform_interface - sha256: "8ceea1223bee3c6ac1a22dabd8feefc550e4729b3675de4b5900f55afcb435d6" + sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "1.1.2" flutter_secure_storage_web: dependency: transitive description: name: flutter_secure_storage_web - sha256: "6a1137df62b84b54261dca582c1c09ea72f4f9a4b2fcee21b025964132d5d0c3" + sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "1.2.1" flutter_secure_storage_windows: dependency: transitive description: name: flutter_secure_storage_windows - sha256: "3b7c8e068875dfd46719ff57c90d8c459c87f2302ed6b00ff006b3c9fcad1613" + sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "3.1.2" flutter_slidable: dependency: "direct main" description: @@ -510,10 +510,10 @@ packages: dependency: transitive description: name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.7.1" + version: "0.6.7" json_annotation: dependency: "direct main" description: diff --git a/med_system_app/pubspec.yaml b/med_system_app/pubspec.yaml index b9a086f..32296ff 100644 --- a/med_system_app/pubspec.yaml +++ b/med_system_app/pubspec.yaml @@ -42,7 +42,7 @@ dependencies: logging: ^1.2.0 flutter_localizations: sdk: flutter - flutter_secure_storage: ^10.0.0 + flutter_secure_storage: ^9.0.0 freezed: ^2.4.5 flutter_svg: ^2.0.10+1 freezed_annotation: ^2.4.1 From f1f82e86c5096d4b0daeebcd6af1981ac28d761a Mon Sep 17 00:00:00 2001 From: roandersonpinheiro Date: Sat, 27 Dec 2025 16:40:07 -0300 Subject: [PATCH 3/4] Remove unused import in HomePage --- med_system_app/lib/features/home/pages/home_page.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/med_system_app/lib/features/home/pages/home_page.dart b/med_system_app/lib/features/home/pages/home_page.dart index 902644b..e3a2f0b 100755 --- a/med_system_app/lib/features/home/pages/home_page.dart +++ b/med_system_app/lib/features/home/pages/home_page.dart @@ -18,7 +18,6 @@ import 'package:distrito_medico/features/medical_shifts/pages/add_medical_shift_ import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:get_it/get_it.dart'; -import 'package:intl/intl.dart'; class HomePage extends StatefulWidget { const HomePage({super.key}); From 875a151341d923d4065185904d2c192d8b0e6d3e Mon Sep 17 00:00:00 2001 From: roandersonpinheiro Date: Sat, 27 Dec 2025 16:45:23 -0300 Subject: [PATCH 4/4] Fix deprecated Chopper annotations --- .../api/services/auth/sign_in.service.dart | 4 +-- .../doctor_registration/sign_up.service.dart | 4 +-- .../event_procedure.service.dart | 22 ++++++++-------- .../events/events_procedure.service.dart | 4 +-- .../health_insurances.service.dart | 10 +++---- .../services/hospitals/hospital.service.dart | 8 +++--- .../medical_shift/medical_shift.service.dart | 26 +++++++++---------- .../medical_shift_recurrence.service.dart | 6 ++--- .../services/patients/patient.service.dart | 10 +++---- .../procedures/procedure.service.dart | 12 ++++----- 10 files changed, 53 insertions(+), 53 deletions(-) diff --git a/med_system_app/lib/core/api/services/auth/sign_in.service.dart b/med_system_app/lib/core/api/services/auth/sign_in.service.dart index 69822a4..cd9e83c 100644 --- a/med_system_app/lib/core/api/services/auth/sign_in.service.dart +++ b/med_system_app/lib/core/api/services/auth/sign_in.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "sign_in.service.chopper.dart"; @@ -7,6 +7,6 @@ part "sign_in.service.chopper.dart"; abstract class SignInService extends ChopperService { static SignInService create([ChopperClient? client]) => _$SignInService(client); - @Post(path: 'users/tokens/sign_in') + @POST(path: 'users/tokens/sign_in') Future signIn(@Body() dynamic body); } diff --git a/med_system_app/lib/core/api/services/doctor_registration/sign_up.service.dart b/med_system_app/lib/core/api/services/doctor_registration/sign_up.service.dart index 58572eb..8111c0f 100644 --- a/med_system_app/lib/core/api/services/doctor_registration/sign_up.service.dart +++ b/med_system_app/lib/core/api/services/doctor_registration/sign_up.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "sign_up.service.chopper.dart"; @@ -7,6 +7,6 @@ part "sign_up.service.chopper.dart"; abstract class SignUpService extends ChopperService { static SignUpService create([ChopperClient? client]) => _$SignUpService(client); - @Post(path: 'users/tokens/sign_up') + @POST(path: 'users/tokens/sign_up') Future signUp(@Body() dynamic body); } diff --git a/med_system_app/lib/core/api/services/event_procedures/event_procedure.service.dart b/med_system_app/lib/core/api/services/event_procedures/event_procedure.service.dart index 9b34c14..f43a787 100644 --- a/med_system_app/lib/core/api/services/event_procedures/event_procedure.service.dart +++ b/med_system_app/lib/core/api/services/event_procedures/event_procedure.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "event_procedure.service.chopper.dart"; @@ -8,41 +8,41 @@ abstract class EventProcedureService extends ChopperService { static EventProcedureService create([ChopperClient? client]) => _$EventProcedureService(client); - @Get(path: 'api/v1/event_procedures') + @GET(path: 'api/v1/event_procedures') Future getAllEventProcedures( @Query('page') int page, @Query('per_page') int perPage, ); - @Get(path: 'api/v1/event_procedures') + @GET(path: 'api/v1/event_procedures') Future getAllEventProceduresByPaid(@Query('page') int page, @Query('per_page') int perPage, @Query('paid') bool paid); - @Get(path: 'api/v1/event_procedures') + @GET(path: 'api/v1/event_procedures') Future getAllEventProceduresByMonth(@Query('page') int page, @Query('per_page') int perPage, @Query('month') int month); - @Get(path: 'api/v1/event_procedures') + @GET(path: 'api/v1/event_procedures') Future getLatestEventProcedures( @Query('page') int page, @Query('per_page') int perPage, @Query('year') int? year, ); - @Post(path: 'api/v1/event_procedures') + @POST(path: 'api/v1/event_procedures') Future registerEventProcedure(@Body() dynamic body); - @Put(path: 'api/v1/event_procedures/{id}') + @PUT(path: 'api/v1/event_procedures/{id}') Future editEventProcedure(@Path('id') id, @Body() dynamic body); - @Put(path: 'api/v1/event_procedures/{id}') + @PUT(path: 'api/v1/event_procedures/{id}') Future editPaymentEventProcedure( @Path('id') id, @Body() dynamic body); - @Delete(path: 'api/v1/event_procedures/{id}') + @DELETE(path: 'api/v1/event_procedures/{id}') Future deleteEventProcedure(@Path('id') id); - @Get(path: 'api/v1/event_procedures') + @GET(path: 'api/v1/event_procedures') Future getEventProceduresByFilters({ @Query('page') int? page, @Query('per_page') int? perPage, @@ -53,7 +53,7 @@ abstract class EventProcedureService extends ChopperService { @Query('hospital[name]') String? hospitalName, }); - @Get(path: 'api/v1/pdf_reports/generate') + @GET(path: 'api/v1/pdf_reports/generate') Future generatePdfReport({ @Query('entity_name') String? entityName, @Query('month') int? month, diff --git a/med_system_app/lib/core/api/services/events/events_procedure.service.dart b/med_system_app/lib/core/api/services/events/events_procedure.service.dart index 7fa22dc..f5f6ccc 100644 --- a/med_system_app/lib/core/api/services/events/events_procedure.service.dart +++ b/med_system_app/lib/core/api/services/events/events_procedure.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "events_procedure.service.chopper.dart"; @@ -7,6 +7,6 @@ part "events_procedure.service.chopper.dart"; abstract class EventsService extends ChopperService { static EventsService create([ChopperClient? client]) => _$EventsService(client); - @Get(path: 'api/v1/event_procedures') + @GET(path: 'api/v1/event_procedures') Future getAllProcedures(); } diff --git a/med_system_app/lib/core/api/services/health_insurances/health_insurances.service.dart b/med_system_app/lib/core/api/services/health_insurances/health_insurances.service.dart index 7f6f789..c013844 100644 --- a/med_system_app/lib/core/api/services/health_insurances/health_insurances.service.dart +++ b/med_system_app/lib/core/api/services/health_insurances/health_insurances.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "health_insurances.service.chopper.dart"; @@ -8,18 +8,18 @@ abstract class HealthInsurancesService extends ChopperService { static HealthInsurancesService create([ChopperClient? client]) => _$HealthInsurancesService(client); - @Get(path: 'api/v1/health_insurances') + @GET(path: 'api/v1/health_insurances') Future getAllHealthInsurances( {@Query('page') int? page, @Query('per_page') int? perPage, @Query('custom') bool? custom}); - @Get(path: 'api/v1/health_insurances') + @GET(path: 'api/v1/health_insurances') Future getAllHealthInsurancesByCustom(@Query('custom') bool custom); - @Post(path: 'api/v1/health_insurances') + @POST(path: 'api/v1/health_insurances') Future registerHealthInsurances(@Body() dynamic body); - @Put(path: 'api/v1/health_insurances/{id}') + @PUT(path: 'api/v1/health_insurances/{id}') Future editHealthInsurance(@Path('id') id, @Body() dynamic body); } diff --git a/med_system_app/lib/core/api/services/hospitals/hospital.service.dart b/med_system_app/lib/core/api/services/hospitals/hospital.service.dart index 41fe131..62ccbb7 100644 --- a/med_system_app/lib/core/api/services/hospitals/hospital.service.dart +++ b/med_system_app/lib/core/api/services/hospitals/hospital.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "hospital.service.chopper.dart"; @@ -8,13 +8,13 @@ abstract class HospitalService extends ChopperService { static HospitalService create([ChopperClient? client]) => _$HospitalService(client); - @Get(path: 'api/v1/hospitals') + @GET(path: 'api/v1/hospitals') Future getAllHospitals( @Query('page') int page, @Query('per_page') int perPage); - @Post(path: 'api/v1/hospitals') + @POST(path: 'api/v1/hospitals') Future registerHospital(@Body() dynamic body); - @Put(path: 'api/v1/hospitals/{id}') + @PUT(path: 'api/v1/hospitals/{id}') Future editHospital(@Path('id') id, @Body() dynamic body); } diff --git a/med_system_app/lib/core/api/services/medical_shift/medical_shift.service.dart b/med_system_app/lib/core/api/services/medical_shift/medical_shift.service.dart index b263c92..cab3ecd 100644 --- a/med_system_app/lib/core/api/services/medical_shift/medical_shift.service.dart +++ b/med_system_app/lib/core/api/services/medical_shift/medical_shift.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "medical_shift.service.chopper.dart"; @@ -8,50 +8,50 @@ abstract class MedicalShiftService extends ChopperService { static MedicalShiftService create([ChopperClient? client]) => _$MedicalShiftService(client); - @Post(path: 'api/v1/medical_shifts') + @POST(path: 'api/v1/medical_shifts') Future registerMedicalShift(@Body() dynamic body); - @Get(path: 'api/v1/medical_shifts') + @GET(path: 'api/v1/medical_shifts') Future getAllMedicalShifts( @Query('page') int page, @Query('per_page') int perPage, ); - @Get(path: 'api/v1/medical_shifts') + @GET(path: 'api/v1/medical_shifts') Future getAllMedicalShiftsByPaid(@Query('page') int page, @Query('per_page') int perPage, @Query('paid') bool paid); - @Get(path: 'api/v1/medical_shifts') + @GET(path: 'api/v1/medical_shifts') Future getAllMedicalShiftsByMonth( @Query('page') int page, @Query('per_page') int perPage, @Query('month') int month, @Query('year') int year); - @Put(path: 'api/v1/medical_shifts/{id}') + @PUT(path: 'api/v1/medical_shifts/{id}') Future editPaymentMedicalShift( @Path('id') id, @Body() dynamic body); - @Put(path: 'api/v1/medical_shifts/{id}') + @PUT(path: 'api/v1/medical_shifts/{id}') Future editMedicalShift(@Path('id') id, @Body() dynamic body); - @Delete(path: 'api/v1/medical_shifts/{id}') + @DELETE(path: 'api/v1/medical_shifts/{id}') Future deleteEventMedicalShifts(@Path('id') id); - @Get(path: 'api/v1/medical_shifts/amount_suggestions') + @GET(path: 'api/v1/medical_shifts/amount_suggestions') Future getAmountSuggetions(); - @Get(path: 'api/v1/medical_shifts/hospital_name_suggestion') + @GET(path: 'api/v1/medical_shifts/hospital_name_suggestion') Future getHospitalSuggetions(); - @Get(path: 'api/v1/medical_shifts') + @GET(path: 'api/v1/medical_shifts') Future getLatestMedicalShifts( @Query('page') int page, @Query('per_page') int perPage, @Query('year') int? year, ); - @Get(path: 'api/v1/medical_shifts') + @GET(path: 'api/v1/medical_shifts') Future getMedicalShiftsByFilters({ @Query('page') int? page, @Query('per_page') int? perPage, @@ -61,7 +61,7 @@ abstract class MedicalShiftService extends ChopperService { @Query('hospital_name') String? hospitalName, }); - @Get(path: 'api/v1/pdf_reports/generate') + @GET(path: 'api/v1/pdf_reports/generate') Future generatePdfReport({ @Query('entity_name') String? entityName, @Query('month') int? month, diff --git a/med_system_app/lib/core/api/services/medical_shift_recurrences/medical_shift_recurrence.service.dart b/med_system_app/lib/core/api/services/medical_shift_recurrences/medical_shift_recurrence.service.dart index b767c94..07375f1 100644 --- a/med_system_app/lib/core/api/services/medical_shift_recurrences/medical_shift_recurrence.service.dart +++ b/med_system_app/lib/core/api/services/medical_shift_recurrences/medical_shift_recurrence.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "medical_shift_recurrence.service.chopper.dart"; @@ -8,9 +8,9 @@ abstract class MedicalShiftRecurrenceService extends ChopperService { static MedicalShiftRecurrenceService create([ChopperClient? client]) => _$MedicalShiftRecurrenceService(client); - @Post(path: 'api/v1/medical_shift_recurrences') + @POST(path: 'api/v1/medical_shift_recurrences') Future createMedicalShiftRecurrence(@Body() dynamic body); - @Delete(path: 'api/v1/medical_shift_recurrences/{id}') + @DELETE(path: 'api/v1/medical_shift_recurrences/{id}') Future deleteMedicalShiftRecurrence(@Path('id') id); } diff --git a/med_system_app/lib/core/api/services/patients/patient.service.dart b/med_system_app/lib/core/api/services/patients/patient.service.dart index 74d3fa6..9b4fb69 100644 --- a/med_system_app/lib/core/api/services/patients/patient.service.dart +++ b/med_system_app/lib/core/api/services/patients/patient.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "patient.service.chopper.dart"; @@ -7,16 +7,16 @@ part "patient.service.chopper.dart"; abstract class PatientService extends ChopperService { static PatientService create([ChopperClient? client]) => _$PatientService(client); - @Get(path: 'api/v1/patients') + @GET(path: 'api/v1/patients') Future getAllPatients( @Query('page') int page, @Query('per_page') int perPage); - @Post(path: 'api/v1/patients') + @POST(path: 'api/v1/patients') Future registerPatient(@Body() dynamic body); - @Put(path: 'api/v1/patients/{id}') + @PUT(path: 'api/v1/patients/{id}') Future editPatient(@Path('id') id, @Body() dynamic body); - @Delete(path: 'api/v1/patients/{id}') + @DELETE(path: 'api/v1/patients/{id}') Future deletePatient(@Path('id') id); } diff --git a/med_system_app/lib/core/api/services/procedures/procedure.service.dart b/med_system_app/lib/core/api/services/procedures/procedure.service.dart index 0195f55..a8deb8b 100644 --- a/med_system_app/lib/core/api/services/procedures/procedure.service.dart +++ b/med_system_app/lib/core/api/services/procedures/procedure.service.dart @@ -1,4 +1,4 @@ -import "dart:async"; +import "dart:async"; import 'package:chopper/chopper.dart'; part "procedure.service.chopper.dart"; @@ -7,19 +7,19 @@ part "procedure.service.chopper.dart"; abstract class ProcedureService extends ChopperService { static ProcedureService create([ChopperClient? client]) => _$ProcedureService(client); - @Get(path: 'api/v1/procedures') + @GET(path: 'api/v1/procedures') Future getAllProcedures( @Query('page') int page, @Query('per_page') int perPage); - @Get(path: 'api/v1/procedures') + @GET(path: 'api/v1/procedures') Future getProcedures(); - @Get(path: 'api/v1/procedures') + @GET(path: 'api/v1/procedures') Future getProceduresByCustom(@Query('custom') bool custom); - @Post(path: 'api/v1/procedures') + @POST(path: 'api/v1/procedures') Future registerProcedure(@Body() dynamic body); - @Put(path: 'api/v1/procedures/{id}') + @PUT(path: 'api/v1/procedures/{id}') Future editProcedure(@Path('id') id, @Body() dynamic body); }