ajustes en las estadisticas
This commit is contained in:
@@ -127,6 +127,8 @@ export class TrainingService {
|
|||||||
genderResult,
|
genderResult,
|
||||||
municipalityDistribution,
|
municipalityDistribution,
|
||||||
parishDistribution,
|
parishDistribution,
|
||||||
|
surveyStatusDistribution,
|
||||||
|
isExportingDistribution,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
// 1. Total OSPs
|
// 1. Total OSPs
|
||||||
this.drizzle
|
this.drizzle
|
||||||
@@ -307,6 +309,26 @@ export class TrainingService {
|
|||||||
.leftJoin(parishes, eq(trainingSurveys.parish, parishes.id))
|
.leftJoin(parishes, eq(trainingSurveys.parish, parishes.id))
|
||||||
.where(whereCondition)
|
.where(whereCondition)
|
||||||
.groupBy(parishes.name),
|
.groupBy(parishes.name),
|
||||||
|
|
||||||
|
// 19. Distribución por Estatus de la Encuesta (Completada / Borrador)
|
||||||
|
this.drizzle
|
||||||
|
.select({
|
||||||
|
name: trainingSurveys.surveyStatus,
|
||||||
|
value: sql<number>`count(*)`,
|
||||||
|
})
|
||||||
|
.from(trainingSurveys)
|
||||||
|
.where(whereCondition)
|
||||||
|
.groupBy(trainingSurveys.surveyStatus),
|
||||||
|
|
||||||
|
// 20. Distribución por Exportación
|
||||||
|
this.drizzle
|
||||||
|
.select({
|
||||||
|
name: sql<string>`case when ${trainingSurveys.isExporting} then 'Sí' else 'No' end`,
|
||||||
|
value: sql<number>`count(*)`,
|
||||||
|
})
|
||||||
|
.from(trainingSurveys)
|
||||||
|
.where(whereCondition)
|
||||||
|
.groupBy(trainingSurveys.isExporting),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -374,6 +396,14 @@ export class TrainingService {
|
|||||||
...item,
|
...item,
|
||||||
value: Number(item.value),
|
value: Number(item.value),
|
||||||
})),
|
})),
|
||||||
|
surveyStatusDistribution: surveyStatusDistribution.map((item) => ({
|
||||||
|
...item,
|
||||||
|
value: Number(item.value),
|
||||||
|
})),
|
||||||
|
isExportingDistribution: isExportingDistribution.map((item) => ({
|
||||||
|
...item,
|
||||||
|
value: Number(item.value),
|
||||||
|
})),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const StatisticsItems: NavItem[] = [
|
|||||||
url: '#', // Placeholder as there is no direct link for the parent
|
url: '#', // Placeholder as there is no direct link for the parent
|
||||||
icon: 'chartColumn',
|
icon: 'chartColumn',
|
||||||
isActive: true,
|
isActive: true,
|
||||||
role: ['admin', 'superadmin', 'autoridad'],
|
role: ['admin', 'superadmin', 'autoridad', 'manager'],
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
// {
|
// {
|
||||||
@@ -82,7 +82,7 @@ export const StatisticsItems: NavItem[] = [
|
|||||||
shortcut: ['s', 's'],
|
shortcut: ['s', 's'],
|
||||||
url: '/dashboard/estadisticas/socioproductiva',
|
url: '/dashboard/estadisticas/socioproductiva',
|
||||||
icon: 'blocks',
|
icon: 'blocks',
|
||||||
role: ['admin', 'superadmin', 'autoridad'],
|
role: ['admin', 'superadmin', 'autoridad', 'manager'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -62,18 +62,31 @@ export function TrainingStatistics() {
|
|||||||
const { data: dataMunicipality } = useMunicipalityQuery(stateId);
|
const { data: dataMunicipality } = useMunicipalityQuery(stateId);
|
||||||
const { data: dataParish } = useParishQuery(municipalityId);
|
const { data: dataParish } = useParishQuery(municipalityId);
|
||||||
|
|
||||||
const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }];
|
const ALL_OPTION = [{ value: 'all', label: 'Todos' }];
|
||||||
const municipalityOptions =
|
|
||||||
Array.isArray(dataMunicipality?.data) && dataMunicipality.data.length > 0
|
const stateOptions = [
|
||||||
? dataMunicipality.data
|
...ALL_OPTION,
|
||||||
: [{ id: 0, stateId: 0, name: 'Sin Municipios' }];
|
...(dataState?.data || []).map((item) => ({
|
||||||
const parishOptions =
|
value: item.id.toString(),
|
||||||
Array.isArray(dataParish?.data) && dataParish.data.length > 0
|
label: item.name,
|
||||||
? dataParish.data
|
})),
|
||||||
: [{ id: 0, stateId: 0, name: 'Sin Parroquias' }];
|
];
|
||||||
|
const municipalityOptions = [
|
||||||
|
...ALL_OPTION,
|
||||||
|
...(Array.isArray(dataMunicipality?.data) ? dataMunicipality.data : []).map(
|
||||||
|
(item) => ({ value: item.id.toString(), label: item.name }),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
const parishOptions = [
|
||||||
|
...ALL_OPTION,
|
||||||
|
...(Array.isArray(dataParish?.data) ? dataParish.data : []).map((item) => ({
|
||||||
|
value: item.id.toString(),
|
||||||
|
label: item.name,
|
||||||
|
})),
|
||||||
|
];
|
||||||
|
|
||||||
// Query with Filters
|
// Query with Filters
|
||||||
const { data, isLoading, refetch } = useTrainingStatsQuery({
|
const { data, isLoading } = useTrainingStatsQuery({
|
||||||
startDate: startDate || undefined,
|
startDate: startDate || undefined,
|
||||||
endDate: endDate || undefined,
|
endDate: endDate || undefined,
|
||||||
stateId: stateId || undefined,
|
stateId: stateId || undefined,
|
||||||
@@ -135,25 +148,55 @@ export function TrainingStatistics() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toList = (value: unknown): any[] =>
|
||||||
|
Array.isArray(value) ? value : [];
|
||||||
|
|
||||||
|
const raw = data ?? {};
|
||||||
|
const totalOsps = raw.totalOsps ?? 0;
|
||||||
|
const totalProducts = raw.totalProducts ?? 0;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
totalOsps,
|
statusDistribution: statusRaw,
|
||||||
// totalProducers,
|
activityDistribution: activityRaw,
|
||||||
statusDistribution,
|
typeDistribution: typeRaw,
|
||||||
activityDistribution,
|
stateDistribution: stateRaw,
|
||||||
typeDistribution,
|
yearDistribution: yearRaw,
|
||||||
stateDistribution,
|
ecoSectorDistribution: ecoRaw,
|
||||||
yearDistribution,
|
productiveSectorDistribution: prodRaw,
|
||||||
ecoSectorDistribution,
|
centralActivityDistribution: centralRaw,
|
||||||
productiveSectorDistribution,
|
mainActivityDistribution: mainRaw,
|
||||||
centralActivityDistribution,
|
structureTypeDistribution: structureRaw,
|
||||||
mainActivityDistribution,
|
isOpenSpaceDistribution: openRaw,
|
||||||
structureTypeDistribution,
|
hasTransportDistribution: transportRaw,
|
||||||
isOpenSpaceDistribution,
|
genderDistribution: genderRaw,
|
||||||
hasTransportDistribution,
|
municipalityDistribution: municipalityRaw,
|
||||||
genderDistribution,
|
parishDistribution: parishRaw,
|
||||||
municipalityDistribution,
|
surveyStatusDistribution: surveyRaw,
|
||||||
parishDistribution,
|
isExportingDistribution: exportingRaw,
|
||||||
} = data;
|
} = raw;
|
||||||
|
|
||||||
|
const statusDistribution = toList(statusRaw);
|
||||||
|
const activityDistribution = toList(activityRaw);
|
||||||
|
const typeDistribution = toList(typeRaw);
|
||||||
|
const stateDistribution = toList(stateRaw);
|
||||||
|
const yearDistribution = toList(yearRaw);
|
||||||
|
const ecoSectorDistribution = toList(ecoRaw);
|
||||||
|
const productiveSectorDistribution = toList(prodRaw);
|
||||||
|
const centralActivityDistribution = toList(centralRaw);
|
||||||
|
const mainActivityDistribution = toList(mainRaw);
|
||||||
|
const structureTypeDistribution = toList(structureRaw);
|
||||||
|
const isOpenSpaceDistribution = toList(openRaw);
|
||||||
|
const hasTransportDistribution = toList(transportRaw);
|
||||||
|
const genderDistribution = toList(genderRaw);
|
||||||
|
const municipalityDistribution = toList(municipalityRaw);
|
||||||
|
const parishDistribution = toList(parishRaw);
|
||||||
|
const surveyStatusDistribution = toList(surveyRaw);
|
||||||
|
const isExportingDistribution = toList(exportingRaw);
|
||||||
|
|
||||||
|
const totalCompleted =
|
||||||
|
surveyStatusDistribution.find((s) => s.name === 'COMPLETADA')?.value ?? 0;
|
||||||
|
const totalDrafts =
|
||||||
|
surveyStatusDistribution.find((s) => s.name === 'BORRADOR')?.value ?? 0;
|
||||||
|
|
||||||
const COLORS = [
|
const COLORS = [
|
||||||
'#0088FE',
|
'#0088FE',
|
||||||
@@ -192,49 +235,44 @@ export function TrainingStatistics() {
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Estado</label>
|
<label className="text-sm font-medium">Estado</label>
|
||||||
<SelectSearchable
|
<SelectSearchable
|
||||||
options={stateOptions.map((item) => ({
|
options={stateOptions}
|
||||||
value: item.id.toString(),
|
onValueChange={(value) => {
|
||||||
label: item.name,
|
setStateId(value === 'all' || value === null ? 0 : Number(value));
|
||||||
}))}
|
|
||||||
onValueChange={(value: any) => {
|
|
||||||
setStateId(Number(value));
|
|
||||||
setMunicipalityId(0); // Reset municipality
|
setMunicipalityId(0); // Reset municipality
|
||||||
setParishId(0); // Reset parish
|
setParishId(0); // Reset parish
|
||||||
}}
|
}}
|
||||||
placeholder="Selecciona un estado"
|
placeholder="Selecciona un estado"
|
||||||
defaultValue={stateId ? stateId.toString() : ''}
|
value={stateId ? stateId.toString() : 'all'}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Municipio</label>
|
<label className="text-sm font-medium">Municipio</label>
|
||||||
<SelectSearchable
|
<SelectSearchable
|
||||||
options={municipalityOptions.map((item) => ({
|
options={municipalityOptions}
|
||||||
value: item.id.toString(),
|
onValueChange={(value) => {
|
||||||
label: item.name,
|
setMunicipalityId(
|
||||||
}))}
|
value === 'all' || value === null ? 0 : Number(value),
|
||||||
onValueChange={(value: any) => {
|
);
|
||||||
setMunicipalityId(Number(value));
|
|
||||||
setParishId(0);
|
setParishId(0);
|
||||||
}}
|
}}
|
||||||
placeholder="Selecciona municipio"
|
placeholder="Selecciona municipio"
|
||||||
defaultValue={municipalityId ? municipalityId.toString() : ''}
|
value={municipalityId ? municipalityId.toString() : 'all'}
|
||||||
disabled={!stateId || stateId === 0}
|
disabled={!stateId || stateId === 0}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Parroquia</label>
|
<label className="text-sm font-medium">Parroquia</label>
|
||||||
<SelectSearchable
|
<SelectSearchable
|
||||||
options={parishOptions.map((item) => ({
|
options={parishOptions}
|
||||||
value: item.id.toString(),
|
onValueChange={(value) =>
|
||||||
label: item.name,
|
setParishId(value === 'all' || value === null ? 0 : Number(value))
|
||||||
}))}
|
}
|
||||||
onValueChange={(value: any) => setParishId(Number(value))}
|
|
||||||
placeholder="Selecciona parroquia"
|
placeholder="Selecciona parroquia"
|
||||||
defaultValue={parishId ? parishId.toString() : ''}
|
value={parishId ? parishId.toString() : 'all'}
|
||||||
disabled={!municipalityId || municipalityId === 0}
|
disabled={!municipalityId || municipalityId === 0}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
{/* <div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Tipo de OSP</label>
|
<label className="text-sm font-medium">Tipo de OSP</label>
|
||||||
<Select value={ospType} onValueChange={setOspType}>
|
<Select value={ospType} onValueChange={setOspType}>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
@@ -249,7 +287,7 @@ export function TrainingStatistics() {
|
|||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div> */}
|
||||||
<div className="flex items-end gap-2">
|
<div className="flex items-end gap-2">
|
||||||
<Button variant="outline" onClick={handleClearFilters}>
|
<Button variant="outline" onClick={handleClearFilters}>
|
||||||
Limpiar Filtros
|
Limpiar Filtros
|
||||||
@@ -268,36 +306,88 @@ export function TrainingStatistics() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{/* Statistics Cards */}
|
{/* Summary Cards */}
|
||||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
<CardTitle className="text-sm font-medium">
|
<CardTitle className="text-sm font-medium">
|
||||||
Total de OSP Registradas
|
Registradas
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-2xl font-bold">{totalOsps}</div>
|
<div className="text-2xl font-bold">{totalOsps}</div>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
Organizaciones Socioproductivas
|
OSP registradas
|
||||||
</p>
|
</p>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{/* <Card>
|
<Card>
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
<CardTitle className="text-sm font-medium">
|
<CardTitle className="text-sm font-medium">Completadas</CardTitle>
|
||||||
Total de Productores
|
|
||||||
</CardTitle>
|
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-2xl font-bold">{totalProducers}</div>
|
<div className="text-2xl font-bold text-green-600">
|
||||||
|
{totalCompleted}
|
||||||
|
</div>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
Productores asociados
|
Encuestas completadas
|
||||||
</p>
|
</p>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card> */}
|
</Card>
|
||||||
|
|
||||||
|
<Card>
|
||||||
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
|
<CardTitle className="text-sm font-medium">Borrador</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<div className="text-2xl font-bold text-orange-500">
|
||||||
|
{totalDrafts}
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Encuestas en borrador
|
||||||
|
</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Card>
|
||||||
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
|
<CardTitle className="text-sm font-medium">Productos</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<div className="text-2xl font-bold">{totalProducts}</div>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Total de productos registrados
|
||||||
|
</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Statistics Cards */}
|
||||||
|
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||||
|
<Card>
|
||||||
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
|
<CardTitle className="text-sm font-medium">Mano de obra</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<div className="text-2xl font-bold">
|
||||||
|
{(() => {
|
||||||
|
const mujeres =
|
||||||
|
genderDistribution.find((g) => g.name === 'Mujeres')?.value ??
|
||||||
|
0;
|
||||||
|
const hombres =
|
||||||
|
genderDistribution.find((g) => g.name === 'Hombres')?.value ??
|
||||||
|
0;
|
||||||
|
if (mujeres > hombres) return 'Mujeres';
|
||||||
|
if (hombres > mujeres) return 'Hombres';
|
||||||
|
return 'Empate';
|
||||||
|
})()}
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Fuerza laboral predominante
|
||||||
|
</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
<Card className="col-span-full">
|
<Card className="col-span-full">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
@@ -635,8 +725,8 @@ export function TrainingStatistics() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{/* OPEN SPACE AND TRANSPORT (PIE CHARTS) */}
|
{/* OPEN SPACE, TRANSPORT AND EXPORTING (PIE CHARTS) */}
|
||||||
<div className="col-span-full grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="col-span-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Espacio Abierto</CardTitle>
|
<CardTitle>Espacio Abierto</CardTitle>
|
||||||
@@ -700,6 +790,38 @@ export function TrainingStatistics() {
|
|||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Exportación</CardTitle>
|
||||||
|
<CardDescription>¿Exportan sus productos?</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="h-[300px]">
|
||||||
|
<ResponsiveContainer width="100%" height="100%">
|
||||||
|
<PieChart>
|
||||||
|
<Pie
|
||||||
|
data={isExportingDistribution}
|
||||||
|
cx="50%"
|
||||||
|
cy="50%"
|
||||||
|
innerRadius={60}
|
||||||
|
outerRadius={80}
|
||||||
|
fill="#8884d8"
|
||||||
|
paddingAngle={5}
|
||||||
|
dataKey="value"
|
||||||
|
>
|
||||||
|
{isExportingDistribution.map((entry, index) => (
|
||||||
|
<Cell
|
||||||
|
key={`cell-${index}`}
|
||||||
|
fill={COLORS[(index + 6) % COLORS.length]}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Pie>
|
||||||
|
<Tooltip wrapperStyle={{ color: '#000' }} />
|
||||||
|
<Legend />
|
||||||
|
</PieChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,34 +4,43 @@ export const statisticsItemSchema = z.object({
|
|||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.nullable()
|
.nullable()
|
||||||
|
.optional()
|
||||||
.transform((val) => val || 'Sin Información'),
|
.transform((val) => val || 'Sin Información'),
|
||||||
value: z.number(),
|
value: z.number().nullable().optional().default(0),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const distributionSchema = z
|
||||||
|
.array(statisticsItemSchema)
|
||||||
|
.nullable()
|
||||||
|
.optional()
|
||||||
|
.default([]);
|
||||||
|
|
||||||
export const trainingStatisticsSchema = z.object({
|
export const trainingStatisticsSchema = z.object({
|
||||||
totalOsps: z.number(),
|
totalOsps: z.number().nullable().optional().default(0),
|
||||||
// totalProducers: z.number(),
|
// totalProducers: z.number(),
|
||||||
totalProducts: z.number(),
|
totalProducts: z.number().nullable().optional().default(0),
|
||||||
statusDistribution: z.array(statisticsItemSchema),
|
statusDistribution: distributionSchema,
|
||||||
activityDistribution: z.array(statisticsItemSchema),
|
activityDistribution: distributionSchema,
|
||||||
typeDistribution: z.array(statisticsItemSchema),
|
typeDistribution: distributionSchema,
|
||||||
stateDistribution: z.array(statisticsItemSchema),
|
stateDistribution: distributionSchema,
|
||||||
yearDistribution: z.array(statisticsItemSchema),
|
yearDistribution: distributionSchema,
|
||||||
ecoSectorDistribution: z.array(statisticsItemSchema),
|
ecoSectorDistribution: distributionSchema,
|
||||||
productiveSectorDistribution: z.array(statisticsItemSchema),
|
productiveSectorDistribution: distributionSchema,
|
||||||
centralActivityDistribution: z.array(statisticsItemSchema),
|
centralActivityDistribution: distributionSchema,
|
||||||
mainActivityDistribution: z.array(statisticsItemSchema),
|
mainActivityDistribution: distributionSchema,
|
||||||
structureTypeDistribution: z.array(statisticsItemSchema),
|
structureTypeDistribution: distributionSchema,
|
||||||
isOpenSpaceDistribution: z.array(statisticsItemSchema),
|
isOpenSpaceDistribution: distributionSchema,
|
||||||
hasTransportDistribution: z.array(statisticsItemSchema),
|
hasTransportDistribution: distributionSchema,
|
||||||
genderDistribution: z.array(statisticsItemSchema),
|
genderDistribution: distributionSchema,
|
||||||
municipalityDistribution: z.array(statisticsItemSchema),
|
municipalityDistribution: distributionSchema,
|
||||||
parishDistribution: z.array(statisticsItemSchema),
|
parishDistribution: distributionSchema,
|
||||||
|
surveyStatusDistribution: distributionSchema,
|
||||||
|
isExportingDistribution: distributionSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TrainingStatisticsData = z.infer<typeof trainingStatisticsSchema>;
|
export type TrainingStatisticsData = z.infer<typeof trainingStatisticsSchema>;
|
||||||
|
|
||||||
export const trainingStatisticsResponseSchema = z.object({
|
export const trainingStatisticsResponseSchema = z.object({
|
||||||
message: z.string(),
|
message: z.string().nullable().optional(),
|
||||||
data: trainingStatisticsSchema,
|
data: trainingStatisticsSchema.nullable().optional(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ function SelectSearchable({
|
|||||||
onValueChange,
|
onValueChange,
|
||||||
placeholder,
|
placeholder,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
|
value,
|
||||||
disabled,
|
disabled,
|
||||||
enableNoneOption = false, // New prop to enable or disable "Ninguno"
|
enableNoneOption = false, // New prop to enable or disable "Ninguno"
|
||||||
}: {
|
}: {
|
||||||
@@ -18,6 +19,7 @@ function SelectSearchable({
|
|||||||
onValueChange: (value: string | null) => void;
|
onValueChange: (value: string | null) => void;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
defaultValue?: string;
|
defaultValue?: string;
|
||||||
|
value?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
enableNoneOption?: boolean;
|
enableNoneOption?: boolean;
|
||||||
}) {
|
}) {
|
||||||
@@ -33,7 +35,7 @@ function SelectSearchable({
|
|||||||
return (
|
return (
|
||||||
<SelectPrimitive.Root
|
<SelectPrimitive.Root
|
||||||
onValueChange={(value) => onValueChange(value === 'null' ? null : value)}
|
onValueChange={(value) => onValueChange(value === 'null' ? null : value)}
|
||||||
defaultValue={defaultValue}
|
{...(value !== undefined ? { value } : { defaultValue })}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<SelectPrimitive.Trigger
|
<SelectPrimitive.Trigger
|
||||||
|
|||||||
Reference in New Issue
Block a user