From a1cef22a4811c31e64f945b97e2cf76531a0aa5f Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 6 Oct 2015 20:55:55 +0300 Subject: [PATCH] Add quotes to the dashboard and a map to the client page --- app/Console/Commands/SendReminders.php | 1 + app/Http/Controllers/DashboardController.php | 15 +- app/Http/Controllers/InvoiceController.php | 1 + app/Http/Controllers/PaymentController.php | 1 + app/Http/routes.php | 3 +- app/Libraries/Utils.php | 43 ----- app/Models/Account.php | 11 +- app/Models/Activity.php | 8 +- app/Models/Client.php | 20 ++ app/Models/EntityModel.php | 4 + app/Ninja/Mailers/ContactMailer.php | 4 + app/Ninja/Repositories/InvoiceRepository.php | 2 +- database/seeds/PaymentLibrariesSeeder.php | 1 + public/js/built.js | 13 +- public/js/pdf.pdfmake.js | 4 +- public/js/script.js | 9 +- resources/lang/da/texts.php | 4 +- resources/lang/de/texts.php | 4 +- resources/lang/en/texts.php | 5 +- resources/lang/es/texts.php | 4 +- resources/lang/es_ES/texts.php | 4 +- resources/lang/fr/texts.php | 4 +- resources/lang/fr_CA/texts.php | 4 +- resources/lang/it/texts.php | 4 +- resources/lang/lt/texts.php | 4 +- resources/lang/nb_NO/texts.php | 4 +- resources/lang/nl/texts.php | 4 +- resources/lang/pt_BR/texts.php | 4 +- resources/lang/sv/texts.php | 4 +- resources/views/clients/show.blade.php | 78 +++++++- resources/views/dashboard.blade.php | 174 +++++++++++++----- resources/views/header.blade.php | 1 + resources/views/invoices/edit.blade.php | 11 +- resources/views/master.blade.php | 50 +++-- .../partials/fb_pixel_checkout.blade.php | 15 ++ 35 files changed, 365 insertions(+), 157 deletions(-) create mode 100644 resources/views/partials/fb_pixel_checkout.blade.php diff --git a/app/Console/Commands/SendReminders.php b/app/Console/Commands/SendReminders.php index 40b1896eedd0..123e086feb30 100644 --- a/app/Console/Commands/SendReminders.php +++ b/app/Console/Commands/SendReminders.php @@ -41,6 +41,7 @@ class SendReminders extends Command foreach ($invoices as $invoice) { if ($reminder = $invoice->getReminder()) { + $this->info('Send to' . $invoice->id); $this->mailer->sendInvoice($invoice, $reminder); } } diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index dfbd181d86db..0b72d3669114 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -77,9 +77,10 @@ class DashboardController extends BaseController //->where('invoices.is_quote', '=', false) ->where('invoices.balance', '>', 0) ->where('invoices.is_deleted', '=', false) + ->where('invoices.deleted_at', '=', null) ->where('contacts.is_primary', '=', true) ->where('invoices.due_date', '<', date('Y-m-d')) - ->select(['invoices.due_date', 'invoices.balance', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id']) + ->select(['invoices.due_date', 'invoices.balance', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id', 'is_quote']) ->orderBy('invoices.due_date', 'asc') ->take(50) ->get(); @@ -90,6 +91,7 @@ class DashboardController extends BaseController ->where('invoices.account_id', '=', Auth::user()->account_id) ->where('clients.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null) + ->where('invoices.deleted_at', '=', null) ->where('invoices.is_recurring', '=', false) //->where('invoices.is_quote', '=', false) ->where('invoices.balance', '>', 0) @@ -98,7 +100,7 @@ class DashboardController extends BaseController ->where('invoices.due_date', '>=', date('Y-m-d')) ->orderBy('invoices.due_date', 'asc') ->take(50) - ->select(['invoices.due_date', 'invoices.balance', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id']) + ->select(['invoices.due_date', 'invoices.balance', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id', 'is_quote']) ->get(); $payments = DB::table('payments') @@ -114,6 +116,14 @@ class DashboardController extends BaseController ->take(50) ->get(); + $hasQuotes = false; + foreach ([$upcoming, $pastDue] as $data) { + foreach ($data as $invoice) { + if ($invoice->is_quote) { + $hasQuotes = true; + } + } + } $data = [ 'account' => Auth::user()->account, @@ -127,6 +137,7 @@ class DashboardController extends BaseController 'upcoming' => $upcoming, 'payments' => $payments, 'title' => trans('texts.dashboard'), + 'hasQuotes' => $hasQuotes, ]; return View::make('dashboard', $data); diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 7f7ee72ea790..60c1e7578cd0 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -258,6 +258,7 @@ class InvoiceController extends BaseController 'showApprove' => $showApprove, 'showBreadcrumbs' => false, 'hideLogo' => $account->isWhiteLabel(), + 'hideHeader' => $account->isNinjaAccount(), 'invoice' => $invoice->hidePrivateFields(), 'invitation' => $invitation, 'invoiceLabels' => $account->getInvoiceLabels(), diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index 2a4eb331305f..326f0be4ad82 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -246,6 +246,7 @@ class PaymentController extends BaseController 'currencyCode' => $client->currency ? $client->currency->code : ($account->currency ? $account->currency->code : 'USD'), 'account' => $client->account, 'hideLogo' => $account->isWhiteLabel(), + 'hideHeader' => $account->isNinjaAccount(), 'showAddress' => $accountGateway->show_address, ]; diff --git a/app/Http/routes.php b/app/Http/routes.php index cbb0e45ad612..2d09b37d2c00 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -348,6 +348,7 @@ if (!defined('CONTACT_EMAIL')) { define('DEFAULT_DATETIME_MOMENT_FORMAT', 'MMM D, YYYY h:mm:ss a'); define('DEFAULT_QUERY_CACHE', 120); // minutes define('DEFAULT_LOCALE', 'en'); + define('DEFAULT_MAP_ZOOM', 10); define('RESULT_SUCCESS', 'success'); define('RESULT_FAILURE', 'failure'); @@ -387,7 +388,7 @@ if (!defined('CONTACT_EMAIL')) { define('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com'); define('RELEASES_URL', 'https://github.com/hillelcoren/invoice-ninja/releases/'); - define('ZAPIER_URL', 'https://zapier.com/developer/invite/11276/85cf0ee4beae8e802c6c579eb4e351f1/'); + define('ZAPIER_URL', 'https://zapier.com/zapbook/invoice-ninja'); define('OUTDATE_BROWSER_URL', 'http://browsehappy.com/'); define('PDFMAKE_DOCS', 'http://pdfmake.org/playground.html'); define('PHANTOMJS_CLOUD', 'http://api.phantomjscloud.com/single/browser/v1/'); diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 0a42cd634bad..60548af6ca7c 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -203,49 +203,6 @@ class Utils return floatval($value); } - public static function formatPhoneNumber($phoneNumber) - { - $phoneNumber = preg_replace('/[^0-9a-zA-Z]/', '', $phoneNumber); - - if (!$phoneNumber) { - return ''; - } - - if (strlen($phoneNumber) > 10) { - $countryCode = substr($phoneNumber, 0, strlen($phoneNumber)-10); - $areaCode = substr($phoneNumber, -10, 3); - $nextThree = substr($phoneNumber, -7, 3); - $lastFour = substr($phoneNumber, -4, 4); - - $phoneNumber = '+'.$countryCode.' ('.$areaCode.') '.$nextThree.'-'.$lastFour; - } elseif (strlen($phoneNumber) == 10 && in_array(substr($phoneNumber, 0, 3), array(653, 656, 658, 659))) { - /** - * SG country code are 653, 656, 658, 659 - * US area code consist of 650, 651 and 657 - * @see http://en.wikipedia.org/wiki/Telephone_numbers_in_Singapore#Numbering_plan - * @see http://www.bennetyee.org/ucsd-pages/area.html - */ - $countryCode = substr($phoneNumber, 0, 2); - $nextFour = substr($phoneNumber, 2, 4); - $lastFour = substr($phoneNumber, 6, 4); - - $phoneNumber = '+'.$countryCode.' '.$nextFour.' '.$lastFour; - } elseif (strlen($phoneNumber) == 10) { - $areaCode = substr($phoneNumber, 0, 3); - $nextThree = substr($phoneNumber, 3, 3); - $lastFour = substr($phoneNumber, 6, 4); - - $phoneNumber = '('.$areaCode.') '.$nextThree.'-'.$lastFour; - } elseif (strlen($phoneNumber) == 7) { - $nextThree = substr($phoneNumber, 0, 3); - $lastFour = substr($phoneNumber, 3, 4); - - $phoneNumber = $nextThree.'-'.$lastFour; - } - - return $phoneNumber; - } - public static function formatMoney($value, $currencyId = false) { if (!$currencyId) { diff --git a/app/Models/Account.php b/app/Models/Account.php index adc365a612e7..5d64c68deefb 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -321,13 +321,18 @@ class Account extends Eloquent return $data; } + public function isNinjaAccount() + { + return $this->account_key === NINJA_ACCOUNT_KEY; + } + public function isPro() { if (!Utils::isNinjaProd()) { return true; } - if ($this->account_key == NINJA_ACCOUNT_KEY) { + if ($this->isNinjaAccount()) { return true; } @@ -348,6 +353,10 @@ class Account extends Eloquent public function isWhiteLabel() { + if ($this->isNinjaAccount()) { + return false; + } + if (Utils::isNinjaProd()) { return self::isPro() && $this->pro_plan_paid != NINJA_DATE; } else { diff --git a/app/Models/Activity.php b/app/Models/Activity.php index 40a65434e811..b910cac6a350 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -61,7 +61,7 @@ class Activity extends Eloquent public static function updateClient($client) { - if ($client->is_deleted && !$client->getOriginal('is_deleted')) { + if ($client->isBeingDeleted()) { $activity = Activity::getBlank(); $activity->client_id = $client->id; $activity->activity_type_id = ACTIVITY_TYPE_DELETE_CLIENT; @@ -166,7 +166,7 @@ class Activity extends Eloquent { $client = $invoice->client; - if ($invoice->is_deleted && !$invoice->getOriginal('is_deleted')) { + if ($invoice->isBeingDeleted()) { $adjustment = 0; if (!$invoice->is_quote && !$invoice->is_recurring) { $adjustment = $invoice->balance * -1; @@ -315,7 +315,7 @@ class Activity extends Eloquent public static function updatePayment($payment) { - if ($payment->is_deleted && !$payment->getOriginal('is_deleted')) { + if ($payment->isBeingDeleted()) { $client = $payment->client; $client->balance = $client->balance + $payment->amount; $client->paid_to_date = $client->paid_to_date - $payment->amount; @@ -422,7 +422,7 @@ class Activity extends Eloquent public static function updateCredit($credit) { - if ($credit->is_deleted && !$credit->getOriginal('is_deleted')) { + if ($credit->isBeingDeleted()) { $activity = Activity::getBlank(); $activity->credit_id = $credit->id; $activity->client_id = $credit->client_id; diff --git a/app/Models/Client.php b/app/Models/Client.php index 88f7ab11ea23..4cc960f77ecf 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -93,6 +93,26 @@ class Client extends EntityModel return ENTITY_CLIENT; } + public function hasAddress() + { + $fields = [ + 'address1', + 'address2', + 'city', + 'state', + 'postal_code', + 'country_id', + ]; + + foreach ($fields as $field) { + if ($this->$field) { + return true; + } + } + + return false; + } + public function getWebsite() { if (!$this->website) { diff --git a/app/Models/EntityModel.php b/app/Models/EntityModel.php index 550de1d3cef0..4cef225a2d2e 100644 --- a/app/Models/EntityModel.php +++ b/app/Models/EntityModel.php @@ -112,4 +112,8 @@ class EntityModel extends Eloquent return $data; } + public function isBeingDeleted() + { + return $this->is_deleted && !$this->getOriginal('is_deleted'); + } } diff --git a/app/Ninja/Mailers/ContactMailer.php b/app/Ninja/Mailers/ContactMailer.php index a90dc5dbe72f..e269f91fedea 100644 --- a/app/Ninja/Mailers/ContactMailer.php +++ b/app/Ninja/Mailers/ContactMailer.php @@ -27,6 +27,10 @@ class ContactMailer extends Mailer $account->loadLocalizationSettings($client); + if ($account->pdf_email_attachment) { + $invoice->updateCachedPDF(); + } + $view = 'invoice'; $accountName = $invoice->account->getDisplayName(); $emailTemplate = $invoice->account->getEmailTemplate($reminder ?: $entityType); diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index 529b9d29957f..054b8d19739a 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -677,7 +677,7 @@ class InvoiceRepository $invoices = Invoice::whereAccountId($account->id) ->where('balance', '>', 0) - ->whereRaw($sql) + ->whereRaw('(' . $sql . ')') ->get(); return $invoices; diff --git a/database/seeds/PaymentLibrariesSeeder.php b/database/seeds/PaymentLibrariesSeeder.php index 1780bb6bd9a1..dc937cd3938a 100644 --- a/database/seeds/PaymentLibrariesSeeder.php +++ b/database/seeds/PaymentLibrariesSeeder.php @@ -93,6 +93,7 @@ class PaymentLibrariesSeeder extends Seeder ['name' => 'Argentine Peso', 'code' => 'ARS', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Bangladeshi Taka', 'code' => 'BDT', 'symbol' => 'Tk', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'United Arab Emirates Dirham', 'code' => 'AED', 'symbol' => 'DH ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], + ['name' => 'Hong Kong Dollar', 'code' => 'HKD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ]; foreach ($currencies as $currency) { diff --git a/public/js/built.js b/public/js/built.js index e0e096435c2b..1f40652e3845 100644 --- a/public/js/built.js +++ b/public/js/built.js @@ -30404,14 +30404,11 @@ if (window.ko) { function getContactDisplayName(contact) { - var str = ''; if (contact.first_name || contact.last_name) { - str += contact.first_name + ' ' + contact.last_name; + return contact.first_name + ' ' + contact.last_name; + } else { + return contact.email; } - if (str && contact.email) { - str += ' - '; - } - return str + contact.email; } function getClientDisplayName(client) @@ -31739,12 +31736,10 @@ NINJA.decodeJavascript = function(invoice, javascript) var match = matches[i]; field = match.substring(2, match.indexOf('Value')); field = toSnakeCase(field); + var value = getDescendantProp(invoice, field) || ' '; value = doubleDollarSign(value); - if (field.toLowerCase().indexOf('date') >= 0 && value != ' ') { - value = moment(value, 'YYYY-MM-DD').format('MMM D YYYY'); - } javascript = javascript.replace(match, '"'+value+'"'); } } diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index 94171ceae299..bad3cea5d5e7 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -183,12 +183,10 @@ NINJA.decodeJavascript = function(invoice, javascript) var match = matches[i]; field = match.substring(2, match.indexOf('Value')); field = toSnakeCase(field); + var value = getDescendantProp(invoice, field) || ' '; value = doubleDollarSign(value); - if (field.toLowerCase().indexOf('date') >= 0 && value != ' ') { - value = moment(value, 'YYYY-MM-DD').format('MMM D YYYY'); - } javascript = javascript.replace(match, '"'+value+'"'); } } diff --git a/public/js/script.js b/public/js/script.js index a62f3f6ef830..915d9eb17424 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -526,14 +526,11 @@ if (window.ko) { function getContactDisplayName(contact) { - var str = ''; if (contact.first_name || contact.last_name) { - str += contact.first_name + ' ' + contact.last_name; + return contact.first_name + ' ' + contact.last_name; + } else { + return contact.email; } - if (str && contact.email) { - str += ' - '; - } - return str + contact.email; } function getClientDisplayName(client) diff --git a/resources/lang/da/texts.php b/resources/lang/da/texts.php index 0d23039ba5e3..61a9405ecfcb 100644 --- a/resources/lang/da/texts.php +++ b/resources/lang/da/texts.php @@ -621,7 +621,7 @@ 'run' => 'Kør', 'export' => 'Eksport', 'documentation' => 'Dokumentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Gentagne', 'last_invoice_sent' => 'Sidste faktura sendt :date', @@ -793,6 +793,8 @@ 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); \ No newline at end of file diff --git a/resources/lang/de/texts.php b/resources/lang/de/texts.php index 64857ca47bf1..9b8aad70c66f 100644 --- a/resources/lang/de/texts.php +++ b/resources/lang/de/texts.php @@ -621,7 +621,7 @@ return array( 'run' => 'Ausführen', 'export' => 'Exportieren', 'documentation' => 'Dokumentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Wiederkehrend', 'last_invoice_sent' => 'Letzte Rechnung verschickt am :date', @@ -792,6 +792,8 @@ return array( 'last_sent_on' => 'Zuletzt versendet am :date', 'page_expire' => 'Diese Seite wird bald ablaufen, :click_here um weiter zu arbeiten', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 815179ea78bc..e86e0bc7e6ad 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -621,7 +621,7 @@ return array( 'run' => 'Run', 'export' => 'Export', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurring', 'last_invoice_sent' => 'Last invoice sent :date', @@ -792,6 +792,9 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', + ); diff --git a/resources/lang/es/texts.php b/resources/lang/es/texts.php index 864541fef419..c08cf53f88c2 100644 --- a/resources/lang/es/texts.php +++ b/resources/lang/es/texts.php @@ -592,7 +592,7 @@ return array( 'run' => 'Ejecutar', 'export' => 'Exportar', 'documentation' => 'Documentación', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurrente', 'last_invoice_sent' => 'Ultima factura enviada en :date', @@ -770,6 +770,8 @@ return array( 'last_sent_on' => 'ültimo enviado en :date', 'page_expire' => 'Esta página expirará pronto, :click_here para que siga funcionando', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/lang/es_ES/texts.php b/resources/lang/es_ES/texts.php index f5a33b84b8a9..5d48d3a9a2ce 100644 --- a/resources/lang/es_ES/texts.php +++ b/resources/lang/es_ES/texts.php @@ -621,7 +621,7 @@ return array( 'run' => 'Run', 'export' => 'Export', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurring', 'last_invoice_sent' => 'Last invoice sent :date', @@ -792,6 +792,8 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); \ No newline at end of file diff --git a/resources/lang/fr/texts.php b/resources/lang/fr/texts.php index 50346b29fc0b..4ac75e401522 100644 --- a/resources/lang/fr/texts.php +++ b/resources/lang/fr/texts.php @@ -613,7 +613,7 @@ return array( 'run' => 'Run', 'export' => 'Exporter', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Récurrent', 'last_invoice_sent' => 'Dernière facture envoyée le :date', @@ -784,6 +784,8 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/lang/fr_CA/texts.php b/resources/lang/fr_CA/texts.php index f7b2fea3531e..6257451a3f31 100644 --- a/resources/lang/fr_CA/texts.php +++ b/resources/lang/fr_CA/texts.php @@ -613,7 +613,7 @@ return array( 'run' => 'Run', 'export' => 'Export', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurring', 'last_invoice_sent' => 'Last invoice sent :date', @@ -785,6 +785,8 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/lang/it/texts.php b/resources/lang/it/texts.php index 8991b8570ad3..3730c16fa5b7 100644 --- a/resources/lang/it/texts.php +++ b/resources/lang/it/texts.php @@ -615,7 +615,7 @@ return array( 'run' => 'Run', 'export' => 'Export', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurring', 'last_invoice_sent' => 'Last invoice sent :date', @@ -787,5 +787,7 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/lang/lt/texts.php b/resources/lang/lt/texts.php index cef36d462675..a9a26e74c7a6 100644 --- a/resources/lang/lt/texts.php +++ b/resources/lang/lt/texts.php @@ -623,7 +623,7 @@ return array( 'run' => 'Run', 'export' => 'Export', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurring', 'last_invoice_sent' => 'Last invoice sent :date', @@ -795,6 +795,8 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/lang/nb_NO/texts.php b/resources/lang/nb_NO/texts.php index 10474f4bf747..de8643b514dd 100644 --- a/resources/lang/nb_NO/texts.php +++ b/resources/lang/nb_NO/texts.php @@ -621,7 +621,7 @@ return array( 'run' => 'Run', 'export' => 'Export', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurring', 'last_invoice_sent' => 'Last invoice sent :date', @@ -792,5 +792,7 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); \ No newline at end of file diff --git a/resources/lang/nl/texts.php b/resources/lang/nl/texts.php index b8876f085b5e..af7f3297ccab 100644 --- a/resources/lang/nl/texts.php +++ b/resources/lang/nl/texts.php @@ -616,7 +616,7 @@ return array( 'run' => 'Uitvoeren', 'export' => 'Exporteer', 'documentation' => 'Documentatie', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Terugkerend', 'last_invoice_sent' => 'Laatste factuur verzonden :date', @@ -787,5 +787,7 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/lang/pt_BR/texts.php b/resources/lang/pt_BR/texts.php index 7a579ae7076b..2c5c00f7b414 100644 --- a/resources/lang/pt_BR/texts.php +++ b/resources/lang/pt_BR/texts.php @@ -616,7 +616,7 @@ return array( 'run' => 'Run', 'export' => 'Export', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurring', 'last_invoice_sent' => 'Last invoice sent :date', @@ -787,5 +787,7 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/lang/sv/texts.php b/resources/lang/sv/texts.php index 2ceafe9a9c31..ca7bbdc3e2af 100644 --- a/resources/lang/sv/texts.php +++ b/resources/lang/sv/texts.php @@ -619,7 +619,7 @@ return array( 'run' => 'Run', 'export' => 'Export', 'documentation' => 'Documentation', - 'zapier' => 'Zapier Beta', + 'zapier' => 'Zapier', 'recurring' => 'Recurring', 'last_invoice_sent' => 'Last invoice sent :date', @@ -790,5 +790,7 @@ return array( 'last_sent_on' => 'Last sent on :date', 'page_expire' => 'This page will expire soon, :click_here to keep working', + 'upcoming_quotes' => 'Upcoming Quotes', + 'expired_quotes' => 'Expired Quotes', ); diff --git a/resources/views/clients/show.blade.php b/resources/views/clients/show.blade.php index 8072601d6c33..1fc64a7668d9 100644 --- a/resources/views/clients/show.blade.php +++ b/resources/views/clients/show.blade.php @@ -1,7 +1,25 @@ @extends('header') -@section('content') +@section('head') + @parent + @if ($client->hasAddress()) + + + + @endif +@stop + + +@section('content')
{!! Former::open('clients/bulk')->addClass('mainForm') !!} @@ -81,7 +99,7 @@ @endif @if ($client->work_phone) - {{ Utils::formatPhoneNumber($client->work_phone) }} + {{ $client->work_phone }} @endif @if ($client->private_notes) @@ -116,14 +134,14 @@ {!! HTML::mailto($contact->email, $contact->email) !!}
@endif @if ($contact->phone) - {!! Utils::formatPhoneNumber($contact->phone) !!}
+ {{ $contact->phone }}
@endif @endforeach
-
+

