mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Proposals
This commit is contained in:
parent
08cd5a2c07
commit
09c6debbc9
@ -121,8 +121,8 @@ class ProposalController extends BaseController
|
|||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = Input::get('bulk_action') ?: Input::get('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
|
||||||
|
|
||||||
$count = $this->proposalService->bulk($ids, $action);
|
$count = $this->proposalService->bulk($ids, $action);
|
||||||
|
|
||||||
|
@ -68,6 +68,14 @@ class Proposal extends EntityModel
|
|||||||
return $this->belongsTo('App\Models\Invoice')->withTrashed();
|
return $this->belongsTo('App\Models\Invoice')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function invitations()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\ProposalInvitation')->orderBy('proposal_invitations.contact_id');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,16 @@ class ProposalDatatable extends EntityDatatable
|
|||||||
return link_to("quotes/{$model->invoice_public_id}", $model->invoice_number)->toHtml();
|
return link_to("quotes/{$model->invoice_public_id}", $model->invoice_number)->toHtml();
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'client',
|
||||||
|
function ($model) {
|
||||||
|
if (! Auth::user()->can('viewByOwner', [ENTITY_CLIENT, $model->client_user_id])) {
|
||||||
|
return $model->client;
|
||||||
|
}
|
||||||
|
|
||||||
|
return link_to("clients/{$model->client_public_id}", $model->client)->toHtml();
|
||||||
|
},
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'template',
|
'template',
|
||||||
function ($model) {
|
function ($model) {
|
||||||
|
@ -3,11 +3,31 @@
|
|||||||
namespace App\Ninja\Presenters;
|
namespace App\Ninja\Presenters;
|
||||||
|
|
||||||
use Utils;
|
use Utils;
|
||||||
|
use DropdownButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ProposalPresenter.
|
* Class ProposalPresenter.
|
||||||
*/
|
*/
|
||||||
class ProposalPresenter extends EntityPresenter
|
class ProposalPresenter extends EntityPresenter
|
||||||
{
|
{
|
||||||
|
public function moreActions()
|
||||||
|
{
|
||||||
|
$proposal = $this->entity;
|
||||||
|
$invitation = $proposal->invitations->first();
|
||||||
|
$actions = [];
|
||||||
|
|
||||||
|
$actions[] = ['url' => $invitation->getLink('proposal'), 'label' => trans("texts.view_as_recipient")];
|
||||||
|
|
||||||
|
$actions[] = DropdownButton::DIVIDER;
|
||||||
|
|
||||||
|
if (! $proposal->trashed()) {
|
||||||
|
$actions[] = ['url' => 'javascript:onArchiveClick()', 'label' => trans("texts.archive_proposal")];
|
||||||
|
}
|
||||||
|
if (! $proposal->is_deleted) {
|
||||||
|
$actions[] = ['url' => 'javascript:onDeleteClick()', 'label' => trans("texts.delete_proposal")];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $actions;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class ProposalRepository extends BaseRepository
|
|||||||
'proposals.is_deleted',
|
'proposals.is_deleted',
|
||||||
'proposals.private_notes',
|
'proposals.private_notes',
|
||||||
'proposals.html as content',
|
'proposals.html as content',
|
||||||
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"),
|
||||||
'clients.user_id as client_user_id',
|
'clients.user_id as client_user_id',
|
||||||
'clients.public_id as client_public_id',
|
'clients.public_id as client_public_id',
|
||||||
'invoices.invoice_number as quote',
|
'invoices.invoice_number as quote',
|
||||||
|
@ -60,6 +60,12 @@
|
|||||||
{!! Button::success(trans("texts.save"))
|
{!! Button::success(trans("texts.save"))
|
||||||
->submit()
|
->submit()
|
||||||
->appendIcon(Icon::create('floppy-disk')) !!}
|
->appendIcon(Icon::create('floppy-disk')) !!}
|
||||||
|
|
||||||
|
@if ($proposal)
|
||||||
|
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||||
|
->withContents($proposal->present()->moreActions()) !!}
|
||||||
|
@endif
|
||||||
|
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
{!! Former::close() !!}
|
{!! Former::close() !!}
|
||||||
@ -147,6 +153,18 @@
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if ($proposal)
|
||||||
|
function onArchiveClick() {
|
||||||
|
submitForm_proposal('archive', {{ $proposal->id }});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDeleteClick() {
|
||||||
|
sweetConfirm(function() {
|
||||||
|
submitForm_proposal('delete', {{ $proposal->id }});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@endif
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var invoiceId = {{ ! empty($invoicePublicId) ? $invoicePublicId : 0 }};
|
var invoiceId = {{ ! empty($invoicePublicId) ? $invoicePublicId : 0 }};
|
||||||
var $invoiceSelect = $('select#invoice_id');
|
var $invoiceSelect = $('select#invoice_id');
|
||||||
@ -183,6 +201,7 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@include('partials.bulk_form', ['entityType' => ENTITY_PROPOSAL])
|
||||||
@include('proposals.grapesjs', ['entity' => $proposal])
|
@include('proposals.grapesjs', ['entity' => $proposal])
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user