mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Adjustments to task projects
This commit is contained in:
parent
bef3b85614
commit
d1f496023b
@ -79,7 +79,7 @@ class ProjectController extends BaseController
|
|||||||
|
|
||||||
public function store(CreateProjectRequest $request)
|
public function store(CreateProjectRequest $request)
|
||||||
{
|
{
|
||||||
$project = $this->projectRepo->save($request->input());
|
$project = $this->projectService->save($request->input());
|
||||||
|
|
||||||
Session::flash('message', trans('texts.created_project'));
|
Session::flash('message', trans('texts.created_project'));
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ class ProjectController extends BaseController
|
|||||||
|
|
||||||
public function update(UpdateProjectRequest $request)
|
public function update(UpdateProjectRequest $request)
|
||||||
{
|
{
|
||||||
$project = $this->projectRepo->save($request->input(), $request->entity());
|
$project = $this->projectService->save($request->input(), $request->entity());
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_project'));
|
Session::flash('message', trans('texts.updated_project'));
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ class CreateProjectRequest extends ProjectRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => sprintf('required|unique:projects,name,,id,account_id,%s', $this->user()->account_id),
|
'name' => sprintf('required|unique:projects,name,,id,account_id,%s', $this->user()->account_id),
|
||||||
|
'client_id' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ class UpdateProjectRequest extends ProjectRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required',
|
|
||||||
'name' => sprintf('required|unique:projects,name,%s,id,account_id,%s', $this->entity()->id, $this->user()->account_id),
|
'name' => sprintf('required|unique:projects,name,%s,id,account_id,%s', $this->entity()->id, $this->user()->account_id),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ class Project extends EntityModel
|
|||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'client_id',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,6 +65,7 @@ class ProjectRepository extends BaseRepository
|
|||||||
|
|
||||||
if ( ! $project) {
|
if ( ! $project) {
|
||||||
$project = Project::createNew();
|
$project = Project::createNew();
|
||||||
|
$project['client_id'] = $input['client_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$project->fill($input);
|
$project->fill($input);
|
||||||
|
@ -45,13 +45,13 @@ class ProjectService extends BaseService
|
|||||||
* @param $data
|
* @param $data
|
||||||
* @return mixed|null
|
* @return mixed|null
|
||||||
*/
|
*/
|
||||||
public function save($data)
|
public function save($data, $project)
|
||||||
{
|
{
|
||||||
if (isset($data['client_id']) && $data['client_id']) {
|
if (isset($data['client_id']) && $data['client_id']) {
|
||||||
$data['client_id'] = Client::getPrivateId($data['client_id']);
|
$data['client_id'] = Client::getPrivateId($data['client_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->projectRepo->save($data);
|
return $this->projectRepo->save($data, $project);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
->method($method)
|
->method($method)
|
||||||
->rules([
|
->rules([
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
|
'client_id' => 'required',
|
||||||
]) !!}
|
]) !!}
|
||||||
|
|
||||||
@if ($project)
|
@if ($project)
|
||||||
@ -26,11 +27,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
|
@if ($project)
|
||||||
|
{!! Former::plaintext('client_name')
|
||||||
|
->value($project->client->getDisplayName()) !!}
|
||||||
|
@else
|
||||||
|
{!! Former::select('client_id')
|
||||||
|
->addOption('', '')
|
||||||
|
->label(trans('texts.client'))
|
||||||
|
->addGroupClass('client-select') !!}
|
||||||
|
@endif
|
||||||
|
|
||||||
{!! Former::text('name') !!}
|
{!! Former::text('name') !!}
|
||||||
|
|
||||||
{!! Former::select('client_id')
|
|
||||||
->addOption('', '')
|
|
||||||
->label(trans('texts.client')) !!}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -51,8 +59,6 @@
|
|||||||
var clients = {!! $clients !!};
|
var clients = {!! $clients !!};
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#name').focus();
|
|
||||||
|
|
||||||
var $clientSelect = $('select#client_id');
|
var $clientSelect = $('select#client_id');
|
||||||
for (var i=0; i<clients.length; i++) {
|
for (var i=0; i<clients.length; i++) {
|
||||||
var client = clients[i];
|
var client = clients[i];
|
||||||
@ -65,7 +71,9 @@
|
|||||||
@if ($clientPublicId)
|
@if ($clientPublicId)
|
||||||
$clientSelect.val({{ $clientPublicId }});
|
$clientSelect.val({{ $clientPublicId }});
|
||||||
@endif
|
@endif
|
||||||
$clientSelect.combobox();
|
$clientSelect.combobox().focus();
|
||||||
|
|
||||||
|
$('.client-select input.form-control').focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user