added new logout button and fixed pdf viewing
This commit is contained in:
@@ -405,6 +405,13 @@ Vue.component('warehouse-shipping-note', {
|
||||
//language=Vue
|
||||
template: `
|
||||
<tt-card>
|
||||
<tt-fullscreen-viewer
|
||||
v-if="viewerItem"
|
||||
:item="viewerItem"
|
||||
:url="viewerUrl"
|
||||
@close="viewerItem = null; viewerUrl = null"
|
||||
/>
|
||||
|
||||
<warehouse-shipping-note-see-through
|
||||
@close="shippingNoteSeeThrough = false;$refs.table.$refs.table.refreshTable()"
|
||||
v-if="shippingNoteSeeThrough !== false"
|
||||
@@ -469,7 +476,7 @@ Vue.component('warehouse-shipping-note', {
|
||||
|
||||
<tt-table-crud emit-edit
|
||||
@openHistory="historyModal = true; historyModalId = $event.id"
|
||||
@print="window.open(window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/createPDF?id=' + $event.id)"
|
||||
@print="showPrintPreview($event)"
|
||||
@status_to_progress="changeStatus($event.id, 'in_progress')"
|
||||
@status_to_accepted="changeStatus($event.id, 'accepted')"
|
||||
@status_to_invoiced="changeStatus($event.id, 'invoiced')"
|
||||
@@ -497,6 +504,8 @@ Vue.component('warehouse-shipping-note', {
|
||||
shippingNoteModalId: null,
|
||||
signingShippingNoteId: null,
|
||||
addLogModalId: null,
|
||||
viewerItem: null,
|
||||
viewerUrl: null,
|
||||
shippingNoteSeeThrough: false,
|
||||
articleModalId: null,
|
||||
calendarEvents: [],
|
||||
@@ -523,6 +532,10 @@ Vue.component('warehouse-shipping-note', {
|
||||
window.notify('error', 'Kalendereinträge konnten nicht geladen werden.');
|
||||
}
|
||||
},
|
||||
showPrintPreview(row) {
|
||||
this.viewerUrl = `${window.TT_CONFIG['BASE_PATH']}/WarehouseShippingNote/createPDF?id=${row.id}`;
|
||||
this.viewerItem = { mimetype: 'application/pdf' };
|
||||
},
|
||||
formatEventDate(dateString) {
|
||||
return window.moment(dateString).format('DD.MM.YYYY HH:mm');
|
||||
},
|
||||
@@ -581,4 +594,46 @@ document.addEventListener('visibilitychange', () => {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
if (!window.matchMedia('(display-mode: standalone)').matches) return;
|
||||
|
||||
const logoutButton = document.createElement('button');
|
||||
logoutButton.innerHTML = '<i class="fas fa-sign-out-alt"></i> Logout';
|
||||
|
||||
Object.assign(logoutButton.style, {
|
||||
position: 'fixed',
|
||||
top: '10px',
|
||||
left: '50%',
|
||||
transform: 'translateX(-50%)',
|
||||
zIndex: '10000',
|
||||
padding: '8px 16px',
|
||||
backgroundColor: '#f44336',
|
||||
color: 'white',
|
||||
border: 'none',
|
||||
borderRadius: '4px',
|
||||
cursor: 'pointer',
|
||||
fontSize: '14px',
|
||||
boxShadow: '0 2px 5px rgba(0,0,0,0.2)'
|
||||
});
|
||||
|
||||
const handleLogout = async () => {
|
||||
logoutButton.disabled = true;
|
||||
try {
|
||||
const { data } = await axios.get('/WarehouseShippingNote/warehouseLogoutAction');
|
||||
const type = data.success ? 'success' : 'error';
|
||||
const message = data.message || (data.success ? 'Erfolgreich ausgeloggt' : 'Logout fehlgeschlagen');
|
||||
window.notify(type, message);
|
||||
} catch (error) {
|
||||
console.error('Logout request failed:', error);
|
||||
window.notify('error', 'Ein Netzwerkfehler ist aufgetreten.');
|
||||
} finally {
|
||||
setTimeout(() => window.location.reload(), 1000);
|
||||
}
|
||||
};
|
||||
|
||||
logoutButton.addEventListener('click', handleLogout);
|
||||
document.body.appendChild(logoutButton);
|
||||
});
|
||||
Reference in New Issue
Block a user