| @@ -22,7 +22,7 @@ abstract class DocumentModel extends Model | |||||||
|  |  | ||||||
|     public function scopeAccrued($query) |     public function scopeAccrued($query) | ||||||
|     { |     { | ||||||
|         return $query->where('status', '<>', 'draft'); |         return $query->whereNotIn('status', ['draft', 'cancelled']); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public function scopePaid($query) |     public function scopePaid($query) | ||||||
| @@ -146,6 +146,9 @@ abstract class DocumentModel extends Model | |||||||
|             case 'viewed': |             case 'viewed': | ||||||
|                 $label = 'warning'; |                 $label = 'warning'; | ||||||
|                 break; |                 break; | ||||||
|  |             case 'cancelled': | ||||||
|  |                 $label = 'darker'; | ||||||
|  |                 break; | ||||||
|             default: |             default: | ||||||
|                 $label = 'primary'; |                 $label = 'primary'; | ||||||
|                 break; |                 break; | ||||||
|   | |||||||
| @@ -3,6 +3,8 @@ | |||||||
| namespace App\BulkActions\Purchases; | namespace App\BulkActions\Purchases; | ||||||
|  |  | ||||||
| use App\Abstracts\BulkAction; | use App\Abstracts\BulkAction; | ||||||
|  | use App\Events\Purchase\BillCancelled; | ||||||
|  | use App\Events\Purchase\BillReceived; | ||||||
| use App\Exports\Purchases\Bills as Export; | use App\Exports\Purchases\Bills as Export; | ||||||
| use App\Jobs\Purchase\CreateBillHistory; | use App\Jobs\Purchase\CreateBillHistory; | ||||||
| use App\Jobs\Purchase\DeleteBill; | use App\Jobs\Purchase\DeleteBill; | ||||||
| @@ -18,6 +20,11 @@ class Bills extends BulkAction | |||||||
|             'message' => 'bulk_actions.message.received', |             'message' => 'bulk_actions.message.received', | ||||||
|             'permission' => 'update-purchases-bills', |             'permission' => 'update-purchases-bills', | ||||||
|         ], |         ], | ||||||
|  |         'cancelled' => [ | ||||||
|  |             'name' => 'general.cancel', | ||||||
|  |             'message' => 'bulk_actions.message.cancelled', | ||||||
|  |             'permission' => 'update-purchases-bills', | ||||||
|  |         ], | ||||||
|         'delete' => [ |         'delete' => [ | ||||||
|             'name' => 'general.delete', |             'name' => 'general.delete', | ||||||
|             'message' => 'bulk_actions.message.delete', |             'message' => 'bulk_actions.message.delete', | ||||||
| @@ -34,12 +41,16 @@ class Bills extends BulkAction | |||||||
|         $bills = $this->getSelectedRecords($request); |         $bills = $this->getSelectedRecords($request); | ||||||
|  |  | ||||||
|         foreach ($bills as $bill) { |         foreach ($bills as $bill) { | ||||||
|             $bill->status = 'received'; |             event(new BillReceived($bill)); | ||||||
|             $bill->save(); |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|             $description = trans('bills.mark_recevied'); |     public function cancelled($request) | ||||||
|  |     { | ||||||
|  |         $bills = $this->getSelectedRecords($request); | ||||||
|  |  | ||||||
|             $this->dispatch(new CreateBillHistory($bill, 0, $description)); |         foreach ($bills as $bill) { | ||||||
|  |             event(new BillCancelled($bill)); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
| namespace App\BulkActions\Sales; | namespace App\BulkActions\Sales; | ||||||
|  |  | ||||||
| use App\Abstracts\BulkAction; | use App\Abstracts\BulkAction; | ||||||
|  | use App\Events\Sale\InvoiceCancelled; | ||||||
| use App\Events\Sale\InvoiceCreated; | use App\Events\Sale\InvoiceCreated; | ||||||
| use App\Events\Sale\InvoiceSent; | use App\Events\Sale\InvoiceSent; | ||||||
| use App\Events\Sale\PaymentReceived; | use App\Events\Sale\PaymentReceived; | ||||||
| @@ -25,6 +26,11 @@ class Invoices extends BulkAction | |||||||
|             'message' => 'bulk_actions.message.sent', |             'message' => 'bulk_actions.message.sent', | ||||||
|             'permission' => 'update-sales-invoices', |             'permission' => 'update-sales-invoices', | ||||||
|         ], |         ], | ||||||
|  |         'cancelled' => [ | ||||||
|  |             'name' => 'general.cancel', | ||||||
|  |             'message' => 'bulk_actions.message.cancelled', | ||||||
|  |             'permission' => 'update-sales-invoices', | ||||||
|  |         ], | ||||||
|         'delete' => [ |         'delete' => [ | ||||||
|             'name' => 'general.delete', |             'name' => 'general.delete', | ||||||
|             'message' => 'bulk_actions.message.delete', |             'message' => 'bulk_actions.message.delete', | ||||||
| @@ -54,6 +60,15 @@ class Invoices extends BulkAction | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public function cancelled($request) | ||||||
|  |     { | ||||||
|  |         $invoices = $this->getSelectedRecords($request); | ||||||
|  |  | ||||||
|  |         foreach ($invoices as $invoice) { | ||||||
|  |             event(new InvoiceCancelled($invoice)); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public function duplicate($request) |     public function duplicate($request) | ||||||
|     { |     { | ||||||
|         $invoices = $this->getSelectedRecords($request); |         $invoices = $this->getSelectedRecords($request); | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								app/Events/Purchase/BillCancelled.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								app/Events/Purchase/BillCancelled.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace App\Events\Purchase; | ||||||
|  |  | ||||||
|  | use Illuminate\Queue\SerializesModels; | ||||||
|  |  | ||||||
|  | class BillCancelled | ||||||
|  | { | ||||||
|  |     use SerializesModels; | ||||||
|  |  | ||||||
|  |     public $bill; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Create a new event instance. | ||||||
|  |      * | ||||||
|  |      * @param $bill | ||||||
|  |      */ | ||||||
|  |     public function __construct($bill) | ||||||
|  |     { | ||||||
|  |         $this->bill = $bill; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										22
									
								
								app/Events/Sale/InvoiceCancelled.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								app/Events/Sale/InvoiceCancelled.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace App\Events\Sale; | ||||||
|  |  | ||||||
|  | use Illuminate\Queue\SerializesModels; | ||||||
|  |  | ||||||
|  | class InvoiceCancelled | ||||||
|  | { | ||||||
|  |     use SerializesModels; | ||||||
|  |  | ||||||
|  |     public $invoice; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Create a new event instance. | ||||||
|  |      * | ||||||
|  |      * @param $invoice | ||||||
|  |      */ | ||||||
|  |     public function __construct($invoice) | ||||||
|  |     { | ||||||
|  |         $this->invoice = $invoice; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -284,7 +284,25 @@ class Bills extends Controller | |||||||
|     { |     { | ||||||
|         event(new \App\Events\Purchase\BillReceived($bill)); |         event(new \App\Events\Purchase\BillReceived($bill)); | ||||||
|  |  | ||||||
|         $message = trans('bills.messages.received'); |         $message = trans('bills.messages.marked_received'); | ||||||
|  |  | ||||||
|  |         flash($message)->success(); | ||||||
|  |  | ||||||
|  |         return redirect()->back(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Mark the bill as cancelled. | ||||||
|  |      * | ||||||
|  |      * @param  Bill $bill | ||||||
|  |      * | ||||||
|  |      * @return Response | ||||||
|  |      */ | ||||||
|  |     public function markCancelled(Bill $bill) | ||||||
|  |     { | ||||||
|  |         event(new \App\Events\Purchase\BillCancelled($bill)); | ||||||
|  |  | ||||||
|  |         $message = trans('bills.messages.marked_cancelled'); | ||||||
|  |  | ||||||
|         flash($message)->success(); |         flash($message)->success(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -294,6 +294,24 @@ class Invoices extends Controller | |||||||
|         return redirect()->back(); |         return redirect()->back(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Mark the invoice as cancelled. | ||||||
|  |      * | ||||||
|  |      * @param  Invoice $invoice | ||||||
|  |      * | ||||||
|  |      * @return Response | ||||||
|  |      */ | ||||||
|  |     public function markCancelled(Invoice $invoice) | ||||||
|  |     { | ||||||
|  |         event(new \App\Events\Sale\InvoiceCancelled($invoice)); | ||||||
|  |  | ||||||
|  |         $message = trans('invoices.messages.marked_cancelled'); | ||||||
|  |  | ||||||
|  |         flash($message)->success(); | ||||||
|  |  | ||||||
|  |         return redirect()->back(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Download the PDF file of invoice. |      * Download the PDF file of invoice. | ||||||
|      * |      * | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								app/Jobs/Purchase/CancelBill.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								app/Jobs/Purchase/CancelBill.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace App\Jobs\Purchase; | ||||||
|  |  | ||||||
|  | use App\Abstracts\Job; | ||||||
|  | use App\Models\Purchase\Bill; | ||||||
|  |  | ||||||
|  | class CancelBill extends Job | ||||||
|  | { | ||||||
|  |     protected $bill; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Create a new job instance. | ||||||
|  |      * | ||||||
|  |      * @param  $bill | ||||||
|  |      */ | ||||||
|  |     public function __construct($bill) | ||||||
|  |     { | ||||||
|  |         $this->bill = $bill; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Execute the job. | ||||||
|  |      * | ||||||
|  |      * @return Bill | ||||||
|  |      */ | ||||||
|  |     public function handle() | ||||||
|  |     { | ||||||
|  |         $this->deleteRelationships($this->bill, [ | ||||||
|  |             'transactions', 'recurring' | ||||||
|  |         ]); | ||||||
|  |  | ||||||
|  |         $this->bill->status = 'cancelled'; | ||||||
|  |         $this->bill->save(); | ||||||
|  |  | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										38
									
								
								app/Jobs/Sale/CancelInvoice.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								app/Jobs/Sale/CancelInvoice.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace App\Jobs\Sale; | ||||||
|  |  | ||||||
|  | use App\Abstracts\Job; | ||||||
|  | use App\Models\Sale\Invoice; | ||||||
|  |  | ||||||
|  | class CancelInvoice extends Job | ||||||
|  | { | ||||||
|  |     protected $invoice; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Create a new job instance. | ||||||
|  |      * | ||||||
|  |      * @param  $invoice | ||||||
|  |      */ | ||||||
|  |     public function __construct($invoice) | ||||||
|  |     { | ||||||
|  |         $this->invoice = $invoice; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Execute the job. | ||||||
|  |      * | ||||||
|  |      * @return Invoice | ||||||
|  |      */ | ||||||
|  |     public function handle() | ||||||
|  |     { | ||||||
|  |         $this->deleteRelationships($this->invoice, [ | ||||||
|  |             'transactions', 'recurring' | ||||||
|  |         ]); | ||||||
|  |  | ||||||
|  |         $this->invoice->status = 'cancelled'; | ||||||
|  |         $this->invoice->save(); | ||||||
|  |  | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										26
									
								
								app/Listeners/Purchase/MarkBillCancelled.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/Listeners/Purchase/MarkBillCancelled.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace App\Listeners\Purchase; | ||||||
|  |  | ||||||
|  | use App\Events\Purchase\BillCancelled as Event; | ||||||
|  | use App\Jobs\Purchase\CancelBill; | ||||||
|  | use App\Jobs\Purchase\CreateBillHistory; | ||||||
|  | use App\Traits\Jobs; | ||||||
|  |  | ||||||
|  | class MarkBillCancelled | ||||||
|  | { | ||||||
|  |     use Jobs; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Handle the event. | ||||||
|  |      * | ||||||
|  |      * @param  $event | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     public function handle(Event $event) | ||||||
|  |     { | ||||||
|  |         $this->dispatch(new CancelBill($event->bill)); | ||||||
|  |  | ||||||
|  |         $this->dispatch(new CreateBillHistory($event->bill, 0, trans('bills.messages.marked_cancelled'))); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -24,6 +24,6 @@ class MarkBillReceived | |||||||
|             $event->bill->save(); |             $event->bill->save(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $this->dispatch(new CreateBillHistory($event->bill, 0, trans('bills.mark_received'))); |         $this->dispatch(new CreateBillHistory($event->bill, 0, trans('bills.messages.marked_received'))); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										26
									
								
								app/Listeners/Sale/MarkInvoiceCancelled.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/Listeners/Sale/MarkInvoiceCancelled.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace App\Listeners\Sale; | ||||||
|  |  | ||||||
|  | use App\Events\Sale\InvoiceCancelled as Event; | ||||||
|  | use App\Jobs\Sale\CancelInvoice; | ||||||
|  | use App\Jobs\Sale\CreateInvoiceHistory; | ||||||
|  | use App\Traits\Jobs; | ||||||
|  |  | ||||||
|  | class MarkInvoiceCancelled | ||||||
|  | { | ||||||
|  |     use Jobs; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Handle the event. | ||||||
|  |      * | ||||||
|  |      * @param  $event | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     public function handle(Event $event) | ||||||
|  |     { | ||||||
|  |         $this->dispatch(new CancelInvoice($event->invoice)); | ||||||
|  |  | ||||||
|  |         $this->dispatch(new CreateInvoiceHistory($event->invoice, 0, trans('invoices.messages.marked_cancelled'))); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -24,6 +24,6 @@ class MarkInvoiceSent | |||||||
|             $event->invoice->save(); |             $event->invoice->save(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $this->dispatch(new CreateInvoiceHistory($event->invoice, 0, trans('invoices.mark_sent'))); |         $this->dispatch(new CreateInvoiceHistory($event->invoice, 0, trans('invoices.messages.marked_sent'))); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -29,6 +29,6 @@ class MarkInvoiceViewed | |||||||
|         $invoice->status = 'viewed'; |         $invoice->status = 'viewed'; | ||||||
|         $invoice->save(); |         $invoice->save(); | ||||||
|  |  | ||||||
|         $this->dispatch(new CreateInvoiceHistory($event->invoice, 0, trans('invoices.mark_viewed'))); |         $this->dispatch(new CreateInvoiceHistory($event->invoice, 0, trans('invoices.messages.marked_viewed'))); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -33,6 +33,9 @@ class Event extends Provider | |||||||
|         'App\Events\Purchase\BillReceived' => [ |         'App\Events\Purchase\BillReceived' => [ | ||||||
|             'App\Listeners\Purchase\MarkBillReceived', |             'App\Listeners\Purchase\MarkBillReceived', | ||||||
|         ], |         ], | ||||||
|  |         'App\Events\Purchase\BillCancelled' => [ | ||||||
|  |             'App\Listeners\Purchase\MarkBillCancelled', | ||||||
|  |         ], | ||||||
|         'App\Events\Purchase\BillRecurring' => [ |         'App\Events\Purchase\BillRecurring' => [ | ||||||
|             'App\Listeners\Purchase\SendBillRecurringNotification', |             'App\Listeners\Purchase\SendBillRecurringNotification', | ||||||
|         ], |         ], | ||||||
| @@ -47,6 +50,9 @@ class Event extends Provider | |||||||
|         'App\Events\Sale\InvoiceSent' => [ |         'App\Events\Sale\InvoiceSent' => [ | ||||||
|             'App\Listeners\Sale\MarkInvoiceSent', |             'App\Listeners\Sale\MarkInvoiceSent', | ||||||
|         ], |         ], | ||||||
|  |         'App\Events\Sale\InvoiceCancelled' => [ | ||||||
|  |             'App\Listeners\Sale\MarkInvoiceCancelled', | ||||||
|  |         ], | ||||||
|         'App\Events\Sale\InvoiceViewed' => [ |         'App\Events\Sale\InvoiceViewed' => [ | ||||||
|             'App\Listeners\Sale\MarkInvoiceViewed', |             'App\Listeners\Sale\MarkInvoiceViewed', | ||||||
|         ], |         ], | ||||||
|   | |||||||
| @@ -45,6 +45,7 @@ trait Purchases | |||||||
|             'paid', |             'paid', | ||||||
|             'overdue', |             'overdue', | ||||||
|             'unpaid', |             'unpaid', | ||||||
|  |             'cancelled', | ||||||
|         ]; |         ]; | ||||||
|  |  | ||||||
|         $statuses = collect($list)->each(function ($code) { |         $statuses = collect($list)->each(function ($code) { | ||||||
|   | |||||||
| @@ -47,6 +47,7 @@ trait Sales | |||||||
|             'paid', |             'paid', | ||||||
|             'overdue', |             'overdue', | ||||||
|             'unpaid', |             'unpaid', | ||||||
|  |             'cancelled', | ||||||
|         ]; |         ]; | ||||||
|  |  | ||||||
|         $statuses = collect($list)->each(function ($code) { |         $statuses = collect($list)->each(function ($code) { | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| <?php | <?php | ||||||
|  |  | ||||||
|  | use App\Events\Purchase\BillCancelled; | ||||||
| use App\Events\Purchase\BillCreated; | use App\Events\Purchase\BillCreated; | ||||||
| use App\Events\Purchase\BillReceived; | use App\Events\Purchase\BillReceived; | ||||||
| use App\Jobs\Banking\CreateDocumentTransaction; | use App\Jobs\Banking\CreateDocumentTransaction; | ||||||
| @@ -32,7 +33,7 @@ $factory->define(Bill::class, function (Faker $faker) use ($company) { | |||||||
|         $contact = factory(Contact::class)->states('enabled', 'vendor')->create(); |         $contact = factory(Contact::class)->states('enabled', 'vendor')->create(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $statuses = ['draft', 'received', 'partial', 'paid']; |     $statuses = ['draft', 'received', 'partial', 'paid', 'cancelled']; | ||||||
|  |  | ||||||
|     return [ |     return [ | ||||||
|         'company_id' => $company->id, |         'company_id' => $company->id, | ||||||
| @@ -62,6 +63,8 @@ $factory->state(Bill::class, 'partial', ['status' => 'partial']); | |||||||
|  |  | ||||||
| $factory->state(Bill::class, 'paid', ['status' => 'paid']); | $factory->state(Bill::class, 'paid', ['status' => 'paid']); | ||||||
|  |  | ||||||
|  | $factory->state(Bill::class, 'cancelled', ['status' => 'cancelled']); | ||||||
|  |  | ||||||
| $factory->state(Bill::class, 'recurring', function (Faker $faker) { | $factory->state(Bill::class, 'recurring', function (Faker $faker) { | ||||||
|     $frequencies = ['monthly', 'weekly']; |     $frequencies = ['monthly', 'weekly']; | ||||||
|  |  | ||||||
| @@ -175,6 +178,10 @@ $factory->afterCreating(Bill::class, function ($bill, $faker) use ($company) { | |||||||
|  |  | ||||||
|             $transaction = dispatch_now(new CreateDocumentTransaction($updated_bill, $payment_request)); |             $transaction = dispatch_now(new CreateDocumentTransaction($updated_bill, $payment_request)); | ||||||
|  |  | ||||||
|  |             break; | ||||||
|  |         case 'cancelled': | ||||||
|  |             event(new BillCancelled($updated_bill)); | ||||||
|  |  | ||||||
|             break; |             break; | ||||||
|     } |     } | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| <?php | <?php | ||||||
|  |  | ||||||
|  | use App\Events\Sale\InvoiceCancelled; | ||||||
| use App\Events\Sale\InvoiceCreated; | use App\Events\Sale\InvoiceCreated; | ||||||
| use App\Events\Sale\InvoiceSent; | use App\Events\Sale\InvoiceSent; | ||||||
| use App\Events\Sale\InvoiceViewed; | use App\Events\Sale\InvoiceViewed; | ||||||
| @@ -33,7 +34,7 @@ $factory->define(Invoice::class, function (Faker $faker) use ($company) { | |||||||
|         $contact = factory(Contact::class)->states('enabled', 'customer')->create(); |         $contact = factory(Contact::class)->states('enabled', 'customer')->create(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $statuses = ['draft', 'sent', 'viewed', 'partial', 'paid']; |     $statuses = ['draft', 'sent', 'viewed', 'partial', 'paid', 'cancelled']; | ||||||
|  |  | ||||||
|     return [ |     return [ | ||||||
|         'company_id' => $company->id, |         'company_id' => $company->id, | ||||||
| @@ -65,6 +66,8 @@ $factory->state(Invoice::class, 'partial', ['status' => 'partial']); | |||||||
|  |  | ||||||
| $factory->state(Invoice::class, 'paid', ['status' => 'paid']); | $factory->state(Invoice::class, 'paid', ['status' => 'paid']); | ||||||
|  |  | ||||||
|  | $factory->state(Invoice::class, 'cancelled', ['status' => 'cancelled']); | ||||||
|  |  | ||||||
| $factory->state(Invoice::class, 'recurring', function (Faker $faker) { | $factory->state(Invoice::class, 'recurring', function (Faker $faker) { | ||||||
|     $frequencies = ['monthly', 'weekly']; |     $frequencies = ['monthly', 'weekly']; | ||||||
|  |  | ||||||
| @@ -184,6 +187,10 @@ $factory->afterCreating(Invoice::class, function ($invoice, $faker) use ($compan | |||||||
|  |  | ||||||
|             event(new PaymentReceived($updated_invoice, $payment_request)); |             event(new PaymentReceived($updated_invoice, $payment_request)); | ||||||
|  |  | ||||||
|  |             break; | ||||||
|  |         case 'cancelled': | ||||||
|  |             event(new InvoiceCancelled($updated_invoice)); | ||||||
|  |  | ||||||
|             break; |             break; | ||||||
|     } |     } | ||||||
| }); | }); | ||||||
|   | |||||||
							
								
								
									
										40
									
								
								public/css/akaunting-color.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								public/css/akaunting-color.css
									
									
									
									
										vendored
									
									
								
							| @@ -480,6 +480,32 @@ a.text-yellow:focus | |||||||
|     background-color: #bf8003; |     background-color: #bf8003; | ||||||
| } | } | ||||||
| /*--Warning Color Finish--*/ | /*--Warning Color Finish--*/ | ||||||
|  | /*--Dark Color--*/ | ||||||
|  | .badge-dark | ||||||
|  | { | ||||||
|  |     color: #fff; | ||||||
|  |     background-color: #6a7783; | ||||||
|  | } | ||||||
|  | .badge-dark[href]:hover, | ||||||
|  | .badge-dark[href]:focus | ||||||
|  | { | ||||||
|  |     color: #fff; | ||||||
|  |     background-color: #060607; | ||||||
|  | } | ||||||
|  | /*--Dark Color Finish--*/ | ||||||
|  | /*--Darker Color--*/ | ||||||
|  | .badge-darker | ||||||
|  | { | ||||||
|  |     color: #fff; | ||||||
|  |     background-color: #525252; | ||||||
|  | } | ||||||
|  | .badge-darker[href]:hover, | ||||||
|  | .badge-darker[href]:focus | ||||||
|  | { | ||||||
|  |     color: #fff; | ||||||
|  |     background-color: #000; | ||||||
|  | } | ||||||
|  | /*--Darker Color Finish--*/ | ||||||
| /*--------Badge Colors Finish--------*/ | /*--------Badge Colors Finish--------*/ | ||||||
|  |  | ||||||
| /*--------Background Colors--------*/ | /*--------Background Colors--------*/ | ||||||
| @@ -1897,6 +1923,20 @@ button.bg-yellow:focus | |||||||
|     background-image: linear-gradient(to right, #ffffff , #efad32); |     background-image: linear-gradient(to right, #ffffff , #efad32); | ||||||
| } | } | ||||||
| /*--Viewed Color Finish--*/ | /*--Viewed Color Finish--*/ | ||||||
|  |  | ||||||
|  | /*--Dark Color--*/ | ||||||
|  | .status-dark | ||||||
|  | { | ||||||
|  |     background-image: linear-gradient(to right, #ffffff , #6a7783); | ||||||
|  | } | ||||||
|  | /*--Dark Color Finish--*/ | ||||||
|  |  | ||||||
|  | /*--Darker Color--*/ | ||||||
|  | .status-darker | ||||||
|  | { | ||||||
|  |     background-image: linear-gradient(to right, #ffffff , #525252); | ||||||
|  | } | ||||||
|  | /*--Darker Color Finish--*/ | ||||||
| /*--------Transaction Status Colors Finish--------*/ | /*--------Transaction Status Colors Finish--------*/ | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ return [ | |||||||
|     'add_payment'           => 'Add Payment', |     'add_payment'           => 'Add Payment', | ||||||
|     'mark_paid'             => 'Mark Paid', |     'mark_paid'             => 'Mark Paid', | ||||||
|     'mark_received'         => 'Mark Received', |     'mark_received'         => 'Mark Received', | ||||||
|  |     'mark_cancelled'        => 'Mark Cancelled', | ||||||
|     'download_pdf'          => 'Download PDF', |     'download_pdf'          => 'Download PDF', | ||||||
|     'send_mail'             => 'Send Email', |     'send_mail'             => 'Send Email', | ||||||
|     'create_bill'           => 'Create Bill', |     'create_bill'           => 'Create Bill', | ||||||
| @@ -44,11 +45,13 @@ return [ | |||||||
|         'paid'              => 'Paid', |         'paid'              => 'Paid', | ||||||
|         'overdue'           => 'Overdue', |         'overdue'           => 'Overdue', | ||||||
|         'unpaid'            => 'Unpaid', |         'unpaid'            => 'Unpaid', | ||||||
|  |         'cancelled'         => 'Cancelled', | ||||||
|     ], |     ], | ||||||
|  |  | ||||||
|     'messages' => [ |     'messages' => [ | ||||||
|         'received'          => 'Bill marked as received successfully!', |         'marked_received'   => 'Bill marked as received!', | ||||||
|         'marked_paid'       => 'Bill marked as paid!', |         'marked_paid'       => 'Bill marked as paid!', | ||||||
|  |         'marked_cancelled'  => 'Bill marked as cancelled!', | ||||||
|         'draft'             => 'This is a <b>DRAFT</b> bill and will be reflected to charts after it gets received.', |         'draft'             => 'This is a <b>DRAFT</b> bill and will be reflected to charts after it gets received.', | ||||||
|  |  | ||||||
|         'status' => [ |         'status' => [ | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ return [ | |||||||
|         'paid'          => 'Are you sure you want to mark selected invoice as <b>paid</b>?|Are you sure you want to mark selected invoices as <b>paid</b>?', |         'paid'          => 'Are you sure you want to mark selected invoice as <b>paid</b>?|Are you sure you want to mark selected invoices as <b>paid</b>?', | ||||||
|         'sent'          => 'Are you sure you want to mark selected invoice as <b>sent</b>?|Are you sure you want to mark selected invoices as <b>sent</b>?', |         'sent'          => 'Are you sure you want to mark selected invoice as <b>sent</b>?|Are you sure you want to mark selected invoices as <b>sent</b>?', | ||||||
|         'received'      => 'Are you sure you want to mark selected bill as <b>received</b>?|Are you sure you want to mark selected bills as <b>received</b>?', |         'received'      => 'Are you sure you want to mark selected bill as <b>received</b>?|Are you sure you want to mark selected bills as <b>received</b>?', | ||||||
|  |         'cancelled'     => 'Are you sure you want to <b>cancel</b> selected invoice/bill?|Are you sure you want to <b>cancel</b> selected invoices/bills?', | ||||||
|     ], |     ], | ||||||
|  |  | ||||||
| ]; | ]; | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ return [ | |||||||
|     'mark_paid'             => 'Mark Paid', |     'mark_paid'             => 'Mark Paid', | ||||||
|     'mark_sent'             => 'Mark Sent', |     'mark_sent'             => 'Mark Sent', | ||||||
|     'mark_viewed'           => 'Mark Viewed', |     'mark_viewed'           => 'Mark Viewed', | ||||||
|  |     'mark_cancelled'        => 'Mark Cancelled', | ||||||
|     'download_pdf'          => 'Download PDF', |     'download_pdf'          => 'Download PDF', | ||||||
|     'send_mail'             => 'Send Email', |     'send_mail'             => 'Send Email', | ||||||
|     'all_invoices'          => 'Login to view all invoices', |     'all_invoices'          => 'Login to view all invoices', | ||||||
| @@ -48,12 +49,15 @@ return [ | |||||||
|         'paid'              => 'Paid', |         'paid'              => 'Paid', | ||||||
|         'overdue'           => 'Overdue', |         'overdue'           => 'Overdue', | ||||||
|         'unpaid'            => 'Unpaid', |         'unpaid'            => 'Unpaid', | ||||||
|  |         'cancelled'         => 'Cancelled', | ||||||
|     ], |     ], | ||||||
|  |  | ||||||
|     'messages' => [ |     'messages' => [ | ||||||
|         'email_sent'        => 'Invoice email has been sent!', |         'email_sent'        => 'Invoice email has been sent!', | ||||||
|         'marked_sent'       => 'Invoice marked as sent!', |         'marked_sent'       => 'Invoice marked as sent!', | ||||||
|         'marked_paid'       => 'Invoice marked as paid!', |         'marked_paid'       => 'Invoice marked as paid!', | ||||||
|  |         'marked_viewed'     => 'Invoice marked as viewed!', | ||||||
|  |         'marked_cancelled'  => 'Invoice marked as cancelled!', | ||||||
|         'email_required'    => 'No email address for this customer!', |         'email_required'    => 'No email address for this customer!', | ||||||
|         'draft'             => 'This is a <b>DRAFT</b> invoice and will be reflected to charts after it gets sent.', |         'draft'             => 'This is a <b>DRAFT</b> invoice and will be reflected to charts after it gets sent.', | ||||||
|  |  | ||||||
|   | |||||||
| @@ -273,8 +273,7 @@ | |||||||
|                 <div class="card-footer"> |                 <div class="card-footer"> | ||||||
|                     <div class="row"> |                     <div class="row"> | ||||||
|                         <div class="col-xs-12 col-sm-6"> |                         <div class="col-xs-12 col-sm-6"> | ||||||
|                             @if($invoice->status != 'paid') |                             @if (!empty($payment_methods) && !in_array($invoice->status, ['paid', 'cancelled'])) | ||||||
|                                 @if ($payment_methods) |  | ||||||
|                                 {!! Form::open([ |                                 {!! Form::open([ | ||||||
|                                     'id' => 'invoice-payment', |                                     'id' => 'invoice-payment', | ||||||
|                                     'role' => 'form', |                                     'role' => 'form', | ||||||
| @@ -285,7 +284,6 @@ | |||||||
|                                     {{ Form::selectGroup('payment_method', '', 'money el-icon-money', $payment_methods, '', ['change' => 'onChangePaymentMethod', 'id' => 'payment-method', 'class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])], 'col-sm-12') }} |                                     {{ Form::selectGroup('payment_method', '', 'money el-icon-money', $payment_methods, '', ['change' => 'onChangePaymentMethod', 'id' => 'payment-method', 'class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])], 'col-sm-12') }} | ||||||
|                                     {!! Form::hidden('invoice_id', $invoice->id, ['v-model' => 'form.invoice_id']) !!} |                                     {!! Form::hidden('invoice_id', $invoice->id, ['v-model' => 'form.invoice_id']) !!} | ||||||
|                                 {!! Form::close() !!} |                                 {!! Form::close() !!} | ||||||
|                                 @endif |  | ||||||
|                             @endif |                             @endif | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="col-xs-12 col-sm-6 text-right"> |                         <div class="col-xs-12 col-sm-6 text-right"> | ||||||
|   | |||||||
| @@ -219,19 +219,17 @@ | |||||||
|         <div class="card-footer"> |         <div class="card-footer"> | ||||||
|             <div class="row"> |             <div class="row"> | ||||||
|                 <div class="col-md-4"> |                 <div class="col-md-4"> | ||||||
|                     @if($invoice->status != 'paid') |                     @if (!empty($payment_methods) && !in_array($invoice->status, ['paid', 'cancelled'])) | ||||||
|                         @if ($payment_methods) |                         {!! Form::open([ | ||||||
|                             {!! Form::open([ |                             'id' => 'invoice-payment', | ||||||
|                                 'id' => 'invoice-payment', |                             'role' => 'form', | ||||||
|                                 'role' => 'form', |                             'autocomplete' => "off", | ||||||
|                                 'autocomplete' => "off", |                             'novalidate' => 'true', | ||||||
|                                 'novalidate' => 'true', |                             'class' => 'mb-0', | ||||||
|                                 'class' => 'mb-0', |                         ]) !!} | ||||||
|                             ]) !!} |                             {{ Form::selectGroup('payment_method', '', 'fas fa-wallet', $payment_methods, '', ['change' => 'onChangePaymentMethodSigned', 'id' => 'payment-method', 'class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])], 'mb-0') }} | ||||||
|                                 {{ Form::selectGroup('payment_method', '', 'fas fa-wallet', $payment_methods, '', ['change' => 'onChangePaymentMethodSigned', 'id' => 'payment-method', 'class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])], 'mb-0') }} |                             {!! Form::hidden('invoice_id', $invoice->id, ['v-model' => 'form.invoice_id']) !!} | ||||||
|                                 {!! Form::hidden('invoice_id', $invoice->id, ['v-model' => 'form.invoice_id']) !!} |                         {!! Form::close() !!} | ||||||
|                             {!! Form::close() !!} |  | ||||||
|                         @endif |  | ||||||
|                     @endif |                     @endif | ||||||
|                 </div> |                 </div> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -70,9 +70,17 @@ | |||||||
|                                                 <a class="dropdown-item" href="{{ route('bills.edit', $item->id) }}">{{ trans('general.edit') }}</a> |                                                 <a class="dropdown-item" href="{{ route('bills.edit', $item->id) }}">{{ trans('general.edit') }}</a> | ||||||
|                                             @endif |                                             @endif | ||||||
|                                             <div class="dropdown-divider"></div> |                                             <div class="dropdown-divider"></div> | ||||||
|                                             @permission('create-purchases-bills') |  | ||||||
|                                                 <a class="dropdown-item" href="{{ route('bills.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> |                                             @if ($item->status != 'cancelled') | ||||||
|                                             @endpermission |                                                 @permission('create-purchases-bills') | ||||||
|  |                                                     <a class="dropdown-item" href="{{ route('bills.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> | ||||||
|  |                                                 @endpermission | ||||||
|  |  | ||||||
|  |                                                 @permission('update-purchases-bills') | ||||||
|  |                                                     <a class="dropdown-item" href="{{ route('bills.cancelled', $item->id) }}">{{ trans('general.cancel') }}</a> | ||||||
|  |                                                 @endpermission | ||||||
|  |                                             @endif | ||||||
|  |  | ||||||
|                                             @permission('delete-purchases-bills') |                                             @permission('delete-purchases-bills') | ||||||
|                                                 <div class="dropdown-divider"></div> |                                                 <div class="dropdown-divider"></div> | ||||||
|                                                 @if (!$item->reconciled) |                                                 @if (!$item->reconciled) | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ | |||||||
|     @stack('status_message_end') |     @stack('status_message_end') | ||||||
|  |  | ||||||
|     @stack('timeline_start') |     @stack('timeline_start') | ||||||
|         @if ($bill->status != 'paid') |         @if (!in_array($bill->status, ['paid', 'cancelled'])) | ||||||
|             @stack('timeline_body_start') |             @stack('timeline_body_start') | ||||||
|                 <div class="card"> |                 <div class="card"> | ||||||
|                     <div class="card-body"> |                     <div class="card-body"> | ||||||
| @@ -472,40 +472,50 @@ | |||||||
|                                 <div class="dropup header-drop-top"> |                                 <div class="dropup header-drop-top"> | ||||||
|                                     <button type="button" class="btn btn-primary header-button-top" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-up"></i>  {{ trans('general.more_actions') }}</button> |                                     <button type="button" class="btn btn-primary header-button-top" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-up"></i>  {{ trans('general.more_actions') }}</button> | ||||||
|                                     <div class="dropdown-menu" role="menu"> |                                     <div class="dropdown-menu" role="menu"> | ||||||
|                                         @stack('button_pay_start') |                                         @if ($bill->status != 'cancelled') | ||||||
|                                             @if($bill->status != 'paid') |                                             @stack('button_pay_start') | ||||||
|  |                                                 @if($bill->status != 'paid') | ||||||
|  |                                                     @permission('update-purchases-bills') | ||||||
|  |                                                         <a class="dropdown-item" href="{{ route('bills.paid', $bill->id) }}">{{ trans('bills.mark_paid') }}</a> | ||||||
|  |                                                     @endpermission | ||||||
|  |  | ||||||
|  |                                                     @if(empty($bill->paid) || ($bill->paid != $bill->amount)) | ||||||
|  |                                                         <button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('bills.add_payment') }}</button> | ||||||
|  |                                                     @endif | ||||||
|  |                                                     <div class="dropdown-divider"></div> | ||||||
|  |                                                 @endif | ||||||
|  |                                             @stack('button_pay_end') | ||||||
|  |  | ||||||
|  |                                             @stack('button_received_start') | ||||||
|                                                 @permission('update-purchases-bills') |                                                 @permission('update-purchases-bills') | ||||||
|                                                     <a class="dropdown-item" href="{{ route('bills.paid', $bill->id) }}">{{ trans('bills.mark_paid') }}</a> |                                                     @if($bill->status == 'draft') | ||||||
|  |                                                         <a class="dropdown-item" href="{{ route('bills.received', $bill->id) }}">{{ trans('bills.mark_received') }}</a></a> | ||||||
|  |                                                     @else | ||||||
|  |                                                         <button type="button" class="dropdown-item" disabled="disabled">{{ trans('bills.mark_received') }}</button> | ||||||
|  |                                                     @endif | ||||||
|                                                 @endpermission |                                                 @endpermission | ||||||
|  |                                             @stack('button_received_end') | ||||||
|                                                 @if(empty($bill->paid) || ($bill->paid != $bill->amount)) |                                         @endif | ||||||
|                                                     <button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('bills.add_payment') }}</button> |  | ||||||
|                                                 @endif |  | ||||||
|                                                 <div class="dropdown-divider"></div> |  | ||||||
|                                             @endif |  | ||||||
|                                         @stack('button_pay_end') |  | ||||||
|  |  | ||||||
|                                         @stack('button_received_start') |  | ||||||
|                                             @permission('update-purchases-bills') |  | ||||||
|                                                 @if($bill->status == 'draft') |  | ||||||
|                                                     <a class="dropdown-item" href="{{ route('bills.received', $bill->id) }}">{{ trans('bills.mark_received') }}</a></a> |  | ||||||
|                                                 @else |  | ||||||
|                                                     <button type="button" class="dropdown-item" disabled="disabled">{{ trans('bills.mark_received') }}</button> |  | ||||||
|                                                 @endif |  | ||||||
|                                             @endpermission |  | ||||||
|                                         @stack('button_received_end') |  | ||||||
|  |  | ||||||
|                                         @stack('button_pdf_start') |                                         @stack('button_pdf_start') | ||||||
|                                             <a class="dropdown-item" href="{{ route('bills.pdf', $bill->id) }}">{{ trans('bills.download_pdf') }}</a> |                                             <a class="dropdown-item" href="{{ route('bills.pdf', $bill->id) }}">{{ trans('bills.download_pdf') }}</a> | ||||||
|                                         @stack('button_pdf_end') |                                         @stack('button_pdf_end') | ||||||
|  |  | ||||||
|                                         @stack('button_delete_start') |                                         @permission('update-purchases-bills') | ||||||
|                                             @permission('delete-purchases-bills') |                                             @if ($bill->status != 'cancelled') | ||||||
|                                                 @if(!$bill->reconciled) |                                                 @stack('button_cancelled_start') | ||||||
|                                                     {!! Form::deleteLink($bill, 'purchases/bills') !!} |                                                 <a class="dropdown-item" href="{{ route('bills.cancelled', $bill->id) }}">{{ trans('general.cancel') }}</a> | ||||||
|                                                 @endif |                                                 @stack('button_cancelled_end') | ||||||
|                                             @endpermission |                                             @endif | ||||||
|                                         @stack('button_delete_end') |                                         @endpermission | ||||||
|  |  | ||||||
|  |                                         @permission('delete-purchases-bills') | ||||||
|  |                                             @if (!$bill->reconciled) | ||||||
|  |                                                 @stack('button_delete_start') | ||||||
|  |                                                 {!! Form::deleteLink($bill, 'purchases/bills') !!} | ||||||
|  |                                                 @stack('button_delete_end') | ||||||
|  |                                             @endif | ||||||
|  |                                         @endpermission | ||||||
|                                     </div> |                                     </div> | ||||||
|                                 </div> |                                 </div> | ||||||
|                             @stack('button_group_end') |                             @stack('button_group_end') | ||||||
|   | |||||||
| @@ -71,10 +71,16 @@ | |||||||
|                                             @endif |                                             @endif | ||||||
|                                             <div class="dropdown-divider"></div> |                                             <div class="dropdown-divider"></div> | ||||||
|  |  | ||||||
|                                             @permission('create-sales-invoices') |                                             @if ($item->status != 'cancelled') | ||||||
|                                                 <a class="dropdown-item" href="{{ route('invoices.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> |                                                 @permission('create-sales-invoices') | ||||||
|                                                 <div class="dropdown-divider"></div> |                                                     <a class="dropdown-item" href="{{ route('invoices.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> | ||||||
|                                             @endpermission |                                                     <div class="dropdown-divider"></div> | ||||||
|  |                                                 @endpermission | ||||||
|  |  | ||||||
|  |                                                 @permission('update-sales-invoices') | ||||||
|  |                                                     <a class="dropdown-item" href="{{ route('invoices.cancelled', $item->id) }}">{{ trans('general.cancel') }}</a> | ||||||
|  |                                                 @endpermission | ||||||
|  |                                             @endif | ||||||
|  |  | ||||||
|                                             @permission('delete-sales-invoices') |                                             @permission('delete-sales-invoices') | ||||||
|                                                 @if (!$item->reconciled) |                                                 @if (!$item->reconciled) | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ | |||||||
|     @stack('status_message_end') |     @stack('status_message_end') | ||||||
|  |  | ||||||
|     @stack('timeline_start') |     @stack('timeline_start') | ||||||
|         @if ($invoice->status != 'paid') |         @if (!in_array($invoice->status, ['paid', 'cancelled'])) | ||||||
|             @stack('timeline_body_start') |             @stack('timeline_body_start') | ||||||
|                 <div class="card"> |                 <div class="card"> | ||||||
|                     <div class="card-body"> |                     <div class="card-body"> | ||||||
| @@ -464,7 +464,7 @@ | |||||||
|                 <div class="card-footer"> |                 <div class="card-footer"> | ||||||
|                     <div class="row align-items-center"> |                     <div class="row align-items-center"> | ||||||
|                         <div class="col-xs-12 col-sm-4"> |                         <div class="col-xs-12 col-sm-4"> | ||||||
|                             @if($invoice->attachment) |                             @if ($invoice->attachment) | ||||||
|                                 @php $file = $invoice->attachment; @endphp |                                 @php $file = $invoice->attachment; @endphp | ||||||
|                                 @include('partials.media.file') |                                 @include('partials.media.file') | ||||||
|                             @endif |                             @endif | ||||||
| @@ -485,60 +485,72 @@ | |||||||
|                                 </a> |                                 </a> | ||||||
|                             @stack('button_print_end') |                             @stack('button_print_end') | ||||||
|  |  | ||||||
|                             @stack('button_share_start') |                             @if ($invoice->status != 'cancelled') | ||||||
|                                 <a href="{{ $signed_url }}" target="_blank" class="btn btn-white header-button-top"> |                                 @stack('button_share_start') | ||||||
|                                     <i class="fa fa-share"></i>  {{ trans('general.share') }} |                                     <a href="{{ $signed_url }}" target="_blank" class="btn btn-white header-button-top"> | ||||||
|                                 </a> |                                         <i class="fa fa-share"></i>  {{ trans('general.share') }} | ||||||
|                             @stack('button_share_end') |                                     </a> | ||||||
|  |                                 @stack('button_share_end') | ||||||
|  |                             @endif | ||||||
|  |  | ||||||
|                             @stack('button_group_start') |                             @stack('button_group_start') | ||||||
|                                 <div class="dropup header-drop-top"> |                                 <div class="dropup header-drop-top"> | ||||||
|                                     <button type="button" class="btn btn-primary header-button-top" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-up"></i>  {{ trans('general.more_actions') }}</button> |                                     <button type="button" class="btn btn-primary header-button-top" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-up"></i>  {{ trans('general.more_actions') }}</button> | ||||||
|                                     <div class="dropdown-menu" role="menu"> |                                     <div class="dropdown-menu" role="menu"> | ||||||
|                                         @stack('button_pay_start') |                                         @if ($invoice->status != 'cancelled') | ||||||
|                                             @if($invoice->status != 'paid') |                                             @stack('button_pay_start') | ||||||
|  |                                                 @if ($invoice->status != 'paid') | ||||||
|  |                                                     @permission('update-sales-invoices') | ||||||
|  |                                                         <a class="dropdown-item" href="{{ route('invoices.paid', $invoice->id) }}">{{ trans('invoices.mark_paid') }}</a> | ||||||
|  |                                                     @endpermission | ||||||
|  |  | ||||||
|  |                                                     @if(empty($invoice->paid) || ($invoice->paid != $invoice->amount)) | ||||||
|  |                                                         <button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('invoices.add_payment') }}</button> | ||||||
|  |                                                     @endif | ||||||
|  |                                                     <div class="dropdown-divider"></div> | ||||||
|  |                                                 @endif | ||||||
|  |                                             @stack('button_pay_end') | ||||||
|  |  | ||||||
|  |                                             @stack('button_sent_start') | ||||||
|                                                 @permission('update-sales-invoices') |                                                 @permission('update-sales-invoices') | ||||||
|                                                     <a class="dropdown-item" href="{{ route('invoices.paid', $invoice->id) }}">{{ trans('invoices.mark_paid') }}</a> |                                                     @if ($invoice->status == 'draft') | ||||||
|  |                                                         <a class="dropdown-item" href="{{ route('invoices.sent', $invoice->id) }}">{{ trans('invoices.mark_sent') }}</a> | ||||||
|  |                                                     @else | ||||||
|  |                                                         <button type="button" class="dropdown-item" disabled="disabled"><span class="text-disabled">{{ trans('invoices.mark_sent') }}</span></button> | ||||||
|  |                                                     @endif | ||||||
|                                                 @endpermission |                                                 @endpermission | ||||||
|  |                                             @stack('button_sent_end') | ||||||
|  |  | ||||||
|                                                 @if(empty($invoice->paid) || ($invoice->paid != $invoice->amount)) |                                             @stack('button_email_start') | ||||||
|                                                     <button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('invoices.add_payment') }}</button> |                                                 @if ($invoice->contact_email) | ||||||
|                                                 @endif |                                                     <a class="dropdown-item" href="{{ route('invoices.email', $invoice->id) }}">{{ trans('invoices.send_mail') }}</a> | ||||||
|                                                 <div class="dropdown-divider"></div> |  | ||||||
|                                             @endif |  | ||||||
|                                         @stack('button_pay_end') |  | ||||||
|  |  | ||||||
|                                         @stack('button_sent_start') |  | ||||||
|                                             @permission('update-sales-invoices') |  | ||||||
|                                                 @if($invoice->status == 'draft') |  | ||||||
|                                                     <a class="dropdown-item" href="{{ route('invoices.sent', $invoice->id) }}">{{ trans('invoices.mark_sent') }}</a> |  | ||||||
|                                                 @else |                                                 @else | ||||||
|                                                     <button type="button" class="dropdown-item" disabled="disabled"><span class="text-disabled">{{ trans('invoices.mark_sent') }}</span></button> |                                                     <button type="button" class="dropdown-item" disabled="disabled" data-toggle="tooltip" data-placement="right" title="{{ trans('invoices.messages.email_required') }}"> | ||||||
|  |                                                         <span class="text-disabled">{{ trans('invoices.send_mail') }}</span> | ||||||
|  |                                                     </button> | ||||||
|                                                 @endif |                                                 @endif | ||||||
|                                             @endpermission |                                             @stack('button_email_end') | ||||||
|                                         @stack('button_sent_end') |                                         @endif | ||||||
|  |  | ||||||
|                                         @stack('button_email_start') |  | ||||||
|                                             @if($invoice->contact_email) |  | ||||||
|                                                 <a class="dropdown-item" href="{{ route('invoices.email', $invoice->id) }}">{{ trans('invoices.send_mail') }}</a> |  | ||||||
|                                             @else |  | ||||||
|                                                 <button type="button" class="dropdown-item" disabled="disabled" data-toggle="tooltip" data-placement="right" title="{{ trans('invoices.messages.email_required') }}"> |  | ||||||
|                                                     <span class="text-disabled">{{ trans('invoices.send_mail') }}</span> |  | ||||||
|                                                 </button> |  | ||||||
|                                             @endif |  | ||||||
|                                         @stack('button_email_end') |  | ||||||
|  |  | ||||||
|                                         @stack('button_pdf_start') |                                         @stack('button_pdf_start') | ||||||
|                                             <a class="dropdown-item" href="{{ route('invoices.pdf', $invoice->id) }}">{{ trans('invoices.download_pdf') }}</a> |                                             <a class="dropdown-item" href="{{ route('invoices.pdf', $invoice->id) }}">{{ trans('invoices.download_pdf') }}</a> | ||||||
|                                         @stack('button_pdf_end') |                                         @stack('button_pdf_end') | ||||||
|  |  | ||||||
|                                         @stack('button_delete_start') |                                         @permission('update-sales-invoices') | ||||||
|                                             @permission('delete-sales-invoices') |                                             @if ($invoice->status != 'cancelled') | ||||||
|                                                 @if(!$invoice->reconciled) |                                                 @stack('button_cancelled_start') | ||||||
|                                                     {!! Form::deleteLink($invoice, 'sales/invoices') !!} |                                                 <a class="dropdown-item" href="{{ route('invoices.cancelled', $invoice->id) }}">{{ trans('general.cancel') }}</a> | ||||||
|                                                 @endif |                                                 @stack('button_cancelled_end') | ||||||
|                                             @endpermission |                                             @endif | ||||||
|                                         @stack('button_delete_end') |                                         @endpermission | ||||||
|  |  | ||||||
|  |                                         @permission('delete-sales-invoices') | ||||||
|  |                                             @if (!$invoice->reconciled) | ||||||
|  |                                                 @stack('button_delete_start') | ||||||
|  |                                                 {!! Form::deleteLink($invoice, 'sales/invoices') !!} | ||||||
|  |                                                 @stack('button_delete_end') | ||||||
|  |                                             @endif | ||||||
|  |                                         @endpermission | ||||||
|                                     </div> |                                     </div> | ||||||
|                                 </div> |                                 </div> | ||||||
|                             @stack('button_group_end') |                             @stack('button_group_end') | ||||||
|   | |||||||
| @@ -69,6 +69,7 @@ Route::group(['prefix' => 'auth'], function () { | |||||||
|  |  | ||||||
| Route::group(['prefix' => 'sales'], function () { | Route::group(['prefix' => 'sales'], function () { | ||||||
|     Route::get('invoices/{invoice}/sent', 'Sales\Invoices@markSent')->name('invoices.sent'); |     Route::get('invoices/{invoice}/sent', 'Sales\Invoices@markSent')->name('invoices.sent'); | ||||||
|  |     Route::get('invoices/{invoice}/cancelled', 'Sales\Invoices@markCancelled')->name('invoices.cancelled'); | ||||||
|     Route::get('invoices/{invoice}/email', 'Sales\Invoices@emailInvoice')->name('invoices.email'); |     Route::get('invoices/{invoice}/email', 'Sales\Invoices@emailInvoice')->name('invoices.email'); | ||||||
|     Route::get('invoices/{invoice}/paid', 'Sales\Invoices@markPaid')->name('invoices.paid'); |     Route::get('invoices/{invoice}/paid', 'Sales\Invoices@markPaid')->name('invoices.paid'); | ||||||
|     Route::get('invoices/{invoice}/print', 'Sales\Invoices@printInvoice')->name('invoices.print'); |     Route::get('invoices/{invoice}/print', 'Sales\Invoices@printInvoice')->name('invoices.print'); | ||||||
| @@ -97,6 +98,7 @@ Route::group(['prefix' => 'sales'], function () { | |||||||
|  |  | ||||||
| Route::group(['prefix' => 'purchases'], function () { | Route::group(['prefix' => 'purchases'], function () { | ||||||
|     Route::get('bills/{bill}/received', 'Purchases\Bills@markReceived')->name('bills.received'); |     Route::get('bills/{bill}/received', 'Purchases\Bills@markReceived')->name('bills.received'); | ||||||
|  |     Route::get('bills/{bill}/cancelled', 'Purchases\Bills@markCancelled')->name('bills.cancelled'); | ||||||
|     Route::get('bills/{bill}/paid', 'Purchases\Bills@markPaid')->name('bills.paid'); |     Route::get('bills/{bill}/paid', 'Purchases\Bills@markPaid')->name('bills.paid'); | ||||||
|     Route::get('bills/{bill}/print', 'Purchases\Bills@printBill')->name('bills.print'); |     Route::get('bills/{bill}/print', 'Purchases\Bills@printBill')->name('bills.print'); | ||||||
|     Route::get('bills/{bill}/pdf', 'Purchases\Bills@pdfBill')->name('bills.pdf'); |     Route::get('bills/{bill}/pdf', 'Purchases\Bills@pdfBill')->name('bills.pdf'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user