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

Working on proposals

This commit is contained in:
Hillel Coren 2018-01-31 13:51:18 +02:00
parent 41739d8405
commit de040a4455
11 changed files with 251 additions and 29 deletions

View File

@ -62,7 +62,7 @@ class ProposalCategoryController extends BaseController
'quotePublicId' => $request->quote_id,
];
return View::make('proposal_categories.edit', $data);
return View::make('proposals/categories/edit', $data);
}
public function edit(ProposalCategoryRequest $request)
@ -79,7 +79,7 @@ class ProposalCategoryController extends BaseController
'clientPublicId' => $proposalCategory->client ? $proposalCategory->client->public_id : null,
];
return View::make('proposal_categories.edit', $data);
return View::make('proposals/categories.edit', $data);
}
public function store(CreateProposalCategoryRequest $request)

View File

@ -7,7 +7,6 @@ use App\Http\Requests\ProposalSnippetRequest;
use App\Http\Requests\UpdateProposalSnippetRequest;
use App\Models\Invoice;
use App\Models\ProposalSnippet;
use App\Models\ProposalSnippetTemplate;
use App\Ninja\Datatables\ProposalSnippetDatatable;
use App\Ninja\Repositories\ProposalSnippetRepository;
use App\Services\ProposalSnippetService;
@ -59,11 +58,11 @@ class ProposalSnippetController extends BaseController
'url' => 'proposal_snippets',
'title' => trans('texts.new_proposal_snippet'),
'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(),
'templates' => ProposalSnippetTemplate::scope()->orderBy('name')->get(),
'templates' => ProposalSnippet::scope()->orderBy('name')->get(),
'quotePublicId' => $request->quote_id,
];
return View::make('proposal_snippets.edit', $data);
return View::make('proposals/snippets/edit', $data);
}
public function edit(ProposalSnippetRequest $request)
@ -80,7 +79,7 @@ class ProposalSnippetController extends BaseController
'clientPublicId' => $proposalSnippet->client ? $proposalSnippet->client->public_id : null,
];
return View::make('proposal_snippets.edit', $data);
return View::make('proposals/snippets/edit', $data);
}
public function store(CreateProposalSnippetRequest $request)

View File

@ -7,7 +7,6 @@ use App\Http\Requests\ProposalTemplateRequest;
use App\Http\Requests\UpdateProposalTemplateRequest;
use App\Models\Invoice;
use App\Models\ProposalTemplate;
use App\Models\ProposalTemplateTemplate;
use App\Ninja\Datatables\ProposalTemplateDatatable;
use App\Ninja\Repositories\ProposalTemplateRepository;
use App\Services\ProposalTemplateService;
@ -59,11 +58,11 @@ class ProposalTemplateController extends BaseController
'url' => 'proposal_templates',
'title' => trans('texts.new_proposal_template'),
'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(),
'templates' => ProposalTemplateTemplate::scope()->orderBy('name')->get(),
'templates' => ProposalTemplate::scope()->orderBy('name')->get(),
'quotePublicId' => $request->quote_id,
];
return View::make('proposal_templates.edit', $data);
return View::make('proposals/templates/edit', $data);
}
public function edit(ProposalTemplateRequest $request)
@ -80,7 +79,7 @@ class ProposalTemplateController extends BaseController
'clientPublicId' => $proposalTemplate->client ? $proposalTemplate->client->public_id : null,
];
return View::make('proposal_templates.edit', $data);
return View::make('proposals/templates/edit', $data);
}
public function store(CreateProposalTemplateRequest $request)

View File

@ -321,7 +321,7 @@ class EntityModel extends Eloquent
'recurring_expenses' => 'files-o',
'credits' => 'credit-card',
'quotes' => 'file-text-o',
'proposals' => 'tasks',
'proposals' => 'th-large',
'tasks' => 'clock-o',
'expenses' => 'file-image-o',
'vendors' => 'building',

View File

