fix: refs #6321 colors with variables

This commit is contained in:
Javier Segarra 2025-02-04 23:59:17 +01:00
parent bdb35e24ee
commit 74c0c64d50
4 changed files with 7 additions and 16 deletions

View File

@ -33,7 +33,7 @@ const formattedValue = computed(() => props.value);
color: $negative; color: $negative;
} }
.neutral { .neutral {
color: orange; color: $primary;
} }
.value-icon { .value-icon {
margin-right: 4px; margin-right: 4px;

View File

@ -28,7 +28,6 @@ const $props = defineProps({
}, },
}); });
const proposalSelected = ref([]); const proposalSelected = ref([]);
const quantity = ref(-1);
const sale = computed(() => $props.sales[0]); const sale = computed(() => $props.sales[0]);
const saleFk = computed(() => sale.value.saleFk); const saleFk = computed(() => sale.value.saleFk);
const filter = computed(() => ({ const filter = computed(() => ({
@ -146,15 +145,11 @@ const columns = computed(() => [
}, },
]); ]);
const extractNumericValue = (percentageString) => { const compatibilityItem = (value) => 100 * (value / MATCH_VALUES.length);
const match = percentageString.match(/(\d+(\.\d+)?)/);
return match ? parseFloat(match[0]) : null;
};
const compatibilityItem = (value) => `${100 * (value / MATCH_VALUES.length)}%`;
const gradientStyle = (value) => { const gradientStyle = (value) => {
let color = 'white'; let color = 'white';
const perc = extractNumericValue(compatibilityItem(value)); const perc = parseFloat(compatibilityItem(value));
switch (true) { switch (true) {
case perc >= 0 && perc < 33: case perc >= 0 && perc < 33:
color = 'orange'; color = 'orange';
@ -241,13 +236,13 @@ const isSelectionAvailable = (itemProposal) => {
</QTooltip> </QTooltip>
<div <div
class="middle compatibility" class="middle full-width"
:style="{ :style="{
background: gradientStyle(statusConditionalValue(row)), background: gradientStyle(statusConditionalValue(row)),
}" }"
> >
<QTooltip> <QTooltip>
{{ compatibilityItem(statusConditionalValue(row)) }} {{ compatibilityItem(statusConditionalValue(row)) }}%
</QTooltip> </QTooltip>
</div> </div>
<div style="flex: 2 0 100%; align-content: center"> <div style="flex: 2 0 100%; align-content: center">
@ -281,8 +276,6 @@ const isSelectionAvailable = (itemProposal) => {
</template> </template>
<template #column-price2="{ row }"> <template #column-price2="{ row }">
<div class="flex column items-center content-center"> <div class="flex column items-center content-center">
{{ toCurrency(sales[0].price) }}
{{ toCurrency(row.price2) }}
<VnStockValueDisplay :value="(sales[0].price - row.price2) / 100" /> <VnStockValueDisplay :value="(sales[0].price - row.price2) / 100" />
<span :class="[conditionalValuePrice(row.price2)]">{{ <span :class="[conditionalValuePrice(row.price2)]">{{
toCurrency(row.price2) toCurrency(row.price2)
@ -292,9 +285,6 @@ const isSelectionAvailable = (itemProposal) => {
</VnTable> </VnTable>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.compatibility {
width: 100%;
}
.middle { .middle {
float: left; float: left;
margin-right: 2px; margin-right: 2px;

View File

@ -54,6 +54,7 @@ function onBuysFetched(data) {
} }
const showItemProposal = () => { const showItemProposal = () => {
quasar quasar
.dialog({ .dialog({
component: ItemProposalProxy, component: ItemProposalProxy,
componentProps: { componentProps: {

View File

@ -235,7 +235,7 @@ function onBuysFetched(data) {
ref="badgeLackRef" ref="badgeLackRef"
class="q-ml-xs" class="q-ml-xs"
text-color="white" text-color="white"
:color="itemLack.lack !== 0 ? 'green' : 'red'" :color="itemLack.lack === 0 ? 'positive' : 'negative'"
:label="itemLack.lack" :label="itemLack.lack"
/> />
</div> </div>