1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 14:12:44 +01:00

Proposals

This commit is contained in:
Hillel Coren 2018-02-04 23:50:57 +02:00
parent 2000e66c9d
commit 427c5c3721
9 changed files with 30 additions and 3 deletions

View File

@ -21,6 +21,11 @@ class ProposalComposer
*/ */
public function compose(View $view) public function compose(View $view)
{ {
$view->with('snippets', ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get()); $snippets = ProposalSnippet::scope()
->with('proposal_category')
->orderBy('name')
->get();
$view->with('snippets', $snippets);
} }
} }

View File

@ -44,6 +44,12 @@ class ProposalDatatable extends EntityDatatable
return link_to("proposals/{$model->public_id}/edit", Utils::timestampToDateString(strtotime($model->created_at)))->toHtml(); return link_to("proposals/{$model->public_id}/edit", Utils::timestampToDateString(strtotime($model->created_at)))->toHtml();
}, },
], ],
[
'content',
function ($model) {
return $this->showWithTooltip(strip_tags($model->content));
},
],
[ [
'private_notes', 'private_notes',
function ($model) { function ($model) {

View File

@ -34,6 +34,12 @@ class ProposalSnippetDatatable extends EntityDatatable
return link_to("proposals/categories/{$model->category_public_id}/edit", $model->category ?: ' ')->toHtml(); return link_to("proposals/categories/{$model->category_public_id}/edit", $model->category ?: ' ')->toHtml();
}, },
], ],
[
'content',
function ($model) {
return $this->showWithTooltip(strip_tags($model->content));
},
],
[ [
'private_notes', 'private_notes',
function ($model) { function ($model) {

View File

@ -26,6 +26,12 @@ class ProposalTemplateDatatable extends EntityDatatable
//return $this->addNote($str, $model->private_notes); //return $this->addNote($str, $model->private_notes);
}, },
], ],
[
'content',
function ($model) {
return $this->showWithTooltip(strip_tags($model->content));
},
],
[ [
'private_notes', 'private_notes',
function ($model) { function ($model) {

View File

@ -39,6 +39,7 @@ class ProposalRepository extends BaseRepository
'proposals.created_at', 'proposals.created_at',
'proposals.is_deleted', 'proposals.is_deleted',
'proposals.private_notes', 'proposals.private_notes',
'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_name"),
'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',

View File

@ -32,6 +32,7 @@ class ProposalSnippetRepository extends BaseRepository
'proposal_snippets.deleted_at', 'proposal_snippets.deleted_at',
'proposal_snippets.is_deleted', 'proposal_snippets.is_deleted',
'proposal_snippets.private_notes', 'proposal_snippets.private_notes',
'proposal_snippets.html as content',
'proposal_categories.name as category', 'proposal_categories.name as category',
'proposal_categories.public_id as category_public_id', 'proposal_categories.public_id as category_public_id',
'proposal_categories.user_id as category_user_id' 'proposal_categories.user_id as category_user_id'

View File

@ -29,6 +29,7 @@ class ProposalTemplateRepository extends BaseRepository
'proposal_templates.user_id', 'proposal_templates.user_id',
'proposal_templates.deleted_at', 'proposal_templates.deleted_at',
'proposal_templates.is_deleted', 'proposal_templates.is_deleted',
'proposal_templates.html as content',
'proposal_templates.private_notes' 'proposal_templates.private_notes'
); );

View File

@ -20,7 +20,7 @@ $(function() {
var blockManager = grapesjsEditor.BlockManager; var blockManager = grapesjsEditor.BlockManager;
@foreach ($snippets as $snippet) @foreach ($snippets as $snippet)
blockManager.add('h1-block', { blockManager.add("h{{ ($loop->index + 1) }}-block", {
label: '{{ $snippet->name }}', label: '{{ $snippet->name }}',
category: '{{ $snippet->proposal_category ? $snippet->proposal_category->name : trans('texts.custom') }}', category: '{{ $snippet->proposal_category ? $snippet->proposal_category->name : trans('texts.custom') }}',
content: '{!! $snippet->html !!}', content: '{!! $snippet->html !!}',

View File

@ -52,11 +52,12 @@
->addGroupClass('category-select') !!} ->addGroupClass('category-select') !!}
{!! Former::select('icon') {!! Former::select('icon')
->addGroupClass('icon-select') ->addGroupClass('icon-select')
->addOption('', '')
->options($icons) !!} ->options($icons) !!}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{!! Former::textarea('private_notes') {!! Former::textarea('private_notes')
->style('height:98px') !!} ->style('height:160px') !!}
</div> </div>
</div> </div>
</div> </div>