fixed addresstickets view

This commit is contained in:
Luca Haid
2025-12-22 10:51:10 +01:00
parent f7dc510264
commit 27df509505
3 changed files with 32 additions and 13 deletions

View File

@@ -726,16 +726,24 @@ class AddressController extends mfBaseController {
}
$xinon_project = new XinonProject();
$tickets = $xinon_project->searchSupportTickets('', 0, ['pageSize' => 100,
'filters' => json_encode([['customField6' => ['operator' => '=', 'values' => [$address->customer_number]]]])]);
$filterParams = ['pageSize' => 100,
'filters' => json_encode([['customField6' => ['operator' => '=', 'values' => [(string)$address->customer_number]]]])];
$tickets = $xinon_project->searchSupportTickets('', 0, $filterParams) ?? [];
$shippingNotes = array_map(function ($shippingNote) {
$shippingNote->createByName = (new User($shippingNote->createBy))->getAbbrName();
return $shippingNote;
}, WarehouseShippingNoteModel::getAll(['billingAddressId' => $address->id]));
Helper::renderVue($this,"AddressTickets",
"Tickets und Lieferscheine von Kunden: " . $address->getCompanyOrName() . '(' . $address->customer_number . ')', ["TICKETS" => $tickets,"SHIPPING_NOTES" => $shippingNotes,"ADDRESS" => $address]);
$customerName = str_replace(["\r", "\n"], ' ', $address->getCompanyOrName());
Helper::renderVue($this,"AddressTickets", "Tickets und Lieferscheine", [
"TICKETS" => $tickets,
"SHIPPING_NOTES" => $shippingNotes,
"CUSTOMER_NAME" => $customerName,
"CUSTOMER_NUMBER" => $address->customer_number,
"HIDE_PAGE_TITLE" => true
]);
}
protected function sendServicePinAction() {

View File

@@ -66,8 +66,10 @@ class XinonProject {
if (!is_null($overrideQueryParams)) $queryParams = $overrideQueryParams;
$url = $baseUrl . '?' . http_build_query($queryParams);
curl_setopt_array($curl, array(
CURLOPT_URL => $baseUrl . '?' . http_build_query($queryParams),
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@@ -84,7 +86,7 @@ class XinonProject {
$json = json_decode($response, true);
return $json['_embedded']['elements'];
return $json['_embedded']['elements'] ?? [];
}
}
?>

View File

@@ -1,13 +1,15 @@
Vue.component('AddressTickets', {
template: `
<div>
<tt-card class="mb-4">
<h3 class="text-center mb-3">Tickets</h3>
<div class="table-responsive">
<tt-card class="mb-4 mt-4">
<h3 class="text-center mb-3">Tickets - {{ customerName }} ({{ customerNumber }})</h3>
<div v-if="tickets.length === 0" class="alert alert-info text-center">
Keine Tickets gefunden.
</div>
<div v-else class="table-responsive">
<table class="table table-striped table-hover table-sm">
<thead class="thead-light">
<tr>
<th>Kundennummer</th>
<th>Erstellt am</th>
<th>Betreff</th>
<th>Letztes Update</th>
@@ -16,7 +18,6 @@ Vue.component('AddressTickets', {
</thead>
<tbody>
<tr v-for="ticket in tickets" :key="ticket.id">
<td>{{ ticket.customField7 }}</td>
<td>{{ formatDate(ticket.createdAt) }}</td>
<td>{{ ticket.subject }}</td>
<td>{{ formatDate(ticket.updatedAt) }}</td>
@@ -30,7 +31,10 @@ Vue.component('AddressTickets', {
<tt-card>
<h3 class="text-center mb-3">Lieferscheine</h3>
<div class="table-responsive">
<div v-if="shippingNotes.length === 0" class="alert alert-info text-center">
Keine Lieferscheine gefunden.
</div>
<div v-else class="table-responsive">
<table class="table table-striped table-hover table-sm">
<thead class="thead-light">
<tr>
@@ -65,10 +69,15 @@ Vue.component('AddressTickets', {
return {window: window};
},
computed: {
customerName() {
return this.window.TT_CONFIG?.CUSTOMER_NAME || '';
},
customerNumber() {
return this.window.TT_CONFIG?.CUSTOMER_NUMBER || '';
},
tickets() {
return (this.window.TT_CONFIG?.TICKETS || []).map(t => ({
id: t.id,
customField7: t.customField7,
createdAt: t.createdAt,
subject: t.subject,
updatedAt: t.updatedAt,