diff --git a/.travis.yml b/.travis.yml index c7dd08d994..e3b0e7301e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,16 +64,16 @@ before_script: script: - php ./vendor/codeception/codeception/codecept run --debug acceptance AllPagesCept.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance APICest.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance CheckBalanceCest.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance ClientCest.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance CreditCest.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceCest.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceDesignCest.php - #- php ./vendor/codeception/codeception/codecept run acceptance OnlinePaymentCest.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance PaymentCest.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance TaskCest.php - #- php ./vendor/codeception/codeception/codecept run --debug acceptance TaxRatesCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance APICest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance CheckBalanceCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance ClientCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance CreditCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceDesignCest.php + - php ./vendor/codeception/codeception/codecept run acceptance OnlinePaymentCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance PaymentCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance TaskCest.php + - php ./vendor/codeception/codeception/codecept run --debug acceptance TaxRatesCest.php #- sed -i 's/NINJA_DEV=true/NINJA_PROD=true/g' .env #- php ./vendor/codeception/codeception/codecept run acceptance GoProCest.php diff --git a/Gruntfile.js b/Gruntfile.js index 05dab35047..8b50d2d5b2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -107,7 +107,6 @@ module.exports = function(grunt) { //'public/vendor/pdfmake/build/pdfmake.min.js', //'public/vendor/pdfmake/build/vfs_fonts.js', //'public/js/vfs_fonts.js', - 'public/js/lightbox.min.js', 'public/js/bootstrap-combobox.js', 'public/js/script.js', 'public/js/pdf.pdfmake.js', @@ -140,7 +139,6 @@ module.exports = function(grunt) { 'public/vendor/spectrum/spectrum.css', 'public/css/bootstrap-combobox.css', 'public/css/typeahead.js-bootstrap.css', - 'public/css/lightbox.css', //'public/vendor/handsontable/dist/jquery.handsontable.full.css', 'public/css/style.css', ], diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 6c0f59a3ba..90b6ef930b 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -15,6 +15,7 @@ use Response; use Request; use App\Models\Affiliate; use App\Models\License; +use App\Models\Invoice; use App\Models\User; use App\Models\Account; use App\Models\Gateway; @@ -393,6 +394,21 @@ class AccountController extends BaseController if ($section == ACCOUNT_CUSTOMIZE_DESIGN) { $data['customDesign'] = ($account->custom_design && !$design) ? $account->custom_design : $design; + + // sample invoice to help determine variables + $invoice = Invoice::scope() + ->with('client', 'account') + ->where('is_quote', '=', false) + ->where('is_recurring', '=', false) + ->first(); + + if ($invoice) { + $invoice->hidePrivateFields(); + unset($invoice->account); + unset($invoice->invoice_items); + unset($invoice->client->contacts); + $data['sampleInvoice'] = $invoice; + } } return View::make("accounts.{$section}", $data); diff --git a/app/Http/Controllers/AppController.php b/app/Http/Controllers/AppController.php index 126e2f395c..2ca874b5c0 100644 --- a/app/Http/Controllers/AppController.php +++ b/app/Http/Controllers/AppController.php @@ -288,7 +288,7 @@ class AppController extends BaseController } if (Utils::getResllerType() == RESELLER_REVENUE_SHARE) { - $payments = DB::table('accounts') + $data = DB::table('accounts') ->leftJoin('payments', 'payments.account_id', '=', 'accounts.id') ->leftJoin('clients', 'clients.id', '=', 'payments.client_id') ->where('accounts.account_key', '=', NINJA_ACCOUNT_KEY) @@ -300,15 +300,9 @@ class AppController extends BaseController 'payments.amount' ]); } else { - $payments = DB::table('accounts') - ->leftJoin('payments', 'payments.account_id', '=', 'accounts.id') - ->leftJoin('clients', 'clients.id', '=', 'payments.client_id') - ->where('accounts.account_key', '=', NINJA_ACCOUNT_KEY) - ->where('payments.is_deleted', '=', false) - ->groupBy('clients.id') - ->count(); + $data = DB::table('users')->count(); } - return json_encode($payments); + return json_encode($data); } } \ No newline at end of file diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 540e38d972..a7f5db4b57 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -109,8 +109,7 @@ class ExportController extends BaseController if ($request->input(ENTITY_CLIENT)) { $data['clients'] = Client::scope() ->with('user', 'contacts', 'country') - ->withTrashed() - ->where('is_deleted', '=', false) + ->withArchived() ->get(); $data['contacts'] = Contact::scope() @@ -126,33 +125,36 @@ class ExportController extends BaseController if ($request->input(ENTITY_TASK)) { $data['tasks'] = Task::scope() ->with('user', 'client.contacts') - ->withTrashed() - ->where('is_deleted', '=', false) + ->withArchived() ->get(); } if ($request->input(ENTITY_INVOICE)) { $data['invoices'] = Invoice::scope() ->with('user', 'client.contacts', 'invoice_status') - ->withTrashed() - ->where('is_deleted', '=', false) + ->withArchived() ->where('is_quote', '=', false) ->where('is_recurring', '=', false) ->get(); $data['quotes'] = Invoice::scope() ->with('user', 'client.contacts', 'invoice_status') - ->withTrashed() - ->where('is_deleted', '=', false) + ->withArchived() ->where('is_quote', '=', true) ->where('is_recurring', '=', false) ->get(); + + $data['recurringInvoices'] = Invoice::scope() + ->with('user', 'client.contacts', 'invoice_status', 'frequency') + ->withArchived() + ->where('is_quote', '=', false) + ->where('is_recurring', '=', true) + ->get(); } if ($request->input(ENTITY_PAYMENT)) { $data['payments'] = Payment::scope() - ->withTrashed() - ->where('is_deleted', '=', false) + ->withArchived() ->with('user', 'client.contacts', 'payment_type', 'invoice', 'account_gateway.gateway') ->get(); } @@ -161,14 +163,14 @@ class ExportController extends BaseController if ($request->input(ENTITY_VENDOR)) { $data['clients'] = Vendor::scope() ->with('user', 'vendorcontacts', 'country') - ->withTrashed() - ->where('is_deleted', '=', false) + ->withArchived() ->get(); $data['vendor_contacts'] = VendorContact::scope() ->with('user', 'vendor.contacts') ->withTrashed() ->get(); + /* $data['expenses'] = Credit::scope() ->with('user', 'client.contacts') diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index f6aa72bf53..97582f4ea7 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -292,7 +292,7 @@ class ReportController extends BaseController foreach ($taxes as $tax) { $displayData[] = [ $tax['name'], - $tax['rate'], + $tax['rate'] . '%', $account->formatMoney($tax['amount'], $client), $account->formatMoney($tax['paid'], $client) ]; @@ -372,6 +372,8 @@ class ReportController extends BaseController $query->where('invoice_date', '>=', $startDate) ->where('invoice_date', '<=', $endDate) ->where('is_deleted', '=', false) + ->where('is_quote', '=', false) + ->where('is_recurring', '=', false) ->with(['payments' => function($query) { $query->withTrashed() ->with('payment_type', 'account_gateway.gateway') @@ -419,6 +421,8 @@ class ReportController extends BaseController ->with(['invoices' => function($query) use ($startDate, $endDate) { $query->where('invoice_date', '>=', $startDate) ->where('invoice_date', '<=', $endDate) + ->where('is_quote', '=', false) + ->where('is_recurring', '=', false) ->withArchived(); }]); diff --git a/app/Http/routes.php b/app/Http/routes.php index 7789d48253..1a92403770 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -528,6 +528,8 @@ if (!defined('CONTACT_EMAIL')) { define('EMAIL_MARKUP_URL', 'https://developers.google.com/gmail/markup'); define('OFX_HOME_URL', 'http://www.ofxhome.com/index.php/home/directory/all'); + define('BLANK_IMAGE', 'data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='); + define('COUNT_FREE_DESIGNS', 4); define('COUNT_FREE_DESIGNS_SELF_HOST', 5); // include the custom design define('PRODUCT_ONE_CLICK_INSTALL', 1); diff --git a/app/Models/Account.php b/app/Models/Account.php index d3f64bb2ee..b729f46ffb 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -439,7 +439,7 @@ class Account extends Eloquent return $height; } - public function createInvoice($entityType, $clientId = null) + public function createInvoice($entityType = ENTITY_INVOICE, $clientId = null) { $invoice = Invoice::createNew(); diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 835de501c6..e60a06f8d4 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -200,6 +200,11 @@ class Invoice extends EntityModel implements BalanceAffecting return $this->hasMany('App\Models\Invoice', 'recurring_invoice_id'); } + public function frequency() + { + return $this->belongsTo('App\Models\Frequency'); + } + public function invitations() { return $this->hasMany('App\Models\Invitation')->orderBy('invitations.contact_id'); diff --git a/app/Ninja/Presenters/ClientPresenter.php b/app/Ninja/Presenters/ClientPresenter.php index cd32151a37..bb32a8b62f 100644 --- a/app/Ninja/Presenters/ClientPresenter.php +++ b/app/Ninja/Presenters/ClientPresenter.php @@ -1,5 +1,6 @@ {$text}"; } + public function url() + { + return URL::to('/clients/' . $this->entity->public_id); + } + public function link() { return link_to('/clients/' . $this->entity->public_id, $this->entity->getDisplayName()); diff --git a/app/Ninja/Presenters/InvoicePresenter.php b/app/Ninja/Presenters/InvoicePresenter.php index 2bab049d2a..560f2d49e6 100644 --- a/app/Ninja/Presenters/InvoicePresenter.php +++ b/app/Ninja/Presenters/InvoicePresenter.php @@ -1,5 +1,6 @@ entity->invoice_status ? $this->entity->invoice_status->name : 'draft'; - $status = strtolower($status); - return trans("texts.status_{$status}"); + if ($this->entity->is_deleted) { + return trans('texts.deleted'); + } elseif ($this->entity->trashed()) { + return trans('texts.archived'); + } else { + $status = $this->entity->invoice_status ? $this->entity->invoice_status->name : 'draft'; + $status = strtolower($status); + return trans("texts.status_{$status}"); + } } public function invoice_date() @@ -55,9 +62,24 @@ class InvoicePresenter extends Presenter { return Utils::fromSqlDate($this->entity->due_date); } + public function frequency() + { + return $this->entity->frequency ? $this->entity->frequency->name : ''; + } + + public function url() + { + return URL::to('/invoices/' . $this->entity->public_id); + } + public function link() { return link_to('/invoices/' . $this->entity->public_id, $this->entity->invoice_number); } + public function email() + { + $client = $this->entity->client; + return count($client->contacts) ? $client->contacts[0]->email : ''; + } } \ No newline at end of file diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 880ded2baf..08a546fa9e 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -82,47 +82,42 @@ class AccountRepository private function getAccountSearchData() { - $clients = \DB::table('clients') - ->where('clients.deleted_at', '=', null) - ->where('clients.account_id', '=', \Auth::user()->account_id) - ->whereRaw("clients.name <> ''") - ->select(\DB::raw("'clients' as type, '" . trans('texts.clients') . "' as trans_type, clients.public_id, clients.name, '' as token")); + $data = [ + trans('texts.clients') => [], + trans('texts.contacts') => [], + trans('texts.invoices') => [], + trans('texts.quotes') => [], + ]; - $contacts = \DB::table('clients') - ->join('contacts', 'contacts.client_id', '=', 'clients.id') - ->where('clients.deleted_at', '=', null) - ->where('clients.account_id', '=', \Auth::user()->account_id) - ->whereRaw("CONCAT(contacts.first_name, contacts.last_name, contacts.email) <> ''") - ->select(\DB::raw("'clients' as type, '" . trans('texts.contacts') . "' as trans_type, clients.public_id, CONCAT(contacts.first_name, ' ', contacts.last_name, ' ', contacts.email) as name, '' as token")); + $clients = Client::scope() + ->with('contacts', 'invoices') + ->get(); - $invoices = \DB::table('clients') - ->join('invoices', 'invoices.client_id', '=', 'clients.id') - ->where('clients.account_id', '=', \Auth::user()->account_id) - ->where('clients.deleted_at', '=', null) - ->where('invoices.deleted_at', '=', null) - ->select(\DB::raw("'invoices' as type, '" . trans('texts.invoices') . "' as trans_type, invoices.public_id, CONCAT(invoices.invoice_number, ': ', clients.name) as name, invoices.invoice_number as token")); - - $data = []; - - foreach ($clients->union($contacts)->union($invoices)->get() as $row) { - $type = $row->trans_type; - - if (!isset($data[$type])) { - $data[$type] = []; + foreach ($clients as $client) { + if ($client->name) { + $data[trans('texts.clients')][] = [ + 'value' => $client->name, + 'tokens' => explode(' ', $client->name), + 'url' => $client->present()->url, + ]; } - $tokens = explode(' ', $row->name); - $tokens[] = $type; - - if ($type == 'Invoices') { - $tokens[] = intVal($row->token).''; + foreach ($client->contacts as $contact) { + $data[trans('texts.contacts')][] = [ + 'value' => $contact->getDisplayName(), + 'tokens' => explode(' ', $contact->getFullName() . ' ' . $contact->email), + 'url' => $client->present()->url, + ]; } - $data[$type][] = [ - 'value' => $row->name, - 'tokens' => $tokens, - 'url' => URL::to("/{$row->type}/{$row->public_id}"), - ]; + foreach ($client->invoices as $invoice) { + $entityType = $invoice->getEntityType(); + $data[trans("texts.{$entityType}s")][] = [ + 'value' => $invoice->getDisplayName() . ': ' . $client->getDisplayName(), + 'tokens' => explode(' ', $invoice->invoice_number . ' ' . intval($invoice->invoice_number) . ' ' . $client->getDisplayName()), + 'url' => $invoice->present()->url, + ]; + } } return $data; diff --git a/public/built.js b/public/built.js index ec11a94ceb..1d94fa1247 100644 --- a/public/built.js +++ b/public/built.js @@ -29450,15 +29450,6 @@ links:["Africa/Abidjan|Africa/Bamako","Africa/Abidjan|Africa/Banjul","Africa/Abi (function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function t(e){return"function"==typeof e}function r(e){return"object"==typeof e&&null!==e}function n(e){q=e}function o(e){Z=e}function i(){return function(){process.nextTick(l)}}function a(){return function(){I(l)}}function s(){var e=0,t=new Y(l),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function u(){var e=new MessageChannel;return e.port1.onmessage=l,function(){e.port2.postMessage(0)}}function c(){return function(){setTimeout(l,1)}}function l(){for(var e=0;B>e;e+=2){var t=K[e],r=K[e+1];t(r),K[e]=void 0,K[e+1]=void 0}B=0}function f(){try{var e=require,t=e("vertx");return I=t.runOnLoop||t.runOnContext,a()}catch(r){return c()}}function p(){}function h(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function d(e){try{return e.then}catch(t){return te.error=t,te}}function m(e,t,r,n){try{e.call(t,r,n)}catch(o){return o}}function y(e,t,r){Z(function(e){var n=!1,o=m(r,t,function(r){n||(n=!0,t!==r?b(e,r):A(e,r))},function(t){n||(n=!0,C(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,C(e,o))},e)}function v(e,t){t._state===W?A(e,t._result):t._state===ee?C(e,t._result):S(t,void 0,function(t){b(e,t)},function(t){C(e,t)})}function _(e,r){if(r.constructor===e.constructor)v(e,r);else{var n=d(r);n===te?C(e,te.error):void 0===n?A(e,r):t(n)?y(e,r,n):A(e,r)}}function b(t,r){t===r?C(t,h()):e(r)?_(t,r):A(t,r)}function w(e){e._onerror&&e._onerror(e._result),O(e)}function A(e,t){e._state===Q&&(e._result=t,e._state=W,0!==e._subscribers.length&&Z(O,e))}function C(e,t){e._state===Q&&(e._state=ee,e._result=t,Z(w,e))}function S(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+W]=r,o[i+ee]=n,0===i&&e._state&&Z(O,e)}function O(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,o,i=e._result,a=0;aa;a++)S(n.resolve(e[a]),void 0,t,r);return o}function L(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(p);return b(r,e),r}function P(e){var t=this,r=new t(p);return C(r,e),r}function F(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function R(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function $(e){this._id=ue++,this._state=void 0,this._result=void 0,this._subscribers=[],p!==e&&(t(e)||F(),this instanceof $||R(),j(this,e))}function G(){var e;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;(!r||"[object Promise]"!==Object.prototype.toString.call(r.resolve())||r.cast)&&(e.Promise=ce)}var U;U=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var I,q,J,D=U,B=0,Z=({}.toString,function(e,t){K[B]=e,K[B+1]=t,B+=2,2===B&&(q?q(l):J())}),z="undefined"!=typeof window?window:void 0,H=z||{},Y=H.MutationObserver||H.WebKitMutationObserver,X="undefined"!=typeof process&&"[object process]"==={}.toString.call(process),V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,K=new Array(1e3);J=X?i():Y?s():V?u():void 0===z&&"function"==typeof require?f():c();var Q=void 0,W=1,ee=2,te=new E,re=new E;M.prototype._validateInput=function(e){return D(e)},M.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},M.prototype._init=function(){this._result=new Array(this.length)};var ne=M;M.prototype._enumerate=function(){for(var e=this,t=e.length,r=e.promise,n=e._input,o=0;r._state===Q&&t>o;o++)e._eachEntry(n[o],o)},M.prototype._eachEntry=function(e,t){var n=this,o=n._instanceConstructor;r(e)?e.constructor===o&&e._state!==Q?(e._onerror=null,n._settledAt(e._state,t,e._result)):n._willSettleAt(o.resolve(e),t):(n._remaining--,n._result[t]=e)},M.prototype._settledAt=function(e,t,r){var n=this,o=n.promise;o._state===Q&&(n._remaining--,e===ee?C(o,r):n._result[t]=r),0===n._remaining&&A(o,n._result)},M.prototype._willSettleAt=function(e,t){var r=this;S(e,void 0,function(e){r._settledAt(W,t,e)},function(e){r._settledAt(ee,t,e)})};var oe=k,ie=T,ae=L,se=P,ue=0,ce=$;$.all=oe,$.race=ie,$.resolve=ae,$.reject=se,$._setScheduler=n,$._setAsap=o,$._asap=Z,$.prototype={constructor:$,then:function(e,t){var r=this,n=r._state;if(n===W&&!e||n===ee&&!t)return this;var o=new this.constructor(p),i=r._result;if(n){var a=arguments[n-1];Z(function(){x(n,o,a,i)})}else S(r,o,e,t);return o},"catch":function(e){return this.then(null,e)}};var le=G,fe={Promise:ce,polyfill:le};"function"==typeof define&&define.amd?define(function(){return fe}):"undefined"!=typeof module&&module.exports?module.exports=fe:"undefined"!=typeof this&&(this.ES6Promise=fe),le()}).call(this),function(){function e(t,n){function i(e){if(i[e]!==m)return i[e];var t;if("bug-string-char-index"==e)t="a"!="a"[0];else if("json"==e)t=i("json-stringify")&&i("json-parse");else{var r,o='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==e){var u=n.stringify,l="function"==typeof u&&_;if(l){(r=function(){return 1}).toJSON=r;try{l="0"===u(0)&&"0"===u(new a)&&'""'==u(new s)&&u(v)===m&&u(m)===m&&u()===m&&"1"===u(r)&&"[1]"==u([r])&&"[null]"==u([m])&&"null"==u(null)&&"[null,null,null]"==u([m,v,null])&&u({a:[r,!0,!1,null,"\x00\b\n\f\r "]})==o&&"1"===u(null,r)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new c(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new c(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new c(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new c(-1))}catch(f){l=!1}}t=l}if("json-parse"==e){var p=n.parse;if("function"==typeof p)try{if(0===p("0")&&!p(!1)){r=p(o);var h=5==r.a.length&&1===r.a[0];if(h){try{h=!p('" "')}catch(f){}if(h)try{h=1!==p("01")}catch(f){}if(h)try{h=1!==p("1.")}catch(f){}}}}catch(f){h=!1}t=h}}return i[e]=!!t}t||(t=o.Object()),n||(n=o.Object());var a=t.Number||o.Number,s=t.String||o.String,u=t.Object||o.Object,c=t.Date||o.Date,l=t.SyntaxError||o.SyntaxError,f=t.TypeError||o.TypeError,p=t.Math||o.Math,h=t.JSON||o.JSON;"object"==typeof h&&h&&(n.stringify=h.stringify,n.parse=h.parse);var g,d,m,y=u.prototype,v=y.toString,_=new c(-0xc782b5b800cec);try{_=-109252==_.getUTCFullYear()&&0===_.getUTCMonth()&&1===_.getUTCDate()&&10==_.getUTCHours()&&37==_.getUTCMinutes()&&6==_.getUTCSeconds()&&708==_.getUTCMilliseconds()}catch(b){}if(!i("json")){var w="[object Function]",A="[object Date]",C="[object Number]",S="[object String]",O="[object Array]",E="[object Boolean]",N=i("bug-string-char-index");if(!_)var x=p.floor,j=[0,31,59,90,120,151,181,212,243,273,304,334],M=function(e,t){return j[t]+365*(e-1970)+x((e-1969+(t=+(t>1)))/4)-x((e-1901+t)/100)+x((e-1601+t)/400)};if((g=y.hasOwnProperty)||(g=function(e){var t,r={};return(r.__proto__=null,r.__proto__={toString:1},r).toString!=v?g=function(e){var t=this.__proto__,r=e in(this.__proto__=null,this);return this.__proto__=t,r}:(t=r.constructor,g=function(e){var r=(this.constructor||t).prototype;return e in this&&!(e in r&&this[e]===r[e])}),r=null,g.call(this,e)}),d=function(e,t){var n,o,i,a=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,o=new n;for(i in o)g.call(o,i)&&a++;return n=o=null,a?d=2==a?function(e,t){var r,n={},o=v.call(e)==w;for(r in e)o&&"prototype"==r||g.call(n,r)||!(n[r]=1)||!g.call(e,r)||t(r)}:function(e,t){var r,n,o=v.call(e)==w;for(r in e)o&&"prototype"==r||!g.call(e,r)||(n="constructor"===r)||t(r);(n||g.call(e,r="constructor"))&&t(r)}:(o=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],d=function(e,t){var n,i,a=v.call(e)==w,s=!a&&"function"!=typeof e.constructor&&r[typeof e.hasOwnProperty]&&e.hasOwnProperty||g;for(n in e)a&&"prototype"==n||!s.call(e,n)||t(n);for(i=o.length;n=o[--i];s.call(e,n)&&t(n));}),d(e,t)},!i("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},T="000000",L=function(e,t){return(T+(t||0)).slice(-e)},P="\\u00",F=function(e){for(var t='"',r=0,n=e.length,o=!N||n>10,i=o&&(N?e.split(""):e);n>r;r++){var a=e.charCodeAt(r);switch(a){case 8:case 9:case 10:case 12:case 13:case 34:case 92:t+=k[a];break;default:if(32>a){t+=P+L(2,a.toString(16));break}t+=o?i[r]:e.charAt(r)}}return t+'"'},R=function(e,t,r,n,o,i,a){var s,u,c,l,p,h,y,_,b,w,N,j,k,T,P,$;try{s=t[e]}catch(G){}if("object"==typeof s&&s)if(u=v.call(s),u!=A||g.call(s,"toJSON"))"function"==typeof s.toJSON&&(u!=C&&u!=S&&u!=O||g.call(s,"toJSON"))&&(s=s.toJSON(e));else if(s>-1/0&&1/0>s){if(M){for(p=x(s/864e5),c=x(p/365.2425)+1970-1;M(c+1,0)<=p;c++);for(l=x((p-M(c,0))/30.42);M(c,l+1)<=p;l++);p=1+p-M(c,l),h=(s%864e5+864e5)%864e5,y=x(h/36e5)%24,_=x(h/6e4)%60,b=x(h/1e3)%60,w=h%1e3}else c=s.getUTCFullYear(),l=s.getUTCMonth(),p=s.getUTCDate(),y=s.getUTCHours(),_=s.getUTCMinutes(),b=s.getUTCSeconds(),w=s.getUTCMilliseconds();s=(0>=c||c>=1e4?(0>c?"-":"+")+L(6,0>c?-c:c):L(4,c))+"-"+L(2,l+1)+"-"+L(2,p)+"T"+L(2,y)+":"+L(2,_)+":"+L(2,b)+"."+L(3,w)+"Z"}else s=null;if(r&&(s=r.call(t,e,s)),null===s)return"null";if(u=v.call(s),u==E)return""+s;if(u==C)return s>-1/0&&1/0>s?""+s:"null";if(u==S)return F(""+s);if("object"==typeof s){for(T=a.length;T--;)if(a[T]===s)throw f();if(a.push(s),N=[],P=i,i+=o,u==O){for(k=0,T=s.length;T>k;k++)j=R(k,s,r,n,o,i,a),N.push(j===m?"null":j);$=N.length?o?"[\n"+i+N.join(",\n"+i)+"\n"+P+"]":"["+N.join(",")+"]":"[]"}else d(n||s,function(e){var t=R(e,s,r,n,o,i,a);t!==m&&N.push(F(e)+":"+(o?" ":"")+t)}),$=N.length?o?"{\n"+i+N.join(",\n"+i)+"\n"+P+"}":"{"+N.join(",")+"}":"{}";return a.pop(),$}};n.stringify=function(e,t,n){var o,i,a,s;if(r[typeof t]&&t)if((s=v.call(t))==w)i=t;else if(s==O){a={};for(var u,c=0,l=t.length;l>c;u=t[c++],s=v.call(u),(s==S||s==C)&&(a[u]=1));}if(n)if((s=v.call(n))==C){if((n-=n%1)>0)for(o="",n>10&&(n=10);o.length$;)switch(o=i.charCodeAt($)){case 9:case 10:case 13:case 32:$++;break;case 123:case 125:case 91:case 93:case 58:case 44:return e=N?i.charAt($):i[$],$++,e;case 34:for(e="@",$++;a>$;)if(o=i.charCodeAt($),32>o)q();else if(92==o)switch(o=i.charCodeAt(++$)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:e+=I[o],$++;break;case 117:for(t=++$,r=$+4;r>$;$++)o=i.charCodeAt($),o>=48&&57>=o||o>=97&&102>=o||o>=65&&70>=o||q();e+=U("0x"+i.slice(t,$));break;default:q()}else{if(34==o)break;for(o=i.charCodeAt($),t=$;o>=32&&92!=o&&34!=o;)o=i.charCodeAt(++$);e+=i.slice(t,$)}if(34==i.charCodeAt($))return $++,e;q();default:if(t=$,45==o&&(n=!0,o=i.charCodeAt(++$)),o>=48&&57>=o){for(48==o&&(o=i.charCodeAt($+1),o>=48&&57>=o)&&q(),n=!1;a>$&&(o=i.charCodeAt($),o>=48&&57>=o);$++);if(46==i.charCodeAt($)){for(r=++$;a>r&&(o=i.charCodeAt(r),o>=48&&57>=o);r++);r==$&&q(),$=r}if(o=i.charCodeAt($),101==o||69==o){for(o=i.charCodeAt(++$),(43==o||45==o)&&$++,r=$;a>r&&(o=i.charCodeAt(r),o>=48&&57>=o);r++);r==$&&q(),$=r}return+i.slice(t,$)}if(n&&q(),"true"==i.slice($,$+4))return $+=4,!0;if("false"==i.slice($,$+5))return $+=5,!1;if("null"==i.slice($,$+4))return $+=4,null;q()}return"$"},D=function(e){var t,r;if("$"==e&&q(),"string"==typeof e){if("@"==(N?e.charAt(0):e[0]))return e.slice(1);if("["==e){for(t=[];e=J(),"]"!=e;r||(r=!0))r&&(","==e?(e=J(),"]"==e&&q()):q()),","==e&&q(),t.push(D(e));return t}if("{"==e){for(t={};e=J(),"}"!=e;r||(r=!0))r&&(","==e?(e=J(),"}"==e&&q()):q()),(","==e||"string"!=typeof e||"@"!=(N?e.charAt(0):e[0])||":"!=J())&&q(),t[e.slice(1)]=D(J());return t}q()}return e},B=function(e,t,r){var n=Z(e,t,r);n===m?delete e[t]:e[t]=n},Z=function(e,t,r){var n,o=e[t];if("object"==typeof o&&o)if(v.call(o)==O)for(n=o.length;n--;)B(o,n,r);else d(o,function(e){B(o,e,r)});return r.call(e,t,o)};n.parse=function(e,t){var r,n;return $=0,G=""+e,r=D(J()),"$"!=J()&&q(),$=G=null,t&&v.call(t)==w?Z((n={},n[""]=r,n),"",t):r}}}return n.runInContext=e,n}var t="function"==typeof define&&define.amd,r={"function":!0,object:!0},n=r[typeof exports]&&exports&&!exports.nodeType&&exports,o=r[typeof window]&&window||this,i=n&&r[typeof module]&&module&&!module.nodeType&&"object"==typeof global&&global;if(!i||i.global!==i&&i.window!==i&&i.self!==i||(o=i),n&&!t)e(o,n);else{var a=o.JSON,s=o.JSON3,u=!1,c=e(o,o.JSON3={noConflict:function(){return u||(u=!0,o.JSON=a,o.JSON3=s,a=s=null),c}});o.JSON={parse:c.parse,stringify:c.stringify}}t&&define(function(){return c})}.call(this),"undefined"==typeof Promise&&ES6Promise.polyfill(),Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),r=this,n=function(){},o=function(){return r.apply(this instanceof n&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};return n.prototype=this.prototype,o.prototype=new n,o}),Array.prototype.map||(Array.prototype.map=function(e,t){if(void 0===this||null===this)throw new TypeError("this is null or not defined");var r,n=Object(this),o=n.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");arguments.length>1&&(r=t);for(var i=new Array(o),a=0;o>a;){var s,u;a in n&&(s=n[a],u=e.call(r,s,a,n),i[a]=u),a++}return i}),Array.prototype.filter||(Array.prototype.filter=function(e){if(void 0===this||null===this)throw new TypeError("this is null or not defined");var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(var n=[],o=arguments.length>=2?arguments[1]:void 0,i=0;r>i;i++)if(i in t){var a=t[i];e.call(o,a,i,t)&&n.push(a)}return n}),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){var r,n;if(null===this||void 0===this)throw new TypeError(" this is null or not defined");var o=Object(this),i=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(r=t),n=0;i>n;){var a;n in o&&(a=o[n],e.call(r,a,n,o)),n++}}),!function(e,t){"use strict";"function"==typeof define&&define.amd?define("stackframe",[],t):"object"==typeof exports?module.exports=t():e.StackFrame=t()}(this,function(){"use strict";function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e,t,r,n,o){void 0!==e&&this.setFunctionName(e),void 0!==t&&this.setArgs(t),void 0!==r&&this.setFileName(r),void 0!==n&&this.setLineNumber(n),void 0!==o&&this.setColumnNumber(o)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(e){this.functionName=String(e)},getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getFileName:function(){return this.fileName},setFileName:function(e){this.fileName=String(e)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},toString:function(){var t=this.getFunctionName()||"{anonymous}",r="("+(this.getArgs()||[]).join(",")+")",n=this.getFileName()?"@"+this.getFileName():"",o=e(this.getLineNumber())?":"+this.getLineNumber():"",i=e(this.getColumnNumber())?":"+this.getColumnNumber():"";return t+r+n+o+i}},t});var SourceMap=function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var n;n=function(e,t,n){function o(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=i.getArg(t,"version"),n=i.getArg(t,"sources"),o=i.getArg(t,"names",[]),a=i.getArg(t,"sourceRoot",null),u=i.getArg(t,"sourcesContent",null),c=i.getArg(t,"mappings"),l=i.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);n=n.map(i.normalize),this._names=s.fromArray(o,!0),this._sources=s.fromArray(n,!0),this.sourceRoot=a,this.sourcesContent=u,this._mappings=c,this.file=l}var i=r(1),a=r(2),s=r(3).ArraySet,u=r(4);o.fromSourceMap=function(e){var t=Object.create(o.prototype);return t._names=s.fromArray(e._names.toArray(),!0),t._sources=s.fromArray(e._sources.toArray(),!0),t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file,t.__generatedMappings=e._mappings.toArray().slice(),t.__originalMappings=e._mappings.toArray().slice().sort(i.compareByOriginalPositions),t},o.prototype._version=3,Object.defineProperty(o.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?i.join(this.sourceRoot,e):e},this)}}),o.prototype.__generatedMappings=null,Object.defineProperty(o.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||(this.__generatedMappings=[],this.__originalMappings=[],this._parseMappings(this._mappings,this.sourceRoot)),this.__generatedMappings}}),o.prototype.__originalMappings=null,Object.defineProperty(o.prototype,"_originalMappings",{get:function(){return this.__originalMappings||(this.__generatedMappings=[],this.__originalMappings=[],this._parseMappings(this._mappings,this.sourceRoot)),this.__originalMappings}}),o.prototype._nextCharIsMappingSeparator=function(e){var t=e.charAt(0);return";"===t||","===t},o.prototype._parseMappings=function(e,t){for(var r,n=1,o=0,a=0,s=0,c=0,l=0,f=e,p={};f.length>0;)if(";"===f.charAt(0))n++,f=f.slice(1),o=0;else if(","===f.charAt(0))f=f.slice(1);else{if(r={},r.generatedLine=n,u.decode(f,p),r.generatedColumn=o+p.value,o=r.generatedColumn,f=p.rest,f.length>0&&!this._nextCharIsMappingSeparator(f)){if(u.decode(f,p),r.source=this._sources.at(c+p.value),c+=p.value,f=p.rest,0===f.length||this._nextCharIsMappingSeparator(f))throw new Error("Found a source, but no line and column");if(u.decode(f,p),r.originalLine=a+p.value,a=r.originalLine,r.originalLine+=1,f=p.rest,0===f.length||this._nextCharIsMappingSeparator(f))throw new Error("Found a source and line, but no column");u.decode(f,p),r.originalColumn=s+p.value,s=r.originalColumn,f=p.rest,f.length>0&&!this._nextCharIsMappingSeparator(f)&&(u.decode(f,p),r.name=this._names.at(l+p.value),l+=p.value,f=p.rest)}this.__generatedMappings.push(r),"number"==typeof r.originalLine&&this.__originalMappings.push(r)}this.__generatedMappings.sort(i.compareByGeneratedPositions),this.__originalMappings.sort(i.compareByOriginalPositions)},o.prototype._findMapping=function(e,t,r,n,o){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return a.search(e,t,o)},o.prototype.computeColumnSpans=function(){for(var e=0;e=0){var n=this._generatedMappings[r];if(n.generatedLine===t.generatedLine){var o=i.getArg(n,"source",null);return null!=o&&null!=this.sourceRoot&&(o=i.join(this.sourceRoot,o)),{source:o,line:i.getArg(n,"originalLine",null),column:i.getArg(n,"originalColumn",null),name:i.getArg(n,"name",null)}}}return{source:null,line:null,column:null,name:null}},o.prototype.sourceContentFor=function(e){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=i.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var t;if(null!=this.sourceRoot&&(t=i.urlParse(this.sourceRoot))){var r=e.replace(/^file:\/\//,"");if("file"==t.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!t.path||"/"==t.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}throw new Error('"'+e+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(e){var t={source:i.getArg(e,"source"),originalLine:i.getArg(e,"line"),originalColumn:i.getArg(e,"column")};null!=this.sourceRoot&&(t.source=i.relative(this.sourceRoot,t.source));var r=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions);if(r>=0){var n=this._originalMappings[r];return{line:i.getArg(n,"generatedLine",null),column:i.getArg(n,"generatedColumn",null),lastColumn:i.getArg(n,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},o.prototype.allGeneratedPositionsFor=function(e){var t={source:i.getArg(e,"source"),originalLine:i.getArg(e,"line"),originalColumn:1/0};null!=this.sourceRoot&&(t.source=i.relative(this.sourceRoot,t.source));var r=[],n=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions);if(n>=0)for(var o=this._originalMappings[n];o&&o.originalLine===t.originalLine;)r.push({line:i.getArg(o,"generatedLine",null),column:i.getArg(o,"generatedColumn",null),lastColumn:i.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[--n];return r.reverse()},o.GENERATED_ORDER=1,o.ORIGINAL_ORDER=2,o.prototype.eachMapping=function(e,t,r){var n,a=t||null,s=r||o.GENERATED_ORDER;switch(s){case o.GENERATED_ORDER:n=this._generatedMappings;break;case o.ORIGINAL_ORDER:n=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;n.map(function(e){var t=e.source;return null!=t&&null!=u&&(t=i.join(u,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name}}).forEach(e,a)},t.SourceMapConsumer=o}.call(t,r,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,r){var n;n=function(e,t,r){function n(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}function o(e){var t=e.match(g);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function i(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function a(e){var t=e,r=o(e);if(r){if(!r.path)return e;t=r.path}for(var n,a="/"===t.charAt(0),s=t.split(/\/+/),u=0,c=s.length-1;c>=0;c--)n=s[c],"."===n?s.splice(c,1):".."===n?u++:u>0&&(""===n?(s.splice(c+1,u),u=0):(s.splice(c,2),u--));return t=s.join("/"),""===t&&(t=a?"/":"."),r?(r.path=t,i(r)):t}function s(e,t){""===e&&(e="."),""===t&&(t=".");var r=o(t),n=o(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),i(r);if(r||t.match(d))return t;if(n&&!n.host&&!n.path)return n.host=t,i(n);var s="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=s,i(n)):s}function u(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");var r=o(e);return"/"==t.charAt(0)&&r&&"/"==r.path?t.slice(1):0===t.indexOf(e+"/")?t.substr(e.length+1):t}function c(e){return"$"+e}function l(e){return e.substr(1)}function f(e,t){var r=e||"",n=t||"";return(r>n)-(n>r)}function p(e,t,r){var n;return(n=f(e.source,t.source))?n:(n=e.originalLine-t.originalLine)?n:(n=e.originalColumn-t.originalColumn,n||r?n:(n=f(e.name,t.name))?n:(n=e.generatedLine-t.generatedLine,n?n:e.generatedColumn-t.generatedColumn))}function h(e,t,r){var n;return(n=e.generatedLine-t.generatedLine)?n:(n=e.generatedColumn-t.generatedColumn,n||r?n:(n=f(e.source,t.source))?n:(n=e.originalLine-t.originalLine)?n:(n=e.originalColumn-t.originalColumn,n?n:f(e.name,t.name)))}t.getArg=n;var g=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,d=/^data:.+\,.+$/;t.urlParse=o,t.urlGenerate=i,t.normalize=a,t.join=s,t.relative=u,t.toSetString=c,t.fromSetString=l,t.compareByOriginalPositions=p,t.compareByGeneratedPositions=h}.call(t,r,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,r){var n;n=function(e,t,r){function n(e,t,r,o,i){var a=Math.floor((t-e)/2)+e,s=i(r,o[a],!0);return 0===s?a:s>0?t-a>1?n(a,t,r,o,i):a:a-e>1?n(e,a,r,o,i):0>e?-1:e}t.search=function(e,t,r){return 0===t.length?-1:n(-1,t.length,e,t,r)}}.call(t,r,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,r){var n;n=function(e,t,n){function o(){this._array=[],this._set={}}var i=r(1);o.fromArray=function(e,t){for(var r=new o,n=0,i=e.length;i>n;n++)r.add(e[n],t);return r},o.prototype.add=function(e,t){var r=this.has(e),n=this._array.length;(!r||t)&&this._array.push(e),r||(this._set[i.toSetString(e)]=n)},o.prototype.has=function(e){return Object.prototype.hasOwnProperty.call(this._set,i.toSetString(e))},o.prototype.indexOf=function(e){if(this.has(e))return this._set[i.toSetString(e)];throw new Error('"'+e+'" is not in the set.')},o.prototype.at=function(e){if(e>=0&&ee?(-e<<1)+1:(e<<1)+0}function i(e){var t=1===(1&e),r=e>>1;return t?-r:r}var a=r(5),s=5,u=1<>>=s,n>0&&(t|=l),r+=a.encode(t);while(n>0);return r},t.decode=function(e,t){var r,n,o=0,u=e.length,f=0,p=0;do{if(o>=u)throw new Error("Expected more digits in base 64 VLQ value.");n=a.decode(e.charAt(o++)),r=!!(n&l),n&=c,f+=n<=200&&o.status<400)return t(o.responseText);n(new Error("Unable to retrieve "+e))}},o.send()}function o(e,t,r){for(var n,o,i,a=/function\s+([^(]*?)\s*\(([^)]*)\)/,s=/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*function\b/,u=/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*(?:eval|new Function)\b/,c=e.split("\n"),l="",f=Math.min(t,20),p=0;f>p;++p)if(n=c[t-p-1],i=n.indexOf("//"),i>=0&&(n=n.substr(0,i)),n){if(l=n+l,o=s.exec(l),o&&o[1])return o[1];if(o=a.exec(l),o&&o[1])return o[1];if(o=u.exec(l),o&&o[1])return o[1]}return void 0}function i(){if("function"!=typeof Object.defineProperty||"function"!=typeof Object.create)throw new Error("Unable to consume source maps in older browsers")}function a(e){if("object"!=typeof e)throw new TypeError("Given StackFrame is not an object");if("string"!=typeof e.fileName)throw new TypeError("Given file name is not a String");if("number"!=typeof e.lineNumber||e.lineNumber%1!==0||e.lineNumber<1)throw new TypeError("Given line number must be a positive integer");if("number"!=typeof e.columnNumber||e.columnNumber%1!==0||e.columnNumber<0)throw new TypeError("Given column number must be a non-negative integer");return!0}function s(e){var t=/\/\/[#@] ?sourceMappingURL=([^\s'"]+)$/.exec(e);if(t&&t[1])return t[1];throw new Error("sourceMappingURL not found")}function u(r,n,o,i){var a=new e.SourceMapConsumer(r).originalPositionFor({line:o,column:i});return new t(a.name,n,a.source,a.line,a.column)}return function c(e){return this instanceof c?(e=e||{},this.sourceCache=e.sourceCache||{},this.ajax=n,this._atob=function(e){if(window&&window.atob)return window.atob(e);if("undefined"!=typeof Buffer)return new Buffer(e,"base64").toString("utf-8");throw new Error("No base64 decoder available")},this._get=function(t){return new Promise(function(r,n){var o="data:"===t.substr(0,5);if(this.sourceCache[t])r(this.sourceCache[t]);else if(e.offline&&!o)n(new Error("Cannot make network requests in offline mode"));else if(o){var i="application/json;base64";if(t.substr(5,i.length)!==i)n(new Error("The encoding of the inline sourcemap is not supported"));else{var a="data:".length+i.length+",".length,s=t.substr(a),u=this._atob(s);this.sourceCache[t]=u,r(u)}}else this.ajax(t,function(e){this.sourceCache[t]=e,r(e)}.bind(this),n)}.bind(this))},this.pinpoint=function(e){return new Promise(function(t,r){this.getMappedLocation(e).then(function(e){function r(){t(e)}this.findFunctionName(e).then(t,r)["catch"](r)}.bind(this),r)}.bind(this))},this.findFunctionName=function(e){return new Promise(function(r,n){a(e),this._get(e.fileName).then(function(n){var i=o(n,e.lineNumber,e.columnNumber);r(new t(i,e.args,e.fileName,e.lineNumber,e.columnNumber))},n)}.bind(this))},void(this.getMappedLocation=function(e){return new Promise(function(t,r){i(),a(e);var n=e.fileName;this._get(n).then(function(o){var i=s(o);"/"!==i[0]&&(i=n.substring(0,n.lastIndexOf("/")+1)+i),this._get(i).then(function(r){var n=e.lineNumber,o=e.columnNumber;t(u(r,e.args,n,o))},r)["catch"](r)}.bind(this),r)["catch"](r)}.bind(this))})):new c(e)}}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("stack-generator",["stackframe"],t):"object"==typeof exports?module.exports=t(require("stackframe")):e.StackGenerator=t(e.StackFrame)}(this,function(e){return{backtrace:function(t){var r=[],n=10;"object"==typeof t&&"number"==typeof t.maxStackSize&&(n=t.maxStackSize);for(var o=arguments.callee;o&&r.length-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),o=[],i=2,a=n.length;a>i;i+=2){var s=r.exec(n[i]);s&&o.push(new e(void 0,void 0,s[2],s[1],void 0,n[i]))}return o},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),o=[],i=0,a=n.length;a>i;i+=2){var s=r.exec(n[i]);s&&o.push(new e(s[3]||void 0,void 0,s[2],s[1],void 0,n[i]))}return o},parseOpera11:function(r){return r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,n=t.split("@"),o=this.extractLocation(n.pop()),i=n.shift()||"",a=i.replace(//,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(r=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e(a,s,o[0],o[1],o[2],t)},this)}}}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("stacktrace",["error-stack-parser","stack-generator","stacktrace-gps"],t):"object"==typeof exports?module.exports=t(require("error-stack-parser"),require("stack-generator"),require("stacktrace-gps")):e.StackTrace=t(e.ErrorStackParser,e.StackGenerator,e.StackTraceGPS)}(this,function(e,t,r){function n(e,t){var r={};return[e,t].forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}),r}function o(e){return e.stack||e["opera#sourceloc"]}var i={filter:function(e){return-1===(e.functionName||"").indexOf("StackTrace$$")&&-1===(e.functionName||"").indexOf("ErrorStackParser$$")&&-1===(e.functionName||"").indexOf("StackTraceGPS$$")&&-1===(e.functionName||"").indexOf("StackGenerator$$")}};return{get:function(e){try{throw new Error}catch(t){return o(t)?this.fromError(t,e):this.generateArtificially(e)}},fromError:function(t,o){return o=n(i,o),new Promise(function(n){var i=e.parse(t);"function"==typeof o.filter&&(i=i.filter(o.filter)),n(Promise.all(i.map(function(e){return new Promise(function(t){function n(r){t(e)}new r(o).pinpoint(e).then(t,n)["catch"](n)})})))}.bind(this))},generateArtificially:function(e){e=n(i,e);var r=t.backtrace(e);return"function"==typeof e.filter&&(r=r.filter(e.filter)),Promise.resolve(r)},instrument:function(e,t,r,n){if("function"!=typeof e)throw new Error("Cannot instrument non-function object");if("function"==typeof e.__stacktraceOriginalFn)return e;var i=function(){try{this.get().then(t,r)["catch"](r),e.apply(n||this,arguments)}catch(i){throw o(i)&&this.fromError(i).then(t,r)["catch"](r),i}}.bind(this);return i.__stacktraceOriginalFn=e,i},deinstrument:function(e){if("function"!=typeof e)throw new Error("Cannot de-instrument non-function object");return"function"==typeof e.__stacktraceOriginalFn?e.__stacktraceOriginalFn:e},report:function(e,t){return new Promise(function(r,n){var o=new XMLHttpRequest;o.onerror=n,o.onreadystatechange=function(){4===o.readyState&&(o.status>=200&&o.status<400?r(o.responseText):n(new Error("POST to "+t+" failed with status: "+o.status)))},o.open("post",t),o.setRequestHeader("Content-Type","application/json"),o.send(JSON.stringify({stack:e}))})}}}); //# sourceMappingURL=vendor/stacktrace-js/dist/stacktrace-with-polyfills.min.js.map -/** - * Lightbox v2.7.1 - * by Lokesh Dhakar - http://lokeshdhakar.com/projects/lightbox2/ - * - * @license http://creativecommons.org/licenses/by/2.5/ - * - Free for use in both personal and commercial projects - * - Attribution requires leaving author name, author link, and the license info intact - */ -(function(){var a=jQuery,b=function(){function a(){this.fadeDuration=500,this.fitImagesInViewport=!0,this.resizeDuration=700,this.positionFromTop=50,this.showImageNumberLabel=!0,this.alwaysShowNavOnTouchDevices=!1,this.wrapAround=!1}return a.prototype.albumLabel=function(a,b){return"Image "+a+" of "+b},a}(),c=function(){function b(a){this.options=a,this.album=[],this.currentImageIndex=void 0,this.init()}return b.prototype.init=function(){this.enable(),this.build()},b.prototype.enable=function(){var b=this;a("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(c){return b.start(a(c.currentTarget)),!1})},b.prototype.build=function(){var b=this;a("
").appendTo(a("body")),this.$lightbox=a("#lightbox"),this.$overlay=a("#lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".lb-outerContainer"),this.$container=this.$lightbox.find(".lb-container"),this.containerTopPadding=parseInt(this.$container.css("padding-top"),10),this.containerRightPadding=parseInt(this.$container.css("padding-right"),10),this.containerBottomPadding=parseInt(this.$container.css("padding-bottom"),10),this.containerLeftPadding=parseInt(this.$container.css("padding-left"),10),this.$overlay.hide().on("click",function(){return b.end(),!1}),this.$lightbox.hide().on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),this.$outerContainer.on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return b.changeImage(0===b.currentImageIndex?b.album.length-1:b.currentImageIndex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return b.changeImage(b.currentImageIndex===b.album.length-1?0:b.currentImageIndex+1),!1}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return b.end(),!1})},b.prototype.start=function(b){function c(a){d.album.push({link:a.attr("href"),title:a.attr("data-title")||a.attr("title")})}var d=this,e=a(window);e.on("resize",a.proxy(this.sizeOverlay,this)),a("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var f,g=0,h=b.attr("data-lightbox");if(h){f=a(b.prop("tagName")+'[data-lightbox="'+h+'"]');for(var i=0;ij||e.height>i)&&(e.width/j>e.height/i?(h=j,g=parseInt(e.height/(e.width/h),10),d.width(h),d.height(g)):(g=i,h=parseInt(e.width/(e.height/g),10),d.width(h),d.height(g)))),c.sizeContainer(d.width(),d.height())},e.src=this.album[b].link,this.currentImageIndex=b},b.prototype.sizeOverlay=function(){this.$overlay.width(a(window).width()).height(a(document).height())},b.prototype.sizeContainer=function(a,b){function c(){d.$lightbox.find(".lb-dataContainer").width(g),d.$lightbox.find(".lb-prevLink").height(h),d.$lightbox.find(".lb-nextLink").height(h),d.showImage()}var d=this,e=this.$outerContainer.outerWidth(),f=this.$outerContainer.outerHeight(),g=a+this.containerLeftPadding+this.containerRightPadding,h=b+this.containerTopPadding+this.containerBottomPadding;e!==g||f!==h?this.$outerContainer.animate({width:g,height:h},this.options.resizeDuration,"swing",function(){c()}):c()},b.prototype.showImage=function(){this.$lightbox.find(".lb-loader").hide(),this.$lightbox.find(".lb-image").fadeIn("slow"),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},b.prototype.updateNav=function(){var a=!1;try{document.createEvent("TouchEvent"),a=this.options.alwaysShowNavOnTouchDevices?!0:!1}catch(b){}this.$lightbox.find(".lb-nav").show(),this.album.length>1&&(this.options.wrapAround?(a&&this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(this.currentImageIndex>0&&(this.$lightbox.find(".lb-prev").show(),a&&this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentImageIndex1&&this.options.showImageNumberLabel?this.$lightbox.find(".lb-number").text(this.options.albumLabel(this.currentImageIndex+1,this.album.length)).fadeIn("fast"):this.$lightbox.find(".lb-number").hide(),this.$outerContainer.removeClass("animating"),this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return b.sizeOverlay()})},b.prototype.preloadNeighboringImages=function(){if(this.album.length>this.currentImageIndex+1){var a=new Image;a.src=this.album[this.currentImageIndex+1].link}if(this.currentImageIndex>0){var b=new Image;b.src=this.album[this.currentImageIndex-1].link}},b.prototype.enableKeyboardNav=function(){a(document).on("keyup.keyboard",a.proxy(this.keyboardAction,this))},b.prototype.disableKeyboardNav=function(){a(document).off(".keyboard")},b.prototype.keyboardAction=function(a){var b=27,c=37,d=39,e=a.keyCode,f=String.fromCharCode(e).toLowerCase();e===b||f.match(/x|o|c/)?this.end():"p"===f||e===c?0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&this.album.length>1&&this.changeImage(this.album.length-1):("n"===f||e===d)&&(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&this.album.length>1&&this.changeImage(0))},b.prototype.end=function(){this.disableKeyboardNav(),a(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),a("select, object, embed").css({visibility:"visible"})},b}();a(function(){{var a=new b;new c(a)}})}).call(this); /* ============================================================= * bootstrap-combobox.js v1.1.5 * ============================================================= @@ -30842,6 +30833,11 @@ function truncate(str, length) { return (str && str.length > length) ? (str.substr(0, length-1) + '...') : str; } +// http://stackoverflow.com/questions/280634/endswith-in-javascript +function endsWith(str, suffix) { + return str.indexOf(suffix, str.length - suffix.length) !== -1; +} + // http://codeaid.net/javascript/convert-seconds-to-hours-minutes-and-seconds-%28javascript%29 function secondsToTime(secs) { @@ -30874,6 +30870,11 @@ function toSnakeCase(str) { return str.replace(/([A-Z])/g, function($1){return "_"+$1.toLowerCase();}); } +// https://coderwall.com/p/iprsng/convert-snake-case-to-camelcase +function snakeToCamel(s){ + return s.replace(/_([a-z])/g, function (g) { return g[1].toUpperCase(); }); +} + function getDescendantProp(obj, desc) { var arr = desc.split("."); while(arr.length && (obj = obj[arr.shift()])); @@ -30882,6 +30883,7 @@ function getDescendantProp(obj, desc) { function doubleDollarSign(str) { if (!str) return ''; + if (!str.replace) return str; return str.replace(/\$/g, '\$\$\$'); } @@ -30907,6 +30909,37 @@ function actionListHandler() { }); } +function loadImages(selector) { + $(selector + ' img').each(function(index, item) { + var src = $(item).attr('data-src'); + $(item).attr('src', src); + $(item).attr('data-src', src); + }); +} + +// http://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript +function prettyJson(json) { + if (typeof json != 'string') { + json = JSON.stringify(json, undefined, 2); + } + json = json.replace(/&/g, '&').replace(//g, '>'); + return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { + var cls = 'number'; + if (/^"/.test(match)) { + if (/:$/.test(match)) { + cls = 'key'; + } else { + cls = 'string'; + } + } else if (/true|false/.test(match)) { + cls = 'boolean'; + } else if (/null/.test(match)) { + cls = 'null'; + } + match = snakeToCamel(match); + return '' + match + ''; + }); +} var NINJA = NINJA || {}; NINJA.TEMPLATES = { @@ -31118,18 +31151,28 @@ NINJA.decodeJavascript = function(invoice, javascript) } // search/replace values - var regExp = new RegExp('"\\$[\\\w\\\.]*?Value"', 'g'); + var regExp = new RegExp('"\\$[a-z][\\\w\\\.]*?[Value]?"', 'g'); var matches = javascript.match(regExp); - + if (matches) { for (var i=0; i= 0) { + continue; + } + + // legacy style had 'Value' at the end + if (endsWith(match, 'Value"')) { + field = match.substring(2, match.indexOf('Value')); + } else { + field = match.substring(2, match.length - 1); + } field = toSnakeCase(field); - + var value = getDescendantProp(invoice, field) || ' '; value = doubleDollarSign(value); - javascript = javascript.replace(match, '"'+value+'"'); } } diff --git a/public/css/built.css b/public/css/built.css index 5a511b0f1f..763b433e6a 100644 --- a/public/css/built.css +++ b/public/css/built.css @@ -2138,217 +2138,6 @@ See http://bgrins.github.io/spectrum/themes/ for instructions. border-radius: 6px; line-height: 1.33; } -/* Preload images */ -body:after { - content: url(../images/lightbox/close.png) url(../images/lightbox/loading.gif) url(../images/lightbox/prev.png) url(../images/lightbox/next.png); - display: none; -} - -.lightboxOverlay { - position: absolute; - top: 0; - left: 0; - z-index: 9999; - background-color: black; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); - opacity: 0.8; - display: none; -} - -.lightbox { - position: absolute; - left: 0; - width: 100%; - z-index: 10000; - text-align: center; - line-height: 0; - font-weight: normal; -} - -.lightbox .lb-image { - display: block; - height: auto; - max-width: inherit; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -ms-border-radius: 3px; - -o-border-radius: 3px; - border-radius: 3px; -} - -.lightbox a img { - border: none; -} - -.lb-outerContainer { - position: relative; - background-color: white; - *zoom: 1; - width: 250px; - height: 250px; - margin: 0 auto; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - -ms-border-radius: 4px; - -o-border-radius: 4px; - border-radius: 4px; -} - -.lb-outerContainer:after { - content: ""; - display: table; - clear: both; -} - -.lb-container { - padding: 4px; -} - -.lb-loader { - position: absolute; - top: 43%; - left: 0; - height: 25%; - width: 100%; - text-align: center; - line-height: 0; -} - -.lb-cancel { - display: block; - width: 32px; - height: 32px; - margin: 0 auto; - background: url(../images/lightbox/loading.gif) no-repeat; -} - -.lb-nav { - position: absolute; - top: 0; - left: 0; - height: 100%; - width: 100%; - z-index: 10; -} - -.lb-container > .nav { - left: 0; -} - -.lb-nav a { - outline: none; - background-image: url('data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='); -} - -.lb-prev, .lb-next { - height: 100%; - cursor: pointer; - display: block; -} - -.lb-nav a.lb-prev { - width: 34%; - left: 0; - float: left; - background: url(../images/lightbox/prev.png) left 48% no-repeat; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); - opacity: 0; - -webkit-transition: opacity 0.6s; - -moz-transition: opacity 0.6s; - -o-transition: opacity 0.6s; - transition: opacity 0.6s; -} - -.lb-nav a.lb-prev:hover { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); - opacity: 1; -} - -.lb-nav a.lb-next { - width: 64%; - right: 0; - float: right; - background: url(../images/lightbox/next.png) right 48% no-repeat; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); - opacity: 0; - -webkit-transition: opacity 0.6s; - -moz-transition: opacity 0.6s; - -o-transition: opacity 0.6s; - transition: opacity 0.6s; -} - -.lb-nav a.lb-next:hover { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); - opacity: 1; -} - -.lb-dataContainer { - margin: 0 auto; - padding-top: 5px; - *zoom: 1; - width: 100%; - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; - border-bottom-right-radius: 4px; -} - -.lb-dataContainer:after { - content: ""; - display: table; - clear: both; -} - -.lb-data { - padding: 0 4px; - color: #ccc; -} - -.lb-data .lb-details { - width: 85%; - float: left; - text-align: left; - line-height: 1.1em; -} - -.lb-data .lb-caption { - font-size: 13px; - font-weight: bold; - line-height: 1em; -} - -.lb-data .lb-number { - display: block; - clear: left; - padding-bottom: 1em; - font-size: 12px; - color: #999999; -} - -.lb-data .lb-close { - display: block; - float: right; - width: 30px; - height: 30px; - background: url(../images/lightbox/close.png) top right no-repeat; - text-align: right; - outline: none; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70); - opacity: 0.7; - -webkit-transition: opacity 0.2s; - -moz-transition: opacity 0.2s; - -o-transition: opacity 0.2s; - transition: opacity 0.2s; -} - -.lb-data .lb-close:hover { - cursor: pointer; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); - opacity: 1; -} - body { background: #f8f8f8 !important; font-family: 'Roboto', sans-serif; font-size: 15px; diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index 58ddd24d2d..a5b9ca6815 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -209,18 +209,28 @@ NINJA.decodeJavascript = function(invoice, javascript) } // search/replace values - var regExp = new RegExp('"\\$[\\\w\\\.]*?Value"', 'g'); + var regExp = new RegExp('"\\$[a-z][\\\w\\\.]*?[Value]?"', 'g'); var matches = javascript.match(regExp); - + if (matches) { for (var i=0; i= 0) { + continue; + } + + // legacy style had 'Value' at the end + if (endsWith(match, 'Value"')) { + field = match.substring(2, match.indexOf('Value')); + } else { + field = match.substring(2, match.length - 1); + } field = toSnakeCase(field); - + var value = getDescendantProp(invoice, field) || ' '; value = doubleDollarSign(value); - javascript = javascript.replace(match, '"'+value+'"'); } } diff --git a/public/js/script.js b/public/js/script.js index a98db86385..6167b8ff05 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -961,6 +961,11 @@ function truncate(str, length) { return (str && str.length > length) ? (str.substr(0, length-1) + '...') : str; } +// http://stackoverflow.com/questions/280634/endswith-in-javascript +function endsWith(str, suffix) { + return str.indexOf(suffix, str.length - suffix.length) !== -1; +} + // http://codeaid.net/javascript/convert-seconds-to-hours-minutes-and-seconds-%28javascript%29 function secondsToTime(secs) { @@ -993,6 +998,11 @@ function toSnakeCase(str) { return str.replace(/([A-Z])/g, function($1){return "_"+$1.toLowerCase();}); } +// https://coderwall.com/p/iprsng/convert-snake-case-to-camelcase +function snakeToCamel(s){ + return s.replace(/_([a-z])/g, function (g) { return g[1].toUpperCase(); }); +} + function getDescendantProp(obj, desc) { var arr = desc.split("."); while(arr.length && (obj = obj[arr.shift()])); @@ -1001,6 +1011,7 @@ function getDescendantProp(obj, desc) { function doubleDollarSign(str) { if (!str) return ''; + if (!str.replace) return str; return str.replace(/\$/g, '\$\$\$'); } @@ -1025,3 +1036,35 @@ function actionListHandler() { } }); } + +function loadImages(selector) { + $(selector + ' img').each(function(index, item) { + var src = $(item).attr('data-src'); + $(item).attr('src', src); + $(item).attr('data-src', src); + }); +} + +// http://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript +function prettyJson(json) { + if (typeof json != 'string') { + json = JSON.stringify(json, undefined, 2); + } + json = json.replace(/&/g, '&').replace(//g, '>'); + return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { + var cls = 'number'; + if (/^"/.test(match)) { + if (/:$/.test(match)) { + cls = 'key'; + } else { + cls = 'string'; + } + } else if (/true|false/.test(match)) { + cls = 'boolean'; + } else if (/null/.test(match)) { + cls = 'null'; + } + match = snakeToCamel(match); + return '' + match + ''; + }); +} \ No newline at end of file diff --git a/resources/lang/da/texts.php b/resources/lang/da/texts.php index c4522aca3b..35a559ac6a 100644 --- a/resources/lang/da/texts.php +++ b/resources/lang/da/texts.php @@ -747,8 +747,7 @@ return array( 'primary_user' => 'Primær bruger', 'help' => 'Hjælp', 'customize_help' => '

