Skip to content

Commit

Permalink
Merge pull request #2629 from gillesbourgeat/feature/improve-invoice-…
Browse files Browse the repository at this point in the history
…and-delivery-interface

Improve invoice and delivery interface
  • Loading branch information
gillesbourgeat committed Feb 7, 2019
2 parents b2940ba + 785765e commit 89989fb
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 20 deletions.
4 changes: 4 additions & 0 deletions templates/backOffice/default/I18n/fr_FR.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1336,5 +1336,9 @@
'tracking reference' => 'Numéro du colis', 'tracking reference' => 'Numéro du colis',
'version' => 'Version', 'version' => 'Version',
'warning' => 'Attention', 'warning' => 'Attention',
'Download' => 'Télécharger',
'Print' => 'Imprimer',
'Print invoice' => 'Imprimer la facture',
'Print purchase order' => 'Imprimer le bon de commande',
'you can combine taxes in tax rules and chose if they are applied one after the other or at the same time : it allows to apply taxes on an already taxed price or not.' => 'vous pouvez combiner des taxes en règles de taxe et choisir si elle sont appliquées l\'une après l\'autre ou en même temps: cela permet d\'appliquer des taxes sur un produit déjà taxé ou non.', 'you can combine taxes in tax rules and chose if they are applied one after the other or at the same time : it allows to apply taxes on an already taxed price or not.' => 'vous pouvez combiner des taxes en règles de taxe et choisir si elle sont appliquées l\'une après l\'autre ou en même temps: cela permet d\'appliquer des taxes sur un produit déjà taxé ou non.',
); );
115 changes: 96 additions & 19 deletions templates/backOffice/default/order-edit.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -454,17 +454,42 @@ <h3 class="panel-title">{intl l='tracking reference'}</h3>
<h3 class="panel-title">{intl l='Invoice informations'}</h3> <h3 class="panel-title">{intl l='Invoice informations'}</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<a class="btn btn-info" title="{intl l='View invoice PDF'}" href="{url path="/admin/order/pdf/invoice/%id/%browser" browser=1 id=$ID}" target="_blank"> {include file='renderer/buttons.html' with_text=false buttons=[
<span class="glyphicon glyphicon glyphicon-eye-open"></span> {intl l='PDF | Invoice'} [
</a> 'type' => 'view',
<a class="btn btn-info" title="{intl l='Download invoice as PDF'}" href="{url path="/admin/order/pdf/invoice/%id/%browser" browser=0 id=$ID}"> 'title' => {intl l='View invoice PDF'},
<span class="glyphicon glyphicon-cloud-download"></span> {intl l='PDF | Invoice'} 'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=1 id=$ID},
</a> 'attr' => ['target' => '_blank']
],
[
'type' => 'download',
'title' => {intl l='Download invoice as PDF'},
'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=0 id=$ID}
],
[
'type' => 'print',
'class' => 'js-action-print',
'title' => {intl l='Print invoice'},
'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=1 id=$ID},
'data' => [
'type' => "invoice"
]
]
]}


<div class="pull-right"> <div class="pull-right">
<a class="btn btn-primary js-update-order-address" data-address-id="{$INVOICE_ADDRESS}" title="{intl l='Edit invoice address'}" href="#edit_order_address_dialog" data-toggle="modal"> {include file='renderer/buttons.html' with_text=false buttons=[
<span class="glyphicon glyphicon-edit"></span> [
</a> 'type' => 'edit',
'class' => 'js-update-order-address',
'title' => {intl l='Edit invoice address'},
'href' => "#edit_order_address_dialog",
'data' => [
'address-id' => $INVOICE_ADDRESS,
'toggle' => 'modal'
]
]
]}
</div> </div>
</div> </div>


Expand Down Expand Up @@ -543,6 +568,10 @@ <h3 class="panel-title">{intl l='Invoice informations'}</h3>
<th>{intl l="Cellphone"}</th> <th>{intl l="Cellphone"}</th>
<td>{$CELLPHONE}</td> <td>{$CELLPHONE}</td>
</tr> </tr>
<tr>
<th>{intl l="Email"}</th>
<td>{loop type="customer" name="customer" id=$CUSTOMER backend_context="on" current="false"}<a href="mailto:{$EMAIL}?Subject={intl l='Order %ref' ref={$REF}}">{$EMAIL}</a>{/loop}</td>
</tr>
{/loop} {/loop}
</tbody> </tbody>
</table> </table>
Expand All @@ -556,16 +585,42 @@ <h3 class="panel-title">{intl l='Delivery address'}</h3>
</div> </div>


<div class="panel-body"> <div class="panel-body">
<a class="btn btn-info" title="{intl l='View purchase order as PDF'}" href="{url path="/admin/order/pdf/delivery/%id/%browser" browser=1 id=$ID}" target="_blank"> {include file='renderer/buttons.html' with_text=false buttons=[
<span class="glyphicon glyphicon glyphicon-eye-open"></span> {intl l='PDF | Purchase order'} [
</a> 'type' => 'view',
<a class="btn btn-info" title="{intl l='Download purchase order as PDF'}" href="{url path="/admin/order/pdf/delivery/%id/%browser" browser=0 id=$ID}"> 'title' => {intl l='View purchase order as PDF'},
<span class="glyphicon glyphicon-cloud-download"></span> {intl l='PDF | Purchase order'} 'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=1 id=$ID},
</a> 'attr' => ['target' => '_blank']
],
[
'type' => 'download',
'title' => {intl l='Download purchase order as PDF'},
'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=0 id=$ID}
],
[
'type' => 'print',
'class' => 'js-action-print',
'title' => {intl l='Print purchase order'},
'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=1 id=$ID},
'data' => [
'type' => "purchase"
]
]
]}

<div class="pull-right"> <div class="pull-right">
<a class="btn btn-primary js-update-order-address" data-address-id="{$DELIVERY_ADDRESS}" title="{intl l='Edit delivery address'}" href="#edit_order_address_dialog" data-toggle="modal"> {include file='renderer/buttons.html' with_text=false buttons=[
<span class="glyphicon glyphicon-edit"></span> [
</a> 'type' => 'edit',
'class' => 'js-update-order-address',
'title' => {intl l='Edit delivery address'},
'href' => "#edit_order_address_dialog",
'data' => [
'address-id' => $DELIVERY_ADDRESS,
'toggle' => 'modal'
]
]
]}
</div> </div>
</div> </div>


Expand All @@ -577,6 +632,12 @@ <h3 class="panel-title">{intl l='Delivery address'}</h3>
{/ifhook} {/ifhook}
{elsehook rel="order-edit.bill-delivery-address"} {elsehook rel="order-edit.bill-delivery-address"}
{loop type="order_address" name="order-delivery-address" id=$DELIVERY_ADDRESS} {loop type="order_address" name="order-delivery-address" id=$DELIVERY_ADDRESS}
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr data-field-class="js-company"> <tr data-field-class="js-company">
<th>{intl l="Company"}</th> <th>{intl l="Company"}</th>
<td>{$COMPANY}</td> <td>{$COMPANY}</td>
Expand Down Expand Up @@ -773,6 +834,22 @@ <h3 class="panel-title">{intl l='Delivery address'}</h3>
<script type="text/javascript"> <script type="text/javascript">


$(function() { $(function() {
function print(url, number) {
var iframeName = 'iframe-print-' + number;
var iframe = document.createElement('iframe');
iframe.src = url;
iframe.id = iframeName;
iframe.name = iframeName;
iframe.style.display = "none";
$('body').append(iframe);
window.frames[iframeName].focus();
window.frames[iframeName].print();
}
$('.js-action-print').on('click', function(e) {
e.preventDefault();
print($(this).attr('href'), this.dataset.type);
});

// Atomatic ajax tab load, if data-href is defined. // Atomatic ajax tab load, if data-href is defined.
$('.nav-tabs a[data-href]').on('shown.bs.tab', function (ev) { $('.nav-tabs a[data-href]').on('shown.bs.tab', function (ev) {
var $this = $(this); var $this = $(this);
Expand All @@ -798,7 +875,7 @@ <h3 class="panel-title">{intl l='Delivery address'}</h3>
$(this).data("address-id") $(this).data("address-id")
); );


$(this).parents('table').find('tr').each(function (k, v) { $(this).parents('.panel').find('table tr').each(function (k, v) {
var $field = $(v), var $field = $(v),
$formField, $formField,
fieldValue; fieldValue;
Expand Down
28 changes: 27 additions & 1 deletion templates/backOffice/default/renderer/buttons.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{$button['title'] = {intl l='View'}} {$button['title'] = {intl l='View'}}
{/if} {/if}
{if !$button['icon']['class']} {if !$button['icon']['class']}
{$button['icon']['class'] = 'glyphicon glyphicon-eye'} {$button['icon']['class'] = 'glyphicon glyphicon-eye-open'}
{/if} {/if}
{if $button['auth'] && !$button['auth']['access']} {if $button['auth'] && !$button['auth']['access']}
{$button['auth']['access'] = 'VIEW'} {$button['auth']['access'] = 'VIEW'}
Expand Down Expand Up @@ -201,6 +201,32 @@
{if $button['auth'] && !$button['auth']['access']} {if $button['auth'] && !$button['auth']['access']}
{$button['auth']['access'] = 'VIEW'} {$button['auth']['access'] = 'VIEW'}
{/if} {/if}
{elseif $button['type'] == 'print'}
{if !$button['baseClass']}
{$button['baseClass'] = 'btn btn-default'}
{/if}
{if !$button['title']}
{$button['title'] = {intl l='Print'}}
{/if}
{if !$button['icon']['class']}
{$button['icon']['class'] = 'glyphicon glyphicon-print'}
{/if}
{if $button['auth'] && !$button['auth']['access']}
{$button['auth']['access'] = 'VIEW'}
{/if}
{elseif $button['type'] == 'download'}
{if !$button['baseClass']}
{$button['baseClass'] = 'btn btn-default'}
{/if}
{if !$button['title']}
{$button['title'] = {intl l='Download'}}
{/if}
{if !$button['icon']['class']}
{$button['icon']['class'] = 'glyphicon glyphicon-download-alt'}
{/if}
{if $button['auth'] && !$button['auth']['access']}
{$button['auth']['access'] = 'VIEW'}
{/if}
{/if} {/if}


{if $button['auth'] && $button['auth']['resource']} {if $button['auth'] && $button['auth']['resource']}
Expand Down

0 comments on commit 89989fb

Please sign in to comment.