Se crea tarjeta de notas, lectura y creacion

This commit is contained in:
carlosfonseca 2024-01-16 22:25:17 -05:00
parent 29418d22bb
commit 27f9d5a7b2
3 changed files with 157 additions and 7 deletions

View File

@ -1,3 +1,94 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { date } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const noteFilter = {
order: 'created DESC',
where: {
clientFk: `${route.params.id}`,
},
};
const toCustomerNoteCreate = () => {
router.push({ name: 'CustomerNoteCreate' });
};
</script>
<template>
<div class="flex justify-center">Notes</div>
<QCard class="q-pa-lg">
<VnPaginate
data-key="CustomerNotes"
:url="'clientObservations'"
auto-load
:filter="noteFilter"
>
<template #body="{ rows }">
<div v-if="rows.length">
<QCard
v-for="(item, index) in rows"
:key="index"
:class="{
'consignees-card': true,
'q-mb-md': index < rows.length - 1,
}"
>
<div class="flex justify-between">
<p class="label-color">{{ item.worker.user.nickname }}</p>
<p class="label-color">
{{
date.formatDate(item?.created, 'DD-MM-YYYY HH:mm:ss')
}}
</p>
</div>
<h6 class="q-mt-xs q-mb-none">{{ item.text }}</h6>
</QCard>
</div>
<div v-else>
<h5 class="flex justify-center label-color">
{{ t('globals.noResults') }}
</h5>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn
@click.stop="toCustomerConsigneeCreate()"
color="primary"
fab
icon="add"
/>
<QTooltip>
{{ t('New consignee') }}
</QTooltip>
</QPageSticky>
</template>
</VnPaginate>
</QCard>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerNoteCreate()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New consignee') }}
</QTooltip>
</QPageSticky>
</template>
<style lang="scss">
.consignees-card {
border: 2px solid var(--vn-light-gray);
border-radius: 10px;
padding: 10px;
}
.label-color {
color: var(--vn-label);
}
</style>

View File

@ -0,0 +1,40 @@
<script setup>
import { onMounted, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
const { t } = useI18n();
const route = useRoute();
const initialData = reactive({
text: null,
});
onMounted(() => {
initialData.clientFk = `${route.params.id}`;
});
</script>
<template>
<FormModel
:form-initial-data="initialData"
:observe-form-changes="false"
url-create="ClientObservations"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QInput :label="t('Note')" type="textarea" v-model="data.text" />
</div>
</VnRow>
</template>
</FormModel>
</template>
<i18n>
es:
Note: Nota
</i18n>

View File

@ -198,12 +198,31 @@ export default {
},
{
path: 'notes',
name: 'CustomerNotes',
meta: {
title: 'notes',
icon: 'vn:notes',
},
component: () => import('src/pages/Customer/Card/CustomerNotes.vue'),
name: 'NotesCard',
redirect: { name: 'CustomerNotes' },
children: [
{
path: '',
name: 'CustomerNotes',
meta: {
title: 'notes',
icon: 'vn:notes',
},
component: () =>
import('src/pages/Customer/Card/CustomerNotes.vue'),
},
{
path: 'create',
name: 'CustomerNoteCreate',
meta: {
title: 'note-create',
},
component: () =>
import(
'src/pages/Customer/components/CustomerNoteCreate.vue'
),
},
],
},
{
path: 'credits',