Working
- implementation Coupon Read page
This commit is contained in:
@@ -59,8 +59,7 @@
|
|||||||
<default key="action">edit</default>
|
<default key="action">edit</default>
|
||||||
</route>
|
</route>
|
||||||
<route id="admin.coupon.read" path="/admin/coupon/read/{id}">
|
<route id="admin.coupon.read" path="/admin/coupon/read/{id}">
|
||||||
<default key="_controller">Thelia\Controller\Admin\CouponController::processAction</default>
|
<default key="_controller">Thelia\Controller\Admin\CouponController::readAction</default>
|
||||||
<default key="action">read</default>
|
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Thelia\Core\Event\Coupon\CouponCreateEvent;
|
use Thelia\Core\Event\Coupon\CouponCreateEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||||
@@ -143,15 +144,23 @@ class CouponController extends BaseAdminController
|
|||||||
/**
|
/**
|
||||||
* Manage Coupons read display
|
* Manage Coupons read display
|
||||||
*
|
*
|
||||||
* @param array $args GET arguments
|
* @param int $id Coupon Id
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
protected function readCoupon($args)
|
public function readAction($id)
|
||||||
{
|
{
|
||||||
$this->checkAuth("ADMIN", "admin.coupon.view");
|
$this->checkAuth("ADMIN", "admin.coupon.view");
|
||||||
|
|
||||||
return $this->render('coupon/read', $args);
|
// Database request repeated in the loop but cached
|
||||||
|
$search = CouponQuery::create();
|
||||||
|
$coupon = $search->findOneById($id);
|
||||||
|
|
||||||
|
if ($coupon === null) {
|
||||||
|
return $this->pageNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('coupon/read', array('couponId' => $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class Coupon extends BaseI18nLoop
|
|||||||
$search = CouponQuery::create();
|
$search = CouponQuery::create();
|
||||||
|
|
||||||
/* manage translations */
|
/* manage translations */
|
||||||
$locale = $this->configureI18nProcessing($search, array());
|
$locale = $this->configureI18nProcessing($search, array('TITLE', 'DESCRIPTION', 'SHORT_DESCRIPTION'));
|
||||||
|
|
||||||
$id = $this->getId();
|
$id = $this->getId();
|
||||||
|
|
||||||
@@ -91,9 +91,17 @@ class Coupon extends BaseI18nLoop
|
|||||||
$loopResultRow->set("ID", $coupon->getId())
|
$loopResultRow->set("ID", $coupon->getId())
|
||||||
->set("IS_TRANSLATED", $coupon->getVirtualColumn('IS_TRANSLATED'))
|
->set("IS_TRANSLATED", $coupon->getVirtualColumn('IS_TRANSLATED'))
|
||||||
->set("LOCALE", $locale)
|
->set("LOCALE", $locale)
|
||||||
|
->set("CODE", $coupon->getCode())
|
||||||
->set("TITLE", $coupon->getVirtualColumn('i18n_TITLE'))
|
->set("TITLE", $coupon->getVirtualColumn('i18n_TITLE'))
|
||||||
->set("CODE", $coupon->getVirtualColumn('i18n_CODE'));
|
->set("SHORT_DESCRIPTION", $coupon->getVirtualColumn('i18n_SHORT_DESCRIPTION'))
|
||||||
|
->set("DESCRIPTION", $coupon->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
|
->set("EXPIRATION_DATE", $coupon->getExpirationDate())
|
||||||
|
->set("USAGE_LEFT", $coupon->getMaxUsage())
|
||||||
|
->set("IS_CUMULATIVE", $coupon->getIsCumulative())
|
||||||
|
->set("IS_REMOVING_POSTAGE", $coupon->getIsRemovingPostage())
|
||||||
|
->set("IS_ENABLED", $coupon->getIsEnabled())
|
||||||
|
->set("AMOUNT", $coupon->getAmount())
|
||||||
|
->set("APPLICATION_CONDITIONS", $coupon->getRules());
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,42 +18,78 @@
|
|||||||
<h1>Coupons : <small>Read coupon n°1</small></h1>
|
<h1>Coupons : <small>Read coupon n°1</small></h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<section class="row-fluid">
|
<section class="row-fluid">
|
||||||
<div class="span12 general-block-decorator">
|
<div class="span12 general-block-decorator">
|
||||||
|
{loop type="coupon" name="read_coupon" id=1 backend_context="true"}
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<span class="icon-question-sign"></span> This coupon is disabled, you can enable to the bottom of this form.
|
<span class="icon-question-sign"></span>
|
||||||
|
{if #IS_ENABLED}{else}This coupon is disabled, you can enable to the bottom of this form.{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Code</td>
|
<td>Code</td>
|
||||||
<td>XMAS13</td>
|
<td>#CODE</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Title</td>
|
<td>Title</td>
|
||||||
<td>Coupon for XMAS -30 €</td>
|
<td>#TITLE</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Expiration date</td>
|
<td>Expiration date</td>
|
||||||
<td>25/12/2013</td>
|
<td>EXPIRATION_DATE</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Usage left</td>
|
<td>Usage left</td>
|
||||||
<td>49 times</td>
|
<td>
|
||||||
|
{if #USAGE_LEFT}
|
||||||
|
<span class="label label-success">
|
||||||
|
#USAGE_LEFT
|
||||||
|
</span>
|
||||||
|
{else}
|
||||||
|
<span class="label label-important">
|
||||||
|
0
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">#SHORT_DESCRIPTION</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">#DESCRIPTION</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
{if #IS_CUMULATIVE}
|
||||||
|
<span class="label label-success">
|
||||||
|
{intl l="May be cumulative"}
|
||||||
|
</span>
|
||||||
|
{else}
|
||||||
|
<span class="label label-important">
|
||||||
|
{intl l="Can't be cumulative"}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>May be combined</td>
|
<td colspan="2">
|
||||||
<td><span class="label label-success">Yes</span></td>
|
{if #IS_REMOVING_POSTAGE}
|
||||||
|
<span class="label label-important">
|
||||||
|
{intl l="Will remove postage"}
|
||||||
|
</span>
|
||||||
|
{else}
|
||||||
|
<span class="label label-success">
|
||||||
|
{intl l="Won't remove postage"}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Cancel shipping</td>
|
<td>Amount</td>
|
||||||
<td><span class="label label-important">No</span></td>
|
<td>#AMOUNT</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Effect</td>
|
|
||||||
<td>Remove 30 € to the cart price</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Conditions of application</td>
|
<td>Conditions of application</td>
|
||||||
@@ -73,10 +109,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{/loop}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
</section> <!-- #wrapper -->
|
</section> <!-- #wrapper -->
|
||||||
|
|
||||||
<aside id="enable" class="modal hide fade" role="dialog">
|
<aside id="enable" class="modal hide fade" role="dialog">
|
||||||
@@ -92,14 +130,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</aside> <!-- #enable / Enable confirmation -->
|
</aside> <!-- #enable / Enable confirmation -->
|
||||||
|
|
||||||
boucle coupon
|
|
||||||
{loop type="coupon" name="read_coupon" backend_context="true"}
|
|
||||||
inside
|
|
||||||
#ID
|
|
||||||
#CODE
|
|
||||||
#TITLE
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
{include file='includes/js.inc.html'}
|
{include file='includes/js.inc.html'}
|
||||||
|
|
||||||
{javascripts file='../assets/bootstrap-editable/js/bootstrap-editable.js'}
|
{javascripts file='../assets/bootstrap-editable/js/bootstrap-editable.js'}
|
||||||
|
|||||||
Reference in New Issue
Block a user