Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
add over2.8 tons toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
mltbnz committed Mar 26, 2023
1 parent f643a7e commit 02cb230
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 32 deletions.
8 changes: 6 additions & 2 deletions WegliKit/Sources/DescriptionFeature/DescriptionCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public struct DescriptionDomain: Reducer {
vehicleEmpty: Bool = false,
hazardLights: Bool = false,
expiredTuv: Bool = false,
expiredEco: Bool = false
expiredEco: Bool = false,
over28Tons: Bool = false
) {
self.licensePlateNumber = licensePlateNumber
self.selectedColor = selectedColor
Expand All @@ -36,6 +37,7 @@ public struct DescriptionDomain: Reducer {
self.hazardLights = hazardLights
self.expiredTuv = expiredTuv
self.expiredEco = expiredEco
self.over28Tons = over28Tons
}

public var carBrandSelection: CarBrandSelection.State
Expand All @@ -49,6 +51,7 @@ public struct DescriptionDomain: Reducer {
@BindingState public var hazardLights = false
@BindingState public var expiredTuv = false
@BindingState public var expiredEco = false
@BindingState public var over28Tons = false
@BindingState public var note = ""

@BindingState public var presentChargeSelection = false
Expand Down Expand Up @@ -200,7 +203,8 @@ public extension DescriptionDomain.State {
vehicleEmpty: model.vehicleEmpty ?? true,
hazardLights: model.hazardLights ?? false,
expiredTuv: model.expiredTuv ?? false,
expiredEco: model.expiredEco ?? false
expiredEco: model.expiredEco ?? false,
over28Tons: model.over28Tons ?? false
)
}
}
11 changes: 10 additions & 1 deletion WegliKit/Sources/DescriptionFeature/EditDescriptionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public struct EditDescriptionView: View {
expiredTuvView

expiredEcoView

overTwentyEightTonsView
} header: {
SectionHeader(text: L10n.Description.Section.Violation.copy)
}
Expand All @@ -68,7 +70,7 @@ public struct EditDescriptionView: View {
L10n.Description.Row.licenseplateNumber,
text: viewStore.binding(\.$licensePlateNumber)
)
.textFieldStyle(.roundedBorder)
.textFieldStyle(.plain)
.disableAutocorrection(true)
.textInputAutocapitalization(.characters)
}
Expand Down Expand Up @@ -200,6 +202,13 @@ public struct EditDescriptionView: View {
isOn: viewStore.binding(\.$expiredEco)
)
}

var overTwentyEightTonsView: some View {
ToggleButton(
label: "Fahrzeug über 2,8 t zulässige Gesamtmasse",
isOn: viewStore.binding(\.$over28Tons)
)
}
}

struct Description_Previews: PreviewProvider {
Expand Down
30 changes: 25 additions & 5 deletions WegliKit/Sources/NoticeListFeature/EditNoticeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,32 @@ struct EditNoticeView: View {
VStack(spacing: .grid(2)) {
licensePlateView
.padding(.bottom)

carBrandView
.padding(.bottom)

carColorView
.padding(.bottom)

chargeTypeView
.padding(.bottom)

chargeDurationView
.padding(.bottom)
blockedOthersView
vehicleEmptyView
hazardLightsView
expiredTuvView
expiredEcoView

VStack {
blockedOthersView

vehicleEmptyView

hazardLightsView

expiredTuvView

expiredEcoView

overTwentyEightTonsView
}
}
.foregroundColor(Color(uiColor: .label))
}
Expand Down Expand Up @@ -305,6 +318,13 @@ struct EditNoticeView: View {
isOn: viewStore.binding(\.description.$expiredEco)
)
}

var overTwentyEightTonsView: some View {
ToggleButton(
label: "Fahrzeug über 2,8 t zulässige Gesamtmasse",
isOn: viewStore.binding(\.description.$over28Tons)
)
}
}

struct SwiftUIView_Previews: PreviewProvider {
Expand Down
1 change: 1 addition & 0 deletions WegliKit/Sources/NoticeListFeature/NoticeListDomain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ extension Notice {
hazardLights: editState.description.hazardLights,
expiredTuv: editState.description.expiredTuv,
expiredEco: editState.description.expiredEco,
over28Tons: editState.description.over28Tons,
photos: editState.notice.photos ?? []
)
}
Expand Down
55 changes: 31 additions & 24 deletions WegliKit/Sources/ReportFeature/DescriptionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,37 @@ public struct DescriptionView: View {

row(title: L10n.Description.Row.length, content: viewStore.description.time)

toggleRow(
label: L10n.Description.Row.didBlockOthers,
value: viewStore.description.blockedOthers
)

toggleRow(
label: "Das Fahrzeug war verlassen",
value: viewStore.description.vehicleEmpty
)

toggleRow(
label: "Das Fahrzeug hatte die Warnblinkanlage aktiviert",
value: viewStore.description.hazardLights
)

toggleRow(
label: "Die TÜV-Plakette war abgelaufen",
value: viewStore.description.expiredTuv
)

toggleRow(
label: "Die Umwelt-Plakette fehlte oder war ungültig",
value: viewStore.description.expiredEco
)
VStack(alignment: .leading, spacing: .grid(3)) {
toggleRow(
label: L10n.Description.Row.didBlockOthers,
value: viewStore.description.blockedOthers
)

toggleRow(
label: "Das Fahrzeug war verlassen",
value: viewStore.description.vehicleEmpty
)

toggleRow(
label: "Das Fahrzeug hatte die Warnblinkanlage aktiviert",
value: viewStore.description.hazardLights
)

toggleRow(
label: "Die TÜV-Plakette war abgelaufen",
value: viewStore.description.expiredTuv
)

toggleRow(
label: "Die Umwelt-Plakette fehlte oder war ungültig",
value: viewStore.description.expiredEco
)

toggleRow(
label: "Fahrzeug über 2,8 t zulässige Gesamtmasse",
value: viewStore.description.over28Tons
)
}
}
.accessibilitySortPriority(1)
.accessibilityElement(children: .combine)
Expand Down
1 change: 1 addition & 0 deletions WegliKit/Sources/ReportFeature/ReportDomain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ public extension SharedModels.NoticeInput {
hazardLights: reportState.description.hazardLights,
expiredTuv: reportState.description.expiredTuv,
expiredEco: reportState.description.expiredEco,
over28Tons: reportState.description.over28Tons,
photos: []
)
}
Expand Down
3 changes: 3 additions & 0 deletions WegliKit/Sources/SharedModels/Notice/NoticeInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public struct NoticeInput: Codable, Equatable, Identifiable, Sendable {
public var hazardLights = false
public var expiredTuv = false
public var expiredEco = false
public var over28Tons = false
public var photos: [String]

public init(
Expand All @@ -50,6 +51,7 @@ public struct NoticeInput: Codable, Equatable, Identifiable, Sendable {
hazardLights: Bool = false,
expiredTuv: Bool = false,
expiredEco: Bool = false,
over28Tons: Bool = false,
photos: [String]
) {
self.token = token
Expand All @@ -74,6 +76,7 @@ public struct NoticeInput: Codable, Equatable, Identifiable, Sendable {
self.hazardLights = hazardLights
self.expiredTuv = expiredTuv
self.expiredEco = expiredEco
self.over28Tons = over28Tons
self.photos = photos
}
}

0 comments on commit 02cb230

Please sign in to comment.