fix modal in register visit
This commit is contained in:
parent
bc1c684d72
commit
0f84ee8923
|
@ -587,10 +587,8 @@ class NotificationHandler {
|
||||||
ptText: 'Mensagem',
|
ptText: 'Mensagem',
|
||||||
): message['mensagem'],
|
): message['mensagem'],
|
||||||
}),
|
}),
|
||||||
imageHashMap: Map<String, String>.from({
|
imagePath:
|
||||||
'key': message['documento'],
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${message['documento'] ?? ''}&tipo=E',
|
||||||
'value': 'E',
|
|
||||||
}),
|
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
|
|
@ -17,13 +17,13 @@ class CardItemTemplateComponentWidget extends StatefulWidget {
|
||||||
super.key,
|
super.key,
|
||||||
required this.labelsHashMap,
|
required this.labelsHashMap,
|
||||||
required this.statusHashMap,
|
required this.statusHashMap,
|
||||||
required this.imageHashMap,
|
required this.imagePath,
|
||||||
required this.onTapCardItemAction,
|
required this.onTapCardItemAction,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Map<String, String>? labelsHashMap;
|
final Map<String, String>? labelsHashMap;
|
||||||
final List<Map<String, Color>?> statusHashMap;
|
final List<Map<String, Color>?> statusHashMap;
|
||||||
final Map<String, String> imageHashMap;
|
final String? imagePath;
|
||||||
final Future Function()? onTapCardItemAction;
|
final Future Function()? onTapCardItemAction;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -241,8 +241,7 @@ class _CardItemTemplateComponentWidgetState
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
fadeInDuration: const Duration(milliseconds: 500),
|
fadeInDuration: const Duration(milliseconds: 500),
|
||||||
fadeOutDuration: const Duration(milliseconds: 500),
|
fadeOutDuration: const Duration(milliseconds: 500),
|
||||||
imageUrl:
|
imageUrl: widget.imagePath ?? '',
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.imageHashMap['key']}&tipo=${widget.imageHashMap['value']}',
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -123,10 +123,8 @@ URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${vi
|
||||||
'Inicio': visitaWrapItem['VAW_DTINICIO'] ?? '',
|
'Inicio': visitaWrapItem['VAW_DTINICIO'] ?? '',
|
||||||
'Fim': visitaWrapItem['VAW_DTFIM'] ?? '',
|
'Fim': visitaWrapItem['VAW_DTFIM'] ?? '',
|
||||||
}),
|
}),
|
||||||
imageHashMap: Map<String, String>.from({
|
imagePath:
|
||||||
'key': visitaWrapItem['VTE_DOCUMENTO'] ?? '',
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${visitaWrapItem['VTE_DOCUMENTO'] ?? ''}&tipo=E',
|
||||||
'value': 'E',
|
|
||||||
}),
|
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
|
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
|
@ -168,7 +166,7 @@ URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${vi
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Inativo',
|
ptText: 'Inativo',
|
||||||
enText: 'Inactive',
|
enText: 'Inactive',
|
||||||
): FlutterFlowTheme.of(context).error,
|
): FlutterFlowTheme.of(context).warning,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,14 +16,14 @@ class VisitRequestTemplateComponentWidget extends StatefulWidget {
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.labelsHashMap,
|
required this.labelsHashMap,
|
||||||
required this.statusHashMap,
|
required this.statusHashMap,
|
||||||
required this.imageHashMap,
|
required this.imagePath,
|
||||||
this.onTapCardItemAction,
|
this.onTapCardItemAction,
|
||||||
required this.buttons,
|
required this.buttons,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Map<String, String> labelsHashMap;
|
final Map<String, String> labelsHashMap;
|
||||||
final List<Map<String, Color>?> statusHashMap;
|
final List<Map<String, Color>?> statusHashMap;
|
||||||
final Map<String, String> imageHashMap;
|
final String? imagePath;
|
||||||
final Future Function()? onTapCardItemAction;
|
final Future Function()? onTapCardItemAction;
|
||||||
final List<Widget> buttons;
|
final List<Widget> buttons;
|
||||||
|
|
||||||
|
@ -111,8 +111,7 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
fadeInDuration: const Duration(milliseconds: 100),
|
fadeInDuration: const Duration(milliseconds: 100),
|
||||||
fadeOutDuration: const Duration(milliseconds: 100),
|
fadeOutDuration: const Duration(milliseconds: 100),
|
||||||
imageUrl:
|
imageUrl: widget.imagePath ?? '',
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.imageHashMap['key']}&tipo=${widget.imageHashMap['value']}',
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -292,10 +292,8 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
Widget _accessHistoryCardMoleculeWidget(
|
Widget _accessHistoryCardMoleculeWidget(
|
||||||
BuildContext context, dynamic accessHistoryItem) {
|
BuildContext context, dynamic accessHistoryItem) {
|
||||||
return CardItemTemplateComponentWidget(
|
return CardItemTemplateComponentWidget(
|
||||||
imageHashMap: Map<String, String>.from({
|
imagePath:
|
||||||
'key': accessHistoryItem['PES_ID'] ?? '',
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${accessHistoryItem['PES_ID'] ?? ''}&tipo=${accessHistoryItem['PES_TIPO'] ?? ''}',
|
||||||
'value': accessHistoryItem['PES_TIPO'] ?? '',
|
|
||||||
}),
|
|
||||||
labelsHashMap: Map<String, String>.from({
|
labelsHashMap: Map<String, String>.from({
|
||||||
'Nome:': accessHistoryItem['PES_NOME'] ?? '',
|
'Nome:': accessHistoryItem['PES_NOME'] ?? '',
|
||||||
'Acesso:': accessHistoryItem['ACE_DATAHORA'] ?? '',
|
'Acesso:': accessHistoryItem['ACE_DATAHORA'] ?? '',
|
||||||
|
@ -346,10 +344,3 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
onTapCardItemAction: () async {});
|
onTapCardItemAction: () async {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String imageUrlAtomWidget(String document, String type) {
|
|
||||||
return valueOrDefault<String>(
|
|
||||||
"https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=$document&tipo=$type",
|
|
||||||
"https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
@ -298,10 +298,8 @@ Widget liberationDynamicListView(
|
||||||
Widget liberationHistoryItemCard(
|
Widget liberationHistoryItemCard(
|
||||||
BuildContext context, dynamic liberationHistoryItem) {
|
BuildContext context, dynamic liberationHistoryItem) {
|
||||||
return CardItemTemplateComponentWidget(
|
return CardItemTemplateComponentWidget(
|
||||||
imageHashMap: Map<String, String>.from({
|
imagePath:
|
||||||
'key': liberationHistoryItem['VTE_ID'],
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${liberationHistoryItem['VTE_ID'] ?? ''}&tipo=E',
|
||||||
'value': 'E',
|
|
||||||
}),
|
|
||||||
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'],
|
||||||
|
@ -567,10 +565,9 @@ Widget liberationHistoryItemCard(
|
||||||
): FlutterFlowTheme.of(context).warning,
|
): FlutterFlowTheme.of(context).warning,
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
imageHashMap: Map<String, String>.from({
|
imagePath:
|
||||||
'key': liberationHistoryItem['VTE_ID'],
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${liberationHistoryItem['VTE_ID'] ?? ''}&tipo=E',
|
||||||
'value': 'E',
|
|
||||||
}),
|
|
||||||
// changeStatusAction: answersRequest,
|
// changeStatusAction: answersRequest,
|
||||||
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
||||||
),
|
),
|
||||||
|
|
|
@ -30,6 +30,31 @@ class ScheduleCompleteVisitPageModel
|
||||||
|
|
||||||
/// Local state fields for this page.
|
/// Local state fields for this page.
|
||||||
|
|
||||||
|
String convertDateFormat(String dateStr) {
|
||||||
|
try {
|
||||||
|
// Formato original
|
||||||
|
DateFormat originalFormat = DateFormat('d/M/y H:mm:ss');
|
||||||
|
// Novo formato
|
||||||
|
DateFormat newFormat = DateFormat('y-M-d H:mm:ss');
|
||||||
|
|
||||||
|
// Validate the input string format
|
||||||
|
if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$')
|
||||||
|
.hasMatch(dateStr)) {
|
||||||
|
return 'Invalid date format';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Converte a string para DateTime
|
||||||
|
DateTime dateTime = originalFormat.parse(dateStr);
|
||||||
|
|
||||||
|
// Converte DateTime para a nova string formatada
|
||||||
|
String formattedDate = newFormat.format(dateTime);
|
||||||
|
return formattedDate;
|
||||||
|
} catch (e) {
|
||||||
|
// Handle the exception by returning an error message or a default value
|
||||||
|
return 'Invalid date format';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<dynamic> visitorJsonList = [];
|
List<dynamic> visitorJsonList = [];
|
||||||
void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item);
|
void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item);
|
||||||
void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item);
|
void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item);
|
||||||
|
|
|
@ -24,6 +24,7 @@ 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:hub/pages/visit_history_page/visit_history_page_widget.dart';
|
||||||
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
||||||
|
@ -1568,6 +1569,8 @@ Widget scheduleVisit(
|
||||||
),
|
),
|
||||||
onPressed: _model.isValid()
|
onPressed: _model.isValid()
|
||||||
? () async {
|
? () async {
|
||||||
|
log(_model.dropDownValue1.toString());
|
||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
@ -1595,10 +1598,110 @@ Widget scheduleVisit(
|
||||||
// repeatVisitSchedule: () async {},
|
// repeatVisitSchedule: () async {},
|
||||||
// ),
|
// ),
|
||||||
child: VisitRequestTemplateComponentWidget(
|
child: VisitRequestTemplateComponentWidget(
|
||||||
buttons: [],
|
buttons: [
|
||||||
imageHashMap: {},
|
FlutterFlowIconButton(
|
||||||
labelsHashMap: {},
|
icon: const Icon(Icons.done),
|
||||||
statusHashMap: [],
|
onPressed: () async {
|
||||||
|
showAlertDialog(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context)
|
||||||
|
.getVariableText(
|
||||||
|
ptText: 'Ativar Visita',
|
||||||
|
enText: 'Activate Visit',
|
||||||
|
),
|
||||||
|
FFLocalizations.of(context)
|
||||||
|
.getVariableText(
|
||||||
|
ptText:
|
||||||
|
'Você tem certeza que deseja ativar essa visita?',
|
||||||
|
enText:
|
||||||
|
'Are you sure you want to activate this visit?',
|
||||||
|
), () async {
|
||||||
|
await PhpGroup.postScheduleVisitCall
|
||||||
|
.call(
|
||||||
|
devUUID: FFAppState().devUUID,
|
||||||
|
userUUID: FFAppState().userUUID,
|
||||||
|
atividade: 'putVisita',
|
||||||
|
devDesc: _model.textController3.text,
|
||||||
|
idVisitante: _model.visitorStrList,
|
||||||
|
dtInicio: _model.convertDateFormat(
|
||||||
|
_model.textController1.text ?? ''),
|
||||||
|
dtFim: _model.convertDateFormat(
|
||||||
|
_model.textController2.text ?? ''),
|
||||||
|
unica: _model.switchValue == true
|
||||||
|
? 'Sim'
|
||||||
|
: 'Não',
|
||||||
|
idMotivo: extractIdToStr(
|
||||||
|
_model.dropDownValue1!),
|
||||||
|
idNAC: extractIdToStr(
|
||||||
|
_model.dropDownValue2!),
|
||||||
|
obs: _model.textController3.text,
|
||||||
|
cliID: FFAppState().cliUUID,
|
||||||
|
)
|
||||||
|
.catchError((e) async {
|
||||||
|
await DialogUtil.errorDefault(context);
|
||||||
|
}).then((value) async {
|
||||||
|
if (PhpGroup.postScheduleVisitCall
|
||||||
|
.error(
|
||||||
|
(value.jsonBody ?? ''),
|
||||||
|
) ==
|
||||||
|
false) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context)
|
||||||
|
.getVariableText(
|
||||||
|
enText:
|
||||||
|
'Success in scheduling visit',
|
||||||
|
ptText:
|
||||||
|
'Succeso ao agendar a visita',
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await DialogUtil.errorDefault(
|
||||||
|
context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
imagePath:
|
||||||
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${_model.visitorJsonList[0]['VTE_DOCUMENTO'] ?? ''}&tipo=E',
|
||||||
|
labelsHashMap: {
|
||||||
|
'Nome': _model.visitorJsonList[0]['VTE_NOME'],
|
||||||
|
'Start': _model.textController1.text,
|
||||||
|
'End': _model.textController2.text ?? '',
|
||||||
|
'Reason': (RegExp(r'MOT_DESCRICAO:\s*([^,]+)')
|
||||||
|
.firstMatch(
|
||||||
|
_model.dropDownValue1.toString())
|
||||||
|
?.group(1)
|
||||||
|
.toString()) ??
|
||||||
|
'',
|
||||||
|
'Level': (RegExp(r'NAC_DESCRICAO:\s*([^,]+)')
|
||||||
|
.firstMatch(
|
||||||
|
_model.dropDownValue2.toString())
|
||||||
|
?.group(1)
|
||||||
|
.toString()) ??
|
||||||
|
'',
|
||||||
|
'Single Visit':
|
||||||
|
_model.switchValue == true ? 'Sim' : 'Não',
|
||||||
|
if (_model.textController3.text.isNotEmpty)
|
||||||
|
'Observation': _model.textController3.text,
|
||||||
|
},
|
||||||
|
statusHashMap: [
|
||||||
|
Map<String, Color>.from({
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Inativo',
|
||||||
|
enText: 'Inactive',
|
||||||
|
): FlutterFlowTheme.of(context).warning,
|
||||||
|
}),
|
||||||
|
],
|
||||||
onTapCardItemAction: () async {},
|
onTapCardItemAction: () async {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -93,10 +93,8 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final visitaWrapItem = visitaWrap[index];
|
final visitaWrapItem = visitaWrap[index];
|
||||||
return CardItemTemplateComponentWidget(
|
return CardItemTemplateComponentWidget(
|
||||||
imageHashMap: {
|
imagePath:
|
||||||
'key': visitaWrapItem['VTE_DOCUMENTO'] ?? '',
|
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${visitaWrapItem['VTE_DOCUMENTO'] ?? ''}&tipo=E',
|
||||||
'value': 'E',
|
|
||||||
},
|
|
||||||
labelsHashMap: {
|
labelsHashMap: {
|
||||||
'Nome:': visitaWrapItem['VTE_NOME'] ?? '',
|
'Nome:': visitaWrapItem['VTE_NOME'] ?? '',
|
||||||
'Inicio:': visitaWrapItem['VAW_DTINICIO'] ?? '',
|
'Inicio:': visitaWrapItem['VAW_DTINICIO'] ?? '',
|
||||||
|
|
Loading…
Reference in New Issue