Working on bulk list changes

This commit is contained in:
Hillel Coren 2016-11-27 11:46:32 +02:00
parent 12fd825de5
commit ae28c3c5c3
10 changed files with 39 additions and 16 deletions

View File

@ -115,13 +115,13 @@ class ClientController extends BaseController
'client' => $client,
'credit' => $client->getTotalCredit(),
'title' => trans('texts.view_client'),
'hasRecurringInvoices' => Invoice::scope()->where('is_recurring', '=', true)->whereClientId($client->id)->count() > 0,
'hasQuotes' => Invoice::scope()->invoiceType(INVOICE_TYPE_QUOTE)->whereClientId($client->id)->count() > 0,
'hasTasks' => Task::scope()->whereClientId($client->id)->count() > 0,
'hasRecurringInvoices' => Invoice::scope()->recurring()->withArchived()->whereClientId($client->id)->count() > 0,
'hasQuotes' => Invoice::scope()->quotes()->withArchived()->whereClientId($client->id)->count() > 0,
'hasTasks' => Task::scope()->withArchived()->whereClientId($client->id)->count() > 0,
'gatewayLink' => $token ? $token->gatewayLink() : false,
'gatewayName' => $token ? $token->gatewayName() : false,
];
return View::make('clients.show', $data);
}

View File

@ -101,6 +101,6 @@ class CreditController extends BaseController
Session::flash('message', $message);
}
return Redirect::to('credits');
return $this->returnBulk(ENTITY_CREDIT, $action, $ids);
}
}

View File

@ -192,6 +192,6 @@ class PaymentController extends BaseController
Session::flash('message', $message);
}
return redirect()->to('payments');
return $this->returnBulk(ENTITY_PAYMENT, $action, $ids);
}
}

View File

@ -353,6 +353,16 @@ class Invoice extends EntityModel implements BalanceAffecting
->where('is_recurring', '=', false);
}
/**
* @param $query
* @return mixed
*/
public function scopeRecurring($query)
{
return $query->where('invoice_type_id', '=', INVOICE_TYPE_STANDARD)
->where('is_recurring', '=', true);
}
/**
* @param $query
* @return mixed

View File

@ -19,9 +19,9 @@ class ClientDatatable extends EntityDatatable
}
],
[
'first_name',
'contact',
function ($model) {
return link_to("clients/{$model->public_id}", $model->first_name.' '.$model->last_name)->toHtml();
return link_to("clients/{$model->public_id}", $model->contact ?: '')->toHtml();
}
],
[

View File

@ -35,6 +35,7 @@ class ClientRepository extends BaseRepository
->select(
DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'),
DB::raw('COALESCE(clients.country_id, accounts.country_id) country_id'),
DB::raw("CONCAT(contacts.first_name, ' ', contacts.last_name) contact"),
'clients.public_id',
'clients.name',
'contacts.first_name',

View File

@ -107,10 +107,9 @@ class InvoiceRepository extends BaseRepository
$query->where(function ($query) use ($filter) {
$query->where('clients.name', 'like', '%'.$filter.'%')
->orWhere('invoices.invoice_number', 'like', '%'.$filter.'%')
->orWhere('invoice_statuses.name', 'like', '%'.$filter.'%')
->orWhere('contacts.first_name', 'like', '%'.$filter.'%')
->orWhere('contacts.last_name', 'like', '%'.$filter.'%')
->orWhere('contacts.email', 'like', '%'.$filter.'%');
->orWhere('contacts.first_name', 'like', '%'.$filter.'%')
->orWhere('contacts.last_name', 'like', '%'.$filter.'%')
->orWhere('contacts.email', 'like', '%'.$filter.'%');
});
}

View File

@ -2226,7 +2226,7 @@ $LANG = array(
'vendor_name' => 'Vendor',
'entity_state' => 'State',
'payment_status_name' => 'Status',
'client_created_at' => 'Created At',
'client_created_at' => 'Date Created',
);
return $LANG;

View File

@ -193,7 +193,7 @@
<ul class="nav nav-tabs nav-justified">
{!! Form::tab_link('#activity', trans('texts.activity'), true) !!}
@if ($hasTasks)
@if ($hasTasks && Utils::isPro())
{!! Form::tab_link('#tasks', trans('texts.tasks')) !!}
@endif
@if ($hasQuotes && Utils::isPro())

View File

@ -141,8 +141,7 @@
}
function handleRefundClicked(){
$('#public_id').val(paymentId);
submitForm_{{ $entityType }}('refund');
submitForm_{{ $entityType }}('refund', paymentId);
}
@endif
@ -219,6 +218,20 @@
// Setup state/status filter
$('#statuses_{{ $entityType }}').select2({
placeholder: "{{ trans('texts.status') }}",
templateSelection: function(data, container) {
console.log(data);
console.log(container);
if (data.id == 'archived') {
$(container).css('color', '#fff');
$(container).css('background-color', '#f0ad4e');
$(container).css('border-color', '#eea236');
} else if (data.id == 'deleted') {
$(container).css('color', '#fff');
$(container).css('background-color', '#d9534f');
$(container).css('border-color', '#d43f3a');
}
return data.text;
}
}).val('{{ session('entity_state_filter:' . $entityType, STATUS_ACTIVE) . ',' . session('entity_status_filter:' . $entityType) }}'.split(','))
.trigger('change')
.on('change', function() {