Vi bruger pdfmake til at definere faktura design felter. pdfmake legeplads giver en god mulighed for at se biblioteket i aktion.

-

Du kan tilgå alle faktura felter ved at tilføje Value til slutningen. For eksempel viser $invoiceNumberValue fakturanummeret.

-

For at tilgå under indstillingerne ved hjælp af dot notation. For eksempel kan man for at vise klient navnet bruge $client.nameValue.

+

For at tilgå under indstillingerne ved hjælp af dot notation. For eksempel kan man for at vise klient navnet bruge $client.name.

Hvis du mangler svar på nogen spørgsmål så post et spørgsmål i vores support forum.

', 'invoice_due_date' => 'Due Date', diff --git a/resources/lang/de/texts.php b/resources/lang/de/texts.php index 5fea0bf82b..3c2ec0580f 100644 --- a/resources/lang/de/texts.php +++ b/resources/lang/de/texts.php @@ -747,8 +747,7 @@ return array( 'primary_user' => 'Primärer Benutzer', 'help' => 'Hilfe', 'customize_help' => '

Wir benutzen zur deklarativen Definition der Rechnungsdesigns pdfmake. Der pdfmake playground bietet Gelegenheit die Bibliothek in Aktion zu sehen.

-

Man kann jedes Rechnungsfeld nutzen, in dem man Value hinten anhängt. Zum Beispiel zeigt $invoiceNumberValue die Rechnungsnummer.

