Merge branch 'develop' into fix/not_message
This commit is contained in:
commit
d851fd9661
|
@ -498,85 +498,25 @@ class NotificationHandler {
|
||||||
FlutterFlowIconButton(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
showDialog(
|
showAlertDialog(
|
||||||
context: context,
|
context,
|
||||||
builder: (context) {
|
FFLocalizations.of(context).getVariableText(
|
||||||
return AlertDialog(
|
ptText: 'Bloquear Visita',
|
||||||
title: Text(
|
enText: 'Block Visit',
|
||||||
FFLocalizations.of(context).getVariableText(
|
),
|
||||||
ptText: 'Bloquear Visita',
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Block Visit',
|
ptText:
|
||||||
),
|
'Você tem certeza que deseja bloquear essa visita?',
|
||||||
),
|
enText: 'Are you sure you want to block this visit?',
|
||||||
content: Text(
|
), () async {
|
||||||
FFLocalizations.of(context).getVariableText(
|
await answersRequest.call(
|
||||||
ptText:
|
context,
|
||||||
'Você tem certeza que deseja bloquear essa visita?',
|
message['referencia'].toString(),
|
||||||
enText:
|
'B',
|
||||||
'Are you sure you want to block this visit?',
|
'Mensagem',
|
||||||
),
|
message['idVisitante'].toString(),
|
||||||
),
|
);
|
||||||
backgroundColor:
|
});
|
||||||
FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
actions: [
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'No',
|
|
||||||
ptText: 'Não',
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 100,
|
|
||||||
height: 40,
|
|
||||||
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)),
|
|
||||||
),
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Yes',
|
|
||||||
ptText: 'Sim',
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
await answersRequest.call(
|
|
||||||
context,
|
|
||||||
message['referencia'].toString(),
|
|
||||||
'B',
|
|
||||||
'Mensagem',
|
|
||||||
message['idVisitante'].toString(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 100,
|
|
||||||
height: 40,
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import 'dart:math';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
import 'package:hub/actions/actions.dart';
|
||||||
|
@ -10,6 +10,7 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.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_widget.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';
|
||||||
|
|
||||||
|
@ -22,7 +23,11 @@ Widget buildDetails(
|
||||||
buttons: [
|
buttons: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
status.active) // REJECT ACTION
|
status.active) // REJECT ACTION
|
||||||
FlutterFlowIconButton(
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cancelar',
|
||||||
|
enText: 'Cancel',
|
||||||
|
),
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
showAlertDialog(
|
showAlertDialog(
|
||||||
|
@ -77,6 +82,20 @@ Widget buildDetails(
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) !=
|
if (getStatus(visitaWrapItem['VAW_STATUS']) !=
|
||||||
status.active) // RECALL ACTION
|
status.active) // RECALL ACTION
|
||||||
|
@ -89,19 +108,17 @@ Widget buildDetails(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
context.pushNamed(
|
|
||||||
'scheduleCompleteVisitPage',
|
Navigator.push(
|
||||||
queryParameters: {
|
context,
|
||||||
'visitorStrList': serializeParam(
|
MaterialPageRoute(
|
||||||
visitaWrapItem['VTE_DOCUMENTO'],
|
builder: (context) => ScheduleCompleteVisitPageWidget(
|
||||||
ParamType.String,
|
dropdownValue1: visitaWrapItem['MOT_DESCRICAO'],
|
||||||
),
|
dropdownValue2: visitaWrapItem['NAC_DESCRICAO'],
|
||||||
'visitorJsonList': serializeParam(
|
visitorJsonList: [visitaWrapItem],
|
||||||
[visitaWrapItem],
|
visitorStrList: visitaWrapItem['VTE_DOCUMENTO'],
|
||||||
ParamType.JSON,
|
)
|
||||||
isList: true,
|
),
|
||||||
),
|
|
||||||
}.withoutNulls,
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
|
@ -121,7 +138,11 @@ Widget buildDetails(
|
||||||
),
|
),
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
status.active) // SHARE ACTION
|
status.active) // SHARE ACTION
|
||||||
FlutterFlowIconButton(
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Compartilhar',
|
||||||
|
enText: 'Share',
|
||||||
|
),
|
||||||
icon: const Icon(Icons.share),
|
icon: const Icon(Icons.share),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Share.share('''
|
Share.share('''
|
||||||
|
@ -134,6 +155,20 @@ Olá, \*${visitaWrapItem['VTE_NOME']}\*! Você foi convidado para \*${visitaWrap
|
||||||
URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${visitaWrapItem['CLI_ID']}/${visitaWrapItem['VAW_CHAVE']}
|
URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${visitaWrapItem['CLI_ID']}/${visitaWrapItem['VAW_CHAVE']}
|
||||||
''');
|
''');
|
||||||
},
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
labelsHashMap: Map<String, String>.from({
|
labelsHashMap: Map<String, String>.from({
|
||||||
|
|
|
@ -237,10 +237,8 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
),
|
),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
_model.debounce(() async {
|
_model.debounce(() async {
|
||||||
log('data');
|
|
||||||
var data = await _model.getVisitanteByDocument(
|
var data = await _model.getVisitanteByDocument(
|
||||||
value, context);
|
value, context);
|
||||||
log('data: $data');
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_isVisitorRegistered = data;
|
_isVisitorRegistered = data;
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,7 +37,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
late VisitorSearchModalTemplateComponentModel _model;
|
late VisitorSearchModalTemplateComponentModel _model;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setState(VoidCallback callback) {
|
safeSetState(VoidCallback callback) {
|
||||||
super.setState(callback);
|
super.setState(callback);
|
||||||
_model.onUpdate();
|
_model.onUpdate();
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
focusNode: _model.textFieldFocusNode,
|
focusNode: _model.textFieldFocusNode,
|
||||||
onFieldSubmitted: (_) async {
|
onFieldSubmitted: (_) async {
|
||||||
await addVisitor(context);
|
await addVisitor(context);
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
|
@ -267,7 +267,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
// ),
|
// ),
|
||||||
// );
|
// );
|
||||||
// },
|
// },
|
||||||
// ).then((value) => safeSetState(() {}));
|
// ).then((value) => safeSetState(() {}));
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 100.0,
|
width: 100.0,
|
||||||
|
@ -356,7 +356,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
_model.removeFromVisitors(
|
_model.removeFromVisitors(
|
||||||
visitorItem);
|
visitorItem);
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -391,7 +391,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
? () async {
|
? () async {
|
||||||
await addVisitor(context);
|
await addVisitor(context);
|
||||||
|
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
: () async {
|
: () async {
|
||||||
await sendVisitors(context);
|
await sendVisitors(context);
|
||||||
|
@ -437,7 +437,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10.0,
|
height: 20.0,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -456,7 +456,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addVisitor(BuildContext context) async {
|
Future<void> addVisitor(BuildContext context) async {
|
||||||
setState(() {
|
safeSetState(() {
|
||||||
_model.textController?.text = _model.textController.text;
|
_model.textController?.text = _model.textController.text;
|
||||||
_model.textController?.selection =
|
_model.textController?.selection =
|
||||||
TextSelection.collapsed(offset: _model.textController!.text.length);
|
TextSelection.collapsed(offset: _model.textController!.text.length);
|
||||||
|
@ -470,15 +470,21 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
);
|
);
|
||||||
|
|
||||||
if (PhpGroup.getVisitorByDocCall.vistanteId(
|
if (PhpGroup.getVisitorByDocCall.vistanteId(
|
||||||
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
||||||
) !=
|
) !=
|
||||||
'0') {
|
'0' &&
|
||||||
|
PhpGroup.getVisitorByDocCall
|
||||||
|
.error((_model.getVisitorByDoc?.jsonBody ?? '')) ==
|
||||||
|
false &&
|
||||||
|
PhpGroup.getVisitorByDocCall
|
||||||
|
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
|
||||||
|
null) {
|
||||||
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
|
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
|
||||||
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
||||||
));
|
));
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
_model.addToDocs(_model.textController.text);
|
_model.addToDocs(_model.textController.text);
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
} else {
|
} else {
|
||||||
await showAdaptiveDialog(
|
await showAdaptiveDialog(
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
|
@ -491,7 +497,6 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).then((value) => safeSetState(() {
|
).then((value) => safeSetState(() {
|
||||||
log('value: $value');
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
addVisitor(context);
|
addVisitor(context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
|
|
||||||
void onUpdate(BuildContext context) {
|
void onUpdate(BuildContext context) {
|
||||||
_model.clearGetLiberationsCache();
|
_model.clearGetLiberationsCache();
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -364,182 +364,32 @@ Widget liberationHistoryItemCard(
|
||||||
FlutterFlowIconButton(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.done),
|
icon: const Icon(Icons.done),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
showDialog(
|
Navigator.pop(context);
|
||||||
context: context,
|
await answersRequest
|
||||||
builder: (context) {
|
.call(
|
||||||
return AlertDialog(
|
context,
|
||||||
title: Text(
|
liberationHistoryItem['NOT_ID'].toString(),
|
||||||
FFLocalizations.of(context).getVariableText(
|
'L',
|
||||||
ptText: 'Aprovar Visita',
|
'Mensagem',
|
||||||
enText: 'Approve Visit',
|
liberationHistoryItem['VTE_ID'].toString(),
|
||||||
),
|
)
|
||||||
),
|
.then((value) {
|
||||||
content: Text(
|
if (value) {
|
||||||
FFLocalizations.of(context).getVariableText(
|
return showSnackbar(
|
||||||
ptText:
|
context,
|
||||||
'Você tem certeza que deseja aprovar essa visita?',
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText:
|
enText: 'Successfully resolved visit',
|
||||||
'Are you sure you want to approve this visit?',
|
ptText: 'Visita resolvida com sucesso'),
|
||||||
),
|
false);
|
||||||
),
|
} else {
|
||||||
backgroundColor: FlutterFlowTheme.of(context)
|
return showSnackbar(
|
||||||
.primaryBackground,
|
context,
|
||||||
actions: [
|
FFLocalizations.of(context).getVariableText(
|
||||||
FFButtonWidget(
|
enText: 'Error resolving visit',
|
||||||
text: FFLocalizations.of(context)
|
ptText: 'Erro ao resolver visita'),
|
||||||
.getVariableText(
|
true);
|
||||||
enText: 'No',
|
}
|
||||||
ptText: 'Não',
|
});
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 100,
|
|
||||||
height: 40,
|
|
||||||
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)),
|
|
||||||
),
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context)
|
|
||||||
.getVariableText(
|
|
||||||
enText: 'Yes',
|
|
||||||
ptText: 'Sim',
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
Navigator.pop(context);
|
|
||||||
Navigator.pop(context);
|
|
||||||
await answersRequest
|
|
||||||
.call(
|
|
||||||
context,
|
|
||||||
liberationHistoryItem['NOT_ID']
|
|
||||||
.toString(),
|
|
||||||
'L',
|
|
||||||
'Mensagem',
|
|
||||||
liberationHistoryItem['VTE_ID']
|
|
||||||
.toString(),
|
|
||||||
)
|
|
||||||
.then((value) {});
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 100,
|
|
||||||
height: 40,
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (liberationHistoryItem['NOT_STATUS'] == 'S')
|
|
||||||
FlutterFlowIconButton(
|
|
||||||
icon: const Icon(Icons.close),
|
|
||||||
onPressed: () async {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Bloquear Visita',
|
|
||||||
enText: 'Block Visit',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
content: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText:
|
|
||||||
'Você tem certeza que deseja bloquear essa visita?',
|
|
||||||
enText:
|
|
||||||
'Are you sure you want to block this visit?',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context)
|
|
||||||
.primaryBackground,
|
|
||||||
actions: [
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context)
|
|
||||||
.getVariableText(
|
|
||||||
enText: 'No',
|
|
||||||
ptText: 'Não',
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 100,
|
|
||||||
height: 40,
|
|
||||||
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)),
|
|
||||||
),
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context)
|
|
||||||
.getVariableText(
|
|
||||||
enText: 'Yes',
|
|
||||||
ptText: 'Sim',
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
await answersRequest.call(
|
|
||||||
context,
|
|
||||||
liberationHistoryItem['NOT_ID']
|
|
||||||
.toString(),
|
|
||||||
'B',
|
|
||||||
'Mensagem',
|
|
||||||
liberationHistoryItem['VTE_ID']
|
|
||||||
.toString(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 100,
|
|
||||||
height: 40,
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -567,9 +417,6 @@ Widget liberationHistoryItemCard(
|
||||||
],
|
],
|
||||||
imagePath:
|
imagePath:
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${liberationHistoryItem['VTE_ID'] ?? ''}&tipo=E',
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${liberationHistoryItem['VTE_ID'] ?? ''}&tipo=E',
|
||||||
|
|
||||||
// changeStatusAction: answersRequest,
|
|
||||||
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -580,7 +427,12 @@ Widget liberationHistoryItemCard(
|
||||||
_pushNotificationService.onMessageReceived.listen((received) {
|
_pushNotificationService.onMessageReceived.listen((received) {
|
||||||
if (received.data['click_action'] == 'cancel_request') {
|
if (received.data['click_action'] == 'cancel_request') {
|
||||||
_pushNotificationService.dispose();
|
_pushNotificationService.dispose();
|
||||||
snackbar(context, opt: true);
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Successfully resolved visit',
|
||||||
|
ptText: 'Visita resolvida com sucesso'),
|
||||||
|
false);
|
||||||
context.pushReplacementNamed(
|
context.pushReplacementNamed(
|
||||||
'liberationHistory',
|
'liberationHistory',
|
||||||
extra: <String, dynamic>{
|
extra: <String, dynamic>{
|
||||||
|
|
|
@ -20,10 +20,12 @@ class MessageHistoryPageWidget extends StatefulWidget {
|
||||||
const MessageHistoryPageWidget({super.key});
|
const MessageHistoryPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MessageHistoryPageWidget> createState() => _MessageHistoryPageWidgetState();
|
State<MessageHistoryPageWidget> createState() =>
|
||||||
|
_MessageHistoryPageWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> with TickerProviderStateMixin {
|
class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
late MessageHistoryPageModel _model;
|
late MessageHistoryPageModel _model;
|
||||||
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
@ -47,25 +49,29 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
|
|
||||||
_messageFuture = fetchMessage();
|
_messageFuture = fetchMessage();
|
||||||
|
|
||||||
_scrollController = ScrollController()..addListener(() {
|
_scrollController = ScrollController()
|
||||||
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
|
..addListener(() {
|
||||||
_loadMore();
|
if (_scrollController.position.atEdge &&
|
||||||
}
|
_scrollController.position.pixels != 0) {
|
||||||
});
|
_loadMore();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
_model.tabBarController = TabController(vsync: this, length: 3, initialIndex: 0)..addListener(() {
|
_model.tabBarController =
|
||||||
if (_model.tabBarController?.index == 0) {
|
TabController(vsync: this, length: 3, initialIndex: 0)
|
||||||
_destinyType = "P";
|
..addListener(() {
|
||||||
} else if (_model.tabBarController?.index == 1) {
|
if (_model.tabBarController?.index == 0) {
|
||||||
_destinyType = "A";
|
_destinyType = "P";
|
||||||
} else {
|
} else if (_model.tabBarController?.index == 1) {
|
||||||
_destinyType = "T";
|
_destinyType = "A";
|
||||||
}
|
} else {
|
||||||
|
_destinyType = "T";
|
||||||
|
}
|
||||||
|
|
||||||
_pageNumber = 1;
|
_pageNumber = 1;
|
||||||
_messageWrap = [];
|
_messageWrap = [];
|
||||||
_messageFuture = fetchMessage();
|
_messageFuture = fetchMessage();
|
||||||
});
|
});
|
||||||
|
|
||||||
_model.textController ??= TextEditingController();
|
_model.textController ??= TextEditingController();
|
||||||
_model.textFieldFocusNode ??= FocusNode();
|
_model.textFieldFocusNode ??= FocusNode();
|
||||||
|
@ -80,7 +86,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
|
|
||||||
void onUpdate(BuildContext context) {
|
void onUpdate(BuildContext context) {
|
||||||
_model.clearGetLiberationsCache();
|
_model.clearGetLiberationsCache();
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -129,7 +135,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
return null;
|
return null;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
DialogUtil.errorDefault(context);
|
DialogUtil.errorDefault(context);
|
||||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Mensagems", e, s);
|
LogUtil.requestAPIFailed(
|
||||||
|
"proccessRequest.php", "", "Consulta de Mensagems", e, s);
|
||||||
setState(() {
|
setState(() {
|
||||||
_hasData = false;
|
_hasData = false;
|
||||||
_loading = false;
|
_loading = false;
|
||||||
|
@ -168,12 +175,12 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
ptText: 'Histórico de Mensagens',
|
ptText: 'Histórico de Mensagens',
|
||||||
),
|
),
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
||||||
fontFamily: 'Nunito',
|
fontFamily: 'Nunito',
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
fontSize: 17.0,
|
fontSize: 17.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: const [],
|
actions: const [],
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
@ -193,12 +200,12 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
labelColor: FlutterFlowTheme.of(context).primaryText,
|
labelColor: FlutterFlowTheme.of(context).primaryText,
|
||||||
unselectedLabelColor: FlutterFlowTheme.of(context).primaryText,
|
unselectedLabelColor: FlutterFlowTheme.of(context).primaryText,
|
||||||
labelStyle: FlutterFlowTheme.of(context).titleMedium.override(
|
labelStyle: FlutterFlowTheme.of(context).titleMedium.override(
|
||||||
fontFamily: FlutterFlowTheme.of(context).titleMediumFamily,
|
fontFamily: FlutterFlowTheme.of(context).titleMediumFamily,
|
||||||
fontSize: 13.0,
|
fontSize: 13.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
FlutterFlowTheme.of(context).titleMediumFamily),
|
FlutterFlowTheme.of(context).titleMediumFamily),
|
||||||
),
|
),
|
||||||
unselectedLabelStyle: const TextStyle(),
|
unselectedLabelStyle: const TextStyle(),
|
||||||
indicatorColor: FlutterFlowTheme.of(context).primary,
|
indicatorColor: FlutterFlowTheme.of(context).primary,
|
||||||
padding: const EdgeInsets.all(4.0),
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
@ -232,19 +239,16 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(FFLocalizations.of(context).getVariableText(
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: "Nenhuma mensagem encontrada!",
|
ptText: "Nenhuma mensagem encontrada!",
|
||||||
enText: "No message found"
|
enText: "No message found")),
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
else if (_hasData == true || _pageNumber >= 1)
|
else if (_hasData == true || _pageNumber >= 1)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: FutureBuilder<void>(
|
child: FutureBuilder<void>(
|
||||||
future: _messageFuture,
|
future: _messageFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
|
@ -255,8 +259,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = _messageWrap[index];
|
final item = _messageWrap[index];
|
||||||
return _item(context, item);
|
return _item(context, item);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -280,7 +283,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."),
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: "Não há mais dados.", enText: "No more data."),
|
||||||
),
|
),
|
||||||
duration: const Duration(seconds: 3),
|
duration: const Duration(seconds: 3),
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
|
@ -288,7 +292,6 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget _item(BuildContext context, dynamic jsonBody) {
|
Widget _item(BuildContext context, dynamic jsonBody) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
@ -314,8 +317,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
jsonBody['MSG_DESTINO_TP'] == 'T'
|
jsonBody['MSG_DESTINO_TP'] == 'T'
|
||||||
? Icons.language
|
? Icons.language
|
||||||
: jsonBody['MSG_DESTINO_TP'] == 'P'
|
: jsonBody['MSG_DESTINO_TP'] == 'P'
|
||||||
? Icons.person
|
? Icons.person
|
||||||
: Icons.home,
|
: Icons.home,
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
color: FlutterFlowTheme.of(context).primary,
|
||||||
size: 25,
|
size: 25,
|
||||||
),
|
),
|
||||||
|
@ -340,7 +343,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
padding: const EdgeInsets.only(left: 5),
|
padding: const EdgeInsets.only(left: 5),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.history,
|
Icons.history,
|
||||||
color: FlutterFlowTheme.of(context).customColor6,
|
color:
|
||||||
|
FlutterFlowTheme.of(context).customColor6,
|
||||||
size: 15,
|
size: 15,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -351,7 +355,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
color:
|
color:
|
||||||
FlutterFlowTheme.of(context).customColor6,
|
FlutterFlowTheme.of(context).customColor6,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
@ -366,7 +370,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
padding: const EdgeInsets.only(left: 5),
|
padding: const EdgeInsets.only(left: 5),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.message,
|
Icons.message,
|
||||||
color: FlutterFlowTheme.of(context).customColor6,
|
color:
|
||||||
|
FlutterFlowTheme.of(context).customColor6,
|
||||||
size: 15,
|
size: 15,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -388,7 +393,4 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,14 @@ import 'package:provider/provider.dart';
|
||||||
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
||||||
const ScheduleCompleteVisitPageWidget({
|
const ScheduleCompleteVisitPageWidget({
|
||||||
super.key,
|
super.key,
|
||||||
|
this.dropdownValue1,
|
||||||
|
this.dropdownValue2,
|
||||||
this.visitorStrList,
|
this.visitorStrList,
|
||||||
this.visitorJsonList,
|
this.visitorJsonList,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final String? dropdownValue1;
|
||||||
|
final String? dropdownValue2;
|
||||||
final String? visitorStrList;
|
final String? visitorStrList;
|
||||||
final List<dynamic>? visitorJsonList;
|
final List<dynamic>? visitorJsonList;
|
||||||
|
|
||||||
|
@ -60,10 +64,7 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
|
|
||||||
// On page load action.
|
// On page load action.
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||||
if ((widget.visitorStrList != null && widget.visitorStrList != '') &&
|
if ((widget.visitorStrList != null && widget.visitorStrList != '') && ((widget.visitorJsonList != null && (widget.visitorJsonList)!.isNotEmpty) != null)) {
|
||||||
((widget.visitorJsonList != null &&
|
|
||||||
(widget.visitorJsonList)!.isNotEmpty) !=
|
|
||||||
null)) {
|
|
||||||
_model.visitorJsonList = widget.visitorJsonList!
|
_model.visitorJsonList = widget.visitorJsonList!
|
||||||
.where((e) =>
|
.where((e) =>
|
||||||
widget.visitorStrList ==
|
widget.visitorStrList ==
|
||||||
|
@ -75,17 +76,25 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
.toList()
|
.toList()
|
||||||
.cast<dynamic>();
|
.cast<dynamic>();
|
||||||
_model.visitorStrList = widget.visitorStrList!;
|
_model.visitorStrList = widget.visitorStrList!;
|
||||||
setState(() {});
|
|
||||||
|
safeSetState(() {});
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((widget.dropdownValue1 != null && widget.dropdownValue1 != '') && (widget.dropdownValue2 != null && widget.dropdownValue2 != '')) {
|
||||||
|
_model.dropDownValue1 = widget.dropdownValue1!;
|
||||||
|
_model.dropDownValue2 = widget.dropdownValue2!;
|
||||||
|
safeSetState(() {});
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
_model.tabBarController = TabController(
|
_model.tabBarController = TabController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
length: 2,
|
length: 2,
|
||||||
initialIndex: 0,
|
initialIndex: 0,
|
||||||
)..addListener(() => setState(() {}));
|
)..addListener(() => safeSetState(() {}));
|
||||||
_model.textController1 ??= TextEditingController();
|
_model.textController1 ??= TextEditingController();
|
||||||
_model.textFieldFocusNode1 ??= FocusNode();
|
_model.textFieldFocusNode1 ??= FocusNode();
|
||||||
|
|
||||||
|
@ -116,11 +125,11 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
if (newItems.isNotEmpty) {
|
if (newItems.isNotEmpty) {
|
||||||
_visitHistoryList.addAll(newItems);
|
_visitHistoryList.addAll(newItems);
|
||||||
_visitHistoryLoadingIdx++;
|
_visitHistoryLoadingIdx++;
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void_scrollListener() {
|
void _scrollListener() {
|
||||||
if (_visitHistoryController.position.pixels ==
|
if (_visitHistoryController.position.pixels ==
|
||||||
_visitHistoryController.position.maxScrollExtent) {
|
_visitHistoryController.position.maxScrollExtent) {
|
||||||
_loadMoreVisitHistory();
|
_loadMoreVisitHistory();
|
||||||
|
@ -146,8 +155,7 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
appBar: appBarScheduleCompleteVisit(context),
|
appBar: appBarScheduleCompleteVisit(context),
|
||||||
body:
|
body: bodyScheduleCompleteVisit(context, _model, safeSetState),
|
||||||
bodyScheduleCompleteVisit(context, _model, setState, safeSetState),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -191,11 +199,8 @@ PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bodyScheduleCompleteVisit(
|
Widget bodyScheduleCompleteVisit(BuildContext context,
|
||||||
BuildContext context,
|
ScheduleCompleteVisitPageModel _model, Function safeSetState) {
|
||||||
ScheduleCompleteVisitPageModel _model,
|
|
||||||
Function setState,
|
|
||||||
Function safeSetState) {
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
top: true,
|
top: true,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -237,12 +242,12 @@ Widget bodyScheduleCompleteVisit(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
controller: _model.tabBarController,
|
controller: _model.tabBarController,
|
||||||
children: [
|
children: [
|
||||||
scheduleVisit(context, _model, setState, safeSetState),
|
scheduleVisit(context, _model, safeSetState),
|
||||||
wrapWithModel(
|
wrapWithModel(
|
||||||
model: _model,
|
model: _model,
|
||||||
child: VisitHistoryWidget(),
|
child: VisitHistoryWidget(),
|
||||||
updateCallback: () {
|
updateCallback: () {
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
updateOnChange: true),
|
updateOnChange: true),
|
||||||
],
|
],
|
||||||
|
@ -253,11 +258,8 @@ Widget bodyScheduleCompleteVisit(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget scheduleVisit(
|
Widget scheduleVisit(BuildContext context,
|
||||||
BuildContext context,
|
ScheduleCompleteVisitPageModel _model, Function safeSetState) {
|
||||||
ScheduleCompleteVisitPageModel _model,
|
|
||||||
Function setState,
|
|
||||||
Function safeSetState) {
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
@ -512,7 +514,7 @@ Widget scheduleVisit(
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setState(() {
|
safeSetState(() {
|
||||||
_model.textController1?.text = dateTimeFormat(
|
_model.textController1?.text = dateTimeFormat(
|
||||||
'd/M/y H:mm:ss',
|
'd/M/y H:mm:ss',
|
||||||
_model.datePicked1,
|
_model.datePicked1,
|
||||||
|
@ -760,7 +762,7 @@ Widget scheduleVisit(
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setState(() {
|
safeSetState(() {
|
||||||
_model.textController2?.text = dateTimeFormat(
|
_model.textController2?.text = dateTimeFormat(
|
||||||
'd/M/y H:mm:ss',
|
'd/M/y H:mm:ss',
|
||||||
_model.datePicked2,
|
_model.datePicked2,
|
||||||
|
@ -896,7 +898,7 @@ Widget scheduleVisit(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
_model.removeFromVisitorJsonList(
|
_model.removeFromVisitorJsonList(
|
||||||
visitorListViewItem);
|
visitorListViewItem);
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
),
|
),
|
||||||
|
@ -946,13 +948,13 @@ Widget scheduleVisit(
|
||||||
visitorsParam!
|
visitorsParam!
|
||||||
.toList()
|
.toList()
|
||||||
.cast<dynamic>();
|
.cast<dynamic>();
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
getDocs: (docsParam) async {
|
getDocs: (docsParam) async {
|
||||||
_model.visitorStrList =
|
_model.visitorStrList =
|
||||||
strListToStr(
|
strListToStr(
|
||||||
docsParam!.toList());
|
docsParam!.toList());
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1082,7 +1084,6 @@ Widget scheduleVisit(
|
||||||
atividade: 'getDados',
|
atividade: 'getDados',
|
||||||
),
|
),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
// Customize what your widget looks like when it's loading.
|
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -1096,37 +1097,30 @@ Widget scheduleVisit(
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final dropDownGetDadosResponse =
|
|
||||||
snapshot.data!;
|
final dropDownGetDadosResponse = snapshot.data!;
|
||||||
final reasonsJsonList =
|
final reasonsJsonList = PhpGroup.getDadosCall.reasonsJsonList(dropDownGetDadosResponse.jsonBody);
|
||||||
PhpGroup.getDadosCall.reasonsJsonList(
|
|
||||||
dropDownGetDadosResponse.jsonBody,
|
if (_model.dropDownValue1 != '' && _model.dropDownValue1 != null) {
|
||||||
);
|
String value = _model.dropDownValue1.toString() ?? '';
|
||||||
|
|
||||||
|
if (value.contains('{') && value.contains('}') && value.contains(':')) {
|
||||||
|
// log("Valor e um Objeto | Usuário Escolheu o Motivo ${_model.dropDownValue1}");
|
||||||
|
} else {
|
||||||
|
// log("Valor e uma String | Usuário Escolheu o Motivo ${_model.dropDownValue1}");
|
||||||
|
if (reasonsJsonList != null && reasonsJsonList.isNotEmpty) {
|
||||||
|
var item = reasonsJsonList.where((reason) => reason['MOT_DESCRICAO'].toString().contains(_model.dropDownValue1 ?? ''));
|
||||||
|
_model.dropDownValue1 = item.firstOrNull.toString() ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FlutterFlowDropDown<String>(
|
return FlutterFlowDropDown<String>(
|
||||||
fillColor: FlutterFlowTheme.of(context)
|
fillColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
.primaryBackground,
|
controller: _model.dropDownValueController1 ??= FormFieldController<String>(_model.dropDownValue1 ??= ''),
|
||||||
controller:
|
options: reasonsJsonList != null && reasonsJsonList != [] ? reasonsJsonList.map((e) => e.toString()).toList() : [],
|
||||||
_model.dropDownValueController1 ??=
|
optionLabels: PhpGroup.getDadosCall.reasonsMotDescStrList(dropDownGetDadosResponse.jsonBody),
|
||||||
FormFieldController<String>(
|
onChanged: (val) => safeSetState(() => _model.dropDownValue1 = val),
|
||||||
_model.dropDownValue1 ??= '',
|
|
||||||
),
|
|
||||||
options: reasonsJsonList != null &&
|
|
||||||
reasonsJsonList != []
|
|
||||||
? List<String>.from(
|
|
||||||
PhpGroup.getDadosCall
|
|
||||||
.reasonsJsonList(
|
|
||||||
dropDownGetDadosResponse
|
|
||||||
.jsonBody,
|
|
||||||
)!
|
|
||||||
.map((e) => e.toString())
|
|
||||||
.toList())
|
|
||||||
: [],
|
|
||||||
optionLabels: PhpGroup.getDadosCall
|
|
||||||
.reasonsMotDescStrList(
|
|
||||||
dropDownGetDadosResponse.jsonBody,
|
|
||||||
),
|
|
||||||
onChanged: (val) => setState(
|
|
||||||
() => _model.dropDownValue1 = val),
|
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
textStyle: FlutterFlowTheme.of(context)
|
textStyle: FlutterFlowTheme.of(context)
|
||||||
|
@ -1228,30 +1222,29 @@ Widget scheduleVisit(
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final dropDownGetDadosResponse =
|
|
||||||
snapshot.data!;
|
final dropDownGetDadosResponse = snapshot.data!;
|
||||||
final lavelList =
|
final lavelList = PhpGroup.getDadosCall.levelJsonList(dropDownGetDadosResponse.jsonBody);
|
||||||
PhpGroup.getDadosCall.levelJsonList(
|
|
||||||
dropDownGetDadosResponse.jsonBody,
|
if (_model.dropDownValue2 != '' && _model.dropDownValue2 != null) {
|
||||||
);
|
String value = _model.dropDownValue2.toString() ?? '';
|
||||||
|
|
||||||
|
if (value.contains('{') && value.contains('}') && value.contains(':')) {
|
||||||
|
// log("Valor e um Objeto | Usuário Escolheu o Nivel ${_model.dropDownValue2}");
|
||||||
|
} else {
|
||||||
|
// log("Valor e uma String | Usuário Escolheu o Nivel ${_model.dropDownValue2}");
|
||||||
|
if (lavelList != null && lavelList.isNotEmpty) {
|
||||||
|
var item = lavelList.where((level) => level['NAC_DESCRICAO'].toString().contains(_model.dropDownValue2 ?? ''));
|
||||||
|
_model.dropDownValue2 = item.firstOrNull.toString() ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FlutterFlowDropDown<String>(
|
return FlutterFlowDropDown<String>(
|
||||||
controller:
|
controller: _model.dropDownValueController2 ??= FormFieldController<String>(_model.dropDownValue2 ??= ''),
|
||||||
_model.dropDownValueController2 ??=
|
options: lavelList != null && lavelList != [] ? lavelList.map((e) => e.toString()).toList() : [],
|
||||||
FormFieldController<String>(
|
optionLabels: PhpGroup.getDadosCall.levelNACDescricaoStrList(dropDownGetDadosResponse.jsonBody),
|
||||||
_model.dropDownValue2 ??= '',
|
onChanged: (val) => safeSetState(() => _model.dropDownValue2 = val),
|
||||||
),
|
|
||||||
options:
|
|
||||||
lavelList != null && lavelList != []
|
|
||||||
? List<String>.from(lavelList!
|
|
||||||
.map((e) => e.toString())
|
|
||||||
.toList())
|
|
||||||
: [],
|
|
||||||
optionLabels: PhpGroup.getDadosCall
|
|
||||||
.levelNACDescricaoStrList(
|
|
||||||
dropDownGetDadosResponse.jsonBody,
|
|
||||||
),
|
|
||||||
onChanged: (val) => setState(
|
|
||||||
() => _model.dropDownValue2 = val),
|
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
textStyle: FlutterFlowTheme.of(context)
|
textStyle: FlutterFlowTheme.of(context)
|
||||||
|
@ -1298,7 +1291,7 @@ Widget scheduleVisit(
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (_model.dropDownValue1 == '')
|
if (_model.dropDownValue2 == '')
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
@ -1381,7 +1374,7 @@ Widget scheduleVisit(
|
||||||
Switch.adaptive(
|
Switch.adaptive(
|
||||||
value: _model.switchValue!,
|
value: _model.switchValue!,
|
||||||
onChanged: (newValue) async {
|
onChanged: (newValue) async {
|
||||||
setState(() => _model.switchValue = newValue);
|
safeSetState(() => _model.switchValue = newValue);
|
||||||
},
|
},
|
||||||
applyCupertinoTheme: false,
|
applyCupertinoTheme: false,
|
||||||
focusColor: FlutterFlowTheme.of(context).primary,
|
focusColor: FlutterFlowTheme.of(context).primary,
|
||||||
|
@ -1559,7 +1552,6 @@ Widget scheduleVisit(
|
||||||
),
|
),
|
||||||
onPressed: _model.isValid()
|
onPressed: _model.isValid()
|
||||||
? () async {
|
? () async {
|
||||||
log(_model.dropDownValue1.toString());
|
|
||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -1589,10 +1581,14 @@ Widget scheduleVisit(
|
||||||
// ),
|
// ),
|
||||||
child: DetailsComponentWidget(
|
child: DetailsComponentWidget(
|
||||||
buttons: [
|
buttons: [
|
||||||
FlutterFlowIconButton(
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context)
|
||||||
|
.getVariableText(
|
||||||
|
enText: 'Done',
|
||||||
|
ptText: 'Confirmar',
|
||||||
|
),
|
||||||
icon: const Icon(Icons.done),
|
icon: const Icon(Icons.done),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
log('visitorStrList ${_model.visitorStrList}');
|
|
||||||
showAlertDialog(
|
showAlertDialog(
|
||||||
context,
|
context,
|
||||||
FFLocalizations.of(context)
|
FFLocalizations.of(context)
|
||||||
|
@ -1657,9 +1653,26 @@ Widget scheduleVisit(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context)
|
||||||
|
.primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context)
|
||||||
|
.primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context)
|
||||||
|
.primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
imagePath:
|
imagePath:
|
||||||
|
|
|
@ -45,12 +45,10 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
log('API response: ${response.jsonBody}');
|
|
||||||
|
|
||||||
var newVisits = response.jsonBody['visitas']
|
var newVisits = response.jsonBody['visitas']
|
||||||
as List<dynamic>?; // Ajuste conforme a estrutura da resposta
|
as List<dynamic>?; // Ajuste conforme a estrutura da resposta
|
||||||
if (newVisits != null && newVisits.isNotEmpty) {
|
if (newVisits != null && newVisits.isNotEmpty) {
|
||||||
setState(() {
|
safeSetState(() {
|
||||||
visitaWrap.addAll(newVisits);
|
visitaWrap.addAll(newVisits);
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
|
@ -95,8 +93,6 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
log('[A] - ${visitaWrap.length.toString()}');
|
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: visitaWrap.length + 1,
|
itemCount: visitaWrap.length + 1,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
|
@ -114,7 +110,6 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final visitaWrapItem = visitaWrap[index];
|
final visitaWrapItem = visitaWrap[index];
|
||||||
log('[B] - ${visitaWrap.length.toString()}');
|
|
||||||
|
|
||||||
return CardItemTemplateComponentWidget(
|
return CardItemTemplateComponentWidget(
|
||||||
imagePath:
|
imagePath:
|
||||||
|
@ -183,7 +178,6 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).whenComplete(() {
|
).whenComplete(() {
|
||||||
log('Dialog closed');
|
|
||||||
// updateVisitFuture();
|
// updateVisitFuture();
|
||||||
_fetchVisits().then((response) {
|
_fetchVisits().then((response) {
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
|
|
Loading…
Reference in New Issue