diff --git a/app/Abstracts/View/Components/Transactions/Show.php b/app/Abstracts/View/Components/Transactions/Show.php index b6569c2d9..b02f6b0d4 100644 --- a/app/Abstracts/View/Components/Transactions/Show.php +++ b/app/Abstracts/View/Components/Transactions/Show.php @@ -299,6 +299,9 @@ abstract class Show extends Component /** @var bool */ public $hideRecurringMessage; + /** @var bool */ + public $hideCreated; + /** * Create a new component instance. * @@ -327,7 +330,7 @@ abstract class Show extends Component string $routeDocumentShow = '', string $routeTransactionShow = '', string $textButtonAddNew = '', bool $hideSchedule = false, bool $hideChildren = false, bool $hideAttachment = false, $attachment = [], - array $connectTranslations = [], string $textRecurringType = '', bool $hideRecurringMessage = false + array $connectTranslations = [], string $textRecurringType = '', bool $hideRecurringMessage = false, bool $hideCreated = false ) { $this->type = $type; $this->transaction = $transaction; @@ -461,6 +464,7 @@ abstract class Show extends Component $this->textRecurringType = $this->getTextRecurringType($type, $textRecurringType); $this->hideRecurringMessage = $hideRecurringMessage; + $this->hideCreated = $hideCreated; } protected function getTransactionTemplate($type, $transactionTemplate) 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/Models/Document/Document.php b/app/Models/Document/Document.php index b50d1acf5..df5587684 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,14 +249,14 @@ class Document extends Model public function getSentAtAttribute(string $value = null) { - $sent = $this->histories()->where('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; } 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/public/akaunting-js/generalAction.js b/public/akaunting-js/generalAction.js index deb36a43b..5a35ce460 100644 --- a/public/akaunting-js/generalAction.js +++ b/public/akaunting-js/generalAction.js @@ -277,4 +277,17 @@ function runTooltip(tooltipToggleEl) { tooltipToggleEl.addEventListener(event, hide); }); } -// Tooltip elements using [data-tooltip-target], [data-tooltip-placement] \ No newline at end of file +// Tooltip elements using [data-tooltip-target], [data-tooltip-placement] + +//Auto Height for Textarea +const tx = document.querySelectorAll('[textarea-auto-height]'); +for (let i = 0; i < tx.length; i++) { + tx[i].setAttribute('style', 'height:' + (tx[i].scrollHeight) + 'px;overflow-y:hidden;'); + tx[i].addEventListener('input', OnInput, false); +} + +function OnInput() { + this.style.height = 'auto'; + this.style.height = (this.scrollHeight) + 'px'; +} +//Auto Height for Textarea \ No newline at end of file diff --git a/public/css/app.css b/public/css/app.css index 9ee3dade8..2becdb851 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -1584,7 +1584,7 @@ input[type="date"]::-webkit-inner-spin-button, } .overflow-overlay { - overflow: overlay; + overflow-x: overlay; } .py-top { 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/assets/js/components/AkauntingModal.vue b/resources/assets/js/components/AkauntingModal.vue index 3cbe01bb0..5dc8d4c7c 100644 --- a/resources/assets/js/components/AkauntingModal.vue +++ b/resources/assets/js/components/AkauntingModal.vue @@ -125,7 +125,7 @@ export default { if (this.show) { let documentClasses = document.body.classList; - documentClasses.add("overflow-hidden"); + documentClasses.add('overflow-y-hidden', 'overflow-overlay', '-ml-4'); } if (this.modalDialogClass) { @@ -158,7 +158,7 @@ export default { onCancel() { let documentClasses = document.body.classList; - documentClasses.remove("overflow-hidden"); + documentClasses.remove('overflow-y-hidden', 'overflow-overlay', '-ml-4'); this.$emit("cancel"); } @@ -169,9 +169,9 @@ export default { let documentClasses = document.body.classList; if (val) { - documentClasses.add("overflow-hidden"); + documentClasses.add('overflow-y-hidden', 'overflow-overlay', '-ml-4'); } else { - documentClasses.remove("overflow-hidden"); + documentClasses.remove('overflow-y-hidden', 'overflow-overlay', '-ml-4'); } } } diff --git a/resources/assets/js/components/AkauntingModalAddNew.vue b/resources/assets/js/components/AkauntingModalAddNew.vue index 6da73b8ef..28c42c205 100644 --- a/resources/assets/js/components/AkauntingModalAddNew.vue +++ b/resources/assets/js/components/AkauntingModalAddNew.vue @@ -154,7 +154,7 @@ export default { created: function () { let documentClasses = document.body.classList; - documentClasses.add("overflow-hidden"); + documentClasses.add('overflow-y-hidden', 'overflow-overlay', '-ml-4'); if (this.modalDialogClass) { let modal_size = this.modalDialogClass.replace('modal-', 'max-w-screen-'); @@ -311,7 +311,7 @@ export default { onCancel() { let documentClasses = document.body.classList; - documentClasses.remove("overflow-hidden"); + documentClasses.remove('overflow-y-hidden', 'overflow-overlay', '-ml-4'); this.$emit("cancel"); } @@ -322,9 +322,9 @@ export default { let documentClasses = document.body.classList; if (val) { - documentClasses.add("overflow-hidden"); + documentClasses.add('overflow-y-hidden', 'overflow-overlay', '-ml-4'); } else { - documentClasses.remove("overflow-hidden"); + documentClasses.remove('overflow-y-hidden', 'overflow-overlay', '-ml-4'); } } } diff --git a/resources/assets/sass/app.css b/resources/assets/sass/app.css index fd9082392..74de655ea 100644 --- a/resources/assets/sass/app.css +++ b/resources/assets/sass/app.css @@ -189,7 +189,7 @@ } .overflow-overlay { - overflow: overlay; + overflow-x: overlay; } .py-top { 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.', 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/banking/transactions/index.blade.php b/resources/views/banking/transactions/index.blade.php index e3574de72..ee7b5528d 100644 --- a/resources/views/banking/transactions/index.blade.php +++ b/resources/views/banking/transactions/index.blade.php @@ -162,15 +162,18 @@ {{ $item->contact->name }} - + @if ($item->document) - - {{ $item->document->document_number }} - +
+ + {{ $item->document->document_number }} + -
+
+
- + +
@else @endif diff --git a/resources/views/components/contacts/show/content.blade.php b/resources/views/components/contacts/show/content.blade.php index 765cfa22b..d0f9c7a01 100644 --- a/resources/views/components/contacts/show/content.blade.php +++ b/resources/views/components/contacts/show/content.blade.php @@ -215,12 +215,12 @@ {{ $item->contact_name }}
- + {{ $item->document_number }} -
+
diff --git a/resources/views/components/documents/form/note.blade.php b/resources/views/components/documents/form/note.blade.php index 0fb6d0d19..03a5bffac 100644 --- a/resources/views/components/documents/form/note.blade.php +++ b/resources/views/components/documents/form/note.blade.php @@ -8,5 +8,6 @@ form-label-class="lg:text-lg" form-group-class="border-b pb-2 mb-3.5" rows="1" + textarea-auto-height /> diff --git a/resources/views/components/documents/index/information.blade.php b/resources/views/components/documents/index/information.blade.php index a9b670b4c..a2e3fb1a6 100644 --- a/resources/views/components/documents/index/information.blade.php +++ b/resources/views/components/documents/index/information.blade.php @@ -1,4 +1,4 @@ -