anexado guardar en minio y cambios generales en la interfaz de osp
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
useMunicipalityQuery,
|
||||
useParishQuery,
|
||||
useStateQuery,
|
||||
} from '@/feactures/location/hooks/use-query-location';
|
||||
import { Badge } from '@repo/shadcn/badge';
|
||||
import { Button } from '@repo/shadcn/button';
|
||||
import {
|
||||
@@ -28,11 +33,6 @@ import {
|
||||
} from 'lucide-react';
|
||||
import React, { useState } from 'react';
|
||||
import { TrainingSchema } from '../schemas/training';
|
||||
import {
|
||||
useMunicipalityQuery,
|
||||
useParishQuery,
|
||||
useStateQuery,
|
||||
} from '@/feactures/location/hooks/use-query-location';
|
||||
|
||||
interface TrainingViewModalProps {
|
||||
data: TrainingSchema | null;
|
||||
@@ -46,14 +46,16 @@ export function TrainingViewModal({
|
||||
onClose,
|
||||
}: TrainingViewModalProps) {
|
||||
const [selectedImage, setSelectedImage] = useState<string | null>(null);
|
||||
|
||||
|
||||
const { data: statesData } = useStateQuery();
|
||||
const { data: municipalitiesData } = useMunicipalityQuery(data?.state || 0);
|
||||
const { data: parishesData } = useParishQuery(data?.municipality || 0);
|
||||
|
||||
if (!data) return null;
|
||||
|
||||
const stateName = statesData?.data?.find((s: any) => s.id === data.state)?.name;
|
||||
const stateName = statesData?.data?.find(
|
||||
(s: any) => s.id === data.state,
|
||||
)?.name;
|
||||
const municipalityName = municipalitiesData?.data?.find(
|
||||
(m: any) => m.id === data.municipality,
|
||||
)?.name;
|
||||
@@ -94,7 +96,7 @@ export function TrainingViewModal({
|
||||
</Card>
|
||||
);
|
||||
|
||||
const BooleanBadge = ({ value }: { value?: boolean }) => (
|
||||
const BooleanBadge = ({ value }: { value?: boolean | null }) => (
|
||||
<Badge variant={value ? 'default' : 'secondary'}>
|
||||
{value ? 'Sí' : 'No'}
|
||||
</Badge>
|
||||
@@ -273,7 +275,10 @@ export function TrainingViewModal({
|
||||
<span className="text-xs font-bold text-muted-foreground block mb-1">
|
||||
DISTRIBUCIÓN INTERNA
|
||||
</span>
|
||||
<p>Cant: {prod.internalQuantity} {prod.internalUnit}</p>
|
||||
<p>
|
||||
Cant: {prod.internalQuantity}{' '}
|
||||
{prod.internalUnit}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{prod.internalDescription}
|
||||
</p>
|
||||
@@ -284,7 +289,10 @@ export function TrainingViewModal({
|
||||
<span className="text-xs font-bold text-muted-foreground block mb-1">
|
||||
EXPORTACIÓN ({prod.externalCountry})
|
||||
</span>
|
||||
<p>Cant: {prod.externalQuantity} {prod.externalUnit}</p>
|
||||
<p>
|
||||
Cant: {prod.externalQuantity}{' '}
|
||||
{prod.externalUnit}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{prod.externalDescription}
|
||||
</p>
|
||||
@@ -334,10 +342,10 @@ export function TrainingViewModal({
|
||||
))}
|
||||
{(!data.equipmentList ||
|
||||
data.equipmentList.length === 0) && (
|
||||
<p className="text-sm text-muted-foreground italic">
|
||||
No hay equipamiento registrado.
|
||||
</p>
|
||||
)}
|
||||
<p className="text-sm text-muted-foreground italic">
|
||||
No hay equipamiento registrado.
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -360,15 +368,17 @@ export function TrainingViewModal({
|
||||
{mat.supplyType}
|
||||
</p>
|
||||
</div>
|
||||
<Badge variant="secondary">Cant: {mat.quantity} {mat.unit}</Badge>
|
||||
<Badge variant="secondary">
|
||||
Cant: {mat.quantity} {mat.unit}
|
||||
</Badge>
|
||||
</div>
|
||||
))}
|
||||
{(!data.productionList ||
|
||||
data.productionList.length === 0) && (
|
||||
<p className="text-sm text-muted-foreground italic">
|
||||
No hay materia prima registrada.
|
||||
</p>
|
||||
)}
|
||||
<p className="text-sm text-muted-foreground italic">
|
||||
No hay materia prima registrada.
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
@@ -463,7 +473,7 @@ export function TrainingViewModal({
|
||||
onClick={() => setSelectedImage(photo)}
|
||||
>
|
||||
<img
|
||||
src={`${process.env.NEXT_PUBLIC_API_URL}${photo}`}
|
||||
src={`${photo}`}
|
||||
alt={`Evidencia ${idx + 1}`}
|
||||
className="object-cover w-full h-full"
|
||||
/>
|
||||
@@ -513,7 +523,7 @@ export function TrainingViewModal({
|
||||
</Button>
|
||||
{selectedImage && (
|
||||
<img
|
||||
src={`${process.env.NEXT_PUBLIC_API_URL}${selectedImage}`}
|
||||
src={`${selectedImage}`}
|
||||
alt="Vista ampliada"
|
||||
className="max-w-full max-h-[90vh] object-contain rounded-md"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user