Browse Source

Added payment search by customer id

Added date picker on project create and edit page
Removed autonumeric js from payment create form
Added create new feature on feature detail page
Fixed html title on project features export in html format
Fixed some lang files
pull/1/head
Nafies Luthfi 8 years ago
parent
commit
0722034c48
  1. 13
      app/Entities/Payments/PaymentsRepository.php
  2. 4
      app/Http/Controllers/PaymentsController.php
  3. 2
      resources/lang/id/feature.php
  4. 12
      resources/lang/id/project.php
  5. 1
      resources/views/features/show.blade.php
  6. 6
      resources/views/payments/create.blade.php
  7. 20
      resources/views/projects/create.blade.php
  8. 20
      resources/views/projects/edit.blade.php
  9. 4
      resources/views/projects/features-export-html.blade.php
  10. 4
      resources/views/projects/features.blade.php
  11. 6
      resources/views/subscriptions/partials/subscription-show.blade.php
  12. 2
      tests/Feature/Payments/ManagePaymentsTest.php
  13. 26
      tests/Feature/Payments/PaymentSearchTest.php

13
app/Entities/Payments/PaymentsRepository.php

@ -16,11 +16,18 @@ class PaymentsRepository extends BaseRepository
parent::__construct($model); parent::__construct($model);
} }
public function getAll($q)
public function getPayments($queryStrings)
{ {
return $this->model->orderBy('date','desc') return $this->model->orderBy('date','desc')
->whereHas('project', function($query) use ($q) {
$query->where('name', 'like', '%' . $q . '%');
->whereHas('project', function($query) use ($queryStrings) {
if (isset($queryStrings['q'])) {
$query->where('name', 'like', '%' . $queryStrings['q'] . '%');
}
})
->where(function ($query) use ($queryStrings) {
if (isset($queryStrings['customer_id'])) {
$query->where('customer_id', $queryStrings['customer_id']);
}
}) })
->with('customer','project') ->with('customer','project')
->whereOwnerId(auth()->id()) ->whereOwnerId(auth()->id())

4
app/Http/Controllers/PaymentsController.php

@ -19,9 +19,9 @@ class PaymentsController extends Controller {
$this->repo = $repo; $this->repo = $repo;
} }
public function index(Request $req)
public function index(Request $request)
{ {
$payments = $this->repo->getAll($req->get('q'));
$payments = $this->repo->getPayments($request->only('customer_id'));
return view('payments.index',compact('payments')); return view('payments.index',compact('payments'));
} }

2
resources/lang/id/feature.php

@ -20,7 +20,7 @@ return [
'description' => 'Deskripsi', 'description' => 'Deskripsi',
'progress' => 'Progress', 'progress' => 'Progress',
'worker' => 'Pekerja', 'worker' => 'Pekerja',
'price' => 'Nilai Fitur',
'price' => 'Biaya Pengerjaan',
'type' => 'Jenis Fitur', 'type' => 'Jenis Fitur',
'tasks' => 'Daftar Task', 'tasks' => 'Daftar Task',
'price_total' => 'Nilai Fitur Total', 'price_total' => 'Nilai Fitur Total',

12
resources/lang/id/project.php

@ -23,10 +23,6 @@ return [
'cash_in_total' => 'Total Pemasukan', 'cash_in_total' => 'Total Pemasukan',
'cash_out_total' => 'Total Pengeluaran', 'cash_out_total' => 'Total Pengeluaran',
'customer' => 'Customer', 'customer' => 'Customer',
'features' => 'Daftar Fitur',
'features_export_html' => 'Export HTML',
'features_export_excel' => 'Export Excel',
'features_export_progress_excel' => 'Export Progress',
'subscriptions' => 'Langganan', 'subscriptions' => 'Langganan',
'worker' => 'Pekerja', 'worker' => 'Pekerja',
'status' => 'Status Project', 'status' => 'Status Project',
@ -38,5 +34,11 @@ return [
'back_to_index' => 'Kembali ke daftar Project', 'back_to_index' => 'Kembali ke daftar Project',
// Attribute // Attribute
'files' => 'List Dokumen',
'files' => 'List Dokumen',
'features' => 'Daftar Item Pekerjaan',
// Actions
'features_export_html' => 'Export HTML',
'features_export_excel' => 'Export Excel',
'features_export_progress_excel' => 'Export Progress',
]; ];

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

@ -7,6 +7,7 @@
<h1 class="page-header"> <h1 class="page-header">
<div class="pull-right"> <div class="pull-right">
{!! html_link_to_route('features.create', trans('feature.create'), [$feature->project_id], ['class' => 'btn btn-success','icon' => 'plus']) !!}
{!! link_to_route('features.edit', trans('feature.edit'), [$feature->id], ['class' => 'btn btn-warning']) !!} {!! 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, '#' . $feature->id], ['class' => 'btn btn-default']) !!} {!! link_to_route('projects.features', trans('feature.back_to_index'), [$feature->project_id, '#' . $feature->id], ['class' => 'btn btn-default']) !!}
</div> </div>

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

@ -53,7 +53,6 @@
@section('ext_js') @section('ext_js')
{!! Html::script(url('assets/js/plugins/jquery.datetimepicker.js')) !!} {!! Html::script(url('assets/js/plugins/jquery.datetimepicker.js')) !!}
{!! Html::script(url('assets/js/plugins/autoNumeric.min.js')) !!}
@endsection @endsection
@section('script') @section('script')
@ -64,11 +63,6 @@
format:'Y-m-d', format:'Y-m-d',
closeOnDateSelect: true closeOnDateSelect: true
}); });
$('#amount').autoNumeric("init",{
aSep: '.',
aDec: ',',
mDec: '0'
});
})(); })();
</script> </script>
@endsection @endsection

