mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 03:07:30 -04:00 
			
		
		
		
	Minor improvements
This commit is contained in:
		
							parent
							
								
									2cfcdd1e77
								
							
						
					
					
						commit
						07b3fdb30c
					
				| @ -1,5 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
| |-------------------------------------------------------------------------- | ||||
| | Application Routes | ||||
|  | ||||
| @ -341,10 +341,11 @@ class Utils | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         $timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE); | ||||
|         //$timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE);
 | ||||
|         $format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT); | ||||
| 
 | ||||
|         $dateTime = DateTime::createFromFormat($format, $date, new DateTimeZone($timezone)); | ||||
|         //$dateTime = DateTime::createFromFormat($format, $date, new DateTimeZone($timezone));
 | ||||
|         $dateTime = DateTime::createFromFormat($format, $date); | ||||
| 
 | ||||
|         return $formatResult ? $dateTime->format('Y-m-d') : $dateTime; | ||||
|     } | ||||
| @ -355,11 +356,11 @@ class Utils | ||||
|             return ''; | ||||
|         } | ||||
| 
 | ||||
|         $timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE); | ||||
|         //$timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE);
 | ||||
|         $format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT); | ||||
| 
 | ||||
|         $dateTime = DateTime::createFromFormat('Y-m-d', $date); | ||||
|         $dateTime->setTimeZone(new DateTimeZone($timezone)); | ||||
|         //$dateTime->setTimeZone(new DateTimeZone($timezone));
 | ||||
| 
 | ||||
