diff --git a/apps/api/src/database/schema/surveys.ts b/apps/api/src/database/schema/surveys.ts index 0b3f53c..6270ea1 100644 --- a/apps/api/src/database/schema/surveys.ts +++ b/apps/api/src/database/schema/surveys.ts @@ -158,7 +158,7 @@ export const trainingSurveys = t.pgTable( updatedBy: t .integer('updated_by') .references(() => users.id, { onDelete: 'cascade' }), - surveyStatus: t.text('survey_status').notNull().default('PUBLICADO'), + surveyStatus: t.text('survey_status').notNull().default('COMPLETADA'), ...timestamps, }, (trainingSurveys) => ({ diff --git a/apps/api/src/features/configurations/states/states.service.ts b/apps/api/src/features/configurations/states/states.service.ts index ad8c883..866c87d 100644 --- a/apps/api/src/features/configurations/states/states.service.ts +++ b/apps/api/src/features/configurations/states/states.service.ts @@ -2,7 +2,7 @@ import { DRIZZLE_PROVIDER } from '@/database/drizzle-provider'; import * as schema from '@/database/index'; import { states } from '@/database/schema/general'; import { HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; -import { eq } from 'drizzle-orm'; +import { and, eq, ne } from 'drizzle-orm'; import { NodePgDatabase } from 'drizzle-orm/node-postgres'; import { CreateStateDto } from './dto/create-state.dto'; import { UpdateStateDto } from './dto/update-state.dto'; @@ -15,14 +15,17 @@ export class StatesService { ) {} async findAll(): Promise { - return await this.drizzle.select().from(states); + return await this.drizzle + .select() + .from(states) + .where(ne(states.name, 'EMBAJADA')); } async findOne(id: number): Promise { const state = await this.drizzle .select() .from(states) - .where(eq(states.id, id)); + .where(and(eq(states.id, id), ne(states.name, 'EMBAJADA'))); if (state.length === 0) { throw new HttpException('State not found', HttpStatus.NOT_FOUND); diff --git a/apps/api/src/features/location/location.service.ts b/apps/api/src/features/location/location.service.ts index 3d3f9ee..c32b406 100644 --- a/apps/api/src/features/location/location.service.ts +++ b/apps/api/src/features/location/location.service.ts @@ -1,29 +1,30 @@ import { DRIZZLE_PROVIDER } from 'src/database/drizzle-provider'; // import { Env, validateString } from '@/common/utils'; -import { Inject, Injectable, HttpException, HttpStatus, NotFoundException, UnauthorizedException } from '@nestjs/common'; +import { Inject, Injectable } from '@nestjs/common'; +import { eq, ne } from 'drizzle-orm'; import { NodePgDatabase } from 'drizzle-orm/node-postgres'; import * as schema from 'src/database/index'; -import { states, municipalities, parishes } from 'src/database/index'; -import { eq, like, or, SQL, sql, and, not } from 'drizzle-orm'; -import * as bcrypt from 'bcryptjs'; -import { State, Municipality, Parish } from './entities/user.entity'; +import { municipalities, parishes, states } from 'src/database/index'; + +import { Municipality, Parish, State } from './entities/user.entity'; // import { PaginationDto } from '../../common/dto/pagination.dto'; @Injectable() export class UsersService { constructor( @Inject(DRIZZLE_PROVIDER) private drizzle: NodePgDatabase, - ) { } + ) {} - async StateAll(): Promise< State[]> { + async StateAll(): Promise { const find = await this.drizzle .select() .from(states) + .where(ne(states.name, 'EMBAJADA')); return find; } - async MunicioalityAll(id: string): Promise< Municipality[]> { + async MunicioalityAll(id: string): Promise { const find = await this.drizzle .select() .from(municipalities) @@ -32,7 +33,7 @@ export class UsersService { return find; } - async ParishAll(id: string): Promise< Parish[]> { + async ParishAll(id: string): Promise { const find = await this.drizzle .select() .from(parishes) @@ -41,4 +42,3 @@ export class UsersService { return find; } } - diff --git a/apps/web/feactures/training/components/form.tsx b/apps/web/feactures/training/components/form.tsx index 968bbb7..b7ddf64 100644 --- a/apps/web/feactures/training/components/form.tsx +++ b/apps/web/feactures/training/components/form.tsx @@ -107,7 +107,8 @@ export function CreateTrainingForm({ coorPhone: defaultValues?.coorPhone || '', visitDate: formatToLocalISO(defaultValues?.visitDate), productiveActivity: defaultValues?.productiveActivity || undefined, - productiveActivityOther: defaultValues?.productiveActivityOther || undefined, + productiveActivityOther: + defaultValues?.productiveActivityOther || undefined, ecoSector: defaultValues?.ecoSector || undefined, productiveSector: defaultValues?.productiveSector || undefined, centralProductiveActivity: @@ -172,7 +173,7 @@ export function CreateTrainingForm({ womenCount: defaultValues?.womenCount || 0, menCount: defaultValues?.menCount || 0, - surveyStatus: defaultValues?.surveyStatus || 'BORRADOR' + surveyStatus: defaultValues?.surveyStatus || 'BORRADOR', }, mode: 'onChange', }); @@ -240,7 +241,7 @@ export function CreateTrainingForm({ productiveSector, centralProductiveActivity, mainProductiveActivity, - productiveActivity + productiveActivity, ]); const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }]; @@ -690,26 +691,23 @@ export function CreateTrainingForm({ )} /> - - {other && ( ( - - - ¿Cuál otra Actividad Productiva? - - - - - - - )} - />)} - + {other && ( + ( + + + ¿Cuál otra Actividad Productiva? + + + + + + + )} + /> + )} - + @@ -1291,11 +1285,7 @@ export function CreateTrainingForm({ Correo Electrónico de la Comuna (Opcional) - + @@ -1405,11 +1395,7 @@ export function CreateTrainingForm({ Correo Electrónico del Consejo Comunal (Opcional) - + @@ -1555,9 +1541,7 @@ export function CreateTrainingForm({
- - Subir imágenes (Máximo 3 y opcional) - + Subir imágenes (Máximo 3 y opcional) -
- @@ -1668,8 +1647,10 @@ export function CreateTrainingForm({ - BORRADOR - PUBLICADO + + BORRADOR + + COMPLETADA diff --git a/apps/web/feactures/training/components/training-tables/columns.tsx b/apps/web/feactures/training/components/training-tables/columns.tsx index 5d84779..ffb52e5 100644 --- a/apps/web/feactures/training/components/training-tables/columns.tsx +++ b/apps/web/feactures/training/components/training-tables/columns.tsx @@ -43,22 +43,13 @@ export function columns({ apiUrl }: ColumnsProps): ColumnDef[] { return date ? new Date(date).toLocaleString() : 'N/A'; }, }, - - { - accessorKey: 'visitDate', - header: 'Fecha Visita', - cell: ({ row }) => { - const date = row.getValue('visitDate') as string; - return date ? new Date(date).toLocaleString() : 'N/A'; - }, - }, { accessorKey: 'surveyStatus', header: '', cell: ({ row }) => { const status = row.getValue('surveyStatus') as string; return ( - + {status} ); diff --git a/packages/shadcn/src/components/ui/badge.tsx b/packages/shadcn/src/components/ui/badge.tsx index 6ee9704..9da05af 100644 --- a/packages/shadcn/src/components/ui/badge.tsx +++ b/packages/shadcn/src/components/ui/badge.tsx @@ -1,38 +1,40 @@ -import * as React from "react" -import { Slot } from "@radix-ui/react-slot" -import { cva, type VariantProps } from "class-variance-authority" +import { Slot } from '@radix-ui/react-slot'; +import { cva, type VariantProps } from 'class-variance-authority'; +import * as React from 'react'; -import { cn } from "@repo/shadcn/lib/utils" +import { cn } from '@repo/shadcn/lib/utils'; const badgeVariants = cva( - "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", + 'inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden', { variants: { variant: { default: - "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90", + 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90', secondary: - "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90", + 'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90', destructive: - "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70", + 'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70', outline: - "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground", + 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground', + success: + 'border-transparent bg-green-500 text-black [a&]:hover:bg-green-300', }, }, defaultVariants: { - variant: "default", + variant: 'default', }, - } -) + }, +); function Badge({ className, variant, asChild = false, ...props -}: React.ComponentProps<"span"> & +}: React.ComponentProps<'span'> & VariantProps & { asChild?: boolean }) { - const Comp = asChild ? Slot : "span" + const Comp = asChild ? Slot : 'span'; return ( - ) + ); } -export { Badge, badgeVariants } +export { Badge, badgeVariants };