mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Working on proposals
This commit is contained in:
parent
f45c39d6f4
commit
d649fc84a1
@ -53,7 +53,7 @@ class ProposalCategoryController extends BaseController
|
||||
{
|
||||
$data = [
|
||||
'account' => auth()->user()->account,
|
||||
'proposalCategory' => null,
|
||||
'category' => null,
|
||||
'method' => 'POST',
|
||||
'url' => 'proposals/categories',
|
||||
'title' => trans('texts.new_proposal_category'),
|
||||
@ -71,7 +71,7 @@ class ProposalCategoryController extends BaseController
|
||||
|
||||
$data = [
|
||||
'account' => auth()->user()->account,
|
||||
'proposalCategory' => $proposalCategory,
|
||||
'category' => $proposalCategory,
|
||||
'method' => 'PUT',
|
||||
'url' => 'proposals/categories/' . $proposalCategory->public_id,
|
||||
'title' => trans('texts.edit_proposal_category'),
|
||||
|
28
app/Http/Requests/CreateProposalCategoryRequest.php
Normal file
28
app/Http/Requests/CreateProposalCategoryRequest.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class CreateProposalCategoryRequest extends ProjectRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->user()->can('create', ENTITY_PROPOSAL_CATEGORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
29
app/Http/Requests/CreateProposalRequest.php
Normal file
29
app/Http/Requests/CreateProposalRequest.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class CreateProposalRequest extends ProjectRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->user()->can('create', ENTITY_PROPOSAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'quote_id' => 'required',
|
||||
'template_id' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Requests/CreateProposalSnippetRequest.php
Normal file
28
app/Http/Requests/CreateProposalSnippetRequest.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class CreateProposalSnippetRequest extends ProjectRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->user()->can('create', ENTITY_PROPOSAL_SNIPPET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Requests/CreateProposalTemplateRequest.php
Normal file
28
app/Http/Requests/CreateProposalTemplateRequest.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class CreateProposalTemplateRequest extends ProjectRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->user()->can('create', ENTITY_PROPOSAL_TEMPLATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/UpdateProposalCategoryRequest.php
Normal file
32
app/Http/Requests/UpdateProposalCategoryRequest.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateProposalCategoryRequest extends ProjectRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
if (! $this->entity()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
33
app/Http/Requests/UpdateProposalRequest.php
Normal file
33
app/Http/Requests/UpdateProposalRequest.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateProposalRequest extends ProjectRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
if (! $this->entity()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'quote_id' => 'required',
|
||||
'template_id' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/UpdateProposalSnippetRequest.php
Normal file
32
app/Http/Requests/UpdateProposalSnippetRequest.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateProposalSnippetRequest extends ProjectRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
if (! $this->entity()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/UpdateProposalTemplateRequest.php
Normal file
32
app/Http/Requests/UpdateProposalTemplateRequest.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateProposalTemplateRequest extends ProjectRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
if (! $this->entity()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ class ProposalCategory extends EntityModel
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -42,7 +43,7 @@ class ProposalCategory extends EntityModel
|
||||
*/
|
||||
public function getRoute()
|
||||
{
|
||||
return "/proposal_categories/{$this->public_id}";
|
||||
return "/proposals/categories/{$this->public_id}";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class ProposalSnippet extends EntityModel
|
||||
*/
|
||||
public function getRoute()
|
||||
{
|
||||
return "/proposal_snippets/{$this->public_id}";
|
||||
return "/proposals/snippets/{$this->public_id}";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class ProposalTemplate extends EntityModel
|
||||
*/
|
||||
public function getRoute()
|
||||
{
|
||||
return "/proposal_templates/{$this->public_id}";
|
||||
return "/proposals/templates/{$this->public_id}";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ class ProposalCategoryRepository extends BaseRepository
|
||||
|
||||
public function save($input, $proposal = false)
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
$publicId = isset($input['public_id']) ? $input['public_id'] : false;
|
||||
|
||||
if (! $proposal) {
|
||||
$proposal = ProposalCategory::createNew();
|
||||
|
@ -3,5 +3,47 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
{!! Former::open($url)
|
||||
->addClass('col-lg-10 col-lg-offset-1 warn-on-exit')
|
||||
->method($method)
|
||||
->rules([
|
||||
'name' => 'required',
|
||||
]) !!}
|
||||
|
||||
@if ($category)
|
||||
{!! Former::populate($category) !!}
|
||||
@endif
|
||||
|
||||
<span style="display:none">
|
||||
{!! Former::text('public_id') !!}
|
||||
</span>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-10 col-lg-offset-1">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
{!! Former::text('name') !!}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<center class="buttons">
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(HTMLUtils::previousUrl('/expense_categories'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#name').focus();
|
||||
});
|
||||
</script>
|
||||
|
||||
@stop
|
||||
|
Loading…
Reference in New Issue
Block a user