|         return $formatResult ? $dateTime->format($format) : $dateTime; | ||||
|     } | ||||
|  | ||||
| @ -147,6 +147,7 @@ class Account extends Eloquent | ||||
|     public function getLogoPath() | ||||
|     { | ||||
|         $fileName = 'logo/' . $this->account_key; | ||||
| 
 | ||||
|         return file_exists($fileName.'.png') && $this->utf8_invoices ? $fileName.'.png' : $fileName.'.jpg'; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -298,7 +298,7 @@ class AccountRepository | ||||
|             $item->account_id = $user->account->id; | ||||
|             $item->account_name = $user->account->getDisplayName(); | ||||
|             $item->pro_plan_paid = $user->account->pro_plan_paid; | ||||
|             $item->account_key = file_exists($user->account->getLogoPath()) ? $user->account->account_key : null; | ||||
|             $item->logo_path = file_exists($user->account->getLogoPath()) ? $user->account->getLogoPath() : null; | ||||
|             $data[] = $item; | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -30748,9 +30748,6 @@ function displayGrid(doc, invoice, data, x, y, layout, options)  { | ||||
|         key = invoice.account[key]; | ||||
|       } else if (key === 'tax' && invoice.tax_name) { | ||||
|         key = invoice.tax_name + ' ' + (invoice.tax_rate*1).toString() + '%'; | ||||
|         if (invoice.tax_name.toLowerCase().indexOf(invoiceLabels['tax'].toLowerCase()) == -1) { | ||||
|             key = invoiceLabels['tax'] + ': ' + key; | ||||
|         } | ||||
|       } else if (key === 'discount' && NINJA.parseFloat(invoice.discount) && !parseInt(invoice.is_amount_discount)) { | ||||
|         key = invoiceLabels[key] + ' ' + parseFloat(invoice.discount) + '%'; | ||||
|       } else { | ||||
| @ -31619,7 +31616,7 @@ NINJA.decodeJavascript = function(invoice, javascript) | ||||
|     } | ||||
| 
 | ||||
|     // search/replace values 
 | ||||
|     var regExp = new RegExp('"\\$\\\w*?Value"', 'g'); | ||||
|     var regExp = new RegExp('"\\$[\\\w\\\.]*?Value"', 'g'); | ||||
|     var matches = javascript.match(regExp);     | ||||
|      | ||||
|     if (matches) { | ||||
| @ -31628,6 +31625,7 @@ NINJA.decodeJavascript = function(invoice, javascript) | ||||
|             field = match.substring(2, match.indexOf('Value')); | ||||
|             field = toSnakeCase(field); | ||||
|             var value = getDescendantProp(invoice, field) || ' ';             | ||||
|      | ||||
|             if (field.toLowerCase().indexOf('date') >= 0 && value != ' ') { | ||||
|                 value = moment(value, 'YYYY-MM-DD').format('MMM D YYYY'); | ||||
|             } | ||||
| @ -31760,7 +31758,8 @@ NINJA.subtotals = function(invoice, removeBalance) | ||||
|     } | ||||
| 
 | ||||
|     if (invoice.tax && invoice.tax.name || invoice.tax_name) { | ||||
|         data.push([{text: invoiceLabels.tax}, {text: formatMoney(invoice.tax_amount, invoice.client.currency_id)}]);         | ||||
|         var taxStr = invoice.tax_name + ' ' + (invoice.tax_rate*1).toString() + '%'; | ||||
|         data.push([{text: taxStr}, {text: formatMoney(invoice.tax_amount, invoice.client.currency_id)}]);         | ||||
|     } | ||||
|      | ||||
|     if (NINJA.parseFloat(invoice.custom_value1) && invoice.custom_taxes1 != '1') {         | ||||
|  | ||||
| @ -142,7 +142,7 @@ NINJA.decodeJavascript = function(invoice, javascript) | ||||
|     } | ||||
| 
 | ||||
|     // search/replace values 
 | ||||
|     var regExp = new RegExp('"\\$\\\w*?Value"', 'g'); | ||||
|     var regExp = new RegExp('"\\$[\\\w\\\.]*?Value"', 'g'); | ||||
|     var matches = javascript.match(regExp);     | ||||
|      | ||||
|     if (matches) { | ||||
| @ -151,6 +151,7 @@ NINJA.decodeJavascript = function(invoice, javascript) | ||||
|             field = match.substring(2, match.indexOf('Value')); | ||||
|             field = toSnakeCase(field); | ||||
|             var value = getDescendantProp(invoice, field) || ' ';             | ||||
|      | ||||
|             if (field.toLowerCase().indexOf('date') >= 0 && value != ' ') { | ||||
|                 value = moment(value, 'YYYY-MM-DD').format('MMM D YYYY'); | ||||
|             } | ||||
| @ -283,7 +284,8 @@ NINJA.subtotals = function(invoice, removeBalance) | ||||
|     } | ||||
| 
 | ||||
|     if (invoice.tax && invoice.tax.name || invoice.tax_name) { | ||||
|         data.push([{text: invoiceLabels.tax}, {text: formatMoney(invoice.tax_amount, invoice.client.currency_id)}]);         | ||||
|         var taxStr = invoice.tax_name + ' ' + (invoice.tax_rate*1).toString() + '%'; | ||||
|         data.push([{text: taxStr}, {text: formatMoney(invoice.tax_amount, invoice.client.currency_id)}]);         | ||||
|     } | ||||
|      | ||||
|     if (NINJA.parseFloat(invoice.custom_value1) && invoice.custom_taxes1 != '1') {         | ||||
|  | ||||
| @ -877,9 +877,6 @@ function displayGrid(doc, invoice, data, x, y, layout, options)  { | ||||
|         key = invoice.account[key]; | ||||
|       } else if (key === 'tax' && invoice.tax_name) { | ||||
|         key = invoice.tax_name + ' ' + (invoice.tax_rate*1).toString() + '%'; | ||||
|         if (invoice.tax_name.toLowerCase().indexOf(invoiceLabels['tax'].toLowerCase()) == -1) { | ||||
|             key = invoiceLabels['tax'] + ': ' + key; | ||||
|         } | ||||
|       } else if (key === 'discount' && NINJA.parseFloat(invoice.discount) && !parseInt(invoice.is_amount_discount)) { | ||||
|         key = invoiceLabels[key] + ' ' + parseFloat(invoice.discount) + '%'; | ||||
|       } else { | ||||
|  | ||||
| @ -743,6 +743,8 @@ return array( | ||||
|   'manage_companies' => 'Manage Companies', | ||||
|   'total_revenue' => 'Total Revenue', | ||||
| 
 | ||||
|   'current_user' => 'Current User', | ||||
|    | ||||
| 
 | ||||
| ); | ||||
| 
 | ||||
|  | ||||
| @ -385,7 +385,7 @@ | ||||
|                             'user_id' => $item->user_id, | ||||
|                             'account_name' => $item->account_name, | ||||
|                             'user_name' => $item->user_name, | ||||
|                             'account_key' => $item->account_key, | ||||
|                             'logo_path' => isset($item->logo_path) ? $item->logo_path : "", | ||||
|                             'selected' => true, | ||||
|                         ]) | ||||
|                     @endif | ||||
| @ -397,7 +397,7 @@ | ||||
|                             'user_id' => $item->user_id, | ||||
|                             'account_name' => $item->account_name, | ||||
|                             'user_name' => $item->user_name, | ||||
|                             'account_key' => $item->account_key, | ||||
|                             'logo_path' => isset($item->logo_path) ? $item->logo_path : "", | ||||
|                             'selected' => false, | ||||
|                         ]) | ||||
|                     @endif | ||||
| @ -406,16 +406,15 @@ | ||||
|                 @include('user_account', [ | ||||
|                     'account_name' => Auth::user()->account->name ?: trans('texts.untitled'),  | ||||
|                     'user_name' => Auth::user()->getDisplayName(), | ||||
|                     'account_key' => Auth::user()->account->account_key, | ||||
|                     'logo_path' => Auth::user()->account->getLogoPath(), | ||||
|                     'selected' => true, | ||||
|                 ]) | ||||
|             @endif             | ||||
|             <li class="divider"></li>                 | ||||
|             @if (!session(SESSION_USER_ACCOUNTS) || count(session(SESSION_USER_ACCOUNTS)) < 5) | ||||
|                 <li>{!! link_to('/login?new_company=true', trans('texts.add_company')) !!}</li> | ||||
|             @endif | ||||
|             @if (count(session(SESSION_USER_ACCOUNTS)) > 1) | ||||
|                 <li>{!! link_to('/manage_companies', trans('texts.manage_companies')) !!}</li> | ||||
|             @elseif (!session(SESSION_USER_ACCOUNTS) || count(session(SESSION_USER_ACCOUNTS)) < 5) | ||||
|                 <li>{!! link_to('/login?new_company=true', trans('texts.add_company')) !!}</li> | ||||
|             @endif | ||||
|             <li>{!! link_to('#', trans('texts.logout'), array('onclick'=>'logout()')) !!}</li> | ||||
|           </ul> | ||||
|  | ||||
| @ -5,9 +5,9 @@ | ||||
|         <a href="{{ URL::to("/company/details") }}"> | ||||
|     @endif | ||||
| 
 | ||||
