Skip to content

Commit

Permalink
added options
Browse files Browse the repository at this point in the history
  • Loading branch information
juan cocchi committed Jul 31, 2024
1 parent f513399 commit 9365f26
Show file tree
Hide file tree
Showing 11 changed files with 290 additions and 22 deletions.
Binary file modified bun.lockb
Binary file not shown.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"private": true,
"type": "module",
"scripts": {
"predeploy": "bun run build",
"deploy": "gh-pages -d dist",
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
Expand All @@ -16,12 +14,12 @@
},
"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/babel__core": "^7.20.5",
"@types/node": "^20.14.5",
"@vitejs/plugin-vue": "^5.0.5",
"@vue/eslint-config-prettier": "^9.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/App.vue.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
export default _default;
44 changes: 44 additions & 0 deletions src/App.vue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });

function __VLS_template() {
var __VLS_ctx;
/* Components */
var __VLS_otherComponents;
var __VLS_own;
var __VLS_localComponents;
var __VLS_components;
var __VLS_styleScopedClasses;
var __VLS_resolvedLocalAndGlobalComponents;
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ id: ("app"), });
// @ts-ignore
var __VLS_0 = {}
.MyForm;
({}.MyForm);
__VLS_components.MyForm;
// @ts-ignore
[MyForm_vue_1.default,];
// @ts-ignore
var __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({}));
var __VLS_2 = __VLS_1.apply(void 0, __spreadArray([{}], __VLS_functionalComponentArgsRest(__VLS_1), false));
({}({}));
var __VLS_5 = __VLS_nonNullable(__VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2));
if (typeof __VLS_styleScopedClasses === 'object' && !Array.isArray(__VLS_styleScopedClasses)) {
}
var __VLS_slots;
return __VLS_slots;
var __VLS_componentsOption = {
MyForm: MyForm_vue_1.default
};
var __VLS_name = 'App';
var __VLS_internalComponent;
}
34 changes: 30 additions & 4 deletions src/components/MyForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,29 @@
<form @submit.prevent="handleSubmit">
<div class="form-group">
<label for="deviceType">Tipo de dispositivo:</label>
<input type="text" id="deviceType" v-model="form.deviceType" required />
<select id="deviceType" v-model="form.deviceType" required>
<option value="">Seleccione una opción</option>
<option value="PC">PC</option>
<option value="Mac">Mac</option>
<option value="iOS">iOS</option>
<option value="Android">Android</option>
</select>
</div>
<div class="form-group">
<label for="deviceModel">Modelo del dispositivo:</label>
<input type="text" id="deviceModel" v-model="form.deviceModel" required />
</div>
<div class="form-group">
<label for="operatingSystem">Sistema operativo:</label>
<input type="text" id="operatingSystem" v-model="form.operatingSystem" required />
<select id="operatingSystem" v-model="form.operatingSystem" @change="checkOtherOS" required>
<option value="">Seleccione una opción</option>
<option value="Windows 11">Windows 11</option>
<option value="macOS Ventura">macOS Ventura</option>
<option value="iOS 16">iOS 16</option>
<option value="Android 13">Android 13</option>
<option value="Other">Otro</option>
</select>
<input v-if="isOtherOS" type="text" v-model="form.otherOperatingSystem" placeholder="Ingrese el sistema operativo" required />
</div>
<div class="form-group">
<label for="appVersion">Versión de la aplicación:</label>
Expand Down Expand Up @@ -70,12 +84,13 @@
</template>