{{ trans('texts.standing') }} - +
@@ -140,12 +158,16 @@ @endif
{{ trans('texts.paid_to_date') }} {{ Utils::formatMoney($client->paid_to_date, $client->getCurrencyId()) }}

-
+ @if ($client->hasAddress()) +
+
+ @endif + + + +

@@ -112,7 +115,40 @@

- +
+ + +
+
+
+
+

+ {{ trans('texts.upcoming_invoices') }} +

+
+
+ + + + + + + + + @foreach ($upcoming as $invoice) + @if (!$invoice->is_quote) + + + + + + + @endif + @endforeach + +
{{ trans('texts.invoice_number_short') }}{{ trans('texts.client') }}{{ trans('texts.due_date') }}{{ trans('texts.balance_due') }}
{!! \App\Models\Invoice::calcLink($invoice) !!}{!! link_to('/clients/'.$invoice->client_public_id, trim($invoice->client_name) ?: (trim($invoice->first_name . ' ' . $invoice->last_name) ?: $invoice->email)) !!}{{ Utils::fromSqlDate($invoice->due_date) }}{{ Utils::formatMoney($invoice->balance, $invoice->currency_id ?: ($account->currency_id ?: DEFAULT_CURRENCY)) }}
+
+
@@ -131,48 +167,90 @@ @foreach ($pastDue as $invoice) - - {!! \App\Models\Invoice::calcLink($invoice) !!} - {!! link_to('/clients/'.$invoice->client_public_id, trim($invoice->client_name) ?: (trim($invoice->first_name . ' ' . $invoice->last_name) ?: $invoice->email)) !!} - {{ Utils::fromSqlDate($invoice->due_date) }} - {{ Utils::formatMoney($invoice->balance, $invoice->currency_id ?: ($account->currency_id ?: DEFAULT_CURRENCY)) }} - + @if (!$invoice->is_quote) + + {!! \App\Models\Invoice::calcLink($invoice) !!} + {!! link_to('/clients/'.$invoice->client_public_id, trim($invoice->client_name) ?: (trim($invoice->first_name . ' ' . $invoice->last_name) ?: $invoice->email)) !!} + {{ Utils::fromSqlDate($invoice->due_date) }} + {{ Utils::formatMoney($invoice->balance, $invoice->currency_id ?: ($account->currency_id ?: DEFAULT_CURRENCY)) }} + + @endif @endforeach
-
-
-