|         @if (file_exists('logo/'.$account_key.'.jpg')) | ||||
|         @if (file_exists($logo_path)) | ||||
|             <div class="pull-left" style="height: 40px; margin-right: 16px;"> | ||||
|                 <img style="width: 40px; margin-top:6px" src="{{ asset('logo/'.$account_key.'.jpg') }}"/> | ||||
|                 <img style="width: 40px; margin-top:6px" src="{{ asset($logo_path) }}"/> | ||||
|             </div> | ||||
|         @else | ||||
|             <div class="pull-left" style="width: 40px; min-height: 40px; margin-right: 16px"> </div> | ||||
|  | ||||
| @ -2,8 +2,18 @@ | ||||
| 
 | ||||
| @section('content') | ||||
| 
 | ||||
| 
 | ||||
| <center> | ||||
|     {!! Button::success(trans('texts.add_company'))->asLinkTo('/login?new_company=true') !!} | ||||
| </center> | ||||
| 
 | ||||
| <p> </p> | ||||
| 
 | ||||
| <div class="row"> | ||||
|     <div class="col-md-6 col-md-offset-3"> | ||||
|     </div> | ||||
| </div> | ||||
| 
 | ||||
| <div class="row"> | ||||
|     <div class="col-md-6 col-md-offset-3"> | ||||
|         <div class="panel panel-default"> | ||||
| @ -11,9 +21,20 @@ | ||||
|             <table class="table table-striped"> | ||||
|             @foreach (Session::get(SESSION_USER_ACCOUNTS) as $account) | ||||
|                 <tr> | ||||
|                     <td><b>{{ $account->account_name }}</b></td> | ||||
|                     <td>{{ $account->user_name }}</td> | ||||
|                     <td>{!! Button::primary(trans('texts.unlink'))->small()->withAttributes(['onclick'=>"return showUnlink({$account->id}, {$account->user_id})"]) !!}</td> | ||||
|                     <td> | ||||
|                     @if (isset($account->logo_path)) | ||||
|                         {!! HTML::image($account->logo_path.'?no_cache='.time(), 'Logo', ['width' => 100]) !!} | ||||
|                     @endif | ||||
|                     </td>                     | ||||
|                     <td> | ||||
|                         <h3>{{ $account->account_name }}<br/> | ||||
|                         <small>{{ $account->user_name }} | ||||
|                             @if ($account->user_id == Auth::user()->id) | ||||
|                             | {{ trans('texts.current_user')}} | ||||
|                             @endif | ||||
|                         </small></h3> | ||||
|                     </td> | ||||
|                     <td>{!! Button::primary(trans('texts.unlink'))->withAttributes(['onclick'=>"return showUnlink({$account->id}, {$account->user_id})"]) !!}</td> | ||||
|                 </tr> | ||||
|             @endforeach | ||||
|             </table> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user