diff --git a/backend/src/model/custom_label.rs b/backend/src/model/custom_label.rs index 5e2b76c..2fc6533 100644 --- a/backend/src/model/custom_label.rs +++ b/backend/src/model/custom_label.rs @@ -1,6 +1,5 @@ use crate::db; use serde::{Deserialize, Serialize}; -use sqlx::Row; #[derive(sqlx::FromRow, Serialize, Deserialize)] pub struct CustomLabel { diff --git a/backend/src/model/register.rs b/backend/src/model/register.rs index 4138827..4ec2634 100644 --- a/backend/src/model/register.rs +++ b/backend/src/model/register.rs @@ -16,6 +16,7 @@ pub struct RegisterCreate { date: String, /// Foreign key to the custom_label table custom_label: String, + is_preview: bool, } impl RegisterCreate { @@ -57,7 +58,7 @@ impl RegisterCreate { current_date, self.date, custom_label_id, - false, + self.is_preview, self.person_id, self.course_id ) diff --git a/frontend/src/certs/NewRegister/ManualRegistration.tsx b/frontend/src/certs/NewRegister/ManualRegistration.tsx index 7fbeead..4804e9e 100644 --- a/frontend/src/certs/NewRegister/ManualRegistration.tsx +++ b/frontend/src/certs/NewRegister/ManualRegistration.tsx @@ -18,6 +18,7 @@ export function ManualRegistration(props: { const [selectedCourseId, seSelectedCourseId] = createSignal(null); const [customLabel, setCustomLabel] = createSignal(""); + const [isPreview, setIsPreview] = createSignal(false); let datePicker: HTMLInputElement | undefined; @@ -68,6 +69,7 @@ export function ManualRegistration(props: { courseId: subject, date, customLabel: customLabel(), + is_preview: isPreview(), }; props.onAdd(data); @@ -86,7 +88,7 @@ export function ManualRegistration(props: { /> -
+
- +
+ setIsPreview(ev.target.checked)} + checked={isPreview()} + type="checkbox" + name="is_preview" + id="manual-is-preview" + /> + +
diff --git a/frontend/src/certs/NewRegister/RegisterPresets.tsx b/frontend/src/certs/NewRegister/RegisterPresets.tsx index b5f6cf0..206f3ff 100644 --- a/frontend/src/certs/NewRegister/RegisterPresets.tsx +++ b/frontend/src/certs/NewRegister/RegisterPresets.tsx @@ -46,6 +46,7 @@ export function RegisterPresets(props: { }) { let datePicker: HTMLInputElement | undefined; const [selectedPreset, setSelectedPreset] = createSignal("None"); + const [isPreview, setIsPreview] = createSignal(false); const [error, setError] = createSignal(""); const presets = genPresets(); @@ -86,6 +87,7 @@ export function RegisterPresets(props: { courseId, date: dateYYYYMMDD, customLabel: "", + is_preview: isPreview(), }); // Substract current date for the next course @@ -112,7 +114,7 @@ export function RegisterPresets(props: {
-
+
Fecha
+
+ setIsPreview(ev.target.checked)} + checked={isPreview()} + type="checkbox" + name="is_preview" + id="preset-is-preview" + /> + +
, await wait(2000); - const registers: RegisterBatchCreate = props.selections.map(({courseId, date, customLabel}) => ({ + const registers: RegisterBatchCreate = props.selections.map(({courseId, date, customLabel, is_preview}) => ({ person_id: props.personId!, course_id: courseId, date, custom_label: customLabel, + is_preview, })); const result = await createRegisters(registers); @@ -50,12 +52,13 @@ export function RegisterPreview(props: {selections: Array,

Confirmar registro

- {({courseId, date, customLabel}) => ( + {({courseId, date, customLabel, is_preview}) => ( )} @@ -74,23 +77,38 @@ export function RegisterPreview(props: {selections: Array, ); } -function Register(props: {courseId: number, date: string, customLabel: string, onDelete: (v: number) => void}) { +function Register(props: { + courseId: number, + date: string, + customLabel: string, + onDelete: (v: number) => void, + isPreview: boolean, + }) { const courseName = () => { const courses = allCourses(); return courses.find((course) => course.course_id === props.courseId)?.course_name ?? `Curso invalido! (${props.courseId})`; }; return ( -
- {courseName()} - {isoDateToLocalDate(props.date)} +
+ + + + + {courseName()} + + + {isoDateToLocalDate(props.date)} + - {props.customLabel} + + {props.customLabel} +
); } diff --git a/frontend/src/certs/NewRegister/index.tsx b/frontend/src/certs/NewRegister/index.tsx index 159c78f..20f58a1 100644 --- a/frontend/src/certs/NewRegister/index.tsx +++ b/frontend/src/certs/NewRegister/index.tsx @@ -11,6 +11,7 @@ export type RegistrationPreview = { courseId: number, date: string, customLabel: string, + is_preview: boolean, } export function NewRegister(props: { @@ -32,7 +33,7 @@ export function NewRegister(props: { -
+
setSelections((x) => [...x, v])} diff --git a/frontend/src/certs/Registers/index.tsx b/frontend/src/certs/Registers/index.tsx index 34e4fa7..e969184 100644 --- a/frontend/src/certs/Registers/index.tsx +++ b/frontend/src/certs/Registers/index.tsx @@ -1,4 +1,4 @@ -import { For, Show, createEffect, createMemo, createSignal } from "solid-js"; +import { For, Match, Show, createEffect, createMemo, createSignal } from "solid-js"; import { Person } from "../../types/Person"; import { Register } from "../../types/Register"; import { courseMap } from "../../utils/allCourses"; @@ -180,18 +180,6 @@ function RegisterEl(props: {register: Register, person: Person, onClick: () => v return (
- {/* -
- - - -
- */}

v  

-

- {displayDate()} -  -  - {props.register.register_code} +

+ + {displayDate()} + + + + +  sin firmas + + + + +  - {props.register.register_code} + +