Moved out rejected orders
This commit is contained in:
parent
aeacb726dd
commit
72fcdab84e
@ -21,6 +21,11 @@ class ResellerServicesController extends Controller
|
|||||||
return ['data'=>Auth::user()->all_clients()->values()];
|
return ['data'=>Auth::user()->all_clients()->values()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function service_inactive()
|
||||||
|
{
|
||||||
|
return ['data'=>Auth::user()->all_client_service_inactive()->values()];
|
||||||
|
}
|
||||||
|
|
||||||
public function service_movements()
|
public function service_movements()
|
||||||
{
|
{
|
||||||
return ['data'=>Auth::user()->all_client_service_movements()->values()];
|
return ['data'=>Auth::user()->all_client_service_movements()->values()];
|
||||||
|
@ -49,6 +49,7 @@ class Service extends Model
|
|||||||
|
|
||||||
private $inactive_status = [
|
private $inactive_status = [
|
||||||
'CANCELLED',
|
'CANCELLED',
|
||||||
|
'ORDER-REJECTED',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function account()
|
public function account()
|
||||||
@ -96,6 +97,19 @@ class Service extends Model
|
|||||||
return $this->belongsTo(Product::class);
|
return $this->belongsTo(Product::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find inactive services.
|
||||||
|
*
|
||||||
|
* @param $query
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function scopeInActive($query)
|
||||||
|
{
|
||||||
|
return $query->where(function () use ($query) {
|
||||||
|
return $query->where('active',FALSE)->orWhereIn('order_status',$this->inactive_status);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only query active categories
|
* Only query active categories
|
||||||
*/
|
*/
|
||||||
@ -118,7 +132,8 @@ class Service extends Model
|
|||||||
|
|
||||||
public function getCategoryAttribute()
|
public function getCategoryAttribute()
|
||||||
{
|
{
|
||||||
return $this->product->category;
|
// @todo: All services should be linked to a product. This might require data cleaning for old services not linked to a product.
|
||||||
|
return is_object($this->product) ? $this->product->category : 'Unknown Product';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNameAttribute()
|
public function getNameAttribute()
|
||||||
@ -136,7 +151,8 @@ class Service extends Model
|
|||||||
|
|
||||||
public function getProductNameAttribute()
|
public function getProductNameAttribute()
|
||||||
{
|
{
|
||||||
return $this->product->name($this->account->language);
|
// @todo: All services should be linked to a product. This might require data cleaning for old services not linked to a product.
|
||||||
|
return is_object($this->product) ? $this->product->name($this->account->language) : 'Unknown Product';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getServiceExpireAttribute()
|
public function getServiceExpireAttribute()
|
||||||
@ -197,6 +213,10 @@ class Service extends Model
|
|||||||
*/
|
*/
|
||||||
private function ServicePlugin()
|
private function ServicePlugin()
|
||||||
{
|
{
|
||||||
|
// @todo: All services should be linked to a product. This might require data cleaning for old services not linked to a product.
|
||||||
|
if (! is_object($this->product))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
switch ($this->product->prod_plugin_file)
|
switch ($this->product->prod_plugin_file)
|
||||||
{
|
{
|
||||||
case 'ADSL': return $this->service_adsl;
|
case 'ADSL': return $this->service_adsl;
|
||||||
|
10
app/User.php
10
app/User.php
@ -246,6 +246,16 @@ class User extends Authenticatable
|
|||||||
return $result->flatten();
|
return $result->flatten();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function all_client_service_inactive()
|
||||||
|
{
|
||||||
|
$s = Service::InActive();
|
||||||
|
$aa = $this->all_accounts()->pluck('id')->unique()->toArray();
|
||||||
|
|
||||||
|
return $s->get()->filter(function($item) use ($aa) {
|
||||||
|
return in_array($item->account_id,$aa);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function all_client_service_movements()
|
public function all_client_service_movements()
|
||||||
{
|
{
|
||||||
$s = Service::active()->where('order_status','!=','ACTIVE');
|
$s = Service::active()->where('order_status','!=','ACTIVE');
|
||||||
|
@ -52,6 +52,9 @@
|
|||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
@include('r.agents')
|
@include('r.agents')
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
@include('r.service_inactive')
|
||||||
|
</div>
|
||||||
{{--
|
{{--
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
@include('r.clients')
|
@include('r.clients')
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
<div class="box box-warning">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title">Services Inactive</h3>
|
||||||
|
<div class="box-tools pull-right">
|
||||||
|
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
|
||||||
|
<i class="fa fa-minus"></i></button>
|
||||||
|
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
|
||||||
|
<i class="fa fa-times"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box-body">
|
||||||
|
@if ($user->all_client_service_inactive()->count())
|
||||||
|
<table class="table table-bordered table-striped table-hover" id="service_inactive" style="width: 100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Account</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Product</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Count {{ $user->all_client_service_inactive()->count() }}</th>
|
||||||
|
<th colspan="4"> </th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
@else
|
||||||
|
<p>No Inactive Services</p>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
|
@css('https://cdn.datatables.net/responsive/2.2.1/css/responsive.dataTables.min.css')
|
||||||
|
@css('https://cdn.datatables.net/rowgroup/1.0.2/css/rowGroup.dataTables.min.css')
|
||||||
|
@js('https://cdn.datatables.net/responsive/2.2.1/js/dataTables.responsive.min.js')
|
||||||
|
@js('https://cdn.datatables.net/rowgroup/1.0.2/js/dataTables.rowGroup.min.js')
|
||||||
|
|
||||||
|
<style>
|
||||||
|
table.dataTable td {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#service_inactive').DataTable( {
|
||||||
|
responsive: true,
|
||||||
|
ajax: {
|
||||||
|
url: "/api/r/service_inactive"
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{ data:
|
||||||
|
@if($user->isWholesaler())
|
||||||
|
"admin_service_id_url"
|
||||||
|
@else
|
||||||
|
"service_id_url"
|
||||||
|
@endif
|
||||||
|
},
|
||||||
|
{ data: "account_name" },
|
||||||
|
{ data: "name" },
|
||||||
|
{ data: "status" },
|
||||||
|
{ data: "product_name" }
|
||||||
|
],
|
||||||
|
language: {
|
||||||
|
emptyTable: "No InActive Services"
|
||||||
|
},
|
||||||
|
order: [3, 'asc'],
|
||||||
|
rowGroup: {
|
||||||
|
dataSrc: 'account_name',
|
||||||
|
startRender: null,
|
||||||
|
endRender: function ( rows, group ) {
|
||||||
|
return rows.count()+' x ' + group;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
orderFixed: [1, 'asc']
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#service_movements tbody').on('click','tr', function () {
|
||||||
|
$(this).toggleClass('selected');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@append
|
@ -66,7 +66,7 @@
|
|||||||
{ data: "product_name" }
|
{ data: "product_name" }
|
||||||
],
|
],
|
||||||
language: {
|
language: {
|
||||||
emptyTable: "No Active Clients"
|
emptyTable: "No Service Movements"
|
||||||
},
|
},
|
||||||
order: [3, 'asc'],
|
order: [3, 'asc'],
|
||||||
rowGroup: {
|
rowGroup: {
|
||||||
|
@ -2,5 +2,14 @@
|
|||||||
<li class="header"><b>MENU</b></li>
|
<li class="header"><b>MENU</b></li>
|
||||||
<!-- Optionally, you can add icons to the links -->
|
<!-- Optionally, you can add icons to the links -->
|
||||||
<li @if(Route::current()->getName() == 'home')class="active"@endif><a href="{{ url('home') }}"><i class='fa fa-link'></i> <span>{{ trans('adminlte_lang::message.home') }}</span></a></li>
|
<li @if(Route::current()->getName() == 'home')class="active"@endif><a href="{{ url('home') }}"><i class='fa fa-link'></i> <span>{{ trans('adminlte_lang::message.home') }}</span></a></li>
|
||||||
<li @if(Route::current()->getName() == 'order')class="active"@endif><a href="{{ url('order') }}"><i class='fa fa-shopping-cart'></i> <span>Order</span></a></li>
|
<li class="@if(Route::current()->getName() == 'order') active @endif treeview">
|
||||||
|
<a href="#">
|
||||||
|
<i class='fa fa-shopping-cart'></i> <span>Order</span>
|
||||||
|
<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>
|
||||||
|
</a>
|
||||||
|
<ul class="treeview-menu">
|
||||||
|
<li><a href="{{ url('order') }}"><i class="fa fa-circle-o"></i> New Order</a></li>
|
||||||
|
{{-- <li><a href="{{ url('u/order/rejected') }}"><i class="fa fa-circle-o"></i> Rejected Orders</a></li> --}}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
@ -24,6 +24,7 @@ Route::group(['middleware'=>['auth:api','role:reseller']], function() {
|
|||||||
Route::get('/r/accounts','ResellerServicesController@accounts');
|
Route::get('/r/accounts','ResellerServicesController@accounts');
|
||||||
Route::get('/r/clients','ResellerServicesController@clients');
|
Route::get('/r/clients','ResellerServicesController@clients');
|
||||||
Route::get('/r/service_movements','ResellerServicesController@service_movements');
|
Route::get('/r/service_movements','ResellerServicesController@service_movements');
|
||||||
|
Route::get('/r/service_inactive','ResellerServicesController@service_inactive');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['middleware'=>'auth:api'], function() {
|
Route::group(['middleware'=>'auth:api'], function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user