Desarrollo de los submodulos basic data, notes y pbx #245

Merged
jsegarra merged 16 commits from :features/ms_submodulos_worker into dev 2024-04-08 06:19:29 +00:00
4 changed files with 129 additions and 12 deletions
Showing only changes of commit 239daceca6 - Show all commits

View File

@ -227,6 +227,7 @@ watch(formUrl, async () => {
defineExpose({
save,
isLoading,
hasChanges,
});
</script>
<template>

View File

@ -12,8 +12,6 @@ import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const route = useRoute();
const { t } = useI18n();
const formInitialData = reactive({});
const workersOptions = ref([]);
const countriesOptions = ref([]);
const educationLevelsOptions = ref([]);
@ -71,7 +69,6 @@ const maritalStatus = [
<FormModel
:filter="workerFilter"
:form-initial-data="formInitialData"
:url="`Workers/${route.params.id}`"
auto-load
model="Worker"

View File

@ -1,5 +1,5 @@
<script setup>
import { reactive, watch } from 'vue';
import { watch, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
@ -7,12 +7,13 @@ import { useState } from 'src/composables/useState';
import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const state = useState();
const route = useRoute();
const formInitialData = reactive({});
const workerPBXForm = ref();
const extension = ref(null);
const filter = {
include: [
@ -27,26 +28,39 @@ watch(
() => state.set('extension', null)
);
const onFetch = (data) => state.set('extension', data?.sip?.extension);
const onFetch = (data) => {
state.set('extension', data?.sip?.extension);
extension.value = state.get('extension');
};
const updateModelValue = (data) => state.set('extension', data);
const updateModelValue = (data) => {
jsegarra marked this conversation as resolved Outdated

Los botones no se habilitan cuando se modifica el campo

Los botones no se habilitan cuando se modifica el campo

Corregido

Commit: 239daceca6

Corregido Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/239daceca60bd3158ea8faa79c851a137a7e3a4a
state.set('extension', data);
workerPBXForm.value.hasChanges = true;
};
jsegarra marked this conversation as resolved Outdated

En el caso de que este funcionando bien. Al pulsar guardar, que URL se usaría

En el caso de que este funcionando bien. Al pulsar guardar, que URL se usaría

Corregido

Commit: 239daceca6

Corregido Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/239daceca60bd3158ea8faa79c851a137a7e3a4a
</script>
<template>
<FormModel
ref="workerPBXForm"
:filter="filter"
:form-initial-data="formInitialData"
:url="`Workers/${route.params.id}`"
url-update="Sips"
jsegarra marked this conversation as resolved Outdated

QInput? Usar VnInput

QInput? Usar VnInput

Corregido

Commit: 239daceca6

Corregido Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/239daceca60bd3158ea8faa79c851a137a7e3a4a
auto-load
jsegarra marked this conversation as resolved
Review

Cuando se pierde el foco del campo el valor del input desaparece

Cuando se pierde el foco del campo el valor del input desaparece
Review

Corregido

Commit: 239daceca6

Corregido Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/239daceca60bd3158ea8faa79c851a137a7e3a4a
:mapper="
() => ({
userFk: +route.params.id,
extension,
})
"
model="DeviceProductionUser"
@on-fetch="onFetch"
>
<template #form="{ data }">
<template #form="{}">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QInput
<VnInput
:label="t('worker.summary.sipExtension')"
:model-value="data?.sip?.extension"
v-model="extension"
@update:model-value="updateModelValue"
/>
</div>

105
worker.patch Normal file
View File

@ -0,0 +1,105 @@
diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue
jsegarra marked this conversation as resolved Outdated
Outdated
Review

Eliminar este archivo...

Eliminar este archivo...

Eliminado

Commit: 3055db8ef8

Eliminado Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/3055db8ef8d33ea10e29a985d5b6f4416617911f
index 6fa17dfc..74917b1c 100644
--- a/src/components/FormModel.vue
+++ b/src/components/FormModel.vue
@@ -227,6 +227,7 @@ watch(formUrl, async () => {
defineExpose({
save,
isLoading,
+ hasChanges,
});
</script>
<template>
@@ -252,6 +253,7 @@ defineExpose({
to="#st-actions"
v-if="stateStore?.isSubToolbarShown() && componentIsRendered"
>
+ {{ hasChanges }}
<div v-if="$props.defaultActions">
<QBtnGroup push class="q-gutter-x-sm">
<slot name="moreActions" />
diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue
index be362c72..dcc37208 100644
--- a/src/pages/Worker/Card/WorkerBasicData.vue
+++ b/src/pages/Worker/Card/WorkerBasicData.vue
@@ -71,7 +71,6 @@ const maritalStatus = [
<FormModel
:filter="workerFilter"
- :form-initial-data="formInitialData"
:url="`Workers/${route.params.id}`"
auto-load
model="Worker"
diff --git a/src/pages/Worker/Card/WorkerPBX.vue b/src/pages/Worker/Card/WorkerPBX.vue
index 53dd8058..68119406 100644
--- a/src/pages/Worker/Card/WorkerPBX.vue
+++ b/src/pages/Worker/Card/WorkerPBX.vue
@@ -1,5 +1,5 @@
<script setup>
-import { reactive, watch } from 'vue';
+import { watch, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
@@ -7,12 +7,13 @@ import { useState } from 'src/composables/useState';
import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
+import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const state = useState();
const route = useRoute();
-
-const formInitialData = reactive({});
+const workerPBXForm = ref();
+const extension = ref(null);
const filter = {
include: [
@@ -27,26 +28,39 @@ watch(
() => state.set('extension', null)
);
-const onFetch = (data) => state.set('extension', data?.sip?.extension);
+const onFetch = (data) => {
+ state.set('extension', data?.sip?.extension);
+ extension.value = state.get('extension');
+};
-const updateModelValue = (data) => state.set('extension', data);
+const updateModelValue = (data) => {
+ state.set('extension', data);
+ workerPBXForm.value.hasChanges = true;
+};
</script>
<template>
<FormModel
+ ref="workerPBXForm"
:filter="filter"
- :form-initial-data="formInitialData"
:url="`Workers/${route.params.id}`"
+ url-update="Sips"
auto-load
+ :mapper="
+ () => ({
+ userFk: +route.params.id,
+ extension,
+ })
+ "
model="DeviceProductionUser"
@on-fetch="onFetch"
>
- <template #form="{ data }">
+ <template #form="{}">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
- <QInput
+ <VnInput
:label="t('worker.summary.sipExtension')"
- :model-value="data?.sip?.extension"
+ v-model="extension"
@update:model-value="updateModelValue"
/>
</div>