fixed addresstickets view
This commit is contained in:
@@ -726,16 +726,24 @@ class AddressController extends mfBaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$xinon_project = new XinonProject();
|
$xinon_project = new XinonProject();
|
||||||
$tickets = $xinon_project->searchSupportTickets('', 0, ['pageSize' => 100,
|
$filterParams = ['pageSize' => 100,
|
||||||
'filters' => json_encode([['customField6' => ['operator' => '=', 'values' => [$address->customer_number]]]])]);
|
'filters' => json_encode([['customField6' => ['operator' => '=', 'values' => [(string)$address->customer_number]]]])];
|
||||||
|
|
||||||
|
$tickets = $xinon_project->searchSupportTickets('', 0, $filterParams) ?? [];
|
||||||
|
|
||||||
$shippingNotes = array_map(function ($shippingNote) {
|
$shippingNotes = array_map(function ($shippingNote) {
|
||||||
$shippingNote->createByName = (new User($shippingNote->createBy))->getAbbrName();
|
$shippingNote->createByName = (new User($shippingNote->createBy))->getAbbrName();
|
||||||
return $shippingNote;
|
return $shippingNote;
|
||||||
}, WarehouseShippingNoteModel::getAll(['billingAddressId' => $address->id]));
|
}, WarehouseShippingNoteModel::getAll(['billingAddressId' => $address->id]));
|
||||||
|
|
||||||
Helper::renderVue($this,"AddressTickets",
|
$customerName = str_replace(["\r", "\n"], ' ', $address->getCompanyOrName());
|
||||||
"Tickets und Lieferscheine von Kunden: " . $address->getCompanyOrName() . '(' . $address->customer_number . ')', ["TICKETS" => $tickets,"SHIPPING_NOTES" => $shippingNotes,"ADDRESS" => $address]);
|
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() {
|
protected function sendServicePinAction() {
|
||||||
|
|||||||
@@ -66,8 +66,10 @@ class XinonProject {
|
|||||||
|
|
||||||
if (!is_null($overrideQueryParams)) $queryParams = $overrideQueryParams;
|
if (!is_null($overrideQueryParams)) $queryParams = $overrideQueryParams;
|
||||||
|
|
||||||
|
$url = $baseUrl . '?' . http_build_query($queryParams);
|
||||||
|
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => $baseUrl . '?' . http_build_query($queryParams),
|
CURLOPT_URL => $url,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
@@ -84,7 +86,7 @@ class XinonProject {
|
|||||||
|
|
||||||
$json = json_decode($response, true);
|
$json = json_decode($response, true);
|
||||||
|
|
||||||
return $json['_embedded']['elements'];
|
return $json['_embedded']['elements'] ?? [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
Vue.component('AddressTickets', {
|
Vue.component('AddressTickets', {
|
||||||
template: `
|
template: `
|
||||||
<div>
|
<div>
|
||||||
<tt-card class="mb-4">
|
<tt-card class="mb-4 mt-4">
|
||||||
<h3 class="text-center mb-3">Tickets</h3>
|
<h3 class="text-center mb-3">Tickets - {{ customerName }} ({{ customerNumber }})</h3>
|
||||||
<div class="table-responsive">
|
<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">
|
<table class="table table-striped table-hover table-sm">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Kundennummer</th>
|
|
||||||
<th>Erstellt am</th>
|
<th>Erstellt am</th>
|
||||||
<th>Betreff</th>
|
<th>Betreff</th>
|
||||||
<th>Letztes Update</th>
|
<th>Letztes Update</th>
|
||||||
@@ -16,7 +18,6 @@ Vue.component('AddressTickets', {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="ticket in tickets" :key="ticket.id">
|
<tr v-for="ticket in tickets" :key="ticket.id">
|
||||||
<td>{{ ticket.customField7 }}</td>
|
|
||||||
<td>{{ formatDate(ticket.createdAt) }}</td>
|
<td>{{ formatDate(ticket.createdAt) }}</td>
|
||||||
<td>{{ ticket.subject }}</td>
|
<td>{{ ticket.subject }}</td>
|
||||||
<td>{{ formatDate(ticket.updatedAt) }}</td>
|
<td>{{ formatDate(ticket.updatedAt) }}</td>
|
||||||
@@ -30,7 +31,10 @@ Vue.component('AddressTickets', {
|
|||||||
|
|
||||||
<tt-card>
|
<tt-card>
|
||||||
<h3 class="text-center mb-3">Lieferscheine</h3>
|
<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">
|
<table class="table table-striped table-hover table-sm">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -65,10 +69,15 @@ Vue.component('AddressTickets', {
|
|||||||
return {window: window};
|
return {window: window};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
customerName() {
|
||||||
|
return this.window.TT_CONFIG?.CUSTOMER_NAME || '';
|
||||||
|
},
|
||||||
|
customerNumber() {
|
||||||
|
return this.window.TT_CONFIG?.CUSTOMER_NUMBER || '';
|
||||||
|
},
|
||||||
tickets() {
|
tickets() {
|
||||||
return (this.window.TT_CONFIG?.TICKETS || []).map(t => ({
|
return (this.window.TT_CONFIG?.TICKETS || []).map(t => ({
|
||||||
id: t.id,
|
id: t.id,
|
||||||
customField7: t.customField7,
|
|
||||||
createdAt: t.createdAt,
|
createdAt: t.createdAt,
|
||||||
subject: t.subject,
|
subject: t.subject,
|
||||||
updatedAt: t.updatedAt,
|
updatedAt: t.updatedAt,
|
||||||
|
|||||||
Reference in New Issue
Block a user