From 445f151c15741695b6aaf33e2fbf8b7d3944f2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Mon, 13 Jun 2022 22:50:07 +0300 Subject: [PATCH 01/34] Recurring template show pages remove delete link.. --- resources/views/banking/recurring_transactions/show.blade.php | 4 ++-- .../views/components/documents/show/more-buttons.blade.php | 2 -- resources/views/purchases/recurring_bills/show.blade.php | 2 +- resources/views/sales/recurring_invoices/show.blade.php | 3 ++- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/views/banking/recurring_transactions/show.blade.php b/resources/views/banking/recurring_transactions/show.blade.php index 33f12e6fe..9053cc4ae 100644 --- a/resources/views/banking/recurring_transactions/show.blade.php +++ b/resources/views/banking/recurring_transactions/show.blade.php @@ -8,7 +8,7 @@ - + @@ -21,8 +21,8 @@ hide-button-share hide-button-email hide-divider-2 - hide-button-delete hide-divider-4 + hide-button-delete /> diff --git a/resources/views/components/documents/show/more-buttons.blade.php b/resources/views/components/documents/show/more-buttons.blade.php index 191a22c3f..ea44a44c5 100644 --- a/resources/views/components/documents/show/more-buttons.blade.php +++ b/resources/views/components/documents/show/more-buttons.blade.php @@ -130,8 +130,6 @@ {{ trans('recurring.end') }} - - @endif @stack('end_button_end') diff --git a/resources/views/purchases/recurring_bills/show.blade.php b/resources/views/purchases/recurring_bills/show.blade.php index f00f76d1c..69b661659 100644 --- a/resources/views/purchases/recurring_bills/show.blade.php +++ b/resources/views/purchases/recurring_bills/show.blade.php @@ -17,7 +17,6 @@ :document="$recurring_bill" hide-divider1 hide-divider2 - hide-divider3 hide-divider4 hide-email hide-share @@ -25,6 +24,7 @@ hide-print hide-pdf hide-cancel + hide-delete /> diff --git a/resources/views/sales/recurring_invoices/show.blade.php b/resources/views/sales/recurring_invoices/show.blade.php index 9b78dc0cf..74d64e2e1 100644 --- a/resources/views/sales/recurring_invoices/show.blade.php +++ b/resources/views/sales/recurring_invoices/show.blade.php @@ -17,13 +17,14 @@ :document="$recurring_invoice" hide-divider1 hide-divider2 - hide-divider3 + hide-divider4 hide-email hide-share hide-customize hide-print hide-pdf hide-cancel + hide-delete /> From d17c3a89b399d2df5a78e9cecb418c4b260cdd6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 14 Jun 2022 00:36:26 +0300 Subject: [PATCH 02/34] added status scope --- app/Models/Document/Document.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Models/Document/Document.php b/app/Models/Document/Document.php index b50d1acf5..e8363e280 100644 --- a/app/Models/Document/Document.php +++ b/app/Models/Document/Document.php @@ -179,24 +179,29 @@ class Document extends Model return $query->whereDate('due_at', '=', $date); } + public function scopeStatus(Builder $query, string $status): Builder + { + return $query->where($this->qualifyColumn('status'), '=', $status); + } + public function scopeAccrued(Builder $query): Builder { - return $query->whereNotIn('status', ['draft', 'cancelled']); + return $query->whereNotIn($this->qualifyColumn('status'), ['draft', 'cancelled']); } public function scopePaid(Builder $query): Builder { - return $query->where('status', '=', 'paid'); + return $query->where($this->qualifyColumn('status'), '=', 'paid'); } public function scopeNotPaid(Builder $query): Builder { - return $query->where('status', '<>', 'paid'); + return $query->where($this->qualifyColumn('status'), '<>', 'paid'); } public function scopeFuture(Builder $query): Builder { - return $query->whereIn('status', $this->getDocumentStatusesForFuture()); + return $query->whereIn($this->qualifyColumn('status'), $this->getDocumentStatusesForFuture()); } public function scopeType(Builder $query, string $type): Builder @@ -244,7 +249,7 @@ class Document extends Model public function getSentAtAttribute(string $value = null) { - $sent = $this->histories()->where('status', 'sent')->first(); + $sent = $this->histories()->where($this->qualifyColumn('status'), 'sent')->first(); return $sent->created_at ?? null; } From 4940720ec0c1e148388610005bc26ff9b0a2417c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 14 Jun 2022 01:18:34 +0300 Subject: [PATCH 03/34] added marked sent event --- app/BulkActions/Sales/Invoices.php | 4 +- app/Events/Document/DocumentMarkedSent.php | 20 ++++ app/Http/Controllers/Sales/Invoices.php | 2 +- app/Listeners/Document/MarkDocumentSent.php | 26 ++-- app/Providers/Event.php | 3 + resources/lang/en-GB/documents.php | 126 ++++++++++---------- 6 files changed, 98 insertions(+), 83 deletions(-) create mode 100644 app/Events/Document/DocumentMarkedSent.php diff --git a/app/BulkActions/Sales/Invoices.php b/app/BulkActions/Sales/Invoices.php index e70a04b53..168eac93c 100644 --- a/app/BulkActions/Sales/Invoices.php +++ b/app/BulkActions/Sales/Invoices.php @@ -5,7 +5,7 @@ namespace App\BulkActions\Sales; use App\Abstracts\BulkAction; use App\Events\Document\DocumentCancelled; use App\Events\Document\DocumentCreated; -use App\Events\Document\DocumentSent; +use App\Events\Document\DocumentMarkedSent; use App\Events\Document\PaymentReceived; use App\Exports\Sales\Invoices as Export; use App\Jobs\Document\DeleteDocument; @@ -58,7 +58,7 @@ class Invoices extends BulkAction continue; } - event(new DocumentSent($invoice)); + event(new DocumentMarkedSent($invoice)); } } diff --git a/app/Events/Document/DocumentMarkedSent.php b/app/Events/Document/DocumentMarkedSent.php new file mode 100644 index 000000000..c79c1fe3f --- /dev/null +++ b/app/Events/Document/DocumentMarkedSent.php @@ -0,0 +1,20 @@ +document = $document; + } +} diff --git a/app/Http/Controllers/Sales/Invoices.php b/app/Http/Controllers/Sales/Invoices.php index e2521f12a..be3f68250 100644 --- a/app/Http/Controllers/Sales/Invoices.php +++ b/app/Http/Controllers/Sales/Invoices.php @@ -220,7 +220,7 @@ class Invoices extends Controller */ public function markSent(Document $invoice) { - event(new \App\Events\Document\DocumentSent($invoice)); + event(new \App\Events\Document\DocumentMarkedSent($invoice)); $message = trans('documents.messages.marked_sent', ['type' => trans_choice('general.invoices', 1)]); diff --git a/app/Listeners/Document/MarkDocumentSent.php b/app/Listeners/Document/MarkDocumentSent.php index 266d623fa..70e944756 100644 --- a/app/Listeners/Document/MarkDocumentSent.php +++ b/app/Listeners/Document/MarkDocumentSent.php @@ -2,7 +2,8 @@ namespace App\Listeners\Document; -use App\Events\Document\DocumentSent as Event; +use App\Events\Document\DocumentMarkedSent; +use App\Events\Document\DocumentSent; use App\Jobs\Document\CreateDocumentHistory; use App\Traits\Jobs; @@ -10,13 +11,7 @@ class MarkDocumentSent { use Jobs; - /** - * Handle the event. - * - * @param $event - * @return void - */ - public function handle(Event $event) + public function handle(DocumentMarkedSent|DocumentSent $event): void { if ($event->document->status != 'partial') { $event->document->status = 'sent'; @@ -24,6 +19,11 @@ class MarkDocumentSent $event->document->save(); } + $this->dispatch(new CreateDocumentHistory($event->document, 0, $this->getDescription($event))); + } + + public function getDescription(DocumentMarkedSent|DocumentSent $event): string + { $type_text = ''; if ($alias = config('type.document.' . $event->document->type . '.alias', '')) { @@ -34,12 +34,8 @@ class MarkDocumentSent $type = trans_choice($type_text, 1); - $this->dispatch( - new CreateDocumentHistory( - $event->document, - 0, - trans('documents.messages.marked_sent', ['type' => $type]) - ) - ); + $message = ($event instanceof DocumentMarkedSent) ? 'marked_sent' : 'email_sent'; + + return trans('documents.messages.' . $message, ['type' => $type]); } } diff --git a/app/Providers/Event.php b/app/Providers/Event.php index 198f1c903..832bae905 100644 --- a/app/Providers/Event.php +++ b/app/Providers/Event.php @@ -57,6 +57,9 @@ class Event extends Provider 'App\Listeners\Document\CreateDocumentTransaction', 'App\Listeners\Document\SendDocumentPaymentNotification', ], + 'App\Events\Document\DocumentMarkedSent' => [ + 'App\Listeners\Document\MarkDocumentSent', + ], 'App\Events\Document\DocumentSent' => [ 'App\Listeners\Document\MarkDocumentSent', ], diff --git a/resources/lang/en-GB/documents.php b/resources/lang/en-GB/documents.php index faee0a7d7..bb4170856 100644 --- a/resources/lang/en-GB/documents.php +++ b/resources/lang/en-GB/documents.php @@ -2,84 +2,80 @@ return [ - 'edit_columns' => 'Edit Columns', - 'empty_items' => 'You have not added any items.', + 'edit_columns' => 'Edit Columns', + 'empty_items' => 'You have not added any items.', + 'grand_total' => 'Grand Total', + 'accept_payment_online' => 'Accept Payments Online', + 'transaction' => 'A payment for :amount was made using :account.', + 'billing' => 'Billing', + 'advanced' => 'Advanced', - 'invoice_detail' => [ - 'marked' => ' You marked this invoice as', - 'services' => 'Services', - 'another_item' => 'Another Item', - 'another_description' => 'and another description', - 'more_item' => '+:count more item', + 'invoice_detail' => [ + 'marked' => 'You marked this invoice as', + 'services' => 'Services', + 'another_item' => 'Another Item', + 'another_description' => 'and another description', + 'more_item' => '+:count more item', ], - 'grand_total' => 'Grand Total', - - 'accept_payment_online' => 'Accept Payments Online', - - 'transaction' => 'A payment for :amount was made using :account.', - - 'billing' => 'Billing', - 'advanced' => 'Advanced', - 'statuses' => [ - 'draft' => 'Draft', - 'sent' => 'Sent', - 'expired' => 'Expired', - 'viewed' => 'Viewed', - 'approved' => 'Approved', - 'received' => 'Received', - 'refused' => 'Refused', - 'restored' => 'Restored', - 'reversed' => 'Reversed', - 'partial' => 'Partial', - 'paid' => 'Paid', - 'pending' => 'Pending', - 'invoiced' => 'Invoiced', - 'overdue' => 'Overdue', - 'unpaid' => 'Unpaid', - 'cancelled' => 'Cancelled', - 'voided' => 'Voided', - 'completed' => 'Completed', - 'shipped' => 'Shipped', - 'refunded' => 'Refunded', - 'failed' => 'Failed', - 'denied' => 'Denied', - 'processed' => 'Processed', - 'open' => 'Open', - 'closed' => 'Closed', - 'billed' => 'Billed', - 'delivered' => 'Delivered', - 'returned' => 'Returned', - 'drawn' => 'Drawn', - 'not_billed' => 'Not Billed', - 'issued' => 'Issued', - 'not_invoiced' => 'Not Invoiced', - 'confirmed' => 'Confirmed', - 'not_confirmed' => 'Not Confirmed', - 'active' => 'Active', - 'ended' => 'Ended', + 'draft' => 'Draft', + 'sent' => 'Sent', + 'expired' => 'Expired', + 'viewed' => 'Viewed', + 'approved' => 'Approved', + 'received' => 'Received', + 'refused' => 'Refused', + 'restored' => 'Restored', + 'reversed' => 'Reversed', + 'partial' => 'Partial', + 'paid' => 'Paid', + 'pending' => 'Pending', + 'invoiced' => 'Invoiced', + 'overdue' => 'Overdue', + 'unpaid' => 'Unpaid', + 'cancelled' => 'Cancelled', + 'voided' => 'Voided', + 'completed' => 'Completed', + 'shipped' => 'Shipped', + 'refunded' => 'Refunded', + 'failed' => 'Failed', + 'denied' => 'Denied', + 'processed' => 'Processed', + 'open' => 'Open', + 'closed' => 'Closed', + 'billed' => 'Billed', + 'delivered' => 'Delivered', + 'returned' => 'Returned', + 'drawn' => 'Drawn', + 'not_billed' => 'Not Billed', + 'issued' => 'Issued', + 'not_invoiced' => 'Not Invoiced', + 'confirmed' => 'Confirmed', + 'not_confirmed' => 'Not Confirmed', + 'active' => 'Active', + 'ended' => 'Ended', ], 'form_description' => [ - 'companies' => 'Change the address, logo, and other information for your company.', - 'billing' => 'Billing details appears in your document.', - 'advanced' => 'Select the category, add or edit the footer, and add attachments to your :type.', - 'attachment' => 'Download the files attached to this :type', + 'companies' => 'Change the address, logo, and other information for your company.', + 'billing' => 'Billing details appears in your document.', + 'advanced' => 'Select the category, add or edit the footer, and add attachments to your :type.', + 'attachment' => 'Download the files attached to this :type', ], 'messages' => [ - 'email_sent' => ':type email has been sent!', - 'marked_as' => ':type marked as :status!', - 'marked_sent' => ':type marked as sent!', - 'marked_paid' => ':type marked as paid!', - 'marked_viewed' => ':type marked as viewed!', - 'marked_cancelled' => ':type marked as cancelled!', - 'marked_received' => ':type marked as received!', + 'email_sent' => ':type email has been sent!', + 'marked_as' => ':type marked as :status!', + 'marked_sent' => ':type marked as sent!', + 'marked_paid' => ':type marked as paid!', + 'marked_viewed' => ':type marked as viewed!', + 'marked_cancelled' => ':type marked as cancelled!', + 'marked_received' => ':type marked as received!', ], 'recurring' => [ - 'auto_generated' => 'Auto-generated', + 'auto_generated' => 'Auto-generated', 'tooltip' => [ 'document_date' => 'The :type date will be automatically assigned based on the :type schedule and frequency.', From 472c1c3e811b4097ca5f5986a86b2382710c6e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 14 Jun 2022 01:26:52 +0300 Subject: [PATCH 04/34] fixed qualified column --- app/Models/Document/Document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Document/Document.php b/app/Models/Document/Document.php index e8363e280..df5587684 100644 --- a/app/Models/Document/Document.php +++ b/app/Models/Document/Document.php @@ -249,14 +249,14 @@ class Document extends Model public function getSentAtAttribute(string $value = null) { - $sent = $this->histories()->where($this->qualifyColumn('status'), 'sent')->first(); + $sent = $this->histories()->where('document_histories.status', 'sent')->first(); return $sent->created_at ?? null; } public function getReceivedAtAttribute(string $value = null) { - $received = $this->histories()->where('status', 'received')->first(); + $received = $this->histories()->where('document_histories.status', 'received')->first(); return $received->created_at ?? null; } From 203b47169ca83c0d36f1c5f43cb52d3f441167ec Mon Sep 17 00:00:00 2001 From: Burak Civan Date: Tue, 14 Jun 2022 09:53:44 +0300 Subject: [PATCH 05/34] classname edited for print --- public/css/print.css | 52 +- .../documents/show/template.blade.php | 2 +- .../documents/template/classic.blade.php | 702 +++++++++--------- .../documents/template/default.blade.php | 656 ++++++++-------- .../documents/template/modern.blade.php | 678 ++++++++--------- .../transactions/show/template.blade.php | 2 +- .../transactions/template/default.blade.php | 666 ++++++++--------- .../transfers/show/content.blade.php | 2 +- .../transfers/template/default.blade.php | 412 +++++----- .../transfers/template/second.blade.php | 412 +++++----- .../transfers/template/third.blade.php | 438 +++++------ 11 files changed, 2018 insertions(+), 2004 deletions(-) diff --git a/public/css/print.css b/public/css/print.css index 67d125599..f98bb8dbd 100644 --- a/public/css/print.css +++ b/public/css/print.css @@ -59,12 +59,12 @@ th, td margin-bottom: 8px; } -.mt-1 +.print-template .mt-1 { margin-top: 8px; } -.ml-1 +.print-template .ml-1 { margin-left: 8px; } @@ -74,67 +74,67 @@ th, td padding-left: 18px; } -.mt-0 +.print-template .mt-0 { margin-top: 0 !important; } -.mt-1 +.print-template .mt-1 { margin-top: 8px; } -.mt-2 +.print-template .mt-2 { margin-top: 16px; } -.mt-3 +.print-template .mt-3 { margin-top: 24px; } -.mt-4 +.print-template .mt-4 { margin-top: 32px; } -.mt-5 +.print-template .mt-5 { margin-top: 40px; } -.mt-6 +.print-template .mt-6 { margin-top: 48px; } -.mt-7 +.print-template .mt-7 { margin-top: 56px; } -.mt-8 +.print-template .mt-8 { margin-top: 64px; } -.mt-9 +.print-template .mt-9 { margin-top: 72px; } -.pb-0 +.print-template .pb-0 { padding-bottom: 0; } -.pb-1 +.print-template .pb-1 { padding-bottom: 8px; } -.py-1 +.print-template .py-1 { padding-bottom: 3px; padding-top: 3px; @@ -158,47 +158,47 @@ th, td padding: 0 10px 0 10px; } -.pt-2 +.print-template .pt-2 { padding-top: 16px; } -.pb-2 +.print-template .pb-2 { padding-bottom: 16px; } -.pl-3 +.print-template .pl-3 { padding-left: 24px; } -.pl-4 +.print-template .pl-4 { padding-left: 32px; } -.pl-5 +.print-template .pl-5 { padding-left: 40px; } -.pl-6 +.print-template .pl-6 { padding-left: 48px; } -.pl-7 +.print-template .pl-7 { padding-left: 56px; } -.pl-8 +.print-template .pl-8 { padding-left: 64px; } -.pl-9 +.print-template .pl-9 { padding-left: 72px; } @@ -383,7 +383,7 @@ html[dir='rtl'] .text-alignment-right { .lines { border-collapse: collapse; - table-layout: fixed; + table-layout: auto; border-bottom: 1px solid #adadad; } @@ -564,7 +564,7 @@ html[dir='rtl'] .text-alignment-right { .modern-lines { border-collapse: collapse; - table-layout: fixed; + table-layout: auto; } .modern-lines .item diff --git a/resources/views/components/documents/show/template.blade.php b/resources/views/components/documents/show/template.blade.php index f5129157e..d93973bc2 100644 --- a/resources/views/components/documents/show/template.blade.php +++ b/resources/views/components/documents/show/template.blade.php @@ -1,4 +1,4 @@ -