3/1/1
This commit is contained in:
@@ -17,15 +17,36 @@ class CaptainProfileController extends GetxController {
|
||||
TextEditingController expirationDate = TextEditingController();
|
||||
|
||||
Future updateFields() async {
|
||||
var res = await CRUD().post(link: AppLink.updateRegisrationCar, payload: {
|
||||
var payload = {
|
||||
'driverID': box.read(BoxName.driverID),
|
||||
'vin': vin.text,
|
||||
'color': color.text,
|
||||
'model': model.text,
|
||||
'make': make.text,
|
||||
'year': year.text,
|
||||
'expirationDate': expirationDate.text,
|
||||
});
|
||||
};
|
||||
|
||||
if (vin.text.isNotEmpty) {
|
||||
payload['vin'] = vin.text;
|
||||
}
|
||||
|
||||
if (color.text.isNotEmpty) {
|
||||
payload['color'] = color.text;
|
||||
}
|
||||
|
||||
if (model.text.isNotEmpty) {
|
||||
payload['model'] = model.text;
|
||||
}
|
||||
|
||||
if (make.text.isNotEmpty) {
|
||||
payload['make'] = make.text;
|
||||
}
|
||||
|
||||
if (year.text.isNotEmpty) {
|
||||
payload['year'] = year.text;
|
||||
}
|
||||
|
||||
if (expirationDate.text.isNotEmpty) {
|
||||
payload['expiration_date'] = expirationDate.text;
|
||||
}
|
||||
|
||||
var res =
|
||||
await CRUD().post(link: AppLink.updateRegisrationCar, payload: payload);
|
||||
|
||||
if (jsonDecode(res)['status'] == 'success') {
|
||||
box.write(BoxName.vin, vin.text);
|
||||
@@ -34,7 +55,7 @@ class CaptainProfileController extends GetxController {
|
||||
box.write(BoxName.make, make.text);
|
||||
box.write(BoxName.year, year.text);
|
||||
box.write(BoxName.expirationDate, expirationDate.text);
|
||||
|
||||
update();
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
@@ -56,7 +77,7 @@ class CaptainProfileController extends GetxController {
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
if (box.read(BoxName.dobDriver).toString().isEmpty) {
|
||||
if (box.read(BoxName.dobDriver) == null) {
|
||||
getProfileData();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user