Skip to content

Commit

Permalink
formulario
Browse files Browse the repository at this point in the history
  • Loading branch information
juan cocchi committed Jul 31, 2024
1 parent f654e89 commit 458f52a
Show file tree
Hide file tree
Showing 17 changed files with 417 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# formulario-alfin

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
bun install
```

### Compile and Hot-Reload for Development

```sh
bun dev
```

### Type-Check, Compile and Minify for Production

```sh
bun build
```

### Lint with [ESLint](https://eslint.org/)

```sh
bun lint
```
Binary file added bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alfin Banco Formulario de Asesores</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "formulario-alfin",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d dist",
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"element-plus": "^2.7.8",
"gh-pages": "^6.1.1",
"vue": "^3.4.29"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.8.0",
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.14.5",
"@vitejs/plugin-vue": "^5.0.5",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"npm-run-all2": "^6.2.0",
"prettier": "^3.2.5",
"typescript": "~5.4.0",
"vite": "^5.3.1",
"vue-tsc": "^2.0.21"
}
}
Binary file added public/favicon.ico
Binary file not shown.
17 changes: 17 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div id="app">
<MyForm />
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import MyForm from './components/MyForm.vue';
export default defineComponent({
name: 'App',
components: {
MyForm
}
});
</script>
184 changes: 184 additions & 0 deletions src/components/MyForm.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<template>
<div class="form-container">
<h2 class="form-title">Reporte de Problemas</h2>
<form @submit.prevent="handleSubmit">
<div>
<label for="deviceType">Tipo de dispositivo:</label>
<input type="text" id="deviceType" v-model="form.deviceType" required />
</div>
<div>
<label for="deviceModel">Modelo del dispositivo:</label>
<input type="text" id="deviceModel" v-model="form.deviceModel" required />
</div>
<div>
<label for="operatingSystem">Sistema operativo:</label>
<input type="text" id="operatingSystem" v-model="form.operatingSystem" required />
</div>
<div>
<label for="appVersion">Versión de la aplicación:</label>
<input type="text" id="appVersion" v-model="form.appVersion" required />
</div>
<div>
<label for="incidentDate">Fecha y hora del incidente:</label>
<input type="datetime-local" id="incidentDate" v-model="form.incidentDate" required />
</div>
<div>
<label for="problemDescription">Descripción detallada del problema:</label>
<textarea id="problemDescription" v-model="form.problemDescription" required></textarea>
</div>
<div>
<label for="reproduccionSteps">Pasos para reproducir el problema:</label>
<textarea id="reproduccionSteps" v-model="form.reproduccionSteps" required></textarea>
</div>
<div>
<label for="expectedBehavior">Comportamiento esperado:</label>
<textarea id="expectedBehavior" v-model="form.expectedBehavior" required></textarea>
</div>
<div>
<label for="actualBehavior">Comportamiento actual:</label>
<textarea id="actualBehavior" v-model="form.actualBehavior" required></textarea>
</div>
<div>
<label for="severityLevel">Nivel de severidad:</label>
<select id="severityLevel" v-model="form.severityLevel" required>
<option value="">Seleccione una opción</option>
<option value="low">Bajo</option>
<option value="medium">Medio</option>
<option value="high">Alto</option>
<option value="critical">Crítico</option>
</select>
</div>
<div>
<label for="hasPreviouslyOccurred">¿Ha ocurrido este problema antes?</label>
<select id="hasPreviouslyOccurred" v-model="form.hasPreviouslyOccurred" required>
<option value="">Seleccione una opción</option>
<option value="yes">Sí</option>
<option value="no">No</option>
</select>
</div>
<div>
<label for="additionalComments">¿Algún otro comentario o información adicional?</label>
<textarea id="additionalComments" v-model="form.additionalComments"></textarea>
</div>
<div>
<label for="screenshots">Capturas de pantalla o videos:</label>
<input type="file" id="screenshots" multiple @change="handleFileUpload" />
</div>
<button type="submit">Enviar</button>
</form>
<button type="submit" class="submit-button">Enviar</button>
</div>

</template>


<script lang="ts">
import { defineComponent, reactive } from 'vue';
import { ElInput, ElSelect, ElOption, ElDatePicker, ElButton, ElUpload } from 'element-plus';
import 'element-plus/dist/index.css';
interface FormData {
deviceType: string;
deviceModel: string;
operatingSystem: string;
appVersion: string;
incidentDate: string;
problemDescription: string;
reproduccionSteps: string;
expectedBehavior: string;
actualBehavior: string;
severityLevel: string;
hasPreviouslyOccurred: string;
additionalComments: string;
screenshots: File[];
}
export default defineComponent({
name: 'MyForm',
components: {
ElInput,
ElSelect,
ElOption,
ElDatePicker,
ElButton,
ElUpload
},
setup() {
const form = reactive<FormData>({
deviceType: '',
deviceModel: '',
operatingSystem: '',
appVersion: '',
incidentDate: '',
problemDescription: '',
reproduccionSteps: '',
expectedBehavior: '',
actualBehavior: '',
severityLevel: '',
hasPreviouslyOccurred: '',
additionalComments: '',
screenshots: []
});
const handleFileUpload = (event: Event) => {
const files = (event.target as HTMLInputElement).files;
if (files) {
form.screenshots = Array.from(files);
}
};
const handleSubmit = () => {
console.log('Form submitted:', form);
// Add your form submission logic here
};
return {
form,
handleFileUpload,
handleSubmit
};
}
});
</script>

<style scoped>
.form-container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
border-radius: 4px;
}
.form-title {
font-size: 24px;
margin-bottom: 20px;
text-align: center;
}
.el-form-item {
margin-bottom: 20px;
}
.el-input,
.el-select,
.el-date-editor {
width: 100%;
}
.submit-button {
width: 100%;
padding: 10px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 4px;
cursor: pointer;
}
.submit-button:hover {
background-color: #0056b3;
}
</style>

4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')
14 changes: 14 additions & 0 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",

"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
12 changes: 12 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
Loading

0 comments on commit 458f52a

Please sign in to comment.