-

Mit der dot notation kann auf Kind-Eigenschaften zugegriffen werden. Für den Kundennamen kann man zum Beispiel $client.nameValue benutzen.

+

Mit der dot notation kann auf Kind-Eigenschaften zugegriffen werden. Für den Kundennamen kann man zum Beispiel $client.name benutzen.

Wenn du Hilfe brauchst schreibe uns gern im Support Forum (Englisch).

', 'invoice_due_date' => 'Fällig am', diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index d130919802..2b4a9cd872 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -81,7 +81,7 @@ $LANG = array( 'company_details' => 'Company Details', 'online_payments' => 'Online Payments', 'notifications' => 'Email Notifications', - 'import_export' => 'Import/Export/Cancel', + 'import_export' => 'Import | Export | Cancel', 'done' => 'Done', 'save' => 'Save', 'create' => 'Create', @@ -655,8 +655,7 @@ $LANG = array( 'primary_user' => 'Primary User', 'help' => 'Help', 'customize_help' => '

We use pdfmake to define the invoice designs declaratively. The pdfmake playground provide\'s a great way to see the library in action.

-

You can access any invoice field by adding Value to the end. For example $invoiceNumberValue displays the invoice number.

-

To access a child property using dot notation. For example to show the client name you could use $client.nameValue.

