Browse Source
Merge pull request #57 from nafiesl/56-job-clone-bug
Resolving issue #56 Job Clone Bug
pull/61/head
Nafies Luthfi
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
42 additions and
11 deletions
-
app/Http/Controllers/Projects/JobsController.php
-
resources/lang/de/validation.php
-
resources/lang/en/validation.php
-
resources/lang/id/validation.php
-
resources/views/projects/jobs/add-from-other-project.blade.php
-
tests/Feature/ManageJobsTest.php
|
|
|
@ -52,15 +52,18 @@ class JobsController extends Controller |
|
|
|
public function store(CreateRequest $req, $projectId) |
|
|
|
{ |
|
|
|
$job = $this->repo->createJob($req->except('_token'), $projectId); |
|
|
|
flash(trans('job.created'), 'success'); |
|
|
|
flash(__('job.created'), 'success'); |
|
|
|
|
|
|
|
return redirect()->route('jobs.show', $job->id); |
|
|
|
} |
|
|
|
|
|
|
|
public function storeFromOtherProject(Request $req, $projectId) |
|
|
|
public function storeFromOtherProject(Request $request, $projectId) |
|
|
|
{ |
|
|
|
$this->repo->createJobs($req->except('_token'), $projectId); |
|
|
|
flash(trans('job.created_from_other_project'), 'success'); |
|
|
|
$request->validate(['job_ids' => 'required|array']); |
|
|
|
|
|
|
|
$this->repo->createJobs($request->except('_token'), $projectId); |
|
|
|
|
|
|
|
flash(__('job.created_from_other_project'), 'success'); |
|
|
|
|
|
|
|
return redirect()->route('projects.jobs.index', $projectId); |
|
|
|
} |
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ return [ |
|
|
|
| |
|
|
|
*/ |
|
|
|
|
|
|
|
'project' => [ |
|
|
|
'project' => [ |
|
|
|
'customer_name' => [ |
|
|
|
'required_without' => 'Customer name is required.', |
|
|
|
], |
|
|
|
@ -98,11 +98,12 @@ return [ |
|
|
|
'required_without' => 'Customer email is required.', |
|
|
|
], |
|
|
|
], |
|
|
|
'agency' => [ |
|
|
|
'agency' => [ |
|
|
|
'logo' => [ |
|
|
|
'file_extension' => 'Please upload an image with <strong>.png</strong> format.', |
|
|
|
], |
|
|
|
], |
|
|
|
'select_one' => 'Select at least one item.', |
|
|
|
|
|
|
|
/* |
|
|
|
|-------------------------------------------------------------------------- |
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ return [ |
|
|
|
| |
|
|
|
*/ |
|
|
|
|
|
|
|
'project' => [ |
|
|
|
'project' => [ |
|
|
|
'customer_name' => [ |
|
|
|
'required_without' => 'Customer name is required.', |
|
|
|
], |
|
|
|
@ -98,11 +98,12 @@ return [ |
|
|
|
'required_without' => 'Customer email is required.', |
|
|
|
], |
|
|
|
], |
|
|
|
'agency' => [ |
|
|
|
'agency' => [ |
|
|
|
'logo' => [ |
|
|
|
'file_extension' => 'Please upload an image with <strong>.png</strong> format.', |
|
|
|
], |
|
|
|
], |
|
|
|
'select_one' => 'Select at least one item.', |
|
|
|
|
|
|
|
/* |
|
|
|
|-------------------------------------------------------------------------- |
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ return [ |
|
|
|
| |
|
|
|
*/ |
|
|
|
|
|
|
|
'project' => [ |
|
|
|
'project' => [ |
|
|
|
'customer_name' => [ |
|
|
|
'required_without' => 'Nama customer wajib diisi.', |
|
|
|
], |
|
|
|
@ -98,11 +98,12 @@ return [ |
|
|
|
'required_without' => 'Email customer wajib diisi.', |
|
|
|
], |
|
|
|
], |
|
|
|
'agency' => [ |
|
|
|
'agency' => [ |
|
|
|
'logo' => [ |
|
|
|
'file_extension' => 'Silakan upload file format <strong>.png</strong>', |
|
|
|
], |
|
|
|
], |
|
|
|
'select_one' => 'Pilih setidaknya satu item.', |
|
|
|
|
|
|
|
/* |
|
|
|
|--------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
@ -17,7 +17,11 @@ |
|
|
|
<div class="panel-heading"><h3 class="panel-title">{{ __('job.add_from_other_project') }}</h3></div> |
|
|
|
<div class="panel-body"> |
|
|
|
{{ Form::open(['method' => 'get', 'class' => 'form-inline', 'style' => 'margin-bottom:20px']) }} |
|
|
|
{!! FormField::select('project_id', $projects, ['label' => false, 'placeholder' => __('project.select')]) !!} |
|
|
|
{!! FormField::select('project_id', $projects, [ |
|
|
|
'label' => false, |
|
|
|
'value' => request('project_id'), |
|
|
|
'placeholder' => __('project.select'), |
|
|
|
]) !!} |
|
|
|
{{ Form::submit(__('project.show_jobs'), ['class' => 'btn btn-default btn-sm']) }} |
|
|
|
{{ Form::close() }} |
|
|
|
@if ($selectedProject) |
|
|
|
@ -45,6 +49,9 @@ |
|
|
|
@else |
|
|
|
<div class="alert alert-info">{{ __('job.select_project') }}</div> |
|
|
|
@endif |
|
|
|
@if ($errors->has('job_ids')) |
|
|
|
<div class="alert alert-danger">{{ __('validation.select_one') }}</div> |
|
|
|
@endif |
|
|
|
{{ Form::submit(__('job.add'), ['class' => 'btn btn-primary']) }} |
|
|
|
{{ Form::close() }} |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -199,6 +199,24 @@ class ManageJobsTest extends TestCase |
|
|
|
} |
|
|
|
|
|
|
|
/** @test */ |
|
|
|
public function validate_clone_many_jobs_from_other_projects() |
|
|
|
{ |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$customer = factory(Customer::class)->create(); |
|
|
|
$projects = factory(Project::class, 2)->create(['customer_id' => $customer->id]); |
|
|
|
$jobs = factory(Job::class, 3)->create(['project_id' => $projects[0]->id]); |
|
|
|
$tasks1 = factory(Task::class, 3)->create(['job_id' => $jobs[0]->id]); |
|
|
|
$tasks2 = factory(Task::class, 3)->create(['job_id' => $jobs[1]->id]); |
|
|
|
|
|
|
|
$this->visit(route('projects.jobs.add-from-other-project', [$projects[1]->id, 'project_id' => $projects[0]->id])); |
|
|
|
|
|
|
|
$this->submitForm(__('job.add'), []); |
|
|
|
|
|
|
|
$this->seePageIs(route('projects.jobs.add-from-other-project', [$projects[1]->id, 'project_id' => $projects[0]->id])); |
|
|
|
$this->see(__('validation.select_one')); |
|
|
|
} |
|
|
|
|
|
|
|
/** @test */ |
|
|
|
public function admin_can_see_unfinished_jobs_list() |
|
|
|
{ |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
|