start shipping zone management

This commit is contained in:
Manuel Raynaud
2013-10-14 14:08:50 +02:00
parent 75bc86d43e
commit 9c4c63a564
4 changed files with 38 additions and 88 deletions

View File

@@ -42,4 +42,6 @@ class ShippingZoneController extends BaseAdminController
"shipping_zones_id" => $shipping_zones_id "shipping_zones_id" => $shipping_zones_id
)); ));
} }
} }

View File

@@ -75,7 +75,9 @@ class Area extends BaseLoop
protected function getArgDefinitions() protected function getArgDefinitions()
{ {
return new ArgumentCollection( return new ArgumentCollection(
Argument::createIntListTypeArgument('id') Argument::createIntListTypeArgument('id'),
Argument::createIntTypeArgument('with_zone'),
Argument::createIntTypeArgument('without_zone')
); );
} }
@@ -101,6 +103,24 @@ class Area extends BaseLoop
$search->filterById($id, Criteria::IN); $search->filterById($id, Criteria::IN);
} }
$withZone = $this->getWith_zone();
if ($withZone) {
$search->joinAreaDeliveryModule('with_zone')
->where('`with_zone`.delivery_module_id '.Criteria::EQUAL.' ?', $withZone, \PDO::PARAM_INT);
}
$withoutZone = $this->getWithout_zone();
if($withoutZone)
{
$search->joinAreaDeliveryModule('without_zone', Criteria::LEFT_JOIN)
->addJoinCondition('without_zone', 'delivery_module_id '.Criteria::EQUAL.' ?', $withoutZone, null, \PDO::PARAM_INT)
->where('`without_zone`.delivery_module_id '.Criteria::ISNULL);
}
//echo $search->toString(); exit;
$areas = $this->search($search, $pagination); $areas = $this->search($search, $pagination);
$loopResult = new LoopResult($areas); $loopResult = new LoopResult($areas);

View File

@@ -32,11 +32,9 @@
<div class="input-group"> <div class="input-group">
<select name="" id="" data-toggle="selectpicker"> <select name="" id="" data-toggle="selectpicker">
<option value="">1</option> {loop name="area.module.not_associated" type="area" without_zone=$shipping_zones_id}
<option value="">2</option> <option value="{$ID}">{$NAME}</option>
<option value="">3</option> {/loop}
<option value="">4</option>
<option value="">5</option>
</select> </select>
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-plus-sign"></span> {intl l="Add"}</button> <button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-plus-sign"></span> {intl l="Add"}</button>
@@ -57,30 +55,16 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{loop type="area" name="area.module.associated" with_zone=$shipping_zones_id}
<tr> <tr>
<td>France</td> <td>{$NAME}</td>
<td>
<a class="btn btn-default btn-xs" title="{intl l='Delete this zone'}" href="#delete_zone_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
</td>
</tr>
<tr>
<td>Zone 1</td>
<td>
<a class="btn btn-default btn-xs" title="{intl l='Delete this zone'}" href="#delete_zone_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
</td>
</tr>
<tr>
<td>Zone 2</td>
<td> <td>
<a class="btn btn-default btn-xs" title="{intl l='Delete this zone'}" href="#delete_zone_dialog" data-id="{$ID}" data-toggle="modal"> <a class="btn btn-default btn-xs" title="{intl l='Delete this zone'}" href="#delete_zone_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span> <span class="glyphicon glyphicon-trash"></span>
</a> </a>
</td> </td>
</tr> </tr>
{/loop}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@@ -36,57 +36,21 @@
</thead> </thead>
<tbody> <tbody>
{loop type="delivery" name="delivery.list" backend_context="1"}
<tr> <tr>
<td>So Colissimo</td> <td><a href="{url path="/admin/configuration/shipping_zones/update/$ID"}">{$TITLE}</a></td>
{module_include location='shipping_zones_table_row'} {module_include location='shipping_zones_table_row'}
<td> <td>
{if ! $SECURED} <div class="btn-group">
<div class="btn-group"> {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-zones.change"}
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-zones.change"} <a class="btn btn-default btn-xs shipping-zones-change" title="{intl l='Change this shipping zone'}" href="{url path="/admin/configuration/shipping_zones/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
<a class="btn btn-default btn-xs shipping-zones-change" title="{intl l='Change this shipping zone'}" href="{url path="/admin/configuration/shipping_zones/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a> {/loop}
{/loop} </div>
</div>
{else}
<i title="{intl l='This shipping zone could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
{/if}
</td> </td>
</tr> </tr>
<tr> {/loop}
<td>Chronopost</td>
{module_include location='shipping_zones_table_row'}
<td>
{if ! $SECURED}
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-zones.change"}
<a class="btn btn-default btn-xs shipping-zones-change" title="{intl l='Change this shipping zone'}" href="{url path="/admin/configuration/shipping_zones/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
{/loop}
</div>
{else}
<i title="{intl l='This shipping zone could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
{/if}
</td>
</tr>
<tr>
<td>Kiala</td>
{module_include location='shipping_zones_table_row'}
<td>
{if ! $SECURED}
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.shipping-zones.change"}
<a class="btn btn-default btn-xs shipping-zones-change" title="{intl l='Change this shipping zone'}" href="{url path="/admin/configuration/shipping_zones/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
{/loop}
</div>
{else}
<i title="{intl l='This shipping zone could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
{/if}
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -98,24 +62,4 @@
</div> </div>
</div> </div>
{* Delete confirmation dialog *}
{capture "delete_dialog"}
<input type="hidden" name="shipping_zones_id" id="shipping_zones_delete_id" value="" />
{module_include location='shipping_zones_delete_form'}
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_dialog"
dialog_title = {intl l="Delete shipping zone"}
dialog_message = {intl l="Do you really want to delete this shipping zone ?"}
form_action = {url path='/admin/configuration/shipping_zones/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
}
{/block} {/block}