implement vehicle crud screens
This commit is contained in:
parent
2506ea1270
commit
083f2d200d
|
@ -31,20 +31,17 @@ class PhpGroup extends Api {
|
|||
static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall();
|
||||
static ChangePasswordCall changePasswordCall = ChangePasswordCall();
|
||||
static GetLocalsCall getLocalsCall = GetLocalsCall();
|
||||
static PostScheduleVisitorCall postScheduleVisitorCall =
|
||||
PostScheduleVisitorCall();
|
||||
static PostScheduleVisitorCall postScheduleVisitorCall = PostScheduleVisitorCall();
|
||||
static PostScheduleVisitCall postScheduleVisitCall = PostScheduleVisitCall();
|
||||
static GetScheduleVisitCall getScheduleVisitCall = GetScheduleVisitCall();
|
||||
static GetDadosCall getDadosCall = GetDadosCall();
|
||||
static GetVisitorByDocCall getVisitorByDocCall = GetVisitorByDocCall();
|
||||
static GetFotoVisitanteCall getFotoVisitanteCall = GetFotoVisitanteCall();
|
||||
static PostProvVisitSchedulingCall postProvVisitSchedulingCall =
|
||||
PostProvVisitSchedulingCall();
|
||||
static PostProvVisitSchedulingCall postProvVisitSchedulingCall = PostProvVisitSchedulingCall();
|
||||
static GetVisitsCall getVisitsCall = GetVisitsCall();
|
||||
static DeleteVisitCall deleteVisitCall = DeleteVisitCall();
|
||||
static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall();
|
||||
static RespondeSolicitacaoCall respondeSolicitacaoCall =
|
||||
RespondeSolicitacaoCall();
|
||||
static RespondeSolicitacaoCall respondeSolicitacaoCall = RespondeSolicitacaoCall();
|
||||
static GetAccessCall getAccessCall = GetAccessCall();
|
||||
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
||||
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
||||
|
@ -63,22 +60,134 @@ class PhpGroup extends Api {
|
|||
static GetPetPhoto getPetPhoto = GetPetPhoto();
|
||||
static UnregisterDevice unregisterDevice = UnregisterDevice();
|
||||
static GetVehiclesByProperty getVehiclesByProperty = GetVehiclesByProperty();
|
||||
static GetResidentsByProperty getResidentsByProperty =
|
||||
GetResidentsByProperty();
|
||||
static GetResidentsByProperty getResidentsByProperty = GetResidentsByProperty();
|
||||
static GetOpenedVisits getOpenedVisits = GetOpenedVisits();
|
||||
GetLicense getLicense = GetLicense();
|
||||
static GetProvSchedules getProvSchedules = GetProvSchedules();
|
||||
static RegisterVehicle registerVehicle = RegisterVehicle();
|
||||
static UpdateVehicle updateVehicle = UpdateVehicle();
|
||||
static DeleteVehicle deleteVehicle = DeleteVehicle();
|
||||
}
|
||||
|
||||
class DeleteVehicle {
|
||||
Future<ApiCallResponse> call({vehicleId}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'excluirVeiculo';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'deleteVehicle',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
params: {
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'vehicleId': vehicleId,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RegisterVehicle {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? licensePlate,
|
||||
final String? color,
|
||||
final String? model,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'cadastrarVeiculo';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'registerVehicle',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
params: {
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'licensePlate': licensePlate,
|
||||
'color': color,
|
||||
'model': model,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UpdateVehicle {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? vehicleId,
|
||||
final String? licensePlate,
|
||||
final String? color,
|
||||
final String? model,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'atualizarVeiculo';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'updateVehicle',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
params: {
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'licensePlate': licensePlate,
|
||||
'color': color,
|
||||
'model': model,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GetProvSchedules {
|
||||
Future<ApiCallResponse> call(final String page, final String status) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getAgendamentoProv';
|
||||
const String pageSize = '10';
|
||||
final bool isFiltered = status != '' && status != '.*';
|
||||
|
@ -111,12 +220,9 @@ class GetProvSchedules {
|
|||
class GetOpenedVisits {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getOpenedVisits';
|
||||
const String pageSize = '10';
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -146,12 +252,9 @@ class GetOpenedVisits {
|
|||
class GetResidentsByProperty {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
||||
final String userUUID =
|
||||
await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
|
||||
final String cliID =
|
||||
await StorageHelper().get(ProfileStorageKey.clientUUID.key) ?? '';
|
||||
final String devUUID = await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
||||
final String userUUID = await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
|
||||
final String cliID = await StorageHelper().get(ProfileStorageKey.clientUUID.key) ?? '';
|
||||
const String atividade = 'getResidentsByProperty';
|
||||
const String pageSize = '10';
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -180,12 +283,9 @@ class GetResidentsByProperty {
|
|||
class GetVehiclesByProperty {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getVehiclesByProperty';
|
||||
const String pageSize = '10';
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -216,12 +316,9 @@ class GetVehiclesByProperty {
|
|||
class GetLicense {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getLicense',
|
||||
|
@ -250,10 +347,8 @@ class GetLicense {
|
|||
class UnregisterDevice {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'unregisterDevice',
|
||||
|
@ -280,12 +375,9 @@ class UnregisterDevice {
|
|||
class DeletePet {
|
||||
Future<ApiCallResponse> call({final int? petID = 0}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'excluirPet';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -328,12 +420,9 @@ class UpdatePet {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'atualizarPet';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -354,9 +443,7 @@ class UpdatePet {
|
|||
'species': species,
|
||||
'breed': breed,
|
||||
if (color != '') 'color': color,
|
||||
if (birthdayDate != '')
|
||||
'birthdayDate':
|
||||
ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
||||
if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
||||
'gender': gender,
|
||||
'size': size,
|
||||
if (notes != '') 'notes': notes,
|
||||
|
@ -379,12 +466,9 @@ class GetPets {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'consultaPets';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -416,12 +500,9 @@ class GetPetPhoto {
|
|||
Future<ApiCallResponse> call({final int? petId}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'consultaFotoPet';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -462,12 +543,9 @@ class RegisterPet {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'cadastrarPet';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -487,9 +565,7 @@ class RegisterPet {
|
|||
'species': species,
|
||||
'breed': breed,
|
||||
if (color != '') 'color': color,
|
||||
if (birthdayDate != '')
|
||||
'birthdayDate':
|
||||
ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
||||
if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
||||
'gender': gender,
|
||||
'size': size,
|
||||
if (notes != '') 'notes': notes,
|
||||
|
@ -512,12 +588,9 @@ class BuscaEnconcomendas {
|
|||
final String? adresseeType,
|
||||
final String? status,
|
||||
}) async {
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getEncomendas';
|
||||
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
@ -559,12 +632,9 @@ class CancelaVisita {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'cancelaVisita';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -596,10 +666,8 @@ class CancelaVisita {
|
|||
|
||||
class DeleteAccount {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -630,12 +698,9 @@ class ChangePanic {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -669,12 +734,9 @@ class ChangePass {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -708,12 +770,9 @@ class RespondeVinculo {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'respondeVinculo',
|
||||
|
@ -745,12 +804,9 @@ class ChangeNotifica {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -782,14 +838,10 @@ class UpdateIDE {
|
|||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String newIde =
|
||||
(await StorageHelper().get(ProfileStorageKey.userDevUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String newIde = (await StorageHelper().get(ProfileStorageKey.userDevUUID.key)) ?? '';
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -821,12 +873,9 @@ class UpdToken {
|
|||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String token =
|
||||
(await StorageHelper().get(SecureStorageKey.token.value)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String token = (await StorageHelper().get(SecureStorageKey.token.value)) ?? '';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'updToken',
|
||||
|
@ -853,17 +902,11 @@ class UpdToken {
|
|||
class LoginCall {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String email =
|
||||
(await StorageHelper().get(SecureStorageKey.email.value)) ?? '';
|
||||
final String password =
|
||||
(await StorageHelper().get(SecureStorageKey.password.value)) ?? '';
|
||||
final String type =
|
||||
(await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? '';
|
||||
final String description =
|
||||
(await StorageHelper().get(SecureStorageKey.deviceDescription.value)) ??
|
||||
'';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? '';
|
||||
final String password = (await StorageHelper().get(SecureStorageKey.password.value)) ?? '';
|
||||
final String type = (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? '';
|
||||
final String description = (await StorageHelper().get(SecureStorageKey.deviceDescription.value)) ?? '';
|
||||
late final String token;
|
||||
try {
|
||||
token = await FirebaseMessagingService.getToken();
|
||||
|
@ -946,12 +989,9 @@ class ChangePasswordCall {
|
|||
required final String psswd,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'changePassword',
|
||||
|
@ -1010,10 +1050,8 @@ class GetLocalsCall {
|
|||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
||||
final String userUUID =
|
||||
await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
|
||||
final String devUUID = await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
||||
final String userUUID = await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
|
||||
|
||||
return await ApiManager.instance
|
||||
.makeApiCall(
|
||||
|
@ -1054,12 +1092,9 @@ class PostScheduleVisitorCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'putVisitante';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -1112,12 +1147,9 @@ class PostScheduleVisitCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'putVisita';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -1169,12 +1201,9 @@ class GetScheduleVisitCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getVisitas';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -1446,12 +1475,9 @@ class GetDadosCall {
|
|||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getDados';
|
||||
|
||||
return await ApiManager.instance
|
||||
|
@ -1487,8 +1513,7 @@ class GetDadosCall {
|
|||
response,
|
||||
r'''$.error_msg''',
|
||||
));
|
||||
String? visitedDesNomeStr(dynamic response) =>
|
||||
castToType<String>(getJsonField(
|
||||
String? visitedDesNomeStr(dynamic response) => castToType<String>(getJsonField(
|
||||
response,
|
||||
r'''$.visitado.DES_NOME''',
|
||||
));
|
||||
|
@ -1496,33 +1521,27 @@ class GetDadosCall {
|
|||
response,
|
||||
r'''$.visitado.VDO_ID''',
|
||||
));
|
||||
String? visitedVDOTNomeStr(dynamic response) =>
|
||||
castToType<String>(getJsonField(
|
||||
String? visitedVDOTNomeStr(dynamic response) => castToType<String>(getJsonField(
|
||||
response,
|
||||
r'''$.visitado.VDO_NOME''',
|
||||
));
|
||||
String? visitedVDOTipoStr(dynamic response) =>
|
||||
castToType<String>(getJsonField(
|
||||
String? visitedVDOTipoStr(dynamic response) => castToType<String>(getJsonField(
|
||||
response,
|
||||
r'''$.visitado.VDO_TIPO''',
|
||||
));
|
||||
String? visitedVDOImeiStr(dynamic response) =>
|
||||
castToType<String>(getJsonField(
|
||||
String? visitedVDOImeiStr(dynamic response) => castToType<String>(getJsonField(
|
||||
response,
|
||||
r'''$.visitado.VDO_IMEI''',
|
||||
));
|
||||
String? visitedVDODocumentoStr(dynamic response) =>
|
||||
castToType<String>(getJsonField(
|
||||
String? visitedVDODocumentoStr(dynamic response) => castToType<String>(getJsonField(
|
||||
response,
|
||||
r'''$.visitado.VDO_DOCUMENTO''',
|
||||
));
|
||||
String? visitedVDOEmailStr(dynamic response) =>
|
||||
castToType<String>(getJsonField(
|
||||
String? visitedVDOEmailStr(dynamic response) => castToType<String>(getJsonField(
|
||||
response,
|
||||
r'''$.visitado.VDO_EMAIL''',
|
||||
));
|
||||
String? visitedVDOStatusWebStr(dynamic response) =>
|
||||
castToType<String>(getJsonField(
|
||||
String? visitedVDOStatusWebStr(dynamic response) => castToType<String>(getJsonField(
|
||||
response,
|
||||
r'''$.visitado.VDO_STATUSWEB''',
|
||||
));
|
||||
|
@ -1570,8 +1589,7 @@ class GetDadosCall {
|
|||
response,
|
||||
r'''$.visitado.DES_ID''',
|
||||
));
|
||||
String? visitedVDoNotTerceirosStr(dynamic response) =>
|
||||
castToType<String>(getJsonField(
|
||||
String? visitedVDoNotTerceirosStr(dynamic response) => castToType<String>(getJsonField(
|
||||
response,
|
||||
r'''$.visitado.VDO_NOTTERCEIROS''',
|
||||
));
|
||||
|
@ -1640,8 +1658,7 @@ class GetDadosCall {
|
|||
.map((x) => castToType<String>(x))
|
||||
.withoutNulls
|
||||
.toList();
|
||||
List<String>? levelNACIndPermiteReentradaStrList(dynamic response) =>
|
||||
(getJsonField(
|
||||
List<String>? levelNACIndPermiteReentradaStrList(dynamic response) => (getJsonField(
|
||||
response,
|
||||
r'''$.niveis[:].NAC_INDPERMITEREENTRADA''',
|
||||
true,
|
||||
|
@ -1659,8 +1676,7 @@ class GetDadosCall {
|
|||
.map((x) => castToType<String>(x))
|
||||
.withoutNulls
|
||||
.toList();
|
||||
List<String>? levelNACTempoAntiCaronaStrList(dynamic response) =>
|
||||
(getJsonField(
|
||||
List<String>? levelNACTempoAntiCaronaStrList(dynamic response) => (getJsonField(
|
||||
response,
|
||||
r'''$.niveis[:].NAC_TEMPOANTICARONA''',
|
||||
true,
|
||||
|
@ -1694,12 +1710,9 @@ class GetVisitorByDocCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getVisitante';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -1751,12 +1764,9 @@ class GetFotoVisitanteCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getFotoVisitante';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -1793,12 +1803,9 @@ class PostProvVisitSchedulingCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'putAgendamentoProv';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -1845,12 +1852,9 @@ class GetVisitsCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getVisitas';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -2111,12 +2115,9 @@ class DeleteVisitCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'cancelaVisita';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -2157,14 +2158,10 @@ class GetPessoasLocalCall {
|
|||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String ownerUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String ownerUUID = (await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getPessoasLocal',
|
||||
|
@ -2227,12 +2224,9 @@ class RespondeSolicitacaoCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'respondeSolicitacao';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -2280,12 +2274,9 @@ class GetAccessCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getAcessos';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
@ -2532,12 +2523,9 @@ class GetLiberationsCall {
|
|||
final StreamController<ApiCallResponse> controller = StreamController();
|
||||
|
||||
Future.microtask(() async {
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getSolicitacoes';
|
||||
|
||||
try {
|
||||
|
@ -2727,12 +2715,9 @@ class GetMessagesCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getMensagens';
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
|
|
|
@ -86,20 +86,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
builder: (context, _) {
|
||||
return FutureBuilder<Widget>(
|
||||
future: () async {
|
||||
final bool isLogged =
|
||||
await StorageHelper().get(SecureStorageKey.isLogged.value) ==
|
||||
'true';
|
||||
final bool haveLocal =
|
||||
await StorageHelper().get(SecureStorageKey.haveLocal.value) ==
|
||||
'true';
|
||||
final bool isLogged = await StorageHelper().get(SecureStorageKey.isLogged.value) == 'true';
|
||||
final bool haveLocal = await StorageHelper().get(SecureStorageKey.haveLocal.value) == 'true';
|
||||
final bool haveUserUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key))
|
||||
?.isNotEmpty ??
|
||||
false;
|
||||
final bool haveDevUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key))
|
||||
?.isNotEmpty ??
|
||||
false;
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key))?.isNotEmpty ?? false;
|
||||
final bool haveDevUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key))?.isNotEmpty ?? false;
|
||||
|
||||
if (isLogged && haveDevUUID && haveUserUUID) {
|
||||
return haveLocal
|
||||
|
@ -109,20 +100,17 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
create: (context) => MenuBloc(
|
||||
style: MenuView.list_grid,
|
||||
item: EnumMenuItem.button,
|
||||
entries: MenuEntry.getEntriesByType(
|
||||
MenuEntryType.Home),
|
||||
entries: MenuEntry.getEntriesByType(MenuEntryType.Home),
|
||||
)..add(MenuEvent()),
|
||||
),
|
||||
BlocProvider<HomeBloc>(
|
||||
create: (context) => HomeBloc()..add(HomeEvent()),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) =>
|
||||
LocalProfileBloc()..add(LocalProfileEvent()),
|
||||
create: (context) => LocalProfileBloc()..add(LocalProfileEvent()),
|
||||
),
|
||||
],
|
||||
child: HomePageWidget(
|
||||
key: UniqueKey(), LocalsRepositoryImpl().update),
|
||||
child: HomePageWidget(key: UniqueKey(), LocalsRepositoryImpl().update),
|
||||
)
|
||||
: const ReceptionPageWidget();
|
||||
} else {
|
||||
|
@ -146,10 +134,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
name: 'forgotPassword',
|
||||
path: '/forgotPassword',
|
||||
builder: (context, params) {
|
||||
late final String email =
|
||||
params.getParam('email', ParamType.String);
|
||||
late final String token =
|
||||
params.getParam('token', ParamType.String);
|
||||
late final String email = params.getParam('email', ParamType.String);
|
||||
late final String token = params.getParam('token', ParamType.String);
|
||||
|
||||
return ForgotPasswordScreen(
|
||||
key: UniqueKey(),
|
||||
|
@ -166,8 +152,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
name: 'homePage',
|
||||
path: '/homePage',
|
||||
builder: (context, params) {
|
||||
final Future<bool> Function(BuildContext context)? update =
|
||||
params.getParam('update', ParamType.Function);
|
||||
final Future<bool> Function(BuildContext context)? update = params.getParam('update', ParamType.Function);
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider(
|
||||
|
@ -181,8 +166,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
create: (context) => HomeBloc()..add(HomeEvent()),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) =>
|
||||
LocalProfileBloc()..add(LocalProfileEvent()),
|
||||
create: (context) => LocalProfileBloc()..add(LocalProfileEvent()),
|
||||
),
|
||||
],
|
||||
child: HomePageWidget(key: UniqueKey(), update),
|
||||
|
@ -191,16 +175,12 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
FFRoute(
|
||||
name: 'petsOnThePropertyPage',
|
||||
path: '/petsOnThePropertyPage',
|
||||
builder: (context, params) =>
|
||||
Scaffold(body: const PetsHistoryScreen(isApp: true))),
|
||||
builder: (context, params) => Scaffold(body: const PetsHistoryScreen(isApp: true))),
|
||||
FFRoute(
|
||||
name: 'vehiclesOnThePropertyPage',
|
||||
path: '/vehiclesOnThePropertyPage',
|
||||
builder: (context, params) => const VehicleOnTheProperty()),
|
||||
FFRoute(
|
||||
name: 'receptionPage',
|
||||
path: '/receptionPage',
|
||||
builder: (context, params) => const ReceptionPageWidget()),
|
||||
builder: (context, params) => const VehiclePage()),
|
||||
FFRoute(name: 'receptionPage', path: '/receptionPage', builder: (context, params) => const ReceptionPageWidget()),
|
||||
FFRoute(
|
||||
name: 'messageHistoryPage',
|
||||
path: '/messageHistoryPage',
|
||||
|
@ -212,28 +192,19 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
FFRoute(
|
||||
name: 'scheduleCompleteVisitPage',
|
||||
path: '/scheduleCompleteVisitPage',
|
||||
builder: (context, params) =>
|
||||
const ScheduleCompleteVisitPageWidget()),
|
||||
builder: (context, params) => const ScheduleCompleteVisitPageWidget()),
|
||||
FFRoute(
|
||||
name: 'deliverySchedule',
|
||||
path: '/deliverySchedule',
|
||||
builder: (context, params) => const DeliverySchedule()),
|
||||
name: 'deliverySchedule', path: '/deliverySchedule', builder: (context, params) => const DeliverySchedule()),
|
||||
FFRoute(
|
||||
name: 'provisionalSchedule',
|
||||
path: '/provisionalSchedule',
|
||||
builder: (context, params) => const ProvisionalSchedule()),
|
||||
FFRoute(
|
||||
name: 'fastPassPage',
|
||||
path: '/fastPassPage',
|
||||
builder: (context, params) => FastPassPageWidget()),
|
||||
FFRoute(name: 'fastPassPage', path: '/fastPassPage', builder: (context, params) => FastPassPageWidget()),
|
||||
FFRoute(
|
||||
name: 'preferencesSettings',
|
||||
path: '/preferencesSettings',
|
||||
builder: (context, params) => PreferencesPageWidget()),
|
||||
FFRoute(
|
||||
name: 'aboutProperty',
|
||||
path: '/aboutProperty',
|
||||
builder: (context, params) => AboutPropertyPage()),
|
||||
FFRoute(name: 'aboutProperty', path: '/aboutProperty', builder: (context, params) => AboutPropertyPage()),
|
||||
FFRoute(
|
||||
name: 'residentsOnThePropertyPage',
|
||||
path: '/residentsOnThePropertyPage',
|
||||
|
@ -249,11 +220,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
FFRoute(
|
||||
name: 'acessHistoryPage',
|
||||
path: '/acessHistoryPage',
|
||||
builder: (context, params) => AccessHistoryScreen(opt: const {
|
||||
'personType': '.*',
|
||||
'accessType': '.*',
|
||||
'search': '.*'
|
||||
})),
|
||||
builder: (context, params) =>
|
||||
AccessHistoryScreen(opt: const {'personType': '.*', 'accessType': '.*', 'search': '.*'})),
|
||||
FFRoute(
|
||||
name: 'provisionalHistoryPage',
|
||||
path: '/provisionalHistoryPage',
|
||||
|
@ -262,34 +230,13 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
name: 'liberationHistory',
|
||||
path: '/liberationHistory',
|
||||
builder: (context, params) => const LiberationHistoryWidget()),
|
||||
FFRoute(
|
||||
name: 'signInPage',
|
||||
path: '/signInPage',
|
||||
builder: (context, params) => const SignInPageWidget()),
|
||||
FFRoute(
|
||||
name: 'signUpPage',
|
||||
path: '/signUpPage',
|
||||
builder: (context, params) => const SignUpPageWidget()),
|
||||
FFRoute(
|
||||
name: 'welcomePage',
|
||||
path: '/welcomePage',
|
||||
builder: (context, params) => const WelcomePage()),
|
||||
FFRoute(
|
||||
name: 'qrCodePage',
|
||||
path: '/qrCodePage',
|
||||
builder: (context, params) => const QrCodePageWidget()),
|
||||
FFRoute(
|
||||
name: 'preferencesPage',
|
||||
path: '/preferencesPage',
|
||||
builder: (context, params) => PreferencesPageWidget()),
|
||||
FFRoute(
|
||||
name: 'packageOrder',
|
||||
path: '/packageOrder',
|
||||
builder: (context, params) => const PackageOrderPage()),
|
||||
FFRoute(
|
||||
name: 'reservation',
|
||||
path: '/reservation',
|
||||
builder: (context, params) => ReservationPageWidget()),
|
||||
FFRoute(name: 'signInPage', path: '/signInPage', builder: (context, params) => const SignInPageWidget()),
|
||||
FFRoute(name: 'signUpPage', path: '/signUpPage', builder: (context, params) => const SignUpPageWidget()),
|
||||
FFRoute(name: 'welcomePage', path: '/welcomePage', builder: (context, params) => const WelcomePage()),
|
||||
FFRoute(name: 'qrCodePage', path: '/qrCodePage', builder: (context, params) => const QrCodePageWidget()),
|
||||
FFRoute(name: 'preferencesPage', path: '/preferencesPage', builder: (context, params) => PreferencesPageWidget()),
|
||||
FFRoute(name: 'packageOrder', path: '/packageOrder', builder: (context, params) => const PackageOrderPage()),
|
||||
FFRoute(name: 'reservation', path: '/reservation', builder: (context, params) => ReservationPageWidget()),
|
||||
FFRoute(
|
||||
name: 'petsPage',
|
||||
path: '/petsPage',
|
||||
|
@ -305,9 +252,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
|
||||
extension NavParamExtensions on Map<String, String?> {
|
||||
Map<String, String> get withoutNulls => Map.fromEntries(
|
||||
entries
|
||||
.where((e) => e.value != null)
|
||||
.map((e) => MapEntry(e.key, e.value!)),
|
||||
entries.where((e) => e.value != null).map((e) => MapEntry(e.key, e.value!)),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -321,8 +266,7 @@ extension NavigationExtensions on BuildContext {
|
|||
}
|
||||
|
||||
extension _GoRouterStateExtensions on GoRouterState {
|
||||
Map<String, dynamic> get extraMap =>
|
||||
extra != null ? extra as Map<String, dynamic> : {};
|
||||
Map<String, dynamic> get extraMap => extra != null ? extra as Map<String, dynamic> : {};
|
||||
Map<String, dynamic> get allParams => <String, dynamic>{}
|
||||
..addAll(pathParameters)
|
||||
..addAll(uri.queryParameters)
|
||||
|
@ -335,9 +279,8 @@ extension _GoRouterStateExtensions on GoRouterState {
|
|||
extension GoRouterLocationExtension on GoRouter {
|
||||
String getCurrentLocation() {
|
||||
final RouteMatch lastMatch = routerDelegate.currentConfiguration.last;
|
||||
final RouteMatchList matchList = lastMatch is ImperativeRouteMatch
|
||||
? lastMatch.matches
|
||||
: routerDelegate.currentConfiguration;
|
||||
final RouteMatchList matchList =
|
||||
lastMatch is ImperativeRouteMatch ? lastMatch.matches : routerDelegate.currentConfiguration;
|
||||
return matchList.uri.toString();
|
||||
}
|
||||
}
|
||||
|
@ -350,17 +293,13 @@ class FFParameters {
|
|||
Map<String, dynamic> futureParamValues = {};
|
||||
|
||||
bool get isEmpty =>
|
||||
state.allParams.isEmpty ||
|
||||
(state.allParams.length == 1 &&
|
||||
state.extraMap.containsKey(kTransitionInfoKey));
|
||||
bool isAsyncParam(MapEntry<String, dynamic> param) =>
|
||||
asyncParams.containsKey(param.key) && param.value is String;
|
||||
state.allParams.isEmpty || (state.allParams.length == 1 && state.extraMap.containsKey(kTransitionInfoKey));
|
||||
bool isAsyncParam(MapEntry<String, dynamic> param) => asyncParams.containsKey(param.key) && param.value is String;
|
||||
bool get hasFutures => state.allParams.entries.any(isAsyncParam);
|
||||
Future<bool> completeFutures() => Future.wait(
|
||||
state.allParams.entries.where(isAsyncParam).map(
|
||||
(param) async {
|
||||
final doc = await asyncParams[param.key]!(param.value)
|
||||
.onError((_, __) => null);
|
||||
final doc = await asyncParams[param.key]!(param.value).onError((_, __) => null);
|
||||
if (doc != null) {
|
||||
futureParamValues[param.key] = doc;
|
||||
return true;
|
||||
|
@ -370,15 +309,12 @@ class FFParameters {
|
|||
),
|
||||
).onError((_, __) => [false]).then((v) => v.every((e) => e));
|
||||
|
||||
dynamic getParam<T>(String paramName, ParamType type,
|
||||
{bool isList = false, StructBuilder<T>? structBuilder}) {
|
||||
if (futureParamValues.containsKey(paramName))
|
||||
return futureParamValues[paramName];
|
||||
dynamic getParam<T>(String paramName, ParamType type, {bool isList = false, StructBuilder<T>? structBuilder}) {
|
||||
if (futureParamValues.containsKey(paramName)) return futureParamValues[paramName];
|
||||
if (!state.allParams.containsKey(paramName)) return null;
|
||||
final param = state.allParams[paramName];
|
||||
if (param is! String) return param;
|
||||
return deserializeParam<T>(param, type, isList,
|
||||
structBuilder: structBuilder);
|
||||
return deserializeParam<T>(param, type, isList, structBuilder: structBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,16 +354,13 @@ class FFRoute {
|
|||
key: state.pageKey,
|
||||
child: child,
|
||||
transitionDuration: transitionInfo.duration,
|
||||
transitionsBuilder:
|
||||
(context, animation, secondaryAnimation, child) =>
|
||||
PageTransition(
|
||||
transitionsBuilder: (context, animation, secondaryAnimation, child) => PageTransition(
|
||||
type: transitionInfo.transitionType,
|
||||
duration: transitionInfo.duration,
|
||||
reverseDuration: transitionInfo.duration,
|
||||
alignment: transitionInfo.alignment,
|
||||
child: child,
|
||||
).buildTransitions(
|
||||
context, animation, secondaryAnimation, child),
|
||||
).buildTransitions(context, animation, secondaryAnimation, child),
|
||||
)
|
||||
: MaterialPage(key: state.pageKey, child: child);
|
||||
},
|
||||
|
@ -448,8 +381,7 @@ class TransitionInfo {
|
|||
final Duration duration;
|
||||
final Alignment? alignment;
|
||||
|
||||
static TransitionInfo appDefault() =>
|
||||
const TransitionInfo(hasTransition: false);
|
||||
static TransitionInfo appDefault() => const TransitionInfo(hasTransition: false);
|
||||
}
|
||||
|
||||
class RootPageContext {
|
||||
|
@ -461,9 +393,7 @@ class RootPageContext {
|
|||
final rootPageContext = context.read<RootPageContext?>();
|
||||
final isRootPage = rootPageContext?.isRootPage ?? false;
|
||||
final location = GoRouterState.of(context).uri.toString();
|
||||
return isRootPage &&
|
||||
location != '/' &&
|
||||
location != rootPageContext?.errorRoute;
|
||||
return isRootPage && location != '/' && location != rootPageContext?.errorRoute;
|
||||
}
|
||||
|
||||
static Widget wrap(Widget child, {String? errorRoute}) =>
|
||||
|
|
|
@ -54,8 +54,7 @@ class App extends StatefulWidget {
|
|||
@override
|
||||
State<App> createState() => _AppState();
|
||||
|
||||
static _AppState of(BuildContext context) =>
|
||||
context.findAncestorStateOfType<_AppState>()!;
|
||||
static _AppState of(BuildContext context) => context.findAncestorStateOfType<_AppState>()!;
|
||||
}
|
||||
|
||||
class _AppState extends State<App> {
|
||||
|
@ -97,8 +96,7 @@ class _AppState extends State<App> {
|
|||
}),
|
||||
),
|
||||
);
|
||||
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates =
|
||||
const [
|
||||
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates = const [
|
||||
FFLocalizationsDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
|
@ -140,8 +138,7 @@ class _AppState extends State<App> {
|
|||
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
|
||||
log('onMessageOpenedApp');
|
||||
} else {
|
||||
onMessageReceived(message.data, message.notification!.body,
|
||||
message.data['click_action']);
|
||||
onMessageReceived(message.data, message.notification!.body, message.data['click_action']);
|
||||
}
|
||||
});
|
||||
FirebaseMessaging.instance.getInitialMessage().then((message) async {
|
||||
|
@ -175,9 +172,7 @@ class _AppState extends State<App> {
|
|||
_router = createRouter(_appStateNotifier);
|
||||
Future.delayed(
|
||||
const Duration(milliseconds: 1000),
|
||||
() => mounted
|
||||
? setState(() => _appStateNotifier.stopShowingSplashImage())
|
||||
: null,
|
||||
() => mounted ? setState(() => _appStateNotifier.stopShowingSplashImage()) : null,
|
||||
);
|
||||
|
||||
_setupFirebaseMessaging();
|
||||
|
|
|
@ -504,6 +504,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
options: FFButtonOptions(
|
||||
height: 40,
|
||||
|
|
|
@ -1049,4 +1049,6 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
part of 'vehicles_on_the_property.dart';
|
||||
|
||||
/// [VehicleHistoryScreen] is a StatefulWidget that displays a list of vehicles.
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class VehicleHistoryScreen extends StatefulWidget {
|
||||
VehicleHistoryScreen(this.model, {super.key});
|
||||
late VehicleModel model;
|
||||
|
||||
@override
|
||||
State<VehicleHistoryScreen> createState() => _VehicleHistoryScreenState();
|
||||
}
|
||||
|
||||
class _VehicleHistoryScreenState extends State<VehicleHistoryScreen> {
|
||||
late Future<void> _future = _fetchVisits();
|
||||
late ScrollController _scrollController;
|
||||
List<dynamic> _wrap = [];
|
||||
int _pageNumber = 1;
|
||||
bool _hasData = false;
|
||||
bool _loading = false;
|
||||
int count = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// widget.model = createModel(context, () => VehicleModel());
|
||||
_future = _fetchVisits();
|
||||
_scrollController = ScrollController()
|
||||
..addListener(() {
|
||||
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
|
||||
_loadMore();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _showNoMoreDataSnackBar(BuildContext context) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Não há mais dados.",
|
||||
enText: "No more data.",
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
|
||||
),
|
||||
),
|
||||
duration: const Duration(seconds: 3),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getRandomStatus() {
|
||||
var statuses = ['ATI', 'INA', 'APR_CREATE', 'APR_DELETE', 'APR_UPDATE', 'AGU_CHANGE'];
|
||||
statuses.shuffle();
|
||||
return statuses.first;
|
||||
}
|
||||
|
||||
Widget _item(BuildContext context, Map<String, dynamic> uItem) {
|
||||
uItem['status'] = getRandomStatus();
|
||||
return CardItemTemplateComponentWidget(
|
||||
imagePath: null,
|
||||
labelsHashMap: {
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
||||
uItem['licensePlate'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:': uItem['model'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:': uItem['tag'] ?? '',
|
||||
},
|
||||
statusHashMap: [widget.model.generateStatusColorMap(uItem)],
|
||||
onTapCardItemAction: () async {
|
||||
await showDialog(
|
||||
useSafeArea: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
alignment: Alignment.center,
|
||||
child: widget.model.buildVehicleDetails(
|
||||
item: uItem,
|
||||
context: context,
|
||||
model: widget.model,
|
||||
));
|
||||
},
|
||||
).whenComplete(() {
|
||||
safeSetState(() {
|
||||
_pageNumber = 1;
|
||||
_wrap = [];
|
||||
_future = _fetchVisits().then((value) => value!.jsonBody['vehicles'] ?? []);
|
||||
});
|
||||
}).catchError((e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículos", e, s);
|
||||
safeSetState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<ApiCallResponse?> _fetchVisits() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response = await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString());
|
||||
|
||||
final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? [];
|
||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||
|
||||
if (vehicles.isNotEmpty) {
|
||||
setState(() {
|
||||
_wrap.addAll(vehicles);
|
||||
_hasData = true;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
_showNoMoreDataSnackBar(context);
|
||||
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return null;
|
||||
} catch (e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículo", e, s);
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void _loadMore() {
|
||||
if (_hasData == true) {
|
||||
_pageNumber++;
|
||||
|
||||
_future = _fetchVisits();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
late final limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Nenhum veículo encontrado!",
|
||||
enText: "No vehicle found",
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: limitedHeaderTextSize,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
else if (_hasData == true || _pageNumber >= 1)
|
||||
Expanded(
|
||||
child: FutureBuilder<void>(
|
||||
future: _future,
|
||||
builder: (context, snapshot) {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
itemCount: _wrap.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
// Add your item here
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 30, top: 10),
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Map<String, dynamic> item = _wrap[index - 1];
|
||||
return _item(context, item);
|
||||
}
|
||||
});
|
||||
},
|
||||
)),
|
||||
if (_hasData == true && _loading == true)
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 15, bottom: 15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
].addToStart(const SizedBox(height: 0)),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,54 +1,447 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||
import 'package:hub/flutter_flow/internationalization.dart';
|
||||
import 'package:hub/features/backend/index.dart';
|
||||
import 'package:hub/flutter_flow/index.dart';
|
||||
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
||||
import 'package:hub/shared/utils/index.dart';
|
||||
|
||||
class VehicleModel extends FlutterFlowModel<VehiclePage> {
|
||||
@override
|
||||
void initState(BuildContext context) {
|
||||
resetInstance();
|
||||
initAsync();
|
||||
tabBarController = TabController(
|
||||
vsync: Navigator.of(context),
|
||||
length: 2,
|
||||
);
|
||||
|
||||
textFieldFocusLicensePlate = FocusNode();
|
||||
textFieldControllerLicensePlate = TextEditingController();
|
||||
|
||||
textFieldFocusColor = FocusNode();
|
||||
textFieldControllerColor = TextEditingController();
|
||||
|
||||
textFieldFocusModel = FocusNode();
|
||||
textFieldControllerModel = TextEditingController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
tabBarController.dispose();
|
||||
textFieldFocusLicensePlate!.dispose();
|
||||
textFieldControllerLicensePlate!.dispose();
|
||||
textFieldFocusColor!.dispose();
|
||||
textFieldControllerColor!.dispose();
|
||||
textFieldFocusModel!.dispose();
|
||||
textFieldControllerModel!.dispose();
|
||||
}
|
||||
|
||||
class VehicleModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
||||
static VehicleModel? _instance = VehicleModel._internal();
|
||||
VehicleModel._internal();
|
||||
factory VehicleModel() => _instance ?? VehicleModel._internal();
|
||||
static void resetInstance() => _instance = null;
|
||||
|
||||
dynamic item;
|
||||
String? vehicleId;
|
||||
|
||||
@override
|
||||
void initState(BuildContext context) {
|
||||
resetInstance();
|
||||
late final TabController tabBarController;
|
||||
VoidCallback? onUpdateVehicle;
|
||||
VoidCallback? onRegisterVehicle;
|
||||
VoidCallback? safeSetState;
|
||||
|
||||
initAsync();
|
||||
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
||||
final GlobalKey<FormState> updateFormKey = GlobalKey<FormState>();
|
||||
|
||||
ApiCallResponse? vehicleResponse;
|
||||
bool isEditing = false;
|
||||
BuildContext context = navigatorKey.currentContext!;
|
||||
|
||||
FocusNode? textFieldFocusLicensePlate;
|
||||
TextEditingController? textFieldControllerLicensePlate;
|
||||
String? textControllerLicensePlateValidator(BuildContext context, String? value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Placa é obrigatória',
|
||||
enText: 'License Plate is required',
|
||||
);
|
||||
}
|
||||
|
||||
// (ABC-1234)
|
||||
final brazilianPlateRegex = RegExp(r'^[A-Z]{3}-\d{4}$');
|
||||
// (ABC1D23)
|
||||
final mercosurPlateRegex = RegExp(r'^[A-Z]{3}\d[A-Z]\d{2}$');
|
||||
|
||||
if (!brazilianPlateRegex.hasMatch(value) && !mercosurPlateRegex.hasMatch(value)) {
|
||||
return FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Placa inválida',
|
||||
enText: 'Invalid license plate',
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {}
|
||||
FocusNode? textFieldFocusColor;
|
||||
TextEditingController? textFieldControllerColor;
|
||||
String? textControllerColorValidator(BuildContext contexnt, String? value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Cor é obrigatória',
|
||||
enText: 'Color is required',
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
FocusNode? textFieldFocusModel;
|
||||
TextEditingController? textFieldControllerModel;
|
||||
String? textControllerModelValidator(BuildContext contexnt, String? value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Modelo é obrigatório',
|
||||
enText: 'Model is required',
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<void> initAsync() async {}
|
||||
|
||||
Map<String, Color> generateStatusColorMap(dynamic uItem) {
|
||||
final statusMap = {
|
||||
"ATI": {
|
||||
"text": FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Ativo',
|
||||
enText: 'Active',
|
||||
),
|
||||
"color": FlutterFlowTheme.of(context).success,
|
||||
},
|
||||
"INA": {
|
||||
"text": FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Inativo',
|
||||
enText: 'Inactive',
|
||||
),
|
||||
"color": FlutterFlowTheme.of(context).accent2,
|
||||
},
|
||||
"APR_CREATE": {
|
||||
"text": FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Criando',
|
||||
enText: 'Creating',
|
||||
),
|
||||
"color": FlutterFlowTheme.of(context).success,
|
||||
},
|
||||
"APR_DELETE": {
|
||||
"text": FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Deletando',
|
||||
enText: 'Deleting',
|
||||
),
|
||||
"color": FlutterFlowTheme.of(context).error,
|
||||
},
|
||||
"APR_UPDATE": {
|
||||
"text": FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Atualizando',
|
||||
enText: 'Updating',
|
||||
),
|
||||
"color": FlutterFlowTheme.of(context).warning,
|
||||
},
|
||||
"AGU_CHANGE": {
|
||||
"text": FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Aguardando',
|
||||
enText: 'Waiting',
|
||||
),
|
||||
"color": FlutterFlowTheme.of(context).accent2,
|
||||
},
|
||||
};
|
||||
|
||||
final status = uItem['status'];
|
||||
if (statusMap.containsKey(status)) {
|
||||
return {
|
||||
statusMap[status]!['text'] as String: statusMap[status]!['color'] as Color,
|
||||
};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
List<FFButtonWidget> generateActionButtons(dynamic item) {
|
||||
final Color iconButtonColor = FlutterFlowTheme.of(context).primaryText;
|
||||
final FFButtonOptions buttonOptions = FFButtonOptions(
|
||||
height: 40,
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
elevation: 0,
|
||||
textStyle: TextStyle(
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
fontSize: LimitedFontSizeUtil.getNoResizeFont(context, 15),
|
||||
),
|
||||
splashColor: FlutterFlowTheme.of(context).success,
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
width: 1,
|
||||
),
|
||||
);
|
||||
|
||||
return [
|
||||
if (item['status'].contains('AGU'))
|
||||
FFButtonWidget(
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Editar',
|
||||
enText: 'Edit',
|
||||
),
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: iconButtonColor,
|
||||
),
|
||||
onPressed: () async {
|
||||
context.pop();
|
||||
isEditing = true;
|
||||
item = item;
|
||||
|
||||
switchTab(1);
|
||||
setEditForm();
|
||||
},
|
||||
options: buttonOptions,
|
||||
),
|
||||
if (item['status'].contains('APR') || item['status'].contains('AGU'))
|
||||
FFButtonWidget(
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Cancelar',
|
||||
enText: 'Cancel',
|
||||
),
|
||||
icon: Icon(Icons.close, color: iconButtonColor),
|
||||
onPressed: () async {
|
||||
showAlertDialog(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Cancelar Solicitação',
|
||||
enText: 'Cancel Request',
|
||||
),
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Você tem certeza que deseja cancelar essa solicitação?',
|
||||
enText: 'Are you sure you want to delete this request?',
|
||||
), () async {
|
||||
int id = item['vehicleId'];
|
||||
await PhpGroup.deleteVehicle.call(vehicleId: id).then((value) {
|
||||
context.pop(value);
|
||||
context.pop(value);
|
||||
|
||||
if (value.jsonBody['error'] == false) {
|
||||
showSnackbar(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao cancelar solicitação',
|
||||
enText: 'Error canceling request',
|
||||
),
|
||||
true,
|
||||
);
|
||||
} else if (value.jsonBody['error'] == true) {
|
||||
showSnackbar(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Success canceling request',
|
||||
ptText: 'Succeso ao cancelar solicitação',
|
||||
),
|
||||
false,
|
||||
);
|
||||
}
|
||||
}).catchError((err, stack) {
|
||||
context.pop();
|
||||
showSnackbar(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Error canceling request',
|
||||
ptText: 'Erro ao cancelar solicitação',
|
||||
),
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
options: buttonOptions,
|
||||
),
|
||||
if (item['status'].contains('ATI'))
|
||||
FFButtonWidget(
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Excluir',
|
||||
enText: 'Delete',
|
||||
),
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: iconButtonColor,
|
||||
),
|
||||
onPressed: () async {
|
||||
showAlertDialog(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Excluir Veículo',
|
||||
enText: 'Delete Vehicle',
|
||||
),
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Você tem certeza que deseja excluir esse veículo?',
|
||||
enText: 'Are you sure you want to delete this vehicle?',
|
||||
), () async {
|
||||
int id = item['vehicleId'];
|
||||
await PhpGroup.deleteVehicle.call(vehicleId: id).then((value) {
|
||||
context.pop(value);
|
||||
context.pop(value);
|
||||
|
||||
if (value == false) {
|
||||
showSnackbar(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao excluir veículo',
|
||||
enText: 'Error deleting vehicle',
|
||||
),
|
||||
true,
|
||||
);
|
||||
} else if (value == true) {
|
||||
showSnackbar(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Success deleting vehicle',
|
||||
ptText: 'Succeso ao excluir veículo',
|
||||
),
|
||||
false,
|
||||
);
|
||||
}
|
||||
}).catchError((err, stack) {
|
||||
context.pop();
|
||||
showSnackbar(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Error deleting vehicle',
|
||||
ptText: 'Erro ao excluir veículo',
|
||||
),
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
options: buttonOptions,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Map<String, String> generateLabelsHashMap(dynamic item) {
|
||||
return {
|
||||
if (item['model'] != null && item['model'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:':
|
||||
item['model'].toString().toUpperCase(),
|
||||
if (item['licensePlate'] != null && item['licensePlate'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
||||
item['licensePlate'].toString().toUpperCase(),
|
||||
if (item['color'] != null && item['color'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:':
|
||||
item['color'].toString().toUpperCase(),
|
||||
if (item['personName'] != null && item['personName'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Proprietário", enText: "Owner")}:':
|
||||
item['personName'].toString().toUpperCase(),
|
||||
if (item['tag'] != null && item['tag'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:':
|
||||
item['tag'].toString().toUpperCase(),
|
||||
};
|
||||
}
|
||||
|
||||
Widget buildVehicleDetails({
|
||||
required dynamic item,
|
||||
required BuildContext context,
|
||||
required VehicleModel model,
|
||||
}) {
|
||||
final status = generateStatusColorMap(item);
|
||||
final buttons = generateActionButtons(item);
|
||||
final labels = generateLabelsHashMap(item);
|
||||
return DetailsComponentWidget(
|
||||
buttons: [],
|
||||
labelsHashMap: Map<String, String>.from({
|
||||
if (item['model'] != null && item['model'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:':
|
||||
item['model'].toString().toUpperCase(),
|
||||
if (item['licensePlate'] != null && item['licensePlate'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
||||
item['licensePlate'].toString().toUpperCase(),
|
||||
if (item['color'] != null && item['color'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:':
|
||||
item['color'].toString().toUpperCase(),
|
||||
if (item['personName'] != null && item['personName'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Proprietário", enText: "Owner")}:':
|
||||
item['personName'].toString().toUpperCase(),
|
||||
if (item['tag'] != null && item['tag'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:':
|
||||
item['tag'].toString().toUpperCase(),
|
||||
}),
|
||||
statusHashMap: [],
|
||||
buttons: buttons,
|
||||
labelsHashMap: labels,
|
||||
statusHashMap: [status],
|
||||
);
|
||||
}
|
||||
|
||||
void setEditForm() {
|
||||
if (item != null) {
|
||||
vehicleId = item['vehicleId'];
|
||||
textFieldControllerLicensePlate!.text = item['licensePlate'];
|
||||
textFieldControllerColor!.text = item['color'];
|
||||
textFieldControllerModel!.text = item['model'];
|
||||
}
|
||||
}
|
||||
|
||||
bool isFormValid(BuildContext context) {
|
||||
if (registerFormKey.currentState == null) return false;
|
||||
return registerFormKey.currentState!.validate();
|
||||
}
|
||||
|
||||
Future<void> updateVehicle() async {
|
||||
final response = await PhpGroup.updateVehicle.call(
|
||||
licensePlate: textFieldControllerLicensePlate!.text,
|
||||
color: textFieldControllerColor!.text,
|
||||
model: textFieldControllerModel!.text,
|
||||
vehicleId: vehicleId!,
|
||||
);
|
||||
if (response.jsonBody['error'] == false) {
|
||||
await DialogUtil.success(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Veículo atualizado com sucesso',
|
||||
enText: 'Vehicle updated successfully',
|
||||
)).then((_) async {
|
||||
switchTab(0);
|
||||
});
|
||||
} else {
|
||||
String errorMessage;
|
||||
try {
|
||||
errorMessage = response.jsonBody['message'];
|
||||
} catch (e) {
|
||||
errorMessage = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao atualizar veículo',
|
||||
enText: 'Error updating vehicle',
|
||||
);
|
||||
}
|
||||
await DialogUtil.error(context, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> registerVehicle() async {
|
||||
final response = await PhpGroup.registerVehicle.call(
|
||||
licensePlate: textFieldControllerLicensePlate!.text,
|
||||
color: textFieldControllerColor!.text,
|
||||
model: textFieldControllerModel!.text,
|
||||
);
|
||||
if (response.jsonBody['error'] == false) {
|
||||
await DialogUtil.success(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Veículo cadastrado com sucesso',
|
||||
enText: 'Vehicle registered successfully',
|
||||
)).then((_) async {
|
||||
switchTab(0);
|
||||
});
|
||||
} else {
|
||||
String errorMessage;
|
||||
try {
|
||||
errorMessage = response.jsonBody['message'];
|
||||
} catch (e) {
|
||||
errorMessage = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao cadastrar veículo',
|
||||
enText: 'Error registering vehicle',
|
||||
);
|
||||
}
|
||||
await DialogUtil.error(context, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
void switchTab(int index) {
|
||||
tabBarController.animateTo(index);
|
||||
if (index == 0) handleEditingChanged(false);
|
||||
safeSetState?.call();
|
||||
}
|
||||
|
||||
void clearFields() async {
|
||||
textFieldControllerLicensePlate!.clear();
|
||||
textFieldControllerColor!.clear();
|
||||
textFieldControllerModel!.clear();
|
||||
}
|
||||
|
||||
void handleEditingChanged(bool editing) {
|
||||
isEditing = editing;
|
||||
clearFields();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
part of 'vehicles_on_the_property.dart';
|
||||
|
||||
/// [VehicleRegisterScreen] is a StatefulWidget that displays a form to register a vehicle.
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class VehicleRegisterScreen extends StatefulWidget {
|
||||
VehicleRegisterScreen(this.model, {super.key});
|
||||
late VehicleModel model;
|
||||
|
||||
@override
|
||||
State<VehicleRegisterScreen> createState() => _VehicleRegisterScreenState();
|
||||
}
|
||||
|
||||
class _VehicleRegisterScreenState extends State<VehicleRegisterScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context);
|
||||
double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context);
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Preencha o formulário de cadastro com os dados do seu veículo',
|
||||
enText: 'Fill out the registration form with your vehicle data',
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||
fontSize: limitedHeaderFontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Form(
|
||||
key: widget.model.registerFormKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CustomInputUtil(
|
||||
controller: widget.model.textFieldControllerLicensePlate,
|
||||
validator: widget.model.textControllerLicensePlateValidator.asValidator(context),
|
||||
focusNode: widget.model.textFieldFocusLicensePlate,
|
||||
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
|
||||
hintText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
|
||||
suffixIcon: Symbols.format_color_text,
|
||||
haveMaxLength: true,
|
||||
onChanged: (value) => setState(() {}),
|
||||
maxLength: 80,
|
||||
),
|
||||
CustomInputUtil(
|
||||
controller: widget.model.textFieldControllerModel,
|
||||
validator: widget.model.textControllerModelValidator.asValidator(context),
|
||||
focusNode: widget.model.textFieldFocusModel,
|
||||
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Modelo', enText: 'Model'),
|
||||
hintText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Ex: Voyage, Ford',
|
||||
enText: 'e.g. Voyage, Ford',
|
||||
),
|
||||
suffixIcon: Symbols.car_repair,
|
||||
haveMaxLength: true,
|
||||
onChanged: (value) => setState(() {}),
|
||||
maxLength: 80,
|
||||
),
|
||||
CustomInputUtil(
|
||||
controller: widget.model.textFieldControllerColor,
|
||||
validator: widget.model.textControllerColorValidator.asValidator(context),
|
||||
focusNode: widget.model.textFieldFocusColor,
|
||||
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cor', enText: 'Color'),
|
||||
hintText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Ex: Preto, Amarelo, Branco',
|
||||
enText: 'e.g. Black, Yellow, White',
|
||||
),
|
||||
suffixIcon: Symbols.palette,
|
||||
haveMaxLength: true,
|
||||
onChanged: (value) => setState(() {}),
|
||||
maxLength: 80,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
|
||||
child: SubmitButtonUtil(
|
||||
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register'),
|
||||
onPressed: widget.model.isFormValid(context) ? widget.model.registerVehicle : null),
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
part of 'vehicles_on_the_property.dart';
|
||||
|
||||
/// [VehicleUpdateScreen] is a StatefulWidget that displays a form to update a vehicle.
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class VehicleUpdateScreen extends StatefulWidget {
|
||||
VehicleUpdateScreen(this.model, {super.key});
|
||||
late VehicleModel model;
|
||||
|
||||
@override
|
||||
State<VehicleUpdateScreen> createState() => _VehicleUpdateScreenState();
|
||||
}
|
||||
|
||||
class _VehicleUpdateScreenState extends State<VehicleUpdateScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Preencha o formulário de alteração com os dados do seu veículo',
|
||||
enText: 'Fill out the update form with your vehicle data',
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Form(
|
||||
key: widget.model.updateFormKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CustomInputUtil(
|
||||
controller: widget.model.textFieldControllerLicensePlate,
|
||||
validator: widget.model.textControllerLicensePlateValidator.asValidator(context),
|
||||
focusNode: widget.model.textFieldFocusLicensePlate,
|
||||
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
|
||||
hintText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
|
||||
suffixIcon: Symbols.format_color_text,
|
||||
haveMaxLength: true,
|
||||
onChanged: (value) => setState(() {}),
|
||||
maxLength: 80,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||
child: CustomInputUtil(
|
||||
controller: widget.model.textFieldControllerModel,
|
||||
validator: widget.model.textControllerModelValidator.asValidator(context),
|
||||
focusNode: widget.model.textFieldFocusModel,
|
||||
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Modelo', enText: 'Model'),
|
||||
hintText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Ex: Voyage, Ford',
|
||||
enText: 'e.g. Voyage, Ford',
|
||||
),
|
||||
suffixIcon: Icons.car_repair,
|
||||
haveMaxLength: true,
|
||||
onChanged: (value) => setState(() {}),
|
||||
maxLength: 80,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||
child: CustomInputUtil(
|
||||
controller: widget.model.textFieldControllerColor,
|
||||
validator: widget.model.textControllerColorValidator.asValidator(context),
|
||||
focusNode: widget.model.textFieldFocusColor,
|
||||
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cor', enText: 'Color'),
|
||||
hintText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Ex: Preto, Amarelo, Branco',
|
||||
enText: 'e.g. Black, Yellow, White',
|
||||
),
|
||||
suffixIcon: Icons.pets_outlined,
|
||||
haveMaxLength: true,
|
||||
onChanged: (value) => setState(() {}),
|
||||
maxLength: 80,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
|
||||
child: SubmitButtonUtil(
|
||||
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Salvar', enText: 'Save'),
|
||||
onPressed: widget.model.isFormValid(context) ? widget.model.updateVehicle : null),
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/components/atomic_components/shared_components_atoms/custom_input.dart';
|
||||
import 'package:hub/components/atomic_components/shared_components_atoms/submit_button.dart';
|
||||
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart';
|
||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||
import 'package:hub/features/backend/index.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
||||
|
@ -9,141 +14,109 @@ import 'package:hub/pages/vehicles_on_the_property/vehicle_model.dart';
|
|||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
import 'package:hub/shared/utils/log_util.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
class VehicleOnTheProperty extends StatefulWidget {
|
||||
const VehicleOnTheProperty({super.key});
|
||||
part 'vehicle_history_screen.dart';
|
||||
part 'vehicle_register_screen.dart';
|
||||
part 'vehicle_update_screen.dart';
|
||||
|
||||
/// [VehiclePage] is a StatefulWidget that displays the vehicle screens.
|
||||
|
||||
class VehiclePage extends StatefulWidget {
|
||||
const VehiclePage({super.key});
|
||||
|
||||
@override
|
||||
_VehicleOnThePropertyState createState() => _VehicleOnThePropertyState();
|
||||
_VehiclePageState createState() => _VehiclePageState();
|
||||
}
|
||||
|
||||
class _VehicleOnThePropertyState extends State<VehicleOnTheProperty>
|
||||
with TickerProviderStateMixin {
|
||||
late ScrollController _scrollController;
|
||||
|
||||
int _pageNumber = 1;
|
||||
bool _hasData = false;
|
||||
bool _loading = false;
|
||||
class _VehiclePageState extends State<VehiclePage> with TickerProviderStateMixin {
|
||||
int count = 0;
|
||||
late final VehicleModel model;
|
||||
|
||||
late Future<void> _future;
|
||||
List<dynamic> _wrap = [];
|
||||
late final VehicleModel _model;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
model = createModel(context, () => VehicleModel());
|
||||
_future = _fetchVisits();
|
||||
_scrollController = ScrollController()
|
||||
..addListener(() {
|
||||
if (_scrollController.position.atEdge &&
|
||||
_scrollController.position.pixels != 0) {
|
||||
_loadMore();
|
||||
}
|
||||
_model = createModel(context, () => VehicleModel());
|
||||
|
||||
_model.updateOnChange = true;
|
||||
_model.onUpdateVehicle = () {
|
||||
safeSetState(() {
|
||||
_model.clearFields();
|
||||
});
|
||||
};
|
||||
_model.onRegisterVehicle = () {
|
||||
safeSetState(() {
|
||||
_model.clearFields();
|
||||
});
|
||||
};
|
||||
_model.safeSetState = () {
|
||||
safeSetState(() {});
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
late final limitedHeaderTextSize =
|
||||
LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
|
||||
final backgroundColor = FlutterFlowTheme.of(context).primaryBackground;
|
||||
return Scaffold(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
appBar: _appBar(context),
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Nenhum veículo encontrado!",
|
||||
enText: "No vehicle found",
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: limitedHeaderTextSize,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
else if (_hasData == true || _pageNumber >= 1)
|
||||
Expanded(
|
||||
child: FutureBuilder<void>(
|
||||
future: _future,
|
||||
builder: (context, snapshot) {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
itemCount: _wrap.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
// Add your item here
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 30, top: 10),
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final item = _wrap[index - 1];
|
||||
return _item(context, item);
|
||||
}
|
||||
});
|
||||
},
|
||||
)),
|
||||
if (_hasData == true && _loading == true)
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 15, bottom: 15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
].addToStart(const SizedBox(height: 0)),
|
||||
),
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: _buildAppBar(context),
|
||||
body: _buildBody(context),
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _appBar(BuildContext context) {
|
||||
/// [Body] of the page.
|
||||
void onEditingChanged(bool value) {
|
||||
setState(() {
|
||||
_model.handleEditingChanged(value);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildBody(BuildContext context) {
|
||||
final vehicleHistoryScreenLabel =
|
||||
FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'Consult');
|
||||
final vehicleRegisterScreenLabel =
|
||||
FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register');
|
||||
final vehicleUpdateScreenLabel = FFLocalizations.of(context).getVariableText(ptText: 'Editar', enText: 'Edit');
|
||||
|
||||
return TabViewUtil(
|
||||
context: context,
|
||||
model: _model,
|
||||
labelTab1: vehicleHistoryScreenLabel,
|
||||
labelTab2: _model.isEditing ? vehicleUpdateScreenLabel : vehicleRegisterScreenLabel,
|
||||
controller: _model.tabBarController,
|
||||
widget1: VehicleHistoryScreen(_model),
|
||||
widget2: _model.isEditing ? VehicleUpdateScreen(_model) : VehicleRegisterScreen(_model),
|
||||
onEditingChanged: onEditingChanged,
|
||||
);
|
||||
}
|
||||
|
||||
/// -----------------------------------
|
||||
/// [AppBar] with the title of the page.
|
||||
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
||||
final theme = FlutterFlowTheme.of(context);
|
||||
final backgroundColor = theme.primaryBackground;
|
||||
final primaryText = theme.primaryText;
|
||||
final title = FFLocalizations.of(context).getVariableText(enText: 'Vehicles', ptText: 'Veículos');
|
||||
final titleStyle = theme.headlineMedium.override(
|
||||
fontFamily: theme.headlineMediumFamily,
|
||||
color: primaryText,
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily),
|
||||
);
|
||||
final backButton = _backButton(context, theme);
|
||||
|
||||
return AppBar(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
backgroundColor: backgroundColor,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(
|
||||
FFLocalizations.of(context)
|
||||
.getVariableText(enText: 'Vehicles', ptText: 'Veículos'),
|
||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).headlineMediumFamily),
|
||||
),
|
||||
),
|
||||
leading: _backButton(context, FlutterFlowTheme.of(context)),
|
||||
title: Text(title, style: titleStyle),
|
||||
leading: backButton,
|
||||
centerTitle: true,
|
||||
elevation: 0.0,
|
||||
actions: [],
|
||||
|
@ -151,131 +124,22 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty>
|
|||
}
|
||||
|
||||
Widget _backButton(BuildContext context, FlutterFlowTheme theme) {
|
||||
final Icon icon = Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: theme.primaryText,
|
||||
size: 30.0,
|
||||
);
|
||||
onPressed() => Navigator.of(context).pop();
|
||||
return FlutterFlowIconButton(
|
||||
key: ValueKey<String>('BackNavigationAppBar'),
|
||||
borderColor: Colors.transparent,
|
||||
borderRadius: 30.0,
|
||||
borderWidth: 1.0,
|
||||
buttonSize: 60.0,
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: theme.primaryText,
|
||||
size: 30.0,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: icon,
|
||||
onPressed: onPressed,
|
||||
);
|
||||
}
|
||||
|
||||
Future<ApiCallResponse?> _fetchVisits() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response =
|
||||
await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString());
|
||||
|
||||
final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? [];
|
||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||
|
||||
if (vehicles.isNotEmpty) {
|
||||
setState(() {
|
||||
_wrap.addAll(vehicles);
|
||||
_hasData = true;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
_showNoMoreDataSnackBar(context);
|
||||
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return null;
|
||||
} catch (e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed(
|
||||
"proccessRequest.php", "", "Consulta de Veículo", e, s);
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void _loadMore() {
|
||||
if (_hasData == true) {
|
||||
_pageNumber++;
|
||||
|
||||
_future = _fetchVisits();
|
||||
}
|
||||
}
|
||||
|
||||
void _showNoMoreDataSnackBar(BuildContext context) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Não há mais dados.",
|
||||
enText: "No more data.",
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
|
||||
),
|
||||
),
|
||||
duration: const Duration(seconds: 3),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _item(BuildContext context, dynamic uItem) {
|
||||
return CardItemTemplateComponentWidget(
|
||||
imagePath: null,
|
||||
labelsHashMap: {
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
||||
uItem['licensePlate'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:':
|
||||
uItem['model'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:':
|
||||
uItem['tag'] ?? '',
|
||||
},
|
||||
statusHashMap: [],
|
||||
onTapCardItemAction: () async {
|
||||
await showDialog(
|
||||
useSafeArea: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
alignment: Alignment.center,
|
||||
child: model.buildVehicleDetails(
|
||||
item: uItem,
|
||||
context: context,
|
||||
model: model,
|
||||
),
|
||||
);
|
||||
},
|
||||
).whenComplete(() {
|
||||
safeSetState(() {
|
||||
_pageNumber = 1;
|
||||
_wrap = [];
|
||||
_future = _fetchVisits()
|
||||
.then((value) => value!.jsonBody['vehicles'] ?? []);
|
||||
});
|
||||
}).catchError((e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed(
|
||||
"proccessRequest.php", "", "Consulta de Veículos", e, s);
|
||||
safeSetState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
/// -----------------------------------
|
||||
}
|
||||
|
|
|
@ -6,13 +6,12 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
|||
import 'package:hub/flutter_flow/internationalization.dart';
|
||||
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
||||
|
||||
class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
||||
class VisitsModel extends FlutterFlowModel<VehiclePage> {
|
||||
static VisitsModel? _instance;
|
||||
|
||||
VisitsModel._internal({this.onRefresh});
|
||||
|
||||
factory VisitsModel({VoidCallback? onRefresh}) =>
|
||||
_instance ??= VisitsModel._internal(onRefresh: onRefresh);
|
||||
factory VisitsModel({VoidCallback? onRefresh}) => _instance ??= VisitsModel._internal(onRefresh: onRefresh);
|
||||
|
||||
static void resetInstance() => _instance = null;
|
||||
late final VoidCallback? onRefresh;
|
||||
|
@ -34,8 +33,7 @@ class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
|||
|
||||
Future<void> initAsync() async {
|
||||
devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
cliUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
onRefresh?.call();
|
||||
}
|
||||
|
||||
|
@ -89,9 +87,7 @@ class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
|||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: item['VTA_FIXA'] ? "Entrada Recorrente" : "Entrada Única",
|
||||
enText: item['VTA_FIXA'] ? "Recurrent Entry" : "Single Entry",
|
||||
): item['VTA_FIXA'] == false
|
||||
? FlutterFlowTheme.of(context).success
|
||||
: FlutterFlowTheme.of(context).warning,
|
||||
): item['VTA_FIXA'] == false ? FlutterFlowTheme.of(context).success : FlutterFlowTheme.of(context).warning,
|
||||
})
|
||||
],
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue