From d6c1d557edc42f2c4c7ba60f314000912dd12c78 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 7 Apr 2019 18:12:53 +0800 Subject: [PATCH] Change formatNo and formatRp helper name --- app/Helpers/helpers.php | 6 +++--- app/Http/Controllers/CartController.php | 4 ++-- resources/views/cart/partials/draft-confirm.blade.php | 18 +++++++++--------- .../views/cart/partials/draft-item-list.blade.php | 10 +++++----- .../cart/partials/product-search-result-box.blade.php | 2 +- resources/views/products/index.blade.php | 4 ++-- resources/views/products/partials/forms.blade.php | 4 ++-- resources/views/products/price-list.blade.php | 4 ++-- resources/views/reports/sales/daily.blade.php | 4 ++-- resources/views/reports/sales/monthly.blade.php | 4 ++-- resources/views/reports/sales/yearly.blade.php | 4 ++-- resources/views/transactions/index.blade.php | 2 +- resources/views/transactions/pdf.blade.php | 14 +++++++------- resources/views/transactions/receipt.blade.php | 14 +++++++------- resources/views/transactions/show.blade.php | 18 +++++++++--------- tests/Feature/TransactionEntryTest.php | 12 ++++++------ 16 files changed, 62 insertions(+), 62 deletions(-) diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php index e6fd186..8b2dbd0 100644 --- a/app/Helpers/helpers.php +++ b/app/Helpers/helpers.php @@ -1,17 +1,17 @@ 'required|numeric|min:'.$request->get('total').'|max:'.($request->get('total') + 100000), 'notes' => 'nullable|string|max:100', ], [ - 'payment.min' => 'Pembayaran minimal '.formatRp($request->get('total')).'.', - 'payment.max' => 'Pembayaran terlalu besar '.formatRp($request->get('payment')).'.', + 'payment.min' => 'Pembayaran minimal '.format_rp($request->get('total')).'.', + 'payment.max' => 'Pembayaran terlalu besar '.format_rp($request->get('payment')).'.', ]); $draft = $this->cart->updateDraftAttributes($draftKey, $request->only('customer', 'notes', 'payment')); diff --git a/resources/views/cart/partials/draft-confirm.blade.php b/resources/views/cart/partials/draft-confirm.blade.php index 570be31..49261e9 100644 --- a/resources/views/cart/partials/draft-confirm.blade.php +++ b/resources/views/cart/partials/draft-confirm.blade.php @@ -19,10 +19,10 @@ {{ $key + 1 }} {{ $item->name }} - {{ formatRp($item->price) }} - {{ formatRp($item->item_discount) }} + {{ format_rp($item->price) }} + {{ format_rp($item->item_discount) }} {{ $item->qty }} - {{ formatRp($item->subtotal) }} + {{ format_rp($item->subtotal) }} @empty @endforelse @@ -32,15 +32,15 @@ {{ trans('transaction.subtotal') }} : - {{ formatRp($draft->getSubtotal()) }} + {{ format_rp($draft->getSubtotal()) }} {{ trans('transaction.discount_total') }} : - {{ formatRp($draft->getDiscountTotal()) }} + {{ format_rp($draft->getDiscountTotal()) }} {{ trans('transaction.total') }} : - {{ formatRp($draft->getTotal()) }} + {{ format_rp($draft->getTotal()) }} @@ -55,9 +55,9 @@ {{ trans('transaction.customer_name') }}{{ $draft->customer['name'] }} {{ trans('transaction.customer_phone') }}{{ $draft->customer['phone'] }} - {{ trans('transaction.payment') }}{{ formatRp($draft->payment) }} - {{ trans('transaction.total') }}{{ formatRp($draft->getTotal()) }} - {{ trans('transaction.exchange') }}{{ formatRp($draft->getExchange()) }} + {{ trans('transaction.payment') }}{{ format_rp($draft->payment) }} + {{ trans('transaction.total') }}{{ format_rp($draft->getTotal()) }} + {{ trans('transaction.exchange') }}{{ format_rp($draft->getExchange()) }} {{ trans('transaction.notes') }}{{ $draft->notes }} diff --git a/resources/views/cart/partials/draft-item-list.blade.php b/resources/views/cart/partials/draft-item-list.blade.php index 7029cae..40b9a9c 100644 --- a/resources/views/cart/partials/draft-item-list.blade.php +++ b/resources/views/cart/partials/draft-item-list.blade.php @@ -27,7 +27,7 @@ {{ $item->name }}
({{ $item->unit }}) - {{ formatRp($item->price) }} + {{ format_rp($item->price) }} {{ Form::open(['route' => ['cart.update-draft-item', $draft->draftKey], 'method' => 'patch']) }} {{ Form::hidden('item_key', $key) }} @@ -43,7 +43,7 @@ 'min' => 1 ]) }} - {{ formatRp($item->subtotal) }} + {{ format_rp($item->subtotal) }} {{ Form::submit('update-item-' . $key, ['style'=>'display:none']) }} {{ Form::close() }} @@ -60,17 +60,17 @@ {{ trans('transaction.subtotal') }} : - {{ formatRp($draft->getSubtotal()) }} + {{ format_rp($draft->getSubtotal()) }} {{ trans('transaction.discount_total') }} : - {{ formatRp($draft->getDiscountTotal()) }} + {{ format_rp($draft->getDiscountTotal()) }} {{ trans('transaction.total') }} : - {{ formatRp($draft->getTotal()) }} + {{ format_rp($draft->getTotal()) }} diff --git a/resources/views/cart/partials/product-search-result-box.blade.php b/resources/views/cart/partials/product-search-result-box.blade.php index 60e050c..1266191 100644 --- a/resources/views/cart/partials/product-search-result-box.blade.php +++ b/resources/views/cart/partials/product-search-result-box.blade.php @@ -13,7 +13,7 @@ {{ $product->name }} {{ $product->unit->name }} - {{ formatRp($product->getPrice($draftType)) }} + {{ format_rp($product->getPrice($draftType)) }}
diff --git a/resources/views/products/index.blade.php b/resources/views/products/index.blade.php index ac6476d..386e624 100644 --- a/resources/views/products/index.blade.php +++ b/resources/views/products/index.blade.php @@ -40,8 +40,8 @@ {{ $products->firstItem() + $key }} {{ $product->name }} {{ $product->unit->name }} - {{ formatRp($product->cash_price) }} - {{ formatRp($product->credit_price) }} + {{ format_rp($product->cash_price) }} + {{ format_rp($product->credit_price) }} {!! link_to_route('products.index', __('app.edit'), ['action' => 'edit', 'id' => $product->id] + request(['page','q']), ['id' => 'edit-product-' . $product->id]) !!} | {!! link_to_route('products.index', __('app.delete'), ['action' => 'delete', 'id' => $product->id] + request(['page','q']), ['id' => 'del-product-' . $product->id]) !!} diff --git a/resources/views/products/partials/forms.blade.php b/resources/views/products/partials/forms.blade.php index a1c886e..4a5121e 100644 --- a/resources/views/products/partials/forms.blade.php +++ b/resources/views/products/partials/forms.blade.php @@ -37,8 +37,8 @@ {{ __('product.name') }}{{ $editableProduct->name }} {{ __('product.unit') }}{{ $editableProduct->unit->name }} - {{ __('product.cash_price') }}{{ formatRp($editableProduct->cash_price) }} - {{ __('product.credit_price') }}{{ formatRp($editableProduct->credit_price) }} + {{ __('product.cash_price') }}{{ format_rp($editableProduct->cash_price) }} + {{ __('product.credit_price') }}{{ format_rp($editableProduct->credit_price) }}
diff --git a/resources/views/products/price-list.blade.php b/resources/views/products/price-list.blade.php index 7b45004..a64a720 100644 --- a/resources/views/products/price-list.blade.php +++ b/resources/views/products/price-list.blade.php @@ -22,8 +22,8 @@ @foreach($chunckedProducts as $key => $product) {{ $key + 1 }}) {{ $product->name }} ({{ $product->unit->name }}) - {{ formatRp($product->cash_price) }} - {{ formatRp($product->credit_price) }} + {{ format_rp($product->cash_price) }} + {{ format_rp($product->credit_price) }} @endforeach diff --git a/resources/views/reports/sales/daily.blade.php b/resources/views/reports/sales/daily.blade.php index 6692548..8e78524 100755 --- a/resources/views/reports/sales/daily.blade.php +++ b/resources/views/reports/sales/daily.blade.php @@ -32,7 +32,7 @@ {{ 1 + $key }} {{ dateId($transaction->created_at->format('Y-m-d')) }} - {{ formatRp($transaction->total) }} + {{ format_rp($transaction->total) }} {{ link_to_route( 'transactions.show', @@ -53,7 +53,7 @@ {{ __('app.total') }} - {{ formatRp($transactions->sum('total')) }} + {{ format_rp($transactions->sum('total')) }}   diff --git a/resources/views/reports/sales/monthly.blade.php b/resources/views/reports/sales/monthly.blade.php index 06a8374..5902bb1 100755 --- a/resources/views/reports/sales/monthly.blade.php +++ b/resources/views/reports/sales/monthly.blade.php @@ -44,7 +44,7 @@ {{ dateId($date = $year.'-'.$month.'-'.$dateNumber) }} {{ $count }} - {{ formatRp($subtotal) }} + {{ format_rp($subtotal) }} {{ link_to_route( 'reports.sales.daily', @@ -67,7 +67,7 @@ {{ __('app.total') }} {{ $reports->sum('count') }} - {{ formatRp($reports->sum('amount')) }} + {{ format_rp($reports->sum('amount')) }}   diff --git a/resources/views/reports/sales/yearly.blade.php b/resources/views/reports/sales/yearly.blade.php index 394ade1..de90275 100755 --- a/resources/views/reports/sales/yearly.blade.php +++ b/resources/views/reports/sales/yearly.blade.php @@ -40,7 +40,7 @@ {{ monthId($monthNumber) }} {{ $any ? $reports[$monthNumber]->count : 0 }} - {{ formatRp($omzet) }} + {{ format_rp($omzet) }} {{ link_to_route( 'reports.sales.monthly', @@ -63,7 +63,7 @@ {{ trans('app.total') }} {{ $reports->sum('count') }} - {{ formatRp($reports->sum('omzet')) }} + {{ format_rp($reports->sum('omzet')) }}   diff --git a/resources/views/transactions/index.blade.php b/resources/views/transactions/index.blade.php index b03bb59..39538ea 100644 --- a/resources/views/transactions/index.blade.php +++ b/resources/views/transactions/index.blade.php @@ -51,7 +51,7 @@ {{ $transaction->customer['phone'] ? '(' . $transaction->customer['phone'] . ')' : '' }} {{ $transaction->items_count }} - {{ formatRp($transaction->total) }} + {{ format_rp($transaction->total) }} {{ link_to_route('transactions.show', trans('app.show'), $transaction->invoice_no) }} | {{ link_to_route('transactions.receipt', trans('app.print'), $transaction->invoice_no) }} diff --git a/resources/views/transactions/pdf.blade.php b/resources/views/transactions/pdf.blade.php index f12d40a..c16ae46 100644 --- a/resources/views/transactions/pdf.blade.php +++ b/resources/views/transactions/pdf.blade.php @@ -47,32 +47,32 @@ {{ $item['qty'] }} - {{ formatRp($item['price']) }}
({{ formatRp($item['item_discount']) }}) + {{ format_rp($item['price']) }}
({{ format_rp($item['item_discount']) }}) - {{ formatRp($item['subtotal']) }} + {{ format_rp($item['subtotal']) }} @endforeach @if ($loop->last && $loop->parent->last) {{ trans('transaction.subtotal') }} : - {{ formatRp($transaction['total'] + $discountTotal) }} + {{ format_rp($transaction['total'] + $discountTotal) }} {{ trans('transaction.discount_total') }} : - {{ formatRp($discountTotal) }} + {{ format_rp($discountTotal) }} {{ trans('transaction.total') }} : - {{ formatRp($transaction['total']) }} + {{ format_rp($transaction['total']) }} {{ trans('transaction.payment') }} : - {{ formatRp($transaction->payment) }} + {{ format_rp($transaction->payment) }} {{ trans('transaction.exchange') }} : - {{ formatRp($transaction->getExchange()) }} + {{ format_rp($transaction->getExchange()) }} @endif diff --git a/resources/views/transactions/receipt.blade.php b/resources/views/transactions/receipt.blade.php index a884566..3edf2e2 100644 --- a/resources/views/transactions/receipt.blade.php +++ b/resources/views/transactions/receipt.blade.php @@ -53,31 +53,31 @@ {{ $item['qty'] }} - {{ formatRp($item['price']) }} ({{ formatRp($item['item_discount']) }}) + {{ format_rp($item['price']) }} ({{ format_rp($item['item_discount']) }}) - {{ formatRp($item['subtotal']) }} + {{ format_rp($item['subtotal']) }} @endforeach {{ trans('transaction.subtotal') }} : - {{ formatRp($transaction['total'] + $discountTotal) }} + {{ format_rp($transaction['total'] + $discountTotal) }} {{ trans('transaction.discount_total') }} : - {{ formatRp($discountTotal) }} + {{ format_rp($discountTotal) }} {{ trans('transaction.total') }} : - {{ formatRp($transaction['total']) }} + {{ format_rp($transaction['total']) }} {{ trans('transaction.payment') }} : - {{ formatRp($transaction->payment) }} + {{ format_rp($transaction->payment) }} {{ trans('transaction.exchange') }} : - {{ formatRp($transaction->getExchange()) }} + {{ format_rp($transaction->getExchange()) }} diff --git a/resources/views/transactions/show.blade.php b/resources/views/transactions/show.blade.php index 925a904..21d7d80 100644 --- a/resources/views/transactions/show.blade.php +++ b/resources/views/transactions/show.blade.php @@ -20,9 +20,9 @@ {{ trans('transaction.customer_name') }}{{ $transaction->customer['name'] }} {{ trans('transaction.customer_phone') }}{{ $transaction->customer['phone'] }} {{ trans('transaction.items_count') }}{{ $transaction->items_count }} - {{ trans('transaction.total') }}{{ formatRp($transaction->total) }} - {{ trans('transaction.payment') }}{{ formatRp($transaction->payment) }} - {{ trans('transaction.exchange') }}{{ formatRp($transaction->getExchange()) }} + {{ trans('transaction.total') }}{{ format_rp($transaction->total) }} + {{ trans('transaction.payment') }}{{ format_rp($transaction->payment) }} + {{ trans('transaction.exchange') }}{{ format_rp($transaction->getExchange()) }} @@ -52,10 +52,10 @@ {{ $item['name'] }}
({{ $item['unit'] }}) - {{ formatRp($item['price']) }} - {{ formatRp($item['item_discount']) }} + {{ format_rp($item['price']) }} + {{ format_rp($item['item_discount']) }} {{ $item['qty'] }} - {{ formatRp($item['subtotal']) }} + {{ format_rp($item['subtotal']) }} @endforeach @@ -63,15 +63,15 @@ {{ trans('transaction.subtotal') }} : - {{ formatRp($transaction['total'] + $discountTotal) }} + {{ format_rp($transaction['total'] + $discountTotal) }} {{ trans('transaction.discount_total') }} : - {{ formatRp($discountTotal) }} + {{ format_rp($discountTotal) }} {{ trans('transaction.total') }} : - {{ formatRp($transaction['total']) }} + {{ format_rp($transaction['total']) }} diff --git a/tests/Feature/TransactionEntryTest.php b/tests/Feature/TransactionEntryTest.php index b602dea..f67ca46 100644 --- a/tests/Feature/TransactionEntryTest.php +++ b/tests/Feature/TransactionEntryTest.php @@ -67,7 +67,7 @@ class TransactionEntryTest extends BrowserKitTestCase $this->seePageIs(route('cart.show', [$draft->draftKey, 'query' => 'testing'])); // See product list appears $this->see($product->name); - $this->see(formatRp($product->credit_price)); + $this->see(format_rp($product->credit_price)); $this->seeElement('form', ['action' => route('cart.add-draft-item', [$draft->draftKey, $product->id])]); $this->seeElement('input', ['id' => 'qty-'.$product->id, 'name' => 'qty']); $this->seeElement('input', ['id' => 'add-product-'.$product->id]); @@ -110,7 +110,7 @@ class TransactionEntryTest extends BrowserKitTestCase $this->seeElement('input', ['id' => 'qty-'. 0]); $this->seeElement('input', ['id' => 'item_discount-'. 0]); $this->seeElement('button', ['id' => 'remove-item-'. 0]); - $this->see(formatRp(3800)); + $this->see(format_rp(3800)); } /** @test */ @@ -173,8 +173,8 @@ class TransactionEntryTest extends BrowserKitTestCase $this->assertEquals(6000, $draft->getSubtotal()); $this->assertEquals(5600, $draft->getTotal()); - $this->see(formatRp($draft->getSubtotal())); - $this->see(formatRp($draft->getTotal())); + $this->see(format_rp($draft->getSubtotal())); + $this->see(format_rp($draft->getTotal())); } /** @test */ @@ -208,8 +208,8 @@ class TransactionEntryTest extends BrowserKitTestCase $this->see($draft->customer['name']); $this->see($draft->customer['phone']); $this->see($draft->notes); - $this->see(formatRp(10000)); - $this->see(formatRp(3000)); + $this->see(format_rp(10000)); + $this->see(format_rp(3000)); $this->seeElement('input', ['id' => 'save-transaction-draft']); }