mirror of
https://github.com/Xevion/r2park.git
synced 2025-12-10 22:08:11 -06:00
Properly acquire resident profile Id for VIP forms
This commit is contained in:
17
api.go
17
api.go
@@ -185,6 +185,7 @@ func GetForm(id uint) GetFormResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Validate that vehicleInformationVIP is actually real for non-VIP properties
|
||||||
// Get the resident profile
|
// Get the resident profile
|
||||||
nextButton := doc.Find("#vehicleInformationVIP").First()
|
nextButton := doc.Find("#vehicleInformationVIP").First()
|
||||||
residentProfileId, _ := nextButton.Attr("data-resident-profile-id")
|
residentProfileId, _ := nextButton.Attr("data-resident-profile-id")
|
||||||
@@ -236,11 +237,19 @@ func GetVipForm(id uint, guestCode string) GetFormResult {
|
|||||||
title := titleElement.Text()
|
title := titleElement.Text()
|
||||||
address := strings.TrimSpace(titleElement.Next().Text())
|
address := strings.TrimSpace(titleElement.Next().Text())
|
||||||
|
|
||||||
|
// Acquire the resident profile ID
|
||||||
|
nextButton := doc.Find("#vehicleInformationVIP").First()
|
||||||
|
residentProfileId, exists := nextButton.Attr("data-resident-profile-id")
|
||||||
|
if !exists {
|
||||||
|
return GetFormResult{err: errors.New("resident profile ID not found")}
|
||||||
|
}
|
||||||
|
|
||||||
return GetFormResult{
|
return GetFormResult{
|
||||||
propertyName: title,
|
propertyName: title,
|
||||||
address: address,
|
address: address,
|
||||||
fields: formFields,
|
fields: formFields,
|
||||||
hiddenInputs: hiddenInputs,
|
hiddenInputs: hiddenInputs,
|
||||||
|
residentProfileId: residentProfileId,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user