Files
crm.twinpol.com/modules/EcmSales/tpls/bimit_importAllegroOrders.tpl
2025-05-12 15:46:37 +00:00

104 lines
4.0 KiB
Smarty

<table style="border-collapse: collapse; width: 100%;">
<thead>
<tr>
<th>Klient</th>
<th>Produkty</th>
<th>Zamówienie sprzedaży</th>
</tr>
</thead>
{foreach from=$orders item=order}
<tr style="border-bottom: 1pt solid green; margin-top: 100px;">
<td style="padding-bottom:10px; padding-top:10px;">
{$order->id}<br>
{$order->buyer->email}<br>
{$order->buyer->firstName} {$order->buyer->lastName}<br><br>
{$order->buyer->address->street}<br>
{$order->buyer->address->postCode} {$order->buyer->address->city}<br>
{$order->buyer->address->countryCode} <br><br>
Klient istnieje w bazie:
{if $order->buyer->exists}
<a target="new" href="index.php?module=Accounts&action=DetailView&record={$order->buyer->e5Id}">
{$order->buyer->e5Name}
</a>
{else}NIE
{/if}
</td>
<td style="padding-bottom:10px; padding-top:10px;">
{foreach from=$order->lineItems item=product}
{$product->offer->external->id}, {$product->offer->name} <br>
Ilość: {$product->quantity} Cena {$product->price->amount} {$product->price->currency}<br><br>
{/foreach}
</td>
<td style="padding-bottom:10px; padding-top:10px;">
{if $order->exists}
<a target="new" href="index.php?module=EcmSales&action=DetailView&record={$order->e5Id}">
ZS {$order->e5Number}
</a>
{if $order->e5InvoiceId} <br>
<a target="new" href="index.php?module=EcmInvoiceOuts&action=DetailView&record={$order->e5InvoiceId}">
FV {$order->e5InvoiceNumber}
</a>
<input type="button" value="Wyślij fakturę do Allegro" onclick="sendInvoice('{$order->e5InvoiceId}')">
{/if}
{else}
<input type="button" value="Utwórz zamówienie" onclick="createOrder('{$order->id}')">
{/if}
</td>
</tr>
{/foreach}
</table>
<script>
{literal}
function createOrder(orderId) {
blockUI();
$.ajax({
url: 'index.php?module=EcmSales&action=bimit_importAllegroOrders&ajaxAction=createOrder&to_pdf=1&orderId=' +
orderId,
type: 'GET',
success: function(data) {
window.location.reload();
},
error: function(data) {
alert('Wystąpił błąd');
}
});
}
function sendInvoice(invoiceId) {
alert('Funkcjonalność w trakcie budowy');
return;
//blockUI();
$.ajax({
url: 'index.php?module=EcmSales&action=bimit_importAllegroOrders&ajaxAction=sendInvoice&to_pdf=1&orderId=' +
invoiceId,
type: 'GET',
success: function(data) {
console.log(data);
//window.location.reload();
},
error: function(data) {
alert('Wystąpił błąd');
}
});
}
function blockUI() {
$.blockUI(
{css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
'font-weight': 'bold',
'font-size': '16px',
color: '#fff',
},
message: "Tworzenie zamówienia..."
});
}
{/literal}
</script>