+

To access a child property using dot notation. For example to show the client name you could use $client.name.

If you need help figuring something out post a question to our support forum.

', 'invoice_due_date' => 'Due Date', 'quote_due_date' => 'Valid Until', diff --git a/resources/lang/es/texts.php b/resources/lang/es/texts.php index 5639fff408..1b1f27947c 100644 --- a/resources/lang/es/texts.php +++ b/resources/lang/es/texts.php @@ -725,8 +725,7 @@ return array( 'primary_user' => 'Usuario Primario', 'help' => 'Ayuda', 'customize_help' => '

Nosotros usamos pdfmake para definir los diseños de las facturas de manera declarativa. El playground de pdfmake es una excelente manera de ver a la librería en acción.

-

Puedes acceder cualquier campo de una factura agregando Value al final. Por ejemplo, $invoiceNumberValue muestra el número de factura.

-

Para acceder a una propiedad hija usando notación de punto.Por ejemplo, para mostrar el nombre de un cliente se puede usar $client.nameValue.

+

Para acceder a una propiedad hija usando notación de punto.Por ejemplo, para mostrar el nombre de un cliente se puede usar $client.name.

Si necesitas ayuda entendiendo algo puede preguntar en nuestro foro de soporte.

', 'invoice_due_date' => 'Fecha de Vencimiento', diff --git a/resources/lang/es_ES/texts.php b/resources/lang/es_ES/texts.php index 6640183cf6..4e29075d55 100644 --- a/resources/lang/es_ES/texts.php +++ b/resources/lang/es_ES/texts.php @@ -746,8 +746,7 @@ return array( 'primary_user' => 'Usuario Principal', 'help' => 'Ayuda', 'customize_help' => '