- {{ trans('texts.upcoming_invoices') }} -

-
-
- - - - - - - - - @foreach ($upcoming as $invoice) - - - - - - - @endforeach - -
{{ trans('texts.invoice_number_short') }}{{ trans('texts.client') }}{{ trans('texts.due_date') }}{{ trans('texts.balance_due') }}
{!! \App\Models\Invoice::calcLink($invoice) !!}{!! link_to('/clients/'.$invoice->client_public_id, trim($invoice->client_name) ?: (trim($invoice->first_name . ' ' . $invoice->last_name) ?: $invoice->email)) !!}{{ Utils::fromSqlDate($invoice->due_date) }}{{ Utils::formatMoney($invoice->balance, $invoice->currency_id ?: ($account->currency_id ?: DEFAULT_CURRENCY)) }}
-
-
-
+@if ($hasQuotes) +
+
+
+
+

+ {{ trans('texts.upcoming_quotes') }} +

+
+
+ + + + + + + + + @foreach ($upcoming as $invoice) + @if ($invoice->is_quote) + + + + + + + @endif + @endforeach + +
{{ trans('texts.quote_number_short') }}{{ trans('texts.client') }}{{ trans('texts.due_date') }}{{ trans('texts.balance_due') }}
{!! \App\Models\Invoice::calcLink($invoice) !!}{!! link_to('/clients/'.$invoice->client_public_id, trim($invoice->client_name) ?: (trim($invoice->first_name . ' ' . $invoice->last_name) ?: $invoice->email)) !!}{{ Utils::fromSqlDate($invoice->due_date) }}{{ Utils::formatMoney($invoice->balance, $invoice->currency_id ?: ($account->currency_id ?: DEFAULT_CURRENCY)) }}
+
+
+
+
+
+
+

