chore: Update internationalization translations for access history page and tabBar layout
This commit is contained in:
parent
04f9e64ef7
commit
68aa4c635e
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
@ -1590,7 +1591,7 @@ class RespondeSolicitacaoCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetAccessCall {
|
class GetAccessCall {
|
||||||
Future<ApiCallResponse> call({
|
Stream<ApiCallResponse> call({
|
||||||
String? devUUID = '',
|
String? devUUID = '',
|
||||||
String? userUUID = '',
|
String? userUUID = '',
|
||||||
String? cliID = '',
|
String? cliID = '',
|
||||||
|
@ -1598,10 +1599,13 @@ class GetAccessCall {
|
||||||
String? pageSize = '',
|
String? pageSize = '',
|
||||||
String? pageNumber = '',
|
String? pageNumber = '',
|
||||||
String? pesTipo = '',
|
String? pesTipo = '',
|
||||||
}) async {
|
}) {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
final StreamController<ApiCallResponse> controller = StreamController();
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
Future.microtask(() async {
|
||||||
|
try {
|
||||||
|
final response = await ApiManager.instance.makeApiCall(
|
||||||
callName: 'getAccess',
|
callName: 'getAccess',
|
||||||
apiUrl: '$baseUrl/processRequest.php',
|
apiUrl: '$baseUrl/processRequest.php',
|
||||||
callType: ApiCallType.POST,
|
callType: ApiCallType.POST,
|
||||||
|
@ -1625,6 +1629,15 @@ class GetAccessCall {
|
||||||
isStreamingApi: false,
|
isStreamingApi: false,
|
||||||
alwaysAllowBody: false,
|
alwaysAllowBody: false,
|
||||||
);
|
);
|
||||||
|
controller.add(response);
|
||||||
|
await controller.close();
|
||||||
|
} catch (e) {
|
||||||
|
controller.addError(e);
|
||||||
|
await controller.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return controller.stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool? error(dynamic response) => castToType<bool>(getJsonField(
|
bool? error(dynamic response) => castToType<bool>(getJsonField(
|
||||||
|
@ -1828,7 +1841,7 @@ class GetAccessCall {
|
||||||
.map((x) => castToType<String>(x))
|
.map((x) => castToType<String>(x))
|
||||||
.withoutNulls
|
.withoutNulls
|
||||||
.toList();
|
.toList();
|
||||||
List<String>? accessTypeSet(dynamic response) => (getJsonField(
|
List<String>? accessTypeet(dynamic response) => (getJsonField(
|
||||||
response,
|
response,
|
||||||
r'''$.acessos[:].SET_TIPO''',
|
r'''$.acessos[:].SET_TIPO''',
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -332,6 +332,9 @@ class NotificationHandler {
|
||||||
void _showAcessNotificationModal(
|
void _showAcessNotificationModal(
|
||||||
Map<String, dynamic> message, BuildContext context) {
|
Map<String, dynamic> message, BuildContext context) {
|
||||||
debugPrint('Showing access notification dialog');
|
debugPrint('Showing access notification dialog');
|
||||||
|
debugPrint('USR_TIPO: ${message['USR_TIPO']}');
|
||||||
|
debugPrint('USR_ID: ${message['USR_ID']}');
|
||||||
|
debugPrint('USR_DOCUMENTO: ${message['USR_DOCUMENTO']}');
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -340,9 +343,15 @@ class NotificationHandler {
|
||||||
child: AccessNotificationModalTemplateComponentWidget(
|
child: AccessNotificationModalTemplateComponentWidget(
|
||||||
datetime: message['ACE_DATAHORA'].toString(),
|
datetime: message['ACE_DATAHORA'].toString(),
|
||||||
drive: message['ACI_DESCRICAO'].toString(),
|
drive: message['ACI_DESCRICAO'].toString(),
|
||||||
id: message['PES_ID'].toString(),
|
id: message['USR_TIPO'].toString() == 'O'
|
||||||
|
? message['USR_ID'].toString() == ''
|
||||||
|
? '0'
|
||||||
|
: message['USR_ID'].toString()
|
||||||
|
: message['USR_DOCUMENTO'].toString() == ''
|
||||||
|
? '0'
|
||||||
|
: message['USR_DOCUMENTO'].toString(),
|
||||||
name: message['PES_NOME'].toString(),
|
name: message['PES_NOME'].toString(),
|
||||||
type: message['PES_TIPO'].toString(),
|
type: message['USR_TIPO'],
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,49 +1,324 @@
|
||||||
|
import 'package:f_r_e_hub/components/molecular_components/opt_modal/opt_modal_model.dart';
|
||||||
|
import 'package:f_r_e_hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
import 'package:f_r_e_hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
class OptModalWidget extends StatefulWidget {
|
class OptModalWidget extends StatefulWidget {
|
||||||
const OptModalWidget({Key? key}) : super(key: key);
|
final String defaultPersonType;
|
||||||
|
final String defaultAccessType;
|
||||||
|
|
||||||
|
const OptModalWidget({
|
||||||
|
Key? key,
|
||||||
|
this.defaultPersonType = '.*',
|
||||||
|
this.defaultAccessType = '.*',
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_OptModalWidgetState createState() => _OptModalWidgetState();
|
_OptModalWidgetState createState() => _OptModalWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _OptModalWidgetState extends State<OptModalWidget> {
|
class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
String selectedOption = 'T'; // Estado inicial
|
late OptModalModel _model;
|
||||||
|
|
||||||
void setSelectedOption(String option) {
|
late Map<String, dynamic> selected;
|
||||||
|
final List<Map<String, String>> personTypeOptions = [
|
||||||
|
{'title': 'zok7lu4w', 'value': 'E'},
|
||||||
|
{'title': 'oonqk812', 'value': 'O'},
|
||||||
|
];
|
||||||
|
final List<Map<String, String>> accessTypeOptions = [
|
||||||
|
{'title': '580z80ct', 'value': '0'},
|
||||||
|
{'title': '1nbwqtzs', 'value': '1'},
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void setState(VoidCallback callback) {
|
||||||
|
super.setState(callback);
|
||||||
|
_model.onUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
_model = createModel(context, () => OptModalModel());
|
||||||
|
|
||||||
|
_model.textController ??= TextEditingController();
|
||||||
|
_model.textFieldFocusNode ??= FocusNode();
|
||||||
|
|
||||||
|
selected = {
|
||||||
|
'personType': widget.defaultPersonType == '.*'
|
||||||
|
? ['E', 'O']
|
||||||
|
: [widget.defaultPersonType],
|
||||||
|
'accessType': widget.defaultAccessType == '.*'
|
||||||
|
? ['0', '1']
|
||||||
|
: [widget.defaultAccessType],
|
||||||
|
'search': '.*',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void _applyFilter() {
|
||||||
|
Map<String, String> filterResult = {
|
||||||
|
'personType': '',
|
||||||
|
'accessType': '',
|
||||||
|
'search': _model.textController.text == ''
|
||||||
|
? '.*'
|
||||||
|
: _model.textController.text.toLowerCase(),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (selected['personType']!.isEmpty) {
|
||||||
|
filterResult['personType'] = '.*';
|
||||||
|
} else if (selected['personType']!.length > 1) {
|
||||||
|
filterResult['personType'] = '.*';
|
||||||
|
} else {
|
||||||
|
filterResult['personType'] = selected['personType']!.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selected['accessType']!.isEmpty) {
|
||||||
|
filterResult['accessType'] = '.*';
|
||||||
|
} else if (selected['accessType']!.length > 1) {
|
||||||
|
filterResult['accessType'] = '.*';
|
||||||
|
} else {
|
||||||
|
filterResult['accessType'] = selected['accessType']!.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
Navigator.pop(context, filterResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCheckboxListTile(String key, List<Map<String, String>> options) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
|
||||||
|
child: Text(
|
||||||
|
FFLocalizations.of(context).getText('l7tw8b92'),
|
||||||
|
textAlign: TextAlign
|
||||||
|
.left, // Adiciona esta linha para alinhar o texto à esquerda
|
||||||
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: options.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final option = options[index];
|
||||||
|
return CheckboxListTile(
|
||||||
|
title: Text(
|
||||||
|
FFLocalizations.of(context).getText(option['title']!),
|
||||||
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dense: true,
|
||||||
|
value: selected[key]!.contains(option['value']),
|
||||||
|
onChanged: (bool? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedOption = option;
|
if (value == true) {
|
||||||
|
if (!selected[key]!.contains(option['value'])) {
|
||||||
|
selected[key]!.add(option['value']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selected[key]!.remove(option['value']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
activeColor: FlutterFlowTheme.of(context).primary,
|
||||||
|
checkColor: FlutterFlowTheme.of(context).info,
|
||||||
|
side: BorderSide(
|
||||||
|
width: 2,
|
||||||
|
color: FlutterFlowTheme.of(context).secondaryText,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _updateSelection(String? value, String key) {
|
||||||
|
setState(() {
|
||||||
|
if (value == '.') {
|
||||||
|
selected[key] = [];
|
||||||
|
} else if (value != null) {
|
||||||
|
if (selected[key]!.contains(value)) {
|
||||||
|
selected[key]!.remove(value);
|
||||||
|
} else {
|
||||||
|
selected[key]!.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return SafeArea(
|
||||||
// Estilize seu modal como necessário
|
child: Align(
|
||||||
|
alignment: const AlignmentDirectional(1.0, -1.0),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 50.0, 50.0, 0.0),
|
||||||
|
child: Container(
|
||||||
|
width: 300.0,
|
||||||
|
height: 500.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
borderRadius: BorderRadius.circular(24.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Botão para "Visitante"
|
Row(
|
||||||
ElevatedButton(
|
mainAxisSize: MainAxisSize.max,
|
||||||
onPressed: () => setSelectedOption('E'),
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
child: Text('Visitante'),
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
10.0, 10.0, 0.0, 10.0),
|
||||||
|
child: Text(
|
||||||
|
FFLocalizations.of(context)
|
||||||
|
.getText('yfj9pd6k'), // Filtros
|
||||||
|
style: FlutterFlowTheme.of(context)
|
||||||
|
.headlineMedium
|
||||||
|
.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context)
|
||||||
|
.headlineMediumFamily,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
fontSize: 16.0,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.headlineMediumFamily),
|
||||||
),
|
),
|
||||||
// Botão para "Morador"
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () => setSelectedOption('O'),
|
|
||||||
child: Text('Morador'),
|
|
||||||
),
|
),
|
||||||
// Botão para "Ambos ou Nenhum"
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () => setSelectedOption('T'),
|
|
||||||
child: Text('Ambos ou Nenhum'),
|
|
||||||
),
|
|
||||||
// Botão para confirmar a seleção e fechar o modal
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () => Navigator.pop(context, selectedOption),
|
|
||||||
child: Text('Confirmar'),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
8.0, 0.0, 8.0, 0.0),
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _model.textController,
|
||||||
|
focusNode: _model.textFieldFocusNode,
|
||||||
|
autofocus: true,
|
||||||
|
obscureText: false,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
labelText: FFLocalizations.of(context).getText(
|
||||||
|
'0enrtljz' /* Pesquise aqui..... */,
|
||||||
|
),
|
||||||
|
labelStyle: FlutterFlowTheme.of(context)
|
||||||
|
.labelMedium
|
||||||
|
.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context)
|
||||||
|
.labelMediumFamily,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.labelMediumFamily),
|
||||||
|
),
|
||||||
|
hintStyle: FlutterFlowTheme.of(context)
|
||||||
|
.labelMedium
|
||||||
|
.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context)
|
||||||
|
.labelMediumFamily,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.labelMediumFamily),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).alternate,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primary,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).error,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
focusedErrorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).error,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
filled: true,
|
||||||
|
fillColor: FlutterFlowTheme.of(context).alternate,
|
||||||
|
suffixIcon: const Icon(
|
||||||
|
Icons.search_outlined,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
fontFamily:
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
),
|
||||||
|
validator:
|
||||||
|
_model.textControllerValidator.asValidator(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
_buildCheckboxListTile(
|
||||||
|
'personType', personTypeOptions),
|
||||||
|
_buildCheckboxListTile(
|
||||||
|
'accessType', accessTypeOptions),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: _applyFilter,
|
||||||
|
child:
|
||||||
|
Text(FFLocalizations.of(context).getText('88kshkph')),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
foregroundColor: FlutterFlowTheme.of(context).info,
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,10 @@ class _AccessNotificationModalTemplateComponentWidgetState
|
||||||
fadeInDuration: const Duration(milliseconds: 100),
|
fadeInDuration: const Duration(milliseconds: 100),
|
||||||
fadeOutDuration: const Duration(milliseconds: 100),
|
fadeOutDuration: const Duration(milliseconds: 100),
|
||||||
imageUrl: valueOrDefault<String>(
|
imageUrl: valueOrDefault<String>(
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=E',
|
// widget.type == 'O'
|
||||||
|
// ? 'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=O'
|
||||||
|
// : 'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=E',
|
||||||
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=${widget.type}',
|
||||||
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
||||||
),
|
),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
|
@ -117,7 +120,8 @@ class _AccessNotificationModalTemplateComponentWidgetState
|
||||||
.addToEnd(const SizedBox(width: 10.0)),
|
.addToEnd(const SizedBox(width: 10.0)),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
24.0, 0.0, 24.0, 0.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController1,
|
controller: _model.textController1,
|
||||||
focusNode: _model.textFieldFocusNode1,
|
focusNode: _model.textFieldFocusNode1,
|
||||||
|
@ -300,7 +304,8 @@ class _AccessNotificationModalTemplateComponentWidgetState
|
||||||
.addToEnd(const SizedBox(width: 24.0)),
|
.addToEnd(const SizedBox(width: 24.0)),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
24.0, 0.0, 24.0, 0.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController4,
|
controller: _model.textController4,
|
||||||
focusNode: _model.textFieldFocusNode4,
|
focusNode: _model.textFieldFocusNode4,
|
||||||
|
@ -358,7 +363,8 @@ class _AccessNotificationModalTemplateComponentWidgetState
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
24.0, 0.0, 24.0, 0.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController5,
|
controller: _model.textController5,
|
||||||
focusNode: _model.textFieldFocusNode5,
|
focusNode: _model.textFieldFocusNode5,
|
||||||
|
|
|
@ -501,8 +501,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
|
||||||
'en': 'Resident',
|
'en': 'Resident',
|
||||||
},
|
},
|
||||||
'yfj9pd6k': {
|
'yfj9pd6k': {
|
||||||
'pt': 'Visitante',
|
'pt': 'Filtro',
|
||||||
'en': '',
|
'en': 'Filter',
|
||||||
},
|
},
|
||||||
'svfcf5xs': {
|
'svfcf5xs': {
|
||||||
'pt': 'Morador',
|
'pt': 'Morador',
|
||||||
|
@ -530,7 +530,7 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
|
||||||
},
|
},
|
||||||
'88kshkph': {
|
'88kshkph': {
|
||||||
'pt': 'Salvar',
|
'pt': 'Salvar',
|
||||||
'en': 'To save',
|
'en': 'Apply',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// throwException
|
// throwException
|
||||||
|
|
|
@ -135,7 +135,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'acessHistoryPage',
|
name: 'acessHistoryPage',
|
||||||
path: '/acessHistoryPage',
|
path: '/acessHistoryPage',
|
||||||
builder: (context, params) => const AcessHistoryPageWidget()),
|
builder: (context, params) => AcessHistoryPageWidget(opt: {
|
||||||
|
'personType': '.*',
|
||||||
|
'accessType': '.*',
|
||||||
|
'search': '.*',
|
||||||
|
})),
|
||||||
// FFRoute(
|
// FFRoute(
|
||||||
// name: 'liberationHistory',
|
// name: 'liberationHistory',
|
||||||
// path: '/liberationHistory',
|
// path: '/liberationHistory',
|
||||||
|
|
|
@ -1,17 +1,25 @@
|
||||||
// Export pages
|
|
||||||
export '/pages/home_page/home_page_widget.dart' show HomePageWidget;
|
export '/pages/home_page/home_page_widget.dart' show HomePageWidget;
|
||||||
|
|
||||||
export '/pages/register_visitor_page/register_visitor_page_widget.dart'
|
export '/pages/register_visitor_page/register_visitor_page_widget.dart'
|
||||||
show RegisterVisitorPageWidget;
|
show RegisterVisitorPageWidget;
|
||||||
|
|
||||||
export '/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart'
|
export '/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart'
|
||||||
show ScheduleCompleteVisitPageWidget;
|
show ScheduleCompleteVisitPageWidget;
|
||||||
|
|
||||||
export '/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart'
|
export '/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart'
|
||||||
show ScheduleProvisionalVisitPageWidget;
|
show ScheduleProvisionalVisitPageWidget;
|
||||||
|
|
||||||
export '/pages/people_on_the_property_page/people_on_the_property_page_widget.dart'
|
export '/pages/people_on_the_property_page/people_on_the_property_page_widget.dart'
|
||||||
show PeopleOnThePropertyPageWidget;
|
show PeopleOnThePropertyPageWidget;
|
||||||
|
|
||||||
export '/pages/acess_history_page/acess_history_page_widget.dart'
|
export '/pages/acess_history_page/acess_history_page_widget.dart'
|
||||||
show AcessHistoryPageWidget;
|
show AcessHistoryPageWidget;
|
||||||
|
|
||||||
export '/pages/liberation_history/liberation_history_widget.dart'
|
export '/pages/liberation_history/liberation_history_widget.dart'
|
||||||
show LiberationHistoryWidget;
|
show LiberationHistoryWidget;
|
||||||
|
|
||||||
export '/pages/sign_in_page/sign_in_page_widget.dart' show SignInPageWidget;
|
export '/pages/sign_in_page/sign_in_page_widget.dart' show SignInPageWidget;
|
||||||
|
|
||||||
export '/pages/sign_up_page/sign_up_page_widget.dart' show SignUpPageWidget;
|
export '/pages/sign_up_page/sign_up_page_widget.dart' show SignUpPageWidget;
|
||||||
|
|
||||||
export '/pages/welcome_page/welcome_page_widget.dart' show WelcomePageWidget;
|
export '/pages/welcome_page/welcome_page_widget.dart' show WelcomePageWidget;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import 'package:f_r_e_hub/backend/api_requests/api_calls.dart';
|
// import 'package:f_r_e_hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:f_r_e_hub/backend/push_notification/pushNotificationService.dart';
|
// import 'package:f_r_e_hub/backend/push_notification/pushNotificationService.dart';
|
||||||
import 'package:f_r_e_hub/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart';
|
// 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_local_notifications/flutter_local_notifications.dart';
|
||||||
|
// import 'package:firebase_analytics/firebase_analytics.dart';
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'firebase_options.dart';
|
import 'firebase_options.dart';
|
||||||
|
@ -12,7 +13,6 @@ import 'package:flutter_web_plugins/url_strategy.dart';
|
||||||
import 'flutter_flow/flutter_flow_theme.dart';
|
import 'flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'flutter_flow/flutter_flow_util.dart';
|
import 'flutter_flow/flutter_flow_util.dart';
|
||||||
import 'flutter_flow/internationalization.dart';
|
import 'flutter_flow/internationalization.dart';
|
||||||
import 'package:firebase_analytics/firebase_analytics.dart';
|
|
||||||
|
|
||||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,12 @@ import 'acess_history_page_widget.dart' show AcessHistoryPageWidget;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
||||||
/// State fields for stateful widgets in this page.
|
|
||||||
|
|
||||||
final unfocusNode = FocusNode();
|
final unfocusNode = FocusNode();
|
||||||
|
final _accessHistoryManager = StreamRequestManager<ApiCallResponse>();
|
||||||
/// Query cache managers for this widget.
|
Stream<ApiCallResponse> accessHistory({
|
||||||
|
|
||||||
final _accessHistoryManager = FutureRequestManager<ApiCallResponse>();
|
|
||||||
Future<ApiCallResponse> accessHistory({
|
|
||||||
String? uniqueQueryKey,
|
String? uniqueQueryKey,
|
||||||
bool? overrideCache,
|
bool? overrideCache,
|
||||||
required Future<ApiCallResponse> Function() requestFn,
|
required Stream<ApiCallResponse> Function() requestFn,
|
||||||
}) =>
|
}) =>
|
||||||
_accessHistoryManager.performRequest(
|
_accessHistoryManager.performRequest(
|
||||||
uniqueQueryKey: uniqueQueryKey,
|
uniqueQueryKey: uniqueQueryKey,
|
||||||
|
@ -40,7 +35,6 @@ class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
||||||
clearAccessHistoryCache();
|
clearAccessHistoryCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Action blocks.
|
|
||||||
Future toggleOptionsAction(BuildContext context) async {
|
Future toggleOptionsAction(BuildContext context) async {
|
||||||
await showModalBottomSheet(
|
await showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
|
|
|
@ -9,20 +9,24 @@ import '/flutter_flow/custom_functions.dart' as functions;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'acess_history_page_model.dart';
|
import 'acess_history_page_model.dart';
|
||||||
export 'acess_history_page_model.dart';
|
export 'acess_history_page_model.dart';
|
||||||
|
|
||||||
|
@immutable
|
||||||
class AcessHistoryPageWidget extends StatefulWidget {
|
class AcessHistoryPageWidget extends StatefulWidget {
|
||||||
const AcessHistoryPageWidget({super.key});
|
late Map<String, String> opt = {
|
||||||
|
'personType': '.*',
|
||||||
|
'accessType': '.*',
|
||||||
|
'search': '.*',
|
||||||
|
};
|
||||||
|
AcessHistoryPageWidget({super.key, required this.opt});
|
||||||
@override
|
@override
|
||||||
State<AcessHistoryPageWidget> createState() => _AcessHistoryPageWidgetState();
|
State<AcessHistoryPageWidget> createState() =>
|
||||||
|
_AcessHistoryPageWidgetState(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
class AccessHistoryItemWidget extends StatelessWidget {
|
class AccessHistoryItemWidget extends StatelessWidget {
|
||||||
final dynamic
|
final dynamic accessHistoryItem;
|
||||||
accessHistoryItem; // Substitua dynamic pelo tipo correto conforme seu modelo de dados
|
|
||||||
|
|
||||||
const AccessHistoryItemWidget({Key? key, required this.accessHistoryItem})
|
const AccessHistoryItemWidget({Key? key, required this.accessHistoryItem})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
@ -31,162 +35,150 @@ class AccessHistoryItemWidget extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Column(
|
child: Column(),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
accessHistoryItem[
|
|
||||||
'nomeCampo'], // Substitua 'nomeCampo' pelo campo correto do seu modelo de dados
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 4.0),
|
|
||||||
Text(
|
|
||||||
accessHistoryItem[
|
|
||||||
'descricaoCampo'], // Substitua 'descricaoCampo' pelo campo correto do seu modelo de dados
|
|
||||||
style: TextStyle(fontSize: 14.0),
|
|
||||||
),
|
|
||||||
// Adicione mais Widgets conforme necessário
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
late AcessHistoryPageModel _model;
|
late AcessHistoryPageModel _model;
|
||||||
BehaviorSubject<String> selectedTypeSubject =
|
final BehaviorSubject<Map<String, String>> selectedTypeSubject;
|
||||||
BehaviorSubject<String>.seeded('T');
|
bool _isSubjectClosed = false;
|
||||||
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
// Método para atualizar o estado e refazer a chamada à API
|
_AcessHistoryPageWidgetState(Map<String, String> opt)
|
||||||
void updateAccessHistory(String newType) {
|
: selectedTypeSubject = BehaviorSubject.seeded(opt) {
|
||||||
debugPrint('ne: $newType');
|
selectedTypeSubject.listen((value) {
|
||||||
selectedTypeSubject.add(newType); // Atualiza o tipo selecionado
|
print("selectedTypeSubject changed: $value");
|
||||||
setState(() {}); // Atualiza o estado do StreamBuilder
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_model = createModel(context, () => AcessHistoryPageModel());
|
_model = createModel(context, () => AcessHistoryPageModel());
|
||||||
|
debugPrint("initState called in _AcessHistoryPageWidgetState");
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_model.dispose();
|
selectedTypeSubject.close();
|
||||||
|
_isSubjectClosed = true;
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// void updateSelectedType(String? value) {
|
|
||||||
// setState(() {
|
|
||||||
// selectedType.value = value;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
appBar: _buildAppBar(context),
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
body: SafeArea(
|
appBar: _appBarOrganismWidget(context),
|
||||||
child: Column(
|
body: _accessHistoryListOrganismWidget(context));
|
||||||
children: [
|
}
|
||||||
_buildFilterButton(context),
|
|
||||||
Expanded(
|
// AppBar Widgets
|
||||||
// Isso garante que SingleChildScrollView tenha um limite e possa rolar
|
PreferredSizeWidget _appBarOrganismWidget(BuildContext context) {
|
||||||
child: SingleChildScrollView(
|
final theme = FlutterFlowTheme.of(context);
|
||||||
child: Column(
|
return AppBar(
|
||||||
children: [
|
backgroundColor: theme.primaryBackground,
|
||||||
_buildAccessHistoryList(context),
|
automaticallyImplyLeading: false,
|
||||||
|
leading: _appBarBackButtonAtomWidget(context, theme),
|
||||||
|
title: _appBarTitleMoleculeWidget(context, theme),
|
||||||
|
centerTitle: true,
|
||||||
|
elevation: 0.0,
|
||||||
|
actions: [
|
||||||
|
_appBarFilterButtonAtomWidget(context),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
Widget _appBarBackButtonAtomWidget(
|
||||||
return AppBar(
|
BuildContext context, FlutterFlowTheme theme) {
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
return FlutterFlowIconButton(
|
||||||
automaticallyImplyLeading: false,
|
|
||||||
leading: FlutterFlowIconButton(
|
|
||||||
borderColor: Colors.transparent,
|
borderColor: Colors.transparent,
|
||||||
borderRadius: 30.0,
|
borderRadius: 30.0,
|
||||||
borderWidth: 1.0,
|
borderWidth: 1.0,
|
||||||
buttonSize: 60.0,
|
buttonSize: 60.0,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.keyboard_arrow_left,
|
Icons.keyboard_arrow_left,
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
color: theme.primaryText,
|
||||||
size: 30.0,
|
size: 30.0,
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
FFLocalizations.of(context).getText(
|
|
||||||
'ch8qymga' /* Histórico de Acesso */,
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
fontSize: 18.0,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).headlineMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: const [],
|
|
||||||
centerTitle: true,
|
|
||||||
elevation: 0.0,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFilterButton(BuildContext context) {
|
Widget _appBarTitleMoleculeWidget(
|
||||||
return FlutterFlowIconButton(
|
BuildContext context, FlutterFlowTheme theme) {
|
||||||
borderColor: Colors.transparent,
|
return Text(
|
||||||
borderRadius: 20.0,
|
FFLocalizations.of(context).getText('ch8qymga'),
|
||||||
borderWidth: 1.0,
|
style: theme.headlineMedium.override(
|
||||||
buttonSize: 40.0,
|
fontFamily: theme.headlineMediumFamily,
|
||||||
icon: Icon(
|
color: theme.primaryText,
|
||||||
Icons.filter_list,
|
fontSize: 16.0,
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
letterSpacing: 0.0,
|
||||||
size: 24.0,
|
useGoogleFonts:
|
||||||
|
GoogleFonts.asMap().containsKey(theme.headlineMediumFamily),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _appBarFilterButtonAtomWidget(BuildContext context) {
|
||||||
|
debugPrint('selectedTypeSubject: ${selectedTypeSubject.value}');
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.filter_list),
|
||||||
|
padding: EdgeInsets.fromLTRB(0, 0, 10, 0),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await showModalBottomSheet<String>(
|
final Map<String, String>? selectedFilter =
|
||||||
|
await showModalBottomSheet<Map<String, String>>(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => OptModalWidget(
|
||||||
return GestureDetector(
|
defaultAccessType:
|
||||||
onTap: () => _model.unfocusNode.canRequestFocus
|
selectedTypeSubject.value['accessType'] ?? '.*',
|
||||||
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
defaultPersonType:
|
||||||
: FocusScope.of(context).unfocus(),
|
selectedTypeSubject.value['personType'] ?? '.*',
|
||||||
child: Padding(
|
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
|
||||||
child: const OptModalWidget(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (selectedFilter != null) {
|
||||||
|
debugPrint('Selected Filter: $selectedFilter');
|
||||||
|
_updateAccessHistoryAction(selectedFilter);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
).then((value) => safeSetState(() {
|
),
|
||||||
updateAccessHistory(value!);
|
],
|
||||||
}));
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget card(String selectedType) {
|
void _updateAccessHistoryAction(Map<String, String> newType) {
|
||||||
debugPrint('Selected type in Card: $selectedType');
|
if (!_isSubjectClosed) {
|
||||||
return FutureBuilder<ApiCallResponse>(
|
final currentType = selectedTypeSubject.value;
|
||||||
future: _model.accessHistory(
|
final updatedType = Map<String, String>.from(currentType);
|
||||||
|
bool needsUpdate = false;
|
||||||
|
newType.forEach((key, newValue) {
|
||||||
|
if (currentType[key] != newValue) {
|
||||||
|
updatedType[key] = newValue;
|
||||||
|
needsUpdate = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (needsUpdate) {
|
||||||
|
selectedTypeSubject.add(updatedType);
|
||||||
|
print("updateAccessHistory called with newType: $newType");
|
||||||
|
safeSetState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Stream<ApiCallResponse> fetchAccessHistoryService(String selectedType) {
|
||||||
|
debugPrint('Calling API with type: $selectedType');
|
||||||
|
switch (selectedType) {
|
||||||
|
case 'E':
|
||||||
|
return _model.accessHistory(
|
||||||
requestFn: () => PhpGroup.getAccessCall.call(
|
requestFn: () => PhpGroup.getAccessCall.call(
|
||||||
devUUID: FFAppState().devUUID,
|
devUUID: FFAppState().devUUID,
|
||||||
userUUID: FFAppState().userUUID,
|
userUUID: FFAppState().userUUID,
|
||||||
|
@ -194,11 +186,90 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
atividade: 'getAcessos',
|
atividade: 'getAcessos',
|
||||||
pageSize: '100',
|
pageSize: '100',
|
||||||
pageNumber: '1',
|
pageNumber: '1',
|
||||||
pesTipo: selectedType,
|
pesTipo: 'E',
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
case 'O':
|
||||||
|
return _model.accessHistory(
|
||||||
|
requestFn: () => PhpGroup.getAccessCall.call(
|
||||||
|
devUUID: FFAppState().devUUID,
|
||||||
|
userUUID: FFAppState().userUUID,
|
||||||
|
cliID: FFAppState().cliUUID,
|
||||||
|
atividade: 'getAcessos',
|
||||||
|
pageSize: '100',
|
||||||
|
pageNumber: '1',
|
||||||
|
pesTipo: 'O',
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return _model.accessHistory(
|
||||||
|
requestFn: () => PhpGroup.getAccessCall.call(
|
||||||
|
devUUID: FFAppState().devUUID,
|
||||||
|
userUUID: FFAppState().userUUID,
|
||||||
|
cliID: FFAppState().cliUUID,
|
||||||
|
atividade: 'getAcessos',
|
||||||
|
pageSize: '100',
|
||||||
|
pageNumber: '1',
|
||||||
|
pesTipo: 'T',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _accessHistoryListOrganismWidget(BuildContext context) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
StreamBuilder<Map<String, String>>(
|
||||||
|
stream: selectedTypeSubject.stream,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
|
return Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
final selected = snapshot.data!;
|
||||||
|
return _cardListViewOrganismWidget(selected);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<dynamic>> fetchCardListViewService(
|
||||||
|
Map<String, String> select) async {
|
||||||
|
debugPrint('Fetching access history');
|
||||||
|
final response =
|
||||||
|
await fetchAccessHistoryService(select['personType']!).first;
|
||||||
|
debugPrint('Response: ${response.jsonBody}');
|
||||||
|
final List<dynamic> accessHistory = response.jsonBody['acessos'] ?? [];
|
||||||
|
debugPrint('Access History Before Filtering: $accessHistory');
|
||||||
|
debugPrint(
|
||||||
|
'Filtering for: Person Type - ${select['personType']}, Access Type - ${select['accessType']}, Search - ${select['search']}');
|
||||||
|
|
||||||
|
return accessHistory.where((item) {
|
||||||
|
final personTypeMatches = select['personType'] == '.*' ||
|
||||||
|
item["PES_TIPO"].toString() == select['personType'];
|
||||||
|
final accessTypeMatches = select['accessType'] == '.*' ||
|
||||||
|
item["ACE_TIPO"].toString() == select['accessType'];
|
||||||
|
final searchMatches = select['search'] == '.*' ||
|
||||||
|
item["PES_NOME"]
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(select['search']!.toLowerCase());
|
||||||
|
debugPrint('NOMES: ${item["PES_NOME"].toString().toLowerCase()}');
|
||||||
|
return personTypeMatches && accessTypeMatches && searchMatches;
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _cardListViewOrganismWidget(Map<String, String> selected) {
|
||||||
|
debugPrint(
|
||||||
|
'Selected types in Card: ${selected['personType']}, ${selected['accessType']}');
|
||||||
|
debugPrint('_buildAccessHistoryList called');
|
||||||
|
return FutureBuilder<List<dynamic>>(
|
||||||
|
future: fetchCardListViewService(selected),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
debugPrint('Waiting for data');
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 50.0,
|
width: 50.0,
|
||||||
|
@ -209,31 +280,41 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
} else if (snapshot.hasError) {
|
||||||
final wrapGetAccessResponse = snapshot.data!;
|
return Text('Error: ${snapshot.error}');
|
||||||
return Builder(
|
} else {
|
||||||
builder: (context) {
|
final accessHistory = snapshot.data!;
|
||||||
final accessHistory = PhpGroup.getAccessCall
|
debugPrint('Access History: $accessHistory');
|
||||||
.access(wrapGetAccessResponse.jsonBody)
|
return ListView.builder(
|
||||||
?.toList() ??
|
shrinkWrap: true,
|
||||||
[];
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
return Wrap(
|
itemCount: accessHistory.length,
|
||||||
spacing: 2.0,
|
itemBuilder: (context, index) {
|
||||||
runSpacing: 1.0,
|
final accessHistoryItem = accessHistory[index];
|
||||||
alignment: WrapAlignment.start,
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.start,
|
|
||||||
direction: Axis.horizontal,
|
|
||||||
runAlignment: WrapAlignment.start,
|
|
||||||
verticalDirection: VerticalDirection.down,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children:
|
|
||||||
List.generate(accessHistory.length, (accessHistoryIndex) {
|
|
||||||
final accessHistoryItem = accessHistory[accessHistoryIndex];
|
|
||||||
debugPrint(
|
debugPrint(
|
||||||
'Access History Item: ${accessHistoryItem['PES_TIPO']}');
|
'Access History Item: ${accessHistoryItem['PES_TIPO']}');
|
||||||
return Align(
|
return _accessHistoryCardMoleculeWidget(
|
||||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
context, accessHistoryItem);
|
||||||
child: Card(
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _accessHistoryCardMoleculeWidget(
|
||||||
|
BuildContext context, dynamic accessHistoryItem) {
|
||||||
|
var tipoPessoa =
|
||||||
|
getJsonField(accessHistoryItem, r'''$.PES_TIPO''').toString();
|
||||||
|
var documentoPessoa =
|
||||||
|
getJsonField(accessHistoryItem, r'''$.PES_ID''').toString();
|
||||||
|
var corFundoTipo = tipoPessoa == 'E'
|
||||||
|
? FlutterFlowTheme.of(context).primary
|
||||||
|
: FlutterFlowTheme.of(context).warning;
|
||||||
|
debugPrint('Tipo de Pessoa: $tipoPessoa');
|
||||||
|
debugPrint('Documento da Pessoa: $documentoPessoa');
|
||||||
|
var urlImagem = imageUrlAtomWidget(documentoPessoa, tipoPessoa);
|
||||||
|
return Card(
|
||||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||||
color: FlutterFlowTheme.of(context).secondaryBackground,
|
color: FlutterFlowTheme.of(context).secondaryBackground,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
|
@ -249,7 +330,19 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
_cardHeaderAtomWidget(context, urlImagem, tipoPessoa, corFundoTipo,
|
||||||
|
accessHistoryItem),
|
||||||
|
_cardDetailsMoleculeWidget(context, accessHistoryItem),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _cardHeaderAtomWidget(BuildContext context, String urlImagem,
|
||||||
|
String tipoPessoa, Color corFundoTipo, accessHistoryItem) {
|
||||||
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -257,13 +350,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(100.0),
|
borderRadius: BorderRadius.circular(100.0),
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
valueOrDefault<String>(
|
urlImagem,
|
||||||
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
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",
|
|
||||||
),
|
|
||||||
width: 60.0,
|
width: 60.0,
|
||||||
height: 60.0,
|
height: 60.0,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
|
@ -279,57 +366,57 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
accessHistoryItem,
|
accessHistoryItem,
|
||||||
r'''$.PES_NOME''',
|
r'''$.PES_NOME''',
|
||||||
).toString(),
|
).toString(),
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
.bodyMedium
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
.containsKey(
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: 100.0,
|
width: 100.0,
|
||||||
height: 25.0,
|
height: 25.0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: functions.jsonToStr(getJsonField(
|
color: (() {
|
||||||
|
// Extrai o valor de PES_TIPO, converte para String, remove espaços em branco e aspas
|
||||||
|
final pesTipo = functions
|
||||||
|
.jsonToStr(getJsonField(
|
||||||
accessHistoryItem,
|
accessHistoryItem,
|
||||||
r'''$.PES_TIPO''',
|
r'''$.PES_TIPO''',
|
||||||
)) ==
|
))
|
||||||
'E'
|
.trim()
|
||||||
? FlutterFlowTheme.of(context).primary
|
.replaceAll('"', ''); // Remove aspas
|
||||||
: FlutterFlowTheme.of(context)
|
|
||||||
.warning,
|
// Debug: Imprime o valor de PES_TIPO ajustado
|
||||||
|
debugPrint('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),
|
borderRadius: BorderRadius.circular(24.0),
|
||||||
),
|
),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment:
|
alignment: const AlignmentDirectional(0.0, 0.0),
|
||||||
const AlignmentDirectional(0.0, 0.0),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
getJsonField(
|
getJsonField(
|
||||||
accessHistoryItem,
|
accessHistoryItem,
|
||||||
r'''$.PES_TIPO''',
|
r'''$.PES_TIPO''',
|
||||||
).toString(),
|
).toString() ==
|
||||||
style: FlutterFlowTheme.of(context)
|
'E'
|
||||||
.bodyMedium
|
? FFLocalizations.of(context).getText(
|
||||||
.override(
|
'zok7lu4w',
|
||||||
fontFamily:
|
)
|
||||||
FlutterFlowTheme.of(context)
|
: FFLocalizations.of(context).getText(
|
||||||
.bodyMediumFamily,
|
'oonqk812',
|
||||||
color:
|
),
|
||||||
FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
.info,
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
color: FlutterFlowTheme.of(context).info,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
.asMap()
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -340,8 +427,12 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
.divide(const SizedBox(width: 20.0))
|
.divide(const SizedBox(width: 20.0))
|
||||||
.addToStart(const SizedBox(width: 5.0))
|
.addToStart(const SizedBox(width: 5.0))
|
||||||
.addToEnd(const SizedBox(width: 5.0)),
|
.addToEnd(const SizedBox(width: 5.0)),
|
||||||
),
|
);
|
||||||
Row(
|
}
|
||||||
|
|
||||||
|
Widget _cardDetailsMoleculeWidget(
|
||||||
|
BuildContext context, dynamic accessHistoryItem) {
|
||||||
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -351,28 +442,20 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment:
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
MainAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'2odgr6hg' /* Entrou: */,
|
'2odgr6hg',
|
||||||
),
|
),
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
fontFamily:
|
||||||
FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
fontSize: 12.5,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
useGoogleFonts: GoogleFonts
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
.asMap()
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
|
@ -380,48 +463,33 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
accessHistoryItem,
|
accessHistoryItem,
|
||||||
r'''$.ACE_DATAHORA''',
|
r'''$.ACE_DATAHORA''',
|
||||||
).toString(),
|
).toString(),
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
fontFamily:
|
||||||
FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
fontSize: 12.5,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
.asMap()
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
].addToStart(const SizedBox(width: 10.0)),
|
].addToStart(const SizedBox(width: 10.0)),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment:
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
MainAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'zrde3fke' /* Setor */,
|
'zrde3fke',
|
||||||
),
|
),
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
fontFamily:
|
||||||
FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
fontSize: 12.5,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
useGoogleFonts: GoogleFonts
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
.asMap()
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
|
@ -429,20 +497,13 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
accessHistoryItem,
|
accessHistoryItem,
|
||||||
r'''$.ACI_DESCRICAO''',
|
r'''$.ACI_DESCRICAO''',
|
||||||
).toString(),
|
).toString(),
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
fontFamily:
|
||||||
FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
.bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
fontSize: 12.5,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
.asMap()
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(
|
|
||||||
context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
].addToStart(const SizedBox(width: 10.0)),
|
].addToStart(const SizedBox(width: 10.0)),
|
||||||
|
@ -453,32 +514,12 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
]
|
]
|
||||||
.addToStart(const SizedBox(width: 5.0))
|
.addToStart(const SizedBox(width: 5.0))
|
||||||
.addToEnd(const SizedBox(width: 5.0)),
|
.addToEnd(const SizedBox(width: 5.0)),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAccessHistoryList(BuildContext context) {
|
String imageUrlAtomWidget(String document, String type) {
|
||||||
return StreamBuilder<String>(
|
return valueOrDefault<String>(
|
||||||
stream: selectedTypeSubject.stream,
|
"https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=$document&tipo=$type",
|
||||||
builder: (context, snapshot) {
|
"https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg",
|
||||||
if (!snapshot.hasData) {
|
|
||||||
// Você pode mostrar um widget de carregamento ou qualquer outro widget aqui
|
|
||||||
return Center(child: CircularProgressIndicator());
|
|
||||||
}
|
|
||||||
final selectedType = snapshot.data!;
|
|
||||||
// Aqui você chama o método que constrói o card, passando o selectedType
|
|
||||||
return card(selectedType);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,458 +0,0 @@
|
||||||
@override
|
|
||||||
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: 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(
|
|
||||||
'ch8qymga' /* Histórico de Acesso */,
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
fontSize: 18.0,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).headlineMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: const [],
|
|
||||||
centerTitle: true,
|
|
||||||
elevation: 0.0,
|
|
||||||
),
|
|
||||||
body: SafeArea(
|
|
||||||
top: true,
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 38.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
FlutterFlowIconButton(
|
|
||||||
borderColor: Colors.transparent,
|
|
||||||
borderRadius: 20.0,
|
|
||||||
borderWidth: 1.0,
|
|
||||||
buttonSize: 40.0,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.filter_list,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
size: 24.0,
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
await showModalBottomSheet<String>(
|
|
||||||
isScrollControlled: true,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
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 OptModalWidget(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
).then((value) => safeSetState(() {
|
|
||||||
updateSelectedType(value);
|
|
||||||
debugPrint('Selected type: $value');
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
.addToStart(const SizedBox(width: 10.0))
|
|
||||||
.addToEnd(const SizedBox(width: 10.0)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: double.infinity,
|
|
||||||
decoration: const BoxDecoration(),
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
FutureBuilder<ApiCallResponse>(
|
|
||||||
future: _model.accessHistory(
|
|
||||||
requestFn: () => PhpGroup.getAccessCall.call(
|
|
||||||
devUUID: FFAppState().devUUID,
|
|
||||||
userUUID: FFAppState().userUUID,
|
|
||||||
cliID: FFAppState().cliUUID,
|
|
||||||
atividade: 'getAcessos',
|
|
||||||
pageSize: '100',
|
|
||||||
pageNumber: '1',
|
|
||||||
pesTipo: selectedType,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
// Customize what your widget looks like when it's loading.
|
|
||||||
if (!snapshot.hasData) {
|
|
||||||
return Center(
|
|
||||||
child: SizedBox(
|
|
||||||
width: 50.0,
|
|
||||||
height: 50.0,
|
|
||||||
child: SpinKitCircle(
|
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
|
||||||
size: 50.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final wrapGetAccessResponse = snapshot.data!;
|
|
||||||
return Builder(
|
|
||||||
builder: (context) {
|
|
||||||
final accessHistory = PhpGroup.getAccessCall
|
|
||||||
.access(
|
|
||||||
wrapGetAccessResponse.jsonBody,
|
|
||||||
)
|
|
||||||
?.toList() ??
|
|
||||||
[];
|
|
||||||
return Wrap(
|
|
||||||
spacing: 2.0,
|
|
||||||
runSpacing: 1.0,
|
|
||||||
alignment: WrapAlignment.start,
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.start,
|
|
||||||
direction: Axis.horizontal,
|
|
||||||
runAlignment: WrapAlignment.start,
|
|
||||||
verticalDirection: VerticalDirection.down,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: List.generate(accessHistory.length,
|
|
||||||
(accessHistoryIndex) {
|
|
||||||
final accessHistoryItem =
|
|
||||||
accessHistory[accessHistoryIndex];
|
|
||||||
return Align(
|
|
||||||
alignment:
|
|
||||||
const AlignmentDirectional(0.0, 0.0),
|
|
||||||
child: Card(
|
|
||||||
clipBehavior:
|
|
||||||
Clip.antiAliasWithSaveLayer,
|
|
||||||
color: FlutterFlowTheme.of(context)
|
|
||||||
.secondaryBackground,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(8.0),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
width: 350.0,
|
|
||||||
height: 128.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: FlutterFlowTheme.of(context)
|
|
||||||
.primaryBackground,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.all(
|
|
||||||
10.0),
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(
|
|
||||||
100.0),
|
|
||||||
child: Image.network(
|
|
||||||
valueOrDefault<String>(
|
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
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',
|
|
||||||
),
|
|
||||||
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: functions.jsonToStr(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.PES_TIPO''',
|
|
||||||
)) ==
|
|
||||||
'E'
|
|
||||||
? FlutterFlowTheme
|
|
||||||
.of(
|
|
||||||
context)
|
|
||||||
.primary
|
|
||||||
: FlutterFlowTheme
|
|
||||||
.of(context)
|
|
||||||
.warning,
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius
|
|
||||||
.circular(
|
|
||||||
24.0),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment:
|
|
||||||
const AlignmentDirectional(
|
|
||||||
0.0, 0.0),
|
|
||||||
child: Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.PES_TIPO''',
|
|
||||||
).toString(),
|
|
||||||
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)),
|
|
||||||
),
|
|
||||||
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' /* Entrou: */,
|
|
||||||
),
|
|
||||||
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' /* Setor */,
|
|
||||||
),
|
|
||||||
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)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].addToStart(const SizedBox(height: 5.0)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
Loading…
Reference in New Issue