Colocar el nombre de la Facultad/Carrera en el Resumen de la creación de los planes
fix #56: Ya se muestra el nombre de la facultad y de la carrera.
This commit is contained in:
@@ -34,7 +34,7 @@ export function PasoBasicosForm({
|
|||||||
const estructurasPlanList = catalogos?.estructurasPlan ?? []
|
const estructurasPlanList = catalogos?.estructurasPlan ?? []
|
||||||
|
|
||||||
const filteredCarreras = rawCarreras.filter((c: any) => {
|
const filteredCarreras = rawCarreras.filter((c: any) => {
|
||||||
const facId = wizard.datosBasicos.facultadId
|
const facId = wizard.datosBasicos.facultad.id
|
||||||
if (!facId) return true
|
if (!facId) return true
|
||||||
// soportar ambos shapes: `facultad_id` (BD) o `facultadId` (local)
|
// soportar ambos shapes: `facultad_id` (BD) o `facultadId` (local)
|
||||||
return c.facultad_id ? c.facultad_id === facId : c.facultadId === facId
|
return c.facultad_id ? c.facultad_id === facId : c.facultadId === facId
|
||||||
@@ -68,15 +68,20 @@ export function PasoBasicosForm({
|
|||||||
<div className="grid gap-1">
|
<div className="grid gap-1">
|
||||||
<Label htmlFor="facultad">Facultad</Label>
|
<Label htmlFor="facultad">Facultad</Label>
|
||||||
<Select
|
<Select
|
||||||
value={wizard.datosBasicos.facultadId}
|
value={wizard.datosBasicos.facultad.id}
|
||||||
onValueChange={(value) =>
|
onValueChange={(value) =>
|
||||||
onChange(
|
onChange(
|
||||||
(w): NewPlanWizardState => ({
|
(w): NewPlanWizardState => ({
|
||||||
...w,
|
...w,
|
||||||
datosBasicos: {
|
datosBasicos: {
|
||||||
...w.datosBasicos,
|
...w.datosBasicos,
|
||||||
facultadId: value,
|
facultad: {
|
||||||
carreraId: '',
|
id: value,
|
||||||
|
nombre:
|
||||||
|
facultadesList.find((f) => f.id === value)?.nombre ||
|
||||||
|
'',
|
||||||
|
},
|
||||||
|
carrera: { id: '', nombre: '' },
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@@ -86,7 +91,7 @@ export function PasoBasicosForm({
|
|||||||
id="facultad"
|
id="facultad"
|
||||||
className={cn(
|
className={cn(
|
||||||
'w-full min-w-0 [&>span]:block! [&>span]:truncate!',
|
'w-full min-w-0 [&>span]:block! [&>span]:truncate!',
|
||||||
!wizard.datosBasicos.facultadId
|
!wizard.datosBasicos.facultad.id
|
||||||
? 'text-muted-foreground font-normal italic opacity-70' // Es Placeholder
|
? 'text-muted-foreground font-normal italic opacity-70' // Es Placeholder
|
||||||
: 'font-medium not-italic', // Tiene Valor (Medium)
|
: 'font-medium not-italic', // Tiene Valor (Medium)
|
||||||
)}
|
)}
|
||||||
@@ -106,22 +111,30 @@ export function PasoBasicosForm({
|
|||||||
<div className="grid gap-1">
|
<div className="grid gap-1">
|
||||||
<Label htmlFor="carrera">Carrera</Label>
|
<Label htmlFor="carrera">Carrera</Label>
|
||||||
<Select
|
<Select
|
||||||
value={wizard.datosBasicos.carreraId}
|
value={wizard.datosBasicos.carrera.id}
|
||||||
onValueChange={(value) =>
|
onValueChange={(value) =>
|
||||||
onChange(
|
onChange(
|
||||||
(w): NewPlanWizardState => ({
|
(w): NewPlanWizardState => ({
|
||||||
...w,
|
...w,
|
||||||
datosBasicos: { ...w.datosBasicos, carreraId: value },
|
datosBasicos: {
|
||||||
|
...w.datosBasicos,
|
||||||
|
carrera: {
|
||||||
|
id: value,
|
||||||
|
nombre:
|
||||||
|
filteredCarreras.find((c) => c.id === value)?.nombre ||
|
||||||
|
'',
|
||||||
|
},
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
disabled={!wizard.datosBasicos.facultadId}
|
disabled={!wizard.datosBasicos.facultad.id}
|
||||||
>
|
>
|
||||||
<SelectTrigger
|
<SelectTrigger
|
||||||
id="carrera"
|
id="carrera"
|
||||||
className={cn(
|
className={cn(
|
||||||
'w-full min-w-0 [&>span]:block! [&>span]:truncate!',
|
'w-full min-w-0 [&>span]:block! [&>span]:truncate!',
|
||||||
!wizard.datosBasicos.carreraId
|
!wizard.datosBasicos.carrera.id
|
||||||
? 'text-muted-foreground font-normal italic opacity-70' // Es Placeholder
|
? 'text-muted-foreground font-normal italic opacity-70' // Es Placeholder
|
||||||
: 'font-medium not-italic', // Tiene Valor (Medium)
|
: 'font-medium not-italic', // Tiene Valor (Medium)
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ export function PasoResumenCard({ wizard }: { wizard: NewPlanWizardState }) {
|
|||||||
Facultad/Carrera:{' '}
|
Facultad/Carrera:{' '}
|
||||||
</span>
|
</span>
|
||||||
<span className="font-medium">
|
<span className="font-medium">
|
||||||
{wizard.datosBasicos.facultadId || '—'} /{' '}
|
{wizard.datosBasicos.facultad.nombre || '—'} /{' '}
|
||||||
{wizard.datosBasicos.carreraId || '—'}
|
{wizard.datosBasicos.carrera.nombre || '—'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ export function WizardControls({
|
|||||||
const aiInput = {
|
const aiInput = {
|
||||||
datosBasicos: {
|
datosBasicos: {
|
||||||
nombrePlan: wizard.datosBasicos.nombrePlan,
|
nombrePlan: wizard.datosBasicos.nombrePlan,
|
||||||
carreraId: wizard.datosBasicos.carreraId,
|
carreraId: wizard.datosBasicos.carrera.id || undefined,
|
||||||
facultadId: wizard.datosBasicos.facultadId || undefined,
|
facultadId: wizard.datosBasicos.facultad.id || undefined,
|
||||||
nivel: wizard.datosBasicos.nivel as string,
|
nivel: wizard.datosBasicos.nivel as string,
|
||||||
tipoCiclo: tipoCicloSafe,
|
tipoCiclo: tipoCicloSafe,
|
||||||
numCiclos: numCiclosSafe,
|
numCiclos: numCiclosSafe,
|
||||||
@@ -90,7 +90,7 @@ export function WizardControls({
|
|||||||
if (wizard.tipoOrigen === 'MANUAL') {
|
if (wizard.tipoOrigen === 'MANUAL') {
|
||||||
// Crear plan vacío manualmente usando el hook
|
// Crear plan vacío manualmente usando el hook
|
||||||
const plan = await createPlanManual.mutateAsync({
|
const plan = await createPlanManual.mutateAsync({
|
||||||
carreraId: wizard.datosBasicos.carreraId,
|
carreraId: wizard.datosBasicos.carrera.id,
|
||||||
estructuraId: wizard.datosBasicos.estructuraPlanId as string,
|
estructuraId: wizard.datosBasicos.estructuraPlanId as string,
|
||||||
nombre: wizard.datosBasicos.nombrePlan,
|
nombre: wizard.datosBasicos.nombrePlan,
|
||||||
nivel: wizard.datosBasicos.nivel as NivelPlanEstudio,
|
nivel: wizard.datosBasicos.nivel as NivelPlanEstudio,
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ export function useNuevoPlanWizard() {
|
|||||||
tipoOrigen: null,
|
tipoOrigen: null,
|
||||||
datosBasicos: {
|
datosBasicos: {
|
||||||
nombrePlan: '',
|
nombrePlan: '',
|
||||||
carreraId: '',
|
facultad: { id: '', nombre: '' },
|
||||||
facultadId: '',
|
carrera: { id: '', nombre: '' },
|
||||||
nivel: '',
|
nivel: '',
|
||||||
tipoCiclo: '',
|
tipoCiclo: '',
|
||||||
numCiclos: undefined,
|
numCiclos: undefined,
|
||||||
@@ -53,8 +53,8 @@ export function useNuevoPlanWizard() {
|
|||||||
|
|
||||||
const canContinueDesdeBasicos =
|
const canContinueDesdeBasicos =
|
||||||
!!wizard.datosBasicos.nombrePlan &&
|
!!wizard.datosBasicos.nombrePlan &&
|
||||||
!!wizard.datosBasicos.carreraId &&
|
!!wizard.datosBasicos.carrera.id &&
|
||||||
!!wizard.datosBasicos.facultadId &&
|
!!wizard.datosBasicos.facultad.id &&
|
||||||
!!wizard.datosBasicos.nivel &&
|
!!wizard.datosBasicos.nivel &&
|
||||||
wizard.datosBasicos.numCiclos !== undefined &&
|
wizard.datosBasicos.numCiclos !== undefined &&
|
||||||
wizard.datosBasicos.numCiclos > 0 &&
|
wizard.datosBasicos.numCiclos > 0 &&
|
||||||
|
|||||||
@@ -19,8 +19,14 @@ export type NewPlanWizardState = {
|
|||||||
tipoOrigen: TipoOrigen | null
|
tipoOrigen: TipoOrigen | null
|
||||||
datosBasicos: {
|
datosBasicos: {
|
||||||
nombrePlan: string
|
nombrePlan: string
|
||||||
carreraId: string
|
facultad: {
|
||||||
facultadId: string
|
id: string
|
||||||
|
nombre: string
|
||||||
|
}
|
||||||
|
carrera: {
|
||||||
|
id: string
|
||||||
|
nombre: string
|
||||||
|
}
|
||||||
nivel: NivelPlanEstudio | ''
|
nivel: NivelPlanEstudio | ''
|
||||||
tipoCiclo: TipoCiclo | ''
|
tipoCiclo: TipoCiclo | ''
|
||||||
numCiclos: number | undefined
|
numCiclos: number | undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user