WIP
This commit is contained in:
parent
d2cf5b4252
commit
5527f35e25
|
@ -18,7 +18,9 @@ Widget buildDetails(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
Future<dynamic> Function(BuildContext, int, int, String, String)?
|
Future<dynamic> Function(BuildContext, int, int, String, String)?
|
||||||
changeStatusAction) {
|
changeStatusAction) {
|
||||||
|
log('test');
|
||||||
log('visitaWrapItem: ${visitaWrapItem.toString()}');
|
log('visitaWrapItem: ${visitaWrapItem.toString()}');
|
||||||
|
log('test');
|
||||||
return VisitRequestTemplateComponentWidget(
|
return VisitRequestTemplateComponentWidget(
|
||||||
buttons: [
|
buttons: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
|
|
@ -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;
|
||||||
});
|
});
|
||||||
|
|
|
@ -479,7 +479,6 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
PhpGroup.getVisitorByDocCall
|
PhpGroup.getVisitorByDocCall
|
||||||
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
|
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
|
||||||
null) {
|
null) {
|
||||||
log('visitor found: ${PhpGroup.getVisitorByDocCall.vistanteId((_model.getVisitorByDoc?.jsonBody ?? ''))}');
|
|
||||||
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
|
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
|
||||||
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
||||||
));
|
));
|
||||||
|
@ -498,7 +497,6 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).then((value) => safeSetState(() {
|
).then((value) => safeSetState(() {
|
||||||
log('value: $value');
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
addVisitor(context);
|
addVisitor(context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
.toList()
|
.toList()
|
||||||
.cast<dynamic>();
|
.cast<dynamic>();
|
||||||
_model.visitorStrList = widget.visitorStrList!;
|
_model.visitorStrList = widget.visitorStrList!;
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
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,7 +116,7 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
if (newItems.isNotEmpty) {
|
if (newItems.isNotEmpty) {
|
||||||
_visitHistoryList.addAll(newItems);
|
_visitHistoryList.addAll(newItems);
|
||||||
_visitHistoryLoadingIdx++;
|
_visitHistoryLoadingIdx++;
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +146,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 +190,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 +233,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 +249,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 +505,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 +753,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 +889,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 +939,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(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1125,7 +1118,7 @@ Widget scheduleVisit(
|
||||||
.reasonsMotDescStrList(
|
.reasonsMotDescStrList(
|
||||||
dropDownGetDadosResponse.jsonBody,
|
dropDownGetDadosResponse.jsonBody,
|
||||||
),
|
),
|
||||||
onChanged: (val) => setState(
|
onChanged: (val) => safeSetState(
|
||||||
() => _model.dropDownValue1 = val),
|
() => _model.dropDownValue1 = val),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
|
@ -1250,7 +1243,7 @@ Widget scheduleVisit(
|
||||||
.levelNACDescricaoStrList(
|
.levelNACDescricaoStrList(
|
||||||
dropDownGetDadosResponse.jsonBody,
|
dropDownGetDadosResponse.jsonBody,
|
||||||
),
|
),
|
||||||
onChanged: (val) => setState(
|
onChanged: (val) => safeSetState(
|
||||||
() => _model.dropDownValue2 = val),
|
() => _model.dropDownValue2 = val),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
|
@ -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,
|
||||||
|
@ -1657,7 +1650,7 @@ Widget scheduleVisit(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -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