Skip to content

Commit

Permalink
Requests bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Davipcrs committed Oct 25, 2023
1 parent 120106d commit eab5a42
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/controller/api/api_services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import 'package:parking_app/model/veicule_model.dart';
final dio = Dio();

class ApiServices {
static const __serverIP = "192.168.0.2";
//static const __serverIP = "192.168.0.2";
static const __serverIP = "192.168.0.10";
//static const __serverHostname = "";
static const __port = 8000;
final endpoint = "http://$__serverIP:$__port";
Expand Down
2 changes: 1 addition & 1 deletion lib/view/add_veicule_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class AddVeiculeWidget extends ConsumerWidget {

// in the JSON pass the licenseController.text in UPPERCASE.
// API POST
ref.invalidate(apiVeiculeByDateProvider);

ref.invalidate(addVeiculeHasKey);
ref.invalidate(addVeiculeIsSubscriber);
ref.invalidate(addVeiculeIsMotorBike);
Expand Down
23 changes: 18 additions & 5 deletions lib/view/veicule_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,25 @@ class VeiculeInfoView extends ConsumerWidget {
child: ElevatedButton(
onPressed: () {
Veicule data = selectedVeicule;
data.str_timeout =
"${TimeOfDay.now().hour.toString()}:${TimeOfDay.now().minute.toString()}";
TimeOfDay timeOut = TimeOfDay.now();
late String hour;
late String minute;
if (timeOut.hour.toInt() < 10) {
hour = "0${timeOut.hour.toString()}";
} else {
hour = timeOut.hour.toString();
}
if (timeOut.minute.toInt() < 10) {
minute = "0${timeOut.minute.toString()}";
} else {
minute = timeOut.minute.toString();
}

data.str_timeout = "$hour:$minute";
ref
.read(apiPatchVeiculeProvider.notifier)
.patchVeicule(data);
ref.invalidate(apiVeiculeByDateProvider);

ref.invalidate(editVeiculeReadOnlyFields);
ref.invalidate(editVeiculeHasKey);
ref.invalidate(editVeiculeHasPaidEarly);
Expand All @@ -334,7 +347,7 @@ class VeiculeInfoView extends ConsumerWidget {
onPressed: () {
if (readOnly == false) {
Veicule data = selectedVeicule;
data.str_license = veiculeLicense.text;
data.str_license = veiculeLicense.text.toUpperCase();
data.str_timein = timeIn.text;
data.str_timeout = timeOut.text;
data.bool_haskey = hasKey;
Expand All @@ -345,7 +358,7 @@ class VeiculeInfoView extends ConsumerWidget {
ref
.read(apiPatchVeiculeProvider.notifier)
.patchVeicule(data);
ref.invalidate(apiVeiculeByDateProvider);

ref.invalidate(editVeiculeReadOnlyFields);
ref.invalidate(editVeiculeHasKey);
ref.invalidate(editVeiculeHasPaidEarly);
Expand Down
5 changes: 4 additions & 1 deletion lib/view/veicule_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class VeiculeViewWidget extends ConsumerWidget {
// ADD VEICULE VIEW!!
ref.invalidate(addVeiculeLicenseValidator);
ref.invalidate(addVeiculeSelectedSubscriber);
context.push("/add-veicule");
context
.push("/add-veicule")
.then((value) => ref.invalidate(apiVeiculeByDateProvider));
},
child: const Icon(Icons.add),
),
Expand Down Expand Up @@ -99,6 +101,7 @@ class VeiculeViewWidget extends ConsumerWidget {
ref.invalidate(editVeiculeLicenseText);
ref.invalidate(editVeiculeTimeInText);
ref.invalidate(editVeiculeTimeOutText);
ref.invalidate(apiVeiculeByDateProvider);
},
);
},
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
version: 1.0.1+1

environment:
sdk: '>=3.0.6 <4.0.0'
Expand Down

0 comments on commit eab5a42

Please sign in to comment.