diff --git a/src/app/due-considerations/page.tsx b/src/app/due-considerations/page.tsx index 3af9848..b4d8b31 100644 --- a/src/app/due-considerations/page.tsx +++ b/src/app/due-considerations/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useMemo, useState } from "react"; +import { useState } from "react"; import { SelectFolder } from "../components/due-considerations/SelectFolder"; import { Button } from "../shadcn_components/ui/button"; import { useSession } from "next-auth/react"; diff --git a/src/app/eco-spreadsheet/page.tsx b/src/app/eco-spreadsheet/page.tsx index e4d752f..acf2a23 100644 --- a/src/app/eco-spreadsheet/page.tsx +++ b/src/app/eco-spreadsheet/page.tsx @@ -1,11 +1,10 @@ "use client"; -import { useMemo, useState } from "react"; +import { useState } from "react"; import { SelectFolder } from "../components/due-considerations/SelectFolder"; import { Button } from "../shadcn_components/ui/button"; import { useSession } from "next-auth/react"; import { useMutation } from "@tanstack/react-query"; -import { Input } from "../shadcn_components/ui/input"; const Spinner = () => { return ( @@ -193,7 +192,7 @@ export default function EcoSpreadsheetHome() { setUploadMessage(""); } else { setUploadMessage( - "Please select the .xml, the epr and the ventilation and condition report" + "Please select the xml, the epr and the ventilation and condition report" ); setButtonDisabled(true); } @@ -203,6 +202,28 @@ export default function EcoSpreadsheetHome() { } } + function handleOnChangeExcel(e: React.ChangeEvent) { + if (e.target.files && e.target.files.length === 1) { + const ExcelfilesArray = Array.from(e.target.files); + const extensions = ExcelfilesArray.map((file) => + file.name.split(".").pop()?.toLowerCase() + ); + + if (extensions.includes("xlsx")) { + // Append the excel onto the existing files + // TODO + setFiles(); + setUploadMessage(""); + } else { + setUploadMessage("Please select the existing ECO spreadsheet excel"); + setButtonDisabled(true); + } + } else { + setUploadMessage("Please select exactly one Excel files"); + setButtonDisabled(true); + } + } + return (
@@ -212,10 +233,6 @@ export default function EcoSpreadsheetHome() {
  • EPR pdf
  • Ventilation and Condition pdf
  • -
    - Additionally, you can upload an optional ECO spreadsheet if you wish - to add new records to an already populated spreadsheet -
    Make sure these documents all relate to the same property @@ -225,6 +242,15 @@ export default function EcoSpreadsheetHome() {
    +
    + Additionally, you can upload an optional ECO Excel spreadsheet if you + wish to add new records to an already populated spreadsheet +
    + +
    + +
    +