diff --git a/Jenkinsfile b/Jenkinsfile
index 1766e3aea..c20da8ab2 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -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
diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue
index b1c7606e6..521840ebc 100644
--- a/src/components/CrudModel.vue
+++ b/src/components/CrudModel.vue
@@ -249,7 +249,7 @@ function getChanges() {
for (const [i, row] of formData.value.entries()) {
if (!row[pk]) {
creates.push(row);
- } else if (originalData.value) {
+ } else if (originalData.value[i]) {
const data = getDifferences(originalData.value[i], row);
if (!isEmpty(data)) {
updates.push({
diff --git a/src/components/EditTableCellValueForm.vue b/src/components/EditTableCellValueForm.vue
index 7755df9ab..172866191 100644
--- a/src/components/EditTableCellValueForm.vue
+++ b/src/components/EditTableCellValueForm.vue
@@ -85,12 +85,14 @@ const closeForm = () => {
hide-selected
option-label="label"
v-model="selectedField"
+ data-cy="field-to-edit"
/>
diff --git a/src/components/ItemsFilterPanel.vue b/src/components/ItemsFilterPanel.vue
index 405577095..084feb377 100644
--- a/src/components/ItemsFilterPanel.vue
+++ b/src/components/ItemsFilterPanel.vue
@@ -9,6 +9,8 @@ import VnSelect from 'components/common/VnSelect.vue';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
import axios from 'axios';
+import { getParamWhere } from 'src/filters';
+import { useRoute } from 'vue-router';
const { t } = useI18n();
const props = defineProps({
@@ -26,28 +28,21 @@ const props = defineProps({
},
});
-const itemCategories = ref([]);
-const selectedCategoryFk = ref(null);
-const selectedTypeFk = ref(null);
+const route = useRoute();
+
const itemTypesOptions = ref([]);
const suppliersOptions = ref([]);
const tagOptions = ref([]);
const tagValues = ref([]);
+const categoryList = ref(null);
+const selectedCategoryFk = ref(getParamWhere(route.query.table, 'categoryFk', false));
+const selectedTypeFk = ref(getParamWhere(route.query.table, 'typeFk', false));
-const categoryList = computed(() => {
- return (itemCategories.value || [])
- .filter((category) => category.display)
- .map((category) => ({
- ...category,
- icon: `vn:${(category.icon || '').split('-')[1]}`,
- }));
-});
-
-const selectedCategory = computed(() =>
- (itemCategories.value || []).find(
+const selectedCategory = computed(() => {
+ return (categoryList.value || []).find(
(category) => category?.id === selectedCategoryFk.value
- )
-);
+ );
+});
const selectedType = computed(() => {
return (itemTypesOptions.value || []).find(
@@ -87,7 +82,7 @@ const applyTags = (params, search) => {
search();
};
-const fetchItemTypes = async (id) => {
+const fetchItemTypes = async (id = selectedCategoryFk.value) => {
const filter = {
fields: ['id', 'name', 'categoryFk'],
where: { categoryFk: id },
@@ -126,15 +121,19 @@ const removeTag = (index, params, search) => {
(tagValues.value || []).splice(index, 1);
applyTags(params, search);
};
+const setCategoryList = (data) => {
+ categoryList.value = (data || [])
+ .filter((category) => category.display)
+ .map((category) => ({
+ ...category,
+ icon: `vn:${(category.icon || '').split('-')[1]}`,
+ }));
+ fetchItemTypes();
+};
- (itemCategories = data)"
- />
+
{
return filteredParts.join(', ');
};
-const modelValue = ref(
+const modelValue = computed(() =>
props.location ? formatLocation(props.location, locationProperties) : null
);
diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue
index bcbf0945e..e308ea9bb 100644
--- a/src/components/ui/VnNotes.vue
+++ b/src/components/ui/VnNotes.vue
@@ -6,7 +6,6 @@ import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { toDateHourMin } from 'src/filters';
-import { useState } from 'src/composables/useState';
import VnPaginate from 'components/ui/VnPaginate.vue';
import VnUserLink from 'components/ui/VnUserLink.vue';
@@ -26,9 +25,7 @@ const $props = defineProps({
});
const { t } = useI18n();
-const state = useState();
const quasar = useQuasar();
-const currentUser = ref(state.getUser());
const newNote = reactive({ text: null, observationTypeFk: null });
const observationTypes = ref([]);
const vnPaginateRef = ref();
diff --git a/src/composables/useRole.js b/src/composables/useRole.js
index d1a6d6ef3..3ec65dd0a 100644
--- a/src/composables/useRole.js
+++ b/src/composables/useRole.js
@@ -20,7 +20,7 @@ export function useRole() {
function hasAny(roles) {
const roleStore = state.getRoles();
-
+ if (typeof roles === 'string') roles = [roles];
for (const role of roles) {
if (roleStore.value.indexOf(role) !== -1) return true;
}
diff --git a/src/filters/getParamWhere.js b/src/filters/getParamWhere.js
index ef00a93ae..baba46f69 100644
--- a/src/filters/getParamWhere.js
+++ b/src/filters/getParamWhere.js
@@ -1,4 +1,3 @@
-// parsing JSON safely
function parseJSON(str, fallback) {
try {
return JSON.parse(str ?? '{}');
diff --git a/src/pages/Customer/Card/CustomerSummary.vue b/src/pages/Customer/Card/CustomerSummary.vue
index 2cad13115..f4c5e6e09 100644
--- a/src/pages/Customer/Card/CustomerSummary.vue
+++ b/src/pages/Customer/Card/CustomerSummary.vue
@@ -1,12 +1,11 @@