Fix iOS build errors - Update TaskDetail model usage for Double cost fields
Fixed type conversion issues in iOS Swift files to handle KotlinDouble for cost fields instead of String. Updated all task-related views to properly convert between String (for TextField input) and KotlinDouble (for API calls). Changes: - TaskCard.swift: Updated preview data with new TaskDetail signature (added residenceName, createdBy, createdByUsername, intervalDays; changed estimatedCost from String to Double; removed actualCost and notes) - TasksSection.swift: Updated two preview TaskDetail instances with new signature - CompleteTaskView.swift: Convert actualCost String to KotlinDouble for API - EditTaskView.swift: Convert estimatedCost between KotlinDouble and String for display and API calls - TaskFormView.swift: Convert estimatedCost String to KotlinDouble for API Pattern used: - Display: KotlinDouble -> String using .doubleValue - API: String -> Double -> KotlinDouble using KotlinDouble(double:) Build now succeeds with all type conversions properly handling Decimal/Double values from backend instead of String. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -258,6 +258,9 @@ struct TaskCard: View {
|
||||
task: TaskDetail(
|
||||
id: 1,
|
||||
residence: 1,
|
||||
residenceName: "Main House",
|
||||
createdBy: 1,
|
||||
createdByUsername: "testuser",
|
||||
title: "Clean Gutters",
|
||||
description: "Remove all debris from gutters",
|
||||
category: TaskCategory(id: 1, name: "maintenance", orderId: 0, description: ""),
|
||||
@@ -265,9 +268,8 @@ struct TaskCard: View {
|
||||
frequency: TaskFrequency(id: 1, name: "monthly", lookupName: "", displayName: "30", daySpan: 0, notifyDays: 0),
|
||||
status: TaskStatus(id: 1, name: "pending", displayName: "", orderId: 0, description: ""),
|
||||
dueDate: "2024-12-15",
|
||||
estimatedCost: "150.00",
|
||||
actualCost: nil,
|
||||
notes: nil,
|
||||
intervalDays: 30,
|
||||
estimatedCost: 150.00,
|
||||
archived: false,
|
||||
createdAt: "2024-01-01T00:00:00Z",
|
||||
updatedAt: "2024-01-01T00:00:00Z",
|
||||
|
||||
@@ -81,6 +81,9 @@ struct TasksSection: View {
|
||||
TaskDetail(
|
||||
id: 1,
|
||||
residence: 1,
|
||||
residenceName: "Main House",
|
||||
createdBy: 1,
|
||||
createdByUsername: "testuser",
|
||||
title: "Clean Gutters",
|
||||
description: "Remove all debris",
|
||||
category: TaskCategory(id: 1, name: "maintenance", orderId: 1, description: ""),
|
||||
@@ -88,9 +91,8 @@ struct TasksSection: View {
|
||||
frequency: TaskFrequency(id: 1, name: "monthly", lookupName: "", displayName: "Monthly", daySpan: 0, notifyDays: 0),
|
||||
status: TaskStatus(id: 1, name: "pending", displayName: "Pending", orderId: 1, description: ""),
|
||||
dueDate: "2024-12-15",
|
||||
estimatedCost: "150.00",
|
||||
actualCost: nil,
|
||||
notes: nil,
|
||||
intervalDays: 30,
|
||||
estimatedCost: 150.00,
|
||||
archived: false,
|
||||
createdAt: "2024-01-01T00:00:00Z",
|
||||
updatedAt: "2024-01-01T00:00:00Z",
|
||||
@@ -111,6 +113,9 @@ struct TasksSection: View {
|
||||
TaskDetail(
|
||||
id: 2,
|
||||
residence: 1,
|
||||
residenceName: "Main House",
|
||||
createdBy: 1,
|
||||
createdByUsername: "testuser",
|
||||
title: "Fix Leaky Faucet",
|
||||
description: "Kitchen sink fixed",
|
||||
category: TaskCategory(id: 2, name: "plumbing", orderId: 1, description: ""),
|
||||
@@ -118,9 +123,8 @@ struct TasksSection: View {
|
||||
frequency: TaskFrequency(id: 6, name: "once", lookupName: "", displayName: "One Time", daySpan: 0, notifyDays: 0),
|
||||
status: TaskStatus(id: 3, name: "completed", displayName: "Completed", orderId: 1, description: ""),
|
||||
dueDate: "2024-11-01",
|
||||
estimatedCost: "200.00",
|
||||
actualCost: nil,
|
||||
notes: nil,
|
||||
intervalDays: nil,
|
||||
estimatedCost: 200.00,
|
||||
archived: false,
|
||||
createdAt: "2024-10-01T00:00:00Z",
|
||||
updatedAt: "2024-11-05T00:00:00Z",
|
||||
|
||||
@@ -308,7 +308,7 @@ struct CompleteTaskView: View {
|
||||
completedByEmail: "",
|
||||
companyName: selectedContractor?.company ?? "",
|
||||
completionDate: currentDate,
|
||||
actualCost: actualCost.isEmpty ? nil : actualCost,
|
||||
actualCost: actualCost.isEmpty ? nil : KotlinDouble(double: Double(actualCost) ?? 0.0),
|
||||
notes: notes.isEmpty ? nil : notes,
|
||||
rating: KotlinInt(int: Int32(rating))
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@ struct EditTaskView: View {
|
||||
_selectedPriority = State(initialValue: task.priority)
|
||||
_selectedStatus = State(initialValue: task.status)
|
||||
_dueDate = State(initialValue: task.dueDate ?? "")
|
||||
_estimatedCost = State(initialValue: task.estimatedCost ?? "")
|
||||
_estimatedCost = State(initialValue: task.estimatedCost != nil ? String(task.estimatedCost!.doubleValue) : "")
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
@@ -174,7 +174,7 @@ struct EditTaskView: View {
|
||||
priority: priority.id,
|
||||
status: KotlinInt(value: status.id),
|
||||
dueDate: dueDate,
|
||||
estimatedCost: estimatedCost.isEmpty ? nil : estimatedCost,
|
||||
estimatedCost: estimatedCost.isEmpty ? nil : KotlinDouble(double: Double(estimatedCost) ?? 0.0),
|
||||
archived: task.archived
|
||||
)
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ struct TaskFormView: View {
|
||||
priority: Int32(priority.id),
|
||||
status: selectedStatus.map { KotlinInt(value: $0.id) },
|
||||
dueDate: dueDateString,
|
||||
estimatedCost: estimatedCost.isEmpty ? nil : estimatedCost,
|
||||
estimatedCost: estimatedCost.isEmpty ? nil : KotlinDouble(double: Double(estimatedCost) ?? 0.0),
|
||||
archived: false
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user