Browse Source

Composer update and edit some project details view

pull/1/head
Nafies Luthfi 9 years ago
parent
commit
777d2c8564
  1. 6
      app/Entities/Projects/Project.php
  2. 7
      app/Http/Controllers/Projects/ProjectsController.php
  3. 592
      composer.lock
  4. 2
      config/app.php
  5. 5
      resources/views/projects/features-export-progress-excel.blade.php
  6. 19
      resources/views/projects/features.blade.php
  7. 8
      resources/views/projects/index.blade.php
  8. 4
      resources/views/projects/partials/project-stats.blade.php
  9. 1
      routes/web.php

6
app/Entities/Projects/Project.php

@ -4,6 +4,7 @@ namespace App\Entities\Projects;
use App\Entities\Payments\Payment;
use App\Entities\Projects\ProjectPresenter;
use App\Entities\Projects\Task;
use App\Entities\Subscriptions\Subscription;
use App\Entities\Users\User;
use Illuminate\Database\Eloquent\Model;
@ -22,6 +23,11 @@ class Project extends Model {
return $this->hasMany(Feature::class)->orderBy('position');
}
public function tasks()
{
return $this->hasManyThrough(Task::class, Feature::class);
}
public function mainFeatures()
{
return $this->hasMany(Feature::class)->orderBy('position')->whereTypeId(1);

7
app/Http/Controllers/Projects/ProjectsController.php

@ -111,7 +111,12 @@ class ProjectsController extends Controller {
});
})->download('xls');
} elseif ($exportType == 'excel-progress') {
return view('projects.features-export-progress-excel', compact('project','features'));
// return view('projects.features-export-progress-excel', compact('project','features'));
\Excel::create(str_slug(trans('project.features') . '-' . $project->name), function($excel) use ($project, $features) {
$excel->sheet('export-progress', function($sheet) use ($project, $features) {
$sheet->loadView('projects.features-export-progress-excel',compact('project','features'));
});
})->download('xls');
} else {
return view('projects.features-export-html', compact('project','features'));
}

592
composer.lock
File diff suppressed because it is too large
View File

2
config/app.php

