Update Syntax for L5

Also changes script.blade.php to pull the currency info from the cache in a L5 format.
This commit is contained in:
Jeramy Simpson 2015-03-26 13:48:41 +10:00
parent c6d8b6f8e1
commit 567f26a28b
3 changed files with 29 additions and 29 deletions

View File

@ -10,7 +10,7 @@
<div class="in-bold"> <div class="in-bold">
@if (count($paidToDate)) @if (count($paidToDate))
@foreach ($paidToDate as $item) @foreach ($paidToDate as $item)
{{ Utils::formatMoney($item->value, $item->currency_id); }}<br/> {{ Utils::formatMoney($item->value, $item->currency_id) }}<br/>
@endforeach @endforeach
@else @else
{{ Utils::formatMoney(0) }} {{ Utils::formatMoney(0) }}
@ -147,7 +147,7 @@
<div><b>{{ trans('texts.average_invoice') }}</b></div> <div><b>{{ trans('texts.average_invoice') }}</b></div>
<div class="in-bold in-white" style="font-size:42px"> <div class="in-bold in-white" style="font-size:42px">
@foreach ($averageInvoice as $item) @foreach ($averageInvoice as $item)
{{ Utils::formatMoney($item->invoice_avg, $item->currency_id); }}<br/> {{ Utils::formatMoney($item->invoice_avg, $item->currency_id) }}<br/>
@endforeach @endforeach
</div> </div>
</div> </div>

View File