20
resources/views/projects/create.blade.php

@ -44,4 +44,24 @@
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
@endsection
@section('ext_css')
{!! Html::style(url('assets/css/plugins/jquery.datetimepicker.css')) !!}
@endsection
@section('ext_js')
{!! Html::script(url('assets/js/plugins/jquery.datetimepicker.js')) !!}
@endsection
@section('script')
<script>
(function() {
$('#proposal_date').datetimepicker({
timepicker:false,
format:'Y-m-d',
closeOnDateSelect: true
});
})();
</script>
@endsection @endsection

20
resources/views/projects/edit.blade.php

@ -53,4 +53,24 @@
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
</div> </div>
@endsection
@section('ext_css')
{!! Html::style(url('assets/css/plugins/jquery.datetimepicker.css')) !!}
@endsection
@section('ext_js')
{!! Html::script(url('assets/js/plugins/jquery.datetimepicker.js')) !!}
@endsection
@section('script')
<script>
(function() {
$('#proposal_date,#start_date,#end_date').datetimepicker({
timepicker:false,
format:'Y-m-d',
closeOnDateSelect: true
});
})();
</script>
@endsection @endsection

4
resources/views/projects/features-export-html.blade.php

@ -9,7 +9,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
{{-- <meta http-equiv="X-UA-Compatible" content="IE=edge"> --}} {{-- <meta http-equiv="X-UA-Compatible" content="IE=edge"> --}}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{ $project->name }}</title>
<title>{{ trans('project.features') }} {{ $project->name }}</title>
{!! Html::style('assets/css/app.s.css') !!} {!! Html::style('assets/css/app.s.css') !!}
</head> </head>
<body style="font-family:'Liberation Serif'"> <body style="font-family:'Liberation Serif'">
@ -17,7 +17,7 @@
<h1 class="page-header text-center">{{ trans('project.features') }} {{ $project->name }}</h1> <h1 class="page-header text-center">{{ trans('project.features') }} {{ $project->name }}</h1>
@foreach($features as $key => $feature) @foreach($features as $key => $feature)
<h2 class="feature-title">{{ 1 + $key }}. {{ $feature->name }}</h2>
<h2 class="feature-title">{{ $feature->name }}</h2>
<table width="100%" class="table table-condensed table-bordered"> <table width="100%" class="table table-condensed table-bordered">
<tbody> <tbody>
<tr style="background-color: #ffd298"><th colspan="2">{{ trans('app.description') }}</th></tr> <tr style="background-color: #ffd298"><th colspan="2">{{ trans('app.description') }}</th></tr>

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

@ -7,8 +7,8 @@
<h1 class="page-header"> <h1 class="page-header">
<div class="pull-right"> <div class="pull-right">
{!! html_link_to_route('features.create', trans('feature.create'), [$project->id], ['class' => 'btn btn-primary','icon' => 'plus']) !!}
{!! html_link_to_route('features.add-from-other-project', trans('feature.add_from_other_project'), [$project->id], ['class' => 'btn btn-primary','icon' => 'plus']) !!}
{!! html_link_to_route('features.create', trans('feature.create'), [$project->id], ['class' => 'btn btn-success','icon' => 'plus']) !!}
{!! html_link_to_route('features.add-from-other-project', trans('feature.add_from_other_project'), [$project->id], ['class' => 'btn btn-default','icon' => 'plus']) !!}
</div> </div>
{{ $project->name }} <small>{{ trans('project.features') }}</small> {{ $project->name }} <small>{{ trans('project.features') }}</small>
</h1> </h1>

6
resources/views/subscriptions/partials/subscription-show.blade.php

@ -19,6 +19,12 @@
@endif @endif
</td> </td>
</tr> </tr>
<tr>
<td>{{ trans('subscription.project') }}</td>
<td>
{{ link_to_route('projects.subscriptions', $subscription->project->name, [$subscription->project_id], ['target' => '_blank']) }}
</td>
</tr>
<tr><td>{{ trans('subscription.remark') }}</td><td>{!! nl2br($subscription->remark) !!}</td></tr> <tr><td>{{ trans('subscription.remark') }}</td><td>{!! nl2br($subscription->remark) !!}</td></tr>
</tbody> </tbody>
</table> </table>

2
tests/Feature/ManagePaymentsTest.php → tests/Feature/Payments/ManagePaymentsTest.php

@ -1,6 +1,6 @@
<?php <?php
namespace Tests\Feature;
namespace Tests\Feature\Payments;
use App\Entities\Payments\Payment; use App\Entities\Payments\Payment;
use App\Entities\Projects\Project; use App\Entities\Projects\Project;

26
tests/Feature/Payments/PaymentSearchTest.php

@ -0,0 +1,26 @@
<?php
namespace Tests\Feature\Payments;
use App\Entities\Payments\Payment;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Tests\TestCase;
class PaymentSearchTest extends TestCase
{
/** @test */
public function user_can_find_payment_by_customer_id()
{
$admin = $this->adminUserSigningIn();
$payment = factory(Payment::class)->create(['owner_id' => $admin->id]);
$unShownPayment = factory(Payment::class)->create(['owner_id' => $admin->id]);
$this->visit(route('payments.index', ['customer_id' => $payment->customer_id]));
$this->seePageIs(route('payments.index', ['customer_id' => $payment->customer_id]));
$this->see($payment->project->name);
$this->dontSee($unShownPayment->project->name);
}
}
Loading…
Cancel
Save