46 lines
1.1 KiB
Swift
46 lines
1.1 KiB
Swift
//
|
|
// LocationEditScreen.swift
|
|
// AutoCat
|
|
//
|
|
// Created by Selim Mustafaev on 27.07.2024.
|
|
// Copyright © 2024 Selim Mustafaev. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
import AutoCatCore
|
|
|
|
struct LocationEditScreen: View {
|
|
|
|
@Environment(\.dismiss) var dismiss
|
|
|
|
@StateObject var viewModel: LocationEditViewModel
|
|
|
|
var body: some View {
|
|
List {
|
|
DatePicker("Date", selection: $viewModel.date)
|
|
.datePickerStyle(.compact)
|
|
TextRowView(title: "Location", value: viewModel.event.location)
|
|
.onTapGesture {
|
|
Task { await viewModel.pickLocation() }
|
|
}
|
|
}
|
|
.navigationTitle("Edit event")
|
|
.toolbar {
|
|
ToolbarItem(placement: .primaryAction) {
|
|
Button("Done") {
|
|
viewModel.done()
|
|
dismiss()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
|
|
var event = VehicleEventDto(lat: 25.54984, lon: 36.34857)
|
|
event.address = "Ул. Ленина, 123"
|
|
|
|
return LocationEditScreen(viewModel: .init(event: event))
|
|
}
|