@ -44,22 +44,22 @@
<div class="collapse navbar-collapse" id="navbar-collapse-1"> <div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav" style="font-weight: bold"> <ul class="nav navbar-nav" style="font-weight: bold">
{{ HTML::nav_link('dashboard', 'dashboard') }} {!! HTML::nav_link('dashboard', 'dashboard') !!}
{{ HTML::menu_link('client') }} {!! HTML::menu_link('client') !!}
@if (Utils::isPro()) @if (Utils::isPro())
{{ HTML::menu_link('quote') }} {!! HTML::menu_link('quote') !!}
@endif @endif
{{ HTML::menu_link('invoice') }} {!! HTML::menu_link('invoice') !!}
{{ HTML::menu_link('payment') }} {!! HTML::menu_link('payment') !!}
{{ HTML::menu_link('credit') }} {!! HTML::menu_link('credit') !!}
</ul> </ul>
<div class="navbar-form navbar-right"> <div class="navbar-form navbar-right">
@if (Auth::check()) @if (Auth::check())
@if (!Auth::user()->registered) @if (!Auth::user()->registered)
{{ Button::sm_success_primary(trans('texts.sign_up'), array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal')) }} &nbsp; {!! Button::sm_success_primary(trans('texts.sign_up'), array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal')) !!} &nbsp;
@elseif (!Auth::user()->isPro()) @elseif (!Auth::user()->isPro())
{{ Button::sm_success_primary(trans('texts.go_pro'), array('id' => 'proPlanButton', 'data-toggle'=>'modal', 'data-target'=>'#proPlanModal')) }} &nbsp; {!! Button::sm_success_primary(trans('texts.go_pro'), array('id' => 'proPlanButton', 'data-toggle'=>'modal', 'data-target'=>'#proPlanModal')) !!} &nbsp;
@endif @endif
@endif @endif
@ -151,7 +151,7 @@
<div class="container"> <div class="container">
@if (!isset($showBreadcrumbs) || $showBreadcrumbs) @if (!isset($showBreadcrumbs) || $showBreadcrumbs)
{{ HTML::breadcrumbs() }} {!! HTML::breadcrumbs() !!}
@endif @endif
@if (Session::has('warning')) @if (Session::has('warning'))
@ -180,10 +180,10 @@
<div class="footer" style="padding-top: 32px"> <div class="footer" style="padding-top: 32px">
@if (false) @if (false)
<div class="pull-right"> <div class="pull-right">
{{ Former::open('user/setTheme')->addClass('themeForm') }} {!! Former::open('user/setTheme')->addClass('themeForm') !!}
<div style="display:none"> <div style="display:none">
{{ Former::text('theme_id') }} {!! Former::text('theme_id') !!}
{{ Former::text('path')->value(Request::url()) }} {!! Former::text('path')->value(Request::url()) !!}
</div> </div>
<div class="btn-group tr-action dropup"> <div class="btn-group tr-action dropup">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
@ -196,7 +196,7 @@
@endforeach @endforeach
</ul> </ul>
</div> </div>
{{ Former::close() }} {!! Former::close() !!}
</div> </div>
@endif @endif
@ -221,25 +221,25 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
<div style="background-color: #fff; padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onclick="validateSignUp()" onkeydown="checkForEnter(event)"> <div style="background-color: #fff; padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onclick="validateSignUp()" onkeydown="checkForEnter(event)">
<br/> <br/>
{{ Former::open('signup/submit')->addClass('signUpForm') }} {!! Former::open('signup/submit')->addClass('signUpForm') !!}
@if (Auth::check()) @if (Auth::check())
{{ Former::populateField('new_first_name', Auth::user()->first_name); }} {!! Former::populateField('new_first_name', Auth::user()->first_name) !!}
{{ Former::populateField('new_last_name', Auth::user()->last_name); }} {!! Former::populateField('new_last_name', Auth::user()->last_name) !!}
{{ Former::populateField('new_email', Auth::user()->email); }} {!! Former::populateField('new_email', Auth::user()->email) !!}
@endif @endif
<div style="display:none"> <div style="display:none">
{{ Former::text('path')->value(Request::path()) }} {!! Former::text('path')->value(Request::path()) !!}
{{ Former::text('go_pro') }} {!! Former::text('go_pro') !!}
</div> </div>
{{ Former::text('new_first_name')->label(trans('texts.first_name')) }} {!! Former::text('new_first_name')->label(trans('texts.first_name')) !!}
{{ Former::text('new_last_name')->label(trans('texts.last_name')) }} {!! Former::text('new_last_name')->label(trans('texts.last_name')) !!}
{{ Former::text('new_email')->label(trans('texts.email')) }} {!! Former::text('new_email')->label(trans('texts.email')) !!}
{{ Former::password('new_password')->label(trans('texts.password')) }} {!! Former::password('new_password')->label(trans('texts.password')) !!}
{{ Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.URL::to('terms').'" target="_blank">'.trans('texts.terms_of_service').'</a>'])) }} {!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.URL::to('terms').'" target="_blank">'.trans('texts.terms_of_service').'</a>'])) !!}
{{ Former::close() }} {!! Former::close() !!}
<center><div id="errorTaken" style="display:none">&nbsp;<br/>{{ trans('texts.email_taken') }}</div></center> <center><div id="errorTaken" style="display:none">&nbsp;<br/>{{ trans('texts.email_taken') }}</div></center>
<br/> <br/>

View File

@ -1,6 +1,6 @@
<script type="text/javascript"> <script type="text/javascript">
var currencies = {{ Currency::remember(120)->get(); }}; var currencies = {{ \Cache::pull('currency') }};
var currencyMap = {}; var currencyMap = {};
for (var i=0; i<currencies.length; i++) { for (var i=0; i<currencies.length; i++) {
var currency = currencies[i]; var currency = currencies[i];
@ -18,7 +18,7 @@
} }
function formatMoney(value, currency_id, hide_symbol) { function formatMoney(value, currency_id, hide_symbol) {
value = NINJA.parseFloat(value); value = NINJA.parseFloat(value);
if (!currency_id) currency_id = {{ Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY); }}; if (!currency_id) currency_id = {{ Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY) }};
var currency = currencyMap[currency_id]; var currency = currencyMap[currency_id];
return accounting.formatMoney(value, hide_symbol ? '' : currency.symbol, currency.precision, currency.thousand_separator, currency.decimal_separator); return accounting.formatMoney(value, hide_symbol ? '' : currency.symbol, currency.precision, currency.thousand_separator, currency.decimal_separator);
} }