WIP
This commit is contained in:
parent
2a5acf1016
commit
d36de816f5
|
@ -22,7 +22,6 @@ import 'package:url_launcher/url_launcher.dart';
|
||||||
import '../shared/utils/log_util.dart';
|
import '../shared/utils/log_util.dart';
|
||||||
|
|
||||||
Future<void> openTermsOfUse(BuildContext context) async {
|
Future<void> openTermsOfUse(BuildContext context) async {
|
||||||
log('openTermsOfUse');
|
|
||||||
final Uri url = Uri.parse('https://freaccess.com.br/pp/');
|
final Uri url = Uri.parse('https://freaccess.com.br/pp/');
|
||||||
if (!await launchUrl(url)) {
|
if (!await launchUrl(url)) {
|
||||||
throw Exception('Could not launch $url');
|
throw Exception('Could not launch $url');
|
||||||
|
@ -90,7 +89,6 @@ Future<Color> manageStatusColorAction(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
required String? visitStatusStr,
|
required String? visitStatusStr,
|
||||||
}) async {
|
}) async {
|
||||||
log('visitStatusStr: $visitStatusStr');
|
|
||||||
if (visitStatusStr == 'A') {
|
if (visitStatusStr == 'A') {
|
||||||
return FlutterFlowTheme.of(context).success;
|
return FlutterFlowTheme.of(context).success;
|
||||||
} else if ((visitStatusStr == 'C') ||
|
} else if ((visitStatusStr == 'C') ||
|
||||||
|
@ -322,41 +320,28 @@ Future toggleHomePage(BuildContext context) async {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> visitRequestComponentAction(
|
Future<bool> visitCancelAction(BuildContext context,
|
||||||
BuildContext context, {
|
{required int? idDestino,
|
||||||
required String? actionValue,
|
required int? idVisita,
|
||||||
required String? refUUID,
|
required String? accessKey,
|
||||||
required String? responseValue,
|
required String? email}) async {
|
||||||
required String? vteUUID,
|
ApiCallResponse? apiCallResponse;
|
||||||
}) async {
|
|
||||||
ApiCallResponse? respondeSolicitacaoCall;
|
|
||||||
|
|
||||||
respondeSolicitacaoCall = await PhpGroup.respondeSolicitacaoCall.call(
|
apiCallResponse = await PhpGroup.cancelaVisita.call(
|
||||||
userUUID: FFAppState().userUUID,
|
userUUID: FFAppState().userUUID,
|
||||||
devUUID: FFAppState().devUUID,
|
devUUID: FFAppState().devUUID,
|
||||||
cliUUID: FFAppState().cliUUID,
|
cliID: FFAppState().cliUUID,
|
||||||
atividade: 'respondeSolicitacao',
|
atividade: 'cancelaVisita',
|
||||||
referencia: refUUID,
|
idDestino: idDestino,
|
||||||
tarefa: actionValue,
|
idVisita: idVisita,
|
||||||
resposta: responseValue,
|
AccessKey: accessKey,
|
||||||
idVisitante: vteUUID,
|
UsuEmail: email,
|
||||||
|
DevDesc: '',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (respondeSolicitacaoCall.statusCode == 200) {
|
if (apiCallResponse.statusCode == 200) {
|
||||||
log('jsonBody: ${respondeSolicitacaoCall.jsonBody}; actionValue: $actionValue; refUUID: $refUUID; responseValue: $responseValue; vteUUID: $vteUUID; status: ${respondeSolicitacaoCall.jsonBody['error']}');
|
return !apiCallResponse.jsonBody['error'];
|
||||||
return !respondeSolicitacaoCall.jsonBody['error'];
|
|
||||||
} else {
|
} else {
|
||||||
log('headers: ${respondeSolicitacaoCall.headers}');
|
|
||||||
log('bodyText: ${respondeSolicitacaoCall.bodyText}');
|
|
||||||
log('jsonBody: ${respondeSolicitacaoCall.jsonBody}');
|
|
||||||
log('userUUID: ${FFAppState().userUUID}');
|
|
||||||
log('devUUID: ${FFAppState().devUUID}');
|
|
||||||
log('cliUUID: ${FFAppState().cliUUID}');
|
|
||||||
log('atividade: respondeSolicitacao');
|
|
||||||
log('referencia: $refUUID');
|
|
||||||
log('tarefa: $actionValue');
|
|
||||||
log('resposta: $responseValue');
|
|
||||||
log('idVisitante: $vteUUID');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,7 +387,6 @@ Future<bool> checkLocals({
|
||||||
|
|
||||||
// Verificação rápida de erro para evitar processamento desnecessário.
|
// Verificação rápida de erro para evitar processamento desnecessário.
|
||||||
if (response.jsonBody['error']) {
|
if (response.jsonBody['error']) {
|
||||||
log("checkLocals => Erro encontrado na resposta");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,10 +398,8 @@ Future<bool> checkLocals({
|
||||||
|
|
||||||
// Log e retorno condicional baseado no resultado da busca.
|
// Log e retorno condicional baseado no resultado da busca.
|
||||||
if (itemFound) {
|
if (itemFound) {
|
||||||
log("checkLocals => Item encontrado com CLI_ID $uuid e CLU_STATUS A");
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
log("checkLocals => Item não encontrado com CLI_ID $uuid e CLU_STATUS A");
|
|
||||||
// A chamada para showModalBottomSheet permanece, mas a atualização da UI é otimizada.
|
// A chamada para showModalBottomSheet permanece, mas a atualização da UI é otimizada.
|
||||||
await showModalBottomSheet(
|
await showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
|
@ -440,59 +422,51 @@ Future<bool> checkLocals({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future answersRequest(BuildContext context, String? ref, String? task,
|
||||||
|
String? response, String? id) async {
|
||||||
|
ApiCallResponse? respondeSolicitacaoCall;
|
||||||
|
|
||||||
|
respondeSolicitacaoCall = await PhpGroup.respondeSolicitacaoCall.call(
|
||||||
|
userUUID: FFAppState().userUUID,
|
||||||
|
devUUID: FFAppState().devUUID,
|
||||||
|
cliUUID: FFAppState().cliUUID,
|
||||||
|
atividade: 'respondeSolicitacao',
|
||||||
|
referencia: ref,
|
||||||
|
tarefa: task,
|
||||||
|
resposta: response,
|
||||||
|
idVisitante: id,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (respondeSolicitacaoCall.statusCode == 200) {
|
||||||
|
return !respondeSolicitacaoCall.jsonBody['error'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future changeStatusAction(
|
Future changeStatusAction(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
String status,
|
int idDestino,
|
||||||
String vawREF,
|
int idVisita,
|
||||||
String msg,
|
String accessKey,
|
||||||
String vteUUID,
|
String email,
|
||||||
) async {
|
) async {
|
||||||
log('status: $status');
|
|
||||||
|
|
||||||
switch (status) {
|
|
||||||
case 'L':
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
|
|
||||||
bool? approveVisitRequest;
|
|
||||||
approveVisitRequest = await visitRequestComponentAction(
|
|
||||||
context,
|
|
||||||
actionValue: status,
|
|
||||||
refUUID: vawREF,
|
|
||||||
responseValue: msg,
|
|
||||||
vteUUID: vteUUID,
|
|
||||||
);
|
|
||||||
if (!context.mounted) return;
|
|
||||||
if (approveVisitRequest == true) {
|
|
||||||
log('Aprovado');
|
|
||||||
context.pop();
|
|
||||||
} else {
|
|
||||||
log('Erro ao aprovar');
|
|
||||||
context.pop();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'B':
|
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
|
|
||||||
bool? blockVisitRequest;
|
bool? blockVisitRequest;
|
||||||
blockVisitRequest = await visitRequestComponentAction(
|
blockVisitRequest = await visitCancelAction(
|
||||||
context,
|
context,
|
||||||
actionValue: status,
|
accessKey: accessKey,
|
||||||
refUUID: vawREF,
|
idDestino: idDestino,
|
||||||
responseValue: msg,
|
idVisita: idVisita,
|
||||||
vteUUID: vteUUID,
|
email: email,
|
||||||
);
|
);
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
if (blockVisitRequest == true) {
|
if (blockVisitRequest == true) {
|
||||||
log('Bloqueado');
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
log('Erro ao bloquear');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// QR Code
|
/// QR Code
|
||||||
|
@ -502,8 +476,6 @@ Uint8List assembleQRPacket(int direction, String identifier, String password) {
|
||||||
|
|
||||||
String paddedBadge = identifier.padLeft(30, '0');
|
String paddedBadge = identifier.padLeft(30, '0');
|
||||||
|
|
||||||
log("Badge: $paddedBadge");
|
|
||||||
|
|
||||||
for (var i = 0; i < paddedBadge.length; i += 2) {
|
for (var i = 0; i < paddedBadge.length; i += 2) {
|
||||||
packet.add(int.parse(paddedBadge.substring(i, i + 2), radix: 16));
|
packet.add(int.parse(paddedBadge.substring(i, i + 2), radix: 16));
|
||||||
}
|
}
|
||||||
|
@ -545,8 +517,6 @@ Uint8List assembleQRPacket(int direction, String identifier, String password) {
|
||||||
var bytes =
|
var bytes =
|
||||||
packet.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join((' '));
|
packet.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join((' '));
|
||||||
|
|
||||||
log("Pacote: $packet");
|
|
||||||
log("Bytes: $bytes");
|
|
||||||
return Uint8List.fromList(packet);
|
return Uint8List.fromList(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +552,6 @@ Widget buildQrCode(
|
||||||
required String pass,
|
required String pass,
|
||||||
required int direction}) {
|
required int direction}) {
|
||||||
try {
|
try {
|
||||||
log("pass: $pass");
|
|
||||||
const Color backgroundColor = Colors.white;
|
const Color backgroundColor = Colors.white;
|
||||||
const Color foregroundColor = Colors.black;
|
const Color foregroundColor = Colors.black;
|
||||||
return QrImageView.withQr(
|
return QrImageView.withQr(
|
||||||
|
@ -784,3 +753,22 @@ Future accessQRCodeOptAction(BuildContext context) async {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum status { active, unknown, canceled, finished, blocked, inactive }
|
||||||
|
|
||||||
|
status? getStatus(dynamic data) {
|
||||||
|
switch (data) {
|
||||||
|
case 'A':
|
||||||
|
return status.active;
|
||||||
|
case 'F':
|
||||||
|
return status.finished;
|
||||||
|
case 'B':
|
||||||
|
return status.blocked;
|
||||||
|
case 'C':
|
||||||
|
return status.canceled;
|
||||||
|
case 'I':
|
||||||
|
return status.inactive;
|
||||||
|
default:
|
||||||
|
return status.unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ class FFAppState extends ChangeNotifier {
|
||||||
return await auth.canCheckBiometrics;
|
return await auth.canCheckBiometrics;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
clearBiometricAuthentication();
|
clearBiometricAuthentication();
|
||||||
debugPrint('Error checking biometrics: $e');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +43,6 @@ class FFAppState extends ChangeNotifier {
|
||||||
// Salvar o estado de autenticação biométrica, se necessário
|
// Salvar o estado de autenticação biométrica, se necessário
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
|
||||||
debugPrint('Error authenticating: $e');
|
|
||||||
clearBiometricAuthentication();
|
clearBiometricAuthentication();
|
||||||
return Future.error(e);
|
return Future.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,53 @@ class PhpGroup {
|
||||||
static ChangePass changePass = ChangePass();
|
static ChangePass changePass = ChangePass();
|
||||||
static ChangePanic changePanic = ChangePanic();
|
static ChangePanic changePanic = ChangePanic();
|
||||||
static DeleteAccount deleteAccount = DeleteAccount();
|
static DeleteAccount deleteAccount = DeleteAccount();
|
||||||
|
static CancelaVisita cancelaVisita = CancelaVisita();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CancelaVisita {
|
||||||
|
Future<ApiCallResponse> call({
|
||||||
|
String? devUUID = '',
|
||||||
|
String? userUUID = '',
|
||||||
|
String? cliID = '',
|
||||||
|
String? atividade = '',
|
||||||
|
int? idDestino,
|
||||||
|
int? idVisita,
|
||||||
|
String? AccessKey = '',
|
||||||
|
String? UsuEmail = '',
|
||||||
|
String? DevDesc = '',
|
||||||
|
}) async {
|
||||||
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
|
return ApiManager.instance.makeApiCall(
|
||||||
|
callName: 'cancelaVisita',
|
||||||
|
apiUrl: '$baseUrl/processRequest.php',
|
||||||
|
callType: ApiCallType.POST,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
'devUUID': devUUID,
|
||||||
|
'userUUID': userUUID,
|
||||||
|
'atividade': atividade,
|
||||||
|
'cliID': cliID,
|
||||||
|
'idVisita': idVisita,
|
||||||
|
'AccessKey': AccessKey,
|
||||||
|
'UsuEmail': UsuEmail,
|
||||||
|
'DevDesc': DevDesc,
|
||||||
|
},
|
||||||
|
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||||
|
returnBody: true,
|
||||||
|
encodeBodyUtf8: false,
|
||||||
|
decodeUtf8: false,
|
||||||
|
cache: false,
|
||||||
|
alwaysAllowBody: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool? error(dynamic response) => castToType<bool>(getJsonField(
|
||||||
|
response,
|
||||||
|
r'''$.error''',
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeleteAccount {
|
class DeleteAccount {
|
||||||
|
@ -2504,7 +2551,6 @@ String _serializeList(List? list) {
|
||||||
return json.encode(list, toEncodable: _toEncodable);
|
return json.encode(list, toEncodable: _toEncodable);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
log("List serialization failed. Returning empty list.");
|
|
||||||
}
|
}
|
||||||
return '[]';
|
return '[]';
|
||||||
}
|
}
|
||||||
|
@ -2516,7 +2562,6 @@ String _serializeJson(dynamic jsonVar, [bool isList = false]) {
|
||||||
return json.encode(jsonVar, toEncodable: _toEncodable);
|
return json.encode(jsonVar, toEncodable: _toEncodable);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
log("Json serialization failed. Returning empty json.");
|
|
||||||
}
|
}
|
||||||
return isList ? '[]' : '{}';
|
return isList ? '[]' : '{}';
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,7 @@ class PushNotificationService {
|
||||||
sound: true,
|
sound: true,
|
||||||
);
|
);
|
||||||
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
|
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
|
||||||
log('User granted permission');
|
} else {}
|
||||||
} else {
|
|
||||||
log('User declined or has not accepted permission');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> validJsonFromString(String? jsonString) {
|
Map<String, dynamic> validJsonFromString(String? jsonString) {
|
||||||
|
@ -101,7 +98,6 @@ class PushNotificationService {
|
||||||
// Passo 4: Decodificar o JSON corrigido
|
// Passo 4: Decodificar o JSON corrigido
|
||||||
return jsonDecode(correctedJson);
|
return jsonDecode(correctedJson);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Error decoding JSON: $e');
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,19 +122,14 @@ class PushNotificationService {
|
||||||
_flutterLocalNotificationsPlugin.initialize(
|
_flutterLocalNotificationsPlugin.initialize(
|
||||||
initializationSettings,
|
initializationSettings,
|
||||||
onDidReceiveNotificationResponse: (NotificationResponse response) async {
|
onDidReceiveNotificationResponse: (NotificationResponse response) async {
|
||||||
log('Response payload:${response.payload}');
|
|
||||||
if (response.payload != null) {
|
if (response.payload != null) {
|
||||||
try {
|
try {
|
||||||
Map<String, dynamic> message =
|
Map<String, dynamic> message =
|
||||||
validJsonFromString(response.payload!);
|
validJsonFromString(response.payload!);
|
||||||
log('Notification payload: $message');
|
|
||||||
var data =
|
var data =
|
||||||
_notificationDetails; // Assuming getOnMessage() now returns the latest RemoteMessage
|
_notificationDetails; // Assuming getOnMessage() now returns the latest RemoteMessage
|
||||||
log('Extra: ${data.value}');
|
|
||||||
_handleNotificationClick(message, extra: data.value);
|
_handleNotificationClick(message, extra: data.value);
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
log('Error decoding notification payload: $e');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -174,8 +165,6 @@ class PushNotificationService {
|
||||||
|
|
||||||
void _listenToForegroundMessages(BuildContext context) {
|
void _listenToForegroundMessages(BuildContext context) {
|
||||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||||
log('Got a message whilst in the foreground!');
|
|
||||||
log('Message data: ${message.toMap()}');
|
|
||||||
_onMessage.add(message);
|
_onMessage.add(message);
|
||||||
_notificationDetails.add(message.toMap()['notification']);
|
_notificationDetails.add(message.toMap()['notification']);
|
||||||
_showNotification(message);
|
_showNotification(message);
|
||||||
|
@ -188,32 +177,25 @@ class PushNotificationService {
|
||||||
|
|
||||||
void _listenToNotificationClicks(BuildContext context) {
|
void _listenToNotificationClicks(BuildContext context) {
|
||||||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
||||||
log('Notification clicked!');
|
|
||||||
|
|
||||||
_onMessage.add(message);
|
_onMessage.add(message);
|
||||||
log('Extra: ${message.notification?.body}');
|
|
||||||
NotificationHandler().handleMessage(message.data, context);
|
NotificationHandler().handleMessage(message.data, context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void configureTokenRefresh() {
|
void configureTokenRefresh() {
|
||||||
_firebaseMessaging.onTokenRefresh.listen(_handleTokenUpdate).onError((err) {
|
_firebaseMessaging.onTokenRefresh
|
||||||
log("Error refreshing token: $err");
|
.listen(_handleTokenUpdate)
|
||||||
});
|
.onError((err) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _updateToken(String token) async {
|
Future<void> _updateToken(String token) async {
|
||||||
FFAppState().token = token;
|
FFAppState().token = token;
|
||||||
final ApiCallResponse? response = await _updateTokenOnServer(token);
|
final ApiCallResponse? response = await _updateTokenOnServer(token);
|
||||||
if (_isTokenUpdateSuccessful(response)) {
|
if (_isTokenUpdateSuccessful(response)) {
|
||||||
log('Token updated successfully on server. Token: $token');
|
} else {}
|
||||||
} else {
|
|
||||||
log('Error updating token on server');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleTokenUpdate(String newToken) async {
|
Future<void> _handleTokenUpdate(String newToken) async {
|
||||||
log('Token refreshed: $newToken');
|
|
||||||
await _updateToken(newToken);
|
await _updateToken(newToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,11 +208,8 @@ class PushNotificationService {
|
||||||
|
|
||||||
final String? deviceToken = await _firebaseMessaging.getToken();
|
final String? deviceToken = await _firebaseMessaging.getToken();
|
||||||
if (deviceToken != null) {
|
if (deviceToken != null) {
|
||||||
log('Push Messaging token: $deviceToken');
|
|
||||||
await _updateToken(deviceToken);
|
await _updateToken(deviceToken);
|
||||||
} else {
|
} else {}
|
||||||
log('Failed to get Firebase Messaging token');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<NotificationSettings> _requestNotificationPermission() async {
|
Future<NotificationSettings> _requestNotificationPermission() async {
|
||||||
|
@ -283,7 +262,6 @@ class PushNotificationService {
|
||||||
var generalNotificationDetails =
|
var generalNotificationDetails =
|
||||||
NotificationDetails(android: androidDetails, iOS: iOSDetails);
|
NotificationDetails(android: androidDetails, iOS: iOSDetails);
|
||||||
|
|
||||||
log('Showing notification: ${message.messageId.hashCode}');
|
|
||||||
await _flutterLocalNotificationsPlugin.show(
|
await _flutterLocalNotificationsPlugin.show(
|
||||||
// DateTime.now().millisecondsSinceEpoch % (1 << 31),
|
// DateTime.now().millisecondsSinceEpoch % (1 << 31),
|
||||||
math.Random().nextInt(1 << 30),
|
math.Random().nextInt(1 << 30),
|
||||||
|
@ -299,32 +277,24 @@ class PushNotificationService {
|
||||||
switch (payload.isNotEmpty) {
|
switch (payload.isNotEmpty) {
|
||||||
case true:
|
case true:
|
||||||
// Print the 'data' property
|
// Print the 'data' property
|
||||||
log('Notification payload: $payload');
|
|
||||||
log('Extra: $extra');
|
|
||||||
// Handle the message data as needed
|
// Handle the message data as needed
|
||||||
NotificationHandler().handleMessage(payload, _context.value,
|
NotificationHandler().handleMessage(payload, _context.value,
|
||||||
extra: extra.isEmpty ? {} : extra);
|
extra: extra.isEmpty ? {} : extra);
|
||||||
// Access the 'data' property of 'RemoteMessage'
|
// Access the 'data' property of 'RemoteMessage'
|
||||||
case false:
|
case false:
|
||||||
log('Notification payload is empty');
|
|
||||||
// Handle the message notification as needed
|
// Handle the message notification as needed
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> _firebaseMessagingBackgroundHandler(
|
static Future<void> _firebaseMessagingBackgroundHandler(
|
||||||
RemoteMessage message) async {
|
RemoteMessage message) async {}
|
||||||
log('Handling a background message: ${message.messageId}');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class NotificationHandler {
|
class NotificationHandler {
|
||||||
void handleMessage(Map<String, dynamic> message, BuildContext context,
|
void handleMessage(Map<String, dynamic> message, BuildContext context,
|
||||||
{Map<String, dynamic> extra = const {}}) {
|
{Map<String, dynamic> extra = const {}}) {
|
||||||
log('Notification Received!');
|
message.forEach((key, value) {});
|
||||||
message.forEach((key, value) {
|
|
||||||
log('$key: $value');
|
|
||||||
});
|
|
||||||
|
|
||||||
switch (message['click_action']) {
|
switch (message['click_action']) {
|
||||||
case 'visit_request':
|
case 'visit_request':
|
||||||
|
@ -340,10 +310,8 @@ class NotificationHandler {
|
||||||
_showMessageNotificationDialog(message, context, extra);
|
_showMessageNotificationDialog(message, context, extra);
|
||||||
break;
|
break;
|
||||||
case 'enroll_cond':
|
case 'enroll_cond':
|
||||||
log('enroll_cond');
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log('Notification type not recognized');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,10 +331,6 @@ class NotificationHandler {
|
||||||
|
|
||||||
void _showAcessNotificationModal(
|
void _showAcessNotificationModal(
|
||||||
Map<String, dynamic> message, BuildContext context) {
|
Map<String, dynamic> message, BuildContext context) {
|
||||||
log('Showing access notification dialog');
|
|
||||||
log('USR_TIPO: ${message['USR_TIPO']}');
|
|
||||||
log('USR_ID: ${message['USR_ID']}');
|
|
||||||
log('USR_DOCUMENTO: ${message['USR_DOCUMENTO']}');
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -392,8 +356,6 @@ class NotificationHandler {
|
||||||
|
|
||||||
void _showMessageNotificationDialog(Map<String, dynamic> message,
|
void _showMessageNotificationDialog(Map<String, dynamic> message,
|
||||||
BuildContext context, Map<String, dynamic> extra) {
|
BuildContext context, Map<String, dynamic> extra) {
|
||||||
log('Showing message notification dialog');
|
|
||||||
log('Notification "message": $message');
|
|
||||||
showDialog(
|
showDialog(
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
|
@ -432,7 +394,6 @@ class NotificationHandler {
|
||||||
|
|
||||||
void _showVisitRequestDialog(
|
void _showVisitRequestDialog(
|
||||||
Map<String, dynamic> message, BuildContext context) {
|
Map<String, dynamic> message, BuildContext context) {
|
||||||
log('Showing visit request notification dialog');
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
|
@ -442,13 +403,6 @@ class NotificationHandler {
|
||||||
return Dialog(
|
return Dialog(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
child: VisitRequestTemplateComponentWidget(
|
child: VisitRequestTemplateComponentWidget(
|
||||||
vteName: message['mensagem'] ?? 'Unknown',
|
|
||||||
vteReason: message['motivo'] ?? 'Unknown',
|
|
||||||
vteMsg: message['mensagem'] ?? 'Unknown',
|
|
||||||
vteDocument: message['documento'] ?? '',
|
|
||||||
vteUUID: message['idVisitante'].toString(),
|
|
||||||
vawRef: message['referencia'].toString(),
|
|
||||||
vawStatus: 'S',
|
|
||||||
buttons: [
|
buttons: [
|
||||||
FlutterFlowIconButton(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.done),
|
icon: const Icon(Icons.done),
|
||||||
|
@ -504,10 +458,10 @@ class NotificationHandler {
|
||||||
ptText: 'Sim',
|
ptText: 'Sim',
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await changeStatusAction.call(
|
await answersRequest.call(
|
||||||
context,
|
context,
|
||||||
'L',
|
|
||||||
message['referencia'].toString(),
|
message['referencia'].toString(),
|
||||||
|
'L',
|
||||||
'Mensagem',
|
'Mensagem',
|
||||||
message['idVisitante'].toString(),
|
message['idVisitante'].toString(),
|
||||||
);
|
);
|
||||||
|
@ -588,10 +542,10 @@ class NotificationHandler {
|
||||||
ptText: 'Sim',
|
ptText: 'Sim',
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await changeStatusAction.call(
|
await answersRequest.call(
|
||||||
context,
|
context,
|
||||||
'B',
|
|
||||||
message['referencia'].toString(),
|
message['referencia'].toString(),
|
||||||
|
'B',
|
||||||
'Mensagem',
|
'Mensagem',
|
||||||
message['idVisitante'].toString(),
|
message['idVisitante'].toString(),
|
||||||
);
|
);
|
||||||
|
@ -645,7 +599,7 @@ class NotificationHandler {
|
||||||
): FlutterFlowTheme.of(context).warning,
|
): FlutterFlowTheme.of(context).warning,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
changeStatusAction: changeStatusAction,
|
// changeStatusAction: answersRequest,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,90 +1 @@
|
||||||
// import 'package:f_r_e_hub/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart';
|
|
||||||
// import 'package:firebase_messaging/firebase_messaging.dart';
|
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:rxdart/rxdart.dart';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// class NotificationHandler {
|
|
||||||
// // Criar BehaviorSubjects para mensagens em primeiro plano e mensagens que abriram o app
|
|
||||||
// final BehaviorSubject<RemoteMessage> _onMessage =
|
|
||||||
// BehaviorSubject<RemoteMessage>();
|
|
||||||
// final BehaviorSubject<RemoteMessage> _onMessageOpenedApp =
|
|
||||||
// BehaviorSubject<RemoteMessage>();
|
|
||||||
|
|
||||||
// // Inicializar listeners no construtor
|
|
||||||
// NotificationHandler() {
|
|
||||||
// initializeListeners();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void initializeListeners() async {
|
|
||||||
// // Listener para mensagens em primeiro plano
|
|
||||||
// // FirebaseMessaging.onMessage.listen((message) {
|
|
||||||
// // _onMessage.add(message); // Adicionar mensagem ao stream
|
|
||||||
// // });
|
|
||||||
|
|
||||||
// RemoteMessage? initialMessage =
|
|
||||||
// await FirebaseMessaging.instance.getInitialMessage();
|
|
||||||
|
|
||||||
// if (initialMessage != null) _onMessage.add(initialMessage);
|
|
||||||
|
|
||||||
// // Listener para mensagens que abriram o app
|
|
||||||
// FirebaseMessaging.onMessageOpenedApp.listen((message) {
|
|
||||||
// _onMessageOpenedApp.add(message); // Adicionar mensagem ao stream
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void openedAppVisitRequestNotification(
|
|
||||||
// RemoteMessage message, BuildContext context) {
|
|
||||||
// log('openedAppVisitRequestNotification');
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (BuildContext context) {
|
|
||||||
// return Dialog(
|
|
||||||
// backgroundColor:
|
|
||||||
// Colors.transparent, // Faz o fundo do Dialog ser transparente
|
|
||||||
// child: VisitRequestTemplateComponentWidget(
|
|
||||||
// name: message.data['nome'] ?? 'blabla',
|
|
||||||
// reason: message.data['motivo'] ?? 'blabla',
|
|
||||||
// message: message.data['mensagem'] ?? 'blabla',
|
|
||||||
// document: message.data['document']),
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Método para tratar mensagens recebidas
|
|
||||||
// void handleMessage(RemoteMessage message, BuildContext context) {
|
|
||||||
// log('Notification Received!');
|
|
||||||
// message.data.forEach((key, value) {
|
|
||||||
// log('$key: $value');
|
|
||||||
// });
|
|
||||||
|
|
||||||
// switch (message.data['type']) {
|
|
||||||
// case 'visit_request':
|
|
||||||
// openedAppVisitRequestNotification(message, context);
|
|
||||||
// break;
|
|
||||||
// case '':
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// log('Notification type not recognized');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Ouvir streams
|
|
||||||
// void listenToNotifications(BuildContext context) {
|
|
||||||
// _onMessage.listen((message) {
|
|
||||||
// handleMessage(message, context);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// _onMessageOpenedApp.listen((message) {
|
|
||||||
// handleMessage(message, context);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Dispor streams
|
|
||||||
// void dispose() {
|
|
||||||
// _onMessage.close();
|
|
||||||
// _onMessageOpenedApp.close();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
|
||||||
class BottomArrowLinkedLocalsComponentWidget extends StatefulWidget {
|
class BottomArrowLinkedLocalsComponentWidget extends StatefulWidget {
|
||||||
const BottomArrowLinkedLocalsComponentWidget({super.key});
|
const BottomArrowLinkedLocalsComponentWidget({super.key});
|
||||||
|
|
||||||
|
@ -100,9 +99,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
color: FlutterFlowTheme.of(context).primary,
|
||||||
size: 24.0,
|
size: 24.0,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {},
|
||||||
print('IconButton pressed ...');
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -180,8 +177,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
width: 50.0,
|
width: 50.0,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
decoration: const BoxDecoration(),
|
decoration: const BoxDecoration(),
|
||||||
alignment:
|
alignment: const AlignmentDirectional(
|
||||||
const AlignmentDirectional(0.0, 0.0),
|
0.0, 0.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
|
@ -232,13 +229,14 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
alignment:
|
alignment: const Alignment(
|
||||||
const Alignment(0.0, 0.0),
|
0.0, 0.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional
|
padding:
|
||||||
|
const EdgeInsetsDirectional
|
||||||
.fromSTEB(
|
.fromSTEB(
|
||||||
0.0, 10.0, 0.0, 0.0),
|
0.0, 10.0, 0.0, 0.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'dart:async';
|
||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
@ -213,7 +212,7 @@ class _MessageWellComponentWidgetState
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
message['MSG_DESTINO_TP'] == 'T'
|
message['MSG_DESTINO_TP'] == 'T'
|
||||||
? EvaIcons.globe
|
? Icons.language
|
||||||
: message['MSG_DESTINO_TP'] == 'P'
|
: message['MSG_DESTINO_TP'] == 'P'
|
||||||
? Icons.person
|
? Icons.person
|
||||||
: Icons.home,
|
: Icons.home,
|
||||||
|
@ -374,12 +373,8 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
|
||||||
// .toList();
|
// .toList();
|
||||||
// Provider.of<MessageCounter>(context, listen: false).setCounter(int.parse(response.jsonBody['total_pages']));
|
// Provider.of<MessageCounter>(context, listen: false).setCounter(int.parse(response.jsonBody['total_pages']));
|
||||||
// totalPageNumber = int.parse(response.jsonBody['total_pages']);
|
// totalPageNumber = int.parse(response.jsonBody['total_pages']);
|
||||||
} else {
|
} else {}
|
||||||
log('Error fetching messages: ${response.statusCode}');
|
} else {}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log('No more messages to fetch ...');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<dynamic> getMessages() {
|
List<dynamic> getMessages() {
|
||||||
|
|
|
@ -40,8 +40,6 @@ class ScheduleVisitDetailModel
|
||||||
|
|
||||||
String convertDateFormat(String dateStr) {
|
String convertDateFormat(String dateStr) {
|
||||||
try {
|
try {
|
||||||
log('Received date string: $dateStr');
|
|
||||||
|
|
||||||
// Formato original
|
// Formato original
|
||||||
DateFormat originalFormat = DateFormat('d/M/y H:mm:ss');
|
DateFormat originalFormat = DateFormat('d/M/y H:mm:ss');
|
||||||
// Novo formato
|
// Novo formato
|
||||||
|
@ -50,7 +48,6 @@ class ScheduleVisitDetailModel
|
||||||
// Validate the input string format
|
// Validate the input string format
|
||||||
if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$')
|
if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$')
|
||||||
.hasMatch(dateStr)) {
|
.hasMatch(dateStr)) {
|
||||||
log('Invalid date format: $dateStr');
|
|
||||||
return 'Invalid date format';
|
return 'Invalid date format';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,11 +56,9 @@ class ScheduleVisitDetailModel
|
||||||
|
|
||||||
// Converte DateTime para a nova string formatada
|
// Converte DateTime para a nova string formatada
|
||||||
String formattedDate = newFormat.format(dateTime);
|
String formattedDate = newFormat.format(dateTime);
|
||||||
log('Formatted date: $formattedDate');
|
|
||||||
return formattedDate;
|
return formattedDate;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Handle the exception by returning an error message or a default value
|
// Handle the exception by returning an error message or a default value
|
||||||
log('Error parsing date: $e');
|
|
||||||
return 'Invalid date format';
|
return 'Invalid date format';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,14 +74,6 @@ class _CardItemTemplateComponentWidgetState
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<FFAppState>();
|
context.watch<FFAppState>();
|
||||||
log('------------------------------');
|
|
||||||
log('labelsHashMap: ${widget.labelsHashMap}');
|
|
||||||
log('statusHashMap: ${widget.statusHashMap}');
|
|
||||||
log('imageHashMap: ${widget.imageHashMap}');
|
|
||||||
log('onTapCardItemAction: ${widget.onTapCardItemAction}');
|
|
||||||
log('labelsLinkedHashMap: $labelsLinkedHashMap');
|
|
||||||
log('statusLinkedHashMap: $statusLinkedHashMap');
|
|
||||||
log('------------------------------');
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
focusColor: Colors.transparent,
|
focusColor: Colors.transparent,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hub/actions/actions.dart';
|
||||||
import 'package:hub/app_state.dart';
|
import 'package:hub/app_state.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
||||||
|
@ -12,45 +13,12 @@ import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
enum status { active, unknown, canceled, finished, blocked, inactive }
|
|
||||||
|
|
||||||
status? getStatus(dynamic data) {
|
|
||||||
debugPrint('getStatus: $data');
|
|
||||||
switch (data) {
|
|
||||||
case 'A':
|
|
||||||
return status.active;
|
|
||||||
case 'F':
|
|
||||||
return status.finished;
|
|
||||||
case 'B':
|
|
||||||
return status.blocked;
|
|
||||||
case 'C':
|
|
||||||
return status.canceled;
|
|
||||||
case 'I':
|
|
||||||
return status.inactive;
|
|
||||||
default:
|
|
||||||
return status.unknown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildDetails(
|
Widget buildDetails(
|
||||||
dynamic visitaWrapItem,
|
dynamic visitaWrapItem,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
Future<dynamic> Function(BuildContext, String, String, String, String)?
|
Future<dynamic> Function(BuildContext, int, int, String, String)?
|
||||||
changeStatusAction) {
|
changeStatusAction) {
|
||||||
return VisitRequestTemplateComponentWidget(
|
return VisitRequestTemplateComponentWidget(
|
||||||
vteName: 'Lorem Ipsus',
|
|
||||||
vteReason: 'Lorem Ipsus',
|
|
||||||
vawDate: 'Lorem Ipsus',
|
|
||||||
vawStatus: 'Lorem Ipsus',
|
|
||||||
vteMsg: 'Lorem Ipsus',
|
|
||||||
vteUUID: 'Lorem Ipsus',
|
|
||||||
cliUUID: FFAppState().cliUUID,
|
|
||||||
msgUUID: 'Lorem Ipsus',
|
|
||||||
vawDestino: 'Lorem Ipsus',
|
|
||||||
vawUUID: 'Lorem Ipsus',
|
|
||||||
vawName: 'Lorem Ipsus',
|
|
||||||
vawRef: 'Lorem Ipsus',
|
|
||||||
changeStatusAction: changeStatusAction,
|
|
||||||
buttons: [
|
buttons: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
status.active) // REJECT ACTION
|
status.active) // REJECT ACTION
|
||||||
|
@ -109,13 +77,14 @@ Widget buildDetails(
|
||||||
await changeStatusAction
|
await changeStatusAction
|
||||||
?.call(
|
?.call(
|
||||||
context,
|
context,
|
||||||
'B',
|
int.parse(visitaWrapItem['VAW_DESTINO']),
|
||||||
visitaWrapItem['VAW_REF'] ?? '',
|
int.parse(visitaWrapItem['VAW_ID']),
|
||||||
'Mensagem',
|
visitaWrapItem['VAW_CHAVE'] ?? '',
|
||||||
visitaWrapItem['VTE_ID'] ?? '',
|
visitaWrapItem['VTE_DOCUMENTO'] ?? '',
|
||||||
)
|
)
|
||||||
.then((value) {
|
.then((value) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
if (value == false) {
|
if (value == false) {
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context,
|
context,
|
||||||
|
@ -136,8 +105,6 @@ Widget buildDetails(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}).catchError((err, stack) {
|
}).catchError((err, stack) {
|
||||||
debugPrint('Error: $err');
|
|
||||||
debugPrint('Stack: $stack');
|
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context,
|
context,
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
|
|
@ -14,20 +14,6 @@ import 'package:provider/provider.dart';
|
||||||
class VisitRequestTemplateComponentWidget extends StatefulWidget {
|
class VisitRequestTemplateComponentWidget extends StatefulWidget {
|
||||||
const VisitRequestTemplateComponentWidget({
|
const VisitRequestTemplateComponentWidget({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.vteName,
|
|
||||||
required this.vteReason,
|
|
||||||
required this.vteMsg,
|
|
||||||
this.vteDocument,
|
|
||||||
this.cliUUID,
|
|
||||||
this.vteUUID,
|
|
||||||
this.vawName,
|
|
||||||
this.msgUUID,
|
|
||||||
this.vawRef,
|
|
||||||
this.vawUUID,
|
|
||||||
this.vawDestino,
|
|
||||||
required this.vawStatus,
|
|
||||||
this.vawDate,
|
|
||||||
this.changeStatusAction,
|
|
||||||
required this.labelsHashMap,
|
required this.labelsHashMap,
|
||||||
required this.statusHashMap,
|
required this.statusHashMap,
|
||||||
required this.imageHashMap,
|
required this.imageHashMap,
|
||||||
|
@ -41,27 +27,12 @@ class VisitRequestTemplateComponentWidget extends StatefulWidget {
|
||||||
final Future Function()? onTapCardItemAction;
|
final Future Function()? onTapCardItemAction;
|
||||||
final List<Widget> buttons;
|
final List<Widget> buttons;
|
||||||
|
|
||||||
final String? vteName;
|
// final Future Function(
|
||||||
final String? vteReason;
|
// BuildContext context,
|
||||||
final String? vteMsg;
|
// int idDestino,
|
||||||
final String? vteDocument;
|
// int idVisita,
|
||||||
final String? cliUUID;
|
// String AccessKey,
|
||||||
final String? vteUUID;
|
// )? changeStatusAction;
|
||||||
final String? vawName;
|
|
||||||
final String? msgUUID;
|
|
||||||
final String? vawRef;
|
|
||||||
final String? vawUUID;
|
|
||||||
final String? vawDestino;
|
|
||||||
final String? vawStatus;
|
|
||||||
final String? vawDate;
|
|
||||||
|
|
||||||
final Future Function(
|
|
||||||
BuildContext context,
|
|
||||||
String status,
|
|
||||||
String vawREF,
|
|
||||||
String msg,
|
|
||||||
String vteUUID,
|
|
||||||
)? changeStatusAction;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<VisitRequestTemplateComponentWidget> createState() =>
|
State<VisitRequestTemplateComponentWidget> createState() =>
|
||||||
|
@ -90,24 +61,6 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_model = createModel(context, () => VisitRequestTemplateComponentModel());
|
_model = createModel(context, () => VisitRequestTemplateComponentModel());
|
||||||
|
|
||||||
_model.textController1 ??= TextEditingController(text: widget.vteName);
|
|
||||||
_model.textFieldFocusNode1 ??= FocusNode();
|
|
||||||
|
|
||||||
_model.textController2 ??= TextEditingController(text: widget.vteReason);
|
|
||||||
_model.textFieldFocusNode2 ??= FocusNode();
|
|
||||||
|
|
||||||
_model.textController3 ??= TextEditingController(text: widget.vteMsg);
|
|
||||||
_model.textFieldFocusNode3 ??= FocusNode();
|
|
||||||
|
|
||||||
_model.textController4 ??= TextEditingController(text: widget.vawDate);
|
|
||||||
_model.textFieldFocusNode4 ??= FocusNode();
|
|
||||||
|
|
||||||
_model.textController5 ??= TextEditingController();
|
|
||||||
_model.textFieldFocusNode5 ??= FocusNode();
|
|
||||||
|
|
||||||
_model.textControllerStatus ??=
|
|
||||||
TextEditingController(text: widget.vawStatus);
|
|
||||||
_model.textFieldFocusNodeStatus ??= FocusNode();
|
_model.textFieldFocusNodeStatus ??= FocusNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,21 +73,21 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
log('VAW_STATUS: ${statusLinkedHashMap}');
|
|
||||||
context.watch<FFAppState>();
|
context.watch<FFAppState>();
|
||||||
bool isLoaded = false;
|
|
||||||
final pending = FFLocalizations.of(context).getVariableText(
|
// bool isLoaded = false;
|
||||||
enText: 'Pending',
|
// final pending = FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Pendente',
|
// enText: 'Pending',
|
||||||
);
|
// ptText: 'Pendente',
|
||||||
final active = FFLocalizations.of(context).getVariableText(
|
// );
|
||||||
enText: 'Ativo',
|
// final active = FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Ativo',
|
// enText: 'Ativo',
|
||||||
);
|
// ptText: 'Ativo',
|
||||||
final canceled = FFLocalizations.of(context).getVariableText(
|
// );
|
||||||
enText: 'Canceled',
|
// final canceled = FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Cancelado',
|
// enText: 'Canceled',
|
||||||
);
|
// ptText: 'Cancelado',
|
||||||
|
// );
|
||||||
|
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
|
|
|
@ -45,7 +45,6 @@ class RegisiterVistorTemplateComponentModel
|
||||||
documento: document,
|
documento: document,
|
||||||
);
|
);
|
||||||
|
|
||||||
log('${response.jsonBody}');
|
|
||||||
if (response.jsonBody['visitante']['VTE_ID'] != '0' &&
|
if (response.jsonBody['visitante']['VTE_ID'] != '0' &&
|
||||||
response.jsonBody['error'] != 'false') {
|
response.jsonBody['error'] != 'false') {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -69,7 +69,6 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onTextChanged() {
|
void _onTextChanged() {
|
||||||
log('changed');
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +93,6 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Visitante Já Cadastrado $_isVisitorRegistered");
|
|
||||||
if (_isVisitorRegistered) {
|
if (_isVisitorRegistered) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@ List<dynamic>? findVisitorById(List<dynamic>? jsonList, String? id) {
|
||||||
);
|
);
|
||||||
return foundItem != null ? [foundItem] : null;
|
return foundItem != null ? [foundItem] : null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log("Error searching item: $e");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -874,7 +873,6 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
||||||
size: 24.0,
|
size: 24.0,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
log('IconButton pressed ...');
|
|
||||||
// Implement share functionality here
|
// Implement share functionality here
|
||||||
Share.share(
|
Share.share(
|
||||||
'Visita agendada para ${widget.visitStartDate} com término previsto para ${widget.visitEndDate}. Motivo: ${widget.visitReasonStr}. Nível de acesso: ${widget.visitLevelStr}. Observações: ${widget.visitObsStr}.',
|
'Visita agendada para ${widget.visitStartDate} com término previsto para ${widget.visitEndDate}. Motivo: ${widget.visitReasonStr}. Nível de acesso: ${widget.visitLevelStr}. Observações: ${widget.visitObsStr}.',
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
import '/backend/schema/structs/index.dart';
|
import '/backend/schema/structs/index.dart';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import '/backend/schema/enums/enums.dart';
|
import '/backend/schema/enums/enums.dart';
|
||||||
|
@ -12,29 +10,14 @@ import 'package:flutter/material.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Future<String?> getDevUUID() async {
|
Future<String?> getDevUUID() async {
|
||||||
var deviceInfo = DeviceInfoPlugin();
|
var deviceInfo = DeviceInfoPlugin();
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
// import 'dart:io'
|
// import 'dart:io'
|
||||||
var iosDeviceInfo = await deviceInfo.iosInfo;
|
var iosDeviceInfo = await deviceInfo.iosInfo;
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.identifierForVendor: ${iosDeviceInfo.identifierForVendor}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
|
|
||||||
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
|
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
|
||||||
} else if (Platform.isAndroid) {
|
} else if (Platform.isAndroid) {
|
||||||
var androidDeviceInfo = await deviceInfo.androidInfo;
|
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||||
// log('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
|
|
||||||
return androidDeviceInfo.id; // unique ID on Android
|
return androidDeviceInfo.id; // unique ID on Android
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,21 +27,9 @@ Future<String?> getSerialNumber() async {
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
// import 'dart:io'
|
// import 'dart:io'
|
||||||
var iosDeviceInfo = await deviceInfo.iosInfo;
|
var iosDeviceInfo = await deviceInfo.iosInfo;
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPlugin => iosDeviceInfo.identifierForVendor: ${iosDeviceInfo.identifierForVendor}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
|
|
||||||
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
|
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
|
||||||
} else if (Platform.isAndroid) {
|
} else if (Platform.isAndroid) {
|
||||||
var androidDeviceInfo = await deviceInfo.androidInfo;
|
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||||
// log('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone"
|
|
||||||
log('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
|
|
||||||
return androidDeviceInfo.serialNumber; // unique ID on Android
|
return androidDeviceInfo.serialNumber; // unique ID on Android
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,7 +60,6 @@
|
||||||
// final path = _getStoragePath(_firebasePathPrefix(),
|
// final path = _getStoragePath(_firebasePathPrefix(),
|
||||||
// widget.imageFile!.name!, false, 0);
|
// widget.imageFile!.name!, false, 0);
|
||||||
// uploadData(path, image).then((value) {
|
// uploadData(path, image).then((value) {
|
||||||
// log('image cropped');
|
|
||||||
// widget.callBackAction!.call(value!);
|
// widget.callBackAction!.call(value!);
|
||||||
// loading = false;
|
// loading = false;
|
||||||
// });
|
// });
|
||||||
|
@ -95,7 +94,6 @@
|
||||||
// setState(() {
|
// setState(() {
|
||||||
// loading = true;
|
// loading = true;
|
||||||
// });
|
// });
|
||||||
// log('Button pressed ...');
|
|
||||||
// _crop_controller.crop();
|
// _crop_controller.crop();
|
||||||
|
|
||||||
// //widget.loading = true;
|
// //widget.loading = true;
|
||||||
|
|
|
@ -6,6 +6,8 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:from_css_color/from_css_color.dart';
|
import 'package:from_css_color/from_css_color.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'dart:math' show pow, pi, sin;
|
import 'dart:math' show pow, pi, sin;
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:json_path/json_path.dart';
|
import 'package:json_path/json_path.dart';
|
||||||
|
@ -547,6 +549,69 @@ void showSnackbar(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showAlertDialog(
|
||||||
|
BuildContext context, String title, String content, Future action) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
title: Text(title),
|
||||||
|
content: Text(content),
|
||||||
|
actions: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
FFButtonWidget(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.3,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.05,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'No',
|
||||||
|
ptText: 'Não',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
FFButtonWidget(
|
||||||
|
onPressed: () async {
|
||||||
|
await action;
|
||||||
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.3,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.05,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Yes',
|
||||||
|
ptText: 'Sim',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
extension FFStringExt on String {
|
extension FFStringExt on String {
|
||||||
String maybeHandleOverflow({int? maxChars, String replacement = ''}) =>
|
String maybeHandleOverflow({int? maxChars, String replacement = ''}) =>
|
||||||
maxChars != null && length > maxChars
|
maxChars != null && length > maxChars
|
||||||
|
|
|
@ -76,15 +76,14 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'homePage',
|
name: 'homePage',
|
||||||
path: '/homePage',
|
path: '/homePage',
|
||||||
builder: (context, params) => params.isEmpty
|
builder: (context, params) =>
|
||||||
? const HomePageWidget()
|
params.isEmpty ? const HomePageWidget() : const HomePageWidget(),
|
||||||
: const HomePageWidget(),
|
|
||||||
),
|
|
||||||
FFRoute(
|
|
||||||
name: 'visitHistoryPage',
|
|
||||||
path: '/visitHistoryPage',
|
|
||||||
builder: (context, params) => const VisitHistoryPageWidget(),
|
|
||||||
),
|
),
|
||||||
|
// FFRoute(
|
||||||
|
// name: 'visitHistoryPage',
|
||||||
|
// path: '/visitHistoryPage',
|
||||||
|
// builder: (context, params) => const VisitHistoryPageWidget(),
|
||||||
|
// ),
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'messageHistoryPage',
|
name: 'messageHistoryPage',
|
||||||
path: '/messageHistoryPage',
|
path: '/messageHistoryPage',
|
||||||
|
@ -148,7 +147,10 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
||||||
path: '/fastPassPage',
|
path: '/fastPassPage',
|
||||||
builder: (context, params) => /*const*/ FastPassPageWidget(),
|
builder: (context, params) => /*const*/ FastPassPageWidget(),
|
||||||
),
|
),
|
||||||
FFRoute(name: 'preferencesSettings', path: '/preferencesSettings', builder: (context, params) => const PreferencesPageWidget(
|
FFRoute(
|
||||||
|
name: 'preferencesSettings',
|
||||||
|
path: '/preferencesSettings',
|
||||||
|
builder: (context, params) => const PreferencesPageWidget(
|
||||||
key: Key('preferencesSettings'),
|
key: Key('preferencesSettings'),
|
||||||
)),
|
)),
|
||||||
FFRoute(
|
FFRoute(
|
||||||
|
|
|
@ -10,7 +10,6 @@ import '../../flutter_flow/lat_lng.dart';
|
||||||
import '../../flutter_flow/place.dart';
|
import '../../flutter_flow/place.dart';
|
||||||
import '../../flutter_flow/uploaded_file.dart';
|
import '../../flutter_flow/uploaded_file.dart';
|
||||||
|
|
||||||
|
|
||||||
/// SERIALIZATION HELPERS
|
/// SERIALIZATION HELPERS
|
||||||
|
|
||||||
String dateTimeRangeToString(DateTimeRange dateTimeRange) {
|
String dateTimeRangeToString(DateTimeRange dateTimeRange) {
|
||||||
|
@ -85,7 +84,6 @@ String? serializeParam(
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Error serializing parameter: $e');
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +224,6 @@ dynamic deserializeParam<T>(
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Error deserializing parameter: $e');
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,7 +30,6 @@ void main() async {
|
||||||
Future<void> initializeApp() async {
|
Future<void> initializeApp() async {
|
||||||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||||
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
|
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
|
||||||
|
|
||||||
await FlutterFlowTheme.initialize();
|
await FlutterFlowTheme.initialize();
|
||||||
await FFLocalizations.initialize();
|
await FFLocalizations.initialize();
|
||||||
final appState = FFAppState();
|
final appState = FFAppState();
|
||||||
|
|
|
@ -19,9 +19,6 @@ import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/pages/acess_history_page/acess_history_page_model.dart';
|
import 'package:hub/pages/acess_history_page/acess_history_page_model.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class AcessHistoryPageWidget extends StatefulWidget {
|
class AcessHistoryPageWidget extends StatefulWidget {
|
||||||
late Map<String, String> opt = {
|
late Map<String, String> opt = {
|
||||||
|
@ -58,16 +55,13 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
|
|
||||||
_AcessHistoryPageWidgetState(Map<String, String> opt)
|
_AcessHistoryPageWidgetState(Map<String, String> opt)
|
||||||
: selectedTypeSubject = BehaviorSubject.seeded(opt) {
|
: selectedTypeSubject = BehaviorSubject.seeded(opt) {
|
||||||
selectedTypeSubject.listen((value) {
|
selectedTypeSubject.listen((value) {});
|
||||||
log("selectedTypeSubject changed: $value");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_model = createModel(context, () => AcessHistoryPageModel());
|
_model = createModel(context, () => AcessHistoryPageModel());
|
||||||
log("initState called in _AcessHistoryPageWidgetState");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -134,7 +128,6 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _appBarFilterButtonAtomWidget(BuildContext context) {
|
Widget _appBarFilterButtonAtomWidget(BuildContext context) {
|
||||||
log('selectedTypeSubject: ${selectedTypeSubject.value}');
|
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
|
@ -156,7 +149,6 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectedFilter != null) {
|
if (selectedFilter != null) {
|
||||||
log('Selected Filter: $selectedFilter');
|
|
||||||
_updateAccessHistoryAction(selectedFilter);
|
_updateAccessHistoryAction(selectedFilter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -178,14 +170,12 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
});
|
});
|
||||||
if (needsUpdate) {
|
if (needsUpdate) {
|
||||||
selectedTypeSubject.add(updatedType);
|
selectedTypeSubject.add(updatedType);
|
||||||
log("updateAccessHistory called with newType: $newType");
|
|
||||||
safeSetState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<ApiCallResponse> fetchAccessHistoryService(String selectedType) {
|
Stream<ApiCallResponse> fetchAccessHistoryService(String selectedType) {
|
||||||
log('Calling API with type: $selectedType');
|
|
||||||
switch (selectedType) {
|
switch (selectedType) {
|
||||||
case 'E':
|
case 'E':
|
||||||
return _model.accessHistory(
|
return _model.accessHistory(
|
||||||
|
@ -247,14 +237,9 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
|
|
||||||
Future<List<dynamic>> fetchCardListViewService(
|
Future<List<dynamic>> fetchCardListViewService(
|
||||||
Map<String, String> select) async {
|
Map<String, String> select) async {
|
||||||
log('Fetching access history');
|
|
||||||
final response =
|
final response =
|
||||||
await fetchAccessHistoryService(select['personType']!).first;
|
await fetchAccessHistoryService(select['personType']!).first;
|
||||||
log('Response: ${response.jsonBody}');
|
|
||||||
final List<dynamic> accessHistory = response.jsonBody['acessos'] ?? [];
|
final List<dynamic> accessHistory = response.jsonBody['acessos'] ?? [];
|
||||||
log('Access History Before Filtering: $accessHistory');
|
|
||||||
log(
|
|
||||||
'Filtering for: Person Type - ${select['personType']}, Access Type - ${select['accessType']}, Search - ${select['search']}');
|
|
||||||
|
|
||||||
return accessHistory.where((item) {
|
return accessHistory.where((item) {
|
||||||
final personTypeMatches = select['personType'] == '.*' ||
|
final personTypeMatches = select['personType'] == '.*' ||
|
||||||
|
@ -266,20 +251,15 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(select['search']!.toLowerCase());
|
.contains(select['search']!.toLowerCase());
|
||||||
log('NOMES: ${item["PES_NOME"].toString().toLowerCase()}');
|
|
||||||
return personTypeMatches && accessTypeMatches && searchMatches;
|
return personTypeMatches && accessTypeMatches && searchMatches;
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _cardListViewOrganismWidget(Map<String, String> selected) {
|
Widget _cardListViewOrganismWidget(Map<String, String> selected) {
|
||||||
log(
|
|
||||||
'Selected types in Card: ${selected['personType']}, ${selected['accessType']}');
|
|
||||||
log('_buildAccessHistoryList called');
|
|
||||||
return FutureBuilder<List<dynamic>>(
|
return FutureBuilder<List<dynamic>>(
|
||||||
future: fetchCardListViewService(selected),
|
future: fetchCardListViewService(selected),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
log('Waiting for data');
|
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 50.0,
|
width: 50.0,
|
||||||
|
@ -294,15 +274,12 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
return Text('Error: ${snapshot.error}');
|
return Text('Error: ${snapshot.error}');
|
||||||
} else {
|
} else {
|
||||||
final accessHistory = snapshot.data!;
|
final accessHistory = snapshot.data!;
|
||||||
log('Access History: $accessHistory');
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: accessHistory.length,
|
itemCount: accessHistory.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final accessHistoryItem = accessHistory[index];
|
final accessHistoryItem = accessHistory[index];
|
||||||
log(
|
|
||||||
'Access History Item: ${accessHistoryItem['PES_TIPO']}');
|
|
||||||
return _accessHistoryCardMoleculeWidget(
|
return _accessHistoryCardMoleculeWidget(
|
||||||
context, accessHistoryItem);
|
context, accessHistoryItem);
|
||||||
},
|
},
|
||||||
|
@ -314,7 +291,6 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
|
|
||||||
Widget _accessHistoryCardMoleculeWidget(
|
Widget _accessHistoryCardMoleculeWidget(
|
||||||
BuildContext context, dynamic accessHistoryItem) {
|
BuildContext context, dynamic accessHistoryItem) {
|
||||||
log('Access History Item: $accessHistoryItem');
|
|
||||||
return CardItemTemplateComponentWidget(
|
return CardItemTemplateComponentWidget(
|
||||||
imageHashMap: Map<String, String>.from({
|
imageHashMap: Map<String, String>.from({
|
||||||
'key': accessHistoryItem['PES_ID'] ?? '',
|
'key': accessHistoryItem['PES_ID'] ?? '',
|
||||||
|
@ -371,183 +347,6 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _cardHeaderAtomWidget(BuildContext context, String urlImagem,
|
|
||||||
String tipoPessoa, Color corFundoTipo, accessHistoryItem) {
|
|
||||||
return Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(100.0),
|
|
||||||
child: Image.network(
|
|
||||||
urlImagem,
|
|
||||||
width: 60.0,
|
|
||||||
height: 60.0,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.PES_NOME''',
|
|
||||||
).toString(),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
width: 100.0,
|
|
||||||
height: 25.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: (() {
|
|
||||||
// Extrai o valor de PES_TIPO, converte para String, remove espaços em branco e aspas
|
|
||||||
final pesTipo =
|
|
||||||
jsonToStr(getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.PES_TIPO''',
|
|
||||||
))
|
|
||||||
.trim()
|
|
||||||
.replaceAll('"', ''); // Remove aspas
|
|
||||||
|
|
||||||
// Debug: Imprime o valor de PES_TIPO ajustado
|
|
||||||
log('PES_TIPO FOR COLORING: $pesTipo');
|
|
||||||
|
|
||||||
// Retorna a cor baseada na condição ajustada
|
|
||||||
return pesTipo == 'E'
|
|
||||||
? FlutterFlowTheme.of(context).warning
|
|
||||||
: FlutterFlowTheme.of(context).primary;
|
|
||||||
})(),
|
|
||||||
borderRadius: BorderRadius.circular(24.0),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
|
||||||
child: Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.PES_TIPO''',
|
|
||||||
).toString() ==
|
|
||||||
'E'
|
|
||||||
? FFLocalizations.of(context).getText(
|
|
||||||
'zok7lu4w',
|
|
||||||
)
|
|
||||||
: FFLocalizations.of(context).getText(
|
|
||||||
'oonqk812',
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
color: FlutterFlowTheme.of(context).info,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
.divide(const SizedBox(width: 20.0))
|
|
||||||
.addToStart(const SizedBox(width: 5.0))
|
|
||||||
.addToEnd(const SizedBox(width: 5.0)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _cardDetailsMoleculeWidget(
|
|
||||||
BuildContext context, dynamic accessHistoryItem) {
|
|
||||||
return Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
FFLocalizations.of(context).getText(
|
|
||||||
'2odgr6hg',
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.ACE_DATAHORA''',
|
|
||||||
).toString(),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].addToStart(const SizedBox(width: 10.0)),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
FFLocalizations.of(context).getText(
|
|
||||||
'zrde3fke',
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.ACI_DESCRICAO''',
|
|
||||||
).toString(),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].addToStart(const SizedBox(width: 10.0)),
|
|
||||||
),
|
|
||||||
].divide(const SizedBox(height: 3.0)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
.addToStart(const SizedBox(width: 5.0))
|
|
||||||
.addToEnd(const SizedBox(width: 5.0)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String imageUrlAtomWidget(String document, String type) {
|
String imageUrlAtomWidget(String document, String type) {
|
||||||
return valueOrDefault<String>(
|
return valueOrDefault<String>(
|
||||||
"https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=$document&tipo=$type",
|
"https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=$document&tipo=$type",
|
||||||
|
|
|
@ -298,9 +298,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
color: FlutterFlowTheme.of(context).info,
|
color: FlutterFlowTheme.of(context).info,
|
||||||
size: 24.0,
|
size: 24.0,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {},
|
||||||
log('IconButton pressed ...');
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -545,7 +543,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
),
|
),
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
FFAppState().isLogged = false;
|
FFAppState().deleteAll();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
context.goNamed(
|
context.goNamed(
|
||||||
|
|
|
@ -330,7 +330,6 @@ Widget liberationHistoryItemCard(
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
onTapCardItemAction: () async {
|
onTapCardItemAction: () async {
|
||||||
log('LiberationItem: $liberationHistoryItem');
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
isDismissible: true,
|
isDismissible: true,
|
||||||
|
@ -339,20 +338,20 @@ Widget liberationHistoryItemCard(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return VisitRequestTemplateComponentWidget(
|
return VisitRequestTemplateComponentWidget(
|
||||||
vteName: liberationHistoryItem['VTE_NOME'],
|
// vteName: liberationHistoryItem['VTE_NOME'],
|
||||||
vteReason: liberationHistoryItem['NOT_MOTIVO'],
|
// vteReason: liberationHistoryItem['NOT_MOTIVO'],
|
||||||
vawDate: liberationHistoryItem['NOT_STATUS'] == 'S'
|
// vawDate: liberationHistoryItem['NOT_STATUS'] == 'S'
|
||||||
? liberationHistoryItem['NOT_DTENVIO']
|
// ? liberationHistoryItem['NOT_DTENVIO']
|
||||||
: liberationHistoryItem['NOT_DTRESPOSTA'],
|
// : liberationHistoryItem['NOT_DTRESPOSTA'],
|
||||||
vawStatus: liberationHistoryItem['NOT_STATUS'],
|
// vawStatus: liberationHistoryItem['NOT_STATUS'],
|
||||||
vteMsg: liberationHistoryItem['NOT_MSGENVIO'],
|
// vteMsg: liberationHistoryItem['NOT_MSGENVIO'],
|
||||||
vteUUID: liberationHistoryItem['VTE_ID'],
|
// vteUUID: liberationHistoryItem['VTE_ID'],
|
||||||
cliUUID: FFAppState().cliUUID,
|
// cliUUID: FFAppState().cliUUID,
|
||||||
msgUUID: liberationHistoryItem['NOT_ID'],
|
// msgUUID: liberationHistoryItem['NOT_ID'],
|
||||||
vawDestino: liberationHistoryItem['NOT_DESTINO'],
|
// vawDestino: liberationHistoryItem['NOT_DESTINO'],
|
||||||
vawUUID: liberationHistoryItem['NOT_ID'],
|
// vawUUID: liberationHistoryItem['NOT_ID'],
|
||||||
vawName: liberationHistoryItem['NOT_NOME'],
|
// vawName: liberationHistoryItem['NOT_NOME'],
|
||||||
vawRef: liberationHistoryItem['NOT_ID'],
|
// vawRef: liberationHistoryItem['NOT_ID'],
|
||||||
labelsHashMap: Map<String, String>.from({
|
labelsHashMap: Map<String, String>.from({
|
||||||
'Nome:': liberationHistoryItem['VTE_NOME'],
|
'Nome:': liberationHistoryItem['VTE_NOME'],
|
||||||
'Data:': liberationHistoryItem['NOT_DTENVIO'],
|
'Data:': liberationHistoryItem['NOT_DTENVIO'],
|
||||||
|
@ -418,13 +417,19 @@ Widget liberationHistoryItemCard(
|
||||||
ptText: 'Sim',
|
ptText: 'Sim',
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await changeStatusAction.call(
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
await answersRequest
|
||||||
|
.call(
|
||||||
context,
|
context,
|
||||||
'L',
|
|
||||||
liberationHistoryItem['NOT_ID'].toString(),
|
liberationHistoryItem['NOT_ID'].toString(),
|
||||||
|
'L',
|
||||||
'Mensagem',
|
'Mensagem',
|
||||||
liberationHistoryItem['VTE_ID'].toString(),
|
liberationHistoryItem['VTE_ID'].toString(),
|
||||||
);
|
)
|
||||||
|
.then((value) {
|
||||||
|
log(value.toString());
|
||||||
|
});
|
||||||
},
|
},
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
width: 100,
|
width: 100,
|
||||||
|
@ -505,10 +510,10 @@ Widget liberationHistoryItemCard(
|
||||||
ptText: 'Sim',
|
ptText: 'Sim',
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await changeStatusAction.call(
|
await answersRequest.call(
|
||||||
context,
|
context,
|
||||||
'B',
|
|
||||||
liberationHistoryItem['NOT_ID'].toString(),
|
liberationHistoryItem['NOT_ID'].toString(),
|
||||||
|
'B',
|
||||||
'Mensagem',
|
'Mensagem',
|
||||||
liberationHistoryItem['VTE_ID'].toString(),
|
liberationHistoryItem['VTE_ID'].toString(),
|
||||||
);
|
);
|
||||||
|
@ -562,7 +567,7 @@ Widget liberationHistoryItemCard(
|
||||||
'key': liberationHistoryItem['VTE_ID'],
|
'key': liberationHistoryItem['VTE_ID'],
|
||||||
'value': 'E',
|
'value': 'E',
|
||||||
}),
|
}),
|
||||||
changeStatusAction: changeStatusAction,
|
// changeStatusAction: answersRequest,
|
||||||
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -572,7 +577,6 @@ Widget liberationHistoryItemCard(
|
||||||
|
|
||||||
_pushNotificationService.onMessageReceived.listen((received) {
|
_pushNotificationService.onMessageReceived.listen((received) {
|
||||||
if (received.data['click_action'] == 'cancel_request') {
|
if (received.data['click_action'] == 'cancel_request') {
|
||||||
log('Aprovado');
|
|
||||||
_pushNotificationService.dispose();
|
_pushNotificationService.dispose();
|
||||||
snackbar(context, opt: true);
|
snackbar(context, opt: true);
|
||||||
context.pushReplacementNamed(
|
context.pushReplacementNamed(
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
|
||||||
import 'package:hub/app_state.dart';
|
import 'package:hub/app_state.dart';
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
|
||||||
|
@ -219,8 +218,6 @@ Widget buildListView(
|
||||||
snapshot.data == null ||
|
snapshot.data == null ||
|
||||||
!snapshot.hasData ||
|
!snapshot.hasData ||
|
||||||
snapshot.hasError) {
|
snapshot.hasError) {
|
||||||
log('Error: ${snapshot.error.toString()}');
|
|
||||||
// log('Error: ${snapshot.data!.jsonBody['mensagens']}');
|
|
||||||
return const Center(
|
return const Center(
|
||||||
child: Text('Erro ao carregar mensagens'),
|
child: Text('Erro ao carregar mensagens'),
|
||||||
);
|
);
|
||||||
|
@ -273,7 +270,7 @@ Widget buildListItem(BuildContext context, dynamic jsonBody) {
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
jsonBody['MSG_DESTINO_TP'] == 'T'
|
jsonBody['MSG_DESTINO_TP'] == 'T'
|
||||||
? EvaIcons.globe
|
? Icons.language
|
||||||
: jsonBody['MSG_DESTINO_TP'] == 'P'
|
: jsonBody['MSG_DESTINO_TP'] == 'P'
|
||||||
? Icons.person
|
? Icons.person
|
||||||
: Icons.home,
|
: Icons.home,
|
||||||
|
|
|
@ -520,7 +520,6 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> togglePass(BuildContext context) async {
|
Future<void> togglePass(BuildContext context) async {
|
||||||
debugPrint('pass: ${FFAppState().pass}');
|
|
||||||
// if (FFAppState().pass) {
|
// if (FFAppState().pass) {
|
||||||
// FFAppState().pass = false;
|
// FFAppState().pass = false;
|
||||||
// FFAppState().deleteAccessPass();
|
// FFAppState().deleteAccessPass();
|
||||||
|
@ -538,7 +537,6 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
toggleActionStatus: (key) async {
|
toggleActionStatus: (key) async {
|
||||||
FFAppState().accessPass = key;
|
FFAppState().accessPass = key;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
debugPrint('key: $key');
|
|
||||||
await PhpGroup.changePass
|
await PhpGroup.changePass
|
||||||
.call(
|
.call(
|
||||||
userUUID: FFAppState().userUUID,
|
userUUID: FFAppState().userUUID,
|
||||||
|
@ -549,7 +547,6 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
)
|
)
|
||||||
.then((value) {
|
.then((value) {
|
||||||
// var error = jsonDecode(value.jsonBody['error'].toString());
|
// var error = jsonDecode(value.jsonBody['error'].toString());
|
||||||
// log('${jsonDecode(value.jsonBody['error'].toString())}');
|
|
||||||
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
|
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
|
||||||
FFAppState().pass = true;
|
FFAppState().pass = true;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
|
|
@ -398,7 +398,6 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
child: QrCodePassKeyTemplateComponentWidget(
|
child: QrCodePassKeyTemplateComponentWidget(
|
||||||
toggleActionStatus: (key) async {
|
toggleActionStatus: (key) async {
|
||||||
log('Key: $key');
|
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
if (animationsMap['barcodeOnActionTriggerAnimation'] !=
|
if (animationsMap['barcodeOnActionTriggerAnimation'] !=
|
||||||
null) {
|
null) {
|
||||||
|
@ -418,7 +417,6 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).catchError((error) => safeSetState(() {
|
).catchError((error) => safeSetState(() {
|
||||||
log('Error: $error');
|
|
||||||
_resetAnimationAndToggleAccess();
|
_resetAnimationAndToggleAccess();
|
||||||
}));
|
}));
|
||||||
unawaited(
|
unawaited(
|
||||||
|
|
|
@ -22,6 +22,7 @@ import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
import 'package:hub/flutter_flow/form_field_controller.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
||||||
|
import 'package:hub/pages/visit_history_page/visit_history_page_widget.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
||||||
|
@ -162,26 +163,6 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum status { active, unknown, canceled, finished, blocked, inactive }
|
|
||||||
|
|
||||||
status? getStatus(dynamic data) {
|
|
||||||
debugPrint('getStatus: $data');
|
|
||||||
switch (data) {
|
|
||||||
case 'A':
|
|
||||||
return status.active;
|
|
||||||
case 'F':
|
|
||||||
return status.finished;
|
|
||||||
case 'B':
|
|
||||||
return status.blocked;
|
|
||||||
case 'C':
|
|
||||||
return status.canceled;
|
|
||||||
case 'I':
|
|
||||||
return status.inactive;
|
|
||||||
default:
|
|
||||||
return status.unknown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
|
PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
|
||||||
return AppBar(
|
return AppBar(
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
@ -267,7 +248,16 @@ Widget bodyScheduleCompleteVisit(
|
||||||
controller: _model.tabBarController,
|
controller: _model.tabBarController,
|
||||||
children: [
|
children: [
|
||||||
scheduleVisit(context, _model, setState, safeSetState),
|
scheduleVisit(context, _model, setState, safeSetState),
|
||||||
visitHistory(context, _model, safeSetState),
|
wrapWithModel(
|
||||||
|
model: _model,
|
||||||
|
child: VisitHistoryWidget(
|
||||||
|
model: _model,
|
||||||
|
safeSetState: safeSetState,
|
||||||
|
),
|
||||||
|
updateCallback: () {
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
updateOnChange: true),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -863,40 +853,8 @@ Widget scheduleVisit(
|
||||||
focusColor: Colors.transparent,
|
focusColor: Colors.transparent,
|
||||||
hoverColor: Colors.transparent,
|
hoverColor: Colors.transparent,
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
onTap: () async {
|
onTap: () async {},
|
||||||
// await showModalBottomSheet(
|
onLongPress: () async {},
|
||||||
// isScrollControlled: true,
|
|
||||||
// backgroundColor: Colors.transparent,
|
|
||||||
// enableDrag: false,
|
|
||||||
// context: context,
|
|
||||||
// builder: (context) {
|
|
||||||
// return GestureDetector(
|
|
||||||
// onTap: () => _model
|
|
||||||
// .unfocusNode.canRequestFocus
|
|
||||||
// ? FocusScope.of(context)
|
|
||||||
// .requestFocus(_model.unfocusNode)
|
|
||||||
// : FocusScope.of(context).unfocus(),
|
|
||||||
// child: Padding(
|
|
||||||
// padding:
|
|
||||||
// MediaQuery.viewInsetsOf(context),
|
|
||||||
// child:
|
|
||||||
// const VisitorDetailsModalTemplateComponentWidget(
|
|
||||||
// visitorImageURL: '',
|
|
||||||
// visitorEmail: '',
|
|
||||||
// visitorName: '',
|
|
||||||
// visitorPhone: '',
|
|
||||||
// visitorType: '',
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ).then((value) => safeSetState(() {}));
|
|
||||||
},
|
|
||||||
onLongPress: () async {
|
|
||||||
// _model.removeFromVisitorJsonList(
|
|
||||||
// visitorListViewItem);
|
|
||||||
// setState(() {});
|
|
||||||
},
|
|
||||||
child: Container(
|
child: Container(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: 70.0,
|
height: 70.0,
|
||||||
|
@ -1460,16 +1418,6 @@ Widget scheduleVisit(
|
||||||
),
|
),
|
||||||
hoverColor:
|
hoverColor:
|
||||||
FlutterFlowTheme.of(context).primaryBackground,
|
FlutterFlowTheme.of(context).primaryBackground,
|
||||||
// thumbColor: WidgetStateColor.resolveWith(
|
|
||||||
// (states) {
|
|
||||||
// if (states.contains(WidgetState.disabled)) {
|
|
||||||
// return FlutterFlowTheme.of(context)
|
|
||||||
// .alternate;
|
|
||||||
// }
|
|
||||||
// return FlutterFlowTheme.of(context)
|
|
||||||
// .alternate;
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
overlayColor: WidgetStateProperty.resolveWith(
|
overlayColor: WidgetStateProperty.resolveWith(
|
||||||
(states) {
|
(states) {
|
||||||
if (states.contains(WidgetState.disabled)) {
|
if (states.contains(WidgetState.disabled)) {
|
||||||
|
@ -1684,213 +1632,3 @@ Widget scheduleVisit(
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget visitHistory(
|
|
||||||
BuildContext context,
|
|
||||||
ScheduleCompleteVisitPageModel _model,
|
|
||||||
Function safeSetState,
|
|
||||||
) {
|
|
||||||
return Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 900.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
),
|
|
||||||
child: StreamBuilder<ApiCallResponse>(
|
|
||||||
stream: _model.visitHistory(
|
|
||||||
requestFn: () => PhpGroup.getVisitsCall.call(
|
|
||||||
devUUID: FFAppState().devUUID,
|
|
||||||
userUUID: FFAppState().userUUID,
|
|
||||||
cliID: FFAppState().cliUUID,
|
|
||||||
atividade: 'getVisitas',
|
|
||||||
pageSize: 100,
|
|
||||||
pageNumber: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
||||||
return Center(
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
|
||||||
FlutterFlowTheme.of(context).primary,
|
|
||||||
),
|
|
||||||
));
|
|
||||||
} else if (snapshot.hasError) {
|
|
||||||
log('Error: ${snapshot.error}');
|
|
||||||
return Center(child: Text('Error: ${snapshot.error}'));
|
|
||||||
} else if (!snapshot.hasData || snapshot.data!.jsonBody == null) {
|
|
||||||
log('No data or jsonBody is null');
|
|
||||||
return const Center(child: Text('No visits found'));
|
|
||||||
}
|
|
||||||
|
|
||||||
final wrapGetVisitsResponse = snapshot.data!;
|
|
||||||
log('Response: ${wrapGetVisitsResponse.jsonBody}');
|
|
||||||
|
|
||||||
final visitaWrap = PhpGroup.getVisitsCall
|
|
||||||
.visitasList(wrapGetVisitsResponse.jsonBody)
|
|
||||||
?.toList() ??
|
|
||||||
[];
|
|
||||||
log('visitaWrap: $visitaWrap');
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: visitaWrap.length,
|
|
||||||
shrinkWrap: true,
|
|
||||||
scrollDirection: Axis.vertical,
|
|
||||||
physics: const BouncingScrollPhysics(),
|
|
||||||
addAutomaticKeepAlives: true,
|
|
||||||
cacheExtent: 1000.0,
|
|
||||||
addRepaintBoundaries: true,
|
|
||||||
addSemanticIndexes: true,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final visitaWrapItem = visitaWrap[index];
|
|
||||||
return CardItemTemplateComponentWidget(
|
|
||||||
imageHashMap: Map<String, String>.from({
|
|
||||||
'key': visitaWrapItem['VTE_DOCUMENTO'] ?? '',
|
|
||||||
'value': 'E',
|
|
||||||
}),
|
|
||||||
labelsHashMap: Map<String, String>.from({
|
|
||||||
'Nome:': visitaWrapItem['VTE_NOME'] ?? '',
|
|
||||||
'Inicio:': visitaWrapItem['VAW_DTINICIO'] ?? '',
|
|
||||||
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
|
|
||||||
}),
|
|
||||||
statusHashMap: [
|
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
|
||||||
status.active)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Ativo',
|
|
||||||
enText: 'Active',
|
|
||||||
): FlutterFlowTheme.of(context).warning,
|
|
||||||
}),
|
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
|
||||||
status.finished)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Finalizado',
|
|
||||||
enText: 'Finished',
|
|
||||||
): FlutterFlowTheme.of(context).success,
|
|
||||||
}),
|
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
|
||||||
status.unknown)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Desconhecido',
|
|
||||||
enText: 'Unknown',
|
|
||||||
): FlutterFlowTheme.of(context).alternate,
|
|
||||||
}),
|
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
|
||||||
status.canceled)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Cancelado',
|
|
||||||
enText: 'Canceled',
|
|
||||||
): FlutterFlowTheme.of(context).error,
|
|
||||||
}),
|
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
|
||||||
status.blocked)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Bloqueado',
|
|
||||||
enText: 'Blocked',
|
|
||||||
): FlutterFlowTheme.of(context).error,
|
|
||||||
}),
|
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
|
||||||
status.inactive)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Inactive',
|
|
||||||
enText: 'Inactive',
|
|
||||||
): FlutterFlowTheme.of(context).error,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
onTapCardItemAction: () async {
|
|
||||||
showModalBottomSheet(
|
|
||||||
isScrollControlled: true,
|
|
||||||
isDismissible: true,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
useSafeArea: true,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return buildDetails(
|
|
||||||
visitaWrapItem,
|
|
||||||
context,
|
|
||||||
changeStatusAction,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
).then((_) {
|
|
||||||
// PushNotificationManager _pushNotificationService =
|
|
||||||
// PushNotificationManager();
|
|
||||||
// _pushNotificationService.onMessageReceived
|
|
||||||
// .listen((received) {
|
|
||||||
// if (received.data['click_action'] ==
|
|
||||||
// 'cancel_request') {
|
|
||||||
// log('Aprovado');
|
|
||||||
// _pushNotificationService.dispose();
|
|
||||||
// snackbar(context, opt: true);
|
|
||||||
// context.pushReplacementNamed(
|
|
||||||
// 'liberationHistory',
|
|
||||||
// extra: <String, dynamic>{
|
|
||||||
// kTransitionInfoKey: const TransitionInfo(
|
|
||||||
// hasTransition: true,
|
|
||||||
// transitionType: PageTransitionType.scale,
|
|
||||||
// alignment: Alignment.bottomCenter,
|
|
||||||
// ),
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
// await showModalBottomSheet(
|
|
||||||
// isScrollControlled: true,
|
|
||||||
// backgroundColor: Colors.transparent,
|
|
||||||
// enableDrag: true,
|
|
||||||
// isDismissible: true,
|
|
||||||
// useSafeArea: true,
|
|
||||||
// context: context,
|
|
||||||
// builder: (context) {
|
|
||||||
// return GestureDetector(
|
|
||||||
// onTap: () => _model.unfocusNode.canRequestFocus
|
|
||||||
// ? FocusScope.of(context)
|
|
||||||
// .requestFocus(_model.unfocusNode)
|
|
||||||
// : FocusScope.of(context).unfocus(),
|
|
||||||
// child: VisitDetailsModalTemplateComponentWidget(
|
|
||||||
// visitStatusStr: visitaWrapItem['VAW_STATUS'],
|
|
||||||
// visitStartDateStr:
|
|
||||||
// visitaWrapItem['VAW_DTINICIO'],
|
|
||||||
// visitEndDateStr: visitaWrapItem['VAW_DTFIM'],
|
|
||||||
// visitReasonStr:
|
|
||||||
// visitaWrapItem['MOT_DESCRICAO'],
|
|
||||||
// visitLevelStr:
|
|
||||||
// visitaWrapItem['NAC_DESCRICAO'],
|
|
||||||
// visitTempStr:
|
|
||||||
// visitaWrapItem['VTE_UNICA'].toString(),
|
|
||||||
// visitObsStr: visitaWrapItem['VAW_OBS'],
|
|
||||||
// visitorImgPath: valueOrDefault<String>(
|
|
||||||
// "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
|
||||||
// visitaWrapItem,
|
|
||||||
// r'''$.VTE_DOCUMENTO''',
|
|
||||||
// ).toString()}&tipo=E",
|
|
||||||
// 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
|
||||||
// ),
|
|
||||||
// visitorStrList:
|
|
||||||
// visitaWrapItem['VTE_DOCUMENTO'],
|
|
||||||
// visitIdStr: visitaWrapItem['VAW_ID'],
|
|
||||||
// visitStatusColor:
|
|
||||||
// visitaWrapItem['VAW_STATUS'] == 'A'
|
|
||||||
// ? FlutterFlowTheme.of(context).success
|
|
||||||
// : FlutterFlowTheme.of(context).error,
|
|
||||||
// visitorJsonList:
|
|
||||||
// PhpGroup.getVisitsCall.visitasList(
|
|
||||||
// wrapGetVisitsResponse.jsonBody,
|
|
||||||
// ),
|
|
||||||
// updateToggleIdx: () async {},
|
|
||||||
// repeatVisitSchedule: () async {},
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ).then((value) => safeSetState(() {}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
// imageHashMap: imageKeyValue,
|
// imageHashMap: imageKeyValue,
|
||||||
// onTapCardItemAction: () async {
|
// onTapCardItemAction: () async {
|
||||||
// // Ação ao tocar no card
|
// // Ação ao tocar no card
|
||||||
// log('Card tapped');
|
|
||||||
// },
|
// },
|
||||||
// );
|
// );
|
||||||
// }),
|
// }),
|
||||||
|
|
|
@ -1,106 +1 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
|
||||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
|
||||||
import 'package:hub/flutter_flow/request_manager.dart';
|
|
||||||
import 'package:hub/pages/visit_history_page/visit_history_page_widget.dart';
|
|
||||||
|
|
||||||
class VisitHistoryPageModel extends FlutterFlowModel<VisitHistoryPageWidget> {
|
|
||||||
final _visitHistoryManager = StreamRequestManager<ApiCallResponse>();
|
|
||||||
Stream<ApiCallResponse> visitHistory({
|
|
||||||
String? uniqueQueryKey,
|
|
||||||
bool? overrideCache,
|
|
||||||
required Stream<ApiCallResponse> Function() requestFn,
|
|
||||||
}) =>
|
|
||||||
_visitHistoryManager.performRequest(
|
|
||||||
uniqueQueryKey: uniqueQueryKey,
|
|
||||||
overrideCache: overrideCache,
|
|
||||||
requestFn: requestFn,
|
|
||||||
);
|
|
||||||
void clearVisitHistoryCache() => _visitHistoryManager.clear();
|
|
||||||
void clearVisitHistoryCacheKey(String? uniqueKey) =>
|
|
||||||
_visitHistoryManager.clearRequest(uniqueKey);
|
|
||||||
|
|
||||||
/// Local state fields for this page.
|
|
||||||
|
|
||||||
List<dynamic> visitorJsonList = [];
|
|
||||||
void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item);
|
|
||||||
void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item);
|
|
||||||
void removeAtIndexFromVisitorJsonList(int index) =>
|
|
||||||
visitorJsonList.removeAt(index);
|
|
||||||
void insertAtIndexInVisitorJsonList(int index, dynamic item) =>
|
|
||||||
visitorJsonList.insert(index, item);
|
|
||||||
void updateVisitorJsonListAtIndex(int index, Function(dynamic) updateFn) =>
|
|
||||||
visitorJsonList[index] = updateFn(visitorJsonList[index]);
|
|
||||||
|
|
||||||
String visitorStrList = '0';
|
|
||||||
|
|
||||||
/// State fields for stateful widgets in this page.
|
|
||||||
|
|
||||||
final unfocusNode = FocusNode();
|
|
||||||
// State field(s) for TabBar widget.
|
|
||||||
TabController? tabBarController;
|
|
||||||
int get tabBarCurrentIndex =>
|
|
||||||
tabBarController != null ? tabBarController!.index : 0;
|
|
||||||
|
|
||||||
// State field(s) for TextField widget.
|
|
||||||
FocusNode? textFieldFocusNode1;
|
|
||||||
TextEditingController? textController1;
|
|
||||||
String? Function(BuildContext, String?)? textController1Validator;
|
|
||||||
DateTime? datePicked1;
|
|
||||||
// State field(s) for TextField widget.
|
|
||||||
FocusNode? textFieldFocusNode2;
|
|
||||||
TextEditingController? textController2;
|
|
||||||
String? Function(BuildContext, String?)? textController2Validator;
|
|
||||||
DateTime? datePicked2;
|
|
||||||
// State field(s) for DropDown widget.
|
|
||||||
String? dropDownValue1;
|
|
||||||
FormFieldController<String>? dropDownValueController1;
|
|
||||||
// State field(s) for DropDown widget.
|
|
||||||
String? dropDownValue2;
|
|
||||||
FormFieldController<String>? dropDownValueController2;
|
|
||||||
// State field(s) for Switch widget.
|
|
||||||
bool? switchValue;
|
|
||||||
// State field(s) for TextField widget.
|
|
||||||
FocusNode? textFieldFocusNode3;
|
|
||||||
TextEditingController? textController3;
|
|
||||||
String? Function(BuildContext, String?)? textController3Validator;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState(BuildContext context) {}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
unfocusNode.dispose();
|
|
||||||
tabBarController?.dispose();
|
|
||||||
textFieldFocusNode1?.dispose();
|
|
||||||
textController1?.dispose();
|
|
||||||
|
|
||||||
textFieldFocusNode2?.dispose();
|
|
||||||
textController2?.dispose();
|
|
||||||
|
|
||||||
textFieldFocusNode3?.dispose();
|
|
||||||
textController3?.dispose();
|
|
||||||
|
|
||||||
clearVisitHistoryCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Action blocks.
|
|
||||||
Future getVisitorsActionPage(
|
|
||||||
BuildContext context, {
|
|
||||||
List<dynamic>? visitorsJsonList,
|
|
||||||
}) async {
|
|
||||||
visitorJsonList = visitorsJsonList!.toList().cast<dynamic>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> toggleCurrentSelectionHeader(
|
|
||||||
BuildContext context, {
|
|
||||||
required bool? toggleIndexValue,
|
|
||||||
}) async {
|
|
||||||
if (toggleIndexValue == true) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,753 +1,155 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:hub/actions/actions.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:hub/app_state.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
import 'package:hub/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart';
|
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||||
import 'package:hub/flutter_flow/custom_functions.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_action.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
||||||
|
|
||||||
import 'package:hub/pages/visit_history_page/visit_history_page_model.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class VisitHistoryPageWidget extends StatefulWidget {
|
class VisitHistoryWidget extends StatelessWidget {
|
||||||
const VisitHistoryPageWidget({
|
final ScheduleCompleteVisitPageModel _model;
|
||||||
super.key,
|
final Function safeSetState;
|
||||||
this.visitorStrList,
|
|
||||||
this.visitStartDateStr,
|
|
||||||
this.visitEndDateStr,
|
|
||||||
this.visitReasonStr,
|
|
||||||
this.visitLevelStr,
|
|
||||||
this.visitTempBol,
|
|
||||||
this.visitObsStr,
|
|
||||||
this.visitorJsonList,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String? visitorStrList;
|
const VisitHistoryWidget({
|
||||||
final String? visitStartDateStr;
|
Key? key,
|
||||||
final String? visitEndDateStr;
|
required ScheduleCompleteVisitPageModel model,
|
||||||
final String? visitReasonStr;
|
required this.safeSetState,
|
||||||
final String? visitLevelStr;
|
}) : _model = model,
|
||||||
final bool? visitTempBol;
|
super(key: key);
|
||||||
final String? visitObsStr;
|
|
||||||
final List<dynamic>? visitorJsonList;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<VisitHistoryPageWidget> createState() => _VisitHistoryPageWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _VisitHistoryPageWidgetState extends State<VisitHistoryPageWidget>
|
|
||||||
with TickerProviderStateMixin {
|
|
||||||
late VisitHistoryPageModel _model;
|
|
||||||
int _visitHistoryLoadingIdx = 0;
|
|
||||||
final int _visitHistoryLoadingCount = 10;
|
|
||||||
List<dynamic> _visitHistoryList = [];
|
|
||||||
ScrollController _visitHistoryController = ScrollController();
|
|
||||||
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_model = createModel(context, () => VisitHistoryPageModel());
|
|
||||||
|
|
||||||
// On page load action.
|
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
|
||||||
if ((widget.visitorStrList != null && widget.visitorStrList != '') &&
|
|
||||||
((widget.visitorJsonList != null &&
|
|
||||||
(widget.visitorJsonList)!.isNotEmpty) !=
|
|
||||||
null)) {
|
|
||||||
_model.visitorJsonList = widget.visitorJsonList!
|
|
||||||
.where((e) =>
|
|
||||||
widget.visitorStrList ==
|
|
||||||
getJsonField(
|
|
||||||
e,
|
|
||||||
r'''$.VTE_DOCUMENTO''',
|
|
||||||
).toString().toString())
|
|
||||||
.toList()
|
|
||||||
.toList()
|
|
||||||
.cast<dynamic>();
|
|
||||||
_model.visitorStrList = widget.visitorStrList!;
|
|
||||||
setState(() {});
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
_model.tabBarController = TabController(
|
|
||||||
vsync: this,
|
|
||||||
length: 2,
|
|
||||||
initialIndex: 0,
|
|
||||||
)..addListener(() => setState(() {}));
|
|
||||||
_model.textController1 ??= TextEditingController();
|
|
||||||
_model.textFieldFocusNode1 ??= FocusNode();
|
|
||||||
|
|
||||||
_model.textController2 ??= TextEditingController();
|
|
||||||
_model.textFieldFocusNode2 ??= FocusNode();
|
|
||||||
|
|
||||||
_model.switchValue = true;
|
|
||||||
_model.textController3 ??= TextEditingController();
|
|
||||||
_model.textFieldFocusNode3 ??= FocusNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _loadMoreVisitHistory() async {
|
|
||||||
// Simulate fetching data from an API or database
|
|
||||||
Future<List<String>> fetchVisitHistory(int start, int limit) async {
|
|
||||||
// Simulate network delay
|
|
||||||
await Future.delayed(Duration(seconds: 1));
|
|
||||||
// Generate a list of visit history items
|
|
||||||
return List.generate(limit, (index) => "Item ${start + index}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate the start index for the next batch of items to load
|
|
||||||
final int start = _visitHistoryLoadingIdx * _visitHistoryLoadingCount;
|
|
||||||
// Fetch the next batch of items
|
|
||||||
final List<String> newItems =
|
|
||||||
await fetchVisitHistory(start, _visitHistoryLoadingCount);
|
|
||||||
|
|
||||||
// If new items were fetched, add them to the list and update the index
|
|
||||||
if (newItems.isNotEmpty) {
|
|
||||||
_visitHistoryList.addAll(newItems);
|
|
||||||
_visitHistoryLoadingIdx++;
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void_scrollListener() {
|
|
||||||
if (_visitHistoryController.position.pixels ==
|
|
||||||
_visitHistoryController.position.maxScrollExtent) {
|
|
||||||
_loadMoreVisitHistory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_model.dispose();
|
|
||||||
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<FFAppState>();
|
|
||||||
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () => _model.unfocusNode.canRequestFocus
|
|
||||||
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
|
||||||
: FocusScope.of(context).unfocus(),
|
|
||||||
child: Scaffold(
|
|
||||||
key: scaffoldKey,
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
appBar: appBarScheduleCompleteVisit(context),
|
|
||||||
body:
|
|
||||||
bodyScheduleCompleteVisit(context, _model, setState, safeSetState),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
|
|
||||||
return AppBar(
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
automaticallyImplyLeading: false,
|
|
||||||
leading: FlutterFlowIconButton(
|
|
||||||
borderColor: Colors.transparent,
|
|
||||||
borderRadius: 30.0,
|
|
||||||
borderWidth: 1.0,
|
|
||||||
buttonSize: 60.0,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.keyboard_arrow_left,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
size: 30.0,
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
FFLocalizations.of(context).getText(
|
|
||||||
'61lcxdgm' /* Agendar Visita */,
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
|
||||||
fontFamily: 'Nunito',
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
fontSize: 15.0,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: const [],
|
|
||||||
centerTitle: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget bodyScheduleCompleteVisit(BuildContext context,
|
|
||||||
VisitHistoryPageModel _model, Function setState, Function safeSetState) {
|
|
||||||
return SafeArea(
|
|
||||||
top: true,
|
|
||||||
child: visitHistory(context, _model, safeSetState),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget visitHistory(
|
|
||||||
BuildContext context,
|
|
||||||
VisitHistoryPageModel _model,
|
|
||||||
Function safeSetState,
|
|
||||||
) {
|
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 900.0,
|
height: 900.0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: Consumer<ScheduleCompleteVisitPageModel>(
|
||||||
child: Column(
|
builder: (context, model, _) {
|
||||||
mainAxisSize: MainAxisSize.max,
|
return StreamBuilder<ApiCallResponse>(
|
||||||
children: [
|
stream: model.visitHistory(
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
FlutterFlowIconButton(
|
|
||||||
borderColor: Colors.transparent,
|
|
||||||
borderRadius: 20.0,
|
|
||||||
borderWidth: 1.0,
|
|
||||||
buttonSize: 40.0,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.settings_sharp,
|
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
|
||||||
size: 24.0,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
log('IconButton pressed ...');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
StreamBuilder<ApiCallResponse>(
|
|
||||||
stream: _model.visitHistory(
|
|
||||||
requestFn: () => PhpGroup.getVisitsCall.call(
|
requestFn: () => PhpGroup.getVisitsCall.call(
|
||||||
devUUID: FFAppState().devUUID,
|
devUUID: FFAppState().devUUID,
|
||||||
userUUID: FFAppState().userUUID,
|
userUUID: FFAppState().userUUID,
|
||||||
cliID: FFAppState().cliUUID,
|
cliID: FFAppState().cliUUID,
|
||||||
atividade: 'getVisitas',
|
atividade: 'getVisitas',
|
||||||
|
pageSize: 100,
|
||||||
|
pageNumber: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
// Customize what your widget looks like when it's loading.
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
if (!snapshot.hasData) {
|
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: CircularProgressIndicator(
|
||||||
width: 50.0,
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
height: 50.0,
|
FlutterFlowTheme.of(context).primary,
|
||||||
child: SpinKitCircle(
|
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
|
||||||
size: 50.0,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Center(child: Text('Error: ${snapshot.error}'));
|
||||||
|
} else if (!snapshot.hasData || snapshot.data!.jsonBody == null) {
|
||||||
|
return const Center(child: Text('No visits found'));
|
||||||
}
|
}
|
||||||
final wrapGetVisitsResponse = snapshot.data!;
|
final wrapGetVisitsResponse = snapshot.data!;
|
||||||
return Builder(
|
|
||||||
builder: (context) {
|
|
||||||
final visitaWrap = PhpGroup.getVisitsCall
|
final visitaWrap = PhpGroup.getVisitsCall
|
||||||
.visitasList(
|
.visitasList(wrapGetVisitsResponse.jsonBody)
|
||||||
wrapGetVisitsResponse.jsonBody,
|
|
||||||
)
|
|
||||||
?.toList() ??
|
?.toList() ??
|
||||||
[];
|
[];
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: visitaWrap.length,
|
itemCount: visitaWrap.length,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
scrollDirection: Axis.vertical,
|
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
addAutomaticKeepAlives: true,
|
|
||||||
cacheExtent: 1000.0,
|
|
||||||
addRepaintBoundaries: true,
|
|
||||||
addSemanticIndexes: true,
|
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final visitaWrapItem = visitaWrap[index];
|
final visitaWrapItem = visitaWrap[index];
|
||||||
// visitaWrap.length, (visitaWrapIndex) {
|
return CardItemTemplateComponentWidget(
|
||||||
|
imageHashMap: {
|
||||||
return InkWell(
|
'key': visitaWrapItem['VTE_DOCUMENTO'] ?? '',
|
||||||
splashColor: Colors.transparent,
|
'value': 'E',
|
||||||
focusColor: Colors.transparent,
|
},
|
||||||
hoverColor: Colors.transparent,
|
labelsHashMap: {
|
||||||
highlightColor: Colors.transparent,
|
'Nome:': visitaWrapItem['VTE_NOME'] ?? '',
|
||||||
onTap: () async {
|
'Inicio:': visitaWrapItem['VAW_DTINICIO'] ?? '',
|
||||||
await showModalBottomSheet(
|
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
|
||||||
|
},
|
||||||
|
statusHashMap: [
|
||||||
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
status.active)
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Ativo',
|
||||||
|
enText: 'Active',
|
||||||
|
): FlutterFlowTheme.of(context).warning,
|
||||||
|
},
|
||||||
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
status.finished)
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Finalizado',
|
||||||
|
enText: 'Finished',
|
||||||
|
): FlutterFlowTheme.of(context).success,
|
||||||
|
},
|
||||||
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
status.unknown)
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Desconhecido',
|
||||||
|
enText: 'Unknown',
|
||||||
|
): FlutterFlowTheme.of(context).alternate,
|
||||||
|
},
|
||||||
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
status.canceled)
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cancelado',
|
||||||
|
enText: 'Canceled',
|
||||||
|
): FlutterFlowTheme.of(context).error,
|
||||||
|
},
|
||||||
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
status.blocked)
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Bloqueado',
|
||||||
|
enText: 'Blocked',
|
||||||
|
): FlutterFlowTheme.of(context).error,
|
||||||
|
},
|
||||||
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
status.inactive)
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Inactive',
|
||||||
|
enText: 'Inactive',
|
||||||
|
): FlutterFlowTheme.of(context).error,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onTapCardItemAction: () async {
|
||||||
|
showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
|
isDismissible: true,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
enableDrag: false,
|
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return GestureDetector(
|
return buildDetails(
|
||||||
onTap: () =>
|
|
||||||
_model.unfocusNode.canRequestFocus
|
|
||||||
? FocusScope.of(context)
|
|
||||||
.requestFocus(_model.unfocusNode)
|
|
||||||
: FocusScope.of(context).unfocus(),
|
|
||||||
child: Padding(
|
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
|
||||||
child:
|
|
||||||
VisitDetailsModalTemplateComponentWidget(
|
|
||||||
visitStatusStr: getJsonField(
|
|
||||||
visitaWrapItem,
|
visitaWrapItem,
|
||||||
r'''$.VAW_STATUS''',
|
context,
|
||||||
).toString(),
|
changeStatusAction,
|
||||||
visitStartDateStr: getJsonField(
|
);
|
||||||
visitaWrapItem,
|
},
|
||||||
r'''$.VAW_DTINICIO''',
|
);
|
||||||
).toString(),
|
},
|
||||||
visitEndDateStr: getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_DTFIM''',
|
|
||||||
).toString(),
|
|
||||||
visitReasonStr: getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.MOT_DESCRICAO''',
|
|
||||||
).toString(),
|
|
||||||
visitLevelStr: getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.NAC_DESCRICAO''',
|
|
||||||
).toString(),
|
|
||||||
visitTempStr: getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VTE_UNICA''',
|
|
||||||
).toString(),
|
|
||||||
visitObsStr: getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_OBS''',
|
|
||||||
).toString(),
|
|
||||||
visitorImgPath: valueOrDefault<String>(
|
|
||||||
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VTE_DOCUMENTO''',
|
|
||||||
).toString()}&tipo=E",
|
|
||||||
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
|
||||||
),
|
|
||||||
visitorStrList: getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VTE_DOCUMENTO''',
|
|
||||||
).toString(),
|
|
||||||
visitIdStr: getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_ID''',
|
|
||||||
).toString(),
|
|
||||||
visitStatusColor: getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
).toString() ==
|
|
||||||
'A'
|
|
||||||
? FlutterFlowTheme.of(context).success
|
|
||||||
: FlutterFlowTheme.of(context).error,
|
|
||||||
visitorJsonList:
|
|
||||||
PhpGroup.getVisitsCall.visitasList(
|
|
||||||
wrapGetVisitsResponse.jsonBody,
|
|
||||||
),
|
|
||||||
updateToggleIdx: () async {},
|
|
||||||
repeatVisitSchedule: () async {},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).then((value) => safeSetState(() {}));
|
|
||||||
},
|
|
||||||
child: Card(
|
|
||||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
||||||
color: FlutterFlowTheme.of(context)
|
|
||||||
.secondaryBackground,
|
|
||||||
elevation: 5.0,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
width: 350.0,
|
|
||||||
height: 115.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: FlutterFlowTheme.of(context)
|
|
||||||
.secondaryBackground,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
width: 100.0,
|
|
||||||
height: 100.0,
|
|
||||||
decoration: const BoxDecoration(),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
FFLocalizations.of(context)
|
|
||||||
.getText(
|
|
||||||
'i46frqyi' /* Visitante: */,
|
|
||||||
),
|
|
||||||
style:
|
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts
|
|
||||||
.asMap()
|
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Align(
|
|
||||||
alignment:
|
|
||||||
const AlignmentDirectional(
|
|
||||||
-1.0, -1.0),
|
|
||||||
child: Text(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VTE_NOME''',
|
|
||||||
).toString(),
|
|
||||||
style: FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts
|
|
||||||
.asMap()
|
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].addToStart(
|
|
||||||
const SizedBox(width: 10.0)),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
FFLocalizations.of(context)
|
|
||||||
.getText(
|
|
||||||
'73b1kj59' /* Início em: */,
|
|
||||||
),
|
|
||||||
style:
|
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts
|
|
||||||
.asMap()
|
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_DTINICIO''',
|
|
||||||
).toString(),
|
|
||||||
style:
|
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts
|
|
||||||
.asMap()
|
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].addToStart(
|
|
||||||
const SizedBox(width: 10.0)),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
FFLocalizations.of(context)
|
|
||||||
.getText(
|
|
||||||
'klzzrfbn' /* Fim em: */,
|
|
||||||
),
|
|
||||||
style:
|
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts
|
|
||||||
.asMap()
|
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_DTFIM''',
|
|
||||||
).toString(),
|
|
||||||
style:
|
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts
|
|
||||||
.asMap()
|
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].addToStart(
|
|
||||||
const SizedBox(width: 10.0)),
|
|
||||||
),
|
|
||||||
Align(
|
|
||||||
alignment:
|
|
||||||
const AlignmentDirectional(
|
|
||||||
-1.0, 0.0),
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsetsDirectional
|
|
||||||
.fromSTEB(
|
|
||||||
10.0, 0.0, 0.0, 0.0),
|
|
||||||
child: Container(
|
|
||||||
width: 200.0,
|
|
||||||
height: 27.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: valueOrDefault<Color>(
|
|
||||||
() {
|
|
||||||
if (jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"A\"') {
|
|
||||||
return FlutterFlowTheme
|
|
||||||
.of(context)
|
|
||||||
.success;
|
|
||||||
} else if ((jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"C\"') ||
|
|
||||||
(jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"F\"') ||
|
|
||||||
(jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"B\"') ||
|
|
||||||
(jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"I\"')) {
|
|
||||||
return FlutterFlowTheme
|
|
||||||
.of(context)
|
|
||||||
.error;
|
|
||||||
} else if (jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"I\"') {
|
|
||||||
return FlutterFlowTheme
|
|
||||||
.of(context)
|
|
||||||
.warning;
|
|
||||||
} else {
|
|
||||||
return FlutterFlowTheme
|
|
||||||
.of(context)
|
|
||||||
.primary;
|
|
||||||
}
|
|
||||||
}(),
|
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.primary,
|
|
||||||
),
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(
|
|
||||||
5.0),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment:
|
|
||||||
const AlignmentDirectional(
|
|
||||||
0.0, 0.0),
|
|
||||||
child: Text(
|
|
||||||
() {
|
|
||||||
if (jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"A\"') {
|
|
||||||
return FFLocalizations
|
|
||||||
.of(context)
|
|
||||||
.getVariableText(
|
|
||||||
ptText: 'Ativo',
|
|
||||||
enText: 'Active',
|
|
||||||
);
|
);
|
||||||
} else if ((jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"F\"') ||
|
|
||||||
(jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"C\"') ||
|
|
||||||
(jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"B\"') ||
|
|
||||||
(jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VAW_STATUS''',
|
|
||||||
)) ==
|
|
||||||
'\"I\"')) {
|
|
||||||
return FFLocalizations
|
|
||||||
.of(context)
|
|
||||||
.getVariableText(
|
|
||||||
ptText: 'Cancelado',
|
|
||||||
enText: 'Canceled',
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return FFLocalizations
|
|
||||||
.of(context)
|
|
||||||
.getVariableText(
|
|
||||||
ptText: 'Pendente',
|
|
||||||
enText: 'Pending',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}(),
|
|
||||||
style: FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
color: FlutterFlowTheme
|
|
||||||
.of(context)
|
|
||||||
.info,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts
|
|
||||||
.asMap()
|
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].divide(const SizedBox(height: 3.0)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(0.0),
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fadeInDuration:
|
|
||||||
const Duration(milliseconds: 500),
|
|
||||||
fadeOutDuration:
|
|
||||||
const Duration(milliseconds: 500),
|
|
||||||
imageUrl: valueOrDefault<String>(
|
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
|
||||||
visitaWrapItem,
|
|
||||||
r'''$.VTE_DOCUMENTO''',
|
|
||||||
).toString()}&tipo=E',
|
|
||||||
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -233,14 +233,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.5"
|
version: "2.0.5"
|
||||||
eva_icons_flutter:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: eva_icons_flutter
|
|
||||||
sha256: "6d48a10b93590ab83eb092bee5adacdeb14f3d83f527a4b9e4092c363d56e2a8"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.1.0"
|
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -49,7 +49,6 @@ dependencies:
|
||||||
flutter_plugin_android_lifecycle: 2.0.20
|
flutter_plugin_android_lifecycle: 2.0.20
|
||||||
share_plus: ^9.0.0
|
share_plus: ^9.0.0
|
||||||
flutter_secure_storage: 9.2.2
|
flutter_secure_storage: 9.2.2
|
||||||
eva_icons_flutter: ^3.1.0
|
|
||||||
flutter_secure_storage_linux: 1.2.1
|
flutter_secure_storage_linux: 1.2.1
|
||||||
flutter_secure_storage_macos: 3.1.2
|
flutter_secure_storage_macos: 3.1.2
|
||||||
flutter_secure_storage_platform_interface: 1.1.2
|
flutter_secure_storage_platform_interface: 1.1.2
|
||||||
|
|
Loading…
Reference in New Issue