From 85fd9ffcae99453037afd6dc54f1f374ec1fc874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Mon, 28 Jun 2021 12:47:56 +0300 Subject: [PATCH] close #2155 Added: Creating new Bill&Invoice from Customer Screen --- app/Http/Controllers/Purchases/Vendors.php | 7 +++++++ app/Http/Controllers/Sales/Customers.php | 7 +++++++ resources/views/purchases/vendors/show.blade.php | 4 ++++ resources/views/sales/customers/show.blade.php | 4 ++++ routes/admin.php | 2 ++ 5 files changed, 24 insertions(+) diff --git a/app/Http/Controllers/Purchases/Vendors.php b/app/Http/Controllers/Purchases/Vendors.php index d970c6f86..db7ecab05 100644 --- a/app/Http/Controllers/Purchases/Vendors.php +++ b/app/Http/Controllers/Purchases/Vendors.php @@ -322,4 +322,11 @@ class Vendors extends Controller return response()->json($vendor); } + + public function createBill(Contact $vendor) + { + $data['contact'] = $vendor; + + return redirect()->route('bills.create')->withInput($data); + } } diff --git a/app/Http/Controllers/Sales/Customers.php b/app/Http/Controllers/Sales/Customers.php index 351b067c2..f6976d68f 100644 --- a/app/Http/Controllers/Sales/Customers.php +++ b/app/Http/Controllers/Sales/Customers.php @@ -320,4 +320,11 @@ class Customers extends Controller return response()->json($customer); } + + public function createInvoice(Contact $customer) + { + $data['contact'] = $customer; + + return redirect()->route('invoices.create')->withInput($data); + } } diff --git a/resources/views/purchases/vendors/show.blade.php b/resources/views/purchases/vendors/show.blade.php index 3a4aba493..1224ecf61 100644 --- a/resources/views/purchases/vendors/show.blade.php +++ b/resources/views/purchases/vendors/show.blade.php @@ -70,6 +70,10 @@ @stack('vendor_edit_button_start') {{ trans('general.edit') }} @stack('vendor_edit_button_end') + + @stack('vendor_create_bill_button_start') + {{ trans('bills.create_bill') }} + @stack('vendor_create_bill_button_end')
diff --git a/resources/views/sales/customers/show.blade.php b/resources/views/sales/customers/show.blade.php index e47799414..ba3ffb964 100644 --- a/resources/views/sales/customers/show.blade.php +++ b/resources/views/sales/customers/show.blade.php @@ -70,6 +70,10 @@ @stack('customer_edit_button_start') {{ trans('general.edit') }} @stack('customer_edit_button_end') + + @stack('customer_create_invoice_button_start') + {{ trans('invoices.create_invoice') }} + @stack('customer_create_invoice_button_end')
diff --git a/routes/admin.php b/routes/admin.php index 69765e0b3..448916395 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -96,6 +96,7 @@ Route::group(['prefix' => 'sales'], function () { Route::get('customers/{customer}/enable', 'Sales\Customers@enable')->name('customers.enable'); Route::get('customers/{customer}/disable', 'Sales\Customers@disable')->name('customers.disable'); Route::get('customers/{customer}/currency', 'Sales\Customers@currency')->name('customers.currency'); + Route::get('customers/{customer}/create-invoice', 'Sales\Customers@createInvoice')->name('customers.create-invoice'); Route::resource('customers', 'Sales\Customers'); }); @@ -126,6 +127,7 @@ Route::group(['prefix' => 'purchases'], function () { Route::get('vendors/{vendor}/enable', 'Purchases\Vendors@enable')->name('vendors.enable'); Route::get('vendors/{vendor}/currency', 'Purchases\Vendors@currency')->name('vendors.currency'); Route::get('vendors/{vendor}/disable', 'Purchases\Vendors@disable')->name('vendors.disable'); + Route::get('vendors/{vendor}/create-bill', 'Purchases\Vendors@createBill')->name('vendors.create-bill'); Route::resource('vendors', 'Purchases\Vendors', ['middleware' => ['dropzone']]); });