+ {{ trans('texts.expired_quotes') }} +

+
+
+ + + + + + + + + @foreach ($pastDue as $invoice) + @if ($invoice->is_quote) + + + + + + + @endif + @endforeach + +
{{ trans('texts.quote_number_short') }}{{ trans('texts.client') }}{{ trans('texts.due_date') }}{{ trans('texts.balance_due') }}
{!! \App\Models\Invoice::calcLink($invoice) !!}{!! link_to('/clients/'.$invoice->client_public_id, trim($invoice->client_name) ?: (trim($invoice->first_name . ' ' . $invoice->last_name) ?: $invoice->email)) !!}{{ Utils::fromSqlDate($invoice->due_date) }}{{ Utils::formatMoney($invoice->balance, $invoice->currency_id ?: ($account->currency_id ?: DEFAULT_CURRENCY)) }}
+
+
+
+
+@endif + +
diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index 28f37df03886..3e1c52f34f13 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -124,6 +124,7 @@ if (result) { localStorage.setItem('guest_key', ''); fbq('track', 'CompleteRegistration'); + window._fbq.push(['track', '{{ env('FACEBOOK_PIXEL_SIGN_UP') }}', {'value':'0.00','currency':'USD'}]); trackEvent('/account', '/signed_up'); NINJA.isRegistered = true; $('#signUpButton').hide(); diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index 66a5954ec1fc..50534cb422e7 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -793,6 +793,11 @@ } function onEmailClick() { + if (!isEmailValid()) { + alert("{!! trans('texts.provide_email') !!}"); + return; + } + if (!NINJA.isRegistered) { alert("{!! trans('texts.registration_required') !!}"); return; @@ -866,7 +871,7 @@ function isEmailValid() { var isValid = false; var sendTo = false; - var client = self.invoice().client(); + var client = model.invoice().client(); for (var i=0; iinvoice_terms)) }}"); - //self.terms_placeholder = ko.observable({{ !$invoice && $account->invoice_terms ? 'true' : 'false' }} ? self.default_terms() : ''); self.default_terms = ko.observable(account.invoice_terms); self.terms_placeholder = ko.observable({{ !$invoice && $account->invoice_terms ? 'account.invoice_terms' : false}}); self.set_default_terms = ko.observable(false); self.invoice_footer = ko.observable(''); - //self.default_footer = ko.observable("{{ str_replace(["\r\n","\r","\n"], '\n', addslashes($account->invoice_footer)) }}"); - //self.footer_placeholder = ko.observable({{ !$invoice && $account->invoice_footer ? 'true' : 'false' }} ? self.default_footer() : ''); self.default_footer = ko.observable(account.invoice_footer); self.footer_placeholder = ko.observable({{ !$invoice && $account->invoice_footer ? 'account.invoice_footer' : false}}); self.set_default_footer = ko.observable(false); diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php index 5ea7118c9241..a5be2b16ca81 100644 --- a/resources/views/master.blade.php +++ b/resources/views/master.blade.php @@ -61,22 +61,39 @@ }); */ + @if (env('FACEBOOK_PIXEL')) + + !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? + n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; + n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; + t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, + document,'script','//connect.facebook.net/en_US/fbevents.js'); + + fbq('init', '{{ env('FACEBOOK_PIXEL') }}'); + fbq('track', "PageView"); + + (function() { + var _fbq = window._fbq || (window._fbq = []); + if (!_fbq.loaded) { + var fbds = document.createElement('script'); + fbds.async = true; + fbds.src = '//connect.facebook.net/en_US/fbds.js'; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(fbds, s); + _fbq.loaded = true; + } + })(); + + @else + function fbq() { + // do nothing + }; + @endif + + window._fbq = window._fbq || []; + - - - - + \ No newline at end of file