@ -161,7 +161,7 @@ return [
App\Providers\RouteServiceProvider::class,
BackupManager\Laravel\Laravel5ServiceProvider::class,
// Barryvdh\Debugbar\ServiceProvider::class,
Barryvdh\Debugbar\ServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
Laracasts\Flash\FlashServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class,

5
resources/views/projects/features-export-progress-excel.blade.php

@ -39,7 +39,7 @@
<td>
{{ $feature->name }}
</td>
<td class="text-center">{{ $feature->progress = $feature->tasks->avg('progress')/100 }}</td>
<td class="text-center">{{ formatDecimal($feature->progress = $feature->tasks->avg('progress')) }}</td>
{{-- <td class="text-right">{{ $feature->price }}</td> --}}
{{-- <td style="wrap-text: true;">{!! nl2br($feature->description) !!}</td> --}}
</tr>
@ -63,7 +63,8 @@
<tfoot>
<tr>
<th class="text-right" colspan="2">Total</th>
<th class="text-center">{{ $project->getFeatureOveralProgress() }} %</th>
<th class="text-center">{{ formatDecimal($features->sum('progress') / count($features)) }}</th>
{{-- <th class="text-center">{{ $project->getFeatureOveralProgress() }} %</th> --}}
{{-- <th class="text-right">{{ $features->sum('price') }}</th> --}}
{{-- <th></th> --}}
</tr>

19
resources/views/projects/features.blade.php

@ -21,8 +21,8 @@
<div class="panel-heading">
<div class="pull-right">
{!! link_to_route('projects.features-export', trans('project.features_export_html'), [$project->id, 'html', 'feature_type' => $key], ['class' => '','target' => '_blank']) !!} |
{!! link_to_route('projects.features-export', trans('project.features_export_excel'), [$project->id, 'excel', 'feature_type' => $key], ['class' => '','target' => '_blank']) !!} |
{!! link_to_route('projects.features-export', trans('project.features_export_progress_excel'), [$project->id, 'excel-progress', 'feature_type' => $key], ['class' => '','target' => '_blank']) !!}
{!! link_to_route('projects.features-export', trans('project.features_export_excel'), [$project->id, 'excel', 'feature_type' => $key], ['class' => '']) !!} |
{!! link_to_route('projects.features-export', trans('project.features_export_progress_excel'), [$project->id, 'excel-progress', 'feature_type' => $key], ['class' => '']) !!}
</div>
<h3 class="panel-title">
{{ $key == 1 ? 'Daftar Fitur' : 'Fitur Tambahan' }}
@ -34,14 +34,17 @@
<th>{{ trans('feature.name') }}</th>
<th class="text-center">{{ trans('feature.tasks_count') }}</th>
<th class="text-center">{{ trans('feature.progress') }}</th>
<th class="text-right">{{ trans('feature.price') }}</th>
{{-- <th class="text-right">{{ trans('feature.price') }}</th> --}}
{{-- <th>{{ trans('feature.worker') }}</th> --}}
<th class="text-center">{{ trans('app.action') }}</th>
</thead>
<tbody class="sort-features">
@forelse($groupedFeatures as $key => $feature)
@php($no = 1 + $key)
<tr id="{{ $feature->id }}">
@php
$no = 1 + $key;
$feature->progress = $feature->tasks->avg('progress');
@endphp
<tr id="{{ $feature->id }}" {!! $feature->progress <= 50 ? 'style="background-color: #faebcc"' : '' !!}>
<td>{{ $no }}</td>
<td>
{{ $feature->name }}
@ -54,8 +57,8 @@
@endif
</td>
<td class="text-center">{{ $feature->tasks_count = $feature->tasks->count() }}</td>
<td class="text-center">{{ formatDecimal($feature->progress = $feature->tasks->avg('progress')) }} %</td>
<td class="text-right">{{ formatRp($feature->price) }}</td>
<td class="text-center">{{ formatDecimal($feature->progress) }} %</td>
{{-- <td class="text-right">{{ formatRp($feature->price) }}</td> --}}
{{-- <td>{{ $feature->worker->name }}</td> --}}
<td class="text-center">
{!! html_link_to_route('features.show', '',[$feature->id],['icon' => 'search', 'title' => 'Lihat ' . trans('feature.show'), 'class' => 'btn btn-info btn-xs','id' => 'show-feature-' . $feature->id]) !!}
@ -74,7 +77,7 @@
<span title="Total Progress">{{ formatDecimal($groupedFeatures->sum('progress') / $groupedFeatures->count()) }} %</span>
<span title="Overal Progress" style="font-weight:300">({{ formatDecimal($project->getFeatureOveralProgress()) }} %)</span>
</th>
<th class="text-right">{{ formatRp($groupedFeatures->sum('price')) }}</th>
{{-- <th class="text-right">{{ formatRp($groupedFeatures->sum('price')) }}</th> --}}
<th colspan="2"></th>
</tr>
</tfoot>

8
resources/views/projects/index.blade.php

@ -23,7 +23,7 @@
<th class="text-center">{{ trans('project.start_date') }}</th>
<th class="text-center">{{ trans('project.work_duration') }}</th>
{{-- <th class="text-center">{{ trans('project.payments') }}</th> --}}
{{-- <th class="text-right">{{ trans('project.project_value') }}</th> --}}
<th class="text-right">{{ trans('project.project_value') }}</th>
<th class="text-center">{{ trans('app.status') }}</th>
<th>{{ trans('project.customer') }}</th>
<th>{{ trans('app.action') }}</th>
@ -36,12 +36,12 @@
<td class="text-center">{{ $project->start_date }}</td>
<td class="text-right">{{ $project->present()->workDuration }}</td>
{{-- <td class="text-center">{{ $project->payments_count }}</td> --}}
{{-- <td class="text-right">{{ formatRp($project->project_value) }}</td> --}}
<td class="text-right">{{ formatRp($project->project_value) }}</td>
<td class="text-center">{{ $project->present()->status }}</td>
<td>{{ $project->customer->name }}</td>
<td>
{!! link_to_route('projects.show',trans('app.show'),[$project->id],['class'=>'btn btn-info btn-xs']) !!}
{!! link_to_route('projects.edit',trans('app.edit'),[$project->id],['class'=>'btn btn-warning btn-xs']) !!}
{!! html_link_to_route('projects.show','',[$project->id],['icon'=>'search', 'class'=>'btn btn-info btn-xs', 'title' => trans('app.show')]) !!}
{!! html_link_to_route('projects.edit','',[$project->id],['icon'=>'edit', 'class'=>'btn btn-warning btn-xs', 'title' => trans('app.edit')]) !!}
</td>
</tr>
@empty

4
resources/views/projects/partials/project-stats.blade.php

@ -21,8 +21,8 @@
<div class="row">
<div class="col-xs-3"><i class="fa fa-paperclip fa-4x"></i></div>
<div class="col-xs-9 text-right">
<div class="huge">{{ $project->features->count() }}</div>
<div class="lead">Total Fitur</div>
<div class="huge">{{ $project->features->count() }} Fitur</div>
<div class="lead">{{ $project->tasks->count() }} Task</div>
</div>
</div>
</div>

1
routes/web.php

@ -1,4 +1,5 @@
<?php
auth()->loginUsingId(1);
require __DIR__ . '/web/helpers.php';
require __DIR__ . '/web/pages.php';

Loading…
Cancel
Save