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(
|
task: TaskDetail(
|
||||||
id: 1,
|
id: 1,
|
||||||
residence: 1,
|
residence: 1,
|
||||||
|
residenceName: "Main House",
|
||||||
|
createdBy: 1,
|
||||||
|
createdByUsername: "testuser",
|
||||||
title: "Clean Gutters",
|
title: "Clean Gutters",
|
||||||
description: "Remove all debris from gutters",
|
description: "Remove all debris from gutters",
|
||||||
category: TaskCategory(id: 1, name: "maintenance", orderId: 0, description: ""),
|
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),
|
frequency: TaskFrequency(id: 1, name: "monthly", lookupName: "", displayName: "30", daySpan: 0, notifyDays: 0),
|
||||||
status: TaskStatus(id: 1, name: "pending", displayName: "", orderId: 0, description: ""),
|
status: TaskStatus(id: 1, name: "pending", displayName: "", orderId: 0, description: ""),
|
||||||
dueDate: "2024-12-15",
|
dueDate: "2024-12-15",
|
||||||
estimatedCost: "150.00",
|
intervalDays: 30,
|
||||||
actualCost: nil,
|
estimatedCost: 150.00,
|
||||||
notes: nil,
|
|
||||||
archived: false,
|
archived: false,
|
||||||
createdAt: "2024-01-01T00:00:00Z",
|
createdAt: "2024-01-01T00:00:00Z",
|
||||||
updatedAt: "2024-01-01T00:00:00Z",
|
updatedAt: "2024-01-01T00:00:00Z",
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ struct TasksSection: View {
|
|||||||
TaskDetail(
|
TaskDetail(
|
||||||
id: 1,
|
id: 1,
|
||||||
residence: 1,
|
residence: 1,
|
||||||
|
residenceName: "Main House",
|
||||||
|
createdBy: 1,
|
||||||
|
createdByUsername: "testuser",
|
||||||
title: "Clean Gutters",
|
title: "Clean Gutters",
|
||||||
description: "Remove all debris",
|
description: "Remove all debris",
|
||||||
category: TaskCategory(id: 1, name: "maintenance", orderId: 1, description: ""),
|
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),
|
frequency: TaskFrequency(id: 1, name: "monthly", lookupName: "", displayName: "Monthly", daySpan: 0, notifyDays: 0),
|
||||||
status: TaskStatus(id: 1, name: "pending", displayName: "Pending", orderId: 1, description: ""),
|
status: TaskStatus(id: 1, name: "pending", displayName: "Pending", orderId: 1, description: ""),
|
||||||
dueDate: "2024-12-15",
|
dueDate: "2024-12-15",
|
||||||
estimatedCost: "150.00",
|
intervalDays: 30,
|
||||||
actualCost: nil,
|
estimatedCost: 150.00,
|
||||||
notes: nil,
|
|
||||||
archived: false,
|
archived: false,
|
||||||
createdAt: "2024-01-01T00:00:00Z",
|
createdAt: "2024-01-01T00:00:00Z",
|
||||||
updatedAt: "2024-01-01T00:00:00Z",
|
updatedAt: "2024-01-01T00:00:00Z",
|
||||||
@@ -111,6 +113,9 @@ struct TasksSection: View {
|
|||||||
TaskDetail(
|
TaskDetail(
|
||||||
id: 2,
|
id: 2,
|
||||||
residence: 1,
|
residence: 1,
|
||||||
|
residenceName: "Main House",
|
||||||
|
createdBy: 1,
|
||||||
|
createdByUsername: "testuser",
|
||||||
title: "Fix Leaky Faucet",
|
title: "Fix Leaky Faucet",
|
||||||
description: "Kitchen sink fixed",
|
description: "Kitchen sink fixed",
|
||||||
category: TaskCategory(id: 2, name: "plumbing", orderId: 1, description: ""),
|
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),
|
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: ""),
|
status: TaskStatus(id: 3, name: "completed", displayName: "Completed", orderId: 1, description: ""),
|
||||||
dueDate: "2024-11-01",
|
dueDate: "2024-11-01",
|
||||||
estimatedCost: "200.00",
|
intervalDays: nil,
|
||||||
actualCost: nil,
|
estimatedCost: 200.00,
|
||||||
notes: nil,
|
|
||||||
archived: false,
|
archived: false,
|
||||||
createdAt: "2024-10-01T00:00:00Z",
|
createdAt: "2024-10-01T00:00:00Z",
|
||||||
updatedAt: "2024-11-05T00:00:00Z",
|
updatedAt: "2024-11-05T00:00:00Z",
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ struct CompleteTaskView: View {
|
|||||||
completedByEmail: "",
|
completedByEmail: "",
|
||||||
companyName: selectedContractor?.company ?? "",
|
companyName: selectedContractor?.company ?? "",
|
||||||
completionDate: currentDate,
|
completionDate: currentDate,
|
||||||
actualCost: actualCost.isEmpty ? nil : actualCost,
|
actualCost: actualCost.isEmpty ? nil : KotlinDouble(double: Double(actualCost) ?? 0.0),
|
||||||
notes: notes.isEmpty ? nil : notes,
|
notes: notes.isEmpty ? nil : notes,
|
||||||
rating: KotlinInt(int: Int32(rating))
|
rating: KotlinInt(int: Int32(rating))
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ struct EditTaskView: View {
|
|||||||
_selectedPriority = State(initialValue: task.priority)
|
_selectedPriority = State(initialValue: task.priority)
|
||||||
_selectedStatus = State(initialValue: task.status)
|
_selectedStatus = State(initialValue: task.status)
|
||||||
_dueDate = State(initialValue: task.dueDate ?? "")
|
_dueDate = State(initialValue: task.dueDate ?? "")
|
||||||
_estimatedCost = State(initialValue: task.estimatedCost ?? "")
|
_estimatedCost = State(initialValue: task.estimatedCost != nil ? String(task.estimatedCost!.doubleValue) : "")
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -174,7 +174,7 @@ struct EditTaskView: View {
|
|||||||
priority: priority.id,
|
priority: priority.id,
|
||||||
status: KotlinInt(value: status.id),
|
status: KotlinInt(value: status.id),
|
||||||
dueDate: dueDate,
|
dueDate: dueDate,
|
||||||
estimatedCost: estimatedCost.isEmpty ? nil : estimatedCost,
|
estimatedCost: estimatedCost.isEmpty ? nil : KotlinDouble(double: Double(estimatedCost) ?? 0.0),
|
||||||
archived: task.archived
|
archived: task.archived
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ struct TaskFormView: View {
|
|||||||
priority: Int32(priority.id),
|
priority: Int32(priority.id),
|
||||||
status: selectedStatus.map { KotlinInt(value: $0.id) },
|
status: selectedStatus.map { KotlinInt(value: $0.id) },
|
||||||
dueDate: dueDateString,
|
dueDate: dueDateString,
|
||||||
estimatedCost: estimatedCost.isEmpty ? nil : estimatedCost,
|
estimatedCost: estimatedCost.isEmpty ? nil : KotlinDouble(double: Double(estimatedCost) ?? 0.0),
|
||||||
archived: false
|
archived: false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user