Merge branch 'main' into new_appserver

# Conflicts:
#	lib/content_views/approach_area_page.dart
#	lib/content_views/assigned_jobs_page.dart
#	lib/content_views/main_page.dart
#	lib/content_views/task_list_page.dart
#	lib/main.dart
#	lib/popups/accept_jobs_popup.dart
#	lib/protocoll_messages/logout_message.dart
#	lib/protocoll_messages/logout_message.g.dart
#	lib/tools/constants.dart
#	lib/tools/mqtt_core.dart
#	pubspec.lock
#	pubspec.yaml
This commit is contained in:
Sven committed 2024-03-26 12:56:04 +01:00
commit 880cdd65ff
74 files changed
+2463 -441

No files matched your search

+63 -25
View File
@@ -20,6 +20,7 @@ import 'package:stadtbote/popups/tasks_popups/take_photos_popup.dart';
import 'package:stadtbote/protocoll_messages/accept_job_message.dart';
import 'package:stadtbote/protocoll_messages/fin_task_message.dart';
import 'package:stadtbote/protocoll_messages/fin_tour_message.dart';
import 'package:stadtbote/protocoll_messages/pic_message.dart';
import 'package:stadtbote/tools/constants.dart';
import 'package:stadtbote/tools/message_service.dart';
import 'package:stadtbote/tools/mqtt_core.dart';
@@ -64,11 +65,17 @@ class _TaskListPageState extends State<TaskListPage> {
late List<TaskInfo> _taskList;
List<Uint8List> _photos = [];
late String _commisionNumber;
@override
void initState() {
Future.delayed(const Duration(seconds: 0), () async {
_taskList = await _fetchTaskList();
_commisionNumber = widget.tour.com ?? "";
_initCompleted = true;
setState(() {});
@@ -93,8 +100,21 @@ class _TaskListPageState extends State<TaskListPage> {
child: AbsorbPointer(
absorbing: widget.readOnly,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: steps,
children: [
Visibility(
visible: _commisionNumber.length > 0,
child: Row(
children: [
Text('Komm-#: $_commisionNumber', style: const TextStyle(fontSize: 20), textAlign: TextAlign.left),
],
),
),
const SizedBox(height: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: steps,
),
],
),
),
),
@@ -125,7 +145,7 @@ class _TaskListPageState extends State<TaskListPage> {
left: 16.5,
top: i == 0 ? 40 : 40,
child: Container(
height: i == widget.tour.tasks!.length - 1 ? 0 : 20,
height: i == widget.tour.tasks.length - 1 ? 0 : 20,
width: 6,
color: isTaskActive(i) ? Constants.colorPrimary : Constants.colorPrimaryOpaque,
),
@@ -159,12 +179,16 @@ class _TaskListPageState extends State<TaskListPage> {
),
),
const SizedBox(height: 5),
Text(
taskInfo.additionalText ?? '',
textAlign: TextAlign.left,
style: TextStyle(
color: textColor,
fontSize: 12.0,
SizedBox(
width: MediaQuery.of(context).size.width * 0.7,
child: Text(
taskInfo.additionalText ?? '',
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
fontSize: 12.0,
),
),
),
],
@@ -187,7 +211,7 @@ class _TaskListPageState extends State<TaskListPage> {
Future<List<TaskInfo>> _fetchTaskList() async {
List<TaskInfo> taskList = [];
for(var task in widget.tour.tasks!) {
for(var task in widget.tour.tasks) {
var taskInfo = await MyApp.isarInstance.taskInfos.filter().sIdEqualTo(task.sId).findFirst();
if (taskInfo == null) {
taskInfo = TaskInfo();
@@ -268,6 +292,8 @@ class _TaskListPageState extends State<TaskListPage> {
taskInfo.additionalText = comissionNumber;
taskInfo.completed = true;
_commisionNumber = comissionNumber;
setState(() {});
_finishTaskProcessing(taskInfo);
@@ -282,6 +308,7 @@ class _TaskListPageState extends State<TaskListPage> {
answer.codes!.add(barcode);
}
taskInfo.answer = jsonEncode(answer.toJson());
taskInfo.additionalText = "Barcodes gescannt";
taskInfo.completed = true;
@@ -292,13 +319,17 @@ class _TaskListPageState extends State<TaskListPage> {
}
_processTakePhotos(TaskInfo taskInfo) {
showTakePhotosPopup(context, taskInfo, () {
taskInfo.additionalText = "Fotos aufgenommen";
taskInfo.completed = true;
showTakePhotosPopup(context, taskInfo, (List<Uint8List>? photos) {
if (photos != null) {
_photos = photos;
setState(() {});
taskInfo.additionalText = "Fotos aufgenommen";
taskInfo.completed = true;
_finishTaskProcessing(taskInfo);
setState(() {});
_finishTaskProcessing(taskInfo);
}
});
}
@@ -308,6 +339,7 @@ class _TaskListPageState extends State<TaskListPage> {
answer.val = notice;
taskInfo.answer = jsonEncode(answer.toJson());
taskInfo.additionalText = notice;
taskInfo.completed = true;
_finishTaskProcessing(taskInfo);
@@ -349,23 +381,29 @@ class _TaskListPageState extends State<TaskListPage> {
}
void _processSignature(TaskInfo taskInfo) {
MyApp.suppressAcceptDialog = true;
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]);
Future.delayed(const Duration(seconds: 1), () async {
showSignaturePopup(context, taskInfo, () {
var answer = _createAnswerHeader(taskInfo);
answer.sign = 'A110';
taskInfo.answer = jsonEncode(answer.toJson());
taskInfo.completed = true;
showSignaturePopup(context, taskInfo, (String? signature) {
MyApp.suppressAcceptDialog = false;
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
_sendFinTourMessage();
if (signature != null) {
var answer = _createAnswerHeader(taskInfo);
answer.sign = signature;
_finishTaskProcessing(taskInfo);
taskInfo.answer = jsonEncode(answer.toJson());
taskInfo.completed = true;
MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 2));
_sendFinTourMessage();
_finishTaskProcessing(taskInfo);
MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 2));
}
});
});
}
@@ -407,7 +445,7 @@ class _TaskListPageState extends State<TaskListPage> {
message.task.pos!.long = position.longitude;
}
MqttCore.instance.publishText("fin_task", jsonEncode(message.toJson()));
MqttCore.instance.publishPayloadMessage("job", finTaskMessage.toJson());
}
FinTourTask _createAnswerHeader(TaskInfo taskInfo) {