Fixed Icons for WarehouseOrderRequest

This commit is contained in:
Luca Haid
2025-03-11 10:13:28 +01:00
parent cd3f08515c
commit 7da880d155
2 changed files with 36 additions and 28 deletions

View File

@@ -1,21 +1,25 @@
window['TT_CONFIG']['CRUD_CONFIG']['editCondition'] = (row) => {
return row.cancelled === 0 && (!row.linkedOrderIds || row.linkedOrderIds.length === 0);
}
window.TT_CONFIG["CRUD_CONFIG"]["additionalActions"] = [
...window.TT_CONFIG["CRUD_CONFIG"]["additionalActions"],
{
key: "cancelRequest",
title: "Bestellwunsch stornieren",
class: "fas fa-times text-danger",
class: "fas fa-ban text-danger", // Instead of fa-times, use a ban icon
condition: (row) => window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1' && row.cancelled === 0,
},
{
key: "uncancelRequest",
title: "Bestellwunsch wiederherstellen",
class: "fas fa-check text-success",
class: "fas fa-undo text-warning", // Use an undo icon for restore, with a warning color
condition: (row) => window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1' && row.cancelled === 1,
},
{
key: "createOrder",
title: "Bestellung erstellen",
class: "fas fa-plus text-success",
class: "fas fa-shopping-cart text-primary", // Use shopping-cart to indicate order creation
condition: (row) => window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1'
&& row.cancelled === 0 && (!row.linkedOrderIds || row.linkedOrderIds.length === 0)
&& JSON.parse(row.positions).filter(position => position.articleId_text).length === 0,
@@ -23,26 +27,26 @@ window.TT_CONFIG["CRUD_CONFIG"]["additionalActions"] = [
{
key: "doneOrder",
title: "Bestellwunsch erledigt",
class: "fas fa-check text-success",
class: "fas fa-check-circle text-success", // Use check-circle for marking as done
condition: (row) => window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1' && row.done === 0,
},
{
key: "undoneOrder",
title: "Bestellwunsch wieder offen",
class: "fas fa-times text-danger",
class: "fas fa-redo-alt text-info", // Use redo-alt to indicate reopening the order
condition: (row) => window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1' && row.done === 1,
},
]
];
Vue.component('add-log-modal', {
props: {
orderRequestId: {type: Number, required: true},
type: {type: String, default: 'accept'}
type: {type: String, default: 'accept'}
},
data() {
return {
orderRequest: null,
note: '',
orderRequest: null,
note: '',
};
},
async mounted() {
@@ -58,7 +62,7 @@ Vue.component('add-log-modal', {
async submit() {
const response = await axios.post(`${window.TT_CONFIG["BASE_PATH"]}/WarehouseOrderRequest/createNewLogAction`, {
orderRequestId: this.orderRequestId,
note: this.note,
note: this.note,
});
if (response.data.success) {
@@ -82,8 +86,8 @@ Vue.component('add-log-modal', {
})
Vue.component('order-request-log', {
props: {orderRequestId: {type: Number, required: true}},
data: () => ({
props: {orderRequestId: {type: Number, required: true}},
data: () => ({
logs: []
}),
async mounted() {
@@ -98,7 +102,8 @@ Vue.component('order-request-log', {
if (typeof response2.data.linkedOrderIds === 'string') {
try {
response2.data.linkedOrderIds = JSON.parse(response2.data.linkedOrderIds);
} catch {}
} catch {
}
}
if (response2.data.linkedOrderIds && response2.data.linkedOrderIds.length > 0) {
@@ -124,16 +129,16 @@ Vue.component('order-request-log', {
},
//language=Vue
template: `
<div>
<template v-if="logs.length > 0">
<hr>
<h3>Log</h3>
<div v-for="log in logs" :key="log.id" class="alert alert-light">
{{ formatDate(log.create) }} ({{ getUserName(log.createBy) }}) | {{ log.message }}
</div>
</template>
</div>
`
<div>
<template v-if="logs.length > 0">
<hr>
<h3>Log</h3>
<div v-for="log in logs" :key="log.id" class="alert alert-light">
{{ formatDate(log.create) }} ({{ getUserName(log.createBy) }}) | {{ log.message }}
</div>
</template>
</div>
`
})
@@ -166,7 +171,7 @@ Vue.component('linked-order-status', {
});
Vue.component('warehouse-order-request-detail', {
props: {
props: {
positions: {
type: Array,
required: true
@@ -217,15 +222,17 @@ Vue.component('warehouse-order-request', {
</template>
</tt-table-crud>
<warehouse-history-modal :show.sync="historyModal" :id="historyModalId"/>
<add-log-modal v-if="addLogModalId" :orderRequestId="addLogModalId" @close="addLogModal = false; addLogModalId = null; $refs.crud.$refs.table.refreshTable()"/>
<add-log-modal v-if="addLogModalId"
:orderRequestId="addLogModalId"
@close="addLogModal = false; addLogModalId = null; $refs.crud.$refs.table.refreshTable()"/>
</tt-card>
`,
data: () => ({
window,
historyModal: false,
historyModalId: null,
addLogModal: false,
addLogModalId: null,
addLogModal: false,
addLogModalId: null,
showHiddenRequests: false,
showCanceledRequests: false,
orderRequestModalId: null

View File

@@ -30,7 +30,8 @@ Vue.component('tt-table-crud', {
<!-- calculate min width 1 + number of actions * 19 -->
<div style="display: flex; justify-content: space-around; align-items: center;"
:style="{minWidth: calculateMinActionsWidth(row)}">
<a style="cursor: pointer;" @click="openCrudModal(row)"><i class="far fa-edit text-primary"
<a v-if="!crudConfig.editCondition || crudConfig.editCondition(row)"
style="cursor: pointer;" @click="openCrudModal(row)"><i class="far fa-edit text-primary"
title="Editieren"></i></a>
<!-- v-for action crudConfig.additionalActions -> v-if action.condition(row) || true , action.class for icon class, action.title for title, action.key for emitting event -->