added right actionbar icons and asset solution list

This commit is contained in:
2024-03-15 20:05:01 +01:00
parent 3613565b39
commit 29fd2e0a15
15 changed files with 232 additions and 67 deletions

View File

@ -1,4 +1,14 @@
<template>
<section v-if="searchable" :class="['solution-search', darkMode ? 'section-darkmode' : 'section-lightmode']">
<div :class="['solutionLabel', darkMode ? 'label-darkmode' : 'label-lightmode']">Solution</div>
<input v-model="solutionSearchFilter" @change="searchSolution()"
:class="['dataInput', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']">
</section>
<section v-if="filtered" :class="['solution-search', darkMode ? 'section-darkmode' : 'section-lightmode']">
<div :class="['solutionLabel', darkMode ? 'label-darkmode' : 'label-lightmode']">Type</div>
<input v-model="typeSearchFilter" @change="filterSolutionByType()"
:class="['dataInput', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']">
</section>
<div :class="['data', darkMode ? 'div-darkmode' : 'div-lightmode']">
<div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Solutions:</div>
<table class="data-table" id="solution-checkklist">
@ -28,7 +38,7 @@
<script setup>
import { ref, onMounted } from 'vue';
import { ref, onMounted, watch } from 'vue';
import Axios from '../axios.config.js';
import clientsideConfig from '../../clientsideConfig.js';
import { useStore } from 'vuex';
@ -36,9 +46,15 @@ import { computed } from 'vue';
const store = useStore();
const chosenAssetId = computed(() => store.state.chosenAssetId);
const searchable = computed(() => store.state.searchable);
const filtered = computed(() => store.state.filtered);
const solutionSearchFilter = ref('');
const typeSearchFilter = ref('');
const asset = ref({});
const solutions = ref({});
const solutions = ref([]);
const solutionsBySol = ref([]);
const solutionsByType = ref([]);
const darkMode = ref(true)
//get all solutions from the chosen asset
@ -51,6 +67,18 @@ const getSolutions = async () => {
}
}
// update search term
const updateSearchTerm = async () => {
solutionSearchFilter.value = '';
await getSolutions();
}
// update filter term
const updateFilterTerm = async () => {
typeSearchFilter.value = '';
await getSolutions();
}
const goToChosenSolution = (id) => {
store.commit('setChosenSolution', id);
store.commit('changeToSolution');
@ -69,6 +97,45 @@ const getItemById = async () => {
}
}
//get all solutions based on the searched solution name
const searchSolution = async () => {
if (solutionSearchFilter.value === '') {
await getSolutions();
} else {
try {
const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getSelectedSolutionsBySolution/${solutionSearchFilter.value}`);
solutionsBySol.value = response.data;
solutions.value = filterObjectsWithMatchingIds(solutions.value, solutionsBySol.value);
} catch (err) {
console.log(err.response.statusText);
}
}
}
//get all solutions based on the searched solution name
const filterSolutionByType = async () => {
if (typeSearchFilter.value === '') {
await getSolutions();
} else {
try {
const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getSelectedSolutionsByType/${typeSearchFilter.value}`);
solutionsByType.value = response.data;
solutions.value = filterObjectsWithMatchingIds(solutions.value, solutionsByType.value);
} catch (err) {
console.log(err.response.statusText);
}
}
}
const filterObjectsWithMatchingIds = (arr1, arr2) => {
return arr1.filter(obj1 => {
return arr2.some(obj2 => obj2.primaryID === obj1.primaryID);
});
};
watch(searchable, updateSearchTerm);
watch(filtered, updateFilterTerm);
onMounted(() => {
getItemById();
});
@ -103,6 +170,62 @@ export default {
background-color: #fff;
}
.solutionLabel {
width: 5.5625em;
height: 1.875em;
font-family: "Overpass";
font-style: normal;
font-weight: 400;
font-size: 0.875em;
line-height: 1.875;
letter-spacing: 0.05em;
}
.data-darkmode {
background-color: #212121;
color: #fff;
}
.data-lightmode {
background-color: #EBEBEB;
color: #000;
}
.dataInput {
display: flex;
flex-direction: row;
align-items: flex-start;
padding: 0 0.625rem;
border-radius: 0.3125rem;
box-shadow: 0.0625rem 0.0625rem 0.25rem 0rem rgba(0, 0, 0, 0.25) inset;
letter-spacing: 5%;
font: 400 0.75rem/250% Overpass, sans-serif;
}
.input {
border: none;
}
.section-darkmode {
background-color: #2c2c2c;
}
.section-lightmode {
background-color: #fff;
}
.solution-search {
display: flex;
align-items: center;
padding: 0.625em 1.875em;
gap: 1.25em;
width: 30.125em;
height: 3.125em;
box-shadow: 0.25em 0.25em 0.25em rgba(0, 0, 0, 0.25);
border-radius: 0.625em;
box-sizing: border-box;
}
.data-table {
width: 100%;
padding: 0 0.625rem;

View File

@ -1,4 +1,4 @@
<template>
<!-- <template>
<div :class="['data', darkMode ? 'div-darkmode' : 'div-lightmode']">
<div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Assets:</div>
<table class="data-table" id="asset-table-no-customer">
@ -183,4 +183,4 @@ th {
.label-lightmode {
color: #000;
}
</style>
</style> -->

View File

@ -1,4 +1,4 @@
<template>
<!-- <template>
<div :class="['data', darkMode ? 'div-darkmode' : 'div-lightmode']">
<div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Issue slip:</div>
<table class="data-table" id="asset-table">
@ -184,4 +184,4 @@ th {
.label-lightmode {
color: #000;
}</style>
}</style> -->

View File

@ -1,4 +1,4 @@
<template>
<!-- <template>
<div :class="['data', darkMode ? 'div-darkmode' : 'div-lightmode']">
<div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Templates:</div>
<table class="data-table" id="maintenance-visits-templat-table-no-customer">
@ -184,4 +184,4 @@ th {
.label-lightmode {
color: #000;
}</style>
}</style> -->

View File

@ -1,4 +1,4 @@
<template>
<!-- <template>
<div :class="['data', darkMode ? 'div-darkmode' : 'div-lightmode']">
<div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Templates:</div>
<table class="data-table" id="production-orders-template-table-no-customer">
@ -165,4 +165,4 @@ th {
.label-lightmode {
color: #000;
}</style>
}</style> -->

View File

@ -1,4 +1,4 @@
<template>
<!-- <template>
<div :class="['data', darkMode ? 'div-darkmode' : 'div-lightmode']">
<div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Solutions:</div>
<table class="data-table" id="solution-table">
@ -183,4 +183,4 @@ th {
.label-lightmode {
color: #000;
}
</style>
</style> -->