[FE] Fixes #7 - Set tab title to the current person name
This commit is contained in:
parent
34b6aab6b7
commit
c78dbf479f
@ -5,7 +5,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" />
|
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" />
|
||||||
<title>EEGSAC - internal tool</title>
|
<title>EEGSAC - Sistema interno</title>
|
||||||
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
@ -24,6 +24,15 @@ export function Search(props: {setPerson: (p: Person | null) => void}) {
|
|||||||
const [person, setPerson] = createSignal<Person | null>(null);
|
const [person, setPerson] = createSignal<Person | null>(null);
|
||||||
const [manualCreate, setManualCreate] = createSignal(false);
|
const [manualCreate, setManualCreate] = createSignal(false);
|
||||||
|
|
||||||
|
// Change tab title
|
||||||
|
createEffect(() => {
|
||||||
|
if (person() === null) {
|
||||||
|
document.title = "EEGSAC - Sistema interno";
|
||||||
|
} else {
|
||||||
|
document.title = `${person()!.person_names} ${person()!.person_paternal_surname} ${person()!.person_maternal_surname}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Update QR and automatically search when DNI is changed
|
// Update QR and automatically search when DNI is changed
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const dniT = dni();
|
const dniT = dni();
|
||||||
@ -61,7 +70,7 @@ export function Search(props: {setPerson: (p: Person | null) => void}) {
|
|||||||
setPerson(response.data.Ok);
|
setPerson(response.data.Ok);
|
||||||
props.setPerson(response.data.Ok);
|
props.setPerson(response.data.Ok);
|
||||||
} else {
|
} else {
|
||||||
setError(response.data.Err.reason);
|
setError(response.data.Error.reason);
|
||||||
setManualCreate(false);
|
setManualCreate(false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user