Proposals

This commit is contained in:
Hillel Coren 2018-02-04 22:10:40 +02:00
parent b4bf222d5d
commit d3a891375c
3 changed files with 32 additions and 23 deletions

View File

@ -8,6 +8,7 @@ use App\Http\Requests\UpdateProposalRequest;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Proposal; use App\Models\Proposal;
use App\Models\ProposalTemplate; use App\Models\ProposalTemplate;
use App\Models\ProposalSnippet;
use App\Ninja\Datatables\ProposalDatatable; use App\Ninja\Datatables\ProposalDatatable;
use App\Ninja\Repositories\ProposalRepository; use App\Ninja\Repositories\ProposalRepository;
use App\Services\ProposalService; use App\Services\ProposalService;
@ -63,6 +64,7 @@ class ProposalController extends BaseController
'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(), 'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(),
'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(), 'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(),
'quotePublicId' => $request->quote_id, 'quotePublicId' => $request->quote_id,
'snippets' => ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get(),
]; ];
return View::make('proposals.edit', $data); return View::make('proposals.edit', $data);
@ -90,6 +92,7 @@ class ProposalController extends BaseController
'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(), 'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(),
'quotePublicId' => $proposal->quote ? $proposal->quote->public_id : null, 'quotePublicId' => $proposal->quote ? $proposal->quote->public_id : null,
'templatePublicId' => $proposal->proposal_template ? $proposal->proposal_template->public_id : null, 'templatePublicId' => $proposal->proposal_template ? $proposal->proposal_template->public_id : null,
'snippets' => ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get(),
]; ];
return View::make('proposals.edit', $data); return View::make('proposals.edit', $data);

View File

@ -2722,6 +2722,7 @@ $LANG = array(
'deleted_proposal_categories' => 'Successfully archived :count categories', 'deleted_proposal_categories' => 'Successfully archived :count categories',
'restored_proposal_category' => 'Successfully restored category', 'restored_proposal_category' => 'Successfully restored category',
'delete_status' => 'Delete Status', 'delete_status' => 'Delete Status',
'standard' => 'Standard',
); );

View File

@ -120,34 +120,39 @@
components: '{!! $proposal ? $proposal->html : '' !!}', components: '{!! $proposal ? $proposal->html : '' !!}',
style: '{!! $proposal ? $proposal->css : '' !!}', style: '{!! $proposal ? $proposal->css : '' !!}',
showDevices: false, showDevices: false,
categoryLabel: 'tes',
plugins: ['gjs-preset-newsletter'], plugins: ['gjs-preset-newsletter'],
//plugins: ['gjs-blocks-basic'], pluginsOpts: {
'gjs-preset-newsletter': {
'categoryLabel': "{{ trans('texts.standard') }}"
}
},
storageManager: {type: 'none'}, storageManager: {type: 'none'},
panels: {
Xdefaults : [{
id : 'commands',
buttons : [{
id : 'smile',
className : 'fa fa-smile-o',
attributes : { title: 'Smile' }
}],
}],
}
}); });
/* var blockManager = grapesjsEditor.BlockManager;
var blockManager = editor.BlockManager;
blockManager.add('h1-block', { @foreach ($snippets as $snippet)
label: 'Heading', blockManager.add('h1-block', {
category: 'Basic', label: '{{ $snippet->name }}',
content: '<h1>Put your title here</h1>', category: '{{ $snippet->proposal_category ? $snippet->proposal_category->name : trans('texts.custom') }}',
attributes: { content: '{!! $snippet->html !!}',
title: 'Insert h1 block', style: '{!! $snippet->css !!}',
class:'fa fa-smile-o' attributes: {
title: '{!! $snippet->private_notes !!}',
class:'fa fa-smile-o'
}
});
@endforeach
@if (count($snippets))
var blockCategories = blockManager.getCategories();
for (var i=0; i<blockCategories.models.length; i++) {
var blockCategory = blockCategories.models[i];
blockCategory.set('open', false);
} }
}); @endif
*/ })
})
</script> </script>