mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:57:33 -05:00 
			
		
		
		
	Flash message
This commit is contained in:
		
							parent
							
								
									091673a7ac
								
							
						
					
					
						commit
						accbbcf67b
					
				@ -120,9 +120,14 @@ class InvoiceController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $total = $invoices->sum('balance');     
 | 
					        $total = $invoices->sum('balance');     
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $invoices->filter(function ($invoice){
 | 
					        $invoices = $invoices->filter(function ($invoice){
 | 
				
			||||||
            return $invoice->isPayable();
 | 
					            return $invoice->isPayable();
 | 
				
			||||||
        })->map(function ($invoice){
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if($invoices->count() == 0)
 | 
				
			||||||
 | 
					            return back()->with(['warning' => 'No payable invoices selected']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $invoices->map(function ($invoice){
 | 
				
			||||||
            $invoice->balance = Number::formatMoney($invoice->balance, $invoice->client);
 | 
					            $invoice->balance = Number::formatMoney($invoice->balance, $invoice->client);
 | 
				
			||||||
            $invoice->due_date = $this->formatDate($invoice->due_date, $invoice->client->date_format());
 | 
					            $invoice->due_date = $this->formatDate($invoice->due_date, $invoice->client->date_format());
 | 
				
			||||||
            return $invoice;
 | 
					            return $invoice;
 | 
				
			||||||
 | 
				
			|||||||
@ -192,14 +192,25 @@ class Invoice extends BaseModel
 | 
				
			|||||||
        return strtotime($this->createClientDate(date(), $this->client->timezone()->name)) > (strtotime($due_date) + (60 * 60 * 24));
 | 
					        return strtotime($this->createClientDate(date(), $this->client->timezone()->name)) > (strtotime($due_date) + (60 * 60 * 24));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function markViewed()
 | 
					    public function markViewed() :void
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->last_viewed = Carbon::now()->format('Y-m-d H:i');
 | 
					        $this->last_viewed = Carbon::now()->format('Y-m-d H:i');
 | 
				
			||||||
 | 
					        $this->save();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public function isPayable()
 | 
					    public function isPayable() : bool
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return ($this->status === Invoice::STATUS_UNPAID || $this->status === Invoice::STATUS_OVERDUE);
 | 
					
 | 
				
			||||||
 | 
					        if($this->status_id == Invoice::STATUS_SENT && $this->due_date > Carbon::now())
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        else if($this->status_id == Invoice::STATUS_PARTIAL && $this->partial_due_date > Carbon::now())
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        else if($this->status_id == Invoice::STATUS_SENT && $this->due_date < Carbon::now())
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        else if($this->status_id == Invoice::STATUS_PARTIAL && $this->partial_due_date < Carbon::now())
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function badgeForStatus(int $status)
 | 
					    public static function badgeForStatus(int $status)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,38 +1,40 @@
 | 
				
			|||||||
@if ($message = Session::get('success'))
 | 
					<div class="justify-content-center align-items-center pd-10 pm-10">
 | 
				
			||||||
<div class="alert alert-success alert-block">
 | 
						@if ($message = Session::get('success'))
 | 
				
			||||||
	<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
						<div class="alert alert-success alert-block">
 | 
				
			||||||
        <strong>{{ $message }}</strong>
 | 
							<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
				
			||||||
 | 
						        <strong>{{ $message }}</strong>
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
						@endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@if ($message = Session::get('error'))
 | 
				
			||||||
 | 
						<div class="alert alert-danger alert-block">
 | 
				
			||||||
 | 
							<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
				
			||||||
 | 
						        <strong>{{ $message }}</strong>
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
						@endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@if ($message = Session::get('warning'))
 | 
				
			||||||
 | 
						<div class="alert alert-warning alert-block">
 | 
				
			||||||
 | 
							<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
				
			||||||
 | 
							<strong>{{ $message }}</strong>
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
						@endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@if ($message = Session::get('info'))
 | 
				
			||||||
 | 
						<div class="alert alert-info alert-block">
 | 
				
			||||||
 | 
							<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
				
			||||||
 | 
							<strong>{{ $message }}</strong>
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
						@endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@if ($errors->any())
 | 
				
			||||||
 | 
						<div class="alert alert-danger">
 | 
				
			||||||
 | 
							<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
				
			||||||
 | 
							Please check the form below for errors
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
						@endif
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@if ($message = Session::get('error'))
 | 
					 | 
				
			||||||
<div class="alert alert-danger alert-block">
 | 
					 | 
				
			||||||
	<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
					 | 
				
			||||||
        <strong>{{ $message }}</strong>
 | 
					 | 
				
			||||||
</div>
 | 
					 | 
				
			||||||
@endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@if ($message = Session::get('warning'))
 | 
					 | 
				
			||||||
<div class="alert alert-warning alert-block">
 | 
					 | 
				
			||||||
	<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
					 | 
				
			||||||
	<strong>{{ $message }}</strong>
 | 
					 | 
				
			||||||
</div>
 | 
					 | 
				
			||||||
@endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@if ($message = Session::get('info'))
 | 
					 | 
				
			||||||
<div class="alert alert-info alert-block">
 | 
					 | 
				
			||||||
	<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
					 | 
				
			||||||
	<strong>{{ $message }}</strong>
 | 
					 | 
				
			||||||
</div>
 | 
					 | 
				
			||||||
@endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@if ($errors->any())
 | 
					 | 
				
			||||||
<div class="alert alert-danger">
 | 
					 | 
				
			||||||
	<button type="button" class="close" data-dismiss="alert">×</button>	
 | 
					 | 
				
			||||||
	Please check the form below for errors
 | 
					 | 
				
			||||||
</div>
 | 
					 | 
				
			||||||
@endif
 | 
					 | 
				
			||||||
@ -21,6 +21,7 @@
 | 
				
			|||||||
{!! Former::close() !!}
 | 
					{!! Former::close() !!}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		<div class="row" style="padding-top: 30px;">
 | 
							<div class="row" style="padding-top: 30px;">
 | 
				
			||||||
 | 
					        @include('portal.default.flash-message')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			<div class="col-lg-12" style="padding-bottom: 10px;">
 | 
								<div class="col-lg-12" style="padding-bottom: 10px;">
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
 | 
				
			|||||||
@ -46,12 +46,10 @@
 | 
				
			|||||||
    .nav {min-height: calc(100% - 55px);}
 | 
					    .nav {min-height: calc(100% - 55px);}
 | 
				
			||||||
  </style>
 | 
					  </style>
 | 
				
			||||||
  @stack('css')
 | 
					  @stack('css')
 | 
				
			||||||
 | 
					  @yield('head')
 | 
				
			||||||
    @yield('head')
 | 
					 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
@include('portal.default.header')
 | 
					@include('portal.default.header')
 | 
				
			||||||
@yield('header')
 | 
					@yield('header')
 | 
				
			||||||
@include('portal.default.flash-message')
 | 
					 | 
				
			||||||
@include('portal.default.sidebar')
 | 
					@include('portal.default.sidebar')
 | 
				
			||||||
@yield('sidebar')
 | 
					@yield('sidebar')
 | 
				
			||||||
@section('body')
 | 
					@section('body')
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user