From 84966858149bc12afcd8bb96540a0feab1954d7b Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Thu, 1 May 2014 19:20:32 +0200 Subject: [PATCH] Normalized coupon list appearance, added sorting --- .../Controller/Admin/CouponController.php | 3 +- templates/backOffice/default/coupon-list.html | 203 ++++++++++-------- 2 files changed, 117 insertions(+), 89 deletions(-) diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php index 2f2ad63db..82c3a97d5 100644 --- a/core/lib/Thelia/Controller/Admin/CouponController.php +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -73,6 +73,8 @@ class CouponController extends BaseAdminController Router::ABSOLUTE_URL ); + $args['coupon_order'] = $this->getListOrderFromSession('coupon', 'coupon_order', 'code'); + return $this->render('coupon-list', $args); } @@ -856,5 +858,4 @@ class CouponController extends BaseAdminController ) ); } - } diff --git a/templates/backOffice/default/coupon-list.html b/templates/backOffice/default/coupon-list.html index 4ba344601..30a3327b7 100644 --- a/templates/backOffice/default/coupon-list.html +++ b/templates/backOffice/default/coupon-list.html @@ -14,22 +14,25 @@ + {module_include location='coupon_top'} +
+ - - - - - - - - - {loop type="coupon" name="list_coupon" is_enabled="1" backend_context="true"} - - - - - - - - {/loop} - -
- {intl l='Enabled coupons'} + {intl l='Coupons'} {module_include location='coupon_list_caption'} {loop type="auth" name="can_create" role="ADMIN" resource="admin.coupon" access="CREATE"} - + {/loop} @@ -37,98 +40,119 @@
{block name="coupon-label-code"}{intl l='Code'}{/block}{block name="coupon-label-title"}{intl l='Title'}{/block}{block name="coupon-label-expiration-date"}{intl l='Days before expiration'}{/block}{block name="coupon-label-usage-left"}{intl l='Usage left'}{/block}{block name="coupon-label-action"}{/block}
{block name="coupon-code"}{$CODE}{/block}{block name="coupon-title"}{$TITLE}{/block}{block name="coupon-expiration-date"}{$DAY_LEFT_BEFORE_EXPIRATION}{/block} - {block name="coupon-usage-left"} - {if $USAGE_LEFT == -1} - - {intl l="Unlimited"} - - {elseif $USAGE_LEFT} - - {$USAGE_LEFT} - - {else} - - 0 - - {/if} - {/block} - - {block name="coupon-action"} - - {intl l='Edit'} - - {/block} -
-
-
-
-
+ {admin_sortable_header + current_order=$coupon_order + order='code' + reverse_order='code-reverse' + path={url path='/admin/coupon'} + request_parameter_name='coupon_order' + label="{intl l='Code'}" + } + -
-
-
-
- - - - - - - - - + + + + + + + + + + + {module_include location='coupon_table_header'} + + - {loop type="coupon" name="list_coupon" is_enabled="0" backend_context="true"} + {loop type="coupon" name="list_coupon" order={$coupon_order|default:'code'} backend_context="true"} - - - - + + + + + + + + + + {module_include location='coupon_table_row'} + + {/loop} @@ -136,6 +160,9 @@
- {intl l='Disabled coupons'} -
{block name="coupon-label-code"}{intl l='Code'}{/block}{block name="coupon-label-title"}{intl l='Title'}{/block}{block name="coupon-label-expiration-date"}{intl l='Expiration date'}{/block}{block name="coupon-label-usage-left"}{intl l='Usage left'}{/block}{block name="coupon-label-action"}{/block}{admin_sortable_header + current_order=$coupon_order + order='title' + reverse_order='title-reverse' + path={url path='/admin/coupon'} + request_parameter_name='coupon_order' + label="{intl l='Title'}" + } + {admin_sortable_header + current_order=$coupon_order + order='enabled' + reverse_order='enabled-reverse' + path={url path='/admin/coupon'} + request_parameter_name='coupon_order' + label="{intl l='Status'}" + } + {admin_sortable_header + current_order=$coupon_order + order='expiration-date' + reverse_order='expiration-date-reverse' + path={url path='/admin/coupon'} + request_parameter_name='coupon_order' + label="{intl l='Expiration date'}" + } + {admin_sortable_header + current_order=$coupon_order + order='days-left' + reverse_order='days-left-reverse' + path={url path='/admin/coupon'} + request_parameter_name='coupon_order' + label="{intl l='Days before expiration'}" + } + {admin_sortable_header + current_order=$coupon_order + order='usages-left' + reverse_order='usages-left-reverse' + path={url path='/admin/coupon'} + request_parameter_name='coupon_order' + label="{intl l='Usages left'}" + } +  
{block name="coupon-code"}{$CODE}{/block}{block name="coupon-title"}{$TITLE}{/block}{block name="coupon-expiration-date"}{$EXPIRATION_DATE}{/block} - {block name="coupon-usage-left"} - {if $USAGE_LEFT == -1} - - {intl l="Unlimited"} - - {elseif $USAGE_LEFT} - - {$USAGE_LEFT} - - {else} - - 0 - - {/if} - {/block} + {loop type="auth" name="can_change" role="ADMIN" resource="admin.coupon" access="UPDATE"} + {$CODE} + {/loop} + {elseloop rel="can_change"} + {$CODE} + {/elseloop} - {block name="coupon-action"} - - {intl l='Edit'} - - {/block} + + {$TITLE} + {if $IS_ENABLED} + {intl l="Enabled"} + {else} + {intl l="Disabled"} + {/if} + {format_date date=$EXPIRATION_DATE output="date"} + {if $DAY_LEFT_BEFORE_EXPIRATION <= 0} + {intl l='Expired'} + {else} + {$DAY_LEFT_BEFORE_EXPIRATION} + {/if} + + {if $USAGE_LEFT == -1} + {intl l="Unlimited"} + {elseif $USAGE_LEFT} + {$USAGE_LEFT} + {else} + 0 + {/if} + + {loop type="auth" name="can_change" role="ADMIN" resource="admin.coupon" access="UPDATE"} + + {/loop}
+ + {module_include location='coupon_bottom'} +