aboutsummaryrefslogtreecommitdiff
path: root/iosApp/iosApp
diff options
context:
space:
mode:
Diffstat (limited to 'iosApp/iosApp')
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/Contents.json21
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/map_report_end.svg11
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/Contents.json21
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/map_report_position.svg11
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/Contents.json21
-rw-r--r--iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/map_report_start.svg11
-rw-r--r--iosApp/iosApp/Details/Reports/UnitReportsView.swift76
-rw-r--r--iosApp/iosApp/Map/MapViewController.swift10
-rw-r--r--iosApp/iosApp/Shared/MarkerTransformations.swift4
-rw-r--r--iosApp/iosApp/en.lproj/Localizable.strings24
-rw-r--r--iosApp/iosApp/es-419.lproj/Localizable.strings24
11 files changed, 225 insertions, 9 deletions
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/Contents.json b/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/Contents.json
new file mode 100644
index 0000000..40c489c
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "map_report_end.svg",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/map_report_end.svg b/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/map_report_end.svg
new file mode 100644
index 0000000..ec134ba
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportEnd.imageset/map_report_end.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24">
+ <path
+ fill="#008000"
+ d="M12.36,6H7v6h7.24l0.4,2H18V8h-5.24z"/>
+ <path
+ fill="@android:color/black"
+ d="M14.4,6L14,4L5,4v17h2v-7h5.6l0.4,2h7L20,6h-5.6zM18,14h-3.36l-0.4,-2L7,12L7,6h5.36l0.4,2L18,8v6z"/>
+</svg>
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/Contents.json b/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/Contents.json
new file mode 100644
index 0000000..3a7979a
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "map_report_position.svg",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/map_report_position.svg b/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/map_report_position.svg
new file mode 100644
index 0000000..c6d39ac
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportPosition.imageset/map_report_position.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24">
+ <path
+ fill="#008000"
+ d="M12,18c3.31,0 6,-2.69 6,-6s-2.69,-6 -6,-6 -6,2.69 -6,6 2.69,6 6,6z"/>
+ <path
+ fill="@android:color/black"
+ d="M12,20c4.42,0 8,-3.58 8,-8s-3.58,-8 -8,-8 -8,3.58 -8,8 3.58,8 8,8zM12,6c3.31,0 6,2.69 6,6s-2.69,6 -6,6 -6,-2.69 -6,-6 2.69,-6 6,-6z"/>
+</svg>
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/Contents.json b/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/Contents.json
new file mode 100644
index 0000000..3a1438a
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "map_report_start.svg",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/map_report_start.svg b/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/map_report_start.svg
new file mode 100644
index 0000000..59a6142
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/MapReportStart.imageset/map_report_start.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24">
+ <path
+ fill="#008000"
+ d="M12,20c4.41,0 8,-3.59 8,-8s-3.59,-8 -8,-8 -8,3.59 -8,8 3.59,8 8,8zM10,7.5l6,4.5 -6,4.5v-9z"/>
+ <path
+ fill="@android:color/black"
+ d="M12,22c5.52,0 10,-4.48 10,-10S17.52,2 12,2 2,6.48 2,12s4.48,10 10,10zM12,4c4.41,0 8,3.59 8,8s-3.59,8 -8,8 -8,-3.59 -8,-8 3.59,-8 8,-8zM10,7.5v9l6,-4.5z"/>
+</svg>
diff --git a/iosApp/iosApp/Details/Reports/UnitReportsView.swift b/iosApp/iosApp/Details/Reports/UnitReportsView.swift
index b73c9e7..1ca1a87 100644
--- a/iosApp/iosApp/Details/Reports/UnitReportsView.swift
+++ b/iosApp/iosApp/Details/Reports/UnitReportsView.swift
@@ -18,6 +18,9 @@
import SwiftUI
import shared
import SwiftUIX
+import Tabler
+
+extension EventInformation: Identifiable {}
struct UnitReportsView: View {
@StateObject var unitReportsViewModel: UnitReportsViewModel
@@ -30,12 +33,77 @@ struct UnitReportsView: View {
wrappedValue: UnitReportsViewModel(deviceId: unit.device.id))
}
+ private var eventsGridItems: [GridItem] = [
+ GridItem(.flexible(), alignment: .leading),
+ GridItem(.flexible(), alignment: .leading),
+ GridItem(.flexible(), alignment: .leading),
+ GridItem(.flexible(), alignment: .leading),
+ ]
+
+ @ViewBuilder
+ private func eventsHeader(_ ctx: TablerSortContext<EventInformation>) -> some View {
+ Text("events-table-datetime")
+ Text("events-table-event")
+ Text("events-table-geofence")
+ Text("events-table-address")
+ }
+
+ @ViewBuilder
+ private func eventsRow(_ element: EventInformation) -> some View {
+ if let eventTime = element.event.eventTime {
+ Text(Formatter.companion.formatDate(str: eventTime))
+ } else { Text("") }
+
+ if let eventType = element.event.type {
+ switch EventInformation.companion.stringToReportType(s: eventType) {
+ case .deviceOnline: Text("event-device-online")
+ case .deviceUnknown: Text("event-device-unknown")
+ case .deviceOffline: Text("event-device-offline")
+ case .deviceInactive: Text("event-device-inactive")
+ case .deviceMoving: Text("event-device-moving")
+ case .deviceStopped: Text("event-device-stopped")
+ case .deviceOverspeed: Text("event-device-overspeed")
+ case .deviceFuelDrop: Text("event-device-fuel-drop")
+ case .commandResult: Text("event-command-result")
+ case .geofenceEnter: Text("event-geofence-enter")
+ case .geofenceExit: Text("event-geofence-exit")
+ case .alarm: Text("event-alarm")
+ case .ignitionOn: Text("event-ignition-on")
+ case .ignitionOff: Text("event-ignition-off")
+ case .maintenance: Text("event-maintenance")
+ case .textMessage: Text("event-text-message")
+ case .driverChanged: Text("event-driver-changed")
+ default: Text("event-unknown")
+ }
+ } else { Text("") }
+
+ if let geofenceName = element.geofence?.name {
+ Text(geofenceName)
+ } else { Text("") }
+
+ if let positionAddress = element.position?.address {
+ Text(positionAddress)
+ } else { Text("") }
+ }
+
var body: some View {
VStack {
- MapView(layer: $unitReportsViewModel.layer,
- markers: $unitReportsViewModel.markers,
- selected: $unitReportsViewModel.selectedMarker,
- isReport: true)
+ if unitReportsViewModel.reportType == .events {
+ if let report = unitReportsViewModel.report as? ReportController.ReportEventsReport {
+ TablerList(TablerListConfig<EventInformation>(gridItems: eventsGridItems),
+ headerContent: eventsHeader,
+ rowContent: eventsRow,
+ results: report.events)
+ } else {
+ Spacer()
+ }
+ } else {
+ MapView(layer: $unitReportsViewModel.layer,
+ markers: $unitReportsViewModel.markers,
+ selected: $unitReportsViewModel.selectedMarker,
+ isReport: true)
+ }
+
VStack {
HStack {
Text("report-period")
diff --git a/iosApp/iosApp/Map/MapViewController.swift b/iosApp/iosApp/Map/MapViewController.swift
index 2b4c7d4..f068bf4 100644
--- a/iosApp/iosApp/Map/MapViewController.swift
+++ b/iosApp/iosApp/Map/MapViewController.swift
@@ -205,13 +205,13 @@ class OurMaplyViewController: MaplyViewController {
}
let fontSize = 11.0
- let colorReport = UIColor.green
+ let colorReport = UIColor(red: 0.0, green: 0.5, blue: 0.0, alpha: 1.0)
let colorLabel = UIColor.secondaryLabel
let colorLabelOutline = UIColor.systemBackground
let vectorDesc: [AnyHashable : Any] = [
kMaplyColor: colorReport,
- kMaplyVecWidth: 10.0,
+ kMaplyVecWidth: 15.0,
kMaplyWideVecImpl: kMaplyWideVecImplPerf
]
@@ -233,7 +233,7 @@ class OurMaplyViewController: MaplyViewController {
// For reports, position, start and end icons must be different
switch i {
case markers.startIndex: type = .reportStart
- case markers.endIndex: type = .reportEnd
+ case markers.endIndex - 1: type = .reportEnd
default: type = .reportPosition
}
} else {
@@ -246,8 +246,8 @@ class OurMaplyViewController: MaplyViewController {
// For reports, position, start and end sizes must be different
switch i {
case markers.startIndex: size = 50.0
- case markers.endIndex: size = 50.0
- default: size = 25.0
+ case markers.endIndex - 1: size = 50.0
+ default: size = 26.0
}
}
screenMarker.size = CGSize(width: size, height: size)
diff --git a/iosApp/iosApp/Shared/MarkerTransformations.swift b/iosApp/iosApp/Shared/MarkerTransformations.swift
index 2e71980..1e51907 100644
--- a/iosApp/iosApp/Shared/MarkerTransformations.swift
+++ b/iosApp/iosApp/Shared/MarkerTransformations.swift
@@ -42,6 +42,10 @@ class MarkerTransformations {
case .trolleybus: imageName = "MapTrolleybus"
case .truck: imageName = "MapTruck"
case .van: imageName = "MapVan"
+
+ case .reportStart: imageName = "MapReportStart"
+ case .reportPosition: imageName = "MapReportPosition"
+ case .reportEnd: imageName = "MapReportEnd"
default: break
}
return imageName
diff --git a/iosApp/iosApp/en.lproj/Localizable.strings b/iosApp/iosApp/en.lproj/Localizable.strings
index 56a934b..fee132b 100644
--- a/iosApp/iosApp/en.lproj/Localizable.strings
+++ b/iosApp/iosApp/en.lproj/Localizable.strings
@@ -68,6 +68,30 @@
"period-this-month" = "Month";
"period-last-30" = "Last 30d";
+"events-table-event" = "Event";
+"events-table-datetime" = "Datetime";
+"events-table-geofence" = "Geofence";
+"events-table-address" = "Address";
+
+"event-device-online" = "Status online";
+"event-device-unknown" = "Status unknown";
+"event-device-offline" = "Status offline";
+"event-device-inactive" = "Device inactive";
+"event-device-moving" = "Device moving";
+"event-device-stopped" = "Device stopped";
+"event-device-overspeed" = "Speed limit exceeded";
+"event-device-fuel-drop" = "Fuel drop";
+"event-command-result" = "Command result";
+"event-geofence-enter" = "Geofence entered";
+"event-geofence-exit" = "Geofence exited";
+"event-alarm" = "Alarm";
+"event-ignition-on" = "Ignition on";
+"event-ignition-off" = "Ignition off";
+"event-maintenance" = "Maintenance required";
+"event-text-message" = "Text message received";
+"event-driver-changed" = "Driver changed";
+"event-unknown" = "Unknown event";
+
"send-command" = "Send command";
"send-command-confirm" = "Are you sure you want to send the command?";
diff --git a/iosApp/iosApp/es-419.lproj/Localizable.strings b/iosApp/iosApp/es-419.lproj/Localizable.strings
index eae03df..0105e5d 100644
--- a/iosApp/iosApp/es-419.lproj/Localizable.strings
+++ b/iosApp/iosApp/es-419.lproj/Localizable.strings
@@ -68,6 +68,30 @@
"period-this-month" = "Mes";
"period-last-30" = "Últimos 30d";
+"events-table-event" = "Evento";
+"events-table-datetime" = "Fecha y hora";
+"events-table-geofence" = "Geocerca";
+"events-table-address" = "Dirección";
+
+"event-device-online" = "Unidad en línea";
+"event-device-unknown" = "Unidad en estado desconocido";
+"event-device-offline" = "Unidad fuera de línea";
+"event-device-inactive" = "Unidad inactiva";
+"event-device-moving" = "Unidad en movimiento";
+"event-device-stopped" = "Unidad detenida";
+"event-device-overspeed" = "Excedido el límite de velocidad";
+"event-device-fuel-drop" = "Pérdida de combustible";
+"event-command-result" = "Resultado del comando";
+"event-geofence-enter" = "Entrada en la geocerca";
+"event-geofence-exit" = "Salida de la geocerca";
+"event-alarm" = "Alarma";
+"event-ignition-on" = "Ignición encendida";
+"event-ignition-off" = "Ignición apagada";
+"event-maintenance" = "Se requiere mantenimiento";
+"event-text-message" = "Mensaje de texto recibido";
+"event-driver-changed" = "El conductor ha cambiado";
+"event-unknown" = "Evento desconocido";
+
"send-command" = "Enviar comando";
"send-command-confirm" = "¿Está seguro que desea enviar el comando?";