We use pdfmake to define the invoice designs declaratively. The pdfmake playground provide\'s a great way to see the library in action.

-

You can access any invoice field by adding Value to the end. For example $invoiceNumberValue displays the invoice number.

-

To access a child property using dot notation. For example to show the client name you could use $client.nameValue.

+

To access a child property using dot notation. For example to show the client name you could use $client.name.

If you need help figuring something out post a question to our support forum.

', 'invoice_due_date' => 'Fecha de Pago', diff --git a/resources/lang/fr/texts.php b/resources/lang/fr/texts.php index f14abbe158..1572eb2191 100644 --- a/resources/lang/fr/texts.php +++ b/resources/lang/fr/texts.php @@ -738,8 +738,7 @@ return array( 'primary_user' => 'Utilisateur principal', 'help' => 'Aide', 'customize_help' => '

Nous utilisons pdfmake pour définir le design des factures. Le bac à sable de pdfmake est une bonne façon de voir cette bibliothèque en action.

-

Vous pouvez accéder à n\'importe quel champ de facture en ajoutant Value à la fin. Par exemple $invoiceNumberValue affiche le numéro de facture.

-

Pour accéder à une propriété héritée avec la notation par point. Par exemple pour montrer le nom du client vous pouvez utiliser $client.nameValue.

