Merge pull request #60 from Hestia-Homes/engine-file-upload

passing scenario id instead of name
This commit is contained in:
KhalimCK 2025-07-21 23:05:39 +01:00 committed by GitHub
commit fb7dbd6b0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -198,6 +198,7 @@ export function useUploadCsvPlan({
goalValue,
housingType,
scenarioName,
scenarioId,
selectedSheet,
budget,
ashpCop,
@ -214,6 +215,7 @@ export function useUploadCsvPlan({
ashpCop: number;
housingType: string;
scenarioName: string;
scenarioId?: string | null;
selectedSheet: string;
measures: (typeof measuresList)[number][];
onSuccessRedirect: (path: string) => void;
@ -241,7 +243,7 @@ export function useUploadCsvPlan({
await uploadFileToS3({ presignedUrl: url, file });
const body = {
scenario_id: scenarioName === NEW_SENTINEL ? null : scenarioName,
scenario_id: scenarioName === NEW_SENTINEL ? null : scenarioId,
portfolio_id: portfolioId,
housing_type: housingType,
goal: goal,
@ -363,6 +365,7 @@ export default function UploadCsvModal({
budget: form.watch("budget") || null,
ashpCop: form.watch("ashpCop"),
scenarioName: form.watch("scenario"),
scenarioId: selectedScenario === NEW_SENTINEL ? null : selectedScenario,
measures: form.watch("measures"),
fileType: fileType,
fileFormat: fileFormat,
@ -657,53 +660,6 @@ export default function UploadCsvModal({
)}
/>
</div>
{/* <FormField
control={form.control}
name="cop"
render={({ field }) => (
<FormItem>
<FormLabel>Heat pump COP</FormLabel>
<FormControl>
<input
type="number"
step="0.1"
{...field}
disabled={selectedScenario !== "__new__"}
className={`w-full rounded-lg border ${
selectedScenario !== "__new__"
? "bg-gray-100"
: "bg-white"
} border-brandbrown px-4 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brandbrown`}
/>
</FormControl>
</FormItem>
)}
/> */}
{/* <FormField
control={form.control}
name="budget"
render={({ field }) => (
<FormItem>
<FormLabel>Budget (optional)</FormLabel>
<FormControl>
<input
type="text"
inputMode="decimal"
value={field.value ?? ""}
onChange={(e) =>
field.onChange(
e.target.value === ""
? null
: parseFloat(e.target.value)
)
}
/>
</FormControl>
</FormItem>
)}
/> */}
</>
)}