From 200df205c9d4cbc2922d092f7fad7fc1e93c85f5 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 24 Mar 2026 15:58:35 -0400 Subject: [PATCH] =?UTF-8?q?A=C3=B1adida=20la=20opcion=20"otro"=20en=20acti?= =?UTF-8?q?vidad=20productiva=20al=20registrar=20y=20ver=20los=20datos=20d?= =?UTF-8?q?e=20OSP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/migrations/0026_last_vampiro.sql | 2 + .../migrations/meta/0026_snapshot.json | 2099 +++++++++++++++++ .../database/migrations/meta/_journal.json | 7 + apps/api/src/database/schema/surveys.ts | 1 + .../training/dto/create-training.dto.ts | 6 + .../src/features/training/training.service.ts | 7 +- .../feactures/training/components/form.tsx | 49 +- .../components/training-view-modal.tsx | 20 +- .../feactures/training/constants/osp-data.ts | 15 +- .../feactures/training/schemas/training.ts | 2 + 10 files changed, 2177 insertions(+), 31 deletions(-) create mode 100644 apps/api/src/database/migrations/0026_last_vampiro.sql create mode 100644 apps/api/src/database/migrations/meta/0026_snapshot.json diff --git a/apps/api/src/database/migrations/0026_last_vampiro.sql b/apps/api/src/database/migrations/0026_last_vampiro.sql new file mode 100644 index 0000000..fcaaa04 --- /dev/null +++ b/apps/api/src/database/migrations/0026_last_vampiro.sql @@ -0,0 +1,2 @@ +DROP VIEW "public"."v_training_surveys";--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "productive_activity_other" text DEFAULT ''; \ No newline at end of file diff --git a/apps/api/src/database/migrations/meta/0026_snapshot.json b/apps/api/src/database/migrations/meta/0026_snapshot.json new file mode 100644 index 0000000..1f29a0c --- /dev/null +++ b/apps/api/src/database/migrations/meta/0026_snapshot.json @@ -0,0 +1,2099 @@ +{ + "id": "5081425f-21df-45be-922a-da0032da1efc", + "prevId": "05e9e7a1-0351-439a-b056-15ae1c6815e4", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.activity_logs": { + "name": "activity_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "activityLogs_idx": { + "name": "activityLogs_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "activity_logs_user_id_users_id_fk": { + "name": "activity_logs_user_id_users_id_fk", + "tableFrom": "activity_logs", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.roles": { + "name": "roles", + "schema": "auth", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "roles_idx": { + "name": "roles_idx", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.sessions": { + "name": "sessions", + "schema": "auth", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "previous_session_token": { + "name": "previous_session_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "last_rotated_at": { + "name": "last_rotated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "sessions_idx": { + "name": "sessions_idx", + "columns": [ + { + "expression": "session_token", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.users": { + "name": "users", + "schema": "auth", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fullname": { + "name": "fullname", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "municipality": { + "name": "municipality", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parish": { + "name": "parish", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_two_factor_enabled": { + "name": "is_two_factor_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "two_factor_secret": { + "name": "two_factor_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_email_verified": { + "name": "is_email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_idx": { + "name": "users_idx", + "columns": [ + { + "expression": "username", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "users_state_states_id_fk": { + "name": "users_state_states_id_fk", + "tableFrom": "users", + "tableTo": "states", + "columnsFrom": [ + "state" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "users_municipality_municipalities_id_fk": { + "name": "users_municipality_municipalities_id_fk", + "tableFrom": "users", + "tableTo": "municipalities", + "columnsFrom": [ + "municipality" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "users_parish_parishes_id_fk": { + "name": "users_parish_parishes_id_fk", + "tableFrom": "users", + "tableTo": "parishes", + "columnsFrom": [ + "parish" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_username_unique": { + "name": "users_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + }, + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.user_role": { + "name": "user_role", + "schema": "auth", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_role_idx": { + "name": "user_role_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_role_user_id_users_id_fk": { + "name": "user_role_user_id_users_id_fk", + "tableFrom": "user_role", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_role_role_id_roles_id_fk": { + "name": "user_role_role_id_roles_id_fk", + "tableFrom": "user_role", + "tableTo": "roles", + "schemaTo": "auth", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.verificationToken": { + "name": "verificationToken", + "schema": "auth", + "columns": { + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.category_type": { + "name": "category_type", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "group": { + "name": "group", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "category_typeIx0": { + "name": "category_typeIx0", + "columns": [ + { + "expression": "group", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "category_typeIx1": { + "name": "category_typeIx1", + "columns": [ + { + "expression": "description", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.localities": { + "name": "localities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "state_id": { + "name": "state_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "municipality_id": { + "name": "municipality_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "parish_id": { + "name": "parish_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "localities_index_03": { + "name": "localities_index_03", + "columns": [ + { + "expression": "state_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "municipality_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parish_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "localities_index_00": { + "name": "localities_index_00", + "columns": [ + { + "expression": "state_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "localities_index_01": { + "name": "localities_index_01", + "columns": [ + { + "expression": "municipality_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "localities_index_02": { + "name": "localities_index_02", + "columns": [ + { + "expression": "parish_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "localities_state_id_states_id_fk": { + "name": "localities_state_id_states_id_fk", + "tableFrom": "localities", + "tableTo": "states", + "columnsFrom": [ + "state_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "localities_municipality_id_municipalities_id_fk": { + "name": "localities_municipality_id_municipalities_id_fk", + "tableFrom": "localities", + "tableTo": "municipalities", + "columnsFrom": [ + "municipality_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "localities_parish_id_parishes_id_fk": { + "name": "localities_parish_id_parishes_id_fk", + "tableFrom": "localities", + "tableTo": "parishes", + "columnsFrom": [ + "parish_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "localities_name_unique": { + "name": "localities_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.municipalities": { + "name": "municipalities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_id": { + "name": "state_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "municipalities_index_00": { + "name": "municipalities_index_00", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "state_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "municipalities_state_id_states_id_fk": { + "name": "municipalities_state_id_states_id_fk", + "tableFrom": "municipalities", + "tableTo": "states", + "columnsFrom": [ + "state_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.parishes": { + "name": "parishes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "municipality_id": { + "name": "municipality_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "parishes_index_00": { + "name": "parishes_index_00", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "municipality_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "parishes_municipality_id_municipalities_id_fk": { + "name": "parishes_municipality_id_municipalities_id_fk", + "tableFrom": "parishes", + "tableTo": "municipalities", + "columnsFrom": [ + "municipality_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.states": { + "name": "states", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "states_index_00": { + "name": "states_index_00", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.products": { + "name": "products", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "price": { + "name": "price", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "stock": { + "name": "stock", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url_img": { + "name": "url_img", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gallery": { + "name": "gallery", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'BORRADOR'" + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "products_user_id_users_id_fk": { + "name": "products_user_id_users_id_fk", + "tableFrom": "products", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.answers_surveys": { + "name": "answers_surveys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "survey_id": { + "name": "survey_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answers": { + "name": "answers", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "answers_index_00": { + "name": "answers_index_00", + "columns": [ + { + "expression": "answers", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "answers_index_01": { + "name": "answers_index_01", + "columns": [ + { + "expression": "survey_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "answers_index_02": { + "name": "answers_index_02", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "answers_surveys_survey_id_surveys_id_fk": { + "name": "answers_surveys_survey_id_surveys_id_fk", + "tableFrom": "answers_surveys", + "tableTo": "surveys", + "columnsFrom": [ + "survey_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "answers_surveys_user_id_users_id_fk": { + "name": "answers_surveys_user_id_users_id_fk", + "tableFrom": "answers_surveys", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.surveys": { + "name": "surveys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_audience": { + "name": "target_audience", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "closing_date": { + "name": "closing_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "published": { + "name": "published", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "questions": { + "name": "questions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "surveys_index_00": { + "name": "surveys_index_00", + "columns": [ + { + "expression": "title", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.training_surveys": { + "name": "training_surveys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "coor_full_name": { + "name": "coor_full_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visit_date": { + "name": "visit_date", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "coor_phone": { + "name": "coor_phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "municipality": { + "name": "municipality", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parish": { + "name": "parish", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "osp_type": { + "name": "osp_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "eco_sector": { + "name": "eco_sector", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "productive_sector": { + "name": "productive_sector", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "central_productive_activity": { + "name": "central_productive_activity", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "main_productive_activity": { + "name": "main_productive_activity", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "productive_activity": { + "name": "productive_activity", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "productive_activity_other": { + "name": "productive_activity_other", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "osp_rif": { + "name": "osp_rif", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "osp_name": { + "name": "osp_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "company_constitution_year": { + "name": "company_constitution_year", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "current_status": { + "name": "current_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVA'" + }, + "infrastructure_mt2": { + "name": "infrastructure_mt2", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "has_transport": { + "name": "has_transport", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "structure_type": { + "name": "structure_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "is_open_space": { + "name": "is_open_space", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "paralysis_reason": { + "name": "paralysis_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "equipment_list": { + "name": "equipment_list", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "production_list": { + "name": "production_list", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "product_list": { + "name": "product_list", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "osp_address": { + "name": "osp_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_google_maps_link": { + "name": "osp_google_maps_link", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_name": { + "name": "commune_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "situr_code_commune": { + "name": "situr_code_commune", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commune_rif": { + "name": "commune_rif", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_spokesperson_name": { + "name": "commune_spokesperson_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_spokesperson_cedula": { + "name": "commune_spokesperson_cedula", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commune_spokesperson_rif": { + "name": "commune_spokesperson_rif", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commune_spokesperson_phone": { + "name": "commune_spokesperson_phone", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_email": { + "name": "commune_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "communal_council": { + "name": "communal_council", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "situr_code_communal_council": { + "name": "situr_code_communal_council", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "communal_council_rif": { + "name": "communal_council_rif", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council_spokesperson_name": { + "name": "communal_council_spokesperson_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council_spokesperson_cedula": { + "name": "communal_council_spokesperson_cedula", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "communal_council_spokesperson_rif": { + "name": "communal_council_spokesperson_rif", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "communal_council_spokesperson_phone": { + "name": "communal_council_spokesperson_phone", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council_email": { + "name": "communal_council_email", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "osp_responsible_fullname": { + "name": "osp_responsible_fullname", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_responsible_cedula": { + "name": "osp_responsible_cedula", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_responsible_rif": { + "name": "osp_responsible_rif", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "civil_state": { + "name": "civil_state", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "osp_responsible_phone": { + "name": "osp_responsible_phone", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_responsible_email": { + "name": "osp_responsible_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "family_burden": { + "name": "family_burden", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "number_of_children": { + "name": "number_of_children", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "general_observations": { + "name": "general_observations", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "internal_distribution_zone": { + "name": "internal_distribution_zone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_exporting": { + "name": "is_exporting", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "external_country": { + "name": "external_country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_city": { + "name": "external_city", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_description": { + "name": "external_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_quantity": { + "name": "external_quantity", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_unit": { + "name": "external_unit", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "women_count": { + "name": "women_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "men_count": { + "name": "men_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "photo1": { + "name": "photo1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "photo2": { + "name": "photo2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "photo3": { + "name": "photo3", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "training_surveys_index_00": { + "name": "training_surveys_index_00", + "columns": [ + { + "expression": "coor_full_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "training_surveys_state_states_id_fk": { + "name": "training_surveys_state_states_id_fk", + "tableFrom": "training_surveys", + "tableTo": "states", + "columnsFrom": [ + "state" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_surveys_municipality_municipalities_id_fk": { + "name": "training_surveys_municipality_municipalities_id_fk", + "tableFrom": "training_surveys", + "tableTo": "municipalities", + "columnsFrom": [ + "municipality" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_surveys_parish_parishes_id_fk": { + "name": "training_surveys_parish_parishes_id_fk", + "tableFrom": "training_surveys", + "tableTo": "parishes", + "columnsFrom": [ + "parish" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_surveys_created_by_users_id_fk": { + "name": "training_surveys_created_by_users_id_fk", + "tableFrom": "training_surveys", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "training_surveys_updated_by_users_id_fk": { + "name": "training_surveys_updated_by_users_id_fk", + "tableFrom": "training_surveys", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "auth.gender": { + "name": "gender", + "schema": "auth", + "values": [ + "FEMENINO", + "MASCULINO" + ] + }, + "public.nationality": { + "name": "nationality", + "schema": "public", + "values": [ + "VENEZOLANO", + "EXTRANJERO" + ] + }, + "auth.status": { + "name": "status", + "schema": "auth", + "values": [ + "ACTIVE", + "INACTIVE" + ] + } + }, + "schemas": { + "auth": "auth" + }, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "auth.user_access_view": { + "columns": { + "userId": { + "name": "userId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "role_name": { + "name": "role_name", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT\n u.id AS user_id,\n u.username,\n u.email,\n u.fullname,\n r.id AS role_id,\n r.name AS role_name\nFROM\n auth.users u\nLEFT JOIN\n auth.user_role ur ON u.id = ur.user_id \nLEFT JOIN\n auth.roles r ON ur.role_id = r.id", + "name": "user_access_view", + "schema": "auth", + "isExisting": false, + "materialized": false + }, + "public.v_product_store": { + "columns": { + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "price": { + "name": "price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "stock": { + "name": "stock", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "url_img": { + "name": "url_img", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gallery": { + "name": "gallery", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "fullname": { + "name": "fullname", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n select p.id as product_id, p.title, p.description, p.price, p.stock, p.url_img, p.gallery, p.address, p.status, p.user_id, u.fullname, u.email, u.phone\n from products p\n left join auth.users as u on u.id = p.user_id", + "name": "v_product_store", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.v_surveys": { + "columns": { + "survey_id": { + "name": "survey_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "closing_date": { + "name": "closing_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "target_audience": { + "name": "target_audience", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select id as survey_id, title, description, created_at, closing_date, target_audience from surveys\nwhere published = true", + "name": "v_surveys", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/api/src/database/migrations/meta/_journal.json b/apps/api/src/database/migrations/meta/_journal.json index 184366d..2144e55 100644 --- a/apps/api/src/database/migrations/meta/_journal.json +++ b/apps/api/src/database/migrations/meta/_journal.json @@ -183,6 +183,13 @@ "when": 1772643066120, "tag": "0025_funny_makkari", "breakpoints": true + }, + { + "idx": 26, + "version": "7", + "when": 1774379641691, + "tag": "0026_last_vampiro", + "breakpoints": true } ] } \ No newline at end of file diff --git a/apps/api/src/database/schema/surveys.ts b/apps/api/src/database/schema/surveys.ts index 5cebdc4..bc5bb04 100644 --- a/apps/api/src/database/schema/surveys.ts +++ b/apps/api/src/database/schema/surveys.ts @@ -76,6 +76,7 @@ export const trainingSurveys = t.pgTable( .notNull() .default(''), productiveActivity: t.text('productive_activity').notNull(), + productiveActivityOther: t.text('productive_activity_other').default(''), ospRif: t.text('osp_rif'), ospName: t.text('osp_name'), companyConstitutionYear: t.integer('company_constitution_year').notNull(), diff --git a/apps/api/src/features/training/dto/create-training.dto.ts b/apps/api/src/features/training/dto/create-training.dto.ts index 9a607ac..75930bc 100644 --- a/apps/api/src/features/training/dto/create-training.dto.ts +++ b/apps/api/src/features/training/dto/create-training.dto.ts @@ -1,3 +1,4 @@ +import { Optional } from '@nestjs/common'; import { ApiProperty } from '@nestjs/swagger'; import { Transform, Type } from 'class-transformer'; import { @@ -42,6 +43,11 @@ export class CreateTrainingDto { @IsString() productiveActivity: string; + @ApiProperty() + @IsString() + @IsOptional() + productiveActivityOther: string; + @ApiProperty() @IsString() currentStatus: string; diff --git a/apps/api/src/features/training/training.service.ts b/apps/api/src/features/training/training.service.ts index d3bc097..d11582a 100644 --- a/apps/api/src/features/training/training.service.ts +++ b/apps/api/src/features/training/training.service.ts @@ -16,7 +16,7 @@ export class TrainingService { constructor( @Inject(DRIZZLE_PROVIDER) private drizzle: NodePgDatabase, private readonly minioService: MinioService, - ) {} + ) { } async findAll(paginationDto?: PaginationDto) { const { @@ -268,7 +268,7 @@ export class TrainingService { // 2. Extraer solo visitDate para formatearlo. // Ya NO extraemos state, municipality, etc. porque no vienen en el DTO. - const { visitDate, state, municipality, parish, ...rest } = + const { visitDate, state, municipality, parish, productiveActivityOther, ...rest } = createTrainingDto; const [newRecord] = await this.drizzle @@ -280,6 +280,9 @@ export class TrainingService { // Conversión de fecha visitDate: new Date(visitDate), + // Borra las tildes y cambia el texto a mayusculas + productiveActivityOther: productiveActivityOther.toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""), + // 3. Asignar fotos de forma segura photo1: photoPaths[0] ?? null, photo2: photoPaths[1] ?? null, diff --git a/apps/web/feactures/training/components/form.tsx b/apps/web/feactures/training/components/form.tsx index 657520b..9c22bf2 100644 --- a/apps/web/feactures/training/components/form.tsx +++ b/apps/web/feactures/training/components/form.tsx @@ -107,6 +107,7 @@ export function CreateTrainingForm({ coorPhone: defaultValues?.coorPhone || '', visitDate: formatToLocalISO(defaultValues?.visitDate), productiveActivity: defaultValues?.productiveActivity || undefined, + productiveActivityOther: defaultValues?.productiveActivityOther || undefined, ecoSector: defaultValues?.ecoSector || undefined, productiveSector: defaultValues?.productiveSector || undefined, centralProductiveActivity: @@ -202,6 +203,11 @@ export function CreateTrainingForm({ name: 'mainProductiveActivity', }); + const productiveActivity = useWatch({ + control: form.control, + name: 'productiveActivity', + }); + const productiveSectorOptions = ecoSector ? SECTOR_PRODUCTIVO_MAP[ecoSector] || [] : []; @@ -215,6 +221,8 @@ export function CreateTrainingForm({ ? ACTIVIDAD_PRODUCTIVA_MAP[mainProductiveActivity] || [] : []; + const other = productiveActivity == 'OTRO' ? true : false; + // Reset dependent fields when parent changes React.useEffect(() => { // This effect handles shifts in options, but react-hook-form values persist @@ -225,6 +233,7 @@ export function CreateTrainingForm({ productiveSector, centralProductiveActivity, mainProductiveActivity, + productiveActivity ]); const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }]; @@ -249,15 +258,6 @@ export function CreateTrainingForm({ setMunicipality(Number(defaultValues.municipality)); setDisabledParish(false); } - - // if (defaultValues.coorState) { - // setcoorState(Number(defaultValues.coorState)); - // setDisabledCoorMunicipality(false); - // } - // if (defaultValues.coorMunicipality) { - // setcoorMunicipality(Number(defaultValues.coorMunicipality)); - // setDisabledCoorParish(false); - // } } }, [defaultValues]); @@ -292,16 +292,6 @@ export function CreateTrainingForm({ } }); - // 2. Mapeo manual y conversión a numérico - // if (formData.state) { - // data.append('state', Number(formData.state).toString()); - // } - // if (formData.municipality) { - // data.append('municipality', Number(formData.municipality).toString()); - // } - // if (formData.parish) { - // data.append('parish', Number(formData.parish).toString()); - // } if (defaultValues?.id) { data.append('id', defaultValues.id.toString()); } @@ -693,6 +683,27 @@ export function CreateTrainingForm({ )} /> + + {other && ( ( + + + ¿Cuál otra Actividad Productiva? + + + + + + + )} + />)} + + ); + // console.log(data); + + return ( <> @@ -158,12 +161,17 @@ export function TrainingViewModal({ label="Actividad Principal" value={data.mainProductiveActivity} /> -
- -
+ {/*
*/} + + + {data.productiveActivity == 'OTRO' && ()} + {/*
*/} {/* 3. Infraestructura y Ubicación */} diff --git a/apps/web/feactures/training/constants/osp-data.ts b/apps/web/feactures/training/constants/osp-data.ts index ff4c1d4..e66d254 100644 --- a/apps/web/feactures/training/constants/osp-data.ts +++ b/apps/web/feactures/training/constants/osp-data.ts @@ -107,6 +107,7 @@ export const ACTIVIDAD_PRODUCTIVA_MAP: Record = { 'SIEMBRA DE ARROZ', 'SIEMBRA DE CEREALES (CEBADA, LINAZA, SOYA)', 'ELABORACION DE BIO-INSUMO (ABONO ORGANICO)', + 'OTRO' ], [ACTIVIDAD_PRINCIPAL.CRIA]: [ 'BOVINO', @@ -115,8 +116,9 @@ export const ACTIVIDAD_PRODUCTIVA_MAP: Record = { 'CUNICULTURA', 'AVICOLA', 'PISCICULA', + 'OTRO' ], - [ACTIVIDAD_PRINCIPAL.PATIOS_PRODUCTIVOS]: ['SIEMBRA Y CRIA'], + [ACTIVIDAD_PRINCIPAL.PATIOS_PRODUCTIVOS]: ['SIEMBRA Y CRIA', 'OTRO'], [ACTIVIDAD_PRINCIPAL.TRANSFORMACION_MATERIA]: [ 'ELABORACION DE PRODUCTOS QUIMICOS (LIMPIEZA E HIGIENE PERSONAL)', 'PANADERIAS', @@ -131,6 +133,7 @@ export const ACTIVIDAD_PRODUCTIVA_MAP: Record = { 'TORREFACTORA DE CÁFE', 'ESPULPADORA DE TOMATES Y FRUTAS', 'ARTESANIAS', + 'OTRO' ], [ACTIVIDAD_PRINCIPAL.TEXTIL]: [ 'ELABORACION DE UNIFORME ESCOLARES Y PRENDA DE VESTIR', @@ -138,12 +141,14 @@ export const ACTIVIDAD_PRODUCTIVA_MAP: Record = { 'ELABORACION DE LENCERIA', 'SUBLIMACION DE TEJIDOS', 'ELABORACION DE CALZADOS', + 'OTRO' ], [ACTIVIDAD_PRINCIPAL.CONSTRUCCION]: [ 'BLOQUERAS', 'PLANTA PREMEZCLADORA DE CEMENTO', 'CARPINTERIAS', 'HERRERIAS', + 'OTRO' ], [ACTIVIDAD_PRINCIPAL.BIENES_SERVICIOS]: [ 'MERCADOS COMUNALES', @@ -157,15 +162,17 @@ export const ACTIVIDAD_PRODUCTIVA_MAP: Record = { 'REPARACION DE CALZADOS', 'TALLER DE MECANICA', 'TRANSPORTES', + 'OTRO' ], - [ACTIVIDAD_PRINCIPAL.VISITAS_GUIADAS]: ['RUTAS TURISTICAS'], - [ACTIVIDAD_PRINCIPAL.ALOJAMIENTO]: ['POSADAS', 'HOTELES'], - [ACTIVIDAD_PRINCIPAL.TURISMO]: ['AGENCIAS DE VIAJES'], + [ACTIVIDAD_PRINCIPAL.VISITAS_GUIADAS]: ['RUTAS TURISTICAS', 'OTRO'], + [ACTIVIDAD_PRINCIPAL.ALOJAMIENTO]: ['POSADAS', 'HOTELES', 'OTRO'], + [ACTIVIDAD_PRINCIPAL.TURISMO]: ['AGENCIAS DE VIAJES', 'OTRO'], [ACTIVIDAD_PRINCIPAL.COMERCIO]: [ 'VENTA DE VIVERES', 'VENTAS DE PRENDAS DE VESTIR', 'VENTA DE PRODUCTOS QUIMICOS Y DERIVADOS', 'BODEGAS COMUNALES', 'FRIGORIFICOS Y CARNICOS', + 'OTRO' ], }; diff --git a/apps/web/feactures/training/schemas/training.ts b/apps/web/feactures/training/schemas/training.ts index 8ad3a9c..08340dd 100644 --- a/apps/web/feactures/training/schemas/training.ts +++ b/apps/web/feactures/training/schemas/training.ts @@ -46,6 +46,7 @@ export const trainingSchema = z.object({ productiveActivity: z.string({ message: 'Actividad Productiva es requerida', }), + productiveActivityOther: z.string().min(1, { message: 'Este campo es requerido' }).optional(), ospRif: z.string().optional().or(z.literal('')).nullable(), ospName: z.string().optional().or(z.literal('')).nullable(), companyConstitutionYear: z.coerce @@ -226,6 +227,7 @@ export const getTrainingSchema = z.object({ centralProductiveActivity: z.string(), mainProductiveActivity: z.string(), productiveActivity: z.string(), + productiveActivityOther: z.string(), ospRif: z.string().optional().or(z.literal('')).nullable(), ospName: z.string().optional().or(z.literal('')).nullable(), companyConstitutionYear: z.coerce.number(),