Erweiterungen
This commit is contained in:
1 parent
43e146594e
commit
47f31b7a5a
7 files changed
+23
-8
No files matched your search
@@ -44,7 +44,7 @@ class _AcceptedJobsPageState extends State<AcceptedJobsPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
Future.delayed(const Duration(seconds: 0), () async {
|
Future.delayed(const Duration(seconds: 0), () async {
|
||||||
_jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(1).findAll();
|
_jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(Constants.STATE_ACCEPTED).findAll();
|
||||||
|
|
||||||
_initCompleted = true;
|
_initCompleted = true;
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class _AssignedJobsPageState extends State<AssignedJobsPage> {
|
|||||||
Future<List<Widget>> _createListEntries() async {
|
Future<List<Widget>> _createListEntries() async {
|
||||||
List<Widget> entries = [];
|
List<Widget> entries = [];
|
||||||
|
|
||||||
var jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(0).findAll();
|
var jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(Constants.STATE_ASSIGNED).findAll();
|
||||||
for (var job in jobs) {
|
for (var job in jobs) {
|
||||||
entries.add(ExpandableNotifier(
|
entries.add(ExpandableNotifier(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class _FinishedJobsPageState extends State<FinishedJobsPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
Future.delayed(const Duration(seconds: 0), () async {
|
Future.delayed(const Duration(seconds: 0), () async {
|
||||||
_jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(2).findAll();
|
_jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(Constants.STATE_FINISHED).findAll();
|
||||||
|
|
||||||
_initCompleted = true;
|
_initCompleted = true;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:isar/isar.dart';
|
|||||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||||
|
import 'package:stadtbote/model/job.dart';
|
||||||
import 'package:stadtbote/model/job_tour.dart';
|
import 'package:stadtbote/model/job_tour.dart';
|
||||||
import 'package:stadtbote/popups/tasks_popups/arrived_popup.dart';
|
import 'package:stadtbote/popups/tasks_popups/arrived_popup.dart';
|
||||||
import 'package:stadtbote/popups/tasks_popups/commision_number_popup.dart';
|
import 'package:stadtbote/popups/tasks_popups/commision_number_popup.dart';
|
||||||
@@ -27,7 +28,9 @@ import '../model/task_info.dart';
|
|||||||
import '../tools/util.dart';
|
import '../tools/util.dart';
|
||||||
|
|
||||||
class TaskListPage extends ContentViewWidget {
|
class TaskListPage extends ContentViewWidget {
|
||||||
const TaskListPage({super.key, required this.tour, this.readOnly = false});
|
const TaskListPage({super.key, required this.job, required this.tour, this.readOnly = false});
|
||||||
|
|
||||||
|
final Job job;
|
||||||
|
|
||||||
final JobTour tour;
|
final JobTour tour;
|
||||||
|
|
||||||
@@ -427,7 +430,7 @@ class _TaskListPageState extends State<TaskListPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
_sendFinTourMessage() {
|
_sendFinTourMessage() async {
|
||||||
var finTourMessage = FinTourMessage();
|
var finTourMessage = FinTourMessage();
|
||||||
finTourMessage.finTour = FinTour();
|
finTourMessage.finTour = FinTour();
|
||||||
finTourMessage.finTour.trId = widget.tour.id;
|
finTourMessage.finTour.trId = widget.tour.id;
|
||||||
@@ -455,5 +458,12 @@ class _TaskListPageState extends State<TaskListPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MqttCore.instance.publishPayloadMessage("job", finTourMessage.toJson());
|
MqttCore.instance.publishPayloadMessage("job", finTourMessage.toJson());
|
||||||
|
|
||||||
|
widget.tour.state = 9;
|
||||||
|
await MyApp.isarInstance.writeTxn(() async {
|
||||||
|
await MyApp.isarInstance.jobs.put(widget.job);
|
||||||
|
});
|
||||||
|
|
||||||
|
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,11 +14,11 @@ class TourDetailsPage extends ContentViewWidget {
|
|||||||
const TourDetailsPage({super.key, required this.job, required this.tour, this.readOnly = false});
|
const TourDetailsPage({super.key, required this.job, required this.tour, this.readOnly = false});
|
||||||
|
|
||||||
final Job job;
|
final Job job;
|
||||||
|
|
||||||
final JobTour tour;
|
final JobTour tour;
|
||||||
|
|
||||||
final bool readOnly;
|
final bool readOnly;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TourDetailsPage> createState() => _TourDetailsPageState();
|
State<TourDetailsPage> createState() => _TourDetailsPageState();
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ class _TourDetailsPageState extends State<TourDetailsPage> {
|
|||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
getDefaultButton('Weiter', () =>
|
getDefaultButton('Weiter', () =>
|
||||||
{
|
{
|
||||||
MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TaskListPage(tour: widget.tour, readOnly: widget.readOnly))
|
MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TaskListPage(job: widget.job, tour: widget.tour, readOnly: widget.readOnly))
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -15,4 +15,9 @@ class Constants {
|
|||||||
static const String messageTopicReplaceContentView = "replace_content_view";
|
static const String messageTopicReplaceContentView = "replace_content_view";
|
||||||
static const String messageTopicHideRightButton = "hide_right_button";
|
static const String messageTopicHideRightButton = "hide_right_button";
|
||||||
static const String messageShowPopup = "show_popup";
|
static const String messageShowPopup = "show_popup";
|
||||||
|
|
||||||
|
static const int STATE_ASSIGNED = 0;
|
||||||
|
static const int STATE_ACCEPTED = 1;
|
||||||
|
static const int STATE_FINISHED = 2;
|
||||||
|
static const int STATE_FINISHED_NOT_CONFIRMED = 9;
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ class MqttCore {
|
|||||||
MyApp.isarInstance.jobs.putSync(newJob);
|
MyApp.isarInstance.jobs.putSync(newJob);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newJob.state == 0) {
|
if (newJob.state == Constants.STATE_ASSIGNED) {
|
||||||
if (newJob.global) {
|
if (newJob.global) {
|
||||||
await Util.playMp3('aaa.mp3');
|
await Util.playMp3('aaa.mp3');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user