feat: refs #8304 added remove option to operator #1195

Merged
jtubau merged 27 commits from 8304-workerChangesAndFixes into dev 2025-02-05 12:25:27 +00:00
4 changed files with 43 additions and 31 deletions
Showing only changes of commit 8599974437 - Show all commits

View File

@ -26,6 +26,7 @@ const $props = defineProps({
addNote: { type: Boolean, default: false },
selectType: { type: Boolean, default: false },
justInput: { type: Boolean, default: false },
required: { type: Boolean, default: false },
jtubau marked this conversation as resolved Outdated

Porque prop y no un attr?

Porque prop y no un attr?
});
const { t } = useI18n();
@ -53,7 +54,6 @@ async function insert() {
await vnPaginateRef.value.fetch();
}
function confirmAndUpdate() {
if(!newNote.text && originalText)
quasar
@ -101,7 +101,7 @@ onBeforeRouteLeave((to, from, next) => {
:filter="{ fields: ['id', 'description'] }"
auto-load
@on-fetch="(data) => (observationTypes = data)"
/>
/>
<FetchData
v-if="justInput"
jtubau marked this conversation as resolved Outdated

Si usamos selectType para vincularlo con un VnSelect, porque si lo relacionamos con VnInput no hacemos inputType?

Si usamos selectType para vincularlo con un VnSelect, porque si lo relacionamos con VnInput no hacemos inputType?
:url="url"
@ -110,7 +110,7 @@ onBeforeRouteLeave((to, from, next) => {
auto-load
/>
<QCard
class="q-pa-xs q-mb-lg full-width"
class="q-pa-xs q-mb-lg full-width"
v-if="$props.addNote || $props.justInput"
:style="$props.justInput ? 'padding-right: 18px; margin-bottom: 2px; box-shadow: none;' : ''"
jtubau marked this conversation as resolved Outdated

podemos simplificar con :class="{condicion: "clase CSS"}

podemos simplificar con :class="{condicion: "clase CSS"}
>
@ -126,19 +126,19 @@ onBeforeRouteLeave((to, from, next) => {
v-model="newNote.observationTypeFk"
option-label="description"
style="flex: 0.15"
:required="true"
:required="$props.required"
@keyup.enter.stop="insert"
/>
<VnInput
v-model.trim="newNote.text"
type="textarea"
:label="t('Add note here...')"
:label="$props.justInput && newNote.text ? '' : t('Add note here...')"
filled
size="lg"
autogrow
@keyup.enter.stop="handleClick"
:required="$props.required"
clearable
:required="true"
>
<template #append>
<QBtn
@ -257,4 +257,6 @@ onBeforeRouteLeave((to, from, next) => {
New note: Nueva nota
Save (Enter): Guardar (Intro)
Observation type: Tipo de observación
New note is empty: La nueva nota esta vacia
Are you sure remove this note?: Estas seguro de quitar esta nota?
</i18n>

View File

@ -1,8 +1,10 @@
<script setup>
jtubau marked this conversation as resolved
Review

Revisar este componente porque no tiene el mismo estilo en dev que en esta rama

Revisar este componente porque no tiene el mismo estilo en dev que en esta rama
import { onMounted, onBeforeUnmount, ref } from 'vue';
import { useStateStore } from 'stores/useStateStore';
import { computed } from 'vue';
const stateStore = useStateStore();
const general = ref(null);
const actions = ref(null);
const data = ref(null);
const opts = { subtree: true, childList: true, attributes: true };
@ -12,35 +14,44 @@ onMounted(() => {
stateStore.toggleSubToolbar();
actions.value = document.querySelector('#st-actions');
data.value = document.querySelector('#st-data');
general.value = document.querySelector('#st-default');
if (!actions.value && !data.value) return;
if (!actions.value && !data.value && !general.value) return;
// Check if there's content to display
const observer = new MutationObserver(
() =>
(hasContent.value =
actions.value?.childNodes?.length + data.value?.childNodes?.length)
actions.value?.childNodes?.length + data.value?.childNodes?.length + general.value?.childNodes?.length)
);
if (actions.value) observer.observe(actions.value, opts);
if (data.value) observer.observe(data.value, opts);
if (general.value) observer.observe(general.value, opts);
});
onBeforeUnmount(() => stateStore.toggleSubToolbar());
const generalChildCount = () => {
jtubau marked this conversation as resolved Outdated

no hace falta definir llaves y return

no hace falta definir llaves y return
return !!general.value.childNodes.length;
}
onBeforeUnmount(() => stateStore.toggleSubToolbar() && hasSubToolbar);
</script>
<template>
<QToolbar
id="subToolbar"
class="justify-end sticky"
v-show="hasContent || $slots['st-actions'] || $slots['st-data']"
v-show="hasContent || $slots['st-actions'] || $slots['st-data'] || $slots['st-default']"
:class="{'justify-end': !generalChildCount, 'sticky': !generalChildCount}"
>
<slot name="st-data">
<div id="st-data"></div>
</slot>
<QSpace />
<slot name="st-actions">
<div id="st-actions"></div>
<slot>
<div :class="{'full-width' : generalChildCount, 'q-px-none': generalChildCount }" id="st-default"></div>
</slot>
<slot name="st-data">
<div id="st-data"></div>
</slot>
<QSpace />
<slot name="st-actions">
<div id="st-actions"></div>
</slot>
</QToolbar>
</template>
<style lang="scss" scoped>

View File

@ -23,5 +23,6 @@ const noteFilter = computed(() => {
:body="{ clientFk: route.params.id }"
style="overflow-y: auto"
:select-type="true"
:required="true"
/>
</template>

View File

@ -193,20 +193,18 @@ watch([year, businessFk], () => refreshData());
:year-holidays="yearHolidays"
/>
</Teleport>
<div>
<VnNotes
v-if="canSeeNotes"
:just-input="true"
:url="`Workers/${route.params.id}/business`"
:filter="{fields: ['id', 'notes', 'workerFk']}"
:save-url="saveUrl"
@on-fetch="(data) => {
console.log(data);
saveUrl = `Businesses/${data[0].id}`
}"
:body="body"
/>
</div>
<Teleport to="#st-default" v-if="stateStore.isSubToolbarShown()">
<VnNotes
v-if="canSeeNotes"
:just-input="true"
:url="`Workers/${route.params.id}/business`"
:filter="{fields: ['id', 'notes', 'workerFk']}"
:save-url="saveUrl"
@on-fetch="(data) => { saveUrl = `Businesses/${data[0].id}` }"
:body="body"
:required="false"
/>
</Teleport>
<QPage class="column items-center">
<QCard v-if="workerIsFreelance">
<QCardSection class="text-center">