removed invoice/bill status tables

This commit is contained in:
denisdulici 2020-01-11 16:57:32 +03:00
parent b5519004a0
commit 08eb8e75fc
69 changed files with 250 additions and 470 deletions

View File

@ -47,17 +47,13 @@ abstract class Widget
$today = Date::today()->toDateString(); $today = Date::today()->toDateString();
$type = ($model instanceof Invoice) ? 'invoice' : 'bill'; if ($model->status == 'paid') {
$status_field = $type . '_status_code';
if ($model->$status_field == 'paid') {
return [$open, $overdue]; return [$open, $overdue];
} }
$payments = 0; $payments = 0;
if ($model->$status_field == 'partial') { if ($model->status == 'partial') {
foreach ($model->transactions as $transaction) { foreach ($model->transactions as $transaction) {
$payments += $transaction->getAmountConvertedToDefault(); $payments += $transaction->getAmountConvertedToDefault();
} }

View File

@ -34,7 +34,7 @@ class Bills extends BulkAction
$bills = $this->getSelectedRecords($request); $bills = $this->getSelectedRecords($request);
foreach ($bills as $bill) { foreach ($bills as $bill) {
$bill->bill_status_code = 'received'; $bill->status = 'received';
$bill->save(); $bill->save();
$description = trans('bills.mark_recevied'); $description = trans('bills.mark_recevied');

View File

@ -33,7 +33,7 @@ class BillHistories implements FromCollection, ShouldAutoSize, WithHeadings, Wit
{ {
return [ return [
$model->bill_id, $model->bill_id,
$model->status_code, $model->status,
$model->notify, $model->notify,
$model->description, $model->description,
]; ];
@ -43,7 +43,7 @@ class BillHistories implements FromCollection, ShouldAutoSize, WithHeadings, Wit
{ {
return [ return [
'bill_id', 'bill_id',
'status_code', 'status',
'notify', 'notify',
'description', 'description',
]; ];
@ -53,4 +53,4 @@ class BillHistories implements FromCollection, ShouldAutoSize, WithHeadings, Wit
{ {
return 'bill_histories'; return 'bill_histories';
} }
} }

View File

@ -34,7 +34,7 @@ class Bills implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
return [ return [
$model->bill_number, $model->bill_number,
$model->order_number, $model->order_number,
$model->bill_status_code, $model->status,
$model->billed_at, $model->billed_at,
$model->due_at, $model->due_at,
$model->amount, $model->amount,
@ -57,7 +57,7 @@ class Bills implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
return [ return [
'bill_number', 'bill_number',
'order_number', 'order_number',
'bill_status_code', 'status',
'billed_at', 'billed_at',
'due_at', 'due_at',
'amount', 'amount',

View File

@ -33,7 +33,7 @@ class InvoiceHistories implements FromCollection, ShouldAutoSize, WithHeadings,
{ {
return [ return [
$model->invoice_id, $model->invoice_id,
$model->status_code, $model->status,
$model->notify, $model->notify,
$model->description, $model->description,
]; ];
@ -43,7 +43,7 @@ class InvoiceHistories implements FromCollection, ShouldAutoSize, WithHeadings,
{ {
return [ return [
'invoice_id', 'invoice_id',
'status_code', 'status',
'notify', 'notify',
'description', 'description',
]; ];
@ -53,4 +53,4 @@ class InvoiceHistories implements FromCollection, ShouldAutoSize, WithHeadings,
{ {
return 'invoice_histories'; return 'invoice_histories';
} }
} }

View File

@ -34,7 +34,7 @@ class Invoices implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
return [ return [
$model->invoice_number, $model->invoice_number,
$model->order_number, $model->order_number,
$model->invoice_status_code, $model->status,
$model->invoiced_at, $model->invoiced_at,
$model->due_at, $model->due_at,
$model->amount, $model->amount,
@ -57,7 +57,7 @@ class Invoices implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
return [ return [
'invoice_number', 'invoice_number',
'order_number', 'order_number',
'invoice_status_code', 'status',
'invoiced_at', 'invoiced_at',
'due_at', 'due_at',
'amount', 'amount',

View File

@ -40,7 +40,7 @@ class Dashboard extends Controller
$unpaid = $paid = $overdue = $partial_paid = []; $unpaid = $paid = $overdue = $partial_paid = [];
foreach ($invoices as $invoice) { foreach ($invoices as $invoice) {
switch ($invoice->invoice_status_code) { switch ($invoice->status) {
case 'paid': case 'paid':
$paid[] = $invoice; $paid[] = $invoice;
break; break;

View File

@ -6,18 +6,18 @@ use App\Abstracts\Http\Controller;
use App\Models\Banking\Account; use App\Models\Banking\Account;
use App\Models\Common\Contact; use App\Models\Common\Contact;
use App\Models\Sale\Invoice; use App\Models\Sale\Invoice;
use App\Models\Sale\InvoiceStatus;
use App\Models\Setting\Category; use App\Models\Setting\Category;
use App\Models\Setting\Currency; use App\Models\Setting\Currency;
use App\Traits\Currencies; use App\Traits\Currencies;
use App\Traits\DateTime; use App\Traits\DateTime;
use App\Traits\Sales;
use App\Traits\Uploads; use App\Traits\Uploads;
use App\Utilities\Modules; use App\Utilities\Modules;
use Illuminate\Support\Facades\URL; use Illuminate\Support\Facades\URL;
class Invoices extends Controller class Invoices extends Controller
{ {
use DateTime, Currencies, Uploads; use DateTime, Currencies, Sales, Uploads;
/** /**
* Display a listing of the resource. * Display a listing of the resource.
@ -32,10 +32,7 @@ class Invoices extends Controller
$categories = collect(Category::type('income')->enabled()->orderBy('name')->pluck('name', 'id')); $categories = collect(Category::type('income')->enabled()->orderBy('name')->pluck('name', 'id'));
$statuses = collect(InvoiceStatus::get()->each(function ($item) { $statuses = $this->getInvoiceStatuses();
$item->name = trans('invoices.status.' . $item->code);
return $item;
})->pluck('name', 'code'));
return view('portal.invoices.index', compact('invoices', 'categories', 'statuses')); return view('portal.invoices.index', compact('invoices', 'categories', 'statuses'));
} }

View File

@ -15,7 +15,6 @@ use App\Jobs\Purchase\UpdateBill;
use App\Models\Banking\Account; use App\Models\Banking\Account;
use App\Models\Common\Contact; use App\Models\Common\Contact;
use App\Models\Common\Item; use App\Models\Common\Item;
use App\Models\Purchase\BillStatus;
use App\Models\Purchase\Bill; use App\Models\Purchase\Bill;
use App\Models\Purchase\BillHistory; use App\Models\Purchase\BillHistory;
use App\Models\Setting\Category; use App\Models\Setting\Category;
@ -24,12 +23,13 @@ use App\Models\Setting\Tax;
use App\Traits\Contacts; use App\Traits\Contacts;
use App\Traits\Currencies; use App\Traits\Currencies;
use App\Traits\DateTime; use App\Traits\DateTime;
use App\Traits\Purchases;
use App\Traits\Uploads; use App\Traits\Uploads;
use App\Utilities\Modules; use App\Utilities\Modules;
class Bills extends Controller class Bills extends Controller
{ {
use Contacts, Currencies, DateTime, Uploads; use Contacts, Currencies, DateTime, Purchases, Uploads;
/** /**
* Display a listing of the resource. * Display a listing of the resource.
@ -44,10 +44,7 @@ class Bills extends Controller
$categories = Category::type('expense')->enabled()->orderBy('name')->pluck('name', 'id'); $categories = Category::type('expense')->enabled()->orderBy('name')->pluck('name', 'id');
$statuses = collect(BillStatus::get()->each(function ($item) { $statuses = $this->getBillStatuses();
$item->name = trans('bills.status.' . $item->code);
return $item;
})->pluck('name', 'code'));
return view('purchases.bills.index', compact('bills', 'vendors', 'categories', 'statuses')); return view('purchases.bills.index', compact('bills', 'vendors', 'categories', 'statuses'));
} }
@ -270,14 +267,14 @@ class Bills extends Controller
*/ */
public function markReceived(Bill $bill) public function markReceived(Bill $bill)
{ {
$bill->bill_status_code = 'received'; $bill->status = 'received';
$bill->save(); $bill->save();
// Add bill history // Add bill history
BillHistory::create([ BillHistory::create([
'company_id' => $bill->company_id, 'company_id' => $bill->company_id,
'bill_id' => $bill->id, 'bill_id' => $bill->id,
'status_code' => 'received', 'status' => 'received',
'notify' => 0, 'notify' => 0,
'description' => trans('bills.mark_received'), 'description' => trans('bills.mark_received'),
]); ]);

View File

@ -59,7 +59,7 @@ class Vendors extends Controller
foreach ($bills as $item) { foreach ($bills as $item) {
// Already in transactions // Already in transactions
if ($item->bill_status_code == 'paid') { if ($item->status == 'paid') {
continue; continue;
} }

View File

@ -60,7 +60,7 @@ class Customers extends Controller
foreach ($invoices as $item) { foreach ($invoices as $item) {
// Already in transactions // Already in transactions
if ($item->invoice_status_code == 'paid') { if ($item->status == 'paid') {
continue; continue;
} }

View File

@ -16,7 +16,6 @@ use App\Models\Banking\Account;
use App\Models\Common\Contact; use App\Models\Common\Contact;
use App\Models\Common\Item; use App\Models\Common\Item;
use App\Models\Sale\Invoice; use App\Models\Sale\Invoice;
use App\Models\Sale\InvoiceStatus;
use App\Models\Setting\Category; use App\Models\Setting\Category;
use App\Models\Setting\Currency; use App\Models\Setting\Currency;
use App\Models\Setting\Tax; use App\Models\Setting\Tax;
@ -46,10 +45,7 @@ class Invoices extends Controller
$categories = Category::type('income')->enabled()->orderBy('name')->pluck('name', 'id'); $categories = Category::type('income')->enabled()->orderBy('name')->pluck('name', 'id');
$statuses = collect(InvoiceStatus::get()->each(function ($item) { $statuses = $this->getInvoiceStatuses();
$item->name = trans('invoices.status.' . $item->code);
return $item;
})->pluck('name', 'code'));
return view('sales.invoices.index', compact('invoices', 'customers', 'categories', 'statuses')); return view('sales.invoices.index', compact('invoices', 'customers', 'categories', 'statuses'));
} }

View File

@ -42,7 +42,7 @@ class Bill extends FormRequest
return [ return [
'bill_number' => 'required|string|unique:bills,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL', 'bill_number' => 'required|string|unique:bills,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
'bill_status_code' => 'required|string', 'status' => 'required|string',
'billed_at' => 'required|date_format:Y-m-d H:i:s', 'billed_at' => 'required|date_format:Y-m-d H:i:s',
'due_at' => 'required|date_format:Y-m-d H:i:s', 'due_at' => 'required|date_format:Y-m-d H:i:s',
'amount' => 'required', 'amount' => 'required',

View File

@ -25,7 +25,7 @@ class BillHistory extends FormRequest
{ {
return [ return [
'bill_id' => 'required|integer', 'bill_id' => 'required|integer',
'status_code' => 'required|string', 'status' => 'required|string',
'notify' => 'required|integer', 'notify' => 'required|integer',
]; ];
} }

View File

@ -42,7 +42,7 @@ class Invoice extends FormRequest
return [ return [
'invoice_number' => 'required|string|unique:invoices,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL', 'invoice_number' => 'required|string|unique:invoices,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
'invoice_status_code' => 'required|string', 'status' => 'required|string',
'invoiced_at' => 'required|date_format:Y-m-d H:i:s', 'invoiced_at' => 'required|date_format:Y-m-d H:i:s',
'due_at' => 'required|date_format:Y-m-d H:i:s', 'due_at' => 'required|date_format:Y-m-d H:i:s',
'amount' => 'required', 'amount' => 'required',

View File

@ -25,7 +25,7 @@ class InvoiceHistory extends FormRequest
{ {
return [ return [
'invoice_id' => 'required|integer', 'invoice_id' => 'required|integer',
'status_code' => 'required|string', 'status' => 'required|string',
'notify' => 'required|integer', 'notify' => 'required|integer',
]; ];
} }

View File

@ -144,7 +144,7 @@ class CreateDocumentTransaction extends Job
throw new \Exception($message); throw new \Exception($message);
} else { } else {
$this->setStatusCode($amount_check, $total_amount_check); $this->model->status = ($amount_check == $total_amount_check) ? 'paid' : 'partial';
} }
return true; return true;
@ -189,17 +189,6 @@ class CreateDocumentTransaction extends Job
return $paid; return $paid;
} }
protected function setStatusCode($amount_check, $total_amount_check)
{
$column = ($this->model instanceof Invoice) ? 'invoice_status_code' : 'bill_status_code';
if ($amount_check == $total_amount_check) {
$this->model->$column = 'paid';
} else {
$this->model->$column = 'partial';
}
}
protected function createHistory($transaction) protected function createHistory($transaction)
{ {
$history_desc = money((double) $transaction->amount, (string) $transaction->currency_code, true)->format() . ' ' . trans_choice('general.payments', 1); $history_desc = money((double) $transaction->amount, (string) $transaction->currency_code, true)->format() . ' ' . trans_choice('general.payments', 1);

View File

@ -32,9 +32,9 @@ class DeleteCompany extends Job
$this->authorize(); $this->authorize();
$this->deleteRelationships($this->company, [ $this->deleteRelationships($this->company, [
'accounts', 'bills', 'bill_histories', 'bill_items', 'bill_item_taxes', 'bill_statuses', 'bill_totals', 'categories', 'accounts', 'bills', 'bill_histories', 'bill_items', 'bill_item_taxes', 'bill_totals', 'categories',
'contacts', 'currencies', 'dashboards', 'email_templates', 'invoices', 'invoice_histories', 'invoice_items', 'contacts', 'currencies', 'dashboards', 'email_templates', 'invoices', 'invoice_histories', 'invoice_items',
'invoice_item_taxes', 'invoice_statuses', 'invoice_totals', 'items', 'modules', 'module_histories', 'reconciliations', 'invoice_item_taxes', 'invoice_totals', 'items', 'modules', 'module_histories', 'reconciliations',
'recurring', 'reports', 'settings', 'taxes', 'transactions', 'transfers', 'widgets', 'recurring', 'reports', 'settings', 'taxes', 'transactions', 'transfers', 'widgets',
]); ]);

View File

@ -39,7 +39,7 @@ class CreateBillHistory extends Job
$bill_history = BillHistory::create([ $bill_history = BillHistory::create([
'company_id' => $this->bill->company_id, 'company_id' => $this->bill->company_id,
'bill_id' => $this->bill->id, 'bill_id' => $this->bill->id,
'status_code' => $this->bill->bill_status_code, 'status' => $this->bill->status,
'notify' => $this->notify, 'notify' => $this->notify,
'description' => $description, 'description' => $description,
]); ]);

View File

@ -33,7 +33,7 @@ class DuplicateBill extends Job
BillHistory::create([ BillHistory::create([
'company_id' => session('company_id'), 'company_id' => session('company_id'),
'bill_id' => $clone->id, 'bill_id' => $clone->id,
'status_code' => 'draft', 'status' => 'draft',
'notify' => 0, 'notify' => 0,
'description' => trans('messages.success.added', ['type' => $clone->bill_number]), 'description' => trans('messages.success.added', ['type' => $clone->bill_number]),
]); ]);

View File

@ -57,7 +57,7 @@ class UpdateBill extends Job
unset($this->bill->reconciled); unset($this->bill->reconciled);
if (($bill_paid) && $this->request['amount'] > $bill_paid) { if (($bill_paid) && $this->request['amount'] > $bill_paid) {
$this->request['bill_status_code'] = 'partial'; $this->request['status'] = 'partial';
} }
$this->bill->update($this->request->input()); $this->bill->update($this->request->input());

View File

@ -39,7 +39,7 @@ class CreateInvoiceHistory extends Job
$invoice_history = InvoiceHistory::create([ $invoice_history = InvoiceHistory::create([
'company_id' => $this->invoice->company_id, 'company_id' => $this->invoice->company_id,
'invoice_id' => $this->invoice->id, 'invoice_id' => $this->invoice->id,
'status_code' => $this->invoice->invoice_status_code, 'status' => $this->invoice->status,
'notify' => $this->notify, 'notify' => $this->notify,
'description' => $description, 'description' => $description,
]); ]);

View File

@ -57,7 +57,7 @@ class UpdateInvoice extends Job
unset($this->invoice->reconciled); unset($this->invoice->reconciled);
if (($invoice_paid) && $this->request['amount'] > $invoice_paid) { if (($invoice_paid) && $this->request['amount'] > $invoice_paid) {
$this->request['invoice_status_code'] = 'partial'; $this->request['status'] = 'partial';
} }
$this->invoice->update($this->request->all()); $this->invoice->update($this->request->all());

View File

@ -16,8 +16,8 @@ class MarkInvoiceSent
public function handle(Event $event) public function handle(Event $event)
{ {
// Mark invoice as sent // Mark invoice as sent
if ($event->invoice->invoice_status_code != 'partial') { if ($event->invoice->status != 'partial') {
$event->invoice->invoice_status_code = 'sent'; $event->invoice->status = 'sent';
$event->invoice->save(); $event->invoice->save();
} }
@ -26,7 +26,7 @@ class MarkInvoiceSent
InvoiceHistory::create([ InvoiceHistory::create([
'company_id' => $event->invoice->company_id, 'company_id' => $event->invoice->company_id,
'invoice_id' => $event->invoice->id, 'invoice_id' => $event->invoice->id,
'status_code' => 'sent', 'status' => 'sent',
'notify' => 0, 'notify' => 0,
'description' => trans('invoices.mark_sent'), 'description' => trans('invoices.mark_sent'),
]); ]);

View File

@ -16,13 +16,13 @@ class MarkInvoiceViewed
{ {
$invoice = $event->invoice; $invoice = $event->invoice;
if ($invoice->invoice_status_code != 'sent') { if ($invoice->status != 'sent') {
return; return;
} }
unset($invoice->paid); unset($invoice->paid);
$invoice->invoice_status_code = 'viewed'; $invoice->status = 'viewed';
$invoice->save(); $invoice->save();
} }
} }

View File

@ -63,11 +63,6 @@ class Company extends Eloquent
return $this->hasMany('App\Models\Purchase\BillItemTax'); return $this->hasMany('App\Models\Purchase\BillItemTax');
} }
public function bill_statuses()
{
return $this->hasMany('App\Models\Purchase\BillStatus');
}
public function bill_totals() public function bill_totals()
{ {
return $this->hasMany('App\Models\Purchase\BillTotal'); return $this->hasMany('App\Models\Purchase\BillTotal');
@ -133,11 +128,6 @@ class Company extends Eloquent
return $this->hasMany('App\Models\Sale\InvoiceItemTax'); return $this->hasMany('App\Models\Sale\InvoiceItemTax');
} }
public function invoice_statuses()
{
return $this->hasMany('App\Models\Sale\InvoiceStatus');
}
public function invoice_totals() public function invoice_totals()
{ {
return $this->hasMany('App\Models\Sale\InvoiceTotal'); return $this->hasMany('App\Models\Sale\InvoiceTotal');

View File

@ -23,7 +23,7 @@ class Bill extends Model
* *
* @var array * @var array
*/ */
protected $appends = ['attachment', 'amount_without_tax', 'discount', 'paid']; protected $appends = ['attachment', 'amount_without_tax', 'discount', 'paid', 'status_label'];
protected $dates = ['deleted_at', 'billed_at', 'due_at']; protected $dates = ['deleted_at', 'billed_at', 'due_at'];
@ -32,14 +32,14 @@ class Bill extends Model
* *
* @var array * @var array
*/ */
protected $fillable = ['company_id', 'bill_number', 'order_number', 'bill_status_code', 'billed_at', 'due_at', 'amount', 'currency_code', 'currency_rate', 'contact_id', 'contact_name', 'contact_email', 'contact_tax_number', 'contact_phone', 'contact_address', 'notes', 'category_id', 'parent_id']; protected $fillable = ['company_id', 'bill_number', 'order_number', 'status', 'billed_at', 'due_at', 'amount', 'currency_code', 'currency_rate', 'contact_id', 'contact_name', 'contact_email', 'contact_tax_number', 'contact_phone', 'contact_address', 'notes', 'category_id', 'parent_id'];
/** /**
* Sortable columns. * Sortable columns.
* *
* @var array * @var array
*/ */
public $sortable = ['bill_number', 'contact_name', 'amount', 'status.name', 'billed_at', 'due_at', 'bill_status_code']; public $sortable = ['bill_number', 'contact_name', 'amount', 'status', 'billed_at', 'due_at'];
/** /**
* Clonable relationships. * Clonable relationships.
@ -83,11 +83,6 @@ class Bill extends Model
return $this->morphOne('App\Models\Common\Recurring', 'recurable'); return $this->morphOne('App\Models\Common\Recurring', 'recurable');
} }
public function status()
{
return $this->belongsTo('App\Models\Purchase\BillStatus', 'bill_status_code', 'code');
}
public function totals() public function totals()
{ {
return $this->hasMany('App\Models\Purchase\BillTotal'); return $this->hasMany('App\Models\Purchase\BillTotal');
@ -110,22 +105,22 @@ class Bill extends Model
public function scopeAccrued($query) public function scopeAccrued($query)
{ {
return $query->where('bill_status_code', '<>', 'draft'); return $query->where('status', '<>', 'draft');
} }
public function scopePaid($query) public function scopePaid($query)
{ {
return $query->where('bill_status_code', '=', 'paid'); return $query->where('status', '=', 'paid');
} }
public function scopeNotPaid($query) public function scopeNotPaid($query)
{ {
return $query->where('bill_status_code', '<>', 'paid'); return $query->where('status', '<>', 'paid');
} }
public function onCloning($src, $child = null) public function onCloning($src, $child = null)
{ {
$this->bill_status_code = 'draft'; $this->status = 'draft';
} }
/** /**
@ -256,4 +251,30 @@ class Bill extends Model
return $paid; return $paid;
} }
/**
* Get the status label.
*
* @return string
*/
public function getLabelAttribute()
{
switch ($this->code) {
case 'paid':
$label = 'success';
break;
case 'delete':
$label = 'danger';
break;
case 'partial':
case 'received':
$label = 'warning';
break;
default:
$label = 'info';
break;
}
return $label;
}
} }

View File

@ -17,15 +17,10 @@ class BillHistory extends Model
* *
* @var array * @var array
*/ */
protected $fillable = ['company_id', 'bill_id', 'status_code', 'notify', 'description']; protected $fillable = ['company_id', 'bill_id', 'status', 'notify', 'description'];
public function bill() public function bill()
{ {
return $this->belongsTo('App\Models\Purchase\Bill'); return $this->belongsTo('App\Models\Purchase\Bill');
} }
public function status()
{
return $this->belongsTo('App\Models\Purchase\BillStatus', 'status_code', 'code');
}
} }

View File

@ -1,51 +0,0 @@
<?php
namespace App\Models\Purchase;
use App\Abstracts\Model;
class BillStatus extends Model
{
protected $table = 'bill_statuses';
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['label'];
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = ['company_id', 'name', 'code'];
/**
* Get the status label.
*
* @return string
*/
public function getLabelAttribute()
{
switch ($this->code) {
case 'paid':
$label = 'success';
break;
case 'delete':
$label = 'danger';
break;
case 'partial':
case 'received':
$label = 'warning';
break;
default:
$label = 'info';
break;
}
return $label;
}
}

View File

@ -23,7 +23,7 @@ class Invoice extends Model
* *
* @var array * @var array
*/ */
protected $appends = ['attachment', 'amount_without_tax', 'discount', 'paid']; protected $appends = ['attachment', 'amount_without_tax', 'discount', 'paid', 'status_label'];
protected $dates = ['deleted_at', 'invoiced_at', 'due_at']; protected $dates = ['deleted_at', 'invoiced_at', 'due_at'];
@ -32,14 +32,14 @@ class Invoice extends Model
* *
* @var array * @var array
*/ */
protected $fillable = ['company_id', 'invoice_number', 'order_number', 'invoice_status_code', 'invoiced_at', 'due_at', 'amount', 'currency_code', 'currency_rate', 'contact_id', 'contact_name', 'contact_email', 'contact_tax_number', 'contact_phone', 'contact_address', 'notes', 'category_id', 'parent_id', 'footer']; protected $fillable = ['company_id', 'invoice_number', 'order_number', 'status', 'invoiced_at', 'due_at', 'amount', 'currency_code', 'currency_rate', 'contact_id', 'contact_name', 'contact_email', 'contact_tax_number', 'contact_phone', 'contact_address', 'notes', 'category_id', 'parent_id', 'footer'];
/** /**
* Sortable columns. * Sortable columns.
* *
* @var array * @var array
*/ */
public $sortable = ['invoice_number', 'contact_name', 'amount', 'status' , 'invoiced_at', 'due_at', 'invoice_status_code']; public $sortable = ['invoice_number', 'contact_name', 'amount', 'status' , 'invoiced_at', 'due_at'];
protected $reconciled_amount = []; protected $reconciled_amount = [];
@ -90,11 +90,6 @@ class Invoice extends Model
return $this->morphOne('App\Models\Common\Recurring', 'recurable'); return $this->morphOne('App\Models\Common\Recurring', 'recurable');
} }
public function status()
{
return $this->belongsTo('App\Models\Sale\InvoiceStatus', 'invoice_status_code', 'code');
}
public function totals() public function totals()
{ {
return $this->hasMany('App\Models\Sale\InvoiceTotal'); return $this->hasMany('App\Models\Sale\InvoiceTotal');
@ -117,22 +112,22 @@ class Invoice extends Model
public function scopeAccrued($query) public function scopeAccrued($query)
{ {
return $query->where('invoice_status_code', '<>', 'draft'); return $query->where('status', '<>', 'draft');
} }
public function scopePaid($query) public function scopePaid($query)
{ {
return $query->where('invoice_status_code', '=', 'paid'); return $query->where('status', '=', 'paid');
} }
public function scopeNotPaid($query) public function scopeNotPaid($query)
{ {
return $query->where('invoice_status_code', '<>', 'paid'); return $query->where('status', '<>', 'paid');
} }
public function onCloning($src, $child = null) public function onCloning($src, $child = null)
{ {
$this->invoice_status_code = 'draft'; $this->status = 'draft';
$this->invoice_number = $this->getNextInvoiceNumber(); $this->invoice_number = $this->getNextInvoiceNumber();
} }
@ -264,4 +259,30 @@ class Invoice extends Model
return $paid; return $paid;
} }
/**
* Get the status label.
*
* @return string
*/
public function getStatusLabelAttribute()
{
switch ($this->status) {
case 'paid':
$label = 'success';
break;
case 'delete':
$label = 'danger';
break;
case 'partial':
case 'sent':
$label = 'warning';
break;
default:
$label = 'info';
break;
}
return $label;
}
} }

View File

@ -7,7 +7,6 @@ use App\Traits\Currencies;
class InvoiceHistory extends Model class InvoiceHistory extends Model
{ {
use Currencies; use Currencies;
protected $table = 'invoice_histories'; protected $table = 'invoice_histories';
@ -17,15 +16,10 @@ class InvoiceHistory extends Model
* *
* @var array * @var array
*/ */
protected $fillable = ['company_id', 'invoice_id', 'status_code', 'notify', 'description']; protected $fillable = ['company_id', 'invoice_id', 'status', 'notify', 'description'];
public function invoice() public function invoice()
{ {
return $this->belongsTo('App\Models\Sale\Invoice'); return $this->belongsTo('App\Models\Sale\Invoice');
} }
public function status()
{
return $this->belongsTo('App\Models\Sale\InvoiceStatus', 'status_code', 'code');
}
} }

View File

@ -1,51 +0,0 @@
<?php
namespace App\Models\Sale;
use App\Abstracts\Model;
class InvoiceStatus extends Model
{
protected $table = 'invoice_statuses';
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['label'];
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = ['company_id', 'name', 'code'];
/**
* Get the status label.
*
* @return string
*/
public function getLabelAttribute()
{
switch ($this->code) {
case 'paid':
$label = 'success';
break;
case 'delete':
$label = 'danger';
break;
case 'partial':
case 'sent':
$label = 'warning';
break;
default:
$label = 'info';
break;
}
return $label;
}
}

View File

@ -100,7 +100,7 @@ class PaymentReceived extends Notification
$this->invoice->invoice_number, $this->invoice->invoice_number,
money($this->invoice->amount, $this->invoice->currency_code, true), money($this->invoice->amount, $this->invoice->currency_code, true),
$this->invoice->due_at, $this->invoice->due_at,
trans('invoices.status.' . $this->invoice->invoice_status_code), trans('invoices.statuses.' . $this->invoice->status),
URL::signedRoute('signed.invoices.show', [$this->invoice->id, 'company_id' => $this->invoice->company_id]), URL::signedRoute('signed.invoices.show', [$this->invoice->id, 'company_id' => $this->invoice->company_id]),
route('invoices.show', $this->invoice->id), route('invoices.show', $this->invoice->id),
route('portal.invoices.show', $this->invoice->id), route('portal.invoices.show', $this->invoice->id),

View File

@ -32,7 +32,7 @@ class Transaction
{ {
$invoice = $transaction->invoice; $invoice = $transaction->invoice;
$invoice->invoice_status_code = ($invoice->transactions->count() > 1) ? 'partial' : 'sent'; $invoice->status = ($invoice->transactions->count() > 1) ? 'partial' : 'sent';
$invoice->save(); $invoice->save();
@ -43,7 +43,7 @@ class Transaction
{ {
$bill = $transaction->bill; $bill = $transaction->bill;
$bill->bill_status_code = ($bill->transactions->count() > 1) ? 'partial' : 'received'; $bill->status = ($bill->transactions->count() > 1) ? 'partial' : 'received';
$bill->save(); $bill->save();

33
app/Traits/Purchases.php Normal file
View File

@ -0,0 +1,33 @@
<?php
namespace App\Traits;
trait Purchases
{
/**
* Get a collection of bill statuses
*
* @return Collection
*/
public function getBillStatuses()
{
$list = [
'draft',
'received',
'partial',
'paid',
'overdue',
'unpaid',
];
$statuses = collect($list)->each(function ($code) {
$item = new \stdClass();
$item->code = $code;
$item->name = trans('bills.statuses.' . $code);
return $item;
});
return $statuses;
}
}

View File

@ -30,4 +30,33 @@ trait Sales
setting(['invoice.number_next' => $next]); setting(['invoice.number_next' => $next]);
setting()->save(); setting()->save();
} }
}
/**
* Get a collection invoice statuses
*
* @return Collection
*/
public function getInvoiceStatuses()
{
$list = [
'draft',
'sent',
'viewed',
'approved',
'partial',
'paid',
'overdue',
'unpaid',
];
$statuses = collect($list)->each(function ($code) {
$item = new \stdClass();
$item->code = $code;
$item->name = trans('invoices.statuses.' . $code);
return $item;
});
return $statuses;
}
}

View File

@ -13,7 +13,7 @@ class Bill extends TransformerAbstract
/** /**
* @var array * @var array
*/ */
protected $defaultIncludes = ['contact', 'currency', 'histories', 'items', 'status', 'transactions']; protected $defaultIncludes = ['contact', 'currency', 'histories', 'items', 'transactions'];
/** /**
* @param Model $model * @param Model $model
@ -26,7 +26,7 @@ class Bill extends TransformerAbstract
'company_id' => $model->company_id, 'company_id' => $model->company_id,
'bill_number' => $model->bill_number, 'bill_number' => $model->bill_number,
'order_number' => $model->order_number, 'order_number' => $model->order_number,
'bill_status_code' => $model->invoice_status_code, 'status' => $model->status,
'billed_at' => $model->billed_at ? $model->billed_at->toIso8601String() : '', 'billed_at' => $model->billed_at ? $model->billed_at->toIso8601String() : '',
'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '', 'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '',
'amount' => $model->amount, 'amount' => $model->amount,
@ -81,15 +81,6 @@ class Bill extends TransformerAbstract
return $this->collection($model->items, new BillItems()); return $this->collection($model->items, new BillItems());
} }
/**
* @param Model $model
* @return \League\Fractal\Resource\Item
*/
public function includeStatus(Model $model)
{
return $this->item($model->status, new BillStatus());
}
/** /**
* @param Model $model * @param Model $model
* @return \League\Fractal\Resource\Collection * @return \League\Fractal\Resource\Collection

View File

@ -17,7 +17,7 @@ class BillHistories extends TransformerAbstract
'id' => $model->id, 'id' => $model->id,
'company_id' => $model->company_id, 'company_id' => $model->company_id,
'bill_id' => $model->bill_id, 'bill_id' => $model->bill_id,
'status_code' => $model->status_code, 'status' => $model->status,
'notify' => $model->notify, 'notify' => $model->notify,
'description' => $model->description, 'description' => $model->description,
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',

View File

@ -1,25 +0,0 @@
<?php
namespace App\Transformers\Purchase;
use App\Models\Purchase\BillStatus as Model;
use League\Fractal\TransformerAbstract;
class BillStatus extends TransformerAbstract
{
/**
* @param Model $model
* @return array
*/
public function transform(Model $model)
{
return [
'id' => $model->id,
'company_id' => $model->company_id,
'name' => $model->name,
'code' => $model->code,
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
];
}
}

View File

@ -13,7 +13,7 @@ class Invoice extends TransformerAbstract
/** /**
* @var array * @var array
*/ */
protected $defaultIncludes = ['contact', 'currency', 'histories', 'items', 'status', 'transactions']; protected $defaultIncludes = ['contact', 'currency', 'histories', 'items', 'transactions'];
/** /**
* @param Model $model * @param Model $model
@ -26,7 +26,7 @@ class Invoice extends TransformerAbstract
'company_id' => $model->company_id, 'company_id' => $model->company_id,
'invoice_number' => $model->invoice_number, 'invoice_number' => $model->invoice_number,
'order_number' => $model->order_number, 'order_number' => $model->order_number,
'invoice_status_code' => $model->invoice_status_code, 'status' => $model->status,
'invoiced_at' => $model->invoiced_at ? $model->invoiced_at->toIso8601String() : '', 'invoiced_at' => $model->invoiced_at ? $model->invoiced_at->toIso8601String() : '',
'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '', 'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '',
'amount' => $model->amount, 'amount' => $model->amount,
@ -81,15 +81,6 @@ class Invoice extends TransformerAbstract
return $this->collection($model->items, new InvoiceItems()); return $this->collection($model->items, new InvoiceItems());
} }
/**
* @param Model $model
* @return \League\Fractal\Resource\Item
*/
public function includeStatus(Model $model)
{
return $this->item($model->status, new InvoiceStatus());
}
/** /**
* @param Model $model * @param Model $model
* @return \League\Fractal\Resource\Collection * @return \League\Fractal\Resource\Collection

View File

@ -17,7 +17,7 @@ class InvoiceHistories extends TransformerAbstract
'id' => $model->id, 'id' => $model->id,
'company_id' => $model->company_id, 'company_id' => $model->company_id,
'invoice_id' => $model->invoice_id, 'invoice_id' => $model->invoice_id,
'status_code' => $model->status_code, 'status' => $model->status,
'notify' => $model->notify, 'notify' => $model->notify,
'description' => $model->description, 'description' => $model->description,
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '', 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',

View File

@ -1,25 +0,0 @@
<?php
namespace App\Transformers\Sale;
use App\Models\Sale\InvoiceStatus as Model;
use League\Fractal\TransformerAbstract;
class InvoiceStatus extends TransformerAbstract
{
/**
* @param Model $model
* @return array
*/
public function transform(Model $model)
{
return [
'id' => $model->id,
'company_id' => $model->company_id,
'name' => $model->name,
'code' => $model->code,
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
];
}
}

View File

@ -7,7 +7,7 @@ return [
*/ */
'columns' => [ 'columns' => [
'alpha' => [ 'alpha' => [
'rows' => ['name', 'contact_name', 'customer_name', 'vendor_name', 'display_name', 'company_name', 'domain', 'email', 'description', 'code', 'type', 'status', 'vendor', 'account', 'bill_status_code', 'invoice_status_code'], 'rows' => ['name', 'contact_name', 'customer_name', 'vendor_name', 'display_name', 'company_name', 'domain', 'email', 'description', 'code', 'type', 'status', 'vendor', 'account'],
'class' => 'fas fa-sort-alpha', 'class' => 'fas fa-sort-alpha',
], ],
'amount' => [ 'amount' => [

View File

@ -146,7 +146,7 @@ return [
'columns' => [ 'columns' => [
'bill_number' => ['searchable' => true], 'bill_number' => ['searchable' => true],
'order_number' => ['searchable' => true], 'order_number' => ['searchable' => true],
'bill_status_code', 'status',
'billed_at' => ['date' => true], 'billed_at' => ['date' => true],
'due_at' => ['date' => true], 'due_at' => ['date' => true],
'amount', 'amount',
@ -166,7 +166,7 @@ return [
'columns' => [ 'columns' => [
'invoice_number' => ['searchable' => true], 'invoice_number' => ['searchable' => true],
'order_number' => ['searchable' => true], 'order_number' => ['searchable' => true],
'invoice_status_code', 'status',
'invoiced_at' => ['date' => true], 'invoiced_at' => ['date' => true],
'due_at' => ['date' => true], 'due_at' => ['date' => true],
'amount', 'amount',

View File

@ -556,7 +556,6 @@ class CoreV1 extends Migration
Schema::drop('bill_histories'); Schema::drop('bill_histories');
Schema::drop('bill_items'); Schema::drop('bill_items');
Schema::drop('bill_item_taxes'); Schema::drop('bill_item_taxes');
Schema::drop('bill_statuses');
Schema::drop('bill_totals'); Schema::drop('bill_totals');
Schema::drop('categories'); Schema::drop('categories');
Schema::drop('companies'); Schema::drop('companies');
@ -565,7 +564,6 @@ class CoreV1 extends Migration
Schema::drop('invoice_histories'); Schema::drop('invoice_histories');
Schema::drop('invoice_items'); Schema::drop('invoice_items');
Schema::drop('invoice_item_taxes'); Schema::drop('invoice_item_taxes');
Schema::drop('invoice_statuses');
Schema::drop('invoice_totals'); Schema::drop('invoice_totals');
Schema::drop('items'); Schema::drop('items');
Schema::drop('jobs'); Schema::drop('jobs');

View File

@ -41,6 +41,7 @@ class CoreV200 extends Migration
}); });
$rename_bills = [ $rename_bills = [
'bill_status_code' => 'status',
'vendor_id' => 'contact_id', 'vendor_id' => 'contact_id',
'vendor_name' => 'contact_name', 'vendor_name' => 'contact_name',
'vendor_email' => 'contact_email', 'vendor_email' => 'contact_email',
@ -55,7 +56,14 @@ class CoreV200 extends Migration
}); });
} }
Schema::table('bill_histories', function (Blueprint $table) {
$table->renameColumn('status_code', 'status');
});
Schema::drop('bill_statuses');
$rename_invoices = [ $rename_invoices = [
'invoice_status_code' => 'status',
'customer_id' => 'contact_id', 'customer_id' => 'contact_id',
'customer_name' => 'contact_name', 'customer_name' => 'contact_name',
'customer_email' => 'contact_email', 'customer_email' => 'contact_email',
@ -70,6 +78,12 @@ class CoreV200 extends Migration
}); });
} }
Schema::table('invoice_histories', function (Blueprint $table) {
$table->renameColumn('status_code', 'status');
});
Schema::drop('invoice_statuses');
// Dashboards // Dashboards
Schema::create('dashboards', function (Blueprint $table) { Schema::create('dashboards', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -129,7 +143,7 @@ class CoreV200 extends Migration
$table->boolean('blocked')->default(1); $table->boolean('blocked')->default(1);
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->index('ip'); $table->index('ip');
$table->unique(['ip', 'deleted_at']); $table->unique(['ip', 'deleted_at']);
}); });
@ -145,7 +159,7 @@ class CoreV200 extends Migration
$table->text('request')->nullable(); $table->text('request')->nullable();
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->index('ip'); $table->index('ip');
}); });

View File

@ -1,56 +0,0 @@
<?php
namespace Database\Seeds;
use App\Abstracts\Model;
use App\Models\Purchase\BillStatus;
use Illuminate\Database\Seeder;
class BillStatuses extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->create();
Model::reguard();
}
private function create()
{
$company_id = $this->command->argument('company');
$rows = [
[
'company_id' => $company_id,
'name' => trans('bills.status.draft'),
'code' => 'draft',
],
[
'company_id' => $company_id,
'name' => trans('bills.status.received'),
'code' => 'received',
],
[
'company_id' => $company_id,
'name' => trans('bills.status.partial'),
'code' => 'partial',
],
[
'company_id' => $company_id,
'name' => trans('bills.status.paid'),
'code' => 'paid',
],
];
foreach ($rows as $row) {
BillStatus::create($row);
}
}
}

View File

@ -12,11 +12,9 @@ class CompanySeeder extends Seeder
public function run() public function run()
{ {
$this->call(Database\Seeds\Accounts::class); $this->call(Database\Seeds\Accounts::class);
$this->call(Database\Seeds\BillStatuses::class);
$this->call(Database\Seeds\Categories::class); $this->call(Database\Seeds\Categories::class);
$this->call(Database\Seeds\Currencies::class); $this->call(Database\Seeds\Currencies::class);
$this->call(Database\Seeds\EmailTemplates::class); $this->call(Database\Seeds\EmailTemplates::class);
$this->call(Database\Seeds\InvoiceStatuses::class);
$this->call(Database\Seeds\Modules::class); $this->call(Database\Seeds\Modules::class);
$this->call(Database\Seeds\Reports::class); $this->call(Database\Seeds\Reports::class);
$this->call(Database\Seeds\Settings::class); $this->call(Database\Seeds\Settings::class);

View File

@ -1,66 +0,0 @@
<?php
namespace Database\Seeds;
use App\Abstracts\Model;
use App\Models\Sale\InvoiceStatus;
use Illuminate\Database\Seeder;
class InvoiceStatuses extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->create();
Model::reguard();
}
private function create()
{
$company_id = $this->command->argument('company');
$rows = [
[
'company_id' => $company_id,
'name' => trans('invoices.status.draft'),
'code' => 'draft',
],
[
'company_id' => $company_id,
'name' => trans('invoices.status.sent'),
'code' => 'sent',
],
[
'company_id' => $company_id,
'name' => trans('invoices.status.viewed'),
'code' => 'viewed',
],
[
'company_id' => $company_id,
'name' => trans('invoices.status.approved'),
'code' => 'approved',
],
[
'company_id' => $company_id,
'name' => trans('invoices.status.partial'),
'code' => 'partial',
],
[
'company_id' => $company_id,
'name' => trans('invoices.status.paid'),
'code' => 'paid',
],
];
foreach ($rows as $row) {
InvoiceStatus::create($row);
}
}
}

View File

@ -35,11 +35,13 @@ return [
'receive_bill' => 'Receive Bill', 'receive_bill' => 'Receive Bill',
'make_payment' => 'Make Payment', 'make_payment' => 'Make Payment',
'status' => [ 'statuses' => [
'draft' => 'Draft', 'draft' => 'Draft',
'received' => 'Received', 'received' => 'Received',
'partial' => 'Partial', 'partial' => 'Partial',
'paid' => 'Paid', 'paid' => 'Paid',
'overdue' => 'Overdue',
'unpaid' => 'Unpaid',
], ],
'messages' => [ 'messages' => [

View File

@ -37,13 +37,15 @@ return [
'get_paid' => 'Get Paid', 'get_paid' => 'Get Paid',
'accept_payments' => 'Accept Online Payments', 'accept_payments' => 'Accept Online Payments',
'status' => [ 'statuses' => [
'draft' => 'Draft', 'draft' => 'Draft',
'sent' => 'Sent', 'sent' => 'Sent',
'viewed' => 'Viewed', 'viewed' => 'Viewed',
'approved' => 'Approved', 'approved' => 'Approved',
'partial' => 'Partial', 'partial' => 'Partial',
'paid' => 'Paid', 'paid' => 'Paid',
'overdue' => 'Overdue',
'unpaid' => 'Unpaid',
], ],
'messages' => [ 'messages' => [

View File

@ -37,7 +37,7 @@
<th class="col-xs-4 col-sm-3 col-md-3 col-lg-3">@sortablelink('account_id', trans_choice('general.accounts', 1))</th> <th class="col-xs-4 col-sm-3 col-md-3 col-lg-3">@sortablelink('account_id', trans_choice('general.accounts', 1))</th>
<th class="col-lg-2 d-none d-lg-block">{{ trans('general.period') }}</th> <th class="col-lg-2 d-none d-lg-block">{{ trans('general.period') }}</th>
<th class="col-md-2 col-lg-2 d-none d-md-block text-right">@sortablelink('closing_balance', trans('reconciliations.closing_balance'))</th> <th class="col-md-2 col-lg-2 d-none d-md-block text-right">@sortablelink('closing_balance', trans('reconciliations.closing_balance'))</th>
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-1">@sortablelink('invoice_status_code', trans_choice('general.statuses', 1))</th> <th class="col-xs-4 col-sm-2 col-md-2 col-lg-1">@sortablelink('status', trans_choice('general.statuses', 1))</th>
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 text-center">{{ trans('general.actions') }}</th> <th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 text-center">{{ trans('general.actions') }}</th>
</tr> </tr>
</thead> </thead>

View File

@ -30,7 +30,7 @@
<th class="col-xs-4 col-sm-2 col-md-2 text-right">@sortablelink('amount', trans('general.amount'))</th> <th class="col-xs-4 col-sm-2 col-md-2 text-right">@sortablelink('amount', trans('general.amount'))</th>
<th class="col-sm-3 col-md-3 d-none d-sm-block">@sortablelink('invoiced_at', trans('invoices.invoice_date'))</th> <th class="col-sm-3 col-md-3 d-none d-sm-block">@sortablelink('invoiced_at', trans('invoices.invoice_date'))</th>
<th class="col-md-2 d-none d-md-block">@sortablelink('due_at', trans('invoices.due_date'))</th> <th class="col-md-2 d-none d-md-block">@sortablelink('due_at', trans('invoices.due_date'))</th>
<th class="col-xs-4 col-sm-3 col-md-2 text-center">@sortablelink('status.name', trans_choice('general.statuses', 1))</th> <th class="col-xs-4 col-sm-3 col-md-2 text-center">@sortablelink('status', trans_choice('general.statuses', 1))</th>
</tr> </tr>
</thead> </thead>
@ -41,7 +41,7 @@
<td class="col-xs-4 col-sm-2 col-md-2 text-right">@money($item->amount, $item->currency_code, true)</td> <td class="col-xs-4 col-sm-2 col-md-2 text-right">@money($item->amount, $item->currency_code, true)</td>
<td class="col-sm-3 col-md-3 d-none d-sm-block">@date($item->invoiced_at)</td> <td class="col-sm-3 col-md-3 d-none d-sm-block">@date($item->invoiced_at)</td>
<td class="col-md-2 d-none d-md-block">@date($item->due_at)</td> <td class="col-md-2 d-none d-md-block">@date($item->due_at)</td>
<td class="col-xs-4 col-sm-3 col-md-2 text-center"><span class="badge badge-pill badge-{{ $item->status->label }}">{{ trans('invoices.status.' . $item->status->code) }}</span></td> <td class="col-xs-4 col-sm-3 col-md-2 text-center"><span class="badge badge-pill badge-{{ $item->status_label }}">{{ trans('invoices.statuses.' . $item->status) }}</span></td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@ -6,8 +6,8 @@
@stack('invoice_start') @stack('invoice_start')
<div class="card"> <div class="card">
@stack('invoice_status_start') @stack('invoice_status_start')
<div class="card-header status-{{ $invoice->status->label }}"> <div class="card-header status-{{ $invoice->status_label }}">
<h3 class="text-white mb-0 float-right">{{ trans('invoices.status.' . $invoice->status->code) }}</h3> <h3 class="text-white mb-0 float-right">{{ trans('invoices.statuses.' . $invoice->status) }}</h3>
</div> </div>
@stack('invoice_status_end') @stack('invoice_status_end')
@ -278,7 +278,7 @@
@stack('button_pdf_end') @stack('button_pdf_end')
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
@if($invoice->invoice_status_code != 'paid') @if($invoice->status != 'paid')
@if ($payment_methods) @if ($payment_methods)
{!! Form::open([ {!! Form::open([
'id' => 'invoice-payment', 'id' => 'invoice-payment',

View File

@ -8,8 +8,8 @@
@section('content') @section('content')
<div class="card"> <div class="card">
<div class="card-header status-{{ $invoice->status->label }}"> <div class="card-header status-{{ $invoice->status_label }}">
<h3 class="text-white mb-0 float-right pr-4">{{ trans('invoices.status.' . $invoice->status->code) }}</h3> <h3 class="text-white mb-0 float-right pr-4">{{ trans('invoices.statuses.' . $invoice->status) }}</h3>
</div> </div>
<div class="card-body"> <div class="card-body">
@ -214,7 +214,7 @@
<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->invoice_status_code != 'paid') @if($invoice->status != 'paid')
@if ($payment_methods) @if ($payment_methods)
{!! Form::open([ {!! Form::open([
'id' => 'invoice-payment', 'id' => 'invoice-payment',

View File

@ -172,7 +172,7 @@
{{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }} {{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }}
{{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }} {{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }}
{{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }} {{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }}
{{ Form::hidden('bill_status_code', old('bill_status_code', 'draft'), ['id' => 'bill_status_code', 'v-model' => 'form.bill_status_code']) }} {{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }} {{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
</div> </div>
</div> </div>

View File

@ -173,7 +173,7 @@
{{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }} {{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }}
{{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }} {{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }}
{{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }} {{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }}
{{ Form::hidden('bill_status_code', old('bill_status_code', 'draft'), ['id' => 'bill_status_code', 'v-model' => 'form.bill_status_code']) }} {{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }} {{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
</div> </div>
</div> </div>

View File

@ -41,7 +41,7 @@
<th class="col-md-2 col-lg-2 col-xl-2 d-none d-md-block text-right">@sortablelink('amount', trans('general.amount'))</th> <th class="col-md-2 col-lg-2 col-xl-2 d-none d-md-block text-right">@sortablelink('amount', trans('general.amount'))</th>
<th class="col-lg-2 col-xl-2 d-none d-lg-block">@sortablelink('billed_at', trans('bills.bill_date'))</th> <th class="col-lg-2 col-xl-2 d-none d-lg-block">@sortablelink('billed_at', trans('bills.bill_date'))</th>
<th class="col-lg-2 col-xl-2 d-none d-lg-block">@sortablelink('due_at', trans('bills.due_date'))</th> <th class="col-lg-2 col-xl-2 d-none d-lg-block">@sortablelink('due_at', trans('bills.due_date'))</th>
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1">@sortablelink('bill_status_code', trans_choice('general.statuses', 1))</th> <th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1">@sortablelink('status', trans_choice('general.statuses', 1))</th>
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">{{ trans('general.actions') }}</th> <th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">{{ trans('general.actions') }}</th>
</tr> </tr>
</thead> </thead>
@ -57,7 +57,7 @@
<td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->billed_at)</td> <td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->billed_at)</td>
<td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->due_at)</td> <td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->due_at)</td>
<td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1"> <td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1">
<span class="badge badge-pill badge-{{ $item->status->label }}">{{ trans('bills.status.' . $item->status->code) }}</span> <span class="badge badge-pill badge-{{ $item->status_label }}">{{ trans('bills.statuses.' . $item->status) }}</span>
</td> </td>
<td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center"> <td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">
<div class="dropdown"> <div class="dropdown">

View File

@ -22,7 +22,7 @@
@stack('recurring_message_end') @stack('recurring_message_end')
@stack('status_message_start') @stack('status_message_start')
@if ($bill->status->code == 'draft') @if ($bill->status == 'draft')
<div class="row"> <div class="row">
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12"> <div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="alert alert-warning fade show" role="alert"> <div class="alert alert-warning fade show" role="alert">
@ -38,7 +38,7 @@
@stack('status_message_end') @stack('status_message_end')
@stack('timeline_start') @stack('timeline_start')
@if ($bill->status->code != 'paid') @if ($bill->status != 'paid')
@stack('timeline_body_start') @stack('timeline_body_start')
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
@ -82,7 +82,7 @@
@stack('timeline_body_receive_bill_head_end') @stack('timeline_body_receive_bill_head_end')
@stack('timeline_body_receive_bill_body_start') @stack('timeline_body_receive_bill_body_start')
@if ($bill->status->code == 'draft') @if ($bill->status == 'draft')
@stack('timeline_body_receive_bill_body_message_start') @stack('timeline_body_receive_bill_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small> <small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('bills.messages.status.receive.draft') }}</small> <small>{{ trans('bills.messages.status.receive.draft') }}</small>
@ -119,7 +119,7 @@
@stack('timeline_body_make_payment_body_start') @stack('timeline_body_make_payment_body_start')
@stack('timeline_body_get_paid_body_message_start') @stack('timeline_body_get_paid_body_message_start')
@if($bill->status->code != 'paid' && empty($bill->transactions->count())) @if($bill->status != 'paid' && empty($bill->transactions->count()))
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small> <small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('bills.messages.status.paid.await') }}</small> <small>{{ trans('bills.messages.status.paid.await') }}</small>
@else @else
@ -149,8 +149,8 @@
@stack('bill_start') @stack('bill_start')
<div class="card"> <div class="card">
@stack('bill_status_start') @stack('bill_status_start')
<div class="card-header status-{{ $bill->status->label }}"> <div class="card-header status-{{ $bill->status_label }}">
<h3 class="text-white mb-0 float-right">{{ trans('bills.status.' . $bill->status->code) }}</h3> <h3 class="text-white mb-0 float-right">{{ trans('bills.statuses.' . $bill->status) }}</h3>
</div> </div>
@stack('bill_status_end') @stack('bill_status_end')
@ -430,12 +430,12 @@
<button type="button" class="btn btn-primary header-button-top" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-up"></i>&nbsp; {{ 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>&nbsp; {{ trans('general.more_actions') }}</button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
@stack('button_pay_start') @stack('button_pay_start')
@if($bill->status->code != 'paid') @if($bill->status != 'paid')
@if(empty($bill->paid) || ($bill->paid != $bill->amount)) @if(empty($bill->paid) || ($bill->paid != $bill->amount))
<a class="dropdown-item" href="#" id="button-payment">{{ trans('bills.add_payment') }}</a> <a class="dropdown-item" href="#" id="button-payment">{{ trans('bills.add_payment') }}</a>
@endif @endif
@permission('update-purchases-bills') @permission('update-purchases-bills')
@if($bill->bill_status_code == 'draft') @if($bill->status == 'draft')
<a class="dropdown-item" href="{{ route('bills.received', $bill->id) }}">{{ trans('bills.mark_received') }}</a></a> <a class="dropdown-item" href="{{ route('bills.received', $bill->id) }}">{{ trans('bills.mark_received') }}</a></a>
@else @else
<button type="button" class="dropdown-item" disabled="disabled">{{ trans('bills.mark_received') }}</button> <button type="button" class="dropdown-item" disabled="disabled">{{ trans('bills.mark_received') }}</button>
@ -493,7 +493,7 @@
@foreach($bill->histories as $history) @foreach($bill->histories as $history)
<tr class="row align-items-center"> <tr class="row align-items-center">
<td class="col-xs-4 col-sm-4">@date($history->created_at)</td> <td class="col-xs-4 col-sm-4">@date($history->created_at)</td>
<td class="col-xs-4 col-sm-4 text-center">{{ $history->status->name }}</td> <td class="col-xs-4 col-sm-4 text-center">{{ trans('bills.statuses.' . $history->status) }}</td>
<td class="col-xs-4 col-sm-4 text-left long-texts">{{ $history->description }}</td> <td class="col-xs-4 col-sm-4 text-left long-texts">{{ $history->description }}</td>
</tr> </tr>
@endforeach @endforeach

View File

@ -160,7 +160,7 @@
<td class="col-xs-4 col-sm-3">@money($item->amount, $item->currency_code, true)</td> <td class="col-xs-4 col-sm-3">@money($item->amount, $item->currency_code, true)</td>
<td class="col-sm-2 d-none d-sm-none">@date($item->billed_at)</td> <td class="col-sm-2 d-none d-sm-none">@date($item->billed_at)</td>
<td class="col-sm-2 d-none d-sm-none">@date($item->due_at)</td> <td class="col-sm-2 d-none d-sm-none">@date($item->due_at)</td>
<td class="col-xs-4 col-sm-2"><span class="badge badge-pill badge-{{ $item->status->label }}">{{ trans('bills.status.' . $item->status->code) }}</span></td> <td class="col-xs-4 col-sm-2"><span class="badge badge-pill badge-{{ $item->status_label }}">{{ trans('bills.statuses.' . $item->status) }}</span></td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@ -155,7 +155,7 @@
<td class="col-xs-4 col-sm-3">@money($item->amount, $item->currency_code, true)</td> <td class="col-xs-4 col-sm-3">@money($item->amount, $item->currency_code, true)</td>
<td class="col-sm-2 d-none d-sm-block">@date($item->invoiced_at)</td> <td class="col-sm-2 d-none d-sm-block">@date($item->invoiced_at)</td>
<td class="col-sm-2 d-none d-sm-block">@date($item->due_at)</td> <td class="col-sm-2 d-none d-sm-block">@date($item->due_at)</td>
<td class="col-xs-4 col-sm-2"><span class="badge badge-pill badge-{{ $item->status->label }}">{{ trans('invoices.status.' . $item->status->code) }}</span></td> <td class="col-xs-4 col-sm-2"><span class="badge badge-pill badge-{{ $item->status_label }}">{{ trans('invoices.statuses.' . $item->status) }}</span></td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@ -174,7 +174,7 @@
{{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }} {{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }}
{{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }} {{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }}
{{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }} {{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }}
{{ Form::hidden('invoice_status_code', old('invoice_status_code', 'draft'), ['id' => 'invoice_status_code', 'v-model' => 'form.invoice_status_code']) }} {{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }} {{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
</div> </div>
</div> </div>

View File

@ -175,7 +175,7 @@
{{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }} {{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }}
{{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }} {{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }}
{{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }} {{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }}
{{ Form::hidden('invoice_status_code', old('invoice_status_code', 'draft'), ['id' => 'invoice_status_code', 'v-model' => 'form.invoice_status_code']) }} {{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }} {{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
</div> </div>
</div> </div>

View File

@ -41,7 +41,7 @@
<th class="col-xs-4 col-sm-4 col-md-3 col-lg-1 col-xl-1 text-right">@sortablelink('amount', trans('general.amount'))</th> <th class="col-xs-4 col-sm-4 col-md-3 col-lg-1 col-xl-1 text-right">@sortablelink('amount', trans('general.amount'))</th>
<th class="col-lg-2 col-xl-2 d-none d-lg-block">@sortablelink('invoiced_at', trans('invoices.invoice_date'))</th> <th class="col-lg-2 col-xl-2 d-none d-lg-block">@sortablelink('invoiced_at', trans('invoices.invoice_date'))</th>
<th class="col-lg-2 col-xl-2 d-none d-lg-block">@sortablelink('due_at', trans('invoices.due_date'))</th> <th class="col-lg-2 col-xl-2 d-none d-lg-block">@sortablelink('due_at', trans('invoices.due_date'))</th>
<th class="col-lg-1 col-xl-1 d-none d-lg-block">@sortablelink('invoice_status_code', trans_choice('general.statuses', 1))</th> <th class="col-lg-1 col-xl-1 d-none d-lg-block">@sortablelink('status', trans_choice('general.statuses', 1))</th>
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center"><a>{{ trans('general.actions') }}</a></th> <th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center"><a>{{ trans('general.actions') }}</a></th>
</tr> </tr>
</thead> </thead>
@ -57,7 +57,7 @@
<td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->invoiced_at)</td> <td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->invoiced_at)</td>
<td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->due_at)</td> <td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->due_at)</td>
<td class="col-lg-1 col-xl-1 d-none d-lg-block"> <td class="col-lg-1 col-xl-1 d-none d-lg-block">
<span class="badge badge-pill badge-{{ $item->status->label }}">{{ trans('invoices.status.' . $item->status->code) }}</span> <span class="badge badge-pill badge-{{ $item->status_label }}">{{ trans('invoices.statuses.' . $item->status) }}</span>
</td> </td>
<td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center"> <td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">
<div class="dropdown"> <div class="dropdown">

View File

@ -22,7 +22,7 @@
@stack('recurring_message_end') @stack('recurring_message_end')
@stack('status_message_start') @stack('status_message_start')
@if ($invoice->status->code == 'draft') @if ($invoice->status == 'draft')
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="alert alert-warning fade show" role="alert"> <div class="alert alert-warning fade show" role="alert">
@ -38,7 +38,7 @@
@stack('status_message_end') @stack('status_message_end')
@stack('timeline_start') @stack('timeline_start')
@if ($invoice->status->code != 'paid') @if ($invoice->status != 'paid')
@stack('timeline_body_start') @stack('timeline_body_start')
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
@ -82,7 +82,7 @@
@stack('timeline_body_send_invoice_head_end') @stack('timeline_body_send_invoice_head_end')
@stack('timeline_body_send_invoice_body_start') @stack('timeline_body_send_invoice_body_start')
@if ($invoice->status->code != 'sent' && $invoice->status->code != 'partial' && $invoice->status->code != 'viewed') @if ($invoice->status != 'sent' && $invoice->status != 'partial' && $invoice->status != 'viewed')
@stack('timeline_body_send_invoice_body_message_start') @stack('timeline_body_send_invoice_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small> <small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.send.draft') }}</small> <small>{{ trans('invoices.messages.status.send.draft') }}</small>
@ -91,7 +91,7 @@
<div class="mt-3"> <div class="mt-3">
@stack('timeline_body_send_invoice_body_button_sent_start') @stack('timeline_body_send_invoice_body_button_sent_start')
@permission('update-sales-invoices') @permission('update-sales-invoices')
@if($invoice->invoice_status_code == 'draft') @if($invoice->status == 'draft')
<a href="{{ url('sales/invoices/' . $invoice->id . '/sent') }}" class="btn btn-white btn-sm header-button-top">{{ trans('invoices.mark_sent') }}</a> <a href="{{ url('sales/invoices/' . $invoice->id . '/sent') }}" class="btn btn-white btn-sm header-button-top">{{ trans('invoices.mark_sent') }}</a>
@else @else
<button type="button" class="btn btn-secondary btn-sm header-button-top" disabled="disabled"> <button type="button" class="btn btn-secondary btn-sm header-button-top" disabled="disabled">
@ -111,7 +111,7 @@
@endif @endif
@stack('timeline_body_send_invoice_body_button_email_end') @stack('timeline_body_send_invoice_body_button_email_end')
</div> </div>
@elseif($invoice->status->code == 'viewed') @elseif($invoice->status == 'viewed')
@stack('timeline_body_viewed_invoice_body_message_start') @stack('timeline_body_viewed_invoice_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small> <small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.viewed') }}</small> <small>{{ trans('invoices.messages.status.viewed') }}</small>
@ -140,7 +140,7 @@
@stack('timeline_body_get_paid_body_start') @stack('timeline_body_get_paid_body_start')
@stack('timeline_body_get_paid_body_message_start') @stack('timeline_body_get_paid_body_message_start')
@if($invoice->status->code != 'paid' && empty($invoice->transactions->count())) @if($invoice->status != 'paid' && empty($invoice->transactions->count()))
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small> <small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.paid.await') }}</small> <small>{{ trans('invoices.messages.status.paid.await') }}</small>
@else @else
@ -176,8 +176,8 @@
@stack('invoice_start') @stack('invoice_start')
<div class="card"> <div class="card">
@stack('invoice_status_start') @stack('invoice_status_start')
<div class="card-header status-{{ $invoice->status->label }}"> <div class="card-header status-{{ $invoice->status_label }}">
<h3 class="text-white mb-0 float-right">{{ trans('invoices.status.' . $invoice->status->code) }}</h3> <h3 class="text-white mb-0 float-right">{{ trans('invoices.statuses.' . $invoice->status) }}</h3>
</div> </div>
@stack('invoice_status_end') @stack('invoice_status_end')
@ -459,7 +459,7 @@
<button type="button" class="btn btn-primary header-button-top" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-up"></i>&nbsp; {{ 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>&nbsp; {{ trans('general.more_actions') }}</button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
@stack('button_pay_start') @stack('button_pay_start')
@if($invoice->status->code != 'paid') @if($invoice->status != 'paid')
@permission('update-sales-invoices') @permission('update-sales-invoices')
<a class="dropdown-item" href="{{ url('sales/invoices/' . $invoice->id . '/pay') }}">{{ trans('invoices.mark_paid') }}</a> <a class="dropdown-item" href="{{ url('sales/invoices/' . $invoice->id . '/pay') }}">{{ trans('invoices.mark_paid') }}</a>
@endpermission @endpermission
@ -473,7 +473,7 @@
@stack('button_sent_start') @stack('button_sent_start')
@permission('update-sales-invoices') @permission('update-sales-invoices')
@if($invoice->invoice_status_code == 'draft') @if($invoice->status == 'draft')
<a class="dropdown-item" href="{{ url('sales/invoices/' . $invoice->id . '/sent') }}">{{ trans('invoices.mark_sent') }}</a> <a class="dropdown-item" href="{{ url('sales/invoices/' . $invoice->id . '/sent') }}">{{ 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"><span class="text-disabled">{{ trans('invoices.mark_sent') }}</span></button>
@ -539,7 +539,7 @@
@foreach($invoice->histories as $history) @foreach($invoice->histories as $history)
<tr class="row align-items-center"> <tr class="row align-items-center">
<td class="col-xs-4 col-sm-4">@date($history->created_at)</td> <td class="col-xs-4 col-sm-4">@date($history->created_at)</td>
<td class="col-xs-4 col-sm-4 text-center">{{ $history->status->name }}</td> <td class="col-xs-4 col-sm-4 text-center">{{ trans('invoices.statuses.' . $history->status) }}</td>
<td class="col-xs-4 col-sm-4 text-left long-texts">{{ $history->description }}</td> <td class="col-xs-4 col-sm-4 text-left long-texts">{{ $history->description }}</td>
</tr> </tr>
@endforeach @endforeach

View File

@ -68,7 +68,7 @@ class BillReminderTest extends FeatureTestCase
'contact_tax_number' => null, 'contact_tax_number' => null,
'contact_phone' => null, 'contact_phone' => null,
'contact_address' => $this->faker->address, 'contact_address' => $this->faker->address,
'bill_status_code' => 'received', 'status' => 'received',
'amount' => $amount, 'amount' => $amount,
]; ];

View File

@ -68,7 +68,7 @@ class InvoiceReminderTest extends FeatureTestCase
'contact_tax_number' => null, 'contact_tax_number' => null,
'contact_phone' => null, 'contact_phone' => null,
'contact_address' => $this->faker->address, 'contact_address' => $this->faker->address,
'invoice_status_code' => 'sent', 'status' => 'sent',
'amount' => $amount, 'amount' => $amount,
]; ];

View File

@ -103,7 +103,7 @@ class BillsTest extends FeatureTestCase
'contact_tax_number' => null, 'contact_tax_number' => null,
'contact_phone' => null, 'contact_phone' => null,
'contact_address' => $this->faker->address, 'contact_address' => $this->faker->address,
'bill_status_code' => 'draft', 'status' => 'draft',
'amount' => $amount, 'amount' => $amount,
]; ];

View File

@ -103,7 +103,7 @@ class InvoicesTest extends FeatureTestCase
'contact_tax_number' => null, 'contact_tax_number' => null,
'contact_phone' => null, 'contact_phone' => null,
'contact_address' => $this->faker->address, 'contact_address' => $this->faker->address,
'invoice_status_code' => 'draft', 'status' => 'draft',
'amount' => $amount, 'amount' => $amount,
]; ];