<script lang="ts">
import { defineComponent, reactive } from 'vue';
import { defineComponent, reactive, ref } from 'vue';
interface FormData {
deviceType: string;
deviceModel: string;
operatingSystem: string;
otherOperatingSystem?: string;
appVersion: string;
incidentDate: string;
problemDescription: string;
Expand Down Expand Up @@ -107,6 +122,8 @@ export default defineComponent({
screenshots: []
});
const isOtherOS = ref(false);
const handleFileUpload = (event: Event) => {
const files = (event.target as HTMLInputElement).files;
if (files) {
Expand All @@ -119,10 +136,19 @@ export default defineComponent({
// Add your form submission logic here
};
const checkOtherOS = () => {
isOtherOS.value = form.operatingSystem === 'Other';
if (!isOtherOS.value) {
form.otherOperatingSystem = '';
}
};
return {
form,
isOtherOS,
handleFileUpload,
handleSubmit
handleSubmit,
checkOtherOS
};
}
});
Expand Down
30 changes: 30 additions & 0 deletions src/components/MyForm.vue.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
declare const _default: import("vue").DefineComponent<{}, {
form: {
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: {
readonly lastModified: number;
readonly name: string;
readonly webkitRelativePath: string;
readonly size: number;
readonly type: string;
arrayBuffer: () => Promise<ArrayBuffer>;
slice: (start?: number, end?: number, contentType?: string) => Blob;
stream: () => ReadableStream<Uint8Array>;
text: () => Promise<string>;
}[];
};
handleFileUpload: (event: Event) => void;
handleSubmit: () => void;
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
export default _default;
165 changes: 165 additions & 0 deletions src/components/MyForm.vue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var vue_1 = require("vue");
exports.default = (0, vue_1.defineComponent)({
name: 'MyForm',
setup: function () {
var form = (0, vue_1.reactive)({
deviceType: '',
deviceModel: '',
operatingSystem: '',
appVersion: '',
incidentDate: '',
problemDescription: '',
reproduccionSteps: '',
expectedBehavior: '',
actualBehavior: '',
severityLevel: '',
hasPreviouslyOccurred: '',
additionalComments: '',
screenshots: []
});
var handleFileUpload = function (event) {
var files = event.target.files;
if (files) {
form.screenshots = Array.from(files);
}
};
var handleSubmit = function () {
console.log('Form submitted:', form);
// Add your form submission logic here
};
return {
form: form,
handleFileUpload: handleFileUpload,
handleSubmit: handleSubmit
};
}
});
;
function __VLS_template() {
var __VLS_ctx;
/* Components */
var __VLS_otherComponents;
var __VLS_own;
var __VLS_localComponents;
var __VLS_components;
var __VLS_styleScopedClasses;
// CSS variable injection
// CSS variable injection end
var __VLS_resolvedLocalAndGlobalComponents;
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-container") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.h2, __VLS_intrinsicElements.h2)(__assign({ class: ("form-title") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.form, __VLS_intrinsicElements.form)(__assign({ onSubmit: (__VLS_ctx.handleSubmit) }));
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("deviceType"), });
// @ts-ignore
[handleSubmit,];
__VLS_elementAsFunction(__VLS_intrinsicElements.input)({ type: ("text"), id: ("deviceType"), value: ((__VLS_ctx.form.deviceType)), required: (true), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("deviceModel"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.input)({ type: ("text"), id: ("deviceModel"), value: ((__VLS_ctx.form.deviceModel)), required: (true), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("operatingSystem"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.input)({ type: ("text"), id: ("operatingSystem"), value: ((__VLS_ctx.form.operatingSystem)), required: (true), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("appVersion"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.input)({ type: ("text"), id: ("appVersion"), value: ((__VLS_ctx.form.appVersion)), required: (true), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("incidentDate"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.input)({ type: ("datetime-local"), id: ("incidentDate"), required: (true), });
(__VLS_ctx.form.incidentDate);
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("problemDescription"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.textarea, __VLS_intrinsicElements.textarea)({ id: ("problemDescription"), value: ((__VLS_ctx.form.problemDescription)), required: (true), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("reproduccionSteps"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.textarea, __VLS_intrinsicElements.textarea)({ id: ("reproduccionSteps"), value: ((__VLS_ctx.form.reproduccionSteps)), required: (true), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("expectedBehavior"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.textarea, __VLS_intrinsicElements.textarea)({ id: ("expectedBehavior"), value: ((__VLS_ctx.form.expectedBehavior)), required: (true), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("actualBehavior"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.textarea, __VLS_intrinsicElements.textarea)({ id: ("actualBehavior"), value: ((__VLS_ctx.form.actualBehavior)), required: (true), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("severityLevel"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.select, __VLS_intrinsicElements.select)({ id: ("severityLevel"), value: ((__VLS_ctx.form.severityLevel)), required: (true), });
__VLS_elementAsFunction(__VLS_intrinsicElements.option, __VLS_intrinsicElements.option)({ value: (""), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.option, __VLS_intrinsicElements.option)({ value: ("low"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.option, __VLS_intrinsicElements.option)({ value: ("medium"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.option, __VLS_intrinsicElements.option)({ value: ("high"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.option, __VLS_intrinsicElements.option)({ value: ("critical"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("hasPreviouslyOccurred"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.select, __VLS_intrinsicElements.select)({ id: ("hasPreviouslyOccurred"), value: ((__VLS_ctx.form.hasPreviouslyOccurred)), required: (true), });
__VLS_elementAsFunction(__VLS_intrinsicElements.option, __VLS_intrinsicElements.option)({ value: (""), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.option, __VLS_intrinsicElements.option)({ value: ("yes"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.option, __VLS_intrinsicElements.option)({ value: ("no"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("additionalComments"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.textarea, __VLS_intrinsicElements.textarea)({ id: ("additionalComments"), value: ((__VLS_ctx.form.additionalComments)), });
// @ts-ignore
[form,];
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("form-group") }));
__VLS_elementAsFunction(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({ for: ("screenshots"), });
__VLS_elementAsFunction(__VLS_intrinsicElements.input)(__assign({ onChange: (__VLS_ctx.handleFileUpload) }, { type: ("file"), id: ("screenshots"), multiple: (true) }));
// @ts-ignore
[handleFileUpload,];
__VLS_elementAsFunction(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)(__assign({ type: ("submit") }, { class: ("submit-button") }));
if (typeof __VLS_styleScopedClasses === 'object' && !Array.isArray(__VLS_styleScopedClasses)) {
__VLS_styleScopedClasses['form-container'];
__VLS_styleScopedClasses['form-title'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['form-group'];
__VLS_styleScopedClasses['submit-button'];
}
var __VLS_slots;
return __VLS_slots;
var __VLS_componentsOption = {};
var __VLS_name = 'MyForm';
var __VLS_internalComponent;
}
1 change: 1 addition & 0 deletions src/main.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
5 changes: 5 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var vue_1 = require("vue");
var App_vue_1 = require("./App.vue");
(0, vue_1.createApp)(App_vue_1.default).mount('#app');
7 changes: 4 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{

"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"declaration": false,
"declarationMap": false,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
}
}

20 changes: 8 additions & 12 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
],
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})
'@': './src'
},
},
base: '/formulario-asesores/'
});

0 comments on commit 9365f26

Please sign in to comment.