@ -225,6 +225,7 @@ class AccountRepository
ENTITY_PAYMENT,
ENTITY_CREDIT,
ENTITY_PROJECT,
ENTITY_PROPOSAL,
];
foreach ($entityTypes as $entityType) {

View File

@ -2662,6 +2662,7 @@ $LANG = array(
'proposal' => 'Proposal',
'proposals' => 'Proposals',
'list_proposals' => 'List Proposals',
'new_proposal' => 'New Proposal',
'edit_proposal' => 'Edit Proposal',
'archive_proposal' => 'Archive Proposal',
@ -2674,6 +2675,8 @@ $LANG = array(
'archived_proposals' => 'Successfully archived :count proposals',
'deleted_proposals' => 'Successfully archived :count proposals',
'restored_proposal' => 'Successfully restored proposal',
'snippet' => 'Snippet',
'snippets' => 'Snippets',
'proposal_snippet' => 'Snippet',
'proposal_snippets' => 'Snippets',
'new_proposal_snippet' => 'New Snippet',
@ -2688,6 +2691,8 @@ $LANG = array(
'archived_proposal_snippets' => 'Successfully archived :count snippets',
'deleted_proposal_snippets' => 'Successfully archived :count snippets',
'restored_proposal_snippet' => 'Successfully restored snippet',
'template' => 'Template',
'templates' => 'Templates',
'proposal_template' => 'Template',
'proposal_templates' => 'Templates',
'new_proposal_template' => 'New Template',
@ -2702,8 +2707,8 @@ $LANG = array(
'archived_proposal_templates' => 'Successfully archived :count temlates',
'deleted_proposal_templates' => 'Successfully archived :count temlates',
'restored_proposal_template' => 'Successfully restored temlate',
'proposal_category' => 'Proposal Category',
'proposal_categories' => 'Proposal Categories',
'proposal_category' => 'Category',
'proposal_categories' => 'Categories',
'new_proposal_category' => 'New Category',
'edit_proposal_category' => 'Edit Category',
'archive_proposal_category' => 'Archive Category',

View File

@ -47,16 +47,16 @@
class="form-control pull-left" placeholder="{{ trans('texts.filter') }}" value="{{ Input::get('filter') }}"/>
@if ($entityType == ENTITY_PROPOSAL)
{!! DropdownButton::normal(trans('texts.templates'))
{!! DropdownButton::normal(trans('texts.proposal_templates'))
->withAttributes(['class'=>'templatesDropdown'])
->withContents([
['label' => trans('texts.new_template'), 'url' => url('/proposal_templates/create')],
['label' => trans('texts.new_proposal_template'), 'url' => url('/proposal_templates/create')],
]
)->split() !!}
{!! DropdownButton::normal(trans('texts.snippets'))
{!! DropdownButton::normal(trans('texts.proposal_snippets'))
->withAttributes(['class'=>'snippetsDropdown'])
->withContents([
['label' => trans('texts.new_snippet'), 'url' => url('/proposal_snippets/create')],
['label' => trans('texts.new_proposal_snippet'), 'url' => url('/proposal_snippets/create')],
]
)->split() !!}
<script type="text/javascript">
@ -70,10 +70,10 @@
});
</script>
@elseif ($entityType == ENTITY_PROPOSAL_SNIPPET)
{!! DropdownButton::normal(trans('texts.categories'))
{!! DropdownButton::normal(trans('texts.proposal_categories'))
->withAttributes(['class'=>'categoriesDropdown'])
->withContents([
['label' => trans('texts.new_category'), 'url' => url('/proposal_categories/create')],
['label' => trans('texts.new_proposal_category'), 'url' => url('/proposal_categories/create')],
]
)->split() !!}
<script type="text/javascript">

View File

@ -0,0 +1,7 @@
@extends('header')
@section('content')
@stop

View File

@ -0,0 +1,101 @@
@extends('header')
@section('head')
@parent
<script src="{{ asset('js/grapesjs.min.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<link href="{{ asset('css/grapesjs.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
<style>
.gjs-four-color {
color: white !important;
}
.gjs-block.fa {
font-size: 4em !important;
}
</style>
@stop
@section('content')
{!! Former::open() !!}
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-6">
{!! Former::select('quote_id')->addOption('', '')
->label(trans('texts.quote'))
->addGroupClass('quote-select') !!}
</div>
<div class="col-md-6">
{!! Former::select('template_id')->addOption('', '')
->label(trans('texts.template'))
->addGroupClass('template-select') !!}
</div>
</div>
</div>
</div>
</div>
</div>
<center class="buttons">
{!! Button::normal(trans('texts.cancel'))
->appendIcon(Icon::create('remove-circle'))
->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}
{!! Button::success(trans("texts.save"))
->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))
->appendIcon(Icon::create('floppy-disk')) !!}
</center>
{!! Former::close() !!}
<div id="gjs"></div>
<script type="text/javascript">
$(function() {
var editor = grapesjs.init({
container : '#gjs',
components: '',
style: '',
showDevices: false,
plugins: ['gjs-preset-newsletter'],
//plugins: ['gjs-blocks-basic'],
storageManager: {type: 'none'},
panels: {
Xdefaults : [{
id : 'commands',
buttons : [{
id : 'smile',
className : 'fa fa-smile-o',
attributes : { title: 'Smile' }
}],
}],
}
});
/*
var blockManager = editor.BlockManager;
blockManager.add('h1-block', {
label: 'Heading',
category: 'Basic',
content: '<h1>Put your title here</h1>',
attributes: {
title: 'Insert h1 block',
class:'fa fa-smile-o'
}
});
*/
})
</script>
@stop

View File

@ -0,0 +1,110 @@
@extends('header')
@section('head')
@parent
<script src="{{ asset('js/grapesjs.min.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<link href="{{ asset('css/grapesjs.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
<style>
.gjs-four-color {
color: white !important;
}
.gjs-block.fa {
font-size: 4em !important;
}
</style>
@stop
@section('content')
{!! Former::open() !!}
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-6">
{!! Former::select('quote_id')->addOption('', '')
->label(trans('texts.quote'))
->addGroupClass('quote-select') !!}
</div>
<div class="col-md-6">
{!! Former::select('template_id')->addOption('', '')
->label(trans('texts.template'))
->addGroupClass('template-select') !!}
</div>
</div>
</div>
</div>
</div>
</div>
<center class="buttons">
{!! Button::normal(trans('texts.cancel'))
->appendIcon(Icon::create('remove-circle'))
->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}
{!! Button::success(trans("texts.save"))
->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))
->appendIcon(Icon::create('floppy-disk')) !!}
</center>
{!! Former::close() !!}
<div id="gjs"></div>
<script type="text/javascript">
var templates = {!! $templates !!};
var templateMap = {};
$(function() {
var $proposal_templateSelect = $('select#template_id');
for (var i = 0; i < templates.length; i++) {
var template = templates[i];
templateMap[template.public_id] = template;
$templateSelect.append(new Option(template.name, template.public_id));
}
@include('partials/entity_combobox', ['entityType' => ENTITY_PROPOSAL_TEMPLATE])
var editor = grapesjs.init({
container : '#gjs',
components: '',
style: '',
showDevices: false,
plugins: ['gjs-preset-newsletter'],
//plugins: ['gjs-blocks-basic'],
storageManager: {type: 'none'},
panels: {
Xdefaults : [{
id : 'commands',
buttons : [{
id : 'smile',
className : 'fa fa-smile-o',
attributes : { title: 'Smile' }
}],
}],
}
});
/*
var blockManager = editor.BlockManager;
blockManager.add('h1-block', {
label: 'Heading',
category: 'Basic',
content: '<h1>Put your title here</h1>',
attributes: {
title: 'Insert h1 block',
class:'fa fa-smile-o'
}
});
*/
})
</script>
@stop

View File

@ -205,21 +205,21 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {
Route::get('api/quotes/{client_id?}', 'QuoteController@getDatatable');
Route::post('quotes/bulk', 'QuoteController@bulk');
Route::get('proposals/create/{quote_id?}', 'ProposalController@create');
Route::resource('proposals', 'ProposalController');
Route::get('api/proposals', 'ProposalController@getDatatable');
Route::get('proposal_templates/create', 'ProposalTemplateController@create');
Route::resource('proposal_templates', 'ProposalTemplateController');
Route::get('api/proposal_templates', 'ProposalTemplateController@getDatatable');
Route::get('proposal_categories/create', 'ProposalCategoryController@create');
Route::resource('proposal_categories', 'ProposalCategoryController');
Route::get('api/proposal_categories', 'ProposalCategoryController@getDatatable');
Route::get('proposal_snippets/create', 'ProposalSnippetController@create');
Route::resource('proposal_snippets', 'ProposalSnippetController');
Route::get('api/proposal_snippets', 'ProposalSnippetController@getDatatable');
Route::get('proposal_categories/create', 'ProposalCategoryController@create');
Route::resource('proposal_categories', 'ProposalCategoryController');
Route::get('api/proposal_categories', 'ProposalCategoryController@getDatatable');
Route::get('proposal_templates/create', 'ProposalTemplateController@create');
Route::resource('proposal_templates', 'ProposalTemplateController');
Route::get('api/proposal_templates', 'ProposalTemplateController@getDatatable');
Route::get('proposals/create/{quote_id?}', 'ProposalController@create');
Route::resource('proposals', 'ProposalController');
Route::get('api/proposals', 'ProposalController@getDatatable');
Route::resource('payments', 'PaymentController');
Route::get('payments/create/{client_id?}/{invoice_id?}', 'PaymentController@create');