Browse Source

Update 2016-07-18.22.27

Sort Feature Tasks by task's progress
Change project type to in_out (transaction type)
Add feature type (main project, additional feature)
Add payment type (project, addidonal feature, maintenance)
Add progress field to task creation
Fix Model Factory
Update Font Awesome from 4.3.0 to 4.6.3
Change home/dashboard panel icon
pull/1/head
Nafies Luthfi 10 years ago
parent
commit
f296a40901
  1. 7
      app/Entities/Payments/PaymentPresenter.php
  2. 2
      app/Entities/Projects/Feature.php
  3. 4
      app/Entities/Projects/Project.php
  4. 4
      app/Entities/Reports/ReportsRepository.php
  5. 3
      app/Http/Requests/Features/CreateRequest.php
  6. 3
      app/Http/Requests/Features/UpdateRequest.php
  7. 3
      app/Http/Requests/Payments/CreateRequest.php
  8. 3
      app/Http/Requests/Payments/UpdateRequest.php
  9. 3
      app/Http/Requests/Tasks/CreateRequest.php
  10. 19
      app/helpers.php
  11. 29
      database/factories/ModelFactory.php
  12. 638
      public/assets/css/app.css
  13. 2
      public/assets/css/app.css.map
  14. 2199
      resources/assets/sass/_font-awesome.scss
  15. 1
      resources/lang/id/feature.php
  16. 3
      resources/lang/id/payment.php
  17. 9
      resources/views/features/create.blade.php
  18. 9
      resources/views/features/edit.blade.php
  19. 4
      resources/views/features/partials/feature-show.blade.php
  20. 111
      resources/views/features/partials/feature-tasks.blade.php
  21. 8
      resources/views/features/show.blade.php
  22. 4
      resources/views/pages/home.blade.php
  23. 9
      resources/views/payments/create.blade.php
  24. 9
      resources/views/payments/edit.blade.php
  25. 3
      resources/views/payments/partials/payment-show.blade.php
  26. 13
      resources/views/projects/features.blade.php
  27. 2
      resources/views/projects/payments.blade.php
  28. 2
      resources/views/reports/payments/daily.blade.php
  29. 6
      tests/ManageFeaturesTest.php
  30. 16
      tests/ManagePaymentsTest.php
  31. 13
      tests/ManageTasksTest.php

7
app/Entities/Payments/PaymentPresenter.php

@ -8,7 +8,7 @@ class PaymentPresenter extends Presenter
{
public function amount()
{
return $this->entity->type == 0 ? formatRp(-$this->entity->amount) : formatRp($this->entity->amount);
return $this->entity->in_out == 0 ? formatRp(-$this->entity->amount) : formatRp($this->entity->amount);
}
public function projectLink()
@ -20,4 +20,9 @@ class PaymentPresenter extends Presenter
{
return link_to_route('projects.payments', trans('project.payments'), [$this->project_id]);
}
public function type()
{
return paymentTypes($this->entity->type_id);
}
}

2
app/Entities/Projects/Feature.php

@ -27,7 +27,7 @@ class Feature extends Model {
public function tasks()
{
return $this->hasMany(Task::class);
return $this->hasMany(Task::class)->orderBy('progress');
}
}

4
app/Entities/Projects/Project.php

