Working on bulk lists

This commit is contained in:
Hillel Coren 2016-11-27 14:20:58 +02:00
parent ae28c3c5c3
commit e9a5d60d7f
5 changed files with 10 additions and 7 deletions

View File

@ -19,7 +19,6 @@ class CreditRepository extends BaseRepository
->join('clients', 'clients.id', '=', 'credits.client_id') ->join('clients', 'clients.id', '=', 'credits.client_id')
->join('contacts', 'contacts.client_id', '=', 'clients.id') ->join('contacts', 'contacts.client_id', '=', 'clients.id')
->where('clients.account_id', '=', \Auth::user()->account_id) ->where('clients.account_id', '=', \Auth::user()->account_id)
->where('clients.deleted_at', '=', null)
->where('contacts.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null)
->where('contacts.is_primary', '=', true) ->where('contacts.is_primary', '=', true)
->select( ->select(
@ -43,6 +42,8 @@ class CreditRepository extends BaseRepository
if ($clientPublicId) { if ($clientPublicId) {
$query->where('clients.public_id', '=', $clientPublicId); $query->where('clients.public_id', '=', $clientPublicId);
} else {
$query->whereNull('clients.deleted_at');
} }
$this->applyFilters($query, ENTITY_CREDIT); $this->applyFilters($query, ENTITY_CREDIT);

View File

@ -46,7 +46,6 @@ class InvoiceRepository extends BaseRepository
->join('invoice_statuses', 'invoice_statuses.id', '=', 'invoices.invoice_status_id') ->join('invoice_statuses', 'invoice_statuses.id', '=', 'invoices.invoice_status_id')
->join('contacts', 'contacts.client_id', '=', 'clients.id') ->join('contacts', 'contacts.client_id', '=', 'clients.id')
->where('invoices.account_id', '=', $accountId) ->where('invoices.account_id', '=', $accountId)
->where('clients.deleted_at', '=', null)
->where('contacts.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null)
->where('invoices.is_recurring', '=', false) ->where('invoices.is_recurring', '=', false)
->where('contacts.is_primary', '=', true) ->where('contacts.is_primary', '=', true)
@ -101,6 +100,8 @@ class InvoiceRepository extends BaseRepository
if ($clientPublicId) { if ($clientPublicId) {
$query->where('clients.public_id', '=', $clientPublicId); $query->where('clients.public_id', '=', $clientPublicId);
} else {
$query->whereNull('clients.deleted_at');
} }
if ($filter) { if ($filter) {
@ -128,7 +129,6 @@ class InvoiceRepository extends BaseRepository
->where('contacts.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null)
->where('invoices.is_recurring', '=', true) ->where('invoices.is_recurring', '=', true)
->where('contacts.is_primary', '=', true) ->where('contacts.is_primary', '=', true)
->where('clients.deleted_at', '=', null)
->select( ->select(
DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'), DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'),
DB::raw('COALESCE(clients.country_id, accounts.country_id) country_id'), DB::raw('COALESCE(clients.country_id, accounts.country_id) country_id'),
@ -149,6 +149,8 @@ class InvoiceRepository extends BaseRepository
if ($clientPublicId) { if ($clientPublicId) {
$query->where('clients.public_id', '=', $clientPublicId); $query->where('clients.public_id', '=', $clientPublicId);
} else {
$query->whereNull('clients.deleted_at');
} }
$this->applyFilters($query, ENTITY_RECURRING_INVOICE, ENTITY_INVOICE); $this->applyFilters($query, ENTITY_RECURRING_INVOICE, ENTITY_INVOICE);

View File

@ -25,7 +25,6 @@ class PaymentRepository extends BaseRepository
->leftJoin('account_gateways', 'account_gateways.id', '=', 'payments.account_gateway_id') ->leftJoin('account_gateways', 'account_gateways.id', '=', 'payments.account_gateway_id')
->leftJoin('gateways', 'gateways.id', '=', 'account_gateways.gateway_id') ->leftJoin('gateways', 'gateways.id', '=', 'account_gateways.gateway_id')
->where('payments.account_id', '=', \Auth::user()->account_id) ->where('payments.account_id', '=', \Auth::user()->account_id)
->where('clients.deleted_at', '=', null)
->where('contacts.is_primary', '=', true) ->where('contacts.is_primary', '=', true)
->where('contacts.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null)
->where('invoices.is_deleted', '=', false) ->where('invoices.is_deleted', '=', false)
@ -67,6 +66,8 @@ class PaymentRepository extends BaseRepository
if ($clientPublicId) { if ($clientPublicId) {
$query->where('clients.public_id', '=', $clientPublicId); $query->where('clients.public_id', '=', $clientPublicId);
} else {
$query->whereNull('clients.deleted_at');
} }
if ($filter) { if ($filter) {

View File

@ -24,7 +24,6 @@ class TaskRepository extends BaseRepository
->orWhere('contacts.is_primary', '=', null); ->orWhere('contacts.is_primary', '=', null);
}) })
->where('contacts.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null)
->where('clients.deleted_at', '=', null)
->select( ->select(
'tasks.public_id', 'tasks.public_id',
\DB::raw("COALESCE(NULLIF(clients.name,''), NULLIF(CONCAT(contacts.first_name, ' ', contacts.last_name),''), NULLIF(contacts.email,'')) client_name"), \DB::raw("COALESCE(NULLIF(clients.name,''), NULLIF(CONCAT(contacts.first_name, ' ', contacts.last_name),''), NULLIF(contacts.email,'')) client_name"),
@ -52,6 +51,8 @@ class TaskRepository extends BaseRepository
if ($clientPublicId) { if ($clientPublicId) {
$query->where('clients.public_id', '=', $clientPublicId); $query->where('clients.public_id', '=', $clientPublicId);
} else {
$query->whereNull('clients.deleted_at');
} }
$this->applyFilters($query, ENTITY_TASK); $this->applyFilters($query, ENTITY_TASK);

View File

@ -219,8 +219,6 @@
$('#statuses_{{ $entityType }}').select2({ $('#statuses_{{ $entityType }}').select2({
placeholder: "{{ trans('texts.status') }}", placeholder: "{{ trans('texts.status') }}",
templateSelection: function(data, container) { templateSelection: function(data, container) {
console.log(data);
console.log(container);
if (data.id == 'archived') { if (data.id == 'archived') {
$(container).css('color', '#fff'); $(container).css('color', '#fff');
$(container).css('background-color', '#f0ad4e'); $(container).css('background-color', '#f0ad4e');