+

Pour accéder à une propriété héritée avec la notation par point. Par exemple pour montrer le nom du client vous pouvez utiliser $client.name.

Si vous avez besoin d\'aide pour comprendre quelque chose envoyez une question à notre forum de support.

', 'invoice_due_date' => 'Date limite', diff --git a/resources/lang/fr_CA/texts.php b/resources/lang/fr_CA/texts.php index f5deda9ded..946fac0696 100644 --- a/resources/lang/fr_CA/texts.php +++ b/resources/lang/fr_CA/texts.php @@ -741,8 +741,7 @@ return array( 'primary_user' => 'Utilisateur principal', 'help' => 'Aide', 'customize_help' => '

Nous utilisons pdfmake pour définir le design des factures de façon déclarative. L\'environnement pdfmake permet de voir la librairie en action.

-

Vous pouvez accéder à n\'importe quel champ de facture en ajoutant Value à la fin. Par exemple $invoiceNumberValue affiche le numéro de facture.

-

Pour accéder à une propriété enfant en utilisant la notation par point. Par exemple $client.nameValueaffiche le nom du client.

+

Pour accéder à une propriété enfant en utilisant la notation par point. Par exemple $client.nameaffiche le nom du client.

Si vous avez besoin d\'aide à cet effet, n\'hésitez pas à publier une question sur notre forum d\'aide (en anglais).

