1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 09:04:35 +01:00
invoiceninja/app/views/header.blade.php

445 lines
16 KiB
PHP
Raw Normal View History

2013-12-07 19:45:00 +01:00
@extends('master')
2013-11-26 13:45:07 +01:00
2013-12-07 19:45:00 +01:00
2014-01-30 23:29:09 +01:00
@section('head')
2013-12-07 19:45:00 +01:00
<meta name="csrf-token" content="<?= csrf_token() ?>">
2013-11-26 13:45:07 +01:00
2014-01-05 15:03:29 +01:00
<script src="{{ asset('vendor/jquery-ui/ui/minified/jquery-ui.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/bootstrap/dist/js/bootstrap.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/datatables/media/js/jquery.dataTables.js') }}" type="text/javascript"></script>
2014-02-01 21:01:32 +01:00
<script src="{{ asset('vendor/datatables-bootstrap3/BS3/assets/js/datatables.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/knockout.js/knockout.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/knockout-mapping/build/output/knockout.mapping-latest.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/knockout-sortable/build/knockout-sortable.min.js') }}" type="text/javascript"></script>
2014-01-05 15:03:29 +01:00
<script src="{{ asset('vendor/underscore/underscore-min.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/bootstrap-datepicker/js/bootstrap-datepicker.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/typeahead.js/dist/typeahead.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/accounting/accounting.min.js') }}" type="text/javascript"></script>
2013-11-26 13:45:07 +01:00
<script src="{{ asset('js/bootstrap-combobox.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/jspdf.source.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/jspdf.plugin.split_text_to_size.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/script.js') }}" type="text/javascript"></script>
2014-02-01 21:01:32 +01:00
<link href="{{ asset('vendor/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css"/>
2014-01-05 15:03:29 +01:00
<link href="{{ asset('vendor/datatables/media/css/jquery.dataTables.css') }}" rel="stylesheet" type="text/css">
2014-02-01 21:01:32 +01:00
<link href="{{ asset('vendor/datatables-bootstrap3/BS3/assets/css/datatables.css') }}" rel="stylesheet" type="text/css">
2014-01-05 15:03:29 +01:00
<link href="{{ asset('vendor/font-awesome/css/font-awesome.min.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('vendor/bootstrap-datepicker/css/datepicker.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('css/bootstrap-combobox.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('css/typeahead.js-bootstrap.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('css/style.css') }}" rel="stylesheet" type="text/css"/>
2013-11-26 13:45:07 +01:00
<style type="text/css">
2013-12-07 19:45:00 +01:00
body {
2014-01-08 21:09:47 +01:00
/* background-color: #F6F6F6; */
background-color: #EEEEEE;
2013-12-07 19:45:00 +01:00
}
2013-12-29 18:40:11 +01:00
</style>
2013-12-09 10:38:49 +01:00
2013-12-29 18:40:11 +01:00
<script type="text/javascript">
2014-01-02 14:21:15 +01:00
2013-12-29 18:40:11 +01:00
var currencies = {{ Currency::remember(120)->get(); }};
var currencyMap = {};
for (var i=0; i<currencies.length; i++) {
var currency = currencies[i];
currencyMap[currency.id] = currency;
}
2014-02-04 08:07:16 +01:00
var NINJA = {};
NINJA.parseFloat = function(str) {
if (!str) return '';
str = (str+'').replace(/[^0-9\.\-]/g, '');
return window.parseFloat(str);
}
2013-12-29 18:40:11 +01:00
function formatMoney(value, currency_id, hide_symbol) {
2014-02-04 08:07:16 +01:00
value = NINJA.parseFloat(value);
2013-12-29 18:40:11 +01:00
if (!currency_id) currency_id = {{ Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY); }};
var currency = currencyMap[currency_id];
return accounting.formatMoney(value, hide_symbol ? '' : currency.symbol, currency.precision, currency.thousand_separator, currency.decimal_separator);
}
</script>
2013-12-07 19:45:00 +01:00
@stop
2013-12-07 19:45:00 +01:00
@section('body')
2013-12-31 10:43:39 +01:00
<p>&nbsp;</p>
<p>&nbsp;</p>
2013-12-24 07:22:16 +01:00
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
2014-01-15 15:01:24 +01:00
<div class="container">
2013-11-26 13:45:07 +01:00
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
2014-02-02 19:14:56 +01:00
<a href="{{ URL::to('/rocksteady') }}" class='navbar-brand'>Invoice Ninja</a>
2013-11-26 13:45:07 +01:00
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav" style="font-weight: bold">
2013-11-26 22:45:10 +01:00
{{-- HTML::nav_link('home', 'Home') --}}
2013-11-26 13:45:07 +01:00
{{ HTML::menu_link('client') }}
{{ HTML::menu_link('invoice') }}
{{ HTML::menu_link('payment') }}
2013-12-01 21:58:25 +01:00
{{ HTML::menu_link('credit') }}
2014-01-02 18:16:00 +01:00
{{-- HTML::nav_link('reports', 'Reports') --}}
2013-11-26 13:45:07 +01:00
</ul>
2013-12-24 07:22:16 +01:00
<div class="navbar-form navbar-right">
2014-01-06 19:03:00 +01:00
@if (Auth::check() && !Auth::user()->registered)
2014-01-30 23:29:09 +01:00
{{ Button::sm_success_primary('Sign up', array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal')) }} &nbsp;
2013-12-24 07:22:16 +01:00
@endif
2014-01-06 19:03:00 +01:00
@if (Auth::check())
2013-12-24 07:22:16 +01:00
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
2014-01-30 23:29:09 +01:00
<span id="myAccountButton">
@if (Auth::check() && Auth::user()->registered)
{{ Auth::user()->getFullName() }}
@else
My Account
@endif
</span>
2014-01-02 00:12:33 +01:00
<span class="caret"></span>
2013-12-24 07:22:16 +01:00
</button>
<ul class="dropdown-menu" role="menu">
<li>{{ link_to('account/details', 'Details') }}</li>
<li>{{ link_to('account/settings', 'Settings') }}</li>
<li>{{ link_to('account/import', 'Import') }}</li>
<li>{{ link_to('account/export', 'Export') }}</li>
<li class="divider"></li>
<li>{{ link_to('#', 'Logout', array('onclick'=>'logout()')) }}</li>
</ul>
2014-01-06 19:03:00 +01:00
</div>
@endif
2013-12-24 07:22:16 +01:00
</div>
2013-11-29 13:09:21 +01:00
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Recently Viewed <b class="caret"></b></a>
<ul class="dropdown-menu">
@if (count(Session::get(RECENTLY_VIEWED)) == 0)
<li><a href="#">No items</a></li>
@else
@foreach (Session::get(RECENTLY_VIEWED) as $link)
<li><a href="{{ $link->url }}">{{ $link->name }}</a></li>
@endforeach
@endif
</ul>
</li>
<form class="navbar-form navbar-left" role="search">
2013-11-26 13:45:07 +01:00
<div class="form-group">
<input type="text" id="search" class="form-control" placeholder="Search">
</div>
</form>
2013-11-29 13:09:21 +01:00
</ul>
2013-12-24 07:22:16 +01:00
2013-11-26 13:45:07 +01:00
</div><!-- /.navbar-collapse -->
2014-01-15 15:01:24 +01:00
</div>
2013-11-26 13:45:07 +01:00
</nav>
2014-01-15 15:01:24 +01:00
2014-01-02 18:16:00 +01:00
<p>&nbsp;</p>
2014-01-15 15:01:24 +01:00
<div class="container">
2014-02-01 21:01:32 +01:00
@if (Session::has('message'))
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif
@if (Session::has('error'))
<div class="alert alert-danger">{{ Session::get('error') }}</div>
@endif
2013-11-26 13:45:07 +01:00
@yield('content')
2013-12-03 18:32:33 +01:00
</div>
<div class="container">
2013-12-31 00:19:17 +01:00
<div class="footer" style="padding-top: 32px">
2014-01-02 18:16:00 +01:00
@if (false)
2013-12-05 16:23:24 +01:00
<div class="pull-right">
{{ Former::open('user/setTheme')->addClass('themeForm') }}
<div style="display:none">
{{ Former::text('theme_id') }}
{{ Former::text('path')->value(Request::url()) }}
</div>
<div class="btn-group tr-action dropup">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
2013-12-31 00:19:17 +01:00
Site Theme <span class="caret"></span>
2013-12-05 16:23:24 +01:00
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#" onclick="setTheme(0)">Default</a></li>
2013-12-31 00:19:17 +01:00
@foreach (Theme::remember(DEFAULT_QUERY_CACHE)->get() as $theme)
2013-12-05 16:23:24 +01:00
<li><a href="#" onclick="setTheme({{ $theme->id }})">{{ ucwords($theme->name) }}</a></li>
@endforeach
</ul>
</div>
{{ Former::close() }}
</div>
2014-01-02 18:16:00 +01:00
@endif
2013-12-05 16:23:24 +01:00
2014-01-16 22:12:46 +01:00
<!--
2014-01-09 00:22:56 +01:00
Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice-ninja', 'open source', array('target'=>'_blank')) }}, email us at {{ link_to('mailto:contact@invoiceninja.com', 'contact@invoiceninja.com') }}.
2014-01-16 22:12:46 +01:00
-->
2013-12-05 16:23:24 +01:00
</div>
2013-11-26 13:45:07 +01:00
</div>
</div>
2013-12-02 20:54:24 +01:00
2013-12-04 17:20:14 +01:00
@if (!Auth::check() || !Auth::user()->registered)
2013-12-02 20:54:24 +01:00
<div class="modal fade" id="signUpModal" tabindex="-1" role="dialog" aria-labelledby="signUpModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
2013-12-03 18:32:33 +01:00
<h4 class="modal-title" id="myModalLabel">Sign up</h4>
2013-12-02 20:54:24 +01:00
</div>
2014-01-13 20:22:43 +01:00
<div style="background-color: #EEEEEE; padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onkeydown="checkForEnter(event)">
<br/>
2014-01-01 00:50:13 +01:00
2013-12-03 18:32:33 +01:00
{{ Former::open('signup/submit')->addClass('signUpForm') }}
2014-01-01 00:50:13 +01:00
2013-12-04 17:20:14 +01:00
@if (Auth::check())
2014-01-01 00:50:13 +01:00
{{ Former::populateField('new_first_name', Auth::user()->first_name); }}
{{ Former::populateField('new_last_name', Auth::user()->last_name); }}
{{ Former::populateField('new_email', Auth::user()->email); }}
2013-12-04 17:20:14 +01:00
@endif
2014-02-03 23:56:23 +01:00
2013-12-03 18:32:33 +01:00
{{ Former::hidden('path')->value(Request::path()) }}
2014-01-01 00:50:13 +01:00
{{ Former::text('new_first_name')->label('First name') }}
{{ Former::text('new_last_name')->label('Last name') }}
2014-02-03 23:56:23 +01:00
{{ Former::text('new_email')->label('Email') }}
{{ Former::password('new_password')->label('Password') }}
{{ Former::close() }}
2013-12-03 18:32:33 +01:00
<center><div id="errorTaken" style="display:none">&nbsp;<br/>The email address is already regiestered</div></center>
2014-01-13 20:22:43 +01:00
<br/>
2013-12-02 20:54:24 +01:00
</div>
2013-12-03 18:32:33 +01:00
<div style="padding-left:40px;padding-right:40px;display:none;min-height:130px" id="working">
<h3>Working...</h3>
<div class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>
2014-01-30 23:29:09 +01:00
</div>
</div>
<div style="background-color: #EEEEEE; padding-right:20px;padding-left:20px; display:none" id="signUpSuccessDiv">
<br/>
<h3>Success</h3>
You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.
<br/>&nbsp;
</div>
2013-12-03 18:32:33 +01:00
2014-01-13 20:22:43 +01:00
<div class="modal-footer" id="signUpFooter" style="margin-top: 0px">
2013-12-02 20:54:24 +01:00
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
2014-01-30 23:29:09 +01:00
<button type="button" class="btn btn-primary" id="saveSignUpButton" onclick="validateServerSignUp()">Save</button>
2013-12-02 20:54:24 +01:00
</div>
</div>
</div>
</div>
2013-12-03 23:00:01 +01:00
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="logoutModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Logout</h4>
</div>
<div class="container">
<h3>Are you sure?</h3>
2014-01-02 18:16:00 +01:00
<p>This will permanently erase your data.</p>
2013-12-03 23:00:01 +01:00
</div>
<div class="modal-footer" id="signUpFooter">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" onclick="logout(true)">Logout</button>
</div>
</div>
</div>
</div>
2013-12-02 20:54:24 +01:00
@endif
2013-11-26 13:45:07 +01:00
</body>
2014-01-05 15:03:29 +01:00
2013-11-26 13:45:07 +01:00
<script type="text/javascript">
2013-12-05 16:23:24 +01:00
function setTheme(id)
{
$('#theme_id').val(id);
$('form.themeForm').submit();
}
2013-12-04 17:20:14 +01:00
@if (!Auth::check() || !Auth::user()->registered)
2013-12-02 20:54:24 +01:00
function validateSignUp(showError)
{
2013-12-03 18:32:33 +01:00
var isFormValid = true;
2013-12-02 20:54:24 +01:00
$(['first_name','last_name','email','password']).each(function(i, field) {
2014-01-01 00:50:13 +01:00
var $input = $('form.signUpForm #new_'+field),
2013-12-02 20:54:24 +01:00
val = $.trim($input.val());
2013-12-03 18:32:33 +01:00
var isValid = val && val.length >= (field == 'password' ? 6 : 1);
2013-12-02 20:54:24 +01:00
if (isValid && field == 'email') {
isValid = isValidEmailAddress(val);
}
if (isValid) {
2013-12-03 18:32:33 +01:00
$input.closest('div.form-group').removeClass('has-error').addClass('has-success');
2013-12-02 20:54:24 +01:00
} else {
2013-12-03 18:32:33 +01:00
isFormValid = false;
2013-12-02 20:54:24 +01:00
$input.closest('div.form-group').removeClass('has-success');
if (showError) {
$input.closest('div.form-group').addClass('has-error');
}
}
});
2013-12-03 18:32:33 +01:00
return isFormValid;
2013-12-02 20:54:24 +01:00
}
2014-01-30 23:29:09 +01:00
function validateServerSignUp()
2013-12-02 20:54:24 +01:00
{
if (!validateSignUp(true)) {
return;
}
2013-12-03 18:32:33 +01:00
$('#signUpDiv, #signUpFooter').hide();
$('#working').show();
2014-01-30 23:29:09 +01:00
$.ajax({
type: 'POST',
url: '{{ URL::to('signup/validate') }}',
data: 'email=' + $('form.signUpForm #new_email').val(),
success: function(result) {
if (result == 'available') {
submitSignUp();
} else {
$('#errorTaken').show();
$('form.signUpForm #new_email').closest('div.form-group').removeClass('has-success').addClass('has-error');
$('#signUpDiv, #signUpFooter').show();
$('#working').hide();
}
}
});
2013-12-02 20:54:24 +01:00
}
2014-01-30 23:29:09 +01:00
function submitSignUp() {
$.ajax({
type: 'POST',
url: '{{ URL::to('signup/submit') }}',
data: 'new_email=' + $('form.signUpForm #new_email').val() +
'&new_password=' + $('form.signUpForm #new_password').val() +
'&new_first_name=' + $('form.signUpForm #new_first_name').val() +
'&new_last_name=' + $('form.signUpForm #new_last_name').val(),
success: function(result) {
if (result) {
localStorage.setItem('guest_key', '');
isRegistered = true;
$('#signUpButton').hide();
$('#myAccountButton').html(result);
}
$('#signUpSuccessDiv, #signUpFooter').show();
$('#working, #saveSignUpButton').hide();
}
});
}
2013-12-02 20:54:24 +01:00
function checkForEnter(event)
{
if (event.keyCode === 13){
event.preventDefault();
2014-01-30 23:29:09 +01:00
validateServerSignUp();
2013-12-02 20:54:24 +01:00
return false;
}
}
@endif
2014-01-30 23:29:09 +01:00
window.isRegistered = {{ Auth::check() && Auth::user()->registered ? 'true' : 'false' }};
2013-12-03 23:00:01 +01:00
function logout(force)
{
2014-01-30 23:29:09 +01:00
if (force || isRegistered) {
2013-12-03 23:00:01 +01:00
window.location = '{{ URL::to('logout') }}';
} else {
$('#logoutModal').modal('show');
}
}
2013-12-26 01:36:34 +01:00
$(function()
{
$('#search').focus(function(){
if (!window.hasOwnProperty('searchData')) {
$.get('{{ URL::route('getSearchData') }}', function(data) {
window.searchData = true;
var datasets = [];
for (var type in data)
{
if (!data.hasOwnProperty(type)) continue;
datasets.push({
name: type,
2013-12-27 10:10:32 +01:00
header: '&nbsp;<b>' + type + '</b>',
2013-12-26 01:36:34 +01:00
local: data[type]
});
}
2014-01-09 22:38:18 +01:00
if (datasets.length == 0) {
return;
}
2013-12-26 01:36:34 +01:00
$('#search').typeahead(datasets).on('typeahead:selected', function(element, datum, name) {
var type = name == 'Contacts' ? 'clients' : name.toLowerCase();
window.location = '{{ URL::to('/') }}' + '/' + type + '/' + datum.public_id;
}).focus().typeahead('setQuery', $('#search').val());
});
}
});
2013-11-26 13:45:07 +01:00
if (isStorageSupported()) {
2013-12-04 17:20:14 +01:00
@if (Auth::check() && !Auth::user()->registered)
2013-12-03 23:00:01 +01:00
localStorage.setItem('guest_key', '{{ Auth::user()->password }}');
@endif
2013-11-26 13:45:07 +01:00
}
2013-12-03 23:00:01 +01:00
2013-12-04 17:20:14 +01:00
@if (!Auth::check() || !Auth::user()->registered)
2013-12-03 23:00:01 +01:00
validateSignUp();
$('#signUpModal').on('shown.bs.modal', function () {
$(['first_name','last_name','email','password']).each(function(i, field) {
2014-01-02 00:12:33 +01:00
var $input = $('form.signUpForm #new_'+field);
2013-12-03 23:00:01 +01:00
if (!$input.val()) {
$input.focus();
return false;
}
});
})
/*
$(window).on('beforeunload', function() {
return true;
});
$('form').submit(function() { $(window).off('beforeunload') });
$('a[rel!=ext]').click(function() { $(window).off('beforeunload') });
*/
2013-12-02 20:54:24 +01:00
@endif
2014-01-01 00:50:13 +01:00
@if (Session::has('message'))
setTimeout(function() {
$('.alert-info').fadeOut();
2014-01-06 07:48:11 +01:00
}, 3000);
2014-01-01 00:50:13 +01:00
@endif
2013-12-01 08:33:17 +01:00
@yield('onReady')
2013-11-26 13:45:07 +01:00
});
2013-12-03 18:32:33 +01:00
</script>
2014-01-02 18:16:00 +01:00
2013-12-07 19:45:00 +01:00
@stop