WIP
This commit is contained in:
parent
8573d722f5
commit
56f16d2934
|
@ -25,7 +25,7 @@ Future<void> _loggedWithMultiLocalsAccount(
|
|||
.set(ProfileStorageKey.ownerUUID.key, '7');
|
||||
await StorageHelper() //
|
||||
.set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO');
|
||||
await PhpGroup //
|
||||
await FreAccessWSGlobal //
|
||||
.resopndeVinculo
|
||||
.call(tarefa: 'A');
|
||||
await LicenseRepositoryImpl() //
|
||||
|
@ -58,7 +58,7 @@ Future<void> _loggedWithSomeoneLocalAccount(
|
|||
.set(ProfileStorageKey.ownerUUID.key, '7');
|
||||
await StorageHelper() //
|
||||
.set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO');
|
||||
await PhpGroup //
|
||||
await FreAccessWSGlobal //
|
||||
.resopndeVinculo
|
||||
.call(tarefa: 'A');
|
||||
await LicenseRepositoryImpl() //
|
||||
|
|
|
@ -77,7 +77,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
|||
Future<ApiCallResponse?> _fetchLocals() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
widget.response = await PhpGroup.getLocalsCall.call();
|
||||
widget.response = await FreAccessWSGlobal.getLocalsCall.call();
|
||||
final bool isError = widget.response?.jsonBody['error'];
|
||||
|
||||
if (isError) {
|
||||
|
@ -149,7 +149,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
|||
Future<dynamic> _fetchResponseLink(String status, String cliID) async {
|
||||
try {
|
||||
await StorageHelper().set(ProfileStorageKey.clientUUID.key, cliID);
|
||||
var response = await PhpGroup.resopndeVinculo.call(tarefa: status);
|
||||
var response =
|
||||
await FreAccessWSGlobal.resopndeVinculo.call(tarefa: status);
|
||||
|
||||
if (response.jsonBody['error'] == false) {
|
||||
return {
|
||||
|
|
|
@ -781,7 +781,7 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
|
|||
IconButton(
|
||||
onPressed: () async {
|
||||
_model.postScheduleVisit =
|
||||
await PhpGroup.postScheduleVisitCall.call(
|
||||
await FreAccessWSGlobal.postScheduleVisitCall.call(
|
||||
devDesc: widget.visitObsStr,
|
||||
idVisitante: widget.visitorStrList,
|
||||
dtInicio:
|
||||
|
@ -793,13 +793,14 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
|
|||
obs: widget.visitObsStr,
|
||||
);
|
||||
|
||||
if (PhpGroup.postScheduleVisitCall.error(
|
||||
if (FreAccessWSGlobal.postScheduleVisitCall.error(
|
||||
(_model.postScheduleVisit?.jsonBody ?? ''),
|
||||
) ==
|
||||
false) {
|
||||
context.pop();
|
||||
} else {
|
||||
final String? msg = PhpGroup.postScheduleVisitCall.errorMsg(
|
||||
final String? msg =
|
||||
FreAccessWSGlobal.postScheduleVisitCall.errorMsg(
|
||||
(_model.postScheduleVisit?.jsonBody ?? ''),
|
||||
);
|
||||
await DialogUtil.error(context, msg!)
|
||||
|
|
|
@ -75,7 +75,7 @@ class _UpArrowLinkedLocalsComponentWidgetState
|
|||
),
|
||||
),
|
||||
child: FutureBuilder<ApiCallResponse>(
|
||||
future: PhpGroup.getLocalsCall.call(),
|
||||
future: FreAccessWSGlobal.getLocalsCall.call(),
|
||||
builder: (context, snapshot) {
|
||||
// Customize what your widget looks like when it's loading.
|
||||
if (!snapshot.hasData) {
|
||||
|
@ -94,7 +94,7 @@ class _UpArrowLinkedLocalsComponentWidgetState
|
|||
|
||||
return Builder(
|
||||
builder: (context) {
|
||||
final eachLocals = (PhpGroup.getLocalsCall
|
||||
final eachLocals = (FreAccessWSGlobal.getLocalsCall
|
||||
.locais(
|
||||
gridViewGetLocalsResponse.jsonBody,
|
||||
)
|
||||
|
|
|
@ -63,14 +63,14 @@ class AccessNotificationModalTemplateComponentModel
|
|||
}) async {
|
||||
ApiCallResponse? visitRequest;
|
||||
|
||||
visitRequest = await PhpGroup.respondeSolicitacaoCall.call(
|
||||
visitRequest = await FreAccessWSGlobal.respondeSolicitacaoCall.call(
|
||||
referencia: refUUID,
|
||||
tarefa: actionValue,
|
||||
resposta: responseValue,
|
||||
idVisitante: vteUUID,
|
||||
);
|
||||
|
||||
if (PhpGroup.respondeSolicitacaoCall.error(
|
||||
if (FreAccessWSGlobal.respondeSolicitacaoCall.error(
|
||||
(visitRequest.jsonBody ?? ''),
|
||||
) ==
|
||||
false) {
|
||||
|
|
|
@ -951,7 +951,8 @@ class _ScheduleProvisionalVisitPageWidgetState
|
|||
? null
|
||||
: () async {
|
||||
try {
|
||||
model.provVisitSchedule = await PhpGroup
|
||||
model.provVisitSchedule =
|
||||
await FreAccessWSGlobal
|
||||
.postProvVisitSchedulingCall
|
||||
.call(
|
||||
data: DateFormat('dd/MM/yyyy HH:mm:ss')
|
||||
|
@ -964,7 +965,8 @@ class _ScheduleProvisionalVisitPageWidgetState
|
|||
nome: model.personNameTextController.text,
|
||||
proID: model.ownerUUID,
|
||||
);
|
||||
if (PhpGroup.postProvVisitSchedulingCall
|
||||
if (FreAccessWSGlobal
|
||||
.postProvVisitSchedulingCall
|
||||
.error((model.provVisitSchedule
|
||||
?.jsonBody ??
|
||||
'')) ==
|
||||
|
@ -982,7 +984,7 @@ class _ScheduleProvisionalVisitPageWidgetState
|
|||
model.notesTextController?.clear();
|
||||
});
|
||||
} else {
|
||||
var message = PhpGroup
|
||||
var message = FreAccessWSGlobal
|
||||
.postProvVisitSchedulingCall
|
||||
.msg((model.provVisitSchedule
|
||||
?.jsonBody ??
|
||||
|
|
|
@ -46,7 +46,7 @@ class RegisiterVistorTemplateComponentModel
|
|||
|
||||
Future<bool> getVisitanteByDocument(
|
||||
String document, BuildContext context) async {
|
||||
final response = await PhpGroup.getVisitorByDocCall.call(
|
||||
final response = await FreAccessWSGlobal.getVisitorByDocCall.call(
|
||||
documento: document,
|
||||
);
|
||||
|
||||
|
|
|
@ -760,7 +760,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
_model.uploadedLocalFile,
|
||||
);
|
||||
_model.scheduleVisitor =
|
||||
await PhpGroup.postScheduleVisitorCall
|
||||
await FreAccessWSGlobal.postScheduleVisitorCall
|
||||
.call(
|
||||
documento: _model.textController2.text,
|
||||
nome: _model.textController1.text,
|
||||
|
@ -775,7 +775,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
.onError((e, s) async {
|
||||
return await DialogUtil.errorDefault(context);
|
||||
});
|
||||
if (PhpGroup.postScheduleVisitorCall.error(
|
||||
if (FreAccessWSGlobal.postScheduleVisitorCall.error(
|
||||
(_model.scheduleVisitor?.jsonBody ?? ''),
|
||||
) ==
|
||||
false) {
|
||||
|
@ -822,8 +822,8 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
} else {
|
||||
return await DialogUtil.error(
|
||||
context,
|
||||
PhpGroup.postScheduleVisitorCall.errorMsg(
|
||||
_model
|
||||
FreAccessWSGlobal.postScheduleVisitorCall
|
||||
.errorMsg(_model
|
||||
.scheduleVisitor?.jsonBody) ==
|
||||
null
|
||||
? FFLocalizations.of(context)
|
||||
|
@ -832,7 +832,8 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
'Erro ao se conectar com o servidor',
|
||||
enText: 'Error connecting to server',
|
||||
)
|
||||
: PhpGroup.postScheduleVisitorCall
|
||||
: FreAccessWSGlobal
|
||||
.postScheduleVisitorCall
|
||||
.errorMsg(
|
||||
_model.scheduleVisitor?.jsonBody)
|
||||
.toString());
|
||||
|
|
|
@ -818,11 +818,11 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
|||
),
|
||||
onPressed: () async {
|
||||
_model.deleteVisit =
|
||||
await PhpGroup.deleteVisitCall.call(
|
||||
await FreAccessWSGlobal.deleteVisitCall.call(
|
||||
idVisita: widget.visitIdStr,
|
||||
);
|
||||
|
||||
if (PhpGroup.deleteVisitCall.error(
|
||||
if (FreAccessWSGlobal.deleteVisitCall.error(
|
||||
(_model.deleteVisit?.jsonBody ?? ''),
|
||||
) ==
|
||||
false) {
|
||||
|
|
|
@ -406,23 +406,23 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
|||
_model.textController?.selection =
|
||||
TextSelection.collapsed(offset: _model.textController!.text.length);
|
||||
});
|
||||
_model.getVisitorByDoc = await PhpGroup.getVisitorByDocCall.call(
|
||||
_model.getVisitorByDoc = await FreAccessWSGlobal.getVisitorByDocCall.call(
|
||||
documento: _model.textController.text.replaceFirst(RegExp(r'^0+'), ''));
|
||||
|
||||
if (PhpGroup.getVisitorByDocCall
|
||||
if (FreAccessWSGlobal.getVisitorByDocCall
|
||||
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
|
||||
'0' &&
|
||||
PhpGroup.getVisitorByDocCall
|
||||
FreAccessWSGlobal.getVisitorByDocCall
|
||||
.error((_model.getVisitorByDoc?.jsonBody ?? '')) ==
|
||||
false &&
|
||||
PhpGroup.getVisitorByDocCall
|
||||
FreAccessWSGlobal.getVisitorByDocCall
|
||||
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
|
||||
null) {
|
||||
String newDoc =
|
||||
_model.textController.text.replaceFirst(RegExp(r'^0+'), '');
|
||||
bool existDoc = _model.docs.contains(newDoc);
|
||||
if (existDoc == false) {
|
||||
_model.addToVisitors(PhpGroup.getVisitorByDocCall
|
||||
_model.addToVisitors(FreAccessWSGlobal.getVisitorByDocCall
|
||||
.visitante((_model.getVisitorByDoc?.jsonBody ?? '')));
|
||||
safeSetState(() {});
|
||||
_model.addToDocs(
|
||||
|
|
|
@ -14,7 +14,7 @@ import '../../../flutter_flow/random_data_util.dart';
|
|||
class AuthenticationService {
|
||||
static Future<void> login(BuildContext context) async {
|
||||
try {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
|
||||
final response = await callback.call();
|
||||
|
||||
if (response.jsonBody['error']) {
|
||||
|
@ -46,7 +46,7 @@ class AuthenticationService {
|
|||
}) async {
|
||||
try {
|
||||
final ApiCallResponse? response;
|
||||
final LoginCall callback = PhpGroup.loginCall;
|
||||
final LoginCall callback = FreAccessWSGlobal.loginCall;
|
||||
String deviceDescription = randomString(10, 10, true, false, false);
|
||||
await StorageHelper()
|
||||
.set(SecureStorageKey.deviceDescription.value, deviceDescription);
|
||||
|
@ -111,7 +111,7 @@ class AuthenticationService {
|
|||
if ((email != null && email != '') &&
|
||||
(passwd != null && passwd != '' && passwd.length > 7) &&
|
||||
(name != null && name != '')) {
|
||||
response = await PhpGroup.registerCall.call(
|
||||
response = await FreAccessWSGlobal.registerCall.call(
|
||||
name: name,
|
||||
password: passwd,
|
||||
email: email,
|
||||
|
@ -137,7 +137,7 @@ class AuthenticationService {
|
|||
}
|
||||
|
||||
static Future<void> signOut(BuildContext context) async {
|
||||
await PhpGroup.unregisterDevice.call();
|
||||
await FreAccessWSGlobal.unregisterDevice.call();
|
||||
final Map<String, dynamic> extra = <String, dynamic>{
|
||||
kTransitionInfoKey: const TransitionInfo(
|
||||
hasTransition: true,
|
||||
|
@ -158,7 +158,7 @@ class AuthenticationService {
|
|||
static Future<bool> forgotPassword(BuildContext context, String email) async {
|
||||
try {
|
||||
final ApiCallResponse? response;
|
||||
final ForgotPasswordCall callback = PhpGroup.forgotPasswordCall;
|
||||
final ForgotPasswordCall callback = FreAccessWSGlobal.forgotPasswordCall;
|
||||
final String message = FFLocalizations.of(context).getVariableText(
|
||||
enText: "Send E-mail Successful!",
|
||||
ptText: "E-mail Enviado com Sucesso!");
|
||||
|
@ -183,7 +183,8 @@ class AuthenticationService {
|
|||
static Future<bool> changePassword(
|
||||
BuildContext context, String email, String password, String token) async {
|
||||
try {
|
||||
final ApiCallResponse response = await PhpGroup.changePasswordCall
|
||||
final ApiCallResponse response = await FreAccessWSGlobal
|
||||
.changePasswordCall
|
||||
.call(email: email, psswd: password, token: token);
|
||||
|
||||
if (response.jsonBody['error'] == false) {
|
||||
|
@ -209,7 +210,7 @@ class AuthenticationService {
|
|||
static Future<void> deleteAccount(BuildContext context) async {
|
||||
String content;
|
||||
try {
|
||||
await PhpGroup.deleteAccount.call().then((value) async {
|
||||
await FreAccessWSGlobal.deleteAccount.call().then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Account deleted successfully',
|
||||
|
|
|
@ -24,7 +24,9 @@ abstract class Api {
|
|||
GetLicense getLicense = GetLicense();
|
||||
}
|
||||
|
||||
class PhpGroup extends Api {
|
||||
abstract class Endpoint {}
|
||||
|
||||
class FreAccessWSGlobal extends Api {
|
||||
static String getBaseUrl() => 'https://freaccess.com.br/freaccess';
|
||||
static Map<String, String> headers = {};
|
||||
static LoginCall loginCall = LoginCall();
|
||||
|
@ -70,11 +72,86 @@ class PhpGroup extends Api {
|
|||
static GetOpenedVisits getOpenedVisits = GetOpenedVisits();
|
||||
GetLicense getLicense = GetLicense();
|
||||
static GetProvSchedules getProvSchedules = GetProvSchedules();
|
||||
static GetCategories getCategories = GetCategories();
|
||||
static GetDocuments getDocuments = GetDocuments();
|
||||
}
|
||||
|
||||
class GetProvSchedules {
|
||||
class GetCategories extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = FreAccessWSGlobal.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 = 'listaCategoriasDocumentos';
|
||||
const String pageSize = '10';
|
||||
// final bool isFiltered = filter != '' && filter != '.*';
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'listaCategoriasDocumentos',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||
params: {
|
||||
// if (isFiltered) 'filter': filter,
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'pageSize': pageSize,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GetDocuments extends Endpoint {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = FreAccessWSGlobal.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 = 'listaDocumentos';
|
||||
const String pageSize = '10';
|
||||
// final bool isFiltered = filter != '' && filter != '.*';
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'listaDocumentos',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||
params: {
|
||||
// if (isFiltered) 'filter': filter,
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'page': page,
|
||||
'pageSize': pageSize,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GetProvSchedules extends Endpoint {
|
||||
Future<ApiCallResponse> call(final String page, final String status) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
|
@ -110,9 +187,9 @@ class GetProvSchedules {
|
|||
}
|
||||
}
|
||||
|
||||
class GetOpenedVisits {
|
||||
class GetOpenedVisits extends Endpoint {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
|
@ -145,9 +222,9 @@ class GetOpenedVisits {
|
|||
}
|
||||
}
|
||||
|
||||
class GetResidentsByProperty {
|
||||
class GetResidentsByProperty extends Endpoint {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
||||
final String userUUID =
|
||||
|
@ -179,9 +256,9 @@ class GetResidentsByProperty {
|
|||
}
|
||||
}
|
||||
|
||||
class GetVehiclesByProperty {
|
||||
class GetVehiclesByProperty extends Endpoint {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
|
@ -215,9 +292,9 @@ class GetVehiclesByProperty {
|
|||
static GetLicense getLicense = GetLicense();
|
||||
}
|
||||
|
||||
class GetLicense {
|
||||
class GetLicense extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
|
@ -249,9 +326,9 @@ class GetLicense {
|
|||
}
|
||||
}
|
||||
|
||||
class UnregisterDevice {
|
||||
class UnregisterDevice extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
|
@ -279,9 +356,9 @@ class UnregisterDevice {
|
|||
}
|
||||
}
|
||||
|
||||
class DeletePet {
|
||||
class DeletePet extends Endpoint {
|
||||
Future<ApiCallResponse> call({final int? petID = 0}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
|
@ -315,7 +392,7 @@ class DeletePet {
|
|||
}
|
||||
}
|
||||
|
||||
class UpdatePet {
|
||||
class UpdatePet extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final int? petID,
|
||||
final String? image,
|
||||
|
@ -328,7 +405,7 @@ class UpdatePet {
|
|||
final String? size,
|
||||
final String? notes,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -374,12 +451,12 @@ class UpdatePet {
|
|||
}
|
||||
}
|
||||
|
||||
class GetPets {
|
||||
class GetPets extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final int? page,
|
||||
final int? pageSize,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -414,9 +491,9 @@ class GetPets {
|
|||
}
|
||||
}
|
||||
|
||||
class GetPetPhoto {
|
||||
class GetPetPhoto extends Endpoint {
|
||||
Future<ApiCallResponse> call({final int? petId}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -450,7 +527,7 @@ class GetPetPhoto {
|
|||
}
|
||||
}
|
||||
|
||||
class RegisterPet {
|
||||
class RegisterPet extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? image,
|
||||
final String? name,
|
||||
|
@ -462,7 +539,7 @@ class RegisterPet {
|
|||
final String? size,
|
||||
final String? notes,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -507,7 +584,7 @@ class RegisterPet {
|
|||
}
|
||||
}
|
||||
|
||||
class BuscaEnconcomendas {
|
||||
class BuscaEnconcomendas extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? page,
|
||||
final String? pageSize,
|
||||
|
@ -522,7 +599,7 @@ class BuscaEnconcomendas {
|
|||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||
const String atividade = 'getEncomendas';
|
||||
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getEncomendas',
|
||||
|
@ -551,7 +628,7 @@ class BuscaEnconcomendas {
|
|||
}
|
||||
}
|
||||
|
||||
class CancelaVisita {
|
||||
class CancelaVisita extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final int? idDestino,
|
||||
final int? idVisita,
|
||||
|
@ -559,7 +636,7 @@ class CancelaVisita {
|
|||
final String? UsuEmail,
|
||||
final String? DevDesc,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -596,14 +673,14 @@ class CancelaVisita {
|
|||
}
|
||||
}
|
||||
|
||||
class DeleteAccount {
|
||||
class DeleteAccount extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'deleteAccount',
|
||||
apiUrl: '$baseUrl/deleteAccount.php',
|
||||
|
@ -626,11 +703,11 @@ class DeleteAccount {
|
|||
}
|
||||
}
|
||||
|
||||
class ChangePanic {
|
||||
class ChangePanic extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? newSenhaPanico,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -665,11 +742,11 @@ class ChangePanic {
|
|||
}
|
||||
}
|
||||
|
||||
class ChangePass {
|
||||
class ChangePass extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? newSenha,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -704,11 +781,11 @@ class ChangePass {
|
|||
}
|
||||
}
|
||||
|
||||
class RespondeVinculo {
|
||||
class RespondeVinculo extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? tarefa,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -741,11 +818,11 @@ class RespondeVinculo {
|
|||
}
|
||||
}
|
||||
|
||||
class ChangeNotifica {
|
||||
class ChangeNotifica extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? notifica,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -780,9 +857,9 @@ class ChangeNotifica {
|
|||
}
|
||||
}
|
||||
|
||||
class UpdateIDE {
|
||||
class UpdateIDE extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -819,9 +896,9 @@ class UpdateIDE {
|
|||
}
|
||||
}
|
||||
|
||||
class UpdToken {
|
||||
class UpdToken extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -852,9 +929,9 @@ class UpdToken {
|
|||
}
|
||||
}
|
||||
|
||||
class LoginCall {
|
||||
class LoginCall extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String email =
|
||||
|
@ -902,7 +979,7 @@ class LoginCall {
|
|||
}
|
||||
}
|
||||
|
||||
class RegisterCall {
|
||||
class RegisterCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
required final String name,
|
||||
required final String email,
|
||||
|
@ -912,7 +989,7 @@ class RegisterCall {
|
|||
required final String tipo,
|
||||
required final String descricao,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'register',
|
||||
|
@ -941,13 +1018,13 @@ class RegisterCall {
|
|||
}
|
||||
}
|
||||
|
||||
class ChangePasswordCall {
|
||||
class ChangePasswordCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
required final String email,
|
||||
required final String token,
|
||||
required final String psswd,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
final String userUUID =
|
||||
|
@ -981,11 +1058,11 @@ class ChangePasswordCall {
|
|||
}
|
||||
}
|
||||
|
||||
class ForgotPasswordCall {
|
||||
class ForgotPasswordCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? email,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'forgotPassword',
|
||||
|
@ -1008,9 +1085,9 @@ class ForgotPasswordCall {
|
|||
}
|
||||
}
|
||||
|
||||
class GetLocalsCall {
|
||||
class GetLocalsCall extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
||||
|
@ -1047,14 +1124,14 @@ class GetLocalsCall {
|
|||
) as List?;
|
||||
}
|
||||
|
||||
class PostScheduleVisitorCall {
|
||||
class PostScheduleVisitorCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
required final String documento,
|
||||
required final String nome,
|
||||
required final String tipo,
|
||||
required final String foto,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -1101,7 +1178,7 @@ class PostScheduleVisitorCall {
|
|||
));
|
||||
}
|
||||
|
||||
class PostScheduleVisitCall {
|
||||
class PostScheduleVisitCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? devDesc,
|
||||
final String? idVisitante,
|
||||
|
@ -1112,7 +1189,7 @@ class PostScheduleVisitCall {
|
|||
final int? idNAC,
|
||||
final String? obs,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -1163,13 +1240,13 @@ class PostScheduleVisitCall {
|
|||
));
|
||||
}
|
||||
|
||||
class GetScheduleVisitCall {
|
||||
class GetScheduleVisitCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final int? pageSize,
|
||||
final int? pageNumber,
|
||||
final String? chaveBusca,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -1444,9 +1521,9 @@ class GetScheduleVisitCall {
|
|||
));
|
||||
}
|
||||
|
||||
class GetDadosCall {
|
||||
class GetDadosCall extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -1690,11 +1767,11 @@ class GetDadosCall {
|
|||
));
|
||||
}
|
||||
|
||||
class GetVisitorByDocCall {
|
||||
class GetVisitorByDocCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? documento,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -1746,12 +1823,12 @@ class GetVisitorByDocCall {
|
|||
));
|
||||
}
|
||||
|
||||
class GetFotoVisitanteCall {
|
||||
class GetFotoVisitanteCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? documento,
|
||||
final String? tipo,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -1786,14 +1863,14 @@ class GetFotoVisitanteCall {
|
|||
}
|
||||
}
|
||||
|
||||
class PostProvVisitSchedulingCall {
|
||||
class PostProvVisitSchedulingCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? data,
|
||||
final String? motivo,
|
||||
final String? nome,
|
||||
final String? proID,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -1840,12 +1917,12 @@ class PostProvVisitSchedulingCall {
|
|||
));
|
||||
}
|
||||
|
||||
class GetVisitsCall {
|
||||
class GetVisitsCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final int? pageSize,
|
||||
final int? pageNumber,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -2107,11 +2184,11 @@ class GetVisitsCall {
|
|||
.toList();
|
||||
}
|
||||
|
||||
class DeleteVisitCall {
|
||||
class DeleteVisitCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? idVisita,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -2155,9 +2232,9 @@ class DeleteVisitCall {
|
|||
));
|
||||
}
|
||||
|
||||
class GetPessoasLocalCall {
|
||||
class GetPessoasLocalCall extends Endpoint {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -2220,14 +2297,14 @@ class GetPessoasLocalCall {
|
|||
.toList();
|
||||
}
|
||||
|
||||
class RespondeSolicitacaoCall {
|
||||
class RespondeSolicitacaoCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? referencia,
|
||||
final String? tarefa,
|
||||
final String? resposta,
|
||||
final String? idVisitante,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -2274,13 +2351,13 @@ class RespondeSolicitacaoCall {
|
|||
));
|
||||
}
|
||||
|
||||
class GetAccessCall {
|
||||
class GetAccessCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? pageSize,
|
||||
final String? pageNumber,
|
||||
final String? pesTipo,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
@ -2528,9 +2605,9 @@ class GetAccessCall {
|
|||
.toList();
|
||||
}
|
||||
|
||||
class GetLiberationsCall {
|
||||
class GetLiberationsCall extends Endpoint {
|
||||
Stream<ApiCallResponse> call() {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
final StreamController<ApiCallResponse> controller = StreamController();
|
||||
|
||||
Future.microtask(() async {
|
||||
|
@ -2721,13 +2798,13 @@ class GetLiberationsCall {
|
|||
.toList();
|
||||
}
|
||||
|
||||
class GetMessagesCall {
|
||||
class GetMessagesCall extends Endpoint {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? pageSize,
|
||||
final String? pageNumber,
|
||||
final String? tipoDestino,
|
||||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String baseUrl = FreAccessWSGlobal.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||
|
|
|
@ -12,7 +12,6 @@ interface class Category extends Entity {
|
|||
|
||||
interface class Document extends Entity {
|
||||
final String title;
|
||||
final String description;
|
||||
final Category category;
|
||||
final String to;
|
||||
final String from;
|
||||
|
@ -26,7 +25,6 @@ interface class Document extends Entity {
|
|||
required this.to,
|
||||
required this.from,
|
||||
required this.title,
|
||||
required this.description,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,20 @@ class DocumentManagerScreen extends StatelessScreen {
|
|||
document.updatedAt.toLowerCase().contains(lowerQuery);
|
||||
}
|
||||
|
||||
DocumentItem itemBuilder(document) => DocumentItem(document: document);
|
||||
DocumentItem itemBuilder(dynamic item) {
|
||||
log('item: $item');
|
||||
|
||||
final doc = Document(
|
||||
createdAt: '00/00/00',
|
||||
updatedAt: '00/00/00',
|
||||
category: Category(color: Colors.black, title: item['category']),
|
||||
to: item['person'],
|
||||
from: '',
|
||||
title: item['description'],
|
||||
);
|
||||
final docItem = DocumentItem(document: doc);
|
||||
return docItem;
|
||||
}
|
||||
|
||||
void filterByCategory(Category query) {
|
||||
print('Test');
|
||||
|
@ -75,13 +88,15 @@ class DocumentManagerScreen extends StatelessScreen {
|
|||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: LocalSearchView<Document>(
|
||||
child: RemoteSearchListView<dynamic>(
|
||||
key: _listViewKey,
|
||||
header: header,
|
||||
onSearch: filterByString,
|
||||
list: documents,
|
||||
itemBuilder: itemBuilder,
|
||||
filter: filter,
|
||||
title: '',
|
||||
// fetchItems: (String ) { },,
|
||||
),
|
||||
),
|
||||
] //
|
||||
|
|
|
@ -8,7 +8,6 @@ List<Document> generateDocuments(int count) {
|
|||
count,
|
||||
(index) => Document(
|
||||
title: 'Lorem Ipsum et Cetera $index',
|
||||
description: 'Description for document $index',
|
||||
category: Category(color: color(), title: str()),
|
||||
to: str(),
|
||||
from: str(),
|
||||
|
|
|
@ -198,7 +198,7 @@ class _AccessHistoryState extends State<AccessHistoryScreen> {
|
|||
Future<ApiCallResponse?> fetchAccessHistoryService() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
var response = await PhpGroup.getAccessCall.call(
|
||||
var response = await FreAccessWSGlobal.getAccessCall.call(
|
||||
pageSize: _pageSize.toString(),
|
||||
pageNumber: _pageNumber.toString(),
|
||||
pesTipo: _personType != 'E' && _personType != 'O' ? 'T' : _personType,
|
||||
|
|
|
@ -222,8 +222,8 @@ class ProvisionalHistoryState extends State<ProvisionalHistoryPage> {
|
|||
Future<ApiCallResponse?> fetchHistoryService() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
var response =
|
||||
await PhpGroup.getProvSchedules(_pageNumber.toString(), status);
|
||||
var response = await FreAccessWSGlobal.getProvSchedules(
|
||||
_pageNumber.toString(), status);
|
||||
|
||||
final List<dynamic> history =
|
||||
response.jsonBody['agendamento']['value'] ?? [];
|
||||
|
|
|
@ -32,7 +32,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
@override
|
||||
Future<void> linkLocal(BuildContext context) async {
|
||||
try {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
|
||||
var response = await callback.call();
|
||||
final bool? isError = response.jsonBody['error'];
|
||||
|
||||
|
@ -72,7 +72,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
Future<bool> processLocals(BuildContext context) async {
|
||||
log('() => processLocals');
|
||||
try {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
|
||||
final ApiCallResponse response = await callback.call();
|
||||
final bool? isError = response.jsonBody['error'];
|
||||
|
||||
|
@ -163,10 +163,10 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
@override
|
||||
Future<bool> processProperty(BuildContext context) async {
|
||||
try {
|
||||
final GetDadosCall callback = PhpGroup.getDadosCall;
|
||||
final GetDadosCall callback = FreAccessWSGlobal.getDadosCall;
|
||||
ApiCallResponse? response = await callback.call();
|
||||
if (response.jsonBody == null) {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
|
||||
response = await callback.call();
|
||||
// final String errorMsg = FFLocalizations.of(context).getVariableText(
|
||||
// enText: 'Verify your connection',
|
||||
|
@ -178,7 +178,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
|
||||
final bool? isError = response.jsonBody['error'];
|
||||
if (isError == true) {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
|
||||
response = await callback.call();
|
||||
// final String errorMsg =
|
||||
// response.jsonBody['error_msg'] ?? 'Local indisponível';
|
||||
|
@ -231,8 +231,9 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
enText: 'Device unlinked successfully',
|
||||
ptText: 'Dispositivo desvinculado com sucesso',
|
||||
);
|
||||
final bool status =
|
||||
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async {
|
||||
final bool status = await FreAccessWSGlobal.resopndeVinculo
|
||||
.call(tarefa: 'I')
|
||||
.then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
await StorageHelper().set(ProfileStorageKey.clientName.key, '');
|
||||
await StorageHelper().set(ProfileStorageKey.ownerName.key, '');
|
||||
|
|
|
@ -52,7 +52,7 @@ class LocalUtil {
|
|||
await StorageHelper()
|
||||
.set(ProfileStorageKey.ownerName.key, locals[0]['CLU_OWNER_DSC']);
|
||||
|
||||
var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A');
|
||||
var response = await FreAccessWSGlobal.resopndeVinculo.call(tarefa: 'A');
|
||||
if (response.jsonBody['error'] == true) {
|
||||
await StorageHelper().set(ProfileStorageKey.clientUUID.key, '');
|
||||
await StorageHelper().set(ProfileStorageKey.ownerUUID.key, '');
|
||||
|
|
|
@ -37,7 +37,8 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> {
|
|||
}
|
||||
|
||||
Future<void> _onMenuEvent(MenuEvent event, Emitter<MenuState> emit) async {
|
||||
await LicenseRemoteDataSourceImpl(PhpGroup()).waitForSaveCompletion();
|
||||
await LicenseRemoteDataSourceImpl(FreAccessWSGlobal())
|
||||
.waitForSaveCompletion();
|
||||
|
||||
final List<MenuItem?> newEntries =
|
||||
await MenuRepositoryImpl().entries2Items(entries, item);
|
||||
|
|
|
@ -17,7 +17,7 @@ class LicenseRepositoryImpl implements LicenseRepository {
|
|||
|
||||
LicenseRepositoryImpl([Database? database, Api? api])
|
||||
: database = database ?? DatabaseService.database,
|
||||
api = api ?? PhpGroup() {
|
||||
api = api ?? FreAccessWSGlobal() {
|
||||
localDataSource = LicenseLocalDataSourceImpl(this.database);
|
||||
remoteDataSource = LicenseRemoteDataSourceImpl(this.api);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class FirebaseMessagingService {
|
|||
await StorageHelper().set(SecureStorageKey.token.value, deviceToken);
|
||||
final ApiCallResponse? response;
|
||||
|
||||
response = await PhpGroup.updToken.call();
|
||||
response = await FreAccessWSGlobal.updToken.call();
|
||||
|
||||
if (response.jsonBody['error'] == false) {
|
||||
log('Token Atualizado com Sucesso!');
|
||||
|
|
|
@ -25,7 +25,8 @@ Future<void> onMessageReceived(
|
|||
required String? response,
|
||||
required String? id}) async {
|
||||
final ApiCallResponse? respondeSolicitacaoCall;
|
||||
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
||||
final RespondeSolicitacaoCall callback =
|
||||
FreAccessWSGlobal.respondeSolicitacaoCall;
|
||||
|
||||
respondeSolicitacaoCall = await callback.call(
|
||||
referencia: ref,
|
||||
|
|
|
@ -50,7 +50,8 @@ class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
|||
required String? response,
|
||||
required String? id}) async {
|
||||
final ApiCallResponse? respondeSolicitacaoCall;
|
||||
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
||||
final RespondeSolicitacaoCall callback =
|
||||
FreAccessWSGlobal.respondeSolicitacaoCall;
|
||||
|
||||
respondeSolicitacaoCall = await callback.call(
|
||||
referencia: ref,
|
||||
|
|
|
@ -333,7 +333,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
|||
Future<ApiCallResponse?> _fetchRequests() async {
|
||||
try {
|
||||
safeSetState(() => _loading = true);
|
||||
var response = await PhpGroup.getLiberationsCall.call().first;
|
||||
var response = await FreAccessWSGlobal.getLiberationsCall.call().first;
|
||||
|
||||
final List<dynamic> requests = response.jsonBody['solicitacoes'] ?? [];
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
|
|||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response = await PhpGroup.getMessagesCall.call(
|
||||
var response = await FreAccessWSGlobal.getMessagesCall.call(
|
||||
pageSize: _pageSize.toString(),
|
||||
pageNumber: _pageNumber.toString(),
|
||||
tipoDestino: _destinyType,
|
||||
|
|
|
@ -97,7 +97,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
|||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response = await PhpGroup.buscaEnconcomendas.call(
|
||||
var response = await FreAccessWSGlobal.buscaEnconcomendas.call(
|
||||
pageSize: _pageSize.toString(),
|
||||
page: _pageNumber.toString(),
|
||||
adresseeType: _adresseeType == '.*' ? 'TOD' : _adresseeType,
|
||||
|
@ -314,7 +314,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
|||
}
|
||||
|
||||
String _imagePath(dynamic order) {
|
||||
return '${PhpGroup.getBaseUrl()}/getImage.php?cliID=$cliUUID&atividade=getFotoEncomenda&orderId=${order['id'] ?? ''}';
|
||||
return '${FreAccessWSGlobal.getBaseUrl()}/getImage.php?cliID=$cliUUID&atividade=getFotoEncomenda&orderId=${order['id'] ?? ''}';
|
||||
}
|
||||
|
||||
Map<String, String> _labelsHashMap(dynamic order) {
|
||||
|
|
|
@ -82,7 +82,7 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> {
|
|||
body: SafeArea(
|
||||
top: true,
|
||||
child: FutureBuilder<ApiCallResponse>(
|
||||
future: PhpGroup.getPessoasLocalCall.call(),
|
||||
future: FreAccessWSGlobal.getPessoasLocalCall.call(),
|
||||
builder: (context, snapshot) {
|
||||
// Customize what your widget looks like when it's loading.
|
||||
if (!snapshot.hasData) {
|
||||
|
@ -123,7 +123,7 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> {
|
|||
}
|
||||
|
||||
final columnGetPessoasLocalResponse = snapshot.data!;
|
||||
final getPoepleProperty = PhpGroup.getPessoasLocalCall
|
||||
final getPoepleProperty = FreAccessWSGlobal.getPessoasLocalCall
|
||||
.pessoas(
|
||||
columnGetPessoasLocalResponse.jsonBody,
|
||||
)
|
||||
|
|
|
@ -100,7 +100,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
|
|||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response = await PhpGroup.getPets.call(
|
||||
var response = await FreAccessWSGlobal.getPets.call(
|
||||
pageSize: _pageSize,
|
||||
page: _pageNumber,
|
||||
);
|
||||
|
|
|
@ -280,7 +280,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
img = "base64;jpeg,$img";
|
||||
final url =
|
||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId';
|
||||
final response = await PhpGroup.updatePet.call(
|
||||
final response = await FreAccessWSGlobal.updatePet.call(
|
||||
petID: petId,
|
||||
image: img,
|
||||
birthdayDate: textControllerData!.text,
|
||||
|
@ -323,7 +323,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
Future<void> registerPet() async {
|
||||
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
|
||||
img = "base64;jpeg,$img";
|
||||
final response = await PhpGroup.registerPet.call(
|
||||
final response = await FreAccessWSGlobal.registerPet.call(
|
||||
image: img,
|
||||
birthdayDate: textControllerData!.text,
|
||||
color: textControllerColor!.text,
|
||||
|
@ -464,7 +464,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
enText: 'Are you sure you want to delete this pet?',
|
||||
), () async {
|
||||
int id = item['id'];
|
||||
await PhpGroup.deletePet
|
||||
await FreAccessWSGlobal.deletePet
|
||||
.call(
|
||||
petID: id,
|
||||
)
|
||||
|
|
|
@ -62,7 +62,7 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
onConfirm() async {
|
||||
String content;
|
||||
String value = !isNotify ? 'S' : 'N';
|
||||
await PhpGroup.changeNotifica
|
||||
await FreAccessWSGlobal.changeNotifica
|
||||
.call(notifica: value)
|
||||
.then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
|
@ -109,7 +109,7 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
);
|
||||
onConfirm() async {
|
||||
String content;
|
||||
await PhpGroup.updateIDE.call().then((value) async {
|
||||
await FreAccessWSGlobal.updateIDE.call().then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
notifyListeners();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
|
@ -141,7 +141,7 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
Future<void> toggleAccess(BuildContext context) async {
|
||||
onChange(String key) async {
|
||||
await StorageHelper().set(SecureStorageKey.accessPass.value, key);
|
||||
await PhpGroup.changePass
|
||||
await FreAccessWSGlobal.changePass
|
||||
.call(newSenha: key)
|
||||
.then((value) async {
|
||||
final String content;
|
||||
|
@ -180,7 +180,7 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
Future<void> togglePanic(BuildContext context) async {
|
||||
onChange(String key) async {
|
||||
await StorageHelper().set(SecureStorageKey.panicPass.value, key);
|
||||
await PhpGroup.changePanic
|
||||
await FreAccessWSGlobal.changePanic
|
||||
.call(newSenhaPanico: key)
|
||||
.then((value) async {
|
||||
final String content;
|
||||
|
|
|
@ -180,7 +180,7 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget>
|
|||
padding: const EdgeInsets.fromLTRB(60, 0, 60, 25),
|
||||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
PhpGroup.unregisterDevice();
|
||||
FreAccessWSGlobal.unregisterDevice();
|
||||
AuthenticationService.signOut(context);
|
||||
setState(() {});
|
||||
},
|
||||
|
|
|
@ -175,8 +175,8 @@ class _ResidentsOnThePropertyState extends State<ResidentsOnTheProperty>
|
|||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response =
|
||||
await PhpGroup.getResidentsByProperty.call(_pageNumber.toString());
|
||||
var response = await FreAccessWSGlobal.getResidentsByProperty
|
||||
.call(_pageNumber.toString());
|
||||
|
||||
final List<dynamic> residents = response.jsonBody['residents'] ?? [];
|
||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||
|
|
|
@ -361,7 +361,7 @@ class ScheduleCompleteVisitPageModel
|
|||
required String? accessKey,
|
||||
required String? email}) async {
|
||||
final ApiCallResponse? response;
|
||||
final CancelaVisita callback = PhpGroup.cancelaVisita;
|
||||
final CancelaVisita callback = FreAccessWSGlobal.cancelaVisita;
|
||||
|
||||
response = await callback.call(
|
||||
idDestino: idDestino,
|
||||
|
|
|
@ -1072,7 +1072,8 @@ class _ScheduleCompleteVisitPageWidgetState
|
|||
height: scaledSizedBoxSize * 0.5,
|
||||
decoration: const BoxDecoration(),
|
||||
child: FutureBuilder<ApiCallResponse>(
|
||||
future: PhpGroup.getDadosCall.call(),
|
||||
future:
|
||||
FreAccessWSGlobal.getDadosCall.call(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Center(
|
||||
|
@ -1089,11 +1090,12 @@ class _ScheduleCompleteVisitPageWidgetState
|
|||
);
|
||||
}
|
||||
|
||||
final reasonsJsonList =
|
||||
PhpGroup.getDadosCall.reasonsJsonList(
|
||||
snapshot.data!.jsonBody);
|
||||
final reasonsOptionLabels = PhpGroup
|
||||
final reasonsJsonList = FreAccessWSGlobal
|
||||
.getDadosCall
|
||||
.reasonsJsonList(
|
||||
snapshot.data!.jsonBody);
|
||||
final reasonsOptionLabels =
|
||||
FreAccessWSGlobal.getDadosCall
|
||||
.reasonsMotDescStrList(
|
||||
snapshot.data!.jsonBody);
|
||||
|
||||
|
@ -1196,7 +1198,8 @@ class _ScheduleCompleteVisitPageWidgetState
|
|||
height: scaledSizedBoxSize * 0.5,
|
||||
decoration: const BoxDecoration(),
|
||||
child: FutureBuilder<ApiCallResponse>(
|
||||
future: PhpGroup.getDadosCall.call(),
|
||||
future:
|
||||
FreAccessWSGlobal.getDadosCall.call(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Center(
|
||||
|
@ -1213,11 +1216,12 @@ class _ScheduleCompleteVisitPageWidgetState
|
|||
);
|
||||
}
|
||||
|
||||
final lavelsJsonList =
|
||||
PhpGroup.getDadosCall.levelJsonList(
|
||||
snapshot.data!.jsonBody);
|
||||
final lavelsOptionLabels = PhpGroup
|
||||
final lavelsJsonList = FreAccessWSGlobal
|
||||
.getDadosCall
|
||||
.levelJsonList(
|
||||
snapshot.data!.jsonBody);
|
||||
final lavelsOptionLabels =
|
||||
FreAccessWSGlobal.getDadosCall
|
||||
.levelNACDescricaoStrList(
|
||||
snapshot.data!.jsonBody);
|
||||
model.processDropDown2(lavelsJsonList!);
|
||||
|
@ -1557,7 +1561,7 @@ class _ScheduleCompleteVisitPageWidgetState
|
|||
onPressed: model.isValid()
|
||||
? () async {
|
||||
Future<void> scheduleVisit() async {
|
||||
await PhpGroup.postScheduleVisitCall
|
||||
await FreAccessWSGlobal.postScheduleVisitCall
|
||||
.call(
|
||||
devDesc: model.textController3.text,
|
||||
idVisitante: model.visitorStrList,
|
||||
|
@ -1573,7 +1577,7 @@ class _ScheduleCompleteVisitPageWidgetState
|
|||
.catchError((e) async =>
|
||||
await DialogUtil.errorDefault(context))
|
||||
.then((value) async {
|
||||
if (PhpGroup.postScheduleVisitCall.error(
|
||||
if (FreAccessWSGlobal.postScheduleVisitCall.error(
|
||||
(value.jsonBody ?? ''),
|
||||
) ==
|
||||
false) {
|
||||
|
|
|
@ -76,7 +76,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
|||
setState(() => _loading = true);
|
||||
|
||||
var response = await ScheduleCompleteVisitPageModel().visitHistory(
|
||||
requestFn: () => PhpGroup.getVisitsCall.call(
|
||||
requestFn: () => FreAccessWSGlobal.getVisitsCall.call(
|
||||
pageSize: _pageSize,
|
||||
pageNumber: _pageNumber,
|
||||
),
|
||||
|
|
|
@ -170,8 +170,8 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty>
|
|||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response =
|
||||
await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString());
|
||||
var response = await FreAccessWSGlobal.getVehiclesByProperty
|
||||
.call(_pageNumber.toString());
|
||||
|
||||
final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? [];
|
||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||
|
|
|
@ -176,7 +176,7 @@ class _VisitsOnThePropertyState extends State<VisitsOnTheProperty>
|
|||
setState(() => _loading = true);
|
||||
|
||||
var response =
|
||||
await PhpGroup.getOpenedVisits.call(_pageNumber.toString());
|
||||
await FreAccessWSGlobal.getOpenedVisits.call(_pageNumber.toString());
|
||||
|
||||
final List<dynamic> visits = response.jsonBody['visitas'] ?? [];
|
||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/flutter_flow/index.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
|
||||
extension PagedListViewExtension<PageKeyType, ItemType>
|
||||
on PagedSliverList<PageKeyType, ItemType> {}
|
||||
|
||||
mixin Pageable<T extends StatefulWidget> on State<T> {
|
||||
Expanded buildPaginatedListView<X, Y>(
|
||||
String noDataFound,
|
||||
PagingController<X, Y> pg,
|
||||
Widget Function(BuildContext, Y, int) itemBuilder) {
|
||||
final theme = FlutterFlowTheme.of(context);
|
||||
|
||||
return Expanded(
|
||||
child: RefreshIndicator(
|
||||
backgroundColor: theme.primaryBackground,
|
||||
color: theme.primary,
|
||||
onRefresh: () async => pg.refresh(),
|
||||
child: PagedListView<X, Y>(
|
||||
pagingController: pg,
|
||||
builderDelegate: PagedChildBuilderDelegate<Y>(
|
||||
animateTransitions: true,
|
||||
itemBuilder: (context, item, index) =>
|
||||
itemBuilder(context, item, index),
|
||||
// noMoreItemsIndicatorBuilder: ,
|
||||
newPageProgressIndicatorBuilder: (context) =>
|
||||
buildLoadingIndicator(context),
|
||||
firstPageProgressIndicatorBuilder: (context) =>
|
||||
buildLoadingIndicator(context),
|
||||
noItemsFoundIndicatorBuilder: (context) =>
|
||||
buildNoDataFound(context, noDataFound),
|
||||
firstPageErrorIndicatorBuilder: (context) => const Placeholder(),
|
||||
newPageErrorIndicatorBuilder: (context) => const Placeholder(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showError(PagingStatus status, PagingController pg) async {
|
||||
if (status == PagingStatus.subsequentPageError) {
|
||||
final message = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Something went wrong while fetching a new page.',
|
||||
ptText: 'Algo deu errado ao buscar uma nova página.',
|
||||
);
|
||||
final retry = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Retry',
|
||||
ptText: 'Recarregar',
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
action: SnackBarAction(
|
||||
label: retry,
|
||||
onPressed: () => pg.retryLastFailedRequest(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> fetchPage({
|
||||
required Future<(bool, dynamic)> Function() dataProvider,
|
||||
required void Function(dynamic data) onDataAvailable,
|
||||
required void Function() onDataUnavailable,
|
||||
required void Function(Object error, StackTrace stackTrace) onFetchError,
|
||||
}) async {
|
||||
try {
|
||||
final (bool isDataAvailable, dynamic data) = await dataProvider();
|
||||
if (isDataAvailable) {
|
||||
onDataAvailable(data);
|
||||
} else {
|
||||
onDataUnavailable();
|
||||
}
|
||||
} catch (error, stackTrace) {
|
||||
onFetchError(error, stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
void showNoMoreDataSnackBar(BuildContext context) {
|
||||
final message = FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Não há mais dados.",
|
||||
enText: "No more data.",
|
||||
);
|
||||
|
||||
showSnackbar(context, message, true);
|
||||
}
|
||||
|
||||
Widget buildNoDataFound(BuildContext context, String title) {
|
||||
final headerFontSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
// final bodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context);
|
||||
return Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: headerFontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildLoadingIndicator(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ import 'package:hub/features/backend/index.dart';
|
|||
class LogUtil {
|
||||
static void requestAPIFailed(String url, String body, String reason,
|
||||
dynamic error, StackTrace stack) async {
|
||||
final fullUrl = "${PhpGroup.getBaseUrl()}/$url";
|
||||
final fullUrl = "${FreAccessWSGlobal.getBaseUrl()}/$url";
|
||||
log("URL: $fullUrl");
|
||||
log("Body: $body");
|
||||
log("Reason: $reason");
|
||||
|
|
|
@ -109,53 +109,122 @@ class LocalSearchViewState<T> extends State<LocalSearchView<T>> {
|
|||
}
|
||||
|
||||
class RemoteSearchListView<T> extends SearchView<T> {
|
||||
final List<T> items;
|
||||
final List<T> list;
|
||||
final String title;
|
||||
final Widget Function(T) itemBuilder;
|
||||
final Future<List<T>> Function(String) fetchItems;
|
||||
// final Future<List<T>> Function(String) fetchItems;
|
||||
final bool Function(T, String) filter;
|
||||
final Widget header;
|
||||
final List<T> Function(String)? onSearch;
|
||||
|
||||
RemoteSearchListView({
|
||||
Key? key,
|
||||
required this.items,
|
||||
// required this.fetchItems,
|
||||
required this.title,
|
||||
required this.list,
|
||||
required this.itemBuilder,
|
||||
required this.fetchItems,
|
||||
}) : super(key: key);
|
||||
required this.filter,
|
||||
List<T> Function(String)? onSearch,
|
||||
Widget? header,
|
||||
}) : header = header ?? const SizedBox.shrink(),
|
||||
onSearch = onSearch ??
|
||||
((String query) =>
|
||||
list.where((documents) => filter(documents, query)).toList()),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
_RemoteSearchViewState<T> createState() => _RemoteSearchViewState<T>();
|
||||
}
|
||||
|
||||
class _RemoteSearchViewState<T> extends State<RemoteSearchListView<T>> {
|
||||
class _RemoteSearchViewState<T> extends State<RemoteSearchListView<T>>
|
||||
with Pageable {
|
||||
TextEditingController editingController = TextEditingController();
|
||||
late List<T> filteredItems;
|
||||
bool isLoading = false;
|
||||
final apiCall = FreAccessWSGlobal.getDocuments;
|
||||
int count = 0;
|
||||
final PagingController<int, dynamic> _pagingController =
|
||||
PagingController<int, dynamic>(firstPageKey: 1);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
filteredItems = widget.items;
|
||||
filteredItems = widget.list;
|
||||
_pagingController.addPageRequestListener(
|
||||
(dynamic pageKey) => fetchPage(
|
||||
dataProvider: () async {
|
||||
final newItems = await apiCall.call(pageKey.toString());
|
||||
if (newItems.jsonBody == null) return (false, null);
|
||||
final List<dynamic> docs =
|
||||
(newItems.jsonBody['value']['list'] as List<dynamic>?) ?? [];
|
||||
_pagingController.nextPageKey = pageKey + 1;
|
||||
|
||||
safeSetState(() {
|
||||
count = newItems.jsonBody['value']['count'] ?? 0;
|
||||
});
|
||||
return (docs.isNotEmpty, docs);
|
||||
},
|
||||
onDataUnavailable: () {
|
||||
setState(() {});
|
||||
showNoMoreDataSnackBar(context);
|
||||
},
|
||||
onDataAvailable: (vehicles) {
|
||||
setState(() {});
|
||||
_pagingController.appendLastPage(vehicles);
|
||||
},
|
||||
onFetchError: (e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed(
|
||||
"proccessRequest.php", "", "Consulta de Veículo", e, s);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
);
|
||||
_pagingController.addStatusListener(_showError);
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> _showError(PagingStatus status) async {
|
||||
if (status == PagingStatus.subsequentPageError) {
|
||||
final message = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Something went wrong while fetching a new page.',
|
||||
ptText: 'Algo deu errado ao buscar uma nova página.',
|
||||
);
|
||||
final retry = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Retry',
|
||||
ptText: 'Recarregar',
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
action: SnackBarAction(
|
||||
label: retry,
|
||||
onPressed: () => _pagingController.retryLastFailedRequest(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void filterSearchResults(String query) async {
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
final results = await widget.fetchItems(query);
|
||||
setState(() {
|
||||
filteredItems = results;
|
||||
isLoading = false;
|
||||
});
|
||||
// final results = await widget.fetchItems(query);
|
||||
// setState(() {
|
||||
// filteredItems = results;
|
||||
// isLoading = false;
|
||||
// });
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: Container(
|
||||
child: Column(
|
||||
final noDataFound = FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Nenhum veículo encontrado!",
|
||||
enText: "No vehicle found",
|
||||
);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
|
@ -163,9 +232,7 @@ class _RemoteSearchViewState<T> extends State<RemoteSearchListView<T>> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
onChanged: (value) {
|
||||
filterSearchResults(value);
|
||||
},
|
||||
onChanged: (value) => filterSearchResults(value),
|
||||
controller: editingController,
|
||||
decoration: InputDecoration(
|
||||
labelText: "Search",
|
||||
|
@ -177,24 +244,14 @@ class _RemoteSearchViewState<T> extends State<RemoteSearchListView<T>> {
|
|||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(15, 0, 50, 0),
|
||||
child: Text('Últimos Documentos'),
|
||||
),
|
||||
isLoading
|
||||
? Center(child: CircularProgressIndicator())
|
||||
: Expanded(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: filteredItems.length,
|
||||
itemBuilder: (context, index) {
|
||||
return widget.itemBuilder(filteredItems[index]);
|
||||
},
|
||||
),
|
||||
widget.header,
|
||||
buildPaginatedListView<int, dynamic>(
|
||||
noDataFound,
|
||||
_pagingController,
|
||||
(BuildContext context, dynamic item, int index) =>
|
||||
widget.itemBuilder(item),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/features/backend/api_requests/api_calls.dart';
|
||||
import 'package:hub/features/documents/index.dart';
|
||||
import 'package:hub/flutter_flow/index.dart';
|
||||
import 'package:hub/shared/mixins/pegeable_mixin.dart';
|
||||
import 'package:hub/shared/utils/index.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
||||
|
||||
part 'page.dart';
|
||||
|
|
|
@ -85,6 +85,7 @@ dependencies:
|
|||
url_launcher_android: ^6.3.12
|
||||
url_launcher_ios: ^6.3.1
|
||||
url_launcher_platform_interface: 2.3.2
|
||||
infinite_scroll_pagination: ^4.1.0
|
||||
# video_player: 2.8.7
|
||||
# video_player_android: 2.5.0
|
||||
# video_player_avfoundation: 2.6.1
|
||||
|
|
Loading…
Reference in New Issue