diff --git a/app/Entities/Projects/FeaturesRepository.php b/app/Entities/Projects/FeaturesRepository.php index 92e0b7d..8bf41b6 100755 --- a/app/Entities/Projects/FeaturesRepository.php +++ b/app/Entities/Projects/FeaturesRepository.php @@ -26,7 +26,7 @@ class FeaturesRepository extends BaseRepository ->whereHas('project', function($query) { return $query->whereIn('status_id', [2,3]); }) - ->with(['tasks','project','worker']) + ->with(['tasks','project']) ->get(); } diff --git a/app/Http/Controllers/Projects/ProjectsController.php b/app/Http/Controllers/Projects/ProjectsController.php index be83520..ae862dd 100755 --- a/app/Http/Controllers/Projects/ProjectsController.php +++ b/app/Http/Controllers/Projects/ProjectsController.php @@ -91,20 +91,20 @@ class ProjectsController extends Controller { return view('projects.features', compact('project','features')); } - public function featuresExport($projectId) + public function featuresExport($projectId, $type = 'excel') { $project = $this->repo->requireById($projectId); $features = $this->repo->getProjectFeatures($projectId); // return view('projects.features-export', compact('project','features')); - - \Excel::create(str_slug(trans('project.features') . '-' . $project->name), function($excel) use ($project, $features) { - - $excel->sheet('testng', function($sheet) use ($project, $features) { - - $sheet->loadView('projects.features-export',compact('project','features')); - - }); - })->download('xlsx'); + if ($type == 'excel') { + \Excel::create(str_slug(trans('project.features') . '-' . $project->name), function($excel) use ($project, $features) { + $excel->sheet('testng', function($sheet) use ($project, $features) { + $sheet->loadView('projects.features-export-excel',compact('project','features')); + }); + })->download('xlsx'); + } else { + return view('projects.features-export-html', compact('project','features')); + } } public function payments($projectId) diff --git a/app/Http/Requests/Features/CreateRequest.php b/app/Http/Requests/Features/CreateRequest.php index 39235bb..d14db0a 100644 --- a/app/Http/Requests/Features/CreateRequest.php +++ b/app/Http/Requests/Features/CreateRequest.php @@ -27,7 +27,7 @@ class CreateRequest extends Request { { return [ 'name' => 'required|max:60', - 'price' => 'required', + 'price' => 'string', 'worker_id' => 'required|numeric', 'type_id' => 'required|numeric', 'description' => 'max:255', diff --git a/app/Http/routes/projects.php b/app/Http/routes/projects.php index 63ac012..f90e0fd 100644 --- a/app/Http/routes/projects.php +++ b/app/Http/routes/projects.php @@ -6,7 +6,7 @@ Route::group(['middleware' => ['web','role:admin'], 'namespace' => 'Projects'], */ Route::get('projects/{id}/delete', ['as'=>'projects.delete', 'uses'=>'ProjectsController@delete']); Route::get('projects/{id}/features', ['as'=>'projects.features', 'uses'=>'ProjectsController@features']); - Route::get('projects/{id}/features-export', ['as'=>'projects.features-export', 'uses'=>'ProjectsController@featuresExport']); + Route::get('projects/{id}/features-export/{type?}', ['as'=>'projects.features-export', 'uses'=>'ProjectsController@featuresExport']); Route::get('projects/{id}/payments', ['as'=>'projects.payments', 'uses'=>'ProjectsController@payments']); Route::post('projects/{id}/features-reorder', ['as'=>'projects.features-reorder', 'uses'=>'ProjectsController@featuresReorder']); Route::patch('projects/{id}/status-update', ['as'=>'projects.status-update', 'uses'=>'ProjectsController@statusUpdate']); diff --git a/resources/lang/id/project.php b/resources/lang/id/project.php index 732c20b..cde5bd1 100644 --- a/resources/lang/id/project.php +++ b/resources/lang/id/project.php @@ -24,7 +24,8 @@ return [ 'cash_out_total' => 'Total Pengeluaran', 'customer' => 'Customer', 'features' => 'Daftar Fitur', - 'features_export' => 'Export Fitur ke Excel', + 'features_export_html' => 'Export Fitur ke HTML', + 'features_export_excel' => 'Export Fitur ke Excel', 'worker' => 'Pekerja', 'status' => 'Status Project', 'payments' => 'Pembayaran', diff --git a/resources/views/features/partials/feature-tasks.blade.php b/resources/views/features/partials/feature-tasks.blade.php index 8517156..7168eae 100644 --- a/resources/views/features/partials/feature-tasks.blade.php +++ b/resources/views/features/partials/feature-tasks.blade.php @@ -3,10 +3,10 @@ - - - - + + + + @forelse($feature->tasks as $key => $task) diff --git a/resources/views/projects/features-export.blade.php b/resources/views/projects/features-export-excel.blade.php similarity index 97% rename from resources/views/projects/features-export.blade.php rename to resources/views/projects/features-export-excel.blade.php index 5d36814..22a423e 100755 --- a/resources/views/projects/features-export.blade.php +++ b/resources/views/projects/features-export-excel.blade.php @@ -29,7 +29,7 @@ {{-- --}} - + diff --git a/resources/views/projects/features-export-html.blade.php b/resources/views/projects/features-export-html.blade.php new file mode 100755 index 0000000..7887857 --- /dev/null +++ b/resources/views/projects/features-export-html.blade.php @@ -0,0 +1,69 @@ +name) . '.xls'; +// header("Content-Disposition: attachment; filename=\"$filename\""); +// header("Content-Type: application/vnd.ms-excel"); +?> + + + + + {{-- --}} + + {{ $project->name }} + {!! Html::style('assets/css/app.css') !!} + + +
+

{{ trans('project.features') }} {{ $project->name }}

+ + @foreach($features as $key => $feature) +

{{ $feature->name }}

+
{{ trans('app.table_no') }}{{ trans('task.name') }}{{ trans('task.route_name') }}{{ trans('task.progress') }}{{ trans('app.action') }}{{ trans('task.name') }}{{ trans('task.route_name') }}{{ trans('task.progress') }}{{ trans('app.action') }}
{{ trans('feature.name') }}{{ trans('feature.progress') }}{{ trans('feature.price') }}{{ trans('app.notes') }}{{ trans('app.description') }}
+ + + + + @if ($feature->tasks->count()) + + + + + + @foreach($feature->tasks as $task) + + + + + @endforeach + @endif + +
{{ trans('app.description') }}
{!! nl2br($feature->description) !!}
 
Sub Fitur{{ trans('app.description') }}
{{ $task->name }}{!! nl2br($task->description) !!}
+ @endforeach + +

Biaya Pembuatan

+ + + + + + + + @foreach($features as $key => $feature) + + + + + + @endforeach + + + + + + + +
{{ trans('app.table_no') }}{{ trans('feature.name') }}{{ trans('feature.price') }}
{{ 1 + $key }}{{ $feature->name }}{{ formatRp($feature->price) }}
Total{{ formatRp($features->sum('price')) }}
+ + + + \ No newline at end of file diff --git a/resources/views/projects/features.blade.php b/resources/views/projects/features.blade.php index 2e4626b..e694c39 100755 --- a/resources/views/projects/features.blade.php +++ b/resources/views/projects/features.blade.php @@ -23,8 +23,8 @@ {{ trans('feature.tasks_count') }} {{ trans('feature.progress') }} {{ trans('feature.price') }} - {{ trans('feature.worker') }} - {{ trans('app.action') }} + {{-- {{ trans('feature.worker') }} --}} + {{ trans('app.action') }} @forelse($features as $key => $feature) @@ -36,10 +36,7 @@ @if ($feature->tasks->isEmpty() == false) @endif @@ -47,8 +44,8 @@ {{ $feature->tasks_count = $feature->tasks->count() }} {{ formatDecimal($feature->progress = $feature->tasks->avg('progress')) }} % {{ formatRp($feature->price) }} - {{ $feature->worker->name }} - + {{-- {{ $feature->worker->name }} --}} + {!! link_to_route('features.show', trans('task.create'),[$feature->id],['class' => 'btn btn-default btn-xs']) !!} {!! link_to_route('features.show', trans('app.show'),[$feature->id],['class' => 'btn btn-info btn-xs']) !!} {!! link_to_route('features.edit', trans('app.edit'),[$feature->id],['class' => 'btn btn-warning btn-xs']) !!} diff --git a/resources/views/projects/partials/nav-tabs.blade.php b/resources/views/projects/partials/nav-tabs.blade.php index 2355584..a294a1f 100644 --- a/resources/views/projects/partials/nav-tabs.blade.php +++ b/resources/views/projects/partials/nav-tabs.blade.php @@ -1,5 +1,8 @@ @if (Request::segment(3) == 'features') -{!! link_to_route('projects.features-export', trans('project.features_export'), [$project->id], ['class' => 'btn btn-success pull-right']) !!} +
+{!! link_to_route('projects.features-export', trans('project.features_export_html'), [$project->id, 'html'], ['class' => 'btn btn-link','target' => '_blank']) !!} +{!! link_to_route('projects.features-export', trans('project.features_export_excel'), [$project->id], ['class' => 'btn btn-link']) !!} +
@endif