From 0722034c487dff6a96c58635cfc84281b9dee7ee Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 26 Aug 2017 13:05:56 +0800 Subject: [PATCH] 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 --- app/Entities/Payments/PaymentsRepository.php | 13 ++++++++--- app/Http/Controllers/PaymentsController.php | 4 ++-- resources/lang/id/feature.php | 2 +- resources/lang/id/project.php | 12 +++++----- resources/views/features/show.blade.php | 1 + resources/views/payments/create.blade.php | 6 ----- resources/views/projects/create.blade.php | 20 +++++++++++++++++ resources/views/projects/edit.blade.php | 20 +++++++++++++++++ .../views/projects/features-export-html.blade.php | 4 ++-- resources/views/projects/features.blade.php | 4 ++-- .../partials/subscription-show.blade.php | 6 +++++ .../Feature/{ => Payments}/ManagePaymentsTest.php | 2 +- tests/Feature/Payments/PaymentSearchTest.php | 26 ++++++++++++++++++++++ 13 files changed, 98 insertions(+), 22 deletions(-) rename tests/Feature/{ => Payments}/ManagePaymentsTest.php (99%) create mode 100644 tests/Feature/Payments/PaymentSearchTest.php diff --git a/app/Entities/Payments/PaymentsRepository.php b/app/Entities/Payments/PaymentsRepository.php index 01f8e0b..3ec3682 100755 --- a/app/Entities/Payments/PaymentsRepository.php +++ b/app/Entities/Payments/PaymentsRepository.php @@ -16,11 +16,18 @@ class PaymentsRepository extends BaseRepository parent::__construct($model); } - public function getAll($q) + public function getPayments($queryStrings) { 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') ->whereOwnerId(auth()->id()) diff --git a/app/Http/Controllers/PaymentsController.php b/app/Http/Controllers/PaymentsController.php index d32bb10..0f8a1ed 100755 --- a/app/Http/Controllers/PaymentsController.php +++ b/app/Http/Controllers/PaymentsController.php @@ -19,9 +19,9 @@ class PaymentsController extends Controller { $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')); } diff --git a/resources/lang/id/feature.php b/resources/lang/id/feature.php index ac5d56a..162685b 100644 --- a/resources/lang/id/feature.php +++ b/resources/lang/id/feature.php @@ -20,7 +20,7 @@ return [ 'description' => 'Deskripsi', 'progress' => 'Progress', 'worker' => 'Pekerja', - 'price' => 'Nilai Fitur', + 'price' => 'Biaya Pengerjaan', 'type' => 'Jenis Fitur', 'tasks' => 'Daftar Task', 'price_total' => 'Nilai Fitur Total', diff --git a/resources/lang/id/project.php b/resources/lang/id/project.php index a34a33c..a0cdf12 100644 --- a/resources/lang/id/project.php +++ b/resources/lang/id/project.php @@ -23,10 +23,6 @@ return [ 'cash_in_total' => 'Total Pemasukan', 'cash_out_total' => 'Total Pengeluaran', 'customer' => 'Customer', - 'features' => 'Daftar Fitur', - 'features_export_html' => 'Export HTML', - 'features_export_excel' => 'Export Excel', - 'features_export_progress_excel' => 'Export Progress', 'subscriptions' => 'Langganan', 'worker' => 'Pekerja', 'status' => 'Status Project', @@ -38,5 +34,11 @@ return [ 'back_to_index' => 'Kembali ke daftar Project', // 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', ]; \ No newline at end of file diff --git a/resources/views/features/show.blade.php b/resources/views/features/show.blade.php index f4d7987..a94c401 100755 --- a/resources/views/features/show.blade.php +++ b/resources/views/features/show.blade.php @@ -7,6 +7,7 @@

+ {!! 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('projects.features', trans('feature.back_to_index'), [$feature->project_id, '#' . $feature->id], ['class' => 'btn btn-default']) !!}
diff --git a/resources/views/payments/create.blade.php b/resources/views/payments/create.blade.php index 0c477b6..21c9a3c 100755 --- a/resources/views/payments/create.blade.php +++ b/resources/views/payments/create.blade.php @@ -53,7 +53,6 @@ @section('ext_js') {!! Html::script(url('assets/js/plugins/jquery.datetimepicker.js')) !!} - {!! Html::script(url('assets/js/plugins/autoNumeric.min.js')) !!} @endsection @section('script') @@ -64,11 +63,6 @@ format:'Y-m-d', closeOnDateSelect: true }); - $('#amount').autoNumeric("init",{ - aSep: '.', - aDec: ',', - mDec: '0' - }); })(); @endsection \ No newline at end of file diff --git a/resources/views/projects/create.blade.php b/resources/views/projects/create.blade.php index f5496c3..485ec8f 100755 --- a/resources/views/projects/create.blade.php +++ b/resources/views/projects/create.blade.php @@ -44,4 +44,24 @@ {!! 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') + @endsection \ No newline at end of file diff --git a/resources/views/projects/edit.blade.php b/resources/views/projects/edit.blade.php index 9b4b6ac..58a93ca 100755 --- a/resources/views/projects/edit.blade.php +++ b/resources/views/projects/edit.blade.php @@ -53,4 +53,24 @@ {!! 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') + @endsection \ No newline at end of file diff --git a/resources/views/projects/features-export-html.blade.php b/resources/views/projects/features-export-html.blade.php index fc45327..0770d32 100755 --- a/resources/views/projects/features-export-html.blade.php +++ b/resources/views/projects/features-export-html.blade.php @@ -9,7 +9,7 @@ {{-- --}} - {{ $project->name }} + {{ trans('project.features') }} {{ $project->name }} {!! Html::style('assets/css/app.s.css') !!} @@ -17,7 +17,7 @@

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

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

{{ 1 + $key }}. {{ $feature->name }}

+

{{ $feature->name }}

diff --git a/resources/views/projects/features.blade.php b/resources/views/projects/features.blade.php index bd009d3..8dd94f6 100755 --- a/resources/views/projects/features.blade.php +++ b/resources/views/projects/features.blade.php @@ -7,8 +7,8 @@

- {!! 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']) !!}
{{ $project->name }} {{ trans('project.features') }}

diff --git a/resources/views/subscriptions/partials/subscription-show.blade.php b/resources/views/subscriptions/partials/subscription-show.blade.php index e180dcb..590e897 100644 --- a/resources/views/subscriptions/partials/subscription-show.blade.php +++ b/resources/views/subscriptions/partials/subscription-show.blade.php @@ -19,6 +19,12 @@ @endif + + + +
{{ trans('app.description') }}
{{ trans('subscription.project') }} + {{ link_to_route('projects.subscriptions', $subscription->project->name, [$subscription->project_id], ['target' => '_blank']) }} +
{{ trans('subscription.remark') }}{!! nl2br($subscription->remark) !!}
diff --git a/tests/Feature/ManagePaymentsTest.php b/tests/Feature/Payments/ManagePaymentsTest.php similarity index 99% rename from tests/Feature/ManagePaymentsTest.php rename to tests/Feature/Payments/ManagePaymentsTest.php index 9341884..d750694 100644 --- a/tests/Feature/ManagePaymentsTest.php +++ b/tests/Feature/Payments/ManagePaymentsTest.php @@ -1,6 +1,6 @@ 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); + } +}