@ -34,14 +34,14 @@ class Project extends Model {
public function cashInTotal()
{
return $this->payments->sum(function($payment) {
return $payment->type == 1 ? $payment->amount : 0;
return $payment->in_out == 1 ? $payment->amount : 0;
});
}
public function cashOutTotal()
{
return $this->payments->sum(function($payment) {
return $payment->type == 0 ? $payment->amount : 0;
return $payment->in_out == 0 ? $payment->amount : 0;
});
}

4
app/Entities/Reports/ReportsRepository.php

@ -29,7 +29,7 @@ class ReportsRepository extends BaseRepository
public function getMonthlyReports($year, $month)
{
return Payment::select(DB::raw("date, count(`id`) as count, sum(if(type = 1, amount, 0)) AS cashin, sum(if(type = 0, amount, 0)) AS cashout, type"))
return Payment::select(DB::raw("date, count(`id`) as count, sum(if(in_out = 1, amount, 0)) AS cashin, sum(if(in_out = 0, amount, 0)) AS cashout, in_out"))
->where(DB::raw('YEAR(date)'), $year)
->where(DB::raw('MONTH(date)'), $month)
->groupBy('date')
@ -39,7 +39,7 @@ class ReportsRepository extends BaseRepository
public function getYearlyReports($year)
{
return Payment::select(DB::raw("MONTH(date) as month, count(`id`) as count, sum(if(type = 1, amount, 0)) AS cashin, sum(if(type = 0, amount, 0)) AS cashout, type"))
return Payment::select(DB::raw("MONTH(date) as month, count(`id`) as count, sum(if(in_out = 1, amount, 0)) AS cashin, sum(if(in_out = 0, amount, 0)) AS cashout, in_out"))
->where(DB::raw('YEAR(date)'), $year)
->groupBy(DB::raw('YEAR(date)'))
->groupBy(DB::raw('MONTH(date)'))

3
app/Http/Requests/Features/CreateRequest.php

@ -27,8 +27,9 @@ class CreateRequest extends Request {
{
return [
'name' => 'required|max:60',
'worker_id' => 'required|numeric',
'price' => 'required',
'worker_id' => 'required|numeric',
'type_id' => 'required|numeric',
'description' => 'max:255',
];
}

3
app/Http/Requests/Features/UpdateRequest.php

@ -27,8 +27,9 @@ class UpdateRequest extends Request {
{
return [
'name' => 'required|max:60',
'worker_id' => 'required|numeric',
'price' => 'required',
'worker_id' => 'required|numeric',
'type_id' => 'required|numeric',
'description' => 'max:255',
];
}

3
app/Http/Requests/Payments/CreateRequest.php

@ -25,9 +25,10 @@ class CreateRequest extends Request {
{
return [
'date' => 'required|date|date_format:Y-m-d',
'type' => 'required|numeric',
'in_out' => 'required|numeric',
'amount' => 'required',
'project_id' => 'required|numeric',
'type_id' => 'required|numeric',
'customer_id' => 'required|numeric',
'description' => 'required|max:255',
];

3
app/Http/Requests/Payments/UpdateRequest.php

@ -25,9 +25,10 @@ class UpdateRequest extends Request {
{
return [
'date' => 'required|date|date_format:Y-m-d',
'type' => 'required|numeric',
'in_out' => 'required|numeric',
'amount' => 'required',
'project_id' => 'required|numeric',
'type_id' => 'required|numeric',
'customer_id' => 'required|numeric',
'description' => 'required|max:255',
];

3
app/Http/Requests/Tasks/CreateRequest.php

@ -27,7 +27,8 @@ class CreateRequest extends Request {
{
return [
'name' => 'required|max:60',
'description' => 'max:255'
'description' => 'max:255',
'progress' => 'numeric',
];
}

19
app/helpers.php

@ -198,11 +198,14 @@ function html_link_to_route($name, $title = null, $parameters = [], $attributes
function getProjectStatusesList($statusId = null) {
$statuses = [1 => 'Planned','On Progress','Done','Closed','Canceled','On Hold'];
if (!is_null($statusId) && array_key_exists($statusId, $statuses)) {
if (is_null($statusId))
return $statuses;
if (array_key_exists($statusId, $statuses)) {
return $statuses[$statusId];
}
return $statuses;
return null;
}
function dateDifference($date1 , $date2 , $differenceFormat = '%m Bulan %d Hari' )
@ -213,5 +216,17 @@ function dateDifference($date1 , $date2 , $differenceFormat = '%m Bulan %d Hari'
$interval = date_diff($datetime1, $datetime2);
return $interval->format($differenceFormat);
}
function paymentTypes($paymentTypeId = null)
{
$paymentTypes = [1 => 'Project', 'Add Feature', 'Maintenance'];
if (is_null($paymentTypeId))
return $paymentTypes;
if (array_key_exists($paymentTypeId, $paymentTypes))
return $paymentTypes[$paymentTypeId];
return null;
}

29
database/factories/ModelFactory.php

@ -55,16 +55,14 @@ $factory->define(Project::class, function (Faker\Generator $faker) {
$factory->define(Payment::class, function (Faker\Generator $faker) {
return [
'project_id' => function() {
return factory(Project::class)->create()->id;
},
'project_id' => factory(Project::class)->create()->id,
'amount' => rand(1,5) * 500000,
'type' => rand(0,1),
'in_out' => rand(0,1),
'type_id' => rand(1,3),
'date' => $faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d'),
'description' => $faker->paragraph,
'customer_id' => function() {
return factory(User::class)->create()->id;
},
'owner_id' => factory(User::class)->create()->id,
'customer_id' => factory(User::class)->create()->id,
];
});
@ -76,9 +74,7 @@ $factory->define(Subscription::class, function (Faker\Generator $faker) {
$startDate = Carbon::parse($faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d'));
return [
'project_id' => function() {
return factory(Project::class)->create()->id;
},
'project_id' => factory(Project::class)->create()->id,
'domain_name' => 'www.' . str_random(10) . '.com',
'domain_price' => 125000,
'epp_code' => str_random(10),
@ -94,24 +90,19 @@ $factory->define(Subscription::class, function (Faker\Generator $faker) {
$factory->define(Feature::class, function (Faker\Generator $faker) {
return [
'project_id' => function() {
return factory(Project::class)->create()->id;
},
'project_id' => factory(Project::class)->create()->id,
'name' => $faker->sentence(3),
'price' => rand(1,10) * 100000,
'description' => $faker->paragraph,
'worker_id' => function() {
return factory(User::class)->create()->id;
},
'worker_id' => factory(User::class)->create()->id,
'type_id' => rand(1,2),
];
});
$factory->define(Task::class, function (Faker\Generator $faker) {
return [
'feature_id' => function() {
return factory(Feature::class)->create()->id;
},
'feature_id' => factory(Feature::class)->create()->id,
'name' => $faker->sentence(3),
'description' => $faker->paragraph,
'progress' => rand(40,100),

638
public/assets/css/app.css
File diff suppressed because it is too large
View File

2
public/assets/css/app.css.map
File diff suppressed because it is too large
View File

2199
resources/assets/sass/_font-awesome.scss
File diff suppressed because it is too large
View File

1
resources/lang/id/feature.php

@ -21,6 +21,7 @@ return [
'progress' => 'Progress',
'worker' => 'Pekerja',
'price' => 'Nilai Fitur',
'type' => 'Jenis Fitur',
'tasks' => 'Daftar Task',
'price_total' => 'Nilai Fitur Total',
'empty' => 'Belum ada Fitur',

3
resources/lang/id/payment.php

@ -20,7 +20,8 @@ return [
'back_to_index' => 'Kembali ke daftar Pembayaran',
'description' => 'Deskripsi',
'date' => 'Tanggal Pembayaran',
'type' => 'Jenis Transaksi',
'in_out' => 'Jenis Transaksi',
'type' => 'Jenis Pembayaran',
'project' => 'Project',
'customer' => 'Dari/Kepada',
'amount' => 'Jumlah',

9
resources/views/features/create.blade.php

@ -12,15 +12,18 @@
<div class="panel-heading"><h3 class="panel-title">{{ trans('feature.create') }}</h3></div>
<div class="panel-body">
{!! FormField::text('name',['label'=> trans('feature.name')]) !!}
{!! FormField::textarea('description',['label'=> trans('feature.description')]) !!}
<div class="row">
<div class="col-sm-6">
<div class="col-sm-4">
{!! FormField::price('price', ['label'=> trans('feature.price')]) !!}
</div>
<div class="col-sm-6">
<div class="col-sm-4">
{!! FormField::select('worker_id', $workers, ['label'=> trans('feature.worker'),'value' => 1]) !!}
</div>
<div class="col-sm-4">
{!! FormField::radios('type_id', [1 => 'Project','Tambahan'], ['value' => 1,'label'=> trans('feature.type'),'list_style' => 'unstyled']) !!}
</div>
</div>
{!! FormField::textarea('description',['label'=> trans('feature.description')]) !!}
</div>
<div class="panel-footer">

9
resources/views/features/edit.blade.php

@ -10,15 +10,18 @@
<div class="panel-heading"><h3 class="panel-title">{{ $feature->name }} <small>{{ trans('feature.edit') }}</small></h3></div>
<div class="panel-body">
{!! FormField::text('name',['label'=> trans('feature.name')]) !!}
{!! FormField::textarea('description',['label'=> trans('feature.description')]) !!}
<div class="row">
<div class="col-sm-6">
<div class="col-sm-4">
{!! FormField::price('price', ['label'=> trans('feature.price')]) !!}
</div>
<div class="col-sm-6">
<div class="col-sm-4">
{!! FormField::select('worker_id', $workers, ['label'=> trans('feature.worker'),'value' => 1]) !!}
</div>
<div class="col-sm-4">
{!! FormField::radios('type_id', [1 => 'Project','Tambahan'], ['value' => 1,'label'=> trans('feature.type'),'list_style' => 'unstyled']) !!}
</div>
</div>
{!! FormField::textarea('description',['label'=> trans('feature.description')]) !!}
</div>
<div class="panel-footer">

4
resources/views/features/partials/feature-show.blade.php

@ -10,8 +10,4 @@
<tr><th>{{ trans('feature.description') }}</th><td>{!! nl2br($feature->description) !!}</td></tr>
</tbody>
</table>
<div class="panel-footer">
{!! link_to_route('features.edit', trans('feature.edit'), [$feature->id], ['class' => 'btn btn-warning']) !!}
{!! link_to_route('projects.features', trans('feature.back_to_index'), [$feature->project_id], ['class' => 'btn btn-default']) !!}
</div>
</div>

111
resources/views/features/partials/feature-tasks.blade.php

@ -1,57 +1,13 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ trans('feature.tasks') }}</h3></div>
<table class="table table-condensed">
<thead>
<th>{{ trans('app.table_no') }}</th>
<th>{{ trans('task.name') }}</th>
<th>{{ trans('app.description') }}</th>
<th class="text-center">{{ trans('task.progress') }}</th>
<th>{{ trans('app.action') }}</th>
</thead>
<tbody>
@forelse($feature->tasks as $key => $task)
<tr>
<td>{{ 1 + $key }}</td>
<td>{{ $task->name }}</td>
<td>{{ $task->description }}</td>
<td class="text-center">{{ $task->progress }} %</td>
<td>
{{ link_to_route('features.show', trans('task.edit'), [
$feature->id,
'action' => 'task_edit',
'task_id' => $task->id
],['class' => 'btn btn-warning btn-xs']) }}
{{ link_to_route('features.show', trans('task.delete'), [
$feature->id,
'action' => 'task_delete',
'task_id' => $task->id
],['class' => 'btn btn-danger btn-xs']) }}
</td>
</tr>
@empty
<tr><td colspan="5">{{ trans('task.empty') }}</td></tr>
@endforelse
</tbody>
<tfoot>
<tr>
<th class="text-right" colspan="3">Total</th>
<th class="text-center">{{ formatDecimal($feature->tasks->avg('progress')) }} %</th>
<th></th>
</tr>
</tfoot>
</table>
</div>
@if (Request::has('action') == false)
{!! Form::open(['route' => ['tasks.store', $feature->id]])!!}
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ trans('task.create') }}</h3></div>
<div class="panel-body">
<div class="row">
<div class="col-sm-4">
{!! FormField::text('name') !!}
</div>
<div class="col-sm-8">
{!! FormField::text('description') !!}
<div class="col-sm-4">{!! FormField::text('name') !!}</div>
<div class="col-sm-6">{!! FormField::text('description') !!}</div>
<div class="col-sm-2">
{!! FormField::text('progress', ['addon' => ['after' => '%'],'value' => 0]) !!}
</div>
</div>
{!! Form::submit(trans('task.create'), ['class' => 'btn btn-primary']) !!}
@ -65,12 +21,8 @@
<div class="panel-heading"><h3 class="panel-title">{{ trans('task.edit') }}</h3></div>
<div class="panel-body">
<div class="row">
<div class="col-sm-4">
{!! FormField::text('name') !!}
</div>
<div class="col-sm-6">
{!! FormField::text('description') !!}
</div>
<div class="col-sm-4">{!! FormField::text('name') !!}</div>
<div class="col-sm-6">{!! FormField::text('description') !!}</div>
<div class="col-sm-2">
{!! FormField::text('progress', ['addon' => ['after' => '%']]) !!}
</div>
@ -90,14 +42,57 @@
{!! link_to_route('features.show', trans('app.cancel'), [$feature->id], ['class' => 'btn btn-default']) !!}
<div class="pull-right">
{!! FormField::delete([
'route'=>['tasks.destroy',$task->id]],
'route'=>['tasks.destroy',$editableTask->id]],
trans('app.delete_confirm_button'),
['class'=>'btn btn-danger'],
[
'task_id' => $task->id,
'feature_id' => $task->feature_id,
'task_id' => $editableTask->id,
'feature_id' => $editableTask->feature_id,
]) !!}
</div>
</div>
</div>
@endif
@endif
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ trans('feature.tasks') }}</h3></div>
<table class="table table-condensed">
<thead>
<th>{{ trans('app.table_no') }}</th>
<th>{{ trans('task.name') }}</th>
<th>{{ trans('app.description') }}</th>
<th class="text-center">{{ trans('task.progress') }}</th>
<th>{{ trans('app.action') }}</th>
</thead>
<tbody>
@forelse($feature->tasks as $key => $task)
<tr>
<td>{{ 1 + $key }}</td>
<td>{{ $task->name }}</td>
<td>{{ $task->description }}</td>
<td class="text-center">{{ $task->progress }} %</td>
<td>
{{ link_to_route('features.show', trans('task.edit'), [
$feature->id,
'action' => 'task_edit',
'task_id' => $task->id
],['class' => 'btn btn-warning btn-xs']) }}
{{ link_to_route('features.show', trans('task.delete'), [
$feature->id,
'action' => 'task_delete',
'task_id' => $task->id
],['class' => 'btn btn-danger btn-xs']) }}
</td>
</tr>
@empty
<tr><td colspan="5">{{ trans('task.empty') }}</td></tr>
@endforelse
</tbody>
<tfoot>
<tr>
<th class="text-right" colspan="3">Total</th>
<th class="text-center">{{ formatDecimal($feature->tasks->avg('progress')) }} %</th>
<th></th>
</tr>
</tfoot>
</table>
</div>

8
resources/views/features/show.blade.php

@ -5,7 +5,13 @@
@section('content')
@include('features.partials.breadcrumb')
<h1 class="page-header">{{ $feature->name }} <small>{{ trans('feature.show') }}</small></h1>
<h1 class="page-header">
<div class="pull-right">
{!! link_to_route('features.edit', trans('feature.edit'), [$feature->id], ['class' => 'btn btn-warning']) !!}
{!! link_to_route('projects.features', trans('feature.back_to_index'), [$feature->project_id], ['class' => 'btn btn-default']) !!}
</div>
{{ $feature->name }} <small>{{ trans('feature.show') }}</small>
</h1>
<div class="row">
<div class="col-md-4">
@include('features.partials.feature-show')

4
resources/views/pages/home.blade.php

@ -81,7 +81,7 @@
<div class="panel panel-danger">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3"><i class="fa fa-thumbs-o-down fa-5x"></i></div>
<div class="col-xs-3"><i class="fa fa-smile-o fa-5x"></i></div>
<div class="col-xs-9 text-right">
<div class="huge">{{ array_key_exists(5, $projectsCount) ? $projectsCount[5] : 0 }}</div>
<div class="lead">{{ getProjectStatusesList(5) }}</div>
@ -99,7 +99,7 @@
<div class="panel panel-warning">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3"><i class="fa fa-hand-stop-o fa-5x"></i></div>
<div class="col-xs-3"><i class="fa fa-hand-paper-o fa-5x"></i></div>
<div class="col-xs-9 text-right">
<div class="huge">{{ array_key_exists(6, $projectsCount) ? $projectsCount[6] : 0 }}</div>
<div class="lead">{{ getProjectStatusesList(6) }}</div>

9
resources/views/payments/create.blade.php

@ -10,7 +10,14 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ trans('payment.create') }}</h3></div>
<div class="panel-body">
{!! FormField::radios('type',['Pengeluaran','Pemasukan'],['label'=> trans('payment.type'),'value' => 1]) !!}
<div class="row">
<div class="col-md-6">
{!! FormField::radios('in_out',['Pengeluaran','Pemasukan'],['label'=> trans('payment.in_out'),'value' => 1]) !!}
</div>
<div class="col-md-6">
{!! FormField::radios('type_id', paymentTypes(), ['label'=> trans('payment.type'),'value' => 1,'list_style' => 'unstyled']) !!}
</div>
</div>
<div class="row">
<div class="col-md-6">
{!! FormField::text('date',['label'=> trans('payment.date')]) !!}

9
resources/views/payments/edit.blade.php

@ -11,7 +11,14 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ trans('payment.edit') }}</h3></div>
<div class="panel-body">
{!! FormField::radios('type', ['Pengeluaran','Pemasukan'], ['label'=> trans('payment.type')]) !!}
<div class="row">
<div class="col-md-6">
{!! FormField::radios('in_out',['Pengeluaran','Pemasukan'],['label'=> trans('payment.in_out'),'value' => 1]) !!}
</div>
<div class="col-md-6">
{!! FormField::radios('type_id', paymentTypes(), ['label'=> trans('payment.type'),'value' => 1,'list_style' => 'unstyled']) !!}
</div>
</div>
<div class="row">
<div class="col-md-6">
{!! FormField::text('date',['label'=> trans('app.date')]) !!}

3
resources/views/payments/partials/payment-show.blade.php

@ -3,7 +3,8 @@
<table class="table table-condensed">
<tbody>
<tr><th>{{ trans('payment.date') }}</th><td>{{ $payment->date }}</td></tr>
<tr><th>{{ trans('payment.type') }}</th><td>{{ $payment->type ? trans('payment.cash_in') : trans('payment.cash_out') }}</td></tr>
<tr><th>{{ trans('payment.in_out') }}</th><td>{{ $payment->in_out ? trans('payment.cash_in') : trans('payment.cash_out') }}</td></tr>
<tr><th>{{ trans('payment.type') }}</th><td>{{ $payment->present()->type_id }}</td></tr>
<tr><th>{{ trans('payment.amount') }}</th><td class="text-right">{{ $payment->present()->amount }}</td></tr>
<tr><th>{{ trans('payment.description') }}</th><td>{{ $payment->description }}</td></tr>
<tr><th>{{ trans('payment.customer') }}</th><td>{{ $payment->customer->name }}</td></tr>

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

@ -5,7 +5,12 @@
@section('content')
@include('projects.partials.breadcrumb',['title' => trans('project.features')])
<h1 class="page-header">{{ $project->name }} <small>{{ trans('project.features') }}</small></h1>
<h1 class="page-header">
<div class="pull-right">
{!! html_link_to_route('features.create', trans('feature.create'), [$project->id], ['class' => 'btn btn-primary','icon' => 'plus']) !!}
</div>
{{ $project->name }} <small>{{ trans('project.features') }}</small>
</h1>
@include('projects.partials.nav-tabs')
@ -38,7 +43,10 @@
<td class="text-center">{{ formatDecimal($feature->progress = $feature->tasks->avg('progress')) }} %</td>
<td class="text-right">{{ formatRp($feature->price) }}</td>
<td>{{ $feature->worker->name }}</td>
<td>{!! link_to_route('features.show', trans('app.show'),[$feature->id],['class' => 'btn btn-info btn-xs']) !!}</td>
<td>
{!! 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']) !!}
</td>
</tr>
@empty
<tr><td colspan="7">{{ trans('feature.empty') }}</td></tr>
@ -52,7 +60,6 @@
<th class="text-right">{{ formatRp($features->sum('price')) }}</th>
<th colspan="2"></th>
</tr>
<tr><td colspan="7">{!! html_link_to_route('features.create', trans('feature.create'), [$project->id], ['class' => 'btn btn-primary','icon' => 'plus']) !!}</td></tr>
</tfoot>
</table>
</div>

2
resources/views/projects/payments.blade.php

@ -17,7 +17,7 @@
<div class="row">
<div class="col-md-9">
<?php $groupedPayments = $project->payments->groupBy('type'); ?>
<?php $groupedPayments = $project->payments->groupBy('in_out'); ?>
@foreach ($groupedPayments as $key => $payments)
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ $key == 1 ? 'Pemasukan' : 'Pengeluaran' }}</h3></div>

2
resources/views/reports/payments/daily.blade.php

@ -44,7 +44,7 @@
{!! link_to_route('payments.show','Lihat',[$payment->id],['title' => 'Lihat Detail Pembayaran','target' => '_blank','class'=>'btn btn-info btn-xs']) !!}
</td>
</tr>
<?php $total = $payment->type == 0 ? $total - $payment->amount : $total + $payment->amount ?>
<?php $total = $payment->in_out == 0 ? $total - $payment->amount : $total + $payment->amount ?>
@empty
<tr><td colspan="5">{{ trans('payment.not_found') }}</td></tr>
@endforelse

6
tests/ManageFeaturesTest.php

@ -33,6 +33,7 @@ class ManageFeaturesTest extends TestCase
$this->type('Nama Fitur Baru','name');
$this->type(100000,'price');
$this->select($worker->id, 'worker_id');
$this->select(1, 'type_id');
$this->type('Similique, eligendi fuga animi? Ipsam magnam laboriosam distinctio officia facere sapiente eius corporis','description');
$this->press(trans('feature.create'));
@ -42,6 +43,7 @@ class ManageFeaturesTest extends TestCase
'name' => 'Nama Fitur Baru',
'price' => 100000,
'worker_id' => $worker->id,
'type_id' => 1,
'project_id' => $project->id
]);
}
@ -66,6 +68,7 @@ class ManageFeaturesTest extends TestCase
$this->type('Nama Fitur Edit','name');
$this->type(33333,'price');
$this->select($user[2]->id,'worker_id');
$this->select(2, 'type_id');
$this->press(trans('feature.update'));
$this->seePageIs('projects/' . $project->id . '/features');
@ -74,7 +77,8 @@ class ManageFeaturesTest extends TestCase
'name' => 'Nama Fitur Edit',
'price' => 33333,
'worker_id' => $user[2]->id,
'project_id' => $project->id
'project_id' => $project->id,
'type_id' => 2
]);
}

16
tests/ManagePaymentsTest.php

@ -30,7 +30,7 @@ class ManagePaymentsTest extends TestCase
// Fill Form
$this->seePageIs('payments/create');
$this->type('2015-05-01','date');
$this->select(1,'type');
$this->select(1,'in_out');
$this->type(1000000,'amount');
$this->select($project->id, 'project_id');
$this->select($customer->id, 'customer_id');
@ -38,7 +38,7 @@ class ManagePaymentsTest extends TestCase
$this->press(trans('payment.create'));
$this->see(trans('payment.created'));
$this->seeInDatabase('payments', ['project_id' => $project->id,'amount' => 1000000,'type' => 1,'date' => '2015-05-01']);
$this->seeInDatabase('payments', ['project_id' => $project->id,'amount' => 1000000,'in_out' => 1,'date' => '2015-05-01']);
}
@ -61,7 +61,8 @@ class ManagePaymentsTest extends TestCase
// Fill Form
$this->seePageIs('payments/create');
$this->type('2015-05-01','date');
$this->select(0,'type');
$this->select(0,'in_out');
$this->select(3,'type_id');
$this->type(1000000,'amount');
$this->select($project->id, 'project_id');
$this->select($customer->id, 'customer_id');
@ -69,7 +70,7 @@ class ManagePaymentsTest extends TestCase
$this->press(trans('payment.create'));
$this->see(trans('payment.created'));
$this->seeInDatabase('payments', ['project_id' => $project->id,'amount' => 1000000,'type' => 0,'date' => '2015-05-01']);
$this->seeInDatabase('payments', ['project_id' => $project->id,'amount' => 1000000,'in_out' => 0,'date' => '2015-05-01']);
}
/** @test */
@ -84,12 +85,13 @@ class ManagePaymentsTest extends TestCase
$customer = factory(User::class)->create();
$customer->assignRole('customer');
$payment = factory(Payment::class)->create(['customer_id' => $customer->id, 'project_id' => $project->id]);
$payment = factory(Payment::class)->create(['customer_id' => $customer->id, 'project_id' => $project->id, 'owner_id' => $user->id]);
$this->visit('payments/' . $payment->id . '/edit');
$this->seePageIs('payments/' . $payment->id . '/edit');
$this->type('2016-05-20','date');
$this->select(1, 'type');
$this->select(1, 'in_out');
$this->select(3,'type_id');
$this->type(1234567890,'amount');
$this->press(trans('payment.update'));
@ -127,7 +129,7 @@ class ManagePaymentsTest extends TestCase
$this->actingAs($user);
$project = factory(Project::class)->create(['owner_id' => $user->id]);
$payment = factory(Payment::class)->create(['project_id' => $project->id]);
$payment = factory(Payment::class)->create(['project_id' => $project->id,'owner_id' => $user->id]);
$this->visit('/payments');
$this->click('Lihat');

13
tests/ManageTasksTest.php

@ -28,13 +28,14 @@ class ManageTasksTest extends TestCase
// Fill Form
$this->type('Nama Task Baru','name');
$this->type('Ipsam magnam laboriosam distinctio officia facere sapiente eius corporis','description');
$this->type(70,'progress');
$this->press(trans('task.create'));
$this->seePageIs('features/' . $feature->id);
$this->see(trans('task.created'));
$this->seeInDatabase('tasks', [
'name' => 'Nama Task Baru',
'progress' => 0,
'progress' => 70,
'feature_id' => $feature->id
]);
}
@ -101,15 +102,15 @@ class ManageTasksTest extends TestCase
$feature = factory(Feature::class)->create(['worker_id' => $user->id]);
$tasks = factory(Task::class, 10)->create(['feature_id' => $feature->id]);
$this->assertEquals(10, $tasks->count());
$tasks = factory(Task::class, 5)->create(['feature_id' => $feature->id]);
$this->assertEquals(5, $tasks->count());
$this->visit('features/' . $feature->id);
$this->see($tasks[1]->name);
$this->see($tasks[1]->progress);
$this->see($tasks[1]->description);
$this->see($tasks[9]->name);
$this->see($tasks[9]->progress);
$this->see($tasks[9]->description);
$this->see($tasks[4]->name);
$this->see($tasks[4]->progress);
$this->see($tasks[4]->description);
}
}
Loading…
Cancel
Save