Compare commits

..

4 Commits

Author SHA1 Message Date
philipp lang 8c820ab24d Add cy data to invoice edit button
continuous-integration/drone/push Build is failing Details
2024-06-28 08:40:58 +02:00
philipp lang d26463d43c Add run script 2024-06-28 08:38:05 +02:00
philipp lang 4fda17d2c6 make siteName optional in api index 2024-06-28 08:36:57 +02:00
philipp lang 094a84c745 Lint text component 2024-06-28 08:30:35 +02:00
4 changed files with 50 additions and 188 deletions

22
bin/run Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
tmux new-session -d -s test
tmux send-keys -t test "a serve" Enter
tmux new-window -t test
tmux send-keys -t test "SS start docker && duu meilisearch" Enter
tmux new-window -t test
tmux send-keys -t test "SS start docker && duu socketi" Enter
tmux new-window -t test
tmux send-keys -t test "nrh" Enter
tmux new-window -t test
tmux send-keys -t test "ggwdk && cd plugins/silva/adrema/assets/vendor/adrema-form && nrd" Enter
tmux new-window -t test
tmux send-keys -t test "cd tests/Fileshare && docker compose up" Enter
tmux attach-session -t test

View File

@ -5,20 +5,9 @@
<span v-show="required" class="text-red-800">&nbsp;*</span> <span v-show="required" class="text-red-800">&nbsp;*</span>
</span> </span>
<div class="real-field-wrap size-sm" :class="sizes[size].field"> <div class="real-field-wrap size-sm" :class="sizes[size].field">
<input <input :name="name" :type="type" :value="transformedValue" :disabled="disabled" :placeholder="placeholder"
:name="name" :min="min" :max="max" @keypress="$emit('keypress', $event)" @input="onInput" @change="onChange"
:type="type" @focus="onFocus" @blur="onBlur" />
:value="transformedValue"
:disabled="disabled"
:placeholder="placeholder"
:min="min"
:max="max"
@keypress="$emit('keypress', $event)"
@input="onInput"
@change="onChange"
@focus="onFocus"
@blur="onBlur"
/>
<div v-if="hint" class="info-wrap"> <div v-if="hint" class="info-wrap">
<div v-tooltip="hint"> <div v-tooltip="hint">
<ui-sprite src="info-button" class="info-button"></ui-sprite> <ui-sprite src="info-button" class="info-button"></ui-sprite>
@ -33,129 +22,36 @@ import wNumb from 'wnumb';
var numb = { var numb = {
natural: wNumb({ natural: wNumb({
mark: ',',
thousand: '.',
decimals: 0,
decoder(a) {
return a * 100;
},
encoder(a) {
return a / 100;
},
}),
naturalRaw: wNumb({
mark: '', mark: '',
thousand: '', thousand: '',
decimals: 0, decimals: 0,
decoder(a) { decoder: (a) => a * 100,
return a * 100; encoder: (a) => a / 100,
},
encoder(a) {
return a / 100;
},
}),
naturalDetailRaw: wNumb({
mark: '',
thousand: '',
decimals: 0,
decoder(a) {
return a * 10000;
},
encoder(a) {
return a / 10000;
},
}), }),
area: wNumb({ area: wNumb({
mark: ',',
thousand: '.',
decimals: 2,
decoder(a) {
return a * 100;
},
encoder(a) {
return a / 100;
},
}),
areaDetail: wNumb({
mark: ',',
thousand: '.',
decimals: 4,
decoder(a) {
return a * 10000;
},
encoder(a) {
return a / 10000;
},
}),
twoDecimalRaw: wNumb({
mark: ',', mark: ',',
thousand: '', thousand: '',
decimals: 2, decimals: 2,
decoder(a) { decoder: (a) => a * 100,
return a * 100; encoder: (a) => a / 100,
},
encoder(a) {
return a / 100;
},
}),
fourDecimalRaw: wNumb({
mark: ',',
thousand: '',
decimals: 4,
decoder(a) {
return a * 10000;
},
encoder(a) {
return a / 10000;
},
}), }),
}; };
var transformers = { var transformers = {
none: { none: {
display: { display: {
to(v) { to: (v) => v,
return v; from: (v) => v,
},
from(v) {
return v;
},
}, },
edit: { edit: {
to(v) { to: (v) => v,
return v; from: (v) => v,
},
from(v) {
return v;
},
},
},
natural: {
display: {
to(v) {
return isNaN(parseInt(v)) ? '' : numb.natural.to(v);
},
from(v) {
return v === '' ? null : numb.natural.from(v);
},
},
edit: {
to(v) {
return isNaN(parseInt(v)) ? '' : numb.naturalRaw.to(v);
},
from(v) {
return v === '' ? null : numb.naturalRaw.from(v);
},
}, },
}, },
area: { area: {
display: { display: {
to(v) { to: (v) => (v === null ? '' : numb.area.to(v)),
return v === null ? '' : numb.area.to(v); from: (v) => (v === '' ? null : numb.area.from(v)),
},
from(v) {
return v === '' ? null : numb.area.from(v);
},
}, },
edit: { edit: {
to(v) { to(v) {
@ -163,81 +59,19 @@ var transformers = {
return ''; return '';
} }
if (Math.round(v / 100) * 100 === v) { if (Math.round(v / 100) * 100 === v) {
return numb.naturalRaw.to(v); return numb.natural.to(v);
} }
return numb.twoDecimalRaw.to(v); return numb.area.to(v);
}, },
from(v) { from(v) {
if (v === '') { if (v === '') {
return null; return null;
} }
if (v.indexOf(',') === -1) { if (v.indexOf(',') === -1) {
return numb.naturalRaw.from(v); return numb.natural.from(v);
} }
return numb.twoDecimalRaw.from(v); return numb.area.from(v);
},
},
},
currency: {
display: {
to(v) {
return v === null ? '' : numb.area.to(v);
},
from(v) {
return v === '' ? null : numb.area.from(v);
},
},
edit: {
to(v) {
if (v === null) {
return '';
}
if (Math.round(v / 100) * 100 === v) {
return numb.naturalRaw.to(v);
}
return numb.twoDecimalRaw.to(v);
},
from(v) {
if (v === '') {
return null;
}
if (v.indexOf(',') === -1) {
return numb.naturalRaw.from(v);
}
return numb.twoDecimalRaw.from(v);
},
},
},
currencyDetail: {
display: {
to(v) {
return v === null ? '' : numb.areaDetail.to(v);
},
from(v) {
return v === '' ? null : numb.areaDetail.from(v);
},
},
edit: {
to(v) {
if (v === null) {
return '';
}
if (Math.round(v / 10000) * 10000 === v) {
return numb.naturalDetailRaw.to(v);
}
return numb.fourDecimalRaw.to(v);
},
from(v) {
if (v === '') {
return null;
}
if (v.indexOf(',') === -1) {
return numb.naturalDetailRaw.from(v);
}
return numb.fourDecimalRaw.from(v);
}, },
}, },
}, },

View File

@ -2,9 +2,13 @@ import {ref, inject, onBeforeUnmount} from 'vue';
import {router} from '@inertiajs/vue3'; import {router} from '@inertiajs/vue3';
import useQueueEvents from './useQueueEvents.js'; import useQueueEvents from './useQueueEvents.js';
export function useApiIndex(firstUrl, siteName) { export function useApiIndex(firstUrl, siteName = null) {
const axios = inject('axios'); const axios = inject('axios');
const {startListener, stopListener} = useQueueEvents(siteName, () => reload());
if (siteName !== null) {
var {startListener, stopListener} = useQueueEvents(siteName, () => reload());
}
const single = ref(null); const single = ref(null);
const url = ref(firstUrl); const url = ref(firstUrl);
@ -78,8 +82,10 @@ export function useApiIndex(firstUrl, siteName) {
url.value = newUrl; url.value = newUrl;
} }
startListener(); if (siteName !== null) {
onBeforeUnmount(() => stopListener()); startListener();
onBeforeUnmount(() => stopListener());
}
return { return {
data: inner.data, data: inner.data,

View File

@ -113,7 +113,7 @@
<div class="flex space-x-2"> <div class="flex space-x-2">
<ui-action-button tooltip="Anschauen" :href="invoice.links.pdf" class="btn-info" icon="eye" blank></ui-action-button> <ui-action-button tooltip="Anschauen" :href="invoice.links.pdf" class="btn-info" icon="eye" blank></ui-action-button>
<ui-action-button tooltip="Erinnerung anschauen" :href="invoice.links.rememberpdf" class="btn-info" icon="document" blank></ui-action-button> <ui-action-button tooltip="Erinnerung anschauen" :href="invoice.links.rememberpdf" class="btn-info" icon="document" blank></ui-action-button>
<ui-action-button tooltip="Bearbeiten" class="btn-warning" icon="pencil" @click.prevent="edit(invoice)"></ui-action-button> <ui-action-button :data-cy="`edit-button-${invoice.id}`" tooltip="Bearbeiten" class="btn-warning" icon="pencil" @click.prevent="edit(invoice)"></ui-action-button>
<ui-action-button tooltip="Löschen" class="btn-danger" icon="trash" @click.prevent="deleting = invoice"></ui-action-button> <ui-action-button tooltip="Löschen" class="btn-danger" icon="trash" @click.prevent="deleting = invoice"></ui-action-button>
</div> </div>
</td> </td>