import { FilledCard } from "../../components/FilledCard";
import { For } from "solid-js";
import { XIcon } from "../../icons/XIcon";
import { allCourses } from "../../utils/allCourses";
import { RegisterBatchCreate } from "../../types/Register";
function isoDateToLocalDate(date: string): string {
const [,month, day] = /\d{4}-(\d{2})-(\d{2})/.exec(date) ?? "";
return `${day}/${month}`;
}
export function RegisterPreview(props: {selections: Array<[number, string]>, personId: number | null, onDelete: (v: number) => void, onRegister: () => void}) {
const submit = async() => {
const registers: RegisterBatchCreate = props.selections.map(([courseId, date]) => ({
person_id: props.personId!,
course_id: courseId,
date,
}));
const result = await createRegisters(registers);
if (result === null) {
console.log("Create register: success");
} else {
console.log(`error. ${result}`);
}
props.onRegister();
};
return (
Confirmar registro