mirror of
https://github.com/Spythere/genera-tor.git
synced 2026-05-03 21:48:13 +00:00
chore: added resetting order button, changed buttons layout
This commit is contained in:
@@ -76,7 +76,6 @@ function removeOrder(orderId: string) {
|
|||||||
StorageManager.removeValue(orderId);
|
StorageManager.removeValue(orderId);
|
||||||
|
|
||||||
if (store.chosenLocalOrderId == orderId) store.chosenLocalOrderId = '';
|
if (store.chosenLocalOrderId == orderId) store.chosenLocalOrderId = '';
|
||||||
console.log(storageOrderList);
|
|
||||||
|
|
||||||
const orderIndex = storageOrderList.findIndex((o) => o.id == orderId);
|
const orderIndex = storageOrderList.findIndex((o) => o.id == orderId);
|
||||||
if (orderIndex != -1) storageOrderList.splice(orderIndex, 1);
|
if (orderIndex != -1) storageOrderList.splice(orderIndex, 1);
|
||||||
|
|||||||
@@ -8,22 +8,32 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="message_actions">
|
<div class="message_actions">
|
||||||
<button class="g-button action" @click="saveOrder">
|
<button class="g-button action icon" @click="saveOrder">
|
||||||
|
<LucideSave />
|
||||||
{{ $t('order-message.button-save') }}
|
{{ $t('order-message.button-save') }}
|
||||||
</button>
|
</button>
|
||||||
<button class="g-button action" @click="copyMessage">
|
|
||||||
|
<button class="g-button action icon" @click="copyMessage">
|
||||||
|
<LucideCopy />
|
||||||
{{ $t('order-message.button-copy') }}
|
{{ $t('order-message.button-copy') }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="g-button action"
|
class="g-button action icon"
|
||||||
:data-disabled="!store.chosenLocalOrderId"
|
:data-disabled="!store.chosenLocalOrderId"
|
||||||
@click="updateOrder"
|
@click="updateOrder"
|
||||||
>
|
>
|
||||||
|
<LucidePencil />
|
||||||
{{ $t('order-message.button-update') }}
|
{{ $t('order-message.button-update') }}
|
||||||
<span class="text--accent"
|
<span class="text--accent">
|
||||||
>{{ store.chosenLocalOrderId && `#${store.chosenLocalOrderId.split('-')[1]}` }}
|
{{ store.chosenLocalOrderId && `#${store.chosenLocalOrderId.split('-')[1]}` }}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button class="g-button action icon" @click="resetOrder">
|
||||||
|
<LucideRotateCcw />
|
||||||
|
{{ $t('order-message.button-reset') }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="message_checkboxes">
|
<div class="message_checkboxes">
|
||||||
@@ -80,8 +90,8 @@ import { useStore } from '../store/store';
|
|||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import StorageManager from '../managers/storageManager';
|
import StorageManager from '../managers/storageManager';
|
||||||
import { currentFormattedHours, currentFormattedMinutes } from '../utils/dateUtils';
|
import { IOrderFooter, IOrderHeader, IStorageOrderData } from '../types/orderTypes';
|
||||||
import { IStorageOrderData } from '../types/orderTypes';
|
import { LucideCopy, LucidePencil, LucideRotateCcw, LucideSave } from 'lucide-vue-next';
|
||||||
|
|
||||||
type TActionMonitType = 'warning' | 'info' | 'success';
|
type TActionMonitType = 'warning' | 'info' | 'success';
|
||||||
|
|
||||||
@@ -275,6 +285,33 @@ function updateOrder() {
|
|||||||
window.localStorage.setItem(store.chosenLocalOrderId, JSON.stringify(orderDataToUpdate));
|
window.localStorage.setItem(store.chosenLocalOrderId, JSON.stringify(orderDataToUpdate));
|
||||||
showActionMonit(t('order-message.success-update-html'), 'success');
|
showActionMonit(t('order-message.success-update-html'), 'success');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetOrder() {
|
||||||
|
Object.keys(store.orderData.header).forEach((k) => {
|
||||||
|
store.orderData['header'][k as keyof IOrderHeader] = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.keys(store.orderData.footer).forEach((k) => {
|
||||||
|
store.orderData['footer'][k as keyof IOrderFooter] = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
store.orderData.instructions.forEach((instruction) => {
|
||||||
|
instruction.active = false;
|
||||||
|
|
||||||
|
Object.keys(instruction.inputFields).forEach((k) => {
|
||||||
|
instruction.inputFields[k] = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
if (instruction.listFields) {
|
||||||
|
instruction.listFields.forEach((field) => {
|
||||||
|
Object.keys(field.values).forEach((k) => {
|
||||||
|
field.active = false;
|
||||||
|
field.values[k] = '';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -313,10 +350,13 @@ function updateOrder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message_actions {
|
.message_actions {
|
||||||
display: flex;
|
display: grid;
|
||||||
align-items: center;
|
grid-template-columns: repeat(2, 1fr);
|
||||||
justify-content: center;
|
gap: 0.5em;
|
||||||
margin-top: 1em;
|
|
||||||
|
button.icon {
|
||||||
|
gap: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
button img {
|
button img {
|
||||||
height: 2ch;
|
height: 2ch;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"button-save": "Save as new order",
|
"button-save": "Save as new order",
|
||||||
"button-copy": "Copy the order message",
|
"button-copy": "Copy the order message",
|
||||||
"button-update": "Update the order",
|
"button-update": "Update the order",
|
||||||
|
"button-reset": "Reset the order",
|
||||||
"warning-outdated-clipboard": "Oops! Your browser may be a little bit depraceted since it's not supporting saving data to the clipboard! :/",
|
"warning-outdated-clipboard": "Oops! Your browser may be a little bit depraceted since it's not supporting saving data to the clipboard! :/",
|
||||||
"warning-fill-inputs": "Fill all the empty fields before copying the order!",
|
"warning-fill-inputs": "Fill all the empty fields before copying the order!",
|
||||||
"warning-add-rows": "Add at least one row before copying the order!",
|
"warning-add-rows": "Add at least one row before copying the order!",
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"button-save": "Zapisz nowy rozkaz",
|
"button-save": "Zapisz nowy rozkaz",
|
||||||
"button-copy": "Kopiuj treść rozkazu",
|
"button-copy": "Kopiuj treść rozkazu",
|
||||||
"button-update": "Zaktualizuj rozkaz",
|
"button-update": "Zaktualizuj rozkaz",
|
||||||
|
"button-reset": "Wyczyść rozkaz",
|
||||||
"warning-outdated-clipboard": "Ups! Twoja przeglądarka musi być dosyć przestarzała, ponieważ nie obsługuje zapisu do schowka! :/",
|
"warning-outdated-clipboard": "Ups! Twoja przeglądarka musi być dosyć przestarzała, ponieważ nie obsługuje zapisu do schowka! :/",
|
||||||
"warning-fill-inputs": "Wypełnij puste rubryki rozkazu przed jego skopiowaniem!",
|
"warning-fill-inputs": "Wypełnij puste rubryki rozkazu przed jego skopiowaniem!",
|
||||||
"warning-add-rows": "Dodaj co najmniej jedną działkę rozkazu przed jego skopiowaniem!",
|
"warning-add-rows": "Dodaj co najmniej jedną działkę rozkazu przed jego skopiowaniem!",
|
||||||
|
|||||||
Reference in New Issue
Block a user