forked from verdnatura/salix-front
Merge branch 'Fix-Items-Module' of https://gitea.verdnatura.es/verdnatura/salix-front into Fix-Items-Module
This commit is contained in:
commit
b26d07f605
|
@ -4,7 +4,8 @@ def PROTECTED_BRANCH
|
|||
|
||||
def BRANCH_ENV = [
|
||||
test: 'test',
|
||||
master: 'production'
|
||||
master: 'production',
|
||||
beta: 'production'
|
||||
]
|
||||
|
||||
node {
|
||||
|
@ -15,7 +16,8 @@ node {
|
|||
PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
'test',
|
||||
'master'
|
||||
'master',
|
||||
'beta'
|
||||
].contains(env.BRANCH_NAME)
|
||||
|
||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ref } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { useAttrs } from 'vue';
|
||||
import { useRequired } from 'src/composables/useRequired';
|
||||
const { t } = useI18n();
|
||||
|
@ -43,7 +43,7 @@ const formatLocation = (obj, properties) => {
|
|||
return filteredParts.join(', ');
|
||||
};
|
||||
|
||||
const modelValue = ref(
|
||||
const modelValue = computed(() =>
|
||||
props.location ? formatLocation(props.location, locationProperties) : null
|
||||
);
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ const userParams = ref({});
|
|||
defineExpose({ search, sanitizer, params: userParams });
|
||||
|
||||
onMounted(() => {
|
||||
userParams.value = $props.modelValue ?? {};
|
||||
if (!userParams.value) userParams.value = $props.modelValue ?? {};
|
||||
emit('init', { params: userParams.value });
|
||||
});
|
||||
|
||||
|
@ -105,7 +105,8 @@ watch(
|
|||
|
||||
watch(
|
||||
() => arrayData.store.userParams,
|
||||
(val, oldValue) => (val || oldValue) && setUserParams(val)
|
||||
(val, oldValue) => (val || oldValue) && setUserParams(val),
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
|
|
|
@ -331,6 +331,7 @@ globals:
|
|||
fi: FI
|
||||
myTeam: My team
|
||||
departmentFk: Department
|
||||
countryFk: Country
|
||||
changePass: Change password
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
changeState: Change state
|
||||
|
|
|
@ -335,6 +335,7 @@ globals:
|
|||
SSN: NSS
|
||||
fi: NIF
|
||||
myTeam: Mi equipo
|
||||
countryFk: País
|
||||
changePass: Cambiar contraseña
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
changeState: Cambiar estado
|
||||
|
|
|
@ -7,6 +7,7 @@ import AccountSummary from './Card/AccountSummary.vue';
|
|||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import AccountFilter from './AccountFilter.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
|
@ -22,10 +23,27 @@ const columns = computed(() => [
|
|||
field: 'id',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'name',
|
||||
label: t('Name'),
|
||||
component: 'input',
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'roleFk',
|
||||
label: t('role'),
|
||||
label: t('Role'),
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'VnRoles',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
},
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'roleFk',
|
||||
|
@ -35,7 +53,11 @@ const columns = computed(() => [
|
|||
optionLabel: 'name',
|
||||
},
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -51,20 +73,32 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'name',
|
||||
label: t('Name'),
|
||||
name: 'email',
|
||||
label: t('Email'),
|
||||
component: 'input',
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'email',
|
||||
label: t('email'),
|
||||
component: 'input',
|
||||
name: 'password',
|
||||
label: t('Password'),
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
attrs: {},
|
||||
required: true,
|
||||
visible: false,
|
||||
},
|
||||
|
||||
{
|
||||
align: 'left',
|
||||
name: 'active',
|
||||
label: t('Active'),
|
||||
component: 'checkbox',
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
|
@ -101,7 +135,6 @@ const exprBuilder = (param, value) => {
|
|||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="AccountList"
|
||||
|
@ -119,6 +152,12 @@ const exprBuilder = (param, value) => {
|
|||
ref="tableRef"
|
||||
data-key="AccountList"
|
||||
url="VnUsers/preview"
|
||||
:create="{
|
||||
urlCreate: 'VnUsers',
|
||||
title: t('Create user'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
}"
|
||||
:filter="filter"
|
||||
order="id DESC"
|
||||
:columns="columns"
|
||||
|
@ -127,7 +166,19 @@ const exprBuilder = (param, value) => {
|
|||
:use-model="true"
|
||||
:right-search="false"
|
||||
auto-load
|
||||
>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<QCardSection>
|
||||
<VnInput
|
||||
:label="t('Password')"
|
||||
v-model="data.password"
|
||||
type="password"
|
||||
:required="true"
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
</QCardSection>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
@ -135,4 +186,7 @@ const exprBuilder = (param, value) => {
|
|||
Id: Id
|
||||
Nickname: Nickname
|
||||
Name: Nombre
|
||||
Password: Contraseña
|
||||
Active: Activo
|
||||
Role: Rol
|
||||
</i18n>
|
||||
|
|
|
@ -29,7 +29,8 @@ async function hasCustomerRole() {
|
|||
:filter="filter"
|
||||
model="customer"
|
||||
:mapper="
|
||||
({ active, name, email }) => {
|
||||
({ account }) => {
|
||||
const { name, email, active } = account;
|
||||
return {
|
||||
active,
|
||||
name,
|
||||
|
|
|
@ -52,7 +52,9 @@ const columns = computed(() => [
|
|||
label: t('invoiceOutList.tableVisibleColumns.id'),
|
||||
chip: { condition: () => true },
|
||||
isId: true,
|
||||
columnFilter: { name: 'search' },
|
||||
columnFilter: {
|
||||
name: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -84,8 +86,15 @@ const columns = computed(() => [
|
|||
label: t('globals.client'),
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: { url: 'Clients', fields: ['id', 'name'] },
|
||||
columnField: { component: null },
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
fields: ['id', 'socialName'],
|
||||
optionLabel: 'socialName',
|
||||
optionValue: 'id',
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
|
|
@ -59,7 +59,11 @@ const getLocale = (label) => {
|
|||
</template>
|
||||
<template #customTags="{ params, searchFn, formatFn }">
|
||||
<VnFilterPanelChip
|
||||
v-if="params.scopeDays !== null"
|
||||
v-if="
|
||||
params.scopeDays !== undefined ||
|
||||
params.scopeDays !== '' ||
|
||||
params.scopeDays !== null
|
||||
"
|
||||
removable
|
||||
@remove="handleScopeDays(params, null, searchFn)"
|
||||
>
|
||||
|
@ -197,6 +201,18 @@ const getLocale = (label) => {
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
outlined
|
||||
dense
|
||||
rounded
|
||||
:label="t('globals.params.countryFk')"
|
||||
v-model="params.countryFk"
|
||||
url="Countries"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<script setup>
|
||||
import { useRouter } from 'vue-router';
|
||||
import { reactive, onMounted, ref } from 'vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import { useState } from 'composables/useState';
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
|
@ -11,29 +10,12 @@ import VnInputDate from 'components/common/VnInputDate.vue';
|
|||
import { useDialogPluginComponent } from 'quasar';
|
||||
|
||||
const { t } = useI18n();
|
||||
const state = useState();
|
||||
const ORDER_MODEL = 'order';
|
||||
|
||||
const router = useRouter();
|
||||
const agencyList = ref([]);
|
||||
const addressList = ref([]);
|
||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||
|
||||
const fetchAddressList = async (addressId) => {
|
||||
const { data } = await axios.get('addresses', {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
fields: ['id', 'nickname', 'street', 'city'],
|
||||
where: { id: addressId },
|
||||
}),
|
||||
},
|
||||
});
|
||||
addressList.value = data;
|
||||
if (addressList.value?.length === 1) {
|
||||
state.get(ORDER_MODEL).addressId = addressList.value[0].id;
|
||||
}
|
||||
};
|
||||
|
||||
const fetchAgencyList = async (landed, addressFk) => {
|
||||
if (!landed || !addressFk) {
|
||||
return;
|
||||
|
@ -59,17 +41,9 @@ const initialFormState = reactive({
|
|||
clientFk: $props.clientFk,
|
||||
});
|
||||
|
||||
const onClientChange = async (clientId = $props.clientFk) => {
|
||||
const { data } = await axios.get(`Clients/${clientId}`);
|
||||
await fetchAddressList(data.defaultAddressFk);
|
||||
};
|
||||
|
||||
async function onDataSaved(_, id) {
|
||||
await router.push({ path: `/order/${id}/catalog` });
|
||||
}
|
||||
onMounted(async () => {
|
||||
await onClientChange();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -90,10 +64,9 @@ onMounted(async () => {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
:filter="{
|
||||
fields: ['id', 'name', 'defaultAddressFk'],
|
||||
fields: ['id', 'name'],
|
||||
}"
|
||||
hide-selected
|
||||
@update:model-value="onClientChange"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -110,7 +83,7 @@ onMounted(async () => {
|
|||
:label="t('order.form.addressFk')"
|
||||
v-model="data.addressId"
|
||||
url="addresses"
|
||||
:fields="['id', 'nickname', 'defaultAddressFk', 'street', 'city']"
|
||||
:fields="['id', 'nickname', 'street', 'city']"
|
||||
sort-by="id"
|
||||
option-value="id"
|
||||
option-label="street"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { computed, ref, onMounted } from 'vue';
|
||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
|
@ -15,14 +15,13 @@ import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vu
|
|||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import { useRoute } from 'vue-router';
|
||||
import dataByOrder from 'src/utils/dataByOrder';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
const agencyList = ref([]);
|
||||
const addressesList = ref([]);
|
||||
const route = useRoute();
|
||||
const addressOptions = ref([]);
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -148,16 +147,12 @@ onMounted(() => {
|
|||
const id = JSON.parse(clientId);
|
||||
fetchClientAddress(id.clientFk);
|
||||
});
|
||||
|
||||
async function fetchClientAddress(id, formData = {}) {
|
||||
const { data } = await axios.get(`Clients/${id}`, {
|
||||
params: {
|
||||
filter: {
|
||||
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
|
||||
include: { relation: 'addresses' },
|
||||
},
|
||||
},
|
||||
});
|
||||
addressesList.value = data.addresses;
|
||||
const { data } = await axios.get(
|
||||
`Clients/${id}/addresses?filter[order]=isActive DESC`
|
||||
);
|
||||
addressOptions.value = data;
|
||||
formData.addressId = data.defaultAddressFk;
|
||||
fetchAgencies(formData);
|
||||
}
|
||||
|
@ -168,7 +163,7 @@ async function fetchAgencies({ landed, addressId }) {
|
|||
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||
params: { addressFk: addressId, landed },
|
||||
});
|
||||
agencyList.value = dataByOrder(data, 'agencyMode ASC');
|
||||
agencyList.value = data;
|
||||
}
|
||||
|
||||
const getDateColor = (date) => {
|
||||
|
@ -252,34 +247,29 @@ const getDateColor = (date) => {
|
|||
</VnSelect>
|
||||
<VnSelect
|
||||
v-model="data.addressId"
|
||||
:options="addressesList"
|
||||
:options="addressOptions"
|
||||
:label="t('module.address')"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
@update:model-value="() => fetchAgencies(data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem
|
||||
v-bind="scope.itemProps"
|
||||
:class="{ disabled: !scope.opt.isActive }"
|
||||
>
|
||||
<QItemSection style="min-width: min-content" avatar>
|
||||
<QIcon
|
||||
v-if="
|
||||
scope.opt.isActive && data.addressId === scope.opt.id
|
||||
"
|
||||
size="sm"
|
||||
color="grey"
|
||||
name="star"
|
||||
class="fill-icon"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt.nickname }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `${scope.opt.street}, ${scope.opt.city}` }}
|
||||
<QItemLabel
|
||||
:class="{
|
||||
'color-vn-label': !scope.opt?.isActive,
|
||||
}"
|
||||
>
|
||||
{{
|
||||
`${
|
||||
!scope.opt?.isActive
|
||||
? t('basicData.inactive')
|
||||
: ''
|
||||
} `
|
||||
}}
|
||||
{{ scope.opt?.nickname }}: {{ scope.opt?.street }},
|
||||
{{ scope.opt?.city }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -768,7 +768,7 @@ watch(
|
|||
</template>
|
||||
<template #column-item="{ row }">
|
||||
<div class="row column full-width justify-between items-start">
|
||||
{{ row?.item?.name }}
|
||||
{{ row?.concept }}
|
||||
<div v-if="row?.item?.subName" class="subName">
|
||||
{{ row?.item?.subName.toUpperCase() }}
|
||||
</div>
|
||||
|
|
|
@ -57,7 +57,7 @@ const travelKgPercentages = ref([]);
|
|||
const tableColumnComponents = {
|
||||
id: {
|
||||
component: QBtn,
|
||||
attrs: { flat: true, color: 'primary' },
|
||||
attrs: { flat: true, color: 'primary', dense: true },
|
||||
},
|
||||
cargoSupplierNickname: {
|
||||
component: QBtn,
|
||||
|
@ -178,6 +178,7 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
showValue: false,
|
||||
sortable: true,
|
||||
style: 'min-width: 170px;',
|
||||
},
|
||||
{
|
||||
label: t('globals.packages'),
|
||||
|
@ -237,7 +238,7 @@ const columns = computed(() => [
|
|||
format: (value) => toDate(value),
|
||||
},
|
||||
{
|
||||
label: t('globals.wareHhuseIn'),
|
||||
label: t('globals.warehouseIn'),
|
||||
field: 'warehouseInName',
|
||||
name: 'warehouseInName',
|
||||
align: 'left',
|
||||
|
@ -506,7 +507,7 @@ const getColor = (percentage) => {
|
|||
:key="col.name"
|
||||
:props="props"
|
||||
@click="stopEventPropagation($event, col)"
|
||||
auto-width
|
||||
:style="col.style"
|
||||
>
|
||||
<component
|
||||
:is="tableColumnComponents[col.name].component"
|
||||
|
@ -581,7 +582,7 @@ const getColor = (percentage) => {
|
|||
}"
|
||||
>
|
||||
<QTd>
|
||||
<QBtn flat class="link">{{ entry.id }} </QBtn>
|
||||
<QBtn dense flat class="link">{{ entry.id }} </QBtn>
|
||||
<EntryDescriptorProxy :id="entry.id" />
|
||||
</QTd>
|
||||
<QTd>
|
||||
|
@ -637,6 +638,18 @@ const getColor = (percentage) => {
|
|||
|
||||
:deep(.q-table) {
|
||||
border-collapse: collapse;
|
||||
|
||||
th {
|
||||
padding: 0;
|
||||
}
|
||||
tbody tr td {
|
||||
&:nth-child(1) {
|
||||
max-width: 65px;
|
||||
}
|
||||
&:nth-child(4) {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.q-td :deep(input) {
|
||||
|
@ -684,7 +697,6 @@ const getColor = (percentage) => {
|
|||
width: max-content;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
searchExtraCommunity: Search for extra community shipping
|
||||
|
|
|
@ -44,7 +44,18 @@ vi.mock('vue-router', () => ({
|
|||
vi.mock('axios');
|
||||
|
||||
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
|
||||
return { validate: vi.fn() };
|
||||
return {
|
||||
validate: vi.fn(),
|
||||
validations: () => ({
|
||||
format: vi.fn(),
|
||||
presence: vi.fn(),
|
||||
required: vi.fn(),
|
||||
length: vi.fn(),
|
||||
numericality: vi.fn(),
|
||||
min: vi.fn(),
|
||||
custom: vi.fn(),
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
class FormDataMock {
|
||||
|
|
Loading…
Reference in New Issue