partial #2350 - Create an option to assign drivers per community
This commit is contained in:
parent
da1a87a67c
commit
aa917afeb2
@ -826,14 +826,17 @@ class Crunchbutton_Order extends Cana_Table {
|
||||
}
|
||||
}
|
||||
|
||||
// get the restaurant community and its drivers
|
||||
$community = $order->restaurant()->community;
|
||||
if( $community ){
|
||||
$group = Crunchbutton_Group::getDeliveryGroupByCommunity( Crunchbutton_Group::driverGroupOfCommunity( $community ) );
|
||||
if( $group->id_group ){
|
||||
$drivers = Crunchbutton_Admin::q( "SELECT a.* FROM admin a INNER JOIN admin_group ag ON ag.id_admin = a.id_admin AND ag.id_group = {$group->id_group}" );
|
||||
foreach( $drivers as $driver ){
|
||||
$driversToNotify[ $driver->id_admin ] = $driver;
|
||||
// check if the restaurant is using our delivery system
|
||||
if( intval( $order->restaurant()->delivery_service ) == 1 ){
|
||||
// get the restaurant community and its drivers
|
||||
$community = $order->restaurant()->community;
|
||||
if( $community ){
|
||||
$group = Crunchbutton_Group::getDeliveryGroupByCommunity( Crunchbutton_Group::driverGroupOfCommunity( $community ) );
|
||||
if( $group->id_group ){
|
||||
$drivers = Crunchbutton_Admin::q( "SELECT a.* FROM admin a INNER JOIN admin_group ag ON ag.id_admin = a.id_admin AND ag.id_group = {$group->id_group}" );
|
||||
foreach( $drivers as $driver ){
|
||||
$driversToNotify[ $driver->id_admin ] = $driver;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,13 +15,23 @@ $groups = $this->groups;
|
||||
<tr>
|
||||
<td><?php echo $group->name;?> </td>
|
||||
<td><?php echo $group->description;?> </td>
|
||||
<td><?php echo $group->usersTotal();?> </td>
|
||||
<td><?php echo $group->usersTotal();?>
|
||||
|
||||
</td>
|
||||
<?php
|
||||
// verify if it is an system group
|
||||
$pos = strrpos( $group->name, Crunchbutton_Group::DRIVER_GROUPS_PREFIX );
|
||||
?>
|
||||
<td style="width:280px;">
|
||||
<a href="/permissions/groups/permissions/<?php echo $group->id_group; ?>" class="btn btn-blue"><i class="icon-unlock"></i> Permissions</a>
|
||||
<?php if( $pos === false ) { ?>
|
||||
<a href="/permissions/groups/permissions/<?php echo $group->id_group; ?>" class="btn btn-blue"><i class="icon-unlock"></i> Permissions</a>
|
||||
|
||||
<a href="/permissions/groups/<?php echo $group->id_group; ?>" class="btn btn-green"><i class="icon-edit"></i> Edit</a>
|
||||
<?php } else { ?>
|
||||
<i style="font-size:11px;">This group could not be modified</i>
|
||||
<?php } ?>
|
||||
|
||||
<a href="/permissions/groups/<?php echo $group->id_group; ?>" class="btn btn-green"><i class="icon-edit"></i> Edit</a>
|
||||
|
||||
<button data-id="<?php echo $group->id_group; ?>" class="btn group-remove btn-red"><i class="icon-trash"></i> Remove</button>
|
||||
<button data-id="<?php echo $group->id_group; ?>" class="btn group-remove btn-red"><i class="icon-trash"></i> Remove</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user