', 'invoice_due_date' => 'Échéance', diff --git a/resources/lang/it/texts.php b/resources/lang/it/texts.php index 3af6cf3416..5c358ae626 100644 --- a/resources/lang/it/texts.php +++ b/resources/lang/it/texts.php @@ -743,8 +743,7 @@ return array( 'primary_user' => 'Primary User', 'help' => 'Help', 'customize_help' => '

We use pdfmake to define the invoice designs declaratively. The pdfmake playground provide\'s a great way to see the library in action.

-

You can access any invoice field by adding Value to the end. For example $invoiceNumberValue displays the invoice number.

-

To access a child property using dot notation. For example to show the client name you could use $client.nameValue.

+

To access a child property using dot notation. For example to show the client name you could use $client.name.

If you need help figuring something out post a question to our support forum.

', 'invoice_due_date' => 'Due Date', diff --git a/resources/lang/lt/texts.php b/resources/lang/lt/texts.php index 1da6b841fd..4dc55e9e5e 100644 --- a/resources/lang/lt/texts.php +++ b/resources/lang/lt/texts.php @@ -750,8 +750,7 @@ return array( 'primary_user' => 'Primary User', 'help' => 'Help', 'customize_help' => '

We use pdfmake to define the invoice designs declaratively. The pdfmake playground provide\'s a great way to see the library in action.

-

You can access any invoice field by adding Value to the end. For example $invoiceNumberValue displays the invoice number.

-

To access a child property using dot notation. For example to show the client name you could use $client.nameValue.

+

To access a child property using dot notation. For example to show the client name you could use $client.name.

If you need help figuring something out post a question to our support forum.

', 'invoice_due_date' => 'Due Date', diff --git a/resources/lang/nb_NO/texts.php b/resources/lang/nb_NO/texts.php index e232d9fa4b..875df81d46 100644 --- a/resources/lang/nb_NO/texts.php +++ b/resources/lang/nb_NO/texts.php @@ -746,8 +746,7 @@ return array( 'primary_user' => 'Hovedbruker', 'help' => 'Hjelp', 'customize_help' => '

Vi bruker pdfmake for å definere faktura designene deklarativt. Pdfmake playground gir en flott måte å se biblioteket i aksjon.

-

Du kan få tilgang til hvilket som helst faktura felt ved å legge til Value i slutten. For eksempel $invoiceNumberValue viser faktura nummeret.

-

For å få tilgang til et underelementet ved bruk av prikk notasjon. For eksempel for å vise klientens navn, kan du bruke $client.nameValue.

+

For å få tilgang til et underelementet ved bruk av prikk notasjon. For eksempel for å vise klientens navn, kan du bruke $client.name.

Om du trenger hjelp til å finne ut noe, poster et spørsmål til vårt brukerforum.

', 'invoice_due_date' => 'Tidsfrist', diff --git a/resources/lang/nl/texts.php b/resources/lang/nl/texts.php index e1f3f40c16..9794f7c008 100644 --- a/resources/lang/nl/texts.php +++ b/resources/lang/nl/texts.php @@ -741,8 +741,7 @@ return array( 'primary_user' => 'Primaire gebruiker', 'help' => 'Help', 'customize_help' => '

We gebruiken pdfmake om de factuur ontwerpen declaratief te definieren. De pdfmake playground is een interessante manier om de library in actie te zien.

-

Je kan elk factuur veld gebruiken door Veld toe te voegen op het einde. Bijvoorbeeld $invoiceNumberValue toont de factuur nummer.

-

Gebruik dot notatie om een "kind eigenschap" te gebruiken. Bijvoorbeeld voor de klant naam te tonen gebruik je $client.nameValue.

+

Gebruik dot notatie om een "kind eigenschap" te gebruiken. Bijvoorbeeld voor de klant naam te tonen gebruik je $client.name.

Als je ergens hulp bij nodig hebt, post dan een vraag op ons support forum.

', 'invoice_due_date' => 'Vervaldatum', diff --git a/resources/lang/pt_BR/texts.php b/resources/lang/pt_BR/texts.php index 0c2d7d915f..731be8bbbd 100644 --- a/resources/lang/pt_BR/texts.php +++ b/resources/lang/pt_BR/texts.php @@ -739,8 +739,7 @@ return array( 'primary_user' => 'Usuário Principal', 'help' => 'Ajuda', 'customize_help' => '

We use pdfmake to define the invoice designs declaratively. The pdfmake playground provide\'s a great way to see the library in action.

-

You can access any invoice field by adding Value to the end. For example $invoiceNumberValue displays the invoice number.

-

To access a child property using dot notation. For example to show the client name you could use $client.nameValue.

+

To access a child property using dot notation. For example to show the client name you could use $client.name.

If you need help figuring something out post a question to our support forum.

', 'invoice_due_date' => 'Data de vencimento', diff --git a/resources/lang/sv/texts.php b/resources/lang/sv/texts.php index 41f51c2c8a..8f72d9bb40 100644 --- a/resources/lang/sv/texts.php +++ b/resources/lang/sv/texts.php @@ -745,8 +745,7 @@ return array( 'primary_user' => 'Primary User', 'help' => 'Help', 'customize_help' => '

We use pdfmake to define the invoice designs declaratively. The pdfmake playground provide\'s a great way to see the library in action.

-

You can access any invoice field by adding Value to the end. For example $invoiceNumberValue displays the invoice number.

-

To access a child property using dot notation. For example to show the client name you could use $client.nameValue.

+

To access a child property using dot notation. For example to show the client name you could use $client.name.

If you need help figuring something out post a question to our support forum.

', 'invoice_due_date' => 'Due Date', diff --git a/resources/views/accounts/customize_design.blade.php b/resources/views/accounts/customize_design.blade.php index f4ffa9b215..2f60a9dd97 100644 --- a/resources/views/accounts/customize_design.blade.php +++ b/resources/views/accounts/customize_design.blade.php @@ -22,6 +22,14 @@ background: #FFFFFF !important; } + /* http://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript */ + pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; } + .string { color: green; } + .number { color: red; } + .boolean { color: blue; } + .null { color: gray; } + .key { color: black; } + @stop @@ -140,8 +148,14 @@ target = target.substring(1); // strip leading # loadEditor(target); }); - + refreshPDF(true); + + @if (isset($sampleInvoice) && $sampleInvoice) + var sample = {!! $sampleInvoice->toJSON() !!} + console.log(sample); + $('#sampleData').show().html(prettyJson(sample)); + @endif }); @@ -206,6 +220,8 @@
{!! trans('texts.customize_help') !!} + +