mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 06:44:30 -04:00
Client page color matches invoice design primary color
This commit is contained in:
parent
fe2155e139
commit
bf24e8c40f
@ -5,116 +5,108 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use ninja\mailers\ContactMailer as Mailer;
|
||||
|
||||
class SendRecurringInvoices extends Command {
|
||||
class SendRecurringInvoices extends Command
|
||||
{
|
||||
protected $name = 'ninja:send-invoices';
|
||||
protected $description = 'Send recurring invoices';
|
||||
protected $mailer;
|
||||
|
||||
protected $name = 'ninja:send-invoices';
|
||||
protected $description = 'Send recurring invoices';
|
||||
protected $mailer;
|
||||
public function __construct(Mailer $mailer)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
public function __construct(Mailer $mailer)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
public function fire()
|
||||
{
|
||||
$this->info(date('Y-m-d').' Running SendRecurringInvoices...');
|
||||
$today = new DateTime();
|
||||
|
||||
public function fire()
|
||||
{
|
||||
$this->info(date('Y-m-d') . ' Running SendRecurringInvoices...');
|
||||
$today = new DateTime();
|
||||
$invoices = Invoice::with('account.timezone', 'invoice_items', 'client', 'user')
|
||||
->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', array($today, $today))->get();
|
||||
$this->info(count($invoices).' recurring invoice(s) found');
|
||||
|
||||
$invoices = Invoice::with('account.timezone', 'invoice_items', 'client', 'user')
|
||||
->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', array($today, $today))->get();
|
||||
$this->info(count($invoices) . ' recurring invoice(s) found');
|
||||
|
||||
foreach ($invoices as $recurInvoice)
|
||||
{
|
||||
if ($recurInvoice->client->deleted_at)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$recurInvoice->user->confirmed)
|
||||
{
|
||||
foreach ($invoices as $recurInvoice) {
|
||||
if ($recurInvoice->client->deleted_at) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->info('Processing Invoice ' . $recurInvoice->id . ' - Should send ' . ($recurInvoice->shouldSendToday() ? 'YES' : 'NO'));
|
||||
if (!$recurInvoice->user->confirmed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$recurInvoice->shouldSendToday())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$this->info('Processing Invoice '.$recurInvoice->id.' - Should send '.($recurInvoice->shouldSendToday() ? 'YES' : 'NO'));
|
||||
|
||||
$invoice = Invoice::createNew($recurInvoice);
|
||||
$invoice->client_id = $recurInvoice->client_id;
|
||||
$invoice->recurring_invoice_id = $recurInvoice->id;
|
||||
$invoice->invoice_number = 'R' . $recurInvoice->account->getNextInvoiceNumber();
|
||||
$invoice->amount = $recurInvoice->amount;
|
||||
$invoice->balance = $recurInvoice->amount;
|
||||
$invoice->invoice_date = date_create()->format('Y-m-d');
|
||||
$invoice->discount = $recurInvoice->discount;
|
||||
$invoice->po_number = $recurInvoice->po_number;
|
||||
$invoice->public_notes = $recurInvoice->public_notes;
|
||||
$invoice->terms = $recurInvoice->terms;
|
||||
$invoice->tax_name = $recurInvoice->tax_name;
|
||||
$invoice->tax_rate = $recurInvoice->tax_rate;
|
||||
$invoice->invoice_design_id = $recurInvoice->invoice_design_id;
|
||||
$invoice->custom_value1 = $recurInvoice->custom_value1;
|
||||
$invoice->custom_value2 = $recurInvoice->custom_value2;
|
||||
$invoice->custom_taxes1 = $recurInvoice->custom_taxes1;
|
||||
$invoice->custom_taxes2 = $recurInvoice->custom_taxes2;
|
||||
$invoice->is_amount_discount = $recurInvoice->is_amount_discount;
|
||||
if (!$recurInvoice->shouldSendToday()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($invoice->client->payment_terms)
|
||||
{
|
||||
$invoice->due_date = date_create()->modify($invoice->client->payment_terms . ' day')->format('Y-m-d');
|
||||
}
|
||||
$invoice = Invoice::createNew($recurInvoice);
|
||||
$invoice->client_id = $recurInvoice->client_id;
|
||||
$invoice->recurring_invoice_id = $recurInvoice->id;
|
||||
$invoice->invoice_number = 'R'.$recurInvoice->account->getNextInvoiceNumber();
|
||||
$invoice->amount = $recurInvoice->amount;
|
||||
$invoice->balance = $recurInvoice->amount;
|
||||
$invoice->invoice_date = date_create()->format('Y-m-d');
|
||||
$invoice->discount = $recurInvoice->discount;
|
||||
$invoice->po_number = $recurInvoice->po_number;
|
||||
$invoice->public_notes = $recurInvoice->public_notes;
|
||||
$invoice->terms = $recurInvoice->terms;
|
||||
$invoice->tax_name = $recurInvoice->tax_name;
|
||||
$invoice->tax_rate = $recurInvoice->tax_rate;
|
||||
$invoice->invoice_design_id = $recurInvoice->invoice_design_id;
|
||||
$invoice->custom_value1 = $recurInvoice->custom_value1;
|
||||
$invoice->custom_value2 = $recurInvoice->custom_value2;
|
||||
$invoice->custom_taxes1 = $recurInvoice->custom_taxes1;
|
||||
$invoice->custom_taxes2 = $recurInvoice->custom_taxes2;
|
||||
$invoice->is_amount_discount = $recurInvoice->is_amount_discount;
|
||||
|
||||
$invoice->save();
|
||||
if ($invoice->client->payment_terms) {
|
||||
$invoice->due_date = date_create()->modify($invoice->client->payment_terms.' day')->format('Y-m-d');
|
||||
}
|
||||
|
||||
foreach ($recurInvoice->invoice_items as $recurItem)
|
||||
{
|
||||
$item = InvoiceItem::createNew($recurItem);
|
||||
$item->product_id = $recurItem->product_id;
|
||||
$item->qty = $recurItem->qty;
|
||||
$item->cost = $recurItem->cost;
|
||||
$item->notes = Utils::processVariables($recurItem->notes);
|
||||
$item->product_key = Utils::processVariables($recurItem->product_key);
|
||||
$item->tax_name = $recurItem->tax_name;
|
||||
$item->tax_rate = $recurItem->tax_rate;
|
||||
$invoice->invoice_items()->save($item);
|
||||
}
|
||||
$invoice->save();
|
||||
|
||||
foreach ($recurInvoice->invitations as $recurInvitation)
|
||||
{
|
||||
$invitation = Invitation::createNew($recurInvitation);
|
||||
$invitation->contact_id = $recurInvitation->contact_id;
|
||||
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
|
||||
$invoice->invitations()->save($invitation);
|
||||
}
|
||||
foreach ($recurInvoice->invoice_items as $recurItem) {
|
||||
$item = InvoiceItem::createNew($recurItem);
|
||||
$item->product_id = $recurItem->product_id;
|
||||
$item->qty = $recurItem->qty;
|
||||
$item->cost = $recurItem->cost;
|
||||
$item->notes = Utils::processVariables($recurItem->notes);
|
||||
$item->product_key = Utils::processVariables($recurItem->product_key);
|
||||
$item->tax_name = $recurItem->tax_name;
|
||||
$item->tax_rate = $recurItem->tax_rate;
|
||||
$invoice->invoice_items()->save($item);
|
||||
}
|
||||
|
||||
$this->mailer->sendInvoice($invoice);
|
||||
foreach ($recurInvoice->invitations as $recurInvitation) {
|
||||
$invitation = Invitation::createNew($recurInvitation);
|
||||
$invitation->contact_id = $recurInvitation->contact_id;
|
||||
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
|
||||
$invoice->invitations()->save($invitation);
|
||||
}
|
||||
|
||||
$recurInvoice->last_sent_date = Carbon::now()->toDateTimeString();
|
||||
$recurInvoice->save();
|
||||
}
|
||||
$this->mailer->sendInvoice($invoice);
|
||||
|
||||
$this->info('Done');
|
||||
}
|
||||
$recurInvoice->last_sent_date = Carbon::now()->toDateTimeString();
|
||||
$recurInvoice->save();
|
||||
}
|
||||
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
||||
);
|
||||
}
|
||||
$this->info('Done');
|
||||
}
|
||||
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
||||
);
|
||||
}
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
||||
);
|
||||
}
|
||||
}
|
@ -46,7 +46,16 @@ class InvoiceController extends \BaseController
|
||||
|
||||
public function clientIndex()
|
||||
{
|
||||
$invitationKey = Session::get('invitation_key');
|
||||
if (!$invitationKey) {
|
||||
return Redirect::to('/setup');
|
||||
}
|
||||
|
||||
$invitation = Invitation::with('account')->where('invitation_key', '=', $invitationKey)->first();
|
||||
$color = $invitation->account->primary_color ? $invitation->account->primary_color : '#0b4d78';
|
||||
|
||||
$data = [
|
||||
'color' => $color,
|
||||
'hideLogo' => Session::get('white_label'),
|
||||
'title' => trans('texts.invoices'),
|
||||
'entityType' => ENTITY_INVOICE,
|
||||
@ -67,7 +76,7 @@ class InvoiceController extends \BaseController
|
||||
public function getClientDatatable()
|
||||
{
|
||||
//$accountId = Auth::user()->account_id;
|
||||
$search = Input::get('sSearch');
|
||||
$search = Input::get('sSearch');
|
||||
$invitationKey = Session::get('invitation_key');
|
||||
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->first();
|
||||
|
||||
|
@ -30,12 +30,23 @@ class PaymentController extends \BaseController
|
||||
|
||||
public function clientIndex()
|
||||
{
|
||||
return View::make('public_list', array(
|
||||
$invitationKey = Session::get('invitation_key');
|
||||
if (!$invitationKey) {
|
||||
return Redirect::to('/setup');
|
||||
}
|
||||
|
||||
$invitation = Invitation::with('account')->where('invitation_key', '=', $invitationKey)->first();
|
||||
$color = $invitation->account->primary_color ? $invitation->account->primary_color : '#0b4d78';
|
||||
|
||||
$data = [
|
||||
'color' => $color,
|
||||
'hideLogo' => Session::get('white_label'),
|
||||
'entityType' => ENTITY_PAYMENT,
|
||||
'title' => trans('texts.payments'),
|
||||
'columns' => Utils::trans(['invoice', 'transaction_reference', 'method', 'payment_amount', 'payment_date']),
|
||||
));
|
||||
'columns' => Utils::trans(['invoice', 'transaction_reference', 'method', 'payment_amount', 'payment_date'])
|
||||
];
|
||||
|
||||
return View::make('public_list', $data);
|
||||
}
|
||||
|
||||
public function getDatatable($clientPublicId = null)
|
||||
|
@ -29,10 +29,10 @@ class QuoteController extends \BaseController
|
||||
}
|
||||
|
||||
$data = [
|
||||
'title' => trans('texts.quotes'),
|
||||
'entityType' => ENTITY_QUOTE,
|
||||
'columns' => Utils::trans(['checkbox', 'quote_number', 'client', 'quote_date', 'quote_total', 'due_date', 'status', 'action']),
|
||||
];
|
||||
'title' => trans('texts.quotes'),
|
||||
'entityType' => ENTITY_QUOTE,
|
||||
'columns' => Utils::trans(['checkbox', 'quote_number', 'client', 'quote_date', 'quote_total', 'due_date', 'status', 'action']),
|
||||
];
|
||||
|
||||
/*
|
||||
if (Invoice::scope()->where('is_recurring', '=', true)->count() > 0)
|
||||
@ -47,12 +47,21 @@ class QuoteController extends \BaseController
|
||||
|
||||
public function clientIndex()
|
||||
{
|
||||
$invitationKey = Session::get('invitation_key');
|
||||
if (!$invitationKey) {
|
||||
return Redirect::to('/setup');
|
||||
}
|
||||
|
||||
$invitation = Invitation::with('account')->where('invitation_key', '=', $invitationKey)->first();
|
||||
$color = $invitation->account->primary_color ? $invitation->account->primary_color : '#0b4d78';
|
||||
|
||||
$data = [
|
||||
'hideLogo' => Session::get('white_label'),
|
||||
'title' => trans('texts.quotes'),
|
||||
'entityType' => ENTITY_QUOTE,
|
||||
'columns' => Utils::trans(['quote_number', 'quote_date', 'quote_total', 'due_date']),
|
||||
];
|
||||
'color' => $color,
|
||||
'hideLogo' => Session::get('white_label'),
|
||||
'title' => trans('texts.quotes'),
|
||||
'entityType' => ENTITY_QUOTE,
|
||||
'columns' => Utils::trans(['quote_number', 'quote_date', 'quote_total', 'due_date']),
|
||||
];
|
||||
|
||||
return View::make('public_list', $data);
|
||||
}
|
||||
|
@ -2,30 +2,29 @@
|
||||
|
||||
class UserEventHandler
|
||||
{
|
||||
public function subscribe($events)
|
||||
{
|
||||
$events->listen('user.signup', 'UserEventHandler@onSignup');
|
||||
$events->listen('user.login', 'UserEventHandler@onLogin');
|
||||
public function subscribe($events)
|
||||
{
|
||||
$events->listen('user.signup', 'UserEventHandler@onSignup');
|
||||
$events->listen('user.login', 'UserEventHandler@onLogin');
|
||||
|
||||
$events->listen('user.refresh', 'UserEventHandler@onRefresh');
|
||||
}
|
||||
$events->listen('user.refresh', 'UserEventHandler@onRefresh');
|
||||
}
|
||||
|
||||
public function onSignup()
|
||||
{
|
||||
public function onSignup()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
public function onLogin()
|
||||
{
|
||||
$account = Auth::user()->account;
|
||||
$account->last_login = Carbon::now()->toDateTimeString();
|
||||
$account->save();
|
||||
|
||||
public function onLogin()
|
||||
{
|
||||
$account = Auth::user()->account;
|
||||
$account->last_login = Carbon::now()->toDateTimeString();
|
||||
$account->save();
|
||||
Event::fire('user.refresh');
|
||||
}
|
||||
|
||||
Event::fire('user.refresh');
|
||||
}
|
||||
|
||||
public function onRefresh()
|
||||
{
|
||||
Auth::user()->account->loadLocalizationSettings();
|
||||
}
|
||||
public function onRefresh()
|
||||
{
|
||||
Auth::user()->account->loadLocalizationSettings();
|
||||
}
|
||||
}
|
@ -17,6 +17,11 @@ class Invitation extends EntityModel
|
||||
return $this->belongsTo('User')->withTrashed();
|
||||
}
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->belongsTo('Account');
|
||||
}
|
||||
|
||||
public function getLink()
|
||||
{
|
||||
return SITE_URL.'/view/'.$this->invitation_key;
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
<label for="trashed" style="font-weight:normal; margin-left: 10px;">
|
||||
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
|
||||
{{ Session::get("show_trash:{$entityType}") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ strtolower(trans('texts.'.$entityType.'s')) }}
|
||||
{{ Session::get("show_trash:{$entityType}") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ strtolower(trans('texts.'.$entityType.'s')) }}
|
||||
</label>
|
||||
|
||||
<div id="top_right_buttons" class="pull-right">
|
||||
|
@ -15,6 +15,7 @@ body {
|
||||
|
||||
|
||||
.container input[type=text],
|
||||
.container input[type=email],
|
||||
.container select {
|
||||
font-weight: 300;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
@ -145,13 +146,17 @@ header h3 em {
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-7">
|
||||
<header>
|
||||
<h2>{{ $client->getDisplayName() }}</h2>
|
||||
<h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>| {{ trans('texts.amount_due') }}: <em>{{ Utils::formatMoney($amount, $currencyId) }}</em></span></h3>
|
||||
@if ($client)
|
||||
<h2>{{ $client->getDisplayName() }}</h2>
|
||||
<h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>| {{ trans('texts.amount_due') }}: <em>{{ Utils::formatMoney($amount, $currencyId) }}</em></span></h3>
|
||||
@elseif ($paymentTitle)
|
||||
<h2>{{ $paymentTitle }}<br/><small>{{ $paymentSubtitle }}</small></h2>
|
||||
@endif
|
||||
</header>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-5">
|
||||
@if (Request::secure() || Utils::isNinjaDev())
|
||||
<div class="secure">
|
||||
<h3>{{ trans('texts.secure_payment') }}</h3>
|
||||
@ -254,7 +259,7 @@ header h3 em {
|
||||
|
||||
<div class="row" style="padding-top:18px">
|
||||
<div class="col-md-5">
|
||||
@if ($account->showTokenCheckbox())
|
||||
@if ($client && $account->showTokenCheckbox())
|
||||
<input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">
|
||||
<label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
|
||||
<span class="help-block" style="font-size:15px">{{ trans('texts.token_billing_secure', ['stripe_link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) }}</span>
|
||||
|
@ -2,32 +2,100 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
<section class="hero background hero-secure center" data-speed="2" data-type="background">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h1>License Key</h1>
|
||||
<!--<p class="thin"><img src="{{ asset('images/icon-secure-pay.png') }}">256-BiT Encryption</p>-->
|
||||
<!-- <img src="{{ asset('images/providers.png') }}"> -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
background-color: #f8f8f8;
|
||||
color: #1b1a1a;
|
||||
}
|
||||
|
||||
.panel-body {
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 700px) {
|
||||
header {
|
||||
margin: 20px 0 75px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.panel-body {
|
||||
padding-left: 150px;
|
||||
padding-right: 150px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
header {
|
||||
margin: 0px !important
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-weight: 300;
|
||||
font-size: 30px;
|
||||
color: #2e2b2b;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-weight: 900;
|
||||
margin-top: 10px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
h3 .help {
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
color: #888888;
|
||||
}
|
||||
|
||||
header h3 {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
header h3 span {
|
||||
display: inline-block;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
header h3 em {
|
||||
font-style: normal;
|
||||
color: #eb8039;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<div class="container">
|
||||
<p> </p>
|
||||
|
||||
<section class="faq">
|
||||
<div class="container">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<header>
|
||||
<h2>License Key<br/><small>{{ $message }}</small></h2>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3 style="text-align:center">{{ $message }}</h3>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<h2 style="text-align:center">{{ $license }}</h2>
|
||||
<h2 style="text-align:center">{{ $license }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
<div style="height:300px"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@stop
|
@ -11,8 +11,7 @@
|
||||
table.dataTable { border-radius: 3px; border-collapse: collapse;
|
||||
/*border-spacing: 0;*/}
|
||||
table.dataTable thead > tr > th, table.invoice-table thead > tr > th {
|
||||
background-color: #0b4d78 !important;
|
||||
/*background-color: #e37329 !important;*/
|
||||
background-color: {{ $color }} !important;
|
||||
color:#fff;
|
||||
}
|
||||
th:first-child {
|
||||
@ -68,8 +67,8 @@
|
||||
max-width: 250px;
|
||||
}
|
||||
.pagination>.active>a, .pagination>.active>span, .pagination>.active>a:hover, .pagination>.active>span:hover, .pagination>.active>a:focus, .pagination>.active>span:focus {
|
||||
background-color: #0b4d78;
|
||||
border-color: #0b4d78;
|
||||
background-color: {{ $color }};
|
||||
border-color: {{ $color }};
|
||||
}
|
||||
.pagination>li:first-child>a, .pagination>li:first-child>span {
|
||||
border-bottom-left-radius: 3px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user