Skip to content

Instantly share code, notes, and snippets.

@gabrielzevedo
Last active September 24, 2019 15:37
Show Gist options
  • Save gabrielzevedo/05e19216f03c3b013be63390a1f000e4 to your computer and use it in GitHub Desktop.
Save gabrielzevedo/05e19216f03c3b013be63390a1f000e4 to your computer and use it in GitHub Desktop.
{% extends _layout %}
{% block content %}
<h2 class="page-header">{{ 'Pedido'|trans({'en':'Order'}) }} #{{ order_id }}</h2>
<div class="orderAct pull-right">
<a href="{{ site_url('secure/duplicate_cart/' ~ order_id) }}" class="btn btn-default">
<i class="glyphicon glyphicon-repeat"></i>
</a>
{% if boletourl %}
<a class="btn" target="_blank" href="{{ boletourl }}" class="btn btn-primary">
<i class="glyphicon glyphicon-barcode"></i>
</a>
{% elseif paymenturl %}
<a class="btn" target="_blank" href="{{ paymenturl }}" class="btn btn-primary">
<i class="glyphicon glyphicon-barcode"></i>
</a>
{% endif %}
<a href="{{ site_url('secure/print_order/' ~ order_id) }}" class="btn btn-primary" target="_blank">
<i class="glyphicon glyphicon-print"></i>
</a>
</div>
{# Order Status #}
{% if order.status %}
<div class="row order-status">
<div class="col-xs-12">
<div class="tracking clearfix">
<div class="step done">
<span>{{ 'Pedido Realizado'|trans({'en':'Order Placed'}) }}</span>
{% if order.ordered_on %}
<p>{{ 'Data'|trans({'en':'Date'}) }}: {{ order.ordered_on|date('d/m/Y')|trans({'en':order.ordered_on|date('m/d/Y')}) }}</p>
<p>{{ 'Hora'|trans({'en':'Hour'}) }}: {{ order.ordered_on|date('H:i')|trans({'en':order.ordered_on|date('h:i a')}) }}</p>
{% endif %}
</div>
{% if order.status == 'Processing' %}
<div class="step done">
<span>{{ 'Pagamento Aprovado'|trans({'en':'Payment Approved'}) }}</span>
{% if order.approved_on %}
<p>{{ 'Data'|trans({'en':'Date'}) }}: {{ order.approved_on|date('d/m/Y')|trans({'en':order.approved_on|date('m/d/Y')}) }}</p>
<p>{{ 'Hora'|trans({'en':'Hour'}) }}: {{ order.approved_on|date('H:i')|trans({'en':order.ordered_on|date('h:i a')}) }}</p>
{% endif %}
</div>
{% elseif order.status == 'Cancelled' %}
<div class="step actual">
<span>{{ 'Pagamento Cancelado'|trans({'en':'Payment Cancelled'}) }}</span>
</div>
{% else %}
<div class="step actual">
<span>{{ 'Aguardando Pagamento'|trans({'en':'Awaiting Payment'}) }}</span>
</div>
{% endif %}
{% if order.status == 'Processing' %}
<div class="step actual">
<span>{{ 'Aguardando Envio'|trans({'en':'Awaiting Shipping'}) }}</span>
</div>
{% elseif order.status == 'Shipped' or order.status == 'Delivered' %}
<div class="step done">
<span>{{ 'Pedido Enviado'|trans({'en':'Order Dispatched'}) }}</span>
{% if order.shipped_on %}
<p>{{ 'Data'|trans({'en':'Date'}) }}: {{ order.shipped_on|date('d/m/Y')|trans({'en':order.shipped_on|date('m/d/Y')}) }}</p>
<p>{{ 'Hora'|trans({'en':'Hour'}) }}: {{ order.shipped_on|date('H:i')|trans({'en':order.ordered_on|date('h:i a')}) }}</p>
{% endif %}
{% if order.tracking_number %}
<a class="btn btn-default" href="http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI={{ order.tracking_number }}"><i class="glyphicon glyphicon-info-sign"></i>&nbsp; {{ 'Rastrear Pedido'|trans({'en':'Track Order'}) }}</a>
{% endif %}
</div>
{% else %}
<div class="step">
<span>{{ 'Aguardando Envio'|trans({'en':'Awaiting Shipping'}) }}</span>
</div>
{% endif %}
{% if order.status == 'Shipped' %}
<div class="step actual">
<span>{{ 'Entrega Pendente'|trans({'en':'Pending Delivery'}) }}</span>
</div>
{% elseif order.status == 'Delivered' %}
<div class="step done">
<span>{{ 'Pedido Entregue'|trans({'en':'Order Delivered'}) }}</span>
</div>
{% else %}
<div class="step">
<span>{{ 'Entrega Pendente'|trans({'en':'Pending Delivery'}) }}</span>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-lg-12">
<div class="order-detail-wrap">
<div class="row">
<div class="col-md-4">
<h3>{{ 'Endereço'|trans({'en':'Address'}) }}</h3>
<div class="order-detail-info">{{ customer.ship_address|format_address_nl2br }}</div>
</div>
<div class="col-md-4">
<h3>{{ lang('shipping_method') }}</h3>
<div class="order-detail-info">{{ shipping.method }}</div>
</div>
<div class="col-md-4">
<h3>{{ 'Forma de pagamento'|trans({'en':'Payment Method'}) }}</h3>
<div class="order-detail-info">{{ format_payment_desc(payment) }}</div>
</div>
</div>
<table class="table table-light" style="margin-top:20px;">
<thead>
<tr>
<th colspan="2">
{{lang('name') }}
</th>
<th style="width: 15%;">
{{lang('price') }}
</th>
<th style="width: 12%;">
{{lang('quantity') }}
</th>
<th style="width: 15%;">
{{lang('totals') }}
</th>
</tr>
</thead>
<tbody>
{% for cartkey, product in loja.contents %}
<tr>
<td width="7%" class="cart-product-img">{{ product_img(product, 'thumbnails', {'width': 78}) }}</td>
<td>
<strong>{{ product.name }}{{ product.sku ? ' (' ~ product.sku ~ ')' : '' }}</strong>
{% for name, value in product.options %}
<div>
{{ name }}: {{ value }}
</div>
{% endfor %}
</td>
<td>
{{ product.price|format_currency }}
</td>
<td>
{{ product.quantity }}
</td>
<td>
{{ (product.price * product.quantity)|format_currency }}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
{% if loja.group_discount > 0 %}
<tr>
<td colspan="4">
<strong>
{{ lang('group_discount') }}
</strong>
</td>
<td>
{{ (0 - loja.group_discount)|format_currency }}
</td>
</tr>
{% endif %}
<tr>
<td colspan="4">
<strong>
{{ lang('subtotal') }}
</strong>
</td>
<td>
{{ loja.subtotal|format_currency }}
</td>
</tr>
{% if loja.shipping_cost > 0 %}
<tr>
<td colspan="4">
<strong>
{{ lang('shipping') }}
</strong>
</td>
<td>
{{ loja.shipping_cost|format_currency }}
</td>
</tr>
{% endif %}
{% if loja.coupon_discount > 0 %}
<tr>
<td colspan="4">
<strong>
{{ lang('coupon_discount') }}
</strong>
</td>
<td>
-{{ loja.coupon_discount|format_currency }}
</td>
</tr>
{% endif %}
<tr>
<td colspan="4">
<strong>
{{ lang('grand_total') }}
</strong>
</td>
<td>
<span>{{ loja.total|format_currency }}</span>
</td>
</tr>
</tfoot>
</table>
{% if loja.history %}
<table class="table table-light" style="margin-top:20px;">
<thead>
<tr>
<th>{{ lang('history') }}</th>
</tr>
</thead>
<tbody>
{% for history in loja.history %}
<tr>
<td>
{% set dateEn = []|merge([history|split("(")[0]])|merge([history|split("(")[1]|split(")")[0]|replace({"/":"-"})|date("m/d/Y h:i:s a")])|merge([history|split(")")[1]]) %}
{% set translated = (dateEn[0]~'('~dateEn[1]~')'~dateEn[2])|replace({
"Alterado por:": "Edited by:",
"Aguardando Pagamento": "Awaiting Payment",
"Pagamento em Análise": "Payment in Analysis",
"Pagamento Aprovado": "Payment Approved",
"Em produção": "In production",
"Preparando para Envio": "Preparing for shipping",
"Enviado": "Sent",
"Aguardando retirada": "Awaiting withdrawal",
"Entregue": "Delivered",
"Cancelado": "Cancelled",
"Pagamento Cancelado": "Payment Cancelled",
"Em disputa": "In dispute",
"Esperando": "Waiting",
"Aguardando Envio": "Awaiting Shipping",
"Pagamento não identificado": "Unidentified payment",
"Cancelamento automático": "Auto cancel"
}) %}
{{ history|trans({'en': translated}) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>
</div>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment