From 590790bf3c9858eec3ce473473e75e51be5afbd5 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 22 Dec 2018 21:59:20 +0800 Subject: [PATCH 01/13] Change getMonths() to get_months() --- app/Http/Controllers/ReportsController.php | 2 +- app/helpers.php | 6 +++--- resources/views/reports/payments/daily.blade.php | 2 +- resources/views/reports/payments/yearly.blade.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index df90803..5c6d438 100755 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -45,7 +45,7 @@ class ReportsController extends Controller $month = $req->get('month'); } $reports = $this->repo->getMonthlyReports($year, $month); - $months = \getMonths(); + $months = \get_months(); $years = \getYears(); return view('reports.payments.monthly', compact('reports', 'months', 'years', 'month', 'year')); diff --git a/app/helpers.php b/app/helpers.php index 3fdf5da..ee6efcf 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -80,7 +80,7 @@ function dateId($date) $explodedDate = explode('-', $date); if (count($explodedDate) == 3 && checkdate($explodedDate[1], $explodedDate[2], $explodedDate[0])) { - $months = getMonths(); + $months = get_months(); return $explodedDate[2].' '.$months[$explodedDate[1]].' '.$explodedDate[0]; } @@ -111,7 +111,7 @@ function monthId($monthNumber) return $monthNumber; } - $months = getMonths(); + $months = get_months(); $monthNumber = monthNumber($monthNumber); return $months[$monthNumber]; @@ -122,7 +122,7 @@ function monthId($monthNumber) * * @return array */ -function getMonths() +function get_months() { return [ '01' => __('time.months.01'), diff --git a/resources/views/reports/payments/daily.blade.php b/resources/views/reports/payments/daily.blade.php index c766457..3ddf240 100755 --- a/resources/views/reports/payments/daily.blade.php +++ b/resources/views/reports/payments/daily.blade.php @@ -8,7 +8,7 @@ diff --git a/resources/views/reports/payments/yearly.blade.php b/resources/views/reports/payments/yearly.blade.php index 2728cc9..7739e33 100755 --- a/resources/views/reports/payments/yearly.blade.php +++ b/resources/views/reports/payments/yearly.blade.php @@ -37,7 +37,7 @@ @php $chartData = []; @endphp - @foreach(getMonths() as $monthNumber => $monthName) + @foreach(get_months() as $monthNumber => $monthName) @php $any = isset($reports[$monthNumber]); @endphp From 2f436da1f45c1862df669bae8d2bebd8b85422c7 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 22 Dec 2018 22:26:43 +0800 Subject: [PATCH 02/13] Change monthId() to month_id() --- app/helpers.php | 2 +- resources/views/reports/payments/yearly.blade.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index ee6efcf..1f47c17 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -105,7 +105,7 @@ function monthNumber($number) * @param int|string $monthNumber * @return string */ -function monthId($monthNumber) +function month_id($monthNumber) { if (is_null($monthNumber)) { return $monthNumber; diff --git a/resources/views/reports/payments/yearly.blade.php b/resources/views/reports/payments/yearly.blade.php index 7739e33..d9209bf 100755 --- a/resources/views/reports/payments/yearly.blade.php +++ b/resources/views/reports/payments/yearly.blade.php @@ -42,7 +42,7 @@ $any = isset($reports[$monthNumber]); @endphp - {{ monthId($monthNumber) }} + {{ month_id($monthNumber) }} {{ $any ? $reports[$monthNumber]->count : 0 }} {{ formatRp($any ? $reports[$monthNumber]->cashin : 0) }} {{ formatRp($any ? $reports[$monthNumber]->cashout : 0) }} @@ -54,14 +54,14 @@ ['month' => $monthNumber, 'year' => $year], [ 'class' => 'btn btn-info btn-xs', - 'title' => __('report.monthly', ['year_month' => monthId($monthNumber)]), - 'title' => __('report.monthly', ['year_month' => monthId($monthNumber).' '.$year]), + 'title' => __('report.monthly', ['year_month' => month_id($monthNumber)]), + 'title' => __('report.monthly', ['year_month' => month_id($monthNumber).' '.$year]), ] ) }} @php - $chartData[] = ['month' => monthId($monthNumber), 'value' => $profit]; + $chartData[] = ['month' => month_id($monthNumber), 'value' => $profit]; @endphp @endforeach From d7f5cc333b0f790ef4a15787e4a30f581b821123 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 22 Dec 2018 22:26:56 +0800 Subject: [PATCH 03/13] Change getYears() to get_years() --- app/Http/Controllers/ReportsController.php | 4 ++-- app/helpers.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 5c6d438..52eed1b 100755 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -46,7 +46,7 @@ class ReportsController extends Controller } $reports = $this->repo->getMonthlyReports($year, $month); $months = \get_months(); - $years = \getYears(); + $years = \get_years(); return view('reports.payments.monthly', compact('reports', 'months', 'years', 'month', 'year')); } @@ -56,7 +56,7 @@ class ReportsController extends Controller $year = $req->get('year', date('Y')); $reports = $this->repo->getYearlyReports($year); - $years = \getYears(); + $years = \get_years(); return view('reports.payments.yearly', compact('reports', 'years', 'year')); } diff --git a/app/helpers.php b/app/helpers.php index 1f47c17..9d44fdd 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -145,7 +145,7 @@ function get_months() * * @return array */ -function getYears() +function get_years() { $yearRange = range(2014, date('Y')); foreach ($yearRange as $year) { From 35d68ee520eed692de17d2d33aa7880b3a88b364 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 22 Dec 2018 22:29:21 +0800 Subject: [PATCH 04/13] Change monthNumber() to month_number() --- app/helpers.php | 4 ++-- resources/views/reports/payments/daily.blade.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 9d44fdd..e9369e4 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -94,7 +94,7 @@ function dateId($date) * @param int|string $number * @return string */ -function monthNumber($number) +function month_number($number) { return str_pad($number, 2, '0', STR_PAD_LEFT); } @@ -112,7 +112,7 @@ function month_id($monthNumber) } $months = get_months(); - $monthNumber = monthNumber($monthNumber); + $monthNumber = month_number($monthNumber); return $months[$monthNumber]; } diff --git a/resources/views/reports/payments/daily.blade.php b/resources/views/reports/payments/daily.blade.php index 3ddf240..7850f52 100755 --- a/resources/views/reports/payments/daily.blade.php +++ b/resources/views/reports/payments/daily.blade.php @@ -8,7 +8,7 @@ @@ -20,7 +20,7 @@ {{ link_to_route( 'reports.payments.monthly', __('report.view_monthly'), - ['month' => monthNumber($dt->month), 'year' => $dt->year], + ['month' => month_number($dt->month), 'year' => $dt->year], ['class' => 'btn btn-default btn-sm'] ) }} {{ Form::close() }} From e03ce9dcedf02bf2c774de1e2b01249c261b2d13 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 23 Dec 2018 20:29:06 +0800 Subject: [PATCH 05/13] Chang dateId() to date_id() --- app/Entities/Subscriptions/Subscription.php | 4 ++-- app/helpers.php | 2 +- resources/views/customers/subscriptions.blade.php | 2 +- resources/views/invoices/pdf.blade.php | 6 +++--- resources/views/payments/pdf.blade.php | 2 +- resources/views/projects/partials/project-show.blade.php | 8 ++++---- resources/views/projects/subscriptions.blade.php | 4 ++-- resources/views/reports/payments/daily.blade.php | 2 +- resources/views/reports/payments/monthly.blade.php | 4 ++-- resources/views/subscriptions/index.blade.php | 2 +- .../views/subscriptions/partials/subscription-show.blade.php | 4 ++-- tests/Feature/ManageSubscriptionsTest.php | 4 ++-- tests/Unit/Models/SubscriptionTest.php | 6 +++--- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/Entities/Subscriptions/Subscription.php b/app/Entities/Subscriptions/Subscription.php index 1dff03e..1829921 100755 --- a/app/Entities/Subscriptions/Subscription.php +++ b/app/Entities/Subscriptions/Subscription.php @@ -61,8 +61,8 @@ class Subscription extends Model */ public function dueDateDescription() { - $dueDateDescription = __('subscription.start_date').' : '.dateId($this->start_date)."\n"; - $dueDateDescription .= __('subscription.due_date').' : '.dateId($this->due_date); + $dueDateDescription = __('subscription.start_date').' : '.date_id($this->start_date)."\n"; + $dueDateDescription .= __('subscription.due_date').' : '.date_id($this->due_date); return $dueDateDescription; } diff --git a/app/helpers.php b/app/helpers.php index e9369e4..e9632d9 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -71,7 +71,7 @@ function formatDate($date) * @param string $date * @return string */ -function dateId($date) +function date_id($date) { if (is_null($date) || $date == '0000-00-00') { return '-'; diff --git a/resources/views/customers/subscriptions.blade.php b/resources/views/customers/subscriptions.blade.php index b07c629..bc35479 100755 --- a/resources/views/customers/subscriptions.blade.php +++ b/resources/views/customers/subscriptions.blade.php @@ -24,7 +24,7 @@ {!! $subscription->type_label !!} {{ $subscription->customer->name }} - {{ dateId($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} + {{ date_id($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} {{ formatRp($subscription->price) }} {{ $subscription->vendor->name }} diff --git a/resources/views/invoices/pdf.blade.php b/resources/views/invoices/pdf.blade.php index c830812..30b9003 100755 --- a/resources/views/invoices/pdf.blade.php +++ b/resources/views/invoices/pdf.blade.php @@ -61,7 +61,7 @@

{{ __('invoice.invoice') }}

{{ __('invoice.number') }} : INV-{{ $invoice->number }}
-
{{ __('app.date') }} : {{ dateId($invoice->date) }}
+
{{ __('app.date') }} : {{ date_id($invoice->date) }}
@@ -87,7 +87,7 @@ @if ($invoice->due_date)

{{ __('invoice.due_date') }}

-

{{ dateId($invoice->due_date) }}

+

{{ date_id($invoice->due_date) }}

@endif @if ($taxId = Option::get('agency_tax_id'))

{{ __('agency.tax_id') }}

@@ -176,7 +176,7 @@ {{ Option::get('agency_city') ? Option::get('agency_city').', ' : '' }} - {{ dateId($invoice->date) }}



+ {{ date_id($invoice->date) }}



{{ Option::get('agency_name') }}
diff --git a/resources/views/payments/pdf.blade.php b/resources/views/payments/pdf.blade.php index f6e3601..6680e20 100755 --- a/resources/views/payments/pdf.blade.php +++ b/resources/views/payments/pdf.blade.php @@ -63,7 +63,7 @@     - {{ Option::get('agency_city') ? Option::get('agency_city').', ' : '' }} {{ dateId($payment->date) }} + {{ Option::get('agency_city') ? Option::get('agency_city').', ' : '' }} {{ date_id($payment->date) }} diff --git a/resources/views/projects/partials/project-show.blade.php b/resources/views/projects/partials/project-show.blade.php index eee023e..ad8e058 100644 --- a/resources/views/projects/partials/project-show.blade.php +++ b/resources/views/projects/partials/project-show.blade.php @@ -5,14 +5,14 @@ {{ trans('project.name') }}{{ $project->name }} {{ trans('project.description') }}{!! nl2br($project->description) !!} - {{ trans('project.proposal_date') }}{{ dateId($project->proposal_date) }} + {{ trans('project.proposal_date') }}{{ date_id($project->proposal_date) }} @can('see-pricings', $project) {{ trans('project.proposal_value') }}{{ formatRp($project->proposal_value) }} {{ trans('project.project_value') }}{{ formatRp($project->project_value) }} @endcan - {{ trans('project.start_date') }}{{ dateId($project->start_date) }} - {{ trans('project.end_date') }}{{ dateId($project->end_date) }} - {{ trans('project.due_date') }}{{ dateId($project->due_date) }} + {{ trans('project.start_date') }}{{ date_id($project->start_date) }} + {{ trans('project.end_date') }}{{ date_id($project->end_date) }} + {{ trans('project.due_date') }}{{ date_id($project->due_date) }} {{ trans('app.status') }}{{ $project->present()->status }} {{ trans('project.customer') }} diff --git a/resources/views/projects/subscriptions.blade.php b/resources/views/projects/subscriptions.blade.php index 021411f..a74418e 100755 --- a/resources/views/projects/subscriptions.blade.php +++ b/resources/views/projects/subscriptions.blade.php @@ -31,8 +31,8 @@ {{ 1 + $key }} {{ $subscription->type }} {{ $subscription->nameLink() }} - {{ dateId($subscription->start_date) }} - {{ dateId($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} + {{ date_id($subscription->start_date) }} + {{ date_id($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} {{ formatRp($subscription->price) }} {!! link_to_route('subscriptions.show',trans('app.show'),[$subscription->id],['class'=>'btn btn-info btn-xs']) !!} diff --git a/resources/views/reports/payments/daily.blade.php b/resources/views/reports/payments/daily.blade.php index 7850f52..89a9809 100755 --- a/resources/views/reports/payments/daily.blade.php +++ b/resources/views/reports/payments/daily.blade.php @@ -1,6 +1,6 @@ @extends('layouts.app') -@section('title', __('report.daily', ['date' => dateId($date)])) +@section('title', __('report.daily', ['date' => date_id($date)])) @section('content') diff --git a/resources/views/reports/payments/monthly.blade.php b/resources/views/reports/payments/monthly.blade.php index 201e907..7345caa 100755 --- a/resources/views/reports/payments/monthly.blade.php +++ b/resources/views/reports/payments/monthly.blade.php @@ -48,7 +48,7 @@ @endphp @if ($any) - {{ dateId($date = $year.'-'.$month.'-'.$dateNumber) }} + {{ date_id($date = $year.'-'.$month.'-'.$dateNumber) }} {{ $count }} {{ formatRp($any ? $reports[$dateNumber]->cashin : 0) }} {{ formatRp($any ? $reports[$dateNumber]->cashout : 0) }} @@ -60,7 +60,7 @@ ['date' => $date], [ 'class' => 'btn btn-info btn-xs', - 'title' => __('report.daily', ['date' => dateId($date)]), + 'title' => __('report.daily', ['date' => date_id($date)]), ] ) }} diff --git a/resources/views/subscriptions/index.blade.php b/resources/views/subscriptions/index.blade.php index e93be92..7f077c5 100755 --- a/resources/views/subscriptions/index.blade.php +++ b/resources/views/subscriptions/index.blade.php @@ -34,7 +34,7 @@ {!! $subscription->type_label !!} {{ $subscription->customer->name }} - {{ dateId($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} + {{ date_id($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} {{ formatRp($subscription->price) }} {{ $subscription->vendor->name }} diff --git a/resources/views/subscriptions/partials/subscription-show.blade.php b/resources/views/subscriptions/partials/subscription-show.blade.php index 8234b9c..89c6866 100644 --- a/resources/views/subscriptions/partials/subscription-show.blade.php +++ b/resources/views/subscriptions/partials/subscription-show.blade.php @@ -3,8 +3,8 @@ {{ trans('subscription.name') }}{{ $subscription->name }} {{ trans('subscription.price') }}{{ formatRp($subscription->price) }} {{ trans('subscription.type') }}{{ $subscription->type }} - {{ trans('subscription.start_date') }}{{ dateId($subscription->start_date) }} - {{ trans('subscription.due_date') }}{{ dateId($subscription->due_date) }} + {{ trans('subscription.start_date') }}{{ date_id($subscription->start_date) }} + {{ trans('subscription.due_date') }}{{ date_id($subscription->due_date) }} {{ trans('subscription.customer') }}{{ $subscription->customer->nameLink() }} {{ trans('subscription.project') }} diff --git a/tests/Feature/ManageSubscriptionsTest.php b/tests/Feature/ManageSubscriptionsTest.php index 96e4683..69ebaf6 100644 --- a/tests/Feature/ManageSubscriptionsTest.php +++ b/tests/Feature/ManageSubscriptionsTest.php @@ -112,7 +112,7 @@ class ManageSubscriptionsTest extends TestCase $this->see($subscription->name); $this->see(formatRp($subscription->price)); - $this->see(dateId($subscription->start_date)); - $this->see(dateId($subscription->due_date)); + $this->see(date_id($subscription->start_date)); + $this->see(date_id($subscription->due_date)); } } diff --git a/tests/Unit/Models/SubscriptionTest.php b/tests/Unit/Models/SubscriptionTest.php index af0f041..3d2c17a 100644 --- a/tests/Unit/Models/SubscriptionTest.php +++ b/tests/Unit/Models/SubscriptionTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\Models; use Carbon\Carbon; -use Tests\TestCase as TestCase; +use Tests\TestCase; use App\Entities\Partners\Vendor; use App\Entities\Projects\Project; use App\Entities\Partners\Customer; @@ -69,8 +69,8 @@ class SubscriptionTest extends TestCase $next3Months = Carbon::now()->addMonths(2)->format('Y-m-d'); $subscription = factory(Subscription::class)->make(['due_date' => $next3Months]); - $dueDateDescription = trans('subscription.start_date').' : '.dateId($subscription->start_date)."\n"; - $dueDateDescription .= trans('subscription.due_date').' : '.dateId($subscription->due_date); + $dueDateDescription = trans('subscription.start_date').' : '.date_id($subscription->start_date)."\n"; + $dueDateDescription .= trans('subscription.due_date').' : '.date_id($subscription->due_date); $this->assertEquals($dueDateDescription, $subscription->dueDateDescription()); } From a22146bc35b4b71d932eca05a28f46807f41f6fc Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 23 Dec 2018 20:38:43 +0800 Subject: [PATCH 06/13] Remove unused helper function --- app/helpers.php | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index e9632d9..af0f591 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -43,29 +43,6 @@ function formatDecimal($number) } /** - * Format date in indonesian format dd-mm-yyyy. - * - * @param string $date - * @return string - */ -function formatDate($date) -{ - if (!$date || $date == '0000-00-00') { - return; - } - - $explodedDate = explode('-', $date); - - if (count($explodedDate) == 3 && checkdate($explodedDate[1], $explodedDate[0], $explodedDate[2])) { - return $explodedDate[2].'-'.$explodedDate[1].'-'.$explodedDate[0]; - } elseif (count($explodedDate) == 3 && checkdate($explodedDate[1], $explodedDate[2], $explodedDate[0])) { - return $explodedDate[2].'-'.$explodedDate[1].'-'.$explodedDate[0]; - } - - throw new App\Exceptions\InvalidDateException('Invalid date format.'); -} - -/** * Get Indonesian date format. * * @param string $date From 1380bc523cef0e250914e0821da211f276104e1e Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 23 Dec 2018 20:58:10 +0800 Subject: [PATCH 07/13] Change formatDecimal() to format_decimal() --- app/helpers.php | 2 +- resources/views/jobs/partials/job-show.blade.php | 2 +- resources/views/jobs/partials/job-tasks.blade.php | 2 +- resources/views/jobs/unfinished.blade.php | 4 ++-- resources/views/projects/index.blade.php | 2 +- resources/views/projects/jobs/index.blade.php | 6 +++--- resources/views/projects/jobs/progress-export-html.blade.php | 4 ++-- resources/views/projects/partials/project-stats.blade.php | 2 +- resources/views/users/jobs.blade.php | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index af0f591..cb40161 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -37,7 +37,7 @@ function formatRp($number) * @param int|string $number * @return string */ -function formatDecimal($number) +function format_decimal($number) { return number_format($number, 2, ',', '.'); } diff --git a/resources/views/jobs/partials/job-show.blade.php b/resources/views/jobs/partials/job-show.blade.php index 36b993c..3574e19 100644 --- a/resources/views/jobs/partials/job-show.blade.php +++ b/resources/views/jobs/partials/job-show.blade.php @@ -7,7 +7,7 @@ @can('see-pricings', $job) {{ __('job.price') }}{{ formatRp($job->price) }} @endcan - {{ __('job.progress') }}{{ formatDecimal($job->progress) }}% + {{ __('job.progress') }}{{ format_decimal($job->progress) }}% {{ __('job.worker') }}{{ $job->worker->name }} {{ __('time.updated_at') }}{{ $job->updated_at }} {{ __('job.description') }}{!! nl2br($job->description) !!} diff --git a/resources/views/jobs/partials/job-tasks.blade.php b/resources/views/jobs/partials/job-tasks.blade.php index ea906d0..20fe1d1 100644 --- a/resources/views/jobs/partials/job-tasks.blade.php +++ b/resources/views/jobs/partials/job-tasks.blade.php @@ -66,7 +66,7 @@ {{ __('app.total') }} - {{ formatDecimal($job->tasks->avg('progress')) }} % + {{ format_decimal($job->tasks->avg('progress')) }} % @if (request('action') == 'sort_tasks') {{ link_to_route('jobs.show', __('app.done'), [$job], ['class' => 'btn btn-default btn-xs pull-right']) }} diff --git a/resources/views/jobs/unfinished.blade.php b/resources/views/jobs/unfinished.blade.php index 74dfcae..1f4d86f 100755 --- a/resources/views/jobs/unfinished.blade.php +++ b/resources/views/jobs/unfinished.blade.php @@ -46,7 +46,7 @@ @endif {{ $job->tasks_count = $job->tasks->count() }} - {{ formatDecimal($job->progress) }} % + {{ format_decimal($job->progress) }} % @can('see-pricings', $job) {{ formatRp($job->price) }} @endcan @@ -63,7 +63,7 @@ {{ __('app.total') }} {{ $jobs->sum('tasks_count') }} - {{ formatDecimal($jobs->avg('progress')) }} % + {{ format_decimal($jobs->avg('progress')) }} % @can('see-pricings', new App\Entities\Projects\Job) {{ formatRp($jobs->sum('price')) }} @endcan diff --git a/resources/views/projects/index.blade.php b/resources/views/projects/index.blade.php index f5027bd..7b7aa6a 100755 --- a/resources/views/projects/index.blade.php +++ b/resources/views/projects/index.blade.php @@ -44,7 +44,7 @@ {{ $project->start_date }} {{ $project->work_duration }} @if (request('status_id') == 2) - {{ formatDecimal($project->getJobOveralProgress()) }} % + {{ format_decimal($project->getJobOveralProgress()) }} % {{ $project->due_date }} @endif @can('see-pricings', new App\Entities\Projects\Project) diff --git a/resources/views/projects/jobs/index.blade.php b/resources/views/projects/jobs/index.blade.php index 9435629..0b724b6 100755 --- a/resources/views/projects/jobs/index.blade.php +++ b/resources/views/projects/jobs/index.blade.php @@ -82,7 +82,7 @@ @endif {{ $job->tasks_count = $job->tasks->count() }} - {{ formatDecimal($job->progress) }} % + {{ format_decimal($job->progress) }} % @can('see-pricings', $job) {{ formatRp($job->price) }} @endcan @@ -108,8 +108,8 @@ Total {{ $groupedJobs->sum('tasks_count') }} - {{ formatDecimal($groupedJobs->sum('progress') / $groupedJobs->count()) }} % - ({{ formatDecimal($project->getJobOveralProgress()) }} %) + {{ format_decimal($groupedJobs->sum('progress') / $groupedJobs->count()) }} % + ({{ format_decimal($project->getJobOveralProgress()) }} %) @can('see-pricings', new App\Entities\Projects\Job) {{ formatRp($groupedJobs->sum('price')) }} diff --git a/resources/views/projects/jobs/progress-export-html.blade.php b/resources/views/projects/jobs/progress-export-html.blade.php index cb7aa38..f1c78fa 100755 --- a/resources/views/projects/jobs/progress-export-html.blade.php +++ b/resources/views/projects/jobs/progress-export-html.blade.php @@ -31,7 +31,7 @@ {{ 1 + $key }} {{ $job->name }} {{ formatRp($job->price) }} - {{ formatDecimal($job->progress) }} % + {{ format_decimal($job->progress) }} % {{ formatRp($job->receiveable_earning) }} @endforeach @@ -40,7 +40,7 @@ {{ __('app.total') }} {{ formatRp($jobs->sum('price')) }} - {{ formatDecimal($project->getJobOveralProgress()) }} % + {{ format_decimal($project->getJobOveralProgress()) }} % {{ formatRp($jobs->sum('receiveable_earning')) }} diff --git a/resources/views/projects/partials/project-stats.blade.php b/resources/views/projects/partials/project-stats.blade.php index 16a52b3..75194b6 100644 --- a/resources/views/projects/partials/project-stats.blade.php +++ b/resources/views/projects/partials/project-stats.blade.php @@ -6,7 +6,7 @@
-
{{ formatDecimal($project->getJobOveralProgress()) }} %
+
{{ format_decimal($project->getJobOveralProgress()) }} %
{{ __('project.overall_progress') }}
diff --git a/resources/views/users/jobs.blade.php b/resources/views/users/jobs.blade.php index 6a2f113..e61b9e2 100755 --- a/resources/views/users/jobs.blade.php +++ b/resources/views/users/jobs.blade.php @@ -33,7 +33,7 @@ @endif {{ $job->tasks_count = $job->tasks->count() }} - {{ formatDecimal($job->progress = $job->progress) }} % + {{ format_decimal($job->progress = $job->progress) }} % {{ formatRp($job->price) }} {!! html_link_to_route('jobs.show', '', [$job], [ From bf7c359ab14801fa017ba1421c7a0da628ba036a Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 23 Dec 2018 21:03:19 +0800 Subject: [PATCH 08/13] Change from formatRp() to format_money() --- app/Entities/Payments/PaymentPresenter.php | 2 +- app/helpers.php | 3 ++- resources/views/customers/invoices.blade.php | 4 ++-- resources/views/customers/payments.blade.php | 2 +- resources/views/customers/projects.blade.php | 2 +- resources/views/customers/subscriptions.blade.php | 2 +- .../invoice-drafts/partials/draft-confirm.blade.php | 6 +++--- .../invoice-drafts/partials/draft-item-list.blade.php | 2 +- resources/views/invoices/index.blade.php | 4 ++-- resources/views/invoices/partials/detail.blade.php | 2 +- resources/views/invoices/partials/item-list.blade.php | 2 +- resources/views/invoices/pdf.blade.php | 8 ++++---- resources/views/invoices/show.blade.php | 8 ++++---- resources/views/jobs/partials/job-show.blade.php | 2 +- resources/views/jobs/unfinished.blade.php | 4 ++-- resources/views/options/page-1.blade.php | 2 +- resources/views/pages/home.blade.php | 6 +++--- resources/views/payments/pdf.blade.php | 2 +- resources/views/projects/index.blade.php | 2 +- resources/views/projects/invoices.blade.php | 4 ++-- resources/views/projects/jobs/export-html.blade.php | 4 ++-- resources/views/projects/jobs/index.blade.php | 4 ++-- .../views/projects/jobs/progress-export-html.blade.php | 8 ++++---- .../views/projects/partials/payment-summary.blade.php | 16 ++++++++-------- resources/views/projects/partials/project-show.blade.php | 4 ++-- .../views/projects/partials/project-stats.blade.php | 2 +- resources/views/projects/payments.blade.php | 4 ++-- resources/views/projects/subscriptions.blade.php | 2 +- resources/views/reports/current-credits.blade.php | 8 ++++---- resources/views/reports/payments/daily.blade.php | 2 +- resources/views/reports/payments/monthly.blade.php | 12 ++++++------ resources/views/reports/payments/yearly.blade.php | 12 ++++++------ resources/views/subscriptions/index.blade.php | 2 +- .../subscriptions/partials/subscription-show.blade.php | 2 +- resources/views/users/jobs.blade.php | 2 +- resources/views/users/projects.blade.php | 2 +- resources/views/vendors/show.blade.php | 4 ++-- tests/Feature/Invoices/InvoiceEntryTest.php | 6 +++--- tests/Feature/ManageJobsTest.php | 2 +- tests/Feature/ManageSubscriptionsTest.php | 2 +- tests/Feature/Payments/ManagePaymentsTest.php | 2 +- tests/Unit/Helpers/MoneyFormatTest.php | 12 ++++++------ 42 files changed, 92 insertions(+), 91 deletions(-) diff --git a/app/Entities/Payments/PaymentPresenter.php b/app/Entities/Payments/PaymentPresenter.php index c086fe4..25a13d4 100644 --- a/app/Entities/Payments/PaymentPresenter.php +++ b/app/Entities/Payments/PaymentPresenter.php @@ -8,7 +8,7 @@ class PaymentPresenter extends Presenter { public function amount() { - return $this->entity->in_out == 0 ? formatRp(-$this->entity->amount) : formatRp($this->entity->amount); + return $this->entity->in_out == 0 ? format_money(-$this->entity->amount) : format_money($this->entity->amount); } public function projectLink() diff --git a/app/helpers.php b/app/helpers.php index cb40161..6894fa1 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -13,10 +13,11 @@ function formatNo($number) /** * Get number in money currency format. + * * @param int|string $number * @return string */ -function formatRp($number) +function format_money($number) { $moneySign = Option::get('money_sign', 'Rp.'); diff --git a/resources/views/customers/invoices.blade.php b/resources/views/customers/invoices.blade.php index b866f81..f92b869 100755 --- a/resources/views/customers/invoices.blade.php +++ b/resources/views/customers/invoices.blade.php @@ -22,7 +22,7 @@ {{ $invoice->created_at->format('Y-m-d') }} {{ $invoice->project->nameLink() }} {{ $invoice->project->customer->nameLink() }} - {{ formatRp($invoice->amount) }} + {{ format_money($invoice->amount) }} {!! html_link_to_route( 'invoices.show', '', [$invoice->number], @@ -49,7 +49,7 @@ {{ trans('app.total') }} - {{ formatRp($invoices->sum('amount')) }} + {{ format_money($invoices->sum('amount')) }} diff --git a/resources/views/customers/payments.blade.php b/resources/views/customers/payments.blade.php index 38364f8..66a584d 100755 --- a/resources/views/customers/payments.blade.php +++ b/resources/views/customers/payments.blade.php @@ -42,7 +42,7 @@ {{ __('app.total') }} - {{ formatRp($payments->sum('amount')) }} + {{ format_money($payments->sum('amount')) }}   diff --git a/resources/views/customers/projects.blade.php b/resources/views/customers/projects.blade.php index c426a79..c7eaa7b 100755 --- a/resources/views/customers/projects.blade.php +++ b/resources/views/customers/projects.blade.php @@ -21,7 +21,7 @@ {{ $project->nameLink() }} {{ $project->start_date }} {{ $project->work_duration }} - {{ formatRp($project->project_value) }} + {{ format_money($project->project_value) }} {{ $project->present()->status }} {!! html_link_to_route('projects.show', '', [$project->id], ['icon' => 'search', 'class' => 'btn btn-info btn-xs', 'title' => trans('app.show')]) !!} diff --git a/resources/views/customers/subscriptions.blade.php b/resources/views/customers/subscriptions.blade.php index bc35479..96271c9 100755 --- a/resources/views/customers/subscriptions.blade.php +++ b/resources/views/customers/subscriptions.blade.php @@ -26,7 +26,7 @@ {{ date_id($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} - {{ formatRp($subscription->price) }} + {{ format_money($subscription->price) }} {{ $subscription->vendor->name }} {{ $subscription->status() }} diff --git a/resources/views/invoice-drafts/partials/draft-confirm.blade.php b/resources/views/invoice-drafts/partials/draft-confirm.blade.php index a8fbef3..eaef2f7 100644 --- a/resources/views/invoice-drafts/partials/draft-confirm.blade.php +++ b/resources/views/invoice-drafts/partials/draft-confirm.blade.php @@ -18,7 +18,7 @@ {{ trans('invoice.due_date') }}{{ $draft->dueDate }} {{ trans('invoice.total') }} - {{ formatRp($draft->getTotal()) }} + {{ format_money($draft->getTotal()) }} {{ trans('invoice.notes') }}{{ $draft->notes }} @@ -48,7 +48,7 @@ {{ $key + 1 }} {!! nl2br($item->description) !!} - {{ formatRp($item->amount) }} + {{ format_money($item->amount) }} @empty @endforelse @@ -56,7 +56,7 @@ {{ trans('invoice.total') }} : - {{ formatRp($draft->getTotal()) }} + {{ format_money($draft->getTotal()) }} diff --git a/resources/views/invoice-drafts/partials/draft-item-list.blade.php b/resources/views/invoice-drafts/partials/draft-item-list.blade.php index 65f8217..eadf7f5 100644 --- a/resources/views/invoice-drafts/partials/draft-item-list.blade.php +++ b/resources/views/invoice-drafts/partials/draft-item-list.blade.php @@ -51,7 +51,7 @@ @endforeach {{ trans('invoice.amount') }} : - {{ formatRp($draft->getTotal()) }} + {{ format_money($draft->getTotal()) }}   diff --git a/resources/views/invoices/index.blade.php b/resources/views/invoices/index.blade.php index b6c6f95..7a48368 100755 --- a/resources/views/invoices/index.blade.php +++ b/resources/views/invoices/index.blade.php @@ -34,7 +34,7 @@ {{ $invoice->created_at->format('Y-m-d') }} {{ $invoice->project->nameLink() }} {{ $invoice->project->customer->nameLink() }} - {{ formatRp($invoice->amount) }} + {{ format_money($invoice->amount) }} {!! html_link_to_route( 'invoices.show', '', [$invoice->number], @@ -61,7 +61,7 @@ {{ trans('app.total') }} - {{ formatRp($invoices->sum('amount')) }} + {{ format_money($invoices->sum('amount')) }}   diff --git a/resources/views/invoices/partials/detail.blade.php b/resources/views/invoices/partials/detail.blade.php index eed4668..d613565 100644 --- a/resources/views/invoices/partials/detail.blade.php +++ b/resources/views/invoices/partials/detail.blade.php @@ -7,6 +7,6 @@ {{ trans('invoice.customer') }}{{ $invoice->project->customer->nameLink() }} {{ trans('invoice.items_count') }}{{ $invoice->items_count }} {{ trans('invoice.creator') }}{{ $invoice->creator->name }} - {{ trans('invoice.amount') }}{{ formatRp($invoice->amount) }} + {{ trans('invoice.amount') }}{{ format_money($invoice->amount) }} diff --git a/resources/views/invoices/partials/item-list.blade.php b/resources/views/invoices/partials/item-list.blade.php index 7834873..5f3d09d 100644 --- a/resources/views/invoices/partials/item-list.blade.php +++ b/resources/views/invoices/partials/item-list.blade.php @@ -77,7 +77,7 @@ {{ trans('invoice.amount') }} : - {{ formatRp(collect($invoice->items)->sum('amount')) }} + {{ format_money(collect($invoice->items)->sum('amount')) }} diff --git a/resources/views/invoices/pdf.blade.php b/resources/views/invoices/pdf.blade.php index 30b9003..004a517 100755 --- a/resources/views/invoices/pdf.blade.php +++ b/resources/views/invoices/pdf.blade.php @@ -114,7 +114,7 @@ {{ 1 + $key }} {!! nl2br($item['description']) !!} - {{ formatRp($item['amount']) }} + {{ format_money($item['amount']) }} @php $subtotal += $item['amount']; @@ -123,19 +123,19 @@ @if ($invoice->discount) {{ __('invoice.subtotal') }} : - {{ formatRp($subtotal) }} + {{ format_money($subtotal) }} {{ __('invoice.discount') }} {{ $invoice->discount_notes ? '('.$invoice->discount_notes.')': '' }} : - - {{ formatRp($invoice->discount) }} + - {{ format_money($invoice->discount) }} @endif {{ __('app.total') }} - {{ formatRp($invoice->amount) }} + {{ format_money($invoice->amount) }} diff --git a/resources/views/invoices/show.blade.php b/resources/views/invoices/show.blade.php index d0737b5..f96b3fc 100644 --- a/resources/views/invoices/show.blade.php +++ b/resources/views/invoices/show.blade.php @@ -39,7 +39,7 @@ {{ $key + 1 }} {!! nl2br($item['description']) !!} - {{ formatRp($item['amount']) }} + {{ format_money($item['amount']) }} @php $subtotal += $item['amount']; @@ -50,19 +50,19 @@ @if ($invoice->discount) {{ __('invoice.subtotal') }} : - {{ formatRp($subtotal) }} + {{ format_money($subtotal) }} {{ __('invoice.discount') }} {{ $invoice->discount_notes ? '('.$invoice->discount_notes.')': '' }} : - - {{ formatRp($invoice->discount) }} + - {{ format_money($invoice->discount) }} @endif {{ trans('app.total') }} : - {{ formatRp($invoice->amount) }} + {{ format_money($invoice->amount) }} diff --git a/resources/views/jobs/partials/job-show.blade.php b/resources/views/jobs/partials/job-show.blade.php index 3574e19..8f983a7 100644 --- a/resources/views/jobs/partials/job-show.blade.php +++ b/resources/views/jobs/partials/job-show.blade.php @@ -5,7 +5,7 @@ {{ __('job.name') }}{{ $job->name }} {{ __('job.type') }}{{ $job->type() }} @can('see-pricings', $job) - {{ __('job.price') }}{{ formatRp($job->price) }} + {{ __('job.price') }}{{ format_money($job->price) }} @endcan {{ __('job.progress') }}{{ format_decimal($job->progress) }}% {{ __('job.worker') }}{{ $job->worker->name }} diff --git a/resources/views/jobs/unfinished.blade.php b/resources/views/jobs/unfinished.blade.php index 1f4d86f..8d31f01 100755 --- a/resources/views/jobs/unfinished.blade.php +++ b/resources/views/jobs/unfinished.blade.php @@ -48,7 +48,7 @@ {{ $job->tasks_count = $job->tasks->count() }} {{ format_decimal($job->progress) }} % @can('see-pricings', $job) - {{ formatRp($job->price) }} + {{ format_money($job->price) }} @endcan {{ $job->worker->name }} @@ -65,7 +65,7 @@ {{ $jobs->sum('tasks_count') }} {{ format_decimal($jobs->avg('progress')) }} % @can('see-pricings', new App\Entities\Projects\Job) - {{ formatRp($jobs->sum('price')) }} + {{ format_money($jobs->sum('price')) }} @endcan diff --git a/resources/views/options/page-1.blade.php b/resources/views/options/page-1.blade.php index 6d0a1b8..58729c9 100755 --- a/resources/views/options/page-1.blade.php +++ b/resources/views/options/page-1.blade.php @@ -17,7 +17,7 @@ ['class' => 'form-control', 'maxlength' => 3] ) }} - Money sign like : {{ formatRp('9900') }}
(Max 3 characters) + Money sign like : {{ format_money('9900') }}
(Max 3 characters)
diff --git a/resources/views/pages/home.blade.php b/resources/views/pages/home.blade.php index 6bdbf4a..8f930d4 100755 --- a/resources/views/pages/home.blade.php +++ b/resources/views/pages/home.blade.php @@ -32,13 +32,13 @@ - {{ $totalEarnings = formatRp(AdminDashboard::totalEarnings($queriedYear)) }} + {{ $totalEarnings = format_money(AdminDashboard::totalEarnings($queriedYear)) }} {{ $totalFinishedProjects = AdminDashboard::totalFinishedProjects($queriedYear) }} Projects - {{ $currentOutstandingCustomerPayment = formatRp(AdminDashboard::currentOutstandingCustomerPayment($queriedYear)) }} + {{ $currentOutstandingCustomerPayment = format_money(AdminDashboard::currentOutstandingCustomerPayment($queriedYear)) }} @@ -73,7 +73,7 @@ {{ $subscription->nameLink() }} {{ $subscription->customer->name }} - {{ formatRp($subscription->price) }} + {{ format_money($subscription->price) }} {{ $subscription->due_date }} {!! $subscription->nearOfDueDateSign() !!} diff --git a/resources/views/payments/pdf.blade.php b/resources/views/payments/pdf.blade.php index 6680e20..9131635 100755 --- a/resources/views/payments/pdf.blade.php +++ b/resources/views/payments/pdf.blade.php @@ -69,7 +69,7 @@ @lang('payment.cash_amount') - {{ formatRp($payment->amount) }},- + {{ format_money($payment->amount) }},- {{ auth()->user()->name }}
diff --git a/resources/views/projects/index.blade.php b/resources/views/projects/index.blade.php index 7b7aa6a..df9c6e8 100755 --- a/resources/views/projects/index.blade.php +++ b/resources/views/projects/index.blade.php @@ -48,7 +48,7 @@ {{ $project->due_date }} @endif @can('see-pricings', new App\Entities\Projects\Project) - {{ formatRp($project->project_value) }} + {{ format_money($project->project_value) }} @endcan {{ $project->present()->status }} {{ $project->customer->name }} diff --git a/resources/views/projects/invoices.blade.php b/resources/views/projects/invoices.blade.php index a6b12d2..7f46d50 100755 --- a/resources/views/projects/invoices.blade.php +++ b/resources/views/projects/invoices.blade.php @@ -40,7 +40,7 @@ {{ $invoice->date }} {{ $invoice->due_date }} {{ $project->customer->nameLink() }} - {{ formatRp($invoice->amount) }} + {{ format_money($invoice->amount) }} {!! html_link_to_route( 'invoices.show', '', [$invoice->number], @@ -68,7 +68,7 @@ {{ trans('app.total') }} - {{ formatRp($project->invoices->sum('amount')) }} + {{ format_money($project->invoices->sum('amount')) }}   diff --git a/resources/views/projects/jobs/export-html.blade.php b/resources/views/projects/jobs/export-html.blade.php index 164d815..80bc2e1 100755 --- a/resources/views/projects/jobs/export-html.blade.php +++ b/resources/views/projects/jobs/export-html.blade.php @@ -52,14 +52,14 @@ {{ 1 + $key }} {{ $job->name }} - {{ formatRp($job->price) }} + {{ format_money($job->price) }} @endforeach Total - {{ formatRp($jobs->sum('price')) }} + {{ format_money($jobs->sum('price')) }} diff --git a/resources/views/projects/jobs/index.blade.php b/resources/views/projects/jobs/index.blade.php index 0b724b6..3e13ffb 100755 --- a/resources/views/projects/jobs/index.blade.php +++ b/resources/views/projects/jobs/index.blade.php @@ -84,7 +84,7 @@ {{ $job->tasks_count = $job->tasks->count() }} {{ format_decimal($job->progress) }} % @can('see-pricings', $job) - {{ formatRp($job->price) }} + {{ format_money($job->price) }} @endcan {{ $job->updated_at->diffForHumans() }}
@@ -112,7 +112,7 @@ ({{ format_decimal($project->getJobOveralProgress()) }} %) @can('see-pricings', new App\Entities\Projects\Job) - {{ formatRp($groupedJobs->sum('price')) }} + {{ format_money($groupedJobs->sum('price')) }} @endcan @can('update', $project) diff --git a/resources/views/projects/jobs/progress-export-html.blade.php b/resources/views/projects/jobs/progress-export-html.blade.php index f1c78fa..7fe80fb 100755 --- a/resources/views/projects/jobs/progress-export-html.blade.php +++ b/resources/views/projects/jobs/progress-export-html.blade.php @@ -30,18 +30,18 @@ {{ 1 + $key }} {{ $job->name }} - {{ formatRp($job->price) }} + {{ format_money($job->price) }} {{ format_decimal($job->progress) }} % - {{ formatRp($job->receiveable_earning) }} + {{ format_money($job->receiveable_earning) }} @endforeach {{ __('app.total') }} - {{ formatRp($jobs->sum('price')) }} + {{ format_money($jobs->sum('price')) }} {{ format_decimal($project->getJobOveralProgress()) }} % - {{ formatRp($jobs->sum('receiveable_earning')) }} + {{ format_money($jobs->sum('receiveable_earning')) }} diff --git a/resources/views/projects/partials/payment-summary.blade.php b/resources/views/projects/partials/payment-summary.blade.php index 8c4f410..1733a78 100644 --- a/resources/views/projects/partials/payment-summary.blade.php +++ b/resources/views/projects/partials/payment-summary.blade.php @@ -8,19 +8,19 @@ {{ trans('project.payment_status') }} - {{ formatRp($project->project_value) }} - {{ formatRp($project->cashInTotal()) }} - {{ formatRp($project->cashOutTotal()) }} - {{ formatRp($balance = $project->project_value - $project->cashInTotal()) }} + {{ format_money($project->project_value) }} + {{ format_money($project->cashInTotal()) }} + {{ format_money($project->cashOutTotal()) }} + {{ format_money($balance = $project->project_value - $project->cashInTotal()) }} {{ $balance > 0 ? trans('project.payment_statuses.outstanding') : trans('project.payment_statuses.paid') }}
    -
  • {{ trans('project.project_value') }} {{ formatRp($project->project_value) }}
  • -
  • {{ trans('project.cash_in_total') }} {{ formatRp($project->cashInTotal()) }}
  • -
  • {{ trans('project.cash_out_total') }} {{ formatRp($project->cashOutTotal()) }}
  • -
  • {{ trans('project.payment_remaining') }} {{ formatRp($balance = $project->project_value - $project->cashInTotal()) }}
  • +
  • {{ trans('project.project_value') }} {{ format_money($project->project_value) }}
  • +
  • {{ trans('project.cash_in_total') }} {{ format_money($project->cashInTotal()) }}
  • +
  • {{ trans('project.cash_out_total') }} {{ format_money($project->cashOutTotal()) }}
  • +
  • {{ trans('project.payment_remaining') }} {{ format_money($balance = $project->project_value - $project->cashInTotal()) }}
  • {{ trans('project.payment_status') }} {{ $balance > 0 ? trans('project.payment_statuses.outstanding') : trans('project.payment_statuses.paid') }}
diff --git a/resources/views/projects/partials/project-show.blade.php b/resources/views/projects/partials/project-show.blade.php index ad8e058..a2d6ea0 100644 --- a/resources/views/projects/partials/project-show.blade.php +++ b/resources/views/projects/partials/project-show.blade.php @@ -7,8 +7,8 @@ {{ trans('project.description') }}{!! nl2br($project->description) !!} {{ trans('project.proposal_date') }}{{ date_id($project->proposal_date) }} @can('see-pricings', $project) - {{ trans('project.proposal_value') }}{{ formatRp($project->proposal_value) }} - {{ trans('project.project_value') }}{{ formatRp($project->project_value) }} + {{ trans('project.proposal_value') }}{{ format_money($project->proposal_value) }} + {{ trans('project.project_value') }}{{ format_money($project->project_value) }} @endcan {{ trans('project.start_date') }}{{ date_id($project->start_date) }} {{ trans('project.end_date') }}{{ date_id($project->end_date) }} diff --git a/resources/views/projects/partials/project-stats.blade.php b/resources/views/projects/partials/project-stats.blade.php index 75194b6..767ab85 100644 --- a/resources/views/projects/partials/project-stats.blade.php +++ b/resources/views/projects/partials/project-stats.blade.php @@ -38,7 +38,7 @@
Collectibe Earnings
-
{{ formatRp($project->getCollectibeEarnings()) }}
+
{{ format_money($project->getCollectibeEarnings()) }}
diff --git a/resources/views/projects/payments.blade.php b/resources/views/projects/payments.blade.php index 923162e..59d61d0 100755 --- a/resources/views/projects/payments.blade.php +++ b/resources/views/projects/payments.blade.php @@ -36,7 +36,7 @@ {{ 1 + $key }} {{ $payment->date }} - {{ formatRp($payment->amount) }} + {{ format_money($payment->amount) }} {{ $payment->partner->name }} {{ $payment->description }} [{{ $payment->type() }}] @@ -53,7 +53,7 @@ {{ trans('app.total') }} - {{ formatRp($payments->sum('amount')) }} + {{ format_money($payments->sum('amount')) }} diff --git a/resources/views/projects/subscriptions.blade.php b/resources/views/projects/subscriptions.blade.php index a74418e..29e1e35 100755 --- a/resources/views/projects/subscriptions.blade.php +++ b/resources/views/projects/subscriptions.blade.php @@ -33,7 +33,7 @@ {{ $subscription->nameLink() }} {{ date_id($subscription->start_date) }} {{ date_id($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} - {{ formatRp($subscription->price) }} + {{ format_money($subscription->price) }} {!! link_to_route('subscriptions.show',trans('app.show'),[$subscription->id],['class'=>'btn btn-info btn-xs']) !!} {!! link_to_route('subscriptions.edit',trans('app.edit'),[$subscription->id],['class'=>'btn btn-warning btn-xs']) !!} diff --git a/resources/views/reports/current-credits.blade.php b/resources/views/reports/current-credits.blade.php index b5bf46b..be2e2a9 100644 --- a/resources/views/reports/current-credits.blade.php +++ b/resources/views/reports/current-credits.blade.php @@ -23,9 +23,9 @@ {{ 1 + $key }} {!! link_to_route('projects.payments', $project->name, [$project->id], ['title' => __('project.view_payments'), 'target' => '_blank']) !!} - {{ formatRp($project->project_value) }} - {{ formatRp($project->cashInTotal()) }} - {{ formatRp($project->balance = $project->project_value - $project->cashInTotal()) }} + {{ format_money($project->project_value) }} + {{ format_money($project->cashInTotal()) }} + {{ format_money($project->balance = $project->project_value - $project->cashInTotal()) }} {{ $project->customer->name }} {{ $project->present()->status }} @@ -36,7 +36,7 @@ {{ __('app.total') }} - {{ formatRp($projects->sum('balance')) }} + {{ format_money($projects->sum('balance')) }}   diff --git a/resources/views/reports/payments/daily.blade.php b/resources/views/reports/payments/daily.blade.php index 89a9809..a277da3 100755 --- a/resources/views/reports/payments/daily.blade.php +++ b/resources/views/reports/payments/daily.blade.php @@ -67,7 +67,7 @@ {{ __('app.total') }} - {{ formatRp($total) }} + {{ format_money($total) }}   diff --git a/resources/views/reports/payments/monthly.blade.php b/resources/views/reports/payments/monthly.blade.php index 7345caa..13b947e 100755 --- a/resources/views/reports/payments/monthly.blade.php +++ b/resources/views/reports/payments/monthly.blade.php @@ -50,9 +50,9 @@ {{ date_id($date = $year.'-'.$month.'-'.$dateNumber) }} {{ $count }} - {{ formatRp($any ? $reports[$dateNumber]->cashin : 0) }} - {{ formatRp($any ? $reports[$dateNumber]->cashout : 0) }} - {{ formatRp($profit) }} + {{ format_money($any ? $reports[$dateNumber]->cashin : 0) }} + {{ format_money($any ? $reports[$dateNumber]->cashout : 0) }} + {{ format_money($profit) }} {{ link_to_route( 'reports.payments.daily', @@ -75,9 +75,9 @@ {{ __('app.total') }} {{ $reports->sum('count') }} - {{ formatRp($reports->sum('cashin')) }} - {{ formatRp($reports->sum('cashout')) }} - {{ formatRp($reports->sum('profit')) }} + {{ format_money($reports->sum('cashin')) }} + {{ format_money($reports->sum('cashout')) }} + {{ format_money($reports->sum('profit')) }}   diff --git a/resources/views/reports/payments/yearly.blade.php b/resources/views/reports/payments/yearly.blade.php index d9209bf..ca28dd9 100755 --- a/resources/views/reports/payments/yearly.blade.php +++ b/resources/views/reports/payments/yearly.blade.php @@ -44,9 +44,9 @@ {{ month_id($monthNumber) }} {{ $any ? $reports[$monthNumber]->count : 0 }} - {{ formatRp($any ? $reports[$monthNumber]->cashin : 0) }} - {{ formatRp($any ? $reports[$monthNumber]->cashout : 0) }} - {{ formatRp($profit = $any ? $reports[$monthNumber]->profit : 0) }} + {{ format_money($any ? $reports[$monthNumber]->cashin : 0) }} + {{ format_money($any ? $reports[$monthNumber]->cashout : 0) }} + {{ format_money($profit = $any ? $reports[$monthNumber]->profit : 0) }} {{ link_to_route( 'reports.payments.monthly', @@ -69,9 +69,9 @@ {{ trans('app.total') }} {{ $reports->sum('count') }} - {{ formatRp($reports->sum('cashin')) }} - {{ formatRp($reports->sum('cashout')) }} - {{ formatRp($reports->sum('profit')) }} + {{ format_money($reports->sum('cashin')) }} + {{ format_money($reports->sum('cashout')) }} + {{ format_money($reports->sum('profit')) }}   diff --git a/resources/views/subscriptions/index.blade.php b/resources/views/subscriptions/index.blade.php index 7f077c5..2d0fdda 100755 --- a/resources/views/subscriptions/index.blade.php +++ b/resources/views/subscriptions/index.blade.php @@ -36,7 +36,7 @@ {{ date_id($subscription->due_date) }} {!! $subscription->nearOfDueDateSign() !!} - {{ formatRp($subscription->price) }} + {{ format_money($subscription->price) }} {{ $subscription->vendor->name }} {{ $subscription->status() }} diff --git a/resources/views/subscriptions/partials/subscription-show.blade.php b/resources/views/subscriptions/partials/subscription-show.blade.php index 89c6866..7d4f422 100644 --- a/resources/views/subscriptions/partials/subscription-show.blade.php +++ b/resources/views/subscriptions/partials/subscription-show.blade.php @@ -1,7 +1,7 @@ - + diff --git a/resources/views/users/jobs.blade.php b/resources/views/users/jobs.blade.php index e61b9e2..682875d 100755 --- a/resources/views/users/jobs.blade.php +++ b/resources/views/users/jobs.blade.php @@ -34,7 +34,7 @@ - + - + - + @endforeach @@ -52,7 +52,7 @@ - + diff --git a/tests/Feature/Invoices/InvoiceEntryTest.php b/tests/Feature/Invoices/InvoiceEntryTest.php index b635e7b..0401c98 100644 --- a/tests/Feature/Invoices/InvoiceEntryTest.php +++ b/tests/Feature/Invoices/InvoiceEntryTest.php @@ -87,7 +87,7 @@ class InvoiceEntryTest extends TestCase $this->seePageIs(route('invoice-drafts.show', $draft->draftKey)); $this->assertEquals(5000, $draft->getTotal()); - $this->see(formatRp(5000)); + $this->see(format_money(5000)); } /** @test */ @@ -137,7 +137,7 @@ class InvoiceEntryTest extends TestCase $this->assertEquals(200, $draft->getTotal()); - $this->see(formatRp($draft->getTotal())); + $this->see(format_money($draft->getTotal())); } /** @test */ @@ -174,7 +174,7 @@ class InvoiceEntryTest extends TestCase $this->see($project->name); $this->see($project->customer->name); $this->see($draft->notes); - $this->see(formatRp(3000)); + $this->see(format_money(3000)); $this->seeElement('input', ['id' => 'save-invoice-draft']); } diff --git a/tests/Feature/ManageJobsTest.php b/tests/Feature/ManageJobsTest.php index c9972d9..a5aa6e2 100644 --- a/tests/Feature/ManageJobsTest.php +++ b/tests/Feature/ManageJobsTest.php @@ -142,7 +142,7 @@ class ManageJobsTest extends TestCase $this->seePageIs(route('jobs.show', $project->id)); $this->see(trans('job.detail')); $this->see($job->name); - $this->see(formatRp($job->price)); + $this->see(format_money($job->price)); $this->see($job->worker->name); } diff --git a/tests/Feature/ManageSubscriptionsTest.php b/tests/Feature/ManageSubscriptionsTest.php index 69ebaf6..8046f58 100644 --- a/tests/Feature/ManageSubscriptionsTest.php +++ b/tests/Feature/ManageSubscriptionsTest.php @@ -111,7 +111,7 @@ class ManageSubscriptionsTest extends TestCase $this->visit(route('subscriptions.show', $subscription->id)); $this->see($subscription->name); - $this->see(formatRp($subscription->price)); + $this->see(format_money($subscription->price)); $this->see(date_id($subscription->start_date)); $this->see(date_id($subscription->due_date)); } diff --git a/tests/Feature/Payments/ManagePaymentsTest.php b/tests/Feature/Payments/ManagePaymentsTest.php index 9d0133b..8f2cbdc 100644 --- a/tests/Feature/Payments/ManagePaymentsTest.php +++ b/tests/Feature/Payments/ManagePaymentsTest.php @@ -216,7 +216,7 @@ class ManagePaymentsTest extends TestCase $this->seePageIs(route('payments.show', $payment->id)); $this->see(trans('payment.detail')); $this->see($payment->date); - $this->see(formatRp($payment->amount)); + $this->see(format_money($payment->amount)); $this->see($payment->description); $this->see($payment->partner->name); } diff --git a/tests/Unit/Helpers/MoneyFormatTest.php b/tests/Unit/Helpers/MoneyFormatTest.php index fc0384c..483d96c 100644 --- a/tests/Unit/Helpers/MoneyFormatTest.php +++ b/tests/Unit/Helpers/MoneyFormatTest.php @@ -17,9 +17,9 @@ class MoneyFormatTest extends TestCase /** @test */ public function format_money_returns_string_with_default_money_sign() { - $this->assertEquals('Rp. 1.000', formatRp(1000)); - $this->assertEquals('Rp. 0', formatRp(0)); - $this->assertEquals('- Rp. 1.000', formatRp(-1000)); + $this->assertEquals('Rp. 1.000', format_money(1000)); + $this->assertEquals('Rp. 0', format_money(0)); + $this->assertEquals('- Rp. 1.000', format_money(-1000)); } /** @test */ @@ -30,8 +30,8 @@ class MoneyFormatTest extends TestCase 'value' => 'USD', ]); - $this->assertEquals('USD 1.000', formatRp(1000)); - $this->assertEquals('USD 0', formatRp(0)); - $this->assertEquals('- USD 1.000', formatRp(-1000)); + $this->assertEquals('USD 1.000', format_money(1000)); + $this->assertEquals('USD 0', format_money(0)); + $this->assertEquals('- USD 1.000', format_money(-1000)); } } From b0dfc805e93f4c5b30f813d84c7bad699951ee74 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 23 Dec 2018 21:10:03 +0800 Subject: [PATCH 09/13] Change formatSizeUnits() to format_size_units() --- app/helpers.php | 2 +- resources/views/backups/index.blade.php | 2 +- resources/views/projects/files.blade.php | 46 ++++++++++++++--------------- resources/views/reports/log-files.blade.php | 26 +++++++--------- 4 files changed, 36 insertions(+), 40 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 6894fa1..8fb5c3c 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -150,7 +150,7 @@ function str_split_ucwords($string) * @param int $bytes File size. * @return string Converted file size with unit. */ -function formatSizeUnits($bytes) +function format_size_units($bytes) { if ($bytes >= 1073741824) { $bytes = number_format($bytes / 1073741824, 2).' GB'; diff --git a/resources/views/backups/index.blade.php b/resources/views/backups/index.blade.php index 8976fdc..d9efab9 100644 --- a/resources/views/backups/index.blade.php +++ b/resources/views/backups/index.blade.php @@ -24,7 +24,7 @@ - + - + @forelse($logFiles as $key => $logFile) - + @empty - - - + @endforelse
{{ trans('subscription.name') }}{{ $subscription->name }}
{{ trans('subscription.price') }}{{ formatRp($subscription->price) }}
{{ trans('subscription.price') }}{{ format_money($subscription->price) }}
{{ trans('subscription.type') }}{{ $subscription->type }}
{{ trans('subscription.start_date') }}{{ date_id($subscription->start_date) }}
{{ trans('subscription.due_date') }}{{ date_id($subscription->due_date) }}
{{ $job->tasks_count = $job->tasks->count() }} {{ format_decimal($job->progress = $job->progress) }} %{{ formatRp($job->price) }}{{ format_money($job->price) }} {!! html_link_to_route('jobs.show', '', [$job], [ 'icon' => 'search', diff --git a/resources/views/users/projects.blade.php b/resources/views/users/projects.blade.php index 34e1075..9c625d2 100755 --- a/resources/views/users/projects.blade.php +++ b/resources/views/users/projects.blade.php @@ -30,7 +30,7 @@ {{ $project->nameLink() }} {{ $project->start_date }} {{ $project->work_duration }}{{ formatRp($project->project_value) }}{{ format_money($project->project_value) }} {{ $project->present()->status }} {{ $project->customer->name }} diff --git a/resources/views/vendors/show.blade.php b/resources/views/vendors/show.blade.php index 953dc32..1f0db62 100755 --- a/resources/views/vendors/show.blade.php +++ b/resources/views/vendors/show.blade.php @@ -44,7 +44,7 @@ {{ 1 + $key }} {{ $payment->project->name }} {{ $payment->date }}{{ formatRp($payment->amount) }}{{ format_money($payment->amount) }} {{ $payment->description }}
{{ __('app.total') }}{{ formatRp($vendor->payments->sum('amount')) }}{{ format_money($vendor->payments->sum('amount')) }}  
{{ $key + 1 }} {{ $backup->getFilename() }}{{ formatSizeUnits($backup->getSize()) }}{{ format_size_units($backup->getSize()) }} {{ date('Y-m-d H:i:s', $backup->getMTime()) }} name) +@section('title', __('project.files').' | '.$project->name) @section('content') -@include('projects.partials.breadcrumb',['title' => trans('project.files')]) +@include('projects.partials.breadcrumb',['title' => __('project.files')])

- {{ $project->name }} {{ trans('project.files') }} + {{ $project->name }} {{ __('project.files') }}

@include('projects.partials.nav-tabs') @@ -14,16 +14,16 @@
-

{{ trans('project.files') }}

+

{{ __('project.files') }}

- - - - - - + + + + + + @forelse($files as $key => $file) @@ -37,16 +37,16 @@
{{ $file->getDate() }}
{{ $file->getTime() }}
- + @empty - + @endforelse
{{ trans('app.table_no') }}{{ trans('file.file') }}{{ trans('file.updated_at') }}{{ trans('file.size') }}{{ trans('file.download') }}{{ trans('app.action') }}{{ __('app.table_no') }}{{ __('file.file') }}{{ __('file.updated_at') }}{{ __('file.size') }}{{ __('file.download') }}{{ __('app.action') }}
{{ formatSizeUnits($file->getSize()) }}{{ format_size_units($file->getSize()) }} - {!! html_link_to_route('files.download', '', [$file->id], ['icon' => 'file', 'title' => trans('file.download')]) !!} + {!! html_link_to_route('files.download', '', [$file->id], ['icon' => 'file', 'title' => __('file.download')]) !!} - {!! html_link_to_route('projects.files', '', [$project->id, 'action' => 'edit', 'id' => $file->id], ['icon' => 'edit', 'title' => trans('file.edit')]) !!} + {!! html_link_to_route('projects.files', '', [$project->id, 'action' => 'edit', 'id' => $file->id], ['icon' => 'edit', 'title' => __('file.edit')]) !!}
{{ trans('file.empty') }}
{{ __('file.empty') }}
@@ -55,27 +55,27 @@
@if (Request::has('action') == false)
-

{{ trans('file.create') }}

+

{{ __('file.create') }}

{!! Form::open(['route' => ['files.upload', $project->id], 'id' => 'upload-file', 'files' => true]) !!} {{ Form::hidden('fileable_type', get_class($project)) }} - {!! FormField::file('file', ['label' => trans('file.select')]) !!} + {!! FormField::file('file', ['label' => __('file.select')]) !!} {!! FormField::text('title') !!} {!! FormField::textarea('description') !!} - {!! Form::submit(trans('file.upload'), ['class' => 'btn btn-info']) !!} + {!! Form::submit(__('file.upload'), ['class' => 'btn btn-info']) !!} {!! Form::close() !!}
@endif @if (Request::get('action') == 'edit' && $editableFile)
-

{{ trans('file.edit') }} : {{ $editableFile->title }}

+

{{ __('file.edit') }} : {{ $editableFile->title }}

{!! Form::model($editableFile, ['route' => ['files.update', $editableFile->id],'method' => 'patch']) !!} - {!! FormField::text('title', ['label' => trans('file.title'), 'required' => true]) !!} - {!! FormField::textarea('description', ['label' => trans('file.description')]) !!} - {!! Form::submit(trans('file.update'), ['class' => 'btn btn-success']) !!} - {{ link_to_route('projects.files', trans('app.cancel'), [$project->id], ['class' => 'btn btn-default']) }} + {!! FormField::text('title', ['label' => __('file.title'), 'required' => true]) !!} + {!! FormField::textarea('description', ['label' => __('file.description')]) !!} + {!! Form::submit(__('file.update'), ['class' => 'btn btn-success']) !!} + {{ link_to_route('projects.files', __('app.cancel'), [$project->id], ['class' => 'btn btn-default']) }} {!! Form::close() !!}
@@ -84,4 +84,4 @@
-@endsection \ No newline at end of file +@endsection diff --git a/resources/views/reports/log-files.blade.php b/resources/views/reports/log-files.blade.php index a651c9f..16b2c50 100755 --- a/resources/views/reports/log-files.blade.php +++ b/resources/views/reports/log-files.blade.php @@ -1,11 +1,9 @@ @extends('layouts.app') -@section('title','Log Files') +@section('title', 'Log Files') @section('content') - +
@@ -15,35 +13,33 @@
Nama File Ukuran Tanggal Jam{{ trans('app.action') }}{{ __('app.action') }}
{{ $key + 1 }} {{ $logFile->getFilename() }}{{ formatSizeUnits($logFile->getSize()) }}{{ format_size_units($logFile->getSize()) }} {{ date('Y-m-d H:i:s', $logFile->getMTime()) }} - {!! html_link_to_route('log-files.download','',[$logFile->getFilename()],[ + {!! html_link_to_route('log-files.download', '', [$logFile->getFilename()], [ 'class'=>'btn btn-default btn-xs', 'icon' => 'download', - 'id' => 'download-' . $logFile->getFilename(), - 'title' => 'Download file ' . $logFile->getFilename() + 'id' => 'download-'.$logFile->getFilename(), + 'title' => 'Download file '.$logFile->getFilename() ]) !!} - {!! html_link_to_route('log-files.show','',[$logFile->getFilename()],[ + {!! html_link_to_route('log-files.show', '', [$logFile->getFilename()], [ 'class'=>'btn btn-default btn-xs', 'icon' => 'search', - 'id' => 'view-' . $logFile->getFilename(), - 'title' => 'View file ' . $logFile->getFilename(), + 'id' => 'view-'.$logFile->getFilename(), + 'title' => 'View file '.$logFile->getFilename(), 'target' => '_blank', ]) !!}
Belum ada file logFile
Belum ada file logFile
From 5c54caa65cef328c41df5bfa34a33db676dd95b4 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 23 Dec 2018 21:11:59 +0800 Subject: [PATCH 10/13] Change formatNo() to format_no() --- app/helpers.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 8fb5c3c..d0b2d36 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -6,7 +6,7 @@ * @param int $number money in integer format * @return string money in string format */ -function formatNo($number) +function format_no($number) { return number_format($number, 0, ',', '.'); } @@ -26,10 +26,10 @@ function format_money($number) } if ($number < 0) { - return '- '.$moneySign.' '.formatNo(abs($number)); + return '- '.$moneySign.' '.format_no(abs($number)); } - return $moneySign.' '.formatNo($number); + return $moneySign.' '.format_no($number); } /** From 350e4196f9d2e563e838deaac9e51802788df362 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Tue, 25 Dec 2018 14:14:18 +0800 Subject: [PATCH 11/13] Change monthDateArray() to month_date_array() --- app/helpers.php | 2 +- resources/views/reports/payments/monthly.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index d0b2d36..4d801c6 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -244,7 +244,7 @@ function appLogoPath() * @param string $month * @return array */ -function monthDateArray($year, $month) +function month_date_array($year, $month) { $dateCount = Carbon::parse($year.'-'.$month)->format('t'); $dates = []; diff --git a/resources/views/reports/payments/monthly.blade.php b/resources/views/reports/payments/monthly.blade.php index 13b947e..8c9711c 100755 --- a/resources/views/reports/payments/monthly.blade.php +++ b/resources/views/reports/payments/monthly.blade.php @@ -40,7 +40,7 @@ @php $chartData = []; @endphp - @foreach(monthDateArray($year, $month) as $dateNumber) + @foreach(month_date_array($year, $month) as $dateNumber) @php $any = isset($reports[$dateNumber]); $count = $any ? $reports[$dateNumber]->count : 0; From 3cc999c0bc2ea787025d9bc28d3aae4c31393cbb Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Tue, 25 Dec 2018 14:16:46 +0800 Subject: [PATCH 12/13] Change logo function helpers name Change appLogoImage() to app_logo_image() Change appLogoPath() to app_logo_path() --- app/helpers.php | 6 +++--- resources/views/auth/app-install.blade.php | 2 +- resources/views/auth/login.blade.php | 2 +- resources/views/invoices/pdf.blade.php | 2 +- resources/views/layouts/partials/sidebar.blade.php | 2 +- resources/views/payments/pdf.blade.php | 2 +- resources/views/users/agency/edit.blade.php | 2 +- resources/views/users/agency/show.blade.php | 2 +- tests/Unit/Helpers/AppLogoImageTest.php | 12 ++++++------ 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 4d801c6..368fd3c 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -211,10 +211,10 @@ function dateDifference($date1, $date2, $differenceFormat = '%a') * @param array $attributes * @return \Illuminate\Support\HtmlString */ -function appLogoImage($attributes = []) +function app_logo_image($attributes = []) { return Html::image( - appLogoPath(), + app_logo_path(), 'Logo '.Option::get('agency_name', 'Laravel'), $attributes ); @@ -225,7 +225,7 @@ function appLogoImage($attributes = []) * * @return string */ -function appLogoPath() +function app_logo_path() { $defaultLogoImagePath = 'default-logo.png'; $optionLogoImagePath = Option::get('agency_logo_path'); diff --git a/resources/views/auth/app-install.blade.php b/resources/views/auth/app-install.blade.php index bce3cb6..7527df9 100644 --- a/resources/views/auth/app-install.blade.php +++ b/resources/views/auth/app-install.blade.php @@ -11,7 +11,7 @@
- {!! appLogoImage(['style' => 'width:150px']) !!} + {!! app_logo_image(['style' => 'width:150px']) !!}

{{ config('app.name') }}

diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index daa20cf..05bf52e 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -5,7 +5,7 @@ @section('content')