#6321 - Negative ticket #158

Open
jsegarra wants to merge 156 commits from 6321_negative_tickets into dev
5 changed files with 0 additions and 2269 deletions
Showing only changes of commit 207097fa98 - Show all commits

View File

@ -1,72 +0,0 @@
diff --git a/quasar.config.js b/quasar.config.js
index 2d828950..80ddc375 100644
--- a/quasar.config.js
+++ b/quasar.config.js
@@ -29,7 +29,7 @@ module.exports = configure(function (/* ctx */) {
// app boot file (/src/boot)
// --> boot files are part of "main.js"
// https://v2.quasar.dev/quasar-cli/boot-files
- boot: ['i18n', 'axios', 'vnDate', 'validations'],
+ boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar'],
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
css: ['app.scss'],
diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js
new file mode 100644
index 00000000..7130b071
--- /dev/null
+++ b/src/boot/qformMixin.js
@@ -0,0 +1,28 @@
+import { QForm } from 'quasar';
+import { getCurrentInstance } from 'vue';
+
+export default {
+ inject: { QForm },
+ component: { QForm },
+ components: { QForm },
+ extends: { QForm },
+ mounted: function () {
+ const vm = getCurrentInstance();
+ if (vm.type.name === 'QForm')
+ if (![ 'searchbarForm'].includes(this.$el?.id)) {
+ let that = this;
+ const elementsArray = Array.from(this.$el.elements);
+ const index = elementsArray.findIndex(element => element.classList.contains('q-field__native'));
+
+ if (index !== -1) {
+ const firstInputElement = elementsArray[index];
+ firstInputElement.focus();
+ }
+ document.addEventListener('keyup', function (evt) {
+ if (evt.keyCode === 13) {
+ that.onSubmit();
+ }
+ });
+ }
+ },
+};
diff --git a/src/boot/quasar.js b/src/boot/quasar.js
new file mode 100644
index 00000000..a8d9b7ad
--- /dev/null
+++ b/src/boot/quasar.js
@@ -0,0 +1,6 @@
+import { boot } from 'quasar/wrappers';
+import qFormMixin from './qformMixin';
+
+export default boot(({ app }) => {
+ app.mixin(qFormMixin);
+});
diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue
index baab4829..a8065948 100644
--- a/src/components/ui/VnSearchbar.vue
+++ b/src/components/ui/VnSearchbar.vue
@@ -108,7 +108,7 @@ async function search() {
</script>
<template>
- <QForm @submit="search">
+ <QForm @submit="search" id="searchbarForm">
<VnInput
id="searchbar"
v-model="searchText"

View File

@ -1,33 +0,0 @@
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index f075d500..515e9d81 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -28,7 +28,7 @@
// Imports Quasar Cypress AE predefined commands
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
Cypress.Commands.add('login', (user) => {
- //cy.visit('/#/login');
+ cy.visit('/#/login');
cy.request({
method: 'POST',
url: '/api/accounts/login',
@@ -38,7 +38,18 @@ Cypress.Commands.add('login', (user) => {
},
}).then((response) => {
window.localStorage.setItem('token', response.body.token);
- });
+
+ cy.request({
+ method: 'GET',
+ url: '/api/VnUsers/ShareToken',
+ headers:{
+ Authorization: window.localStorage.getItem('token')
+ }
+ }).then(({body}) => {
+ console.log();
+ window.localStorage.setItem('tokenMultimedia', body.multimediaToken.id);
+ })
+});
});
Cypress.Commands.add('waitForElement', (element) => {

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue
index 021ee685..8ff625d5 100644
--- a/src/layouts/MainLayout.vue
+++ b/src/layouts/MainLayout.vue
@@ -5,7 +5,7 @@ const quasar = useQuasar();
</script>
<template>
- <QLayout view="hHh LpR fFf">
+ <QLayout view="hHh LspR fFf">
<Navbar />
<RouterView></RouterView>
<QFooter v-if="quasar.platform.is.mobile"></QFooter>

View File

@ -1,138 +0,0 @@
diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue
index 9f5ae319..61de5d9f 100644
--- a/src/components/FormModel.vue
+++ b/src/components/FormModel.vue
@@ -10,6 +10,7 @@ import { useValidator } from 'src/composables/useValidator';
import useNotify from 'src/composables/useNotify.js';
import SkeletonForm from 'components/ui/SkeletonForm.vue';
import VnConfirm from './ui/VnConfirm.vue';
+import { tMobile } from 'src/composables/tMobile';
const quasar = useQuasar();
const state = useState();
@@ -43,6 +44,10 @@ const $props = defineProps({
type: Boolean,
default: true,
},
+ defaultButtons: {
+ type: Object,
+ default: () => {},
+ },
autoLoad: {
type: Boolean,
default: false,
@@ -119,7 +124,19 @@ const hasChanges = ref(!$props.observeFormChanges);
const originalData = ref({ ...$props.formInitialData });
const formData = computed(() => state.get($props.model));
const formUrl = computed(() => $props.url);
-
+const defaultButtons = computed(() => ({
+ save: {
+ color: 'primary',
+ icon: 'restart_alt',
+ label: 'globals.save',
+ },
+ reset: {
+ color: 'primary',
+ icon: 'save',
+ label: 'globals.reset',
+ },
+ ...$props.defaultButtons,
+}));
const startFormWatcher = () => {
watch(
() => formData.value,
@@ -131,10 +148,6 @@ const startFormWatcher = () => {
);
};
-function tMobile(...args) {
- if (!quasar.platform.is.mobile) return t(...args);
-}
-
async function fetch() {
const { data } = await axios.get($props.url, {
params: { filter: JSON.stringify($props.filter) },
@@ -233,21 +246,21 @@ watch(formUrl, async () => {
<QBtnGroup push class="q-gutter-x-sm">
<slot name="moreActions" />
<QBtn
- :label="tMobile('globals.reset')"
- color="primary"
- icon="restart_alt"
+ :label="tMobile(defaultButtons.reset.label)"
+ :color="defaultButtons.reset.color"
+ :icon="defaultButtons.reset.icon"
flat
@click="reset"
:disable="!hasChanges"
- :title="t('globals.reset')"
+ :title="t(defaultButtons.reset.label)"
/>
<QBtn
- :label="tMobile('globals.save')"
- color="primary"
- icon="save"
+ :label="tMobile(defaultButtons.save.label)"
+ :color="defaultButtons.save.color"
+ :icon="defaultButtons.save.icon"
@click="save"
:disable="!hasChanges"
- :title="t('globals.save')"
+ :title="t(defaultButtons.save.label)"
/>
</QBtnGroup>
</div>
diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js
index be16e367..a9684e4d 100644
--- a/src/i18n/es/index.js
+++ b/src/i18n/es/index.js
@@ -31,6 +31,7 @@ export default {
close: 'Cerrar',
cancel: 'Cancelar',
confirm: 'Confirmar',
+ assign: 'Asignar',
back: 'Volver',
yes: 'Si',
no: 'No',
@@ -881,6 +882,7 @@ export default {
model: 'Modelo',
serialNumber: 'Número de serie',
removePDA: 'Desasignar PDA',
+ assignPDA: 'Asignar PDA',
},
create: {
name: 'Nombre',
diff --git a/src/pages/Worker/Card/WorkerPda.vue b/src/pages/Worker/Card/WorkerPda.vue
index a487f249..964846d7 100644
--- a/src/pages/Worker/Card/WorkerPda.vue
+++ b/src/pages/Worker/Card/WorkerPda.vue
@@ -2,14 +2,16 @@
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { onMounted, ref, computed } from 'vue';
-
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
-
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
import { useRole } from 'src/composables/useRole';
+import { tMobile } from 'src/composables/tMobile';
+import { useStateStore } from 'stores/useStateStore';
+
+const stateStore = useStateStore();
const route = useRoute();
const { t } = useI18n();
@@ -77,7 +79,9 @@ onMounted(async () => await fetchCurrentDeviceRef.value.fetch());
:url-create="`Workers/${route.params.id}/allocatePDA`"
model="DeviceProductionUser"
:form-initial-data="newPDA"
+ :default-actions="true"
auto-load
+ :default-buttons="{ save: { label: 'globals.assign' } }"
@on-data-saved="(_, data) => setCurrentPDA(data)"
>
<template #form="{ data }">