From 66f0e7c9d79aa59738a49d22e282debbdf5e8948 Mon Sep 17 00:00:00 2001 From: cuneytsenturk Date: Mon, 29 Oct 2018 15:36:23 +0300 Subject: [PATCH 1/2] Wizard on Invoice and Bill work flow --- app/Http/Controllers/Expenses/Bills.php | 7 +- public/css/app.css | 8 ++ resources/lang/en-GB/bills.php | 13 +++ resources/lang/en-GB/general.php | 3 + resources/lang/en-GB/invoices.php | 13 +++ resources/views/expenses/bills/show.blade.php | 68 +++++++++++++++ .../views/incomes/invoices/show.blade.php | 82 +++++++++++++++++++ 7 files changed, 191 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Expenses/Bills.php b/app/Http/Controllers/Expenses/Bills.php index fba2db439..bb59d3c22 100644 --- a/app/Http/Controllers/Expenses/Bills.php +++ b/app/Http/Controllers/Expenses/Bills.php @@ -14,6 +14,7 @@ use App\Models\Expense\BillStatus; use App\Models\Expense\Vendor; use App\Models\Expense\Bill; use App\Models\Expense\BillItem; +use App\Models\Expense\BillItemTax; use App\Models\Expense\BillTotal; use App\Models\Expense\BillHistory; use App\Models\Expense\BillPayment; @@ -224,7 +225,7 @@ class Bills extends Controller if ($bill_item_taxes) { foreach ($bill_item_taxes as $bill_item_tax) { - $bill_item_tax['invoice_item_id'] = $bill_item_created->id; + $bill_item_tax['bill_item_id'] = $bill_item_created->id; BillItemTax::create($bill_item_tax); @@ -460,7 +461,7 @@ class Bills extends Controller if ($bill_item_taxes) { foreach ($bill_item_taxes as $bill_item_tax) { - $bill_item_tax['invoice_item_id'] = $bill_item_created->id; + $bill_item_tax['bill_item_id'] = $bill_item_created->id; BillItemTax::create($bill_item_tax); @@ -548,7 +549,7 @@ class Bills extends Controller \Excel::create('bills', function ($excel) { $bills = Bill::with(['items', 'histories', 'payments', 'totals'])->filter(request()->input())->get(); - $excel->sheet('invoices', function ($sheet) use ($bills) { + $excel->sheet('bills', function ($sheet) use ($bills) { $sheet->fromModel($bills->makeHidden([ 'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media' ])); diff --git a/public/css/app.css b/public/css/app.css index 4374d6c64..1c1a8cae0 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -831,3 +831,11 @@ input[type="number"] { line-height: 1.428571; border-radius: 30px; } + +.row.show-invoice .timeline>li { + margin-right: 0; +} + +.row.show-invoice .timeline>li a:first-child { + margin-left: 10px; +} diff --git a/resources/lang/en-GB/bills.php b/resources/lang/en-GB/bills.php index b8832c93d..8593a4716 100644 --- a/resources/lang/en-GB/bills.php +++ b/resources/lang/en-GB/bills.php @@ -41,6 +41,19 @@ return [ 'messages' => [ 'received' => 'Bill marked as received successfully!', + 'draft' => 'This is a DRAFT bill and will be reflected to charts once it gets receive.', + + 'status' => [ + 'created' => 'Created on :date', + 'receive' => [ + 'draft' => 'Not sent', + 'received' => 'Send on :date', + ], + 'paid' => [ + 'await' => 'Awaiting payment', + 'partial' => 'Partial paid', + ], + ], ], ]; diff --git a/resources/lang/en-GB/general.php b/resources/lang/en-GB/general.php index 3459271b0..4ae428195 100644 --- a/resources/lang/en-GB/general.php +++ b/resources/lang/en-GB/general.php @@ -113,6 +113,9 @@ return [ 'title' => [ 'new' => 'New :type', 'edit' => 'Edit :type', + 'create' => 'Create :type', + 'send' => 'Send :type', + 'get' => 'Get :type', ], 'form' => [ diff --git a/resources/lang/en-GB/invoices.php b/resources/lang/en-GB/invoices.php index 512220c9b..6b61049b4 100644 --- a/resources/lang/en-GB/invoices.php +++ b/resources/lang/en-GB/invoices.php @@ -46,6 +46,19 @@ return [ 'email_sent' => 'Invoice email has been sent successfully!', 'marked_sent' => 'Invoice marked as sent successfully!', 'email_required' => 'No email address for this customer!', + 'draft' => 'This is a DRAFT invoice and will be reflected to charts once it gets sent.', + + 'status' => [ + 'created' => 'Created on :date', + 'send' => [ + 'draft' => 'Not sent', + 'sent' => 'Send on :date', + ], + 'paid' => [ + 'await' => 'Awaiting payment', + 'partial' => 'Partial paid', + ], + ], ], 'notification' => [ diff --git a/resources/views/expenses/bills/show.blade.php b/resources/views/expenses/bills/show.blade.php index c3d0c0734..0a1b184bd 100644 --- a/resources/views/expenses/bills/show.blade.php +++ b/resources/views/expenses/bills/show.blade.php @@ -15,6 +15,74 @@ @endif + @if ($bill->status->code == 'draft') +
+

{!! trans('invoices.messages.draft') !!}

+
+ @endif + + @if ($bill->status->code != 'paid') +
+
+
    +
  • + + +
    +

    {{ trans('general.title.create', ['type' => trans_choice('general.bills', 1)]) }}

    + +
    + {{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.created', ['date' => Date::parse($bill->created_at)->format($date_format)]) }} + + + {{ trans('general.edit') }} + +
    +
    +
  • +
  • + + +
    +

    {{ trans('general.title.send', ['type' => trans_choice('general.bills', 1)]) }}

    + +
    + @if ($bill->status->code == 'draft') + {{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.receive.draft') }} + + @permission('update-expenses-bills') + {{ trans('bills.mark_received') }} + @endpermission + @else + {{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.receive.received', ['date' => Date::parse($bill->created_at)->format($date_format)]) }} + @endif +
    +
    +
  • +
  • + + +
    +

    {{ trans('general.title.get', ['type' => trans('general.paid')]) }}

    + +
    + @if($bill->status->code != 'paid' && empty($bill->payments()->count())) + {{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.paid.await') }} + @else + {{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.paid.partial') }} + @endif + + @if(empty($bill->payments()->count()) || (!empty($bill->payments()->count()) && $bill->paid != $bill->amount)) + {{ trans('bills.add_payment') }} + @endif +
    +
    +
  • +
+
+
+ @endif +
diff --git a/resources/views/incomes/invoices/show.blade.php b/resources/views/incomes/invoices/show.blade.php index 32a90a996..72607e094 100644 --- a/resources/views/incomes/invoices/show.blade.php +++ b/resources/views/incomes/invoices/show.blade.php @@ -15,6 +15,88 @@
@endif + @if ($invoice->status->code == 'draft') +
+

{!! trans('invoices.messages.draft') !!}

+
+ @endif + + @if ($invoice->status->code != 'paid') +
+
+
    +
  • + + +
    +

    {{ trans('general.title.create', ['type' => trans_choice('general.invoices', 1)]) }}

    + +
    + {{ trans_choice('general.statuses', 1) . ': ' . trans('invoices.messages.status.created', ['date' => Date::parse($invoice->created_at)->format($date_format)]) }} + + + {{ trans('general.edit') }} + +
    +
    +
  • +
  • + + +
    +

    {{ trans('general.title.send', ['type' => trans_choice('general.invoices', 1)]) }}

    + +
    + @if ($invoice->status->code != 'sent' && $invoice->status->code != 'partial') + {{ trans_choice('general.statuses', 1) . ': ' . trans('invoices.messages.status.send.draft') }} + + @permission('update-incomes-invoices') + @if($invoice->invoice_status_code == 'draft') + {{ trans('invoices.mark_sent') }} + @else + {{ trans('invoices.mark_sent') }} + @endif + @endpermission + @if($invoice->customer_email) + {{ trans('invoices.send_mail') }} + @else + + {{ trans('invoices.send_mail') }} + + @endif + @else + {{ trans_choice('general.statuses', 1) . ': ' . trans('invoices.messages.status.send.sent', ['date' => Date::parse($invoice->created_at)->format($date_format)]) }} + @endif +
    +
    +
  • +
  • + + +
    +

    {{ trans('general.title.get', ['type' => trans('general.paid')]) }}

    + +
    + @if($invoice->status->code != 'paid' && empty($invoice->payments()->count())) + {{ trans_choice('general.statuses', 1) . ': ' . trans('invoices.messages.status.paid.await') }} + @else + {{ trans_choice('general.statuses', 1) . ': ' . trans('invoices.messages.status.paid.partial') }} + @endif + + @permission('update-incomes-invoices') + {{ trans('invoices.mark_paid') }} + @endpermission + @if(empty($invoice->payments()->count()) || (!empty($invoice->payments()->count()) && $invoice->paid != $invoice->amount)) + {{ trans('invoices.add_payment') }} + @endif +
    +
    +
  • +
+
+
+ @endif +
From ae157352123ebe7c7dac666626eca935b212ceff Mon Sep 17 00:00:00 2001 From: cuneytsenturk Date: Mon, 29 Oct 2018 15:41:48 +0300 Subject: [PATCH 2/2] change languge text --- resources/lang/en-GB/bills.php | 1 - resources/lang/en-GB/invoices.php | 1 - resources/views/expenses/bills/show.blade.php | 2 +- resources/views/incomes/invoices/show.blade.php | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/lang/en-GB/bills.php b/resources/lang/en-GB/bills.php index 8593a4716..501cc9414 100644 --- a/resources/lang/en-GB/bills.php +++ b/resources/lang/en-GB/bills.php @@ -51,7 +51,6 @@ return [ ], 'paid' => [ 'await' => 'Awaiting payment', - 'partial' => 'Partial paid', ], ], ], diff --git a/resources/lang/en-GB/invoices.php b/resources/lang/en-GB/invoices.php index 6b61049b4..4399c62cd 100644 --- a/resources/lang/en-GB/invoices.php +++ b/resources/lang/en-GB/invoices.php @@ -56,7 +56,6 @@ return [ ], 'paid' => [ 'await' => 'Awaiting payment', - 'partial' => 'Partial paid', ], ], ], diff --git a/resources/views/expenses/bills/show.blade.php b/resources/views/expenses/bills/show.blade.php index 0a1b184bd..846a840c8 100644 --- a/resources/views/expenses/bills/show.blade.php +++ b/resources/views/expenses/bills/show.blade.php @@ -69,7 +69,7 @@ @if($bill->status->code != 'paid' && empty($bill->payments()->count())) {{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.paid.await') }} @else - {{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.paid.partial') }} + {{ trans_choice('general.statuses', 1) . ': ' . trans('general.partially_paid') }} @endif @if(empty($bill->payments()->count()) || (!empty($bill->payments()->count()) && $bill->paid != $bill->amount)) diff --git a/resources/views/incomes/invoices/show.blade.php b/resources/views/incomes/invoices/show.blade.php index 72607e094..b320ffa22 100644 --- a/resources/views/incomes/invoices/show.blade.php +++ b/resources/views/incomes/invoices/show.blade.php @@ -80,7 +80,7 @@ @if($invoice->status->code != 'paid' && empty($invoice->payments()->count())) {{ trans_choice('general.statuses', 1) . ': ' . trans('invoices.messages.status.paid.await') }} @else - {{ trans_choice('general.statuses', 1) . ': ' . trans('invoices.messages.status.paid.partial') }} + {{ trans_choice('general.statuses', 1) . ': ' . trans('general.partially_paid') }} @endif @permission('update-incomes-invoices')