Merge branch 'dev' into 6346-fixWagonModule
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
b4fb9ceb2e
|
@ -0,0 +1,50 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FormModelPopup from './FormModelPopup.vue';
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<FormModelPopup
|
||||
url-create="Expenses"
|
||||
model="Expense"
|
||||
:title="t('New expense')"
|
||||
:form-initial-data="{ id: null, isWithheld: false, name: null }"
|
||||
@on-data-saved="emit('onDataSaved', $event)"
|
||||
>
|
||||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="`${t('globals.code')}`"
|
||||
v-model="data.id"
|
||||
:required="true"
|
||||
:rules="validate('expense.code')"
|
||||
/>
|
||||
<QCheckbox
|
||||
dense
|
||||
size="sm"
|
||||
:label="`${t('It\'s a withholding')}`"
|
||||
v-model="data.isWithheld"
|
||||
:rules="validate('expense.isWithheld')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="`${t('globals.description')}`"
|
||||
v-model="data.name"
|
||||
:required="true"
|
||||
:rules="validate('expense.description')"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New expense: Nuevo gasto
|
||||
It's a withholding: Es una retención
|
||||
</i18n>
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { onMounted, ref, reactive } from 'vue';
|
||||
import { onMounted, watch, ref, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { QSeparator, useQuasar } from 'quasar';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
@ -29,6 +29,15 @@ onMounted(async () => {
|
|||
getRoutes();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => route.matched,
|
||||
() => {
|
||||
items.value = [];
|
||||
getRoutes();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
function findMatches(search, item) {
|
||||
const matches = [];
|
||||
function findRoute(search, item) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import VnJsonValue from '../common/VnJsonValue.vue';
|
|||
import FetchData from '../FetchData.vue';
|
||||
import VnSelect from './VnSelect.vue';
|
||||
import VnUserLink from '../ui/VnUserLink.vue';
|
||||
import VnPaginate from '../ui/VnPaginate.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const validationsStore = useValidator();
|
||||
|
@ -66,9 +67,10 @@ const filter = {
|
|||
},
|
||||
},
|
||||
],
|
||||
where: { and: [{ originFk: route.params.id }] },
|
||||
};
|
||||
|
||||
const workers = ref();
|
||||
const paginate = ref();
|
||||
const actions = ref();
|
||||
const changeInput = ref();
|
||||
const searchInput = ref();
|
||||
|
@ -235,9 +237,7 @@ async function openPointRecord(id, modelLog) {
|
|||
const locale = validations[modelLog.model]?.locale || {};
|
||||
pointRecord.value = parseProps(propNames, locale, data);
|
||||
}
|
||||
async function setLogTree() {
|
||||
filter.where = { and: [{ originFk: route.params.id }] };
|
||||
const { data } = await getLogs(filter);
|
||||
async function setLogTree(data) {
|
||||
logTree.value = getLogTree(data);
|
||||
}
|
||||
|
||||
|
@ -266,15 +266,7 @@ async function applyFilter() {
|
|||
filter.where.and.push(selectedFilters.value);
|
||||
}
|
||||
|
||||
const { data } = await getLogs(filter);
|
||||
|
||||
logTree.value = getLogTree(data);
|
||||
}
|
||||
|
||||
async function getLogs(filter) {
|
||||
return axios.get(props.url ?? `${props.model}Logs`, {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
paginate.value.fetch(filter);
|
||||
}
|
||||
|
||||
function setDate(type) {
|
||||
|
@ -377,8 +369,6 @@ async function clearFilter() {
|
|||
await applyFilter();
|
||||
}
|
||||
|
||||
setLogTree();
|
||||
|
||||
onUnmounted(() => {
|
||||
stateStore.rightDrawer = false;
|
||||
});
|
||||
|
@ -391,16 +381,6 @@ watch(
|
|||
);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
:url="`${props.model}Logs/${route.params.id}/editors`"
|
||||
:filter="{
|
||||
fields: ['id', 'nickname', 'name', 'image'],
|
||||
order: 'nickname',
|
||||
limit: 30,
|
||||
}"
|
||||
@on-fetch="(data) => (workers = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
:url="`${props.model}Logs/${route.params.id}/models`"
|
||||
:filter="{ order: ['changedModel'] }"
|
||||
|
@ -418,231 +398,283 @@ watch(
|
|||
"
|
||||
auto-load
|
||||
/>
|
||||
<div
|
||||
class="column items-center logs origin-log q-mt-md"
|
||||
v-for="(originLog, originLogIndex) in logTree"
|
||||
:key="originLogIndex"
|
||||
<VnPaginate
|
||||
ref="paginate"
|
||||
:data-key="`${model}Log`"
|
||||
:url="`${model}Logs`"
|
||||
:filter="filter"
|
||||
:skeleton="false"
|
||||
auto-load
|
||||
@on-fetch="setLogTree"
|
||||
>
|
||||
<QItem class="origin-info items-center q-my-md" v-if="logTree.length > 1">
|
||||
<h6 class="origin-id text-grey">
|
||||
{{ useCapitalize(validations[props.model].locale.name) }}
|
||||
#{{ originLog.originFk }}
|
||||
</h6>
|
||||
<div class="line bg-grey"></div>
|
||||
</QItem>
|
||||
<div
|
||||
class="user-log q-mb-sm"
|
||||
v-for="(userLog, userIndex) in originLog.logs"
|
||||
:key="userIndex"
|
||||
>
|
||||
<div class="timeline">
|
||||
<div class="user-avatar">
|
||||
<VnUserLink :worker-id="userLog?.user?.id">
|
||||
<template #link>
|
||||
<VnAvatar
|
||||
:class="{ 'cursor-pointer': userLog?.user?.id }"
|
||||
:worker-id="userLog?.user?.id"
|
||||
:title="userLog?.user?.nickname"
|
||||
:show-letter="!userLog?.user"
|
||||
size="lg"
|
||||
/>
|
||||
</template>
|
||||
</VnUserLink>
|
||||
</div>
|
||||
<div class="arrow bg-panel" v-if="byRecord"></div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<QList class="user-changes" v-if="userLog">
|
||||
<QItem
|
||||
class="model-log column q-px-none q-py-xs"
|
||||
v-for="(modelLog, modelLogIndex) in userLog.logs"
|
||||
:key="modelLogIndex"
|
||||
<template #body>
|
||||
<div
|
||||
class="column items-center logs origin-log q-mt-md"
|
||||
v-for="(originLog, originLogIndex) in logTree"
|
||||
:key="originLogIndex"
|
||||
>
|
||||
<QItem class="origin-info items-center q-my-md" v-if="logTree.length > 1">
|
||||
<h6 class="origin-id text-grey">
|
||||
{{ useCapitalize(validations[props.model].locale.name) }}
|
||||
#{{ originLog.originFk }}
|
||||
</h6>
|
||||
<div class="line bg-grey"></div>
|
||||
</QItem>
|
||||
<div
|
||||
class="user-log q-mb-sm"
|
||||
v-for="(userLog, userIndex) in originLog.logs"
|
||||
:key="userIndex"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel class="model-info q-mb-xs" v-if="!byRecord">
|
||||
<QChip
|
||||
dense
|
||||
size="md"
|
||||
class="model-name q-mr-xs text-white"
|
||||
v-if="
|
||||
!(modelLog.changedModel && modelLog.changedModelId) &&
|
||||
modelLog.model
|
||||
"
|
||||
:style="{
|
||||
backgroundColor: useColor(modelLog.model),
|
||||
}"
|
||||
:title="`${modelLog.model} #${modelLog.id}`"
|
||||
>
|
||||
{{ t(modelLog.modelI18n) }}
|
||||
</QChip>
|
||||
|
||||
<span
|
||||
class="model-id q-mr-xs"
|
||||
v-if="modelLog.summaryId"
|
||||
v-text="`#${modelLog.summaryId}`"
|
||||
/>
|
||||
<span
|
||||
class="model-value"
|
||||
:title="modelLog.showValue"
|
||||
v-text="modelLog.showValue"
|
||||
/>
|
||||
<QBtn
|
||||
flat
|
||||
round
|
||||
color="grey"
|
||||
class="q-mr-xs q-ml-auto"
|
||||
size="sm"
|
||||
icon="filter_alt"
|
||||
:title="t('recordChanges')"
|
||||
@click.stop="filterByRecord(modelLog)"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QCard
|
||||
class="changes-log q-py-none q-mb-xs"
|
||||
v-for="(log, logIndex) in modelLog.logs"
|
||||
:key="logIndex"
|
||||
<div class="timeline">
|
||||
<div class="user-avatar">
|
||||
<VnUserLink :worker-id="userLog?.user?.id">
|
||||
<template #link>
|
||||
<VnAvatar
|
||||
:class="{ 'cursor-pointer': userLog?.user?.id }"
|
||||
:worker-id="userLog?.user?.id"
|
||||
:title="userLog?.user?.nickname"
|
||||
:show-letter="!userLog?.user"
|
||||
size="lg"
|
||||
/>
|
||||
</template>
|
||||
</VnUserLink>
|
||||
</div>
|
||||
<div class="arrow bg-panel" v-if="byRecord"></div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<QList class="user-changes" v-if="userLog">
|
||||
<QItem
|
||||
class="model-log column q-px-none q-py-xs"
|
||||
v-for="(modelLog, modelLogIndex) in userLog.logs"
|
||||
:key="modelLogIndex"
|
||||
>
|
||||
<QCardSection class="change-info q-pa-none">
|
||||
<QItem
|
||||
class="q-px-sm q-py-xs justify-between items-center"
|
||||
>
|
||||
<div
|
||||
class="date text-grey text-caption q-mr-sm"
|
||||
:title="
|
||||
date.formatDate(
|
||||
log.creationDate,
|
||||
'DD/MM/YYYY hh:mm:ss'
|
||||
) ?? `date:'dd/MM/yyyy HH:mm:ss'`
|
||||
<QItemSection>
|
||||
<QItemLabel class="model-info q-mb-xs" v-if="!byRecord">
|
||||
<QChip
|
||||
dense
|
||||
size="md"
|
||||
class="model-name q-mr-xs text-white"
|
||||
v-if="
|
||||
!(
|
||||
modelLog.changedModel &&
|
||||
modelLog.changedModelId
|
||||
) && modelLog.model
|
||||
"
|
||||
:style="{
|
||||
backgroundColor: useColor(modelLog.model),
|
||||
}"
|
||||
:title="`${modelLog.model} #${modelLog.id}`"
|
||||
>
|
||||
{{ toRelativeDate(log.creationDate) }}
|
||||
</div>
|
||||
<div>
|
||||
<QBtn
|
||||
color="grey"
|
||||
class="pit"
|
||||
icon="preview"
|
||||
flat
|
||||
round
|
||||
:title="t('pointRecord')"
|
||||
padding="none"
|
||||
v-if="log.action != 'insert'"
|
||||
@click.stop="
|
||||
openPointRecord(log.id, modelLog)
|
||||
"
|
||||
>
|
||||
<QPopupProxy>
|
||||
<QCard v-if="pointRecord">
|
||||
<div
|
||||
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
|
||||
>
|
||||
{{ modelLog.modelI18n }}
|
||||
<span v-if="modelLog.id"
|
||||
>#{{ modelLog.id }}</span
|
||||
>
|
||||
</div>
|
||||
<QCardSection
|
||||
class="change-detail q-pa-sm"
|
||||
>
|
||||
<QItem
|
||||
v-for="(
|
||||
value, index
|
||||
) in pointRecord"
|
||||
:key="index"
|
||||
class="q-pa-none"
|
||||
>
|
||||
<span
|
||||
class="json-field q-mr-xs text-grey"
|
||||
:title="value.name"
|
||||
>
|
||||
{{ value.nameI18n }}:
|
||||
</span>
|
||||
<VnJsonValue
|
||||
:value="value.val.val"
|
||||
/>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QPopupProxy>
|
||||
</QBtn>
|
||||
<QIcon
|
||||
class="action q-ml-xs"
|
||||
:class="actionsClass[log.action]"
|
||||
:name="actionsIcon[log.action]"
|
||||
:title="
|
||||
t(`actions.${actionsText[log.action]}`)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
class="change-detail q-px-sm q-py-xs"
|
||||
:class="{ expanded: log.expand }"
|
||||
v-if="log.props.length || log.description"
|
||||
>
|
||||
<QIcon
|
||||
class="cursor-pointer q-mr-md"
|
||||
color="grey"
|
||||
name="expand_more"
|
||||
:title="t('globals.details')"
|
||||
size="sm"
|
||||
@click="log.expand = !log.expand"
|
||||
/>
|
||||
<span v-if="log.props.length" class="attributes">
|
||||
<span v-if="!log.expand" class="q-pa-none text-grey">
|
||||
<span
|
||||
v-for="(prop, propIndex) in log.props"
|
||||
:key="propIndex"
|
||||
class="basic-json"
|
||||
>
|
||||
<span class="json-field" :title="prop.name">
|
||||
{{ prop.nameI18n }}:
|
||||
</span>
|
||||
<VnJsonValue :value="prop.val.val" />
|
||||
<span v-if="propIndex < log.props.length - 1"
|
||||
>,
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
{{ t(modelLog.modelI18n) }}
|
||||
</QChip>
|
||||
|
||||
<span
|
||||
v-if="log.expand"
|
||||
class="expanded-json column q-pa-none"
|
||||
>
|
||||
<div
|
||||
v-for="(prop, prop2Index) in log.props"
|
||||
:key="prop2Index"
|
||||
class="q-pa-none text-grey"
|
||||
class="model-id q-mr-xs"
|
||||
v-if="modelLog.summaryId"
|
||||
v-text="`#${modelLog.summaryId}`"
|
||||
/>
|
||||
<span
|
||||
class="model-value"
|
||||
:title="modelLog.showValue"
|
||||
v-text="modelLog.showValue"
|
||||
/>
|
||||
<QBtn
|
||||
flat
|
||||
round
|
||||
color="grey"
|
||||
class="q-mr-xs q-ml-auto"
|
||||
size="sm"
|
||||
icon="filter_alt"
|
||||
:title="t('recordChanges')"
|
||||
@click.stop="filterByRecord(modelLog)"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QCard
|
||||
class="changes-log q-py-none q-mb-xs"
|
||||
v-for="(log, logIndex) in modelLog.logs"
|
||||
:key="logIndex"
|
||||
>
|
||||
<QCardSection class="change-info q-pa-none">
|
||||
<QItem
|
||||
class="q-px-sm q-py-xs justify-between items-center"
|
||||
>
|
||||
<span class="json-field" :title="prop.name">
|
||||
{{ prop.nameI18n }}:
|
||||
</span>
|
||||
<VnJsonValue :value="prop.val.val" />
|
||||
<span v-if="prop.val.id" class="id-value">
|
||||
#{{ prop.val.id }}
|
||||
</span>
|
||||
<span v-if="log.action == 'update'">
|
||||
←
|
||||
<VnJsonValue :value="prop.old.val" />
|
||||
<span v-if="prop.old.id" class="id-value">
|
||||
#{{ prop.old.id }}
|
||||
<div
|
||||
class="date text-grey text-caption q-mr-sm"
|
||||
:title="
|
||||
date.formatDate(
|
||||
log.creationDate,
|
||||
'DD/MM/YYYY hh:mm:ss'
|
||||
) ?? `date:'dd/MM/yyyy HH:mm:ss'`
|
||||
"
|
||||
>
|
||||
{{ toRelativeDate(log.creationDate) }}
|
||||
</div>
|
||||
<div>
|
||||
<QBtn
|
||||
color="grey"
|
||||
class="pit"
|
||||
icon="preview"
|
||||
flat
|
||||
round
|
||||
:title="t('pointRecord')"
|
||||
padding="none"
|
||||
v-if="log.action != 'insert'"
|
||||
@click.stop="
|
||||
openPointRecord(log.id, modelLog)
|
||||
"
|
||||
>
|
||||
<QPopupProxy>
|
||||
<QCard v-if="pointRecord">
|
||||
<div
|
||||
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
|
||||
>
|
||||
{{ modelLog.modelI18n }}
|
||||
<span v-if="modelLog.id"
|
||||
>#{{
|
||||
modelLog.id
|
||||
}}</span
|
||||
>
|
||||
</div>
|
||||
<QCardSection
|
||||
class="change-detail q-pa-sm"
|
||||
>
|
||||
<QItem
|
||||
v-for="(
|
||||
value, index
|
||||
) in pointRecord"
|
||||
:key="index"
|
||||
class="q-pa-none"
|
||||
>
|
||||
<span
|
||||
class="json-field q-mr-xs text-grey"
|
||||
:title="
|
||||
value.name
|
||||
"
|
||||
>
|
||||
{{
|
||||
value.nameI18n
|
||||
}}:
|
||||
</span>
|
||||
<VnJsonValue
|
||||
:value="
|
||||
value.val.val
|
||||
"
|
||||
/>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QPopupProxy>
|
||||
</QBtn>
|
||||
<QIcon
|
||||
class="action q-ml-xs"
|
||||
:class="actionsClass[log.action]"
|
||||
:name="actionsIcon[log.action]"
|
||||
:title="
|
||||
t(
|
||||
`actions.${
|
||||
actionsText[log.action]
|
||||
}`
|
||||
)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
class="change-detail q-px-sm q-py-xs"
|
||||
:class="{ expanded: log.expand }"
|
||||
v-if="log.props.length || log.description"
|
||||
>
|
||||
<QIcon
|
||||
class="cursor-pointer q-mr-md"
|
||||
color="grey"
|
||||
name="expand_more"
|
||||
:title="t('globals.details')"
|
||||
size="sm"
|
||||
@click="log.expand = !log.expand"
|
||||
/>
|
||||
<span v-if="log.props.length" class="attributes">
|
||||
<span
|
||||
v-if="!log.expand"
|
||||
class="q-pa-none text-grey"
|
||||
>
|
||||
<span
|
||||
v-for="(prop, propIndex) in log.props"
|
||||
:key="propIndex"
|
||||
class="basic-json"
|
||||
>
|
||||
<span
|
||||
class="json-field"
|
||||
:title="prop.name"
|
||||
>
|
||||
{{ prop.nameI18n }}:
|
||||
</span>
|
||||
<VnJsonValue :value="prop.val.val" />
|
||||
<span
|
||||
v-if="
|
||||
propIndex <
|
||||
log.props.length - 1
|
||||
"
|
||||
>,
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
</span>
|
||||
<span v-if="!log.props.length" class="description">
|
||||
{{ log.description }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
v-if="log.expand"
|
||||
class="expanded-json column q-pa-none"
|
||||
>
|
||||
<div
|
||||
v-for="(
|
||||
prop, prop2Index
|
||||
) in log.props"
|
||||
:key="prop2Index"
|
||||
class="q-pa-none text-grey"
|
||||
>
|
||||
<span
|
||||
class="json-field"
|
||||
:title="prop.name"
|
||||
>
|
||||
{{ prop.nameI18n }}:
|
||||
</span>
|
||||
<VnJsonValue :value="prop.val.val" />
|
||||
<span
|
||||
v-if="prop.val.id"
|
||||
class="id-value"
|
||||
>
|
||||
#{{ prop.val.id }}
|
||||
</span>
|
||||
<span v-if="log.action == 'update'">
|
||||
←
|
||||
<VnJsonValue
|
||||
:value="prop.old.val"
|
||||
/>
|
||||
<span
|
||||
v-if="prop.old.id"
|
||||
class="id-value"
|
||||
>
|
||||
#{{ prop.old.id }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="!log.props.length"
|
||||
class="description"
|
||||
>
|
||||
{{ log.description }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
|
||||
<QList dense>
|
||||
<QSeparator />
|
||||
|
@ -691,17 +723,16 @@ watch(
|
|||
</QOptionGroup>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QItemSection v-if="!workers">
|
||||
<QSkeleton type="QInput" class="full-width" />
|
||||
</QItemSection>
|
||||
<QItemSection v-if="workers && userRadio !== null">
|
||||
<QItemSection v-if="userRadio !== null">
|
||||
<VnSelect
|
||||
class="full-width"
|
||||
:label="t('globals.user')"
|
||||
v-model="userSelect"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="workers"
|
||||
:url="`${model}Logs/${$route.params.id}/editors`"
|
||||
:fields="['id', 'nickname', 'name', 'image']"
|
||||
sort-by="nickname"
|
||||
@update:model-value="selectFilter('userSelect')"
|
||||
hide-selected
|
||||
>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { toCurrency } from 'src/filters';
|
||||
|
||||
export function getTotal(rows, key, opts = {}) {
|
||||
const { currency, cb } = opts;
|
||||
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
|
||||
|
||||
return currency
|
||||
? toCurrency(total, currency == 'default' ? undefined : currency)
|
||||
: total;
|
||||
}
|
|
@ -263,6 +263,7 @@ globals:
|
|||
clientsActionsMonitor: Clients and actions
|
||||
serial: Serial
|
||||
medical: Mutual
|
||||
supplier: Supplier
|
||||
created: Created
|
||||
worker: Worker
|
||||
now: Now
|
||||
|
@ -755,56 +756,6 @@ parking:
|
|||
searchBar:
|
||||
info: You can search by parking code
|
||||
label: Search parking...
|
||||
invoiceIn:
|
||||
list:
|
||||
ref: Reference
|
||||
supplier: Supplier
|
||||
supplierRef: Supplier ref.
|
||||
serialNumber: Serial number
|
||||
serial: Serial
|
||||
file: File
|
||||
issued: Issued
|
||||
isBooked: Is booked
|
||||
awb: AWB
|
||||
amount: Amount
|
||||
card:
|
||||
issued: Issued
|
||||
amount: Amount
|
||||
client: Client
|
||||
company: Company
|
||||
customerCard: Customer card
|
||||
ticketList: Ticket List
|
||||
vat: Vat
|
||||
dueDay: Due day
|
||||
intrastat: Intrastat
|
||||
summary:
|
||||
supplier: Supplier
|
||||
supplierRef: Supplier ref.
|
||||
currency: Currency
|
||||
docNumber: Doc number
|
||||
issued: Expedition date
|
||||
operated: Operation date
|
||||
bookEntried: Entry date
|
||||
bookedDate: Booked date
|
||||
sage: Sage withholding
|
||||
vat: Undeductible VAT
|
||||
company: Company
|
||||
booked: Booked
|
||||
expense: Expense
|
||||
taxableBase: Taxable base
|
||||
rate: Rate
|
||||
sageVat: Sage vat
|
||||
sageTransaction: Sage transaction
|
||||
dueDay: Date
|
||||
bank: Bank
|
||||
amount: Amount
|
||||
foreignValue: Foreign value
|
||||
dueTotal: Due day
|
||||
noMatch: Do not match
|
||||
code: Code
|
||||
net: Net
|
||||
stems: Stems
|
||||
country: Country
|
||||
order:
|
||||
field:
|
||||
salesPersonFk: Sales Person
|
||||
|
|
|
@ -267,6 +267,7 @@ globals:
|
|||
clientsActionsMonitor: Clientes y acciones
|
||||
serial: Facturas por serie
|
||||
medical: Mutua
|
||||
supplier: Proveedor
|
||||
created: Fecha creación
|
||||
worker: Trabajador
|
||||
now: Ahora
|
||||
|
@ -801,54 +802,6 @@ parking:
|
|||
searchBar:
|
||||
info: Puedes buscar por código de parking
|
||||
label: Buscar parking...
|
||||
invoiceIn:
|
||||
list:
|
||||
ref: Referencia
|
||||
supplier: Proveedor
|
||||
supplierRef: Ref. proveedor
|
||||
serialNumber: Num. serie
|
||||
shortIssued: F. emisión
|
||||
serial: Serie
|
||||
file: Fichero
|
||||
issued: Fecha emisión
|
||||
isBooked: Conciliada
|
||||
awb: AWB
|
||||
amount: Importe
|
||||
card:
|
||||
issued: Fecha emisión
|
||||
amount: Importe
|
||||
client: Cliente
|
||||
company: Empresa
|
||||
customerCard: Ficha del cliente
|
||||
ticketList: Listado de tickets
|
||||
vat: Iva
|
||||
dueDay: Fecha de vencimiento
|
||||
summary:
|
||||
supplier: Proveedor
|
||||
supplierRef: Ref. proveedor
|
||||
currency: Divisa
|
||||
docNumber: Número documento
|
||||
issued: Fecha de expedición
|
||||
operated: Fecha operación
|
||||
bookEntried: Fecha asiento
|
||||
bookedDate: Fecha contable
|
||||
sage: Retención sage
|
||||
vat: Iva no deducible
|
||||
company: Empresa
|
||||
booked: Contabilizada
|
||||
expense: Gasto
|
||||
taxableBase: Base imp.
|
||||
rate: Tasa
|
||||
sageTransaction: Sage transación
|
||||
dueDay: Fecha
|
||||
bank: Caja
|
||||
amount: Importe
|
||||
foreignValue: Divisa
|
||||
dueTotal: Vencimiento
|
||||
code: Código
|
||||
net: Neto
|
||||
stems: Tallos
|
||||
country: País
|
||||
department:
|
||||
pageTitles:
|
||||
basicData: Basic data
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
@ -27,7 +28,7 @@ const router = useRouter();
|
|||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const { sendEmail } = usePrintService();
|
||||
const client = ref({});
|
||||
const hasChanged = ref(false);
|
||||
const isLoading = ref(false);
|
||||
|
@ -156,22 +157,33 @@ const onSubmit = async () => {
|
|||
}
|
||||
};
|
||||
|
||||
const onDataSaved = async ({
|
||||
addressId,
|
||||
companyFk,
|
||||
companyId,
|
||||
from,
|
||||
recipient,
|
||||
replyTo,
|
||||
}) => {
|
||||
await axios.post(`Clients/${route.params.id}/incoterms-authorization-email`, {
|
||||
addressId,
|
||||
companyFk,
|
||||
companyId,
|
||||
from,
|
||||
recipient,
|
||||
replyTo,
|
||||
});
|
||||
const getSamples = async () => {
|
||||
try {
|
||||
const filter = { where: { id: initialData.typeFk } };
|
||||
let { data } = await axios.get('Samples', {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
return data[0];
|
||||
} catch (error) {
|
||||
notify('errors.create', 'negative');
|
||||
}
|
||||
};
|
||||
|
||||
getSamples();
|
||||
const onDataSaved = async () => {
|
||||
try {
|
||||
const params = {
|
||||
recipientId: initialData.recipientId,
|
||||
recipient: initialData.recipient,
|
||||
replyTo: initialData.replyTo,
|
||||
};
|
||||
setParams(params);
|
||||
const samplesData = await getSamples();
|
||||
const path = `${samplesData.model}/${route.params.id}/${samplesData.code}-email`;
|
||||
await sendEmail(path, params);
|
||||
} catch (error) {
|
||||
notify('errors.create', 'negative');
|
||||
}
|
||||
toCustomerSamples();
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ const { notify } = useNotify();
|
|||
|
||||
const rowsSelected = ref([]);
|
||||
const entryBuysPaginateRef = ref(null);
|
||||
const packagingsOptions = ref(null);
|
||||
const originalRowDataCopy = ref(null);
|
||||
|
||||
const getInputEvents = (colField, props) => {
|
||||
|
@ -66,7 +65,10 @@ const tableColumnComponents = computed(() => ({
|
|||
'map-options': true,
|
||||
'use-input': true,
|
||||
'hide-selected': true,
|
||||
options: packagingsOptions.value,
|
||||
url: 'Packagings',
|
||||
fields: ['id'],
|
||||
where: { freightItemFk: true },
|
||||
'sort-by': 'id ASC',
|
||||
dense: true,
|
||||
},
|
||||
event: getInputEvents,
|
||||
|
@ -304,13 +306,6 @@ const lockIconType = (groupingMode, mode) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="expensesRef"
|
||||
url="Packagings"
|
||||
:filter="{ fields: ['id'], where: { freightItemFk: true }, order: 'id ASC' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (packagingsOptions = data)"
|
||||
/>
|
||||
<VnSubToolbar>
|
||||
<template #st-actions>
|
||||
<QBtnGroup push style="column-gap: 10px">
|
||||
|
|
|
@ -223,6 +223,10 @@ async function onSubmit() {
|
|||
autofocus
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInputDate :label="t('Entry date')" v-model="data.bookEntried" />
|
||||
<VnInputDate :label="t('Accounted date')" v-model="data.booked" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Undeductible VAT')"
|
||||
|
@ -285,10 +289,6 @@ async function onSubmit() {
|
|||
</template>
|
||||
</VnInput>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInputDate :label="t('Entry date')" v-model="data.bookEntried" />
|
||||
<VnInputDate :label="t('Accounted date')" v-model="data.booked" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Currency')"
|
||||
|
|
|
@ -3,6 +3,8 @@ import VnCard from 'components/common/VnCard.vue';
|
|||
import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
|
||||
import InvoiceInFilter from '../InvoiceInFilter.vue';
|
||||
import InvoiceInSearchbar from '../InvoiceInSearchbar.vue';
|
||||
import { onBeforeRouteUpdate } from 'vue-router';
|
||||
import { setRectificative } from '../composables/setRectificative';
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
|
@ -20,6 +22,8 @@ const filter = {
|
|||
{ relation: 'currency' },
|
||||
],
|
||||
};
|
||||
|
||||
onBeforeRouteUpdate(async (to) => await setRectificative(to));
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
|
|
|
@ -356,10 +356,7 @@ const createInvoiceInCorrection = async () => {
|
|||
<template #body="{ entity }">
|
||||
<VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" />
|
||||
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
|
||||
<VnLv
|
||||
:label="t('invoiceIn.card.amount')"
|
||||
:value="toCurrency(totalAmount, entity.currency?.code)"
|
||||
/>
|
||||
<VnLv :label="t('invoiceIn.card.amount')" :value="toCurrency(totalAmount)" />
|
||||
<VnLv :label="t('invoiceIn.summary.supplier')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
|
|
|
@ -5,10 +5,10 @@ import { useI18n } from 'vue-i18n';
|
|||
import axios from 'axios';
|
||||
import { toDate } from 'src/filters';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { getTotal } from 'src/composables/getTotal';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
|
@ -72,7 +72,6 @@ async function insert() {
|
|||
await invoiceInFormRef.value.reload();
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
}
|
||||
const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount, 0);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -155,9 +154,17 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
|
|||
<QTd />
|
||||
<QTd />
|
||||
<QTd>
|
||||
{{ toCurrency(getTotalAmount(rows), currency) }}
|
||||
{{ getTotal(rows, 'amount', { currency: 'default' }) }}
|
||||
</QTd>
|
||||
<QTd>
|
||||
<template v-if="isNotEuro(invoiceIn.currency.code)">
|
||||
{{
|
||||
getTotal(rows, 'foreignValue', {
|
||||
currency: invoiceIn.currency.code,
|
||||
})
|
||||
}}
|
||||
</template>
|
||||
</QTd>
|
||||
<QTd />
|
||||
</QTr>
|
||||
</template>
|
||||
<template #item="props">
|
||||
|
|
|
@ -2,18 +2,15 @@
|
|||
import { computed, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import { getTotal } from 'src/composables/getTotal';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const route = useRoute();
|
||||
const arrayData = useArrayData();
|
||||
const currency = computed(() => arrayData.store.data?.currency?.code);
|
||||
const invoceInIntrastat = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
const countries = ref([]);
|
||||
|
@ -72,9 +69,6 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
|
||||
const getTotal = (data, key) =>
|
||||
data.reduce((acc, cur) => acc + +String(cur[key] || 0).replace(',', '.'), 0);
|
||||
|
||||
const formatOpt = (row, { model, options }, prop) => {
|
||||
const obj = row[model];
|
||||
const option = options.find(({ id }) => id == obj);
|
||||
|
@ -154,7 +148,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
|||
<QTd />
|
||||
<QTd />
|
||||
<QTd>
|
||||
{{ toCurrency(getTotal(rows, 'amount'), currency) }}
|
||||
{{ getTotal(rows, 'amount', { currency: 'default' }) }}
|
||||
</QTd>
|
||||
<QTd>
|
||||
{{ getTotal(rows, 'net') }}
|
||||
|
|
|
@ -35,7 +35,7 @@ const vatColumns = ref([
|
|||
name: 'landed',
|
||||
label: 'invoiceIn.summary.taxableBase',
|
||||
field: (row) => row.taxableBase,
|
||||
format: (value) => toCurrency(value, currency.value),
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
|
@ -64,7 +64,7 @@ const vatColumns = ref([
|
|||
name: 'rate',
|
||||
label: 'invoiceIn.summary.rate',
|
||||
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
|
||||
format: (value) => toCurrency(value, currency.value),
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
|
@ -72,7 +72,7 @@ const vatColumns = ref([
|
|||
name: 'currency',
|
||||
label: 'invoiceIn.summary.currency',
|
||||
field: (row) => row.foreignValue,
|
||||
format: (value) => value,
|
||||
format: (val) => val && toCurrency(val, currency.value),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
|
@ -97,7 +97,7 @@ const dueDayColumns = ref([
|
|||
name: 'amount',
|
||||
label: 'invoiceIn.summary.amount',
|
||||
field: (row) => row.amount,
|
||||
format: (value) => toCurrency(value, currency.value),
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
|
@ -105,7 +105,7 @@ const dueDayColumns = ref([
|
|||
name: 'landed',
|
||||
label: 'invoiceIn.summary.foreignValue',
|
||||
field: (row) => row.foreignValue,
|
||||
format: (value) => value,
|
||||
format: (val) => val && toCurrency(val, currency.value),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
|
@ -124,7 +124,7 @@ const intrastatColumns = ref([
|
|||
{
|
||||
name: 'amount',
|
||||
label: 'invoiceIn.summary.amount',
|
||||
field: (row) => toCurrency(row.amount, currency.value),
|
||||
field: (row) => toCurrency(row.amount),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
|
@ -179,7 +179,6 @@ const getTotalTax = (tax) =>
|
|||
|
||||
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
data-key="InvoiceInSummary"
|
||||
|
@ -229,10 +228,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
:label="t('invoiceIn.summary.currency')"
|
||||
:value="entity.currency?.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.docNumber')"
|
||||
:value="`${entity.serial}/${entity.serialNumber}`"
|
||||
/>
|
||||
<VnLv :label="t('invoiceIn.serial')" :value="`${entity.serial}`" />
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
|
@ -293,12 +289,9 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
<QCardSection class="q-pa-none">
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.taxableBase')"
|
||||
:value="toCurrency(entity.totals.totalTaxableBase, currency)"
|
||||
/>
|
||||
<VnLv
|
||||
label="Total"
|
||||
:value="toCurrency(entity.totals.totalVat, currency)"
|
||||
:value="toCurrency(entity.totals.totalTaxableBase)"
|
||||
/>
|
||||
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
|
||||
<VnLv :label="t('invoiceIn.summary.dueTotal')">
|
||||
<template #value>
|
||||
<QChip
|
||||
|
@ -311,7 +304,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
: t('invoiceIn.summary.dueTotal')
|
||||
"
|
||||
>
|
||||
{{ toCurrency(entity.totals.totalDueDay, currency) }}
|
||||
{{ toCurrency(entity.totals.totalDueDay) }}
|
||||
</QChip>
|
||||
</template>
|
||||
</VnLv>
|
||||
|
@ -350,15 +343,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
<template #bottom-row>
|
||||
<QTr class="bg">
|
||||
<QTd></QTd>
|
||||
<QTd>{{ toCurrency(entity.totals.totalTaxableBase) }}</QTd>
|
||||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
<QTd>{{ toCurrency(getTotalTax(entity.invoiceInTax)) }}</QTd>
|
||||
<QTd>{{
|
||||
toCurrency(entity.totals.totalTaxableBase, currency)
|
||||
entity.totals.totalTaxableBaseForeignValue &&
|
||||
toCurrency(
|
||||
entity.totals.totalTaxableBaseForeignValue,
|
||||
currency
|
||||
)
|
||||
}}</QTd>
|
||||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
<QTd>{{
|
||||
toCurrency(getTotalTax(entity.invoiceInTax, currency))
|
||||
}}</QTd>
|
||||
<QTd></QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
|
@ -384,9 +379,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
<QTd>
|
||||
{{ toCurrency(entity.totals.totalDueDay, currency) }}
|
||||
{{ toCurrency(entity.totals.totalDueDay) }}
|
||||
</QTd>
|
||||
<QTd>
|
||||
{{
|
||||
entity.totals.totalDueDayForeignValue &&
|
||||
toCurrency(
|
||||
entity.totals.totalDueDayForeignValue,
|
||||
currency
|
||||
)
|
||||
}}
|
||||
</QTd>
|
||||
<QTd></QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
|
@ -421,7 +424,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
<template #bottom-row>
|
||||
<QTr class="bg">
|
||||
<QTd></QTd>
|
||||
<QTd>{{ toCurrency(intrastatTotals.amount, currency) }}</QTd>
|
||||
<QTd>{{ toCurrency(intrastatTotals.amount) }}</QTd>
|
||||
<QTd>{{ intrastatTotals.net }}</QTd>
|
||||
<QTd>{{ intrastatTotals.stems }}</QTd>
|
||||
<QTd></QTd>
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { getTotal } from 'src/composables/getTotal';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
|
||||
const arrayData = useArrayData();
|
||||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
|
@ -23,15 +22,7 @@ const expenses = ref([]);
|
|||
const sageTaxTypes = ref([]);
|
||||
const sageTransactionTypes = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
const newExpense = ref({
|
||||
code: undefined,
|
||||
isWithheld: false,
|
||||
description: undefined,
|
||||
});
|
||||
|
||||
const invoiceInFormRef = ref();
|
||||
const expensesRef = ref();
|
||||
const newExpenseRef = ref();
|
||||
|
||||
defineProps({
|
||||
actionIcon: {
|
||||
|
@ -56,7 +47,7 @@ const columns = computed(() => [
|
|||
{
|
||||
name: 'taxablebase',
|
||||
label: t('Taxable base'),
|
||||
field: (row) => toCurrency(row.taxableBase, currency.value),
|
||||
field: (row) => row.taxableBase,
|
||||
model: 'taxableBase',
|
||||
sortable: true,
|
||||
tabIndex: 2,
|
||||
|
@ -91,7 +82,7 @@ const columns = computed(() => [
|
|||
label: t('Rate'),
|
||||
sortable: true,
|
||||
tabIndex: 5,
|
||||
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk), currency.value),
|
||||
field: (row) => taxRate(row, row.taxTypeSageFk),
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
|
@ -132,40 +123,6 @@ function taxRate(invoiceInTax) {
|
|||
return (taxTypeSage / 100) * taxableBase;
|
||||
}
|
||||
|
||||
async function addExpense() {
|
||||
try {
|
||||
if (!newExpense.value.code) throw new Error(t(`The code can't be empty`));
|
||||
if (isNaN(newExpense.value.code))
|
||||
throw new Error(t(`The code have to be a number`));
|
||||
if (!newExpense.value.description)
|
||||
throw new Error(t(`The description can't be empty`));
|
||||
|
||||
const data = [
|
||||
{
|
||||
id: newExpense.value.code,
|
||||
isWithheld: newExpense.value.isWithheld,
|
||||
name: newExpense.value.description,
|
||||
},
|
||||
];
|
||||
|
||||
await axios.post(`Expenses`, data);
|
||||
await expensesRef.value.fetch();
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('globals.dataSaved'),
|
||||
});
|
||||
newExpenseRef.value.hide();
|
||||
} catch (error) {
|
||||
quasar.notify({
|
||||
type: 'negative',
|
||||
message: t(`${error.message}`),
|
||||
});
|
||||
}
|
||||
}
|
||||
const getTotalTaxableBase = (rows) =>
|
||||
rows.reduce((acc, { taxableBase }) => acc + +(taxableBase || 0), 0);
|
||||
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
|
||||
|
||||
const formatOpt = (row, { model, options }, prop) => {
|
||||
const obj = row[model];
|
||||
const option = options.find(({ id }) => id == obj);
|
||||
|
@ -207,37 +164,25 @@ const formatOpt = (row, { model, options }, prop) => {
|
|||
>
|
||||
<template #body-cell-expense="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelect
|
||||
<VnSelectDialog
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'name']"
|
||||
:tooltip="t('Create a new expense')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
||||
</QItem>
|
||||
</template>
|
||||
<template #append>
|
||||
<QIcon
|
||||
name="close"
|
||||
@click.stop="value = null"
|
||||
class="cursor-pointer"
|
||||
size="xs"
|
||||
<template #form>
|
||||
<CreateNewExpenseForm
|
||||
@on-data-saved="$refs.expensesRef.fetch()"
|
||||
/>
|
||||
<QIcon
|
||||
@click.stop.prevent="newExpenseRef.show()"
|
||||
:name="actionIcon"
|
||||
size="xs"
|
||||
class="default-icon"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Create expense') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</VnSelectDialog>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-taxablebase="{ row }">
|
||||
|
@ -325,12 +270,24 @@ const formatOpt = (row, { model, options }, prop) => {
|
|||
<QTd />
|
||||
<QTd />
|
||||
<QTd>
|
||||
{{ toCurrency(getTotalTaxableBase(rows), currency) }}
|
||||
{{ getTotal(rows, 'taxableBase', { currency: 'default' }) }}
|
||||
</QTd>
|
||||
<QTd />
|
||||
<QTd />
|
||||
<QTd> {{ toCurrency(getTotalRate(rows), currency) }}</QTd>
|
||||
<QTd />
|
||||
<QTd>
|
||||
{{
|
||||
getTotal(rows, null, { cb: taxRate, currency: 'default' })
|
||||
}}</QTd
|
||||
>
|
||||
<QTd>
|
||||
<template v-if="isNotEuro(invoiceIn.currency.code)">
|
||||
{{
|
||||
getTotal(rows, 'foreignValue', {
|
||||
currency: invoiceIn.currency.code,
|
||||
})
|
||||
}}
|
||||
</template>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #item="props">
|
||||
|
@ -342,7 +299,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
|||
<QSeparator />
|
||||
<QList>
|
||||
<QItem>
|
||||
<VnSelect
|
||||
<VnSelectDialog
|
||||
:label="t('Expense')"
|
||||
class="full-width"
|
||||
v-model="props.row['expenseFk']"
|
||||
|
@ -350,13 +307,17 @@ const formatOpt = (row, { model, options }, prop) => {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
:filter-options="['id', 'name']"
|
||||
:tooltip="t('Create a new expense')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<template #form>
|
||||
<CreateNewExpenseForm />
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnInputNumber
|
||||
|
@ -439,44 +400,6 @@ const formatOpt = (row, { model, options }, prop) => {
|
|||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QDialog ref="newExpenseRef">
|
||||
<QCard>
|
||||
<QCardSection class="q-pb-none">
|
||||
<QItem class="q-pa-none">
|
||||
<span class="text-primary text-h6 full-width">
|
||||
<QIcon name="edit" class="q-mr-xs" />
|
||||
{{ t('New expense') }}
|
||||
</span>
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pt-none">
|
||||
<QItem>
|
||||
<VnInput
|
||||
:label="`${t('Code')}*`"
|
||||
v-model="newExpense.code"
|
||||
:required="true"
|
||||
/>
|
||||
<QCheckbox
|
||||
dense
|
||||
size="sm"
|
||||
:label="`${t('It\'s a withholding')}`"
|
||||
v-model="newExpense.isWithheld"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnInput
|
||||
:label="`${t('Descripction')}*`"
|
||||
v-model="newExpense.description"
|
||||
/>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardActions class="justify-end">
|
||||
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
|
||||
<QBtn :label="t('globals.save')" color="primary" @click="addExpense" />
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn
|
||||
color="primary"
|
||||
|
@ -484,7 +407,9 @@ const formatOpt = (row, { model, options }, prop) => {
|
|||
size="lg"
|
||||
round
|
||||
@click="invoiceInFormRef.insert()"
|
||||
/>
|
||||
>
|
||||
<QTooltip>{{ t('Add tax') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
|
@ -524,18 +449,11 @@ const formatOpt = (row, { model, options }, prop) => {
|
|||
<i18n>
|
||||
es:
|
||||
Expense: Gasto
|
||||
Create expense: Crear gasto
|
||||
Create a new expense: Crear nuevo gasto
|
||||
Add tax: Crear gasto
|
||||
Taxable base: Base imp.
|
||||
Sage tax: Sage iva
|
||||
Sage transaction: Sage transacción
|
||||
Rate: Tasa
|
||||
Foreign value: Divisa
|
||||
New expense: Nuevo gasto
|
||||
Code: Código
|
||||
It's a withholding: Es una retención
|
||||
Descripction: Descripción
|
||||
The code can't be empty: El código no puede estar vacío
|
||||
The description can't be empty: La descripción no puede estar vacía
|
||||
The code have to be a number: El código debe ser un número.
|
||||
</i18n>
|
||||
|
|
|
@ -28,6 +28,16 @@ const activities = ref([]);
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate :label="t('From')" v-model="params.from" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
|
@ -64,16 +74,6 @@ const activities = ref([]);
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.serialNumber')"
|
||||
v-model="params.serialNumber"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -84,15 +84,6 @@ const activities = ref([]);
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('Issued')"
|
||||
v-model="params.issued"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -140,22 +131,6 @@ const activities = ref([]);
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QExpansionItem :label="t('More options')" expand-separator>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('From')"
|
||||
v-model="params.from"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
@ -179,6 +154,7 @@ en:
|
|||
correctedFk: Rectified
|
||||
issued: Issued
|
||||
to: To
|
||||
from: From
|
||||
awbCode: AWB
|
||||
correctingFk: Rectificative
|
||||
supplierActivityFk: Supplier activity
|
||||
|
@ -201,6 +177,8 @@ es:
|
|||
correctedFk: Rectificada
|
||||
correctingFk: Rectificativa
|
||||
supplierActivityFk: Actividad proveedor
|
||||
from: Desde
|
||||
to: Hasta
|
||||
From: Desde
|
||||
To: Hasta
|
||||
Amount: Importe
|
||||
|
|
|
@ -47,12 +47,6 @@ const cols = computed(() => [
|
|||
name: 'supplierRef',
|
||||
label: t('invoiceIn.list.supplierRef'),
|
||||
},
|
||||
|
||||
{
|
||||
align: 'left',
|
||||
name: 'serialNumber',
|
||||
label: t('invoiceIn.list.serialNumber'),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'serial',
|
||||
|
@ -141,7 +135,7 @@ const cols = computed(() => [
|
|||
v-model="data.supplierFk"
|
||||
url="Suppliers"
|
||||
:fields="['id', 'nickname']"
|
||||
:label="t('Supplier')"
|
||||
:label="t('globals.supplier')"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:filter-options="['id', 'name']"
|
||||
|
@ -162,7 +156,7 @@ const cols = computed(() => [
|
|||
/>
|
||||
<VnSelect
|
||||
url="Companies"
|
||||
:label="t('Company')"
|
||||
:label="t('globals.company')"
|
||||
:fields="['id', 'code']"
|
||||
v-model="data.companyFk"
|
||||
option-value="id"
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import axios from 'axios';
|
||||
|
||||
export async function setRectificative(route) {
|
||||
const card = route.matched.find((route) => route.name === 'InvoiceInCard');
|
||||
const corrective = card.children.find(
|
||||
(route) => route.name === 'InvoiceInCorrective'
|
||||
);
|
||||
|
||||
corrective.meta.hidden = !(
|
||||
await axios.get('InvoiceInCorrections', {
|
||||
params: { filter: { where: { correctingFk: route.params.id } } },
|
||||
})
|
||||
).data.length;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
invoiceIn:
|
||||
serial: Serial
|
||||
list:
|
||||
ref: Reference
|
||||
supplier: Supplier
|
||||
supplierRef: Supplier ref.
|
||||
serial: Serial
|
||||
file: File
|
||||
issued: Issued
|
||||
isBooked: Is booked
|
||||
awb: AWB
|
||||
amount: Amount
|
||||
card:
|
||||
issued: Issued
|
||||
amount: Amount
|
||||
client: Client
|
||||
company: Company
|
||||
customerCard: Customer card
|
||||
ticketList: Ticket List
|
||||
vat: Vat
|
||||
dueDay: Due day
|
||||
intrastat: Intrastat
|
||||
summary:
|
||||
supplier: Supplier
|
||||
supplierRef: Supplier ref.
|
||||
currency: Currency
|
||||
issued: Expedition date
|
||||
operated: Operation date
|
||||
bookEntried: Entry date
|
||||
bookedDate: Booked date
|
||||
sage: Sage withholding
|
||||
vat: Undeductible VAT
|
||||
company: Company
|
||||
booked: Booked
|
||||
expense: Expense
|
||||
taxableBase: Taxable base
|
||||
rate: Rate
|
||||
sageVat: Sage vat
|
||||
sageTransaction: Sage transaction
|
||||
dueDay: Date
|
||||
bank: Bank
|
||||
amount: Amount
|
||||
foreignValue: Foreign value
|
||||
dueTotal: Due day
|
||||
noMatch: Do not match
|
||||
code: Code
|
||||
net: Net
|
||||
stems: Stems
|
||||
country: Country
|
|
@ -0,0 +1,47 @@
|
|||
invoiceIn:
|
||||
serial: Serie
|
||||
list:
|
||||
ref: Referencia
|
||||
supplier: Proveedor
|
||||
supplierRef: Ref. proveedor
|
||||
shortIssued: F. emisión
|
||||
file: Fichero
|
||||
issued: Fecha emisión
|
||||
isBooked: Conciliada
|
||||
awb: AWB
|
||||
amount: Importe
|
||||
card:
|
||||
issued: Fecha emisión
|
||||
amount: Importe
|
||||
client: Cliente
|
||||
company: Empresa
|
||||
customerCard: Ficha del cliente
|
||||
ticketList: Listado de tickets
|
||||
vat: Iva
|
||||
dueDay: Fecha de vencimiento
|
||||
summary:
|
||||
supplier: Proveedor
|
||||
supplierRef: Ref. proveedor
|
||||
currency: Divisa
|
||||
docNumber: Número documento
|
||||
issued: Fecha de expedición
|
||||
operated: Fecha operación
|
||||
bookEntried: Fecha asiento
|
||||
bookedDate: Fecha contable
|
||||
sage: Retención sage
|
||||
vat: Iva no deducible
|
||||
company: Empresa
|
||||
booked: Contabilizada
|
||||
expense: Gasto
|
||||
taxableBase: Base imp.
|
||||
rate: Tasa
|
||||
sageTransaction: Sage transación
|
||||
dueDay: Fecha
|
||||
bank: Caja
|
||||
amount: Importe
|
||||
foreignValue: Divisa
|
||||
dueTotal: Vencimiento
|
||||
code: Código
|
||||
net: Neto
|
||||
stems: Tallos
|
||||
country: País
|
|
@ -1,5 +1,5 @@
|
|||
import { RouterView } from 'vue-router';
|
||||
|
||||
import { setRectificative } from 'src/pages/InvoiceIn/composables/setRectificative';
|
||||
export default {
|
||||
path: '/invoice-in',
|
||||
name: 'InvoiceIn',
|
||||
|
@ -63,6 +63,10 @@ export default {
|
|||
path: ':id',
|
||||
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
|
||||
redirect: { name: 'InvoiceInSummary' },
|
||||
beforeEnter: async (to, from, next) => {
|
||||
await setRectificative(to);
|
||||
next();
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'InvoiceInSummary',
|
||||
|
|
|
@ -56,6 +56,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
|
|||
function addMenuItem(module, route, parent) {
|
||||
const { meta } = route;
|
||||
let { menuChildren = null } = meta;
|
||||
if (meta.hidden) return;
|
||||
if (menuChildren)
|
||||
menuChildren = menuChildren.map(({ name, title, icon }) => ({
|
||||
name,
|
||||
|
|
|
@ -36,8 +36,7 @@ describe('InvoiceInBasicData', () => {
|
|||
});
|
||||
|
||||
it('should throw an error creating a new dms if a file is not attached', () => {
|
||||
cy.get(formInputs).eq(5).click();
|
||||
cy.get(formInputs).eq(5).type('{selectall}{backspace}');
|
||||
cy.get(formInputs).eq(7).type('{selectall}{backspace}');
|
||||
cy.get(documentBtns).eq(0).click();
|
||||
cy.get(dialogActionBtns).eq(1).click();
|
||||
cy.get('.q-notification__message').should(
|
||||
|
|
|
@ -3,13 +3,14 @@ describe('InvoiceInVat', () => {
|
|||
const thirdRow = 'tbody > :nth-child(3)';
|
||||
const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
|
||||
const dialogInputs = '.q-dialog label input';
|
||||
const dialogBtns = '.q-dialog button';
|
||||
const acrossInput = 'tbody tr:nth-child(1) td:nth-child(2) .default-icon';
|
||||
const addBtn = 'tbody tr:nth-child(1) td:nth-child(2) .--add-icon';
|
||||
const randomInt = Math.floor(Math.random() * 100);
|
||||
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/invoice-in/1/vat`);
|
||||
cy.intercept('GET', '/api/InvoiceIns/1/getTotals').as('lastCall');
|
||||
cy.wait('@lastCall');
|
||||
});
|
||||
|
||||
it('should edit the sage iva', () => {
|
||||
|
@ -26,22 +27,15 @@ describe('InvoiceInVat', () => {
|
|||
});
|
||||
|
||||
it('should remove the first line', () => {
|
||||
cy.removeRow(2);
|
||||
});
|
||||
|
||||
it('should throw an error if there are fields undefined', () => {
|
||||
cy.get(acrossInput).click();
|
||||
cy.get(dialogBtns).eq(2).click();
|
||||
cy.get('.q-notification__message').should('have.text', "The code can't be empty");
|
||||
cy.removeRow(1);
|
||||
});
|
||||
|
||||
it('should correctly handle expense addition', () => {
|
||||
cy.get(acrossInput).click();
|
||||
cy.get(addBtn).click();
|
||||
cy.get(dialogInputs).eq(0).type(randomInt);
|
||||
cy.get(dialogInputs).eq(1).click();
|
||||
cy.get(dialogInputs).eq(1).type('This is a dummy expense');
|
||||
|
||||
cy.get(dialogBtns).eq(2).click();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
cy.get('button[type="submit"]').click();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue