Merge pull request #7287 from turbo124/v5-stable

v5.3.68
This commit is contained in:
David Bomba 2022-03-13 21:42:30 +11:00 committed by GitHub
commit e4b1c70080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 3538 additions and 3220 deletions

View File

@ -1 +1 @@
5.3.67
5.3.68

View File

@ -64,7 +64,7 @@ class Kernel extends ConsoleKernel
$schedule->job(new RecurringExpensesCron)->dailyAt('00:10')->withoutOverlapping();
$schedule->job(new AutoBillCron)->dailyAt('12:20')->withoutOverlapping();
$schedule->job(new AutoBillCron)->dailyAt('06:00')->withoutOverlapping();
$schedule->job(new SchedulerCheck)->daily()->withoutOverlapping();

View File

@ -17,8 +17,10 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\ClientPortal\RegisterRequest;
use App\Models\Client;
use App\Models\Company;
use App\Utils\Ninja;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\App;
class ContactRegisterController extends Controller
{
@ -29,10 +31,15 @@ class ContactRegisterController extends Controller
public function showRegisterForm(string $company_key = '')
{
$key = request()->session()->has('company_key') ? request()->session()->get('company_key') : $company_key;
$company = Company::where('company_key', $key)->firstOrFail();
App::forgetInstance('translator');
$t = app('translator');
$t->replace(Ninja::transformTranslations($company->settings));
return render('auth.register', ['company' => $company, 'account' => $company->account]);
}

View File

@ -33,6 +33,7 @@ use App\Transformers\CompanyUserTransformer;
use App\Utils\Ninja;
use App\Utils\Traits\UserSessionAttributes;
use App\Utils\Traits\User\LoginCache;
use App\Utils\TruthSource;
use Google_Client;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
@ -250,15 +251,6 @@ class LoginController extends BaseController
->increment()
->queue();
// SystemLogger::dispatch(
// json_encode(['ip' => request()->getClientIp()]),
// SystemLog::CATEGORY_SECURITY,
// SystemLog::EVENT_USER,
// SystemLog::TYPE_LOGIN_FAILURE,
// null,
// Company::first(),
// );
$this->incrementLoginAttempts($request);
return response()
@ -310,6 +302,11 @@ class LoginController extends BaseController
*/
public function refresh(Request $request)
{
$truth = app()->make(TruthSource::class);
if($truth->getCompanyToken())
$company_token = $truth->getCompanyToken();
else
$company_token = CompanyToken::where('token', $request->header('X-API-TOKEN'))->first();
$cu = CompanyUser::query()
@ -606,6 +603,10 @@ class LoginController extends BaseController
if (request()->has('code')) {
return $this->handleProviderCallback($provider);
} else {
if(!in_array($provider, ['google']))
return abort(400, 'Invalid provider');
return Socialite::driver($provider)->with($parameters)->scopes($scopes)->redirect();
}
}

View File

@ -19,6 +19,7 @@ use App\Transformers\EntityTransformer;
use App\Utils\Ninja;
use App\Utils\Statics;
use App\Utils\Traits\AppSetup;
use App\Utils\TruthSource;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
@ -610,6 +611,7 @@ class BaseController extends Controller
protected function listResponse($query)
{
$this->buildManager();
$transformer = new $this->entity_transformer(request()->input('serializer'));
@ -622,7 +624,7 @@ class BaseController extends Controller
// 10-01-2022 need to ensure we snake case properly here to ensure permissions work as expected
// if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename($this->entity_type)))) {
if (auth()->user() && ! auth()->user()->hasPermission('view'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
$query->where('user_id', '=', auth()->user()->id);
}

View File

@ -380,7 +380,7 @@ class UserController extends BaseController
*/
public function update(UpdateUserRequest $request, User $user)
{
$old_company_user = $user->company_user;
$old_company_user = $user->company_user();
$old_user = json_encode($user);
$old_user_email = $user->getOriginal('email');
@ -398,8 +398,8 @@ class UserController extends BaseController
if(
strcasecmp($old_company_user->permissions, $user->company_user->permissions) != 0 ||
$old_company_user->is_admin != $user->company_user->is_admin
strcasecmp($old_company_user->permissions, $user->company_user()->permissions) != 0 ||
$old_company_user->is_admin != $user->company_user()->is_admin
){
$user->company_user()->update(["permissions_updated_at" => now()]);
}

View File

@ -15,6 +15,7 @@ use App\Events\User\UserLoggedIn;
use App\Models\CompanyToken;
use App\Models\User;
use App\Utils\Ninja;
use App\Utils\TruthSource;
use Closure;
use Illuminate\Http\Request;
use stdClass;
@ -30,7 +31,7 @@ class TokenAuth
*/
public function handle($request, Closure $next)
{
if ($request->header('X-API-TOKEN') && ($company_token = CompanyToken::with(['user', 'company'])->where('token', $request->header('X-API-TOKEN'))->first())) {
if ($request->header('X-API-TOKEN') && ($company_token = CompanyToken::with(['user', 'company', 'cu'])->where('token', $request->header('X-API-TOKEN'))->first())) {
$user = $company_token->user;
$error = [
@ -52,6 +53,13 @@ class TokenAuth
return response()->json($error, 403);
}
$truth = app()->make(TruthSource::class);
$truth->setCompanyUser($company_token->cu);
$truth->setUser($company_token->user);
$truth->setCompany($company_token->company);
$truth->setCompanyToken($company_token);
/*
|
| Necessary evil here: As we are authenticating on CompanyToken,
@ -65,7 +73,7 @@ class TokenAuth
});
//user who once existed, but has been soft deleted
if ($company_token->company_user->is_locked) {
if ($company_token->cu->is_locked) {
$error = [
'message' => 'User access locked',
'errors' => new stdClass,

View File

@ -86,8 +86,8 @@ class TransactionLog implements ShouldQueue
*/
public function handle()
{
// if(!Ninja::isHosted())
// return;
if(!Ninja::isHosted())
return;
$this->setTransformer();

View File

@ -27,6 +27,10 @@ class ImportStripeCustomers implements ShouldQueue
public $company;
private $stripe_keys = ['d14dd26a47cecc30fdd65700bfb67b34', 'd14dd26a37cecc30fdd65700bfb55b23'];
public $tries = 1;
/**
* Create a new job instance.
*

View File

@ -55,4 +55,9 @@ class CompanyToken extends BaseModel
->where('company_id', $this->company_id)
->where('user_id', $this->user_id);
}
public function cu()
{
return $this->hasOneThrough(CompanyUser::class, Company::class, 'id', 'company_id', 'company_id', 'id');
}
}

View File

@ -21,6 +21,7 @@ use App\Services\User\UserService;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\UserSessionAttributes;
use App\Utils\Traits\UserSettings;
use App\Utils\TruthSource;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@ -30,8 +31,8 @@ use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Laracasts\Presenter\PresentableTrait;
use Illuminate\Support\Facades\Cache;
use Laracasts\Presenter\PresentableTrait;
class User extends Authenticatable implements MustVerifyEmail
{
@ -142,6 +143,22 @@ class User extends Authenticatable implements MustVerifyEmail
return $this->hasMany(CompanyToken::class)->orderBy('id', 'ASC');
}
public function token()
{
$truth = app()->make(TruthSource::class);
if($truth->getCompanyToken()){
return $truth->getCompanyToken();
}
if (request()->header('X-API-TOKEN')) {
return CompanyToken::with(['cu'])->where('token', request()->header('X-API-TOKEN'))->first();
}
return $this->tokens()->first();
}
/**
* Returns all companies a user has access to.
*
@ -170,12 +187,16 @@ class User extends Authenticatable implements MustVerifyEmail
*/
public function getCompany()
{
$truth = app()->make(TruthSource::class);
if ($this->company){
return $this->company;
}
elseif($truth->getCompany()){
return $truth->getCompany();
}
elseif (request()->header('X-API-TOKEN')) {
$company_token = CompanyToken::with(['company'])->where('token', request()->header('X-API-TOKEN'))->first();
@ -219,31 +240,30 @@ class User extends Authenticatable implements MustVerifyEmail
public function co_user()
{
return $this->company_user();
$truth = app()->make(TruthSource::class);
if($truth->getCompanyUser()){
return $truth->getCompanyUser();
}
return $this->token()->cu;
}
public function company_user()
{
if (! $this->id && auth()->user()) {
$this->id = auth()->user()->id;
// return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'user_id', 'id', 'user_id')
// ->withTrashed();
$truth = app()->make(TruthSource::class);
if($truth->getCompanyUser()){
return $truth->getCompanyUser();
}
return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'user_id', 'id', 'user_id')
->withTrashed();
return $this->token()->cu;
// if (request()->header('X-API-TOKEN')) {
// nlog("with an API token");
// nlog(request()->header('X-API-TOKEN'));
// return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'company_id', 'id', 'company_id')
// ->where('company_tokens.token', request()->header('X-API-TOKEN'))
// ->withTrashed();
// } else {
// return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'company_id', 'id', 'company_id')
// ->where('company_user.user_id', $this->id)
// ->withTrashed();
// }
}
/**
@ -268,7 +288,9 @@ class User extends Authenticatable implements MustVerifyEmail
*/
public function permissions()
{
return $this->company_user->permissions;
return $this->token()->cu->permissions;
// return $this->company_user->permissions;
}
/**
@ -278,7 +300,9 @@ class User extends Authenticatable implements MustVerifyEmail
*/
public function settings()
{
return json_decode($this->company_user->settings);
return json_decode($this->token()->cu->settings);
//return json_decode($this->company_user->settings);
}
/**
@ -288,12 +312,16 @@ class User extends Authenticatable implements MustVerifyEmail
*/
public function isAdmin() : bool
{
return $this->company_user->is_admin;
return $this->token()->cu->is_admin;
// return $this->company_user->is_admin;
}
public function isOwner() : bool
{
return $this->company_user->is_owner;
return $this->token()->cu->is_owner;
// return $this->company_user->is_owner;
}
/**
@ -345,8 +373,13 @@ class User extends Authenticatable implements MustVerifyEmail
return $this->isOwner() ||
$this->isAdmin() ||
(stripos($this->company_user->permissions, $all_permission) !== false) ||
(stripos($this->company_user->permissions, $permission) !== false);
(stripos($this->token()->cu->permissions, $all_permission) !== false) ||
(stripos($this->token()->cu->permissions, $permission) !== false);
// return $this->isOwner() ||
// $this->isAdmin() ||
// (stripos($this->company_user->permissions, $all_permission) !== false) ||
// (stripos($this->company_user->permissions, $permission) !== false);
}
public function documents()
@ -370,9 +403,12 @@ class User extends Authenticatable implements MustVerifyEmail
public function routeNotificationForSlack($notification)
{
if ($this->company_user->slack_webhook_url) {
return $this->company_user->slack_webhook_url;
}
if($this->token()->cu->slack_webhook_url)
return $this->token()->cu->slack_webhook_url;
// if ($this->company_user->slack_webhook_url) {
// return $this->company_user->slack_webhook_url;
// }
}
public function routeNotificationForMail($notification)

View File

@ -15,6 +15,7 @@ use App\Http\Middleware\SetDomainNameDb;
use App\Models\Invoice;
use App\Models\Proposal;
use App\Utils\Ninja;
use App\Utils\TruthSource;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Queue\Events\JobProcessing;
@ -71,6 +72,9 @@ class AppServiceProvider extends ServiceProvider
// \Log::error('Event Job '.$event->job->getJobId);
// // \Log::info('Event Job '.$event->job->payload());
// });
app()->instance(TruthSource::class, new TruthSource());
}
/**

View File

@ -200,7 +200,6 @@ class UserRepository extends BaseRepository
$user->is_deleted = false;
$user->save();
$user->restore();
// $user->company_user->restore();
$cu = CompanyUser::withTrashed()
->where('user_id', $user->id)

View File

@ -16,6 +16,7 @@ use App\Models\Company;
use App\Models\CompanyToken;
use App\Models\CompanyUser;
use App\Models\User;
use App\Utils\TruthSource;
class CompanyUserTransformer extends EntityTransformer
{
@ -79,6 +80,11 @@ class CompanyUserTransformer extends EntityTransformer
public function includeToken(CompanyUser $company_user)
{
$truth = app()->make(TruthSource::class);
if($truth->getCompanyToken())
$token = $truth->getCompanyToken();
else
$token = $company_user->tokens->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
$transformer = new CompanyTokenTransformer($this->serializer);

View File

@ -634,9 +634,11 @@ class HtmlEngine
{
$country = Country::find($this->settings->country_id);
if ($country) {
return ctrans('texts.country_' . $country->iso_3166_2);
}
if($country)
return $country->iso_3166_2;
// if ($country) {
// return ctrans('texts.country_' . $country->iso_3166_2);
// }
return ' ';
}

70
app/Utils/TruthSource.php Normal file
View File

@ -0,0 +1,70 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Utils;
class TruthSource
{
public $company;
public $user;
public $company_user;
public $company_token;
public function setCompanyUser($company_user)
{
$this->company_user = $company_user;
return $this;
}
public function setUser($user){
$this->user = $user;
return $this;
}
public function setCompany($company)
{
$this->company = $company;
return $this;
}
public function setCompanyToken($company_token)
{
$this->company_token = $company_token;
return $this;
}
public function getCompany()
{
return $this->company;
}
public function getCompanyUser()
{
return $this->company_user;
}
public function getUser()
{
return $this->user;
}
public function getCompanyToken()
{
return $this->company_token;
}
}

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.3.67',
'app_tag' => '5.3.67',
'app_version' => '5.3.68',
'app_tag' => '5.3.68',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -3,42 +3,42 @@ const MANIFEST = 'flutter-app-manifest';
const TEMP = 'flutter-temp-cache';
const CACHE_NAME = 'flutter-app-cache';
const RESOURCES = {
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40",
"canvaskit/profiling/canvaskit.wasm": "95e736ab31147d1b2c7b25f11d4c32cd",
"canvaskit/profiling/canvaskit.js": "ae2949af4efc61d28a4a80fffa1db900",
"canvaskit/canvaskit.wasm": "4b83d89d9fecbea8ca46f2f760c5a9ba",
"canvaskit/canvaskit.js": "c2b4e5f3d7a3d82aed024e7249a78487",
"assets/fonts/MaterialIcons-Regular.otf": "7e7a6cccddf6d7b20012a548461d5d81",
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
"assets/assets/images/google_logo.png": "0f118259ce403274f407f5e982e681c3",
"assets/assets/images/logo_light.png": "e5f46d5a78e226e7a9553d4ca6f69219",
"assets/assets/images/icon.png": "090f69e23311a4b6d851b3880ae52541",
"assets/assets/images/logo_dark.png": "a233ed1d4d0f7414bf97a9a10f11fb0a",
"assets/assets/images/payment_types/visa.png": "3ddc4a4d25c946e8ad7e6998f30fd4e3",
"assets/assets/images/payment_types/mastercard.png": "6f6cdc29ee2e22e06b1ac029cb52ef71",
"assets/assets/images/payment_types/carteblanche.png": "d936e11fa3884b8c9f1bd5c914be8629",
"assets/assets/images/payment_types/ach.png": "7433f0aff779dc98a649b7a2daf777cf",
"assets/assets/images/payment_types/solo.png": "2030c3ccaccf5d5e87916a62f5b084d6",
"assets/assets/images/payment_types/paypal.png": "8e06c094c1871376dfea1da8088c29d1",
"assets/assets/images/payment_types/jcb.png": "07e0942d16c5592118b72e74f2f7198c",
"assets/assets/images/payment_types/laser.png": "b4e6e93dd35517ac429301119ff05868",
"assets/assets/images/payment_types/maestro.png": "e533b92bfb50339fdbfa79e3dfe81f08",
"assets/assets/images/payment_types/switch.png": "4fa11c45327f5fdc20205821b2cfd9cc",
"assets/assets/images/payment_types/discover.png": "6c0a386a00307f87db7bea366cca35f5",
"assets/assets/images/payment_types/switch.png": "4fa11c45327f5fdc20205821b2cfd9cc",
"assets/assets/images/payment_types/other.png": "d936e11fa3884b8c9f1bd5c914be8629",
"assets/assets/images/payment_types/unionpay.png": "7002f52004e0ab8cc0b7450b0208ccb2",
"assets/assets/images/payment_types/carteblanche.png": "d936e11fa3884b8c9f1bd5c914be8629",
"assets/assets/images/payment_types/paypal.png": "8e06c094c1871376dfea1da8088c29d1",
"assets/assets/images/payment_types/ach.png": "7433f0aff779dc98a649b7a2daf777cf",
"assets/assets/images/payment_types/mastercard.png": "6f6cdc29ee2e22e06b1ac029cb52ef71",
"assets/assets/images/payment_types/amex.png": "c49a4247984b3732a4af50a3390aa978",
"assets/assets/images/payment_types/dinerscard.png": "06d85186ba858c18ab7c9caa42c92024",
"assets/assets/images/payment_types/laser.png": "b4e6e93dd35517ac429301119ff05868",
"assets/assets/images/payment_types/unionpay.png": "7002f52004e0ab8cc0b7450b0208ccb2",
"assets/assets/images/payment_types/other.png": "d936e11fa3884b8c9f1bd5c914be8629",
"assets/assets/images/payment_types/jcb.png": "07e0942d16c5592118b72e74f2f7198c",
"assets/assets/images/logo_light.png": "e5f46d5a78e226e7a9553d4ca6f69219",
"assets/assets/images/google_logo.png": "0f118259ce403274f407f5e982e681c3",
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "015400679694f1f51047e46da0e1dc98",
"assets/AssetManifest.json": "38d9aea341601f3a5c6fa7b5a1216ea5",
"assets/NOTICES": "9a4bf0423a5e265f38c4df37f7a0a913",
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "015400679694f1f51047e46da0e1dc98",
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
"/": "9c1820b56e212ef046fb5b877da280e6",
"assets/fonts/MaterialIcons-Regular.otf": "7e7a6cccddf6d7b20012a548461d5d81",
"favicon.ico": "51636d3a390451561744c42188ccd628",
"/": "5b757674db7de289861c999d0cbf98eb",
"version.json": "443986d36b3df952ad780139ecccd516",
"main.dart.js": "e82126a54ecc81baa8cf3c81f212ca69",
"favicon.ico": "51636d3a390451561744c42188ccd628"
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
"main.dart.js": "624ab6c1c68bad547ded90f09731b92b",
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40",
"canvaskit/profiling/canvaskit.js": "ae2949af4efc61d28a4a80fffa1db900",
"canvaskit/profiling/canvaskit.wasm": "95e736ab31147d1b2c7b25f11d4c32cd",
"canvaskit/canvaskit.js": "c2b4e5f3d7a3d82aed024e7249a78487",
"canvaskit/canvaskit.wasm": "4b83d89d9fecbea8ca46f2f760c5a9ba"
};
// The application shell files that are downloaded before a service worker can

1535
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1481
public/main.foss.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1617
public/main.html.dart.js vendored

File diff suppressed because one or more lines are too long

1481
public/main.next.dart.js vendored

File diff suppressed because one or more lines are too long

View File

@ -284171,11 +284171,19 @@
return true;
},
compareTo$6$clientMap$invoice$recurringPrefix$sortAscending$sortField$userMap(_, clientMap, invoice, recurringPrefix, sortAscending, sortField, userMap) {
var invoiceANumber, invoiceBNumber, t1, response, stateA, stateB, t2, userA, userB, clientA, clientB, _null = null,
var clientB, invoiceANumber, invoiceBNumber, response, stateA, stateB, userA, userB, _null = null,
_s10_ = "ZZZZZZZZZZ",
_s8_ = "archived",
invoiceA = sortAscending ? this : invoice,
invoiceB = sortAscending ? invoice : this;
invoiceB = sortAscending ? invoice : this,
t1 = invoiceA.clientId,
t2 = clientMap._map$_map,
clientA = t2.$index(0, t1);
if (clientA == null)
clientA = A.ClientEntity_ClientEntity(_null, _null, _null, _null);
clientB = t2.$index(0, invoiceB.clientId);
if (clientB == null)
clientB = A.ClientEntity_ClientEntity(_null, _null, _null, _null);
switch (sortField) {
case "number":
invoiceANumber = invoiceA.number;
@ -284302,14 +284310,6 @@
response = B.JSString_methods.compareTo$1(invoiceA.customValue4.toLowerCase(), invoiceB.customValue4.toLowerCase());
break;
case "client":
t1 = invoiceA.clientId;
t2 = clientMap._map$_map;
clientA = t2.$index(0, t1);
if (clientA == null)
clientA = A.ClientEntity_ClientEntity(_null, _null, _null, _null);
clientB = t2.$index(0, invoiceB.clientId);
if (clientB == null)
clientB = A.ClientEntity_ClientEntity(_null, _null, _null, _null);
response = B.JSString_methods.compareTo$1(A.String_String$fromCharCodes(A.replaceCodeUnits(new A.CodeUnits(clientA.displayName)), 0, _null).toLowerCase(), A.String_String$fromCharCodes(A.replaceCodeUnits(new A.CodeUnits(clientB.displayName)), 0, _null).toLowerCase());
break;
case "is_viewed":
@ -284324,6 +284324,18 @@
case "auto_bill":
response = J.compareTo$1$ns(invoiceA.autoBill, invoiceB.autoBill);
break;
case "client_city":
response = B.JSString_methods.compareTo$1(clientA.city, clientB.city);
break;
case "client_state":
response = B.JSString_methods.compareTo$1(clientA.state, clientB.state);
break;
case "client_postal_code":
response = B.JSString_methods.compareTo$1(clientA.postalCode, clientB.postalCode);
break;
case "client_country":
response = B.JSString_methods.compareTo$1(clientA.countryId, clientB.countryId);
break;
default:
A.print("## ERROR: sort by invoice." + sortField + " is not implemented");
response = 0;
@ -365658,24 +365670,36 @@
return new A.EmailPreview(_this._invoice_email_view$_subjectPreview, _this._invoice_email_view$_bodyPreview, t1, _null);
},
_buildEdit$1(context) {
var enableCustomEmail, t4, t5, _this = this, _null = null,
var t4, enableCustomEmail, t5, _this = this, _null = null,
t1 = A.Localizations_of(context, B.Type_AppLocalization_KyD, type$.legacy_AppLocalization),
state = _this._widget.viewModel.state,
t2 = state.authState,
t3 = t2.get$isHosted();
if (t3) {
if (A.cleanApiUrl(t2.url) === "https://invoicing.co") {
t3 = state.userCompanyStates;
t4 = state.uiState.selectedCompanyIndex;
t4 = t3._list[t4].userCompany.account.plan === "enterprise";
t3 = t4;
} else
t3 = true;
if (!t3) {
t3 = state.userCompanyStates;
t4 = state.uiState.selectedCompanyIndex;
t4 = t3._list[t4].userCompany.account.plan === "pro";
t3 = t4;
} else
t3 = true;
if (!t3) {
t2 = t2.get$isHosted();
if (t2) {
t2 = state.userCompanyStates;
t3 = state.uiState.selectedCompanyIndex;
t3 = t2._list[t3].userCompany.account.plan === "enterprise";
t3 = t2._list[t3].userCompany.account.trialPlan.length !== 0;
t2 = t3;
} else
t2 = true;
if (!t2) {
t2 = state.userCompanyStates;
t3 = state.uiState.selectedCompanyIndex;
t3 = t2._list[t3].userCompany.account.plan === "pro";
enableCustomEmail = t3;
t2 = false;
enableCustomEmail = t2;
} else
enableCustomEmail = true;
} else
@ -371480,7 +371504,7 @@
};
A._LoginState_build_closure16.prototype = {
call$0() {
A.launch("https://status.invoiceninja.com", null, false);
A.launch("https://status.invoiceninja.com/", null, false);
},
$signature: 1
};
@ -377328,10 +377352,16 @@
A.CreditPdfVM.prototype = {};
A.CreditPresenter.prototype = {
getField$2$context$field(context, field) {
var t2, contact, _this = this, _null = null,
var t4, t5, client, contact, _this = this, _null = null,
t1 = A.Localizations_of(context, B.Type_AppLocalization_KyD, type$.legacy_AppLocalization),
state = A._lateReadCheck(A.StoreProvider_of(context, type$.legacy_AppState).__Store__state, "_state"),
credit = type$.legacy_InvoiceEntity._as(_this.entity);
credit = type$.legacy_InvoiceEntity._as(_this.entity),
t2 = state.userCompanyStates,
t3 = state.uiState.selectedCompanyIndex;
t2 = t2._list;
t4 = t2[t3].clientState;
t5 = credit.clientId;
client = t4.$get$1(0, t5);
switch (field) {
case "status":
return new A.EntityStatusChip(credit, 105, _null);
@ -377339,12 +377369,8 @@
t2 = credit.number;
return A.Text$(t2.length === 0 ? t1.get$pending(t1) : t2, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
t2 = t1._list[t2].clientState.map;
t1 = credit.clientId;
t2 = t2._map$_map.$index(0, t1);
return A.Text$((t2 == null ? A.ClientEntity_ClientEntity(_null, t1, _null, _null) : t2).displayName, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t1 = t2[t3].clientState.map._map$_map.$index(0, t5);
return A.Text$((t1 == null ? A.ClientEntity_ClientEntity(_null, t5, _null, _null) : t1).displayName, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "date":
return A.Text$(A.formatDate(credit.date, context, true, true, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "last_sent_date":
@ -377352,11 +377378,10 @@
case "valid_until":
return A.Text$(A.formatDate(credit.dueDate, context, true, true, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "amount":
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(credit.amount, context, credit.clientId, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(credit.amount, context, t5, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
case "remaining":
case "balance":
t1 = credit.statusId !== "1" ? credit.balance : credit.amount;
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(t1, context, credit.clientId, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(credit.statusId !== "1" ? credit.balance : credit.amount, context, t5, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
case "custom1":
return A.Text$(_this.presentCustomField$2(context, credit.customValue1), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "custom2":
@ -377372,30 +377397,36 @@
case "discount":
t1 = credit.isAmountDiscount;
t2 = credit.discount;
return A.Text$(t1 ? A.formatNumber(t2, context, credit.clientId, _null, B.FormatNumberType_0, true, _null, false) : A.formatNumber(t2, context, _null, _null, B.FormatNumberType_1, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t1 ? A.formatNumber(t2, context, t5, _null, B.FormatNumberType_0, true, _null, false) : A.formatNumber(t2, context, _null, _null, B.FormatNumberType_1, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "po_number":
return A.Text$(credit.poNumber, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "documents":
return A.Text$("" + credit.documents._list.length, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "tax_amount":
return A.Text$(A.formatNumber(credit.taxAmount, context, credit.clientId, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(A.formatNumber(credit.taxAmount, context, t5, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "exchange_rate":
return A.Text$(A.formatNumber(credit.exchangeRate, context, _null, _null, B.FormatNumberType_3, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "is_viewed":
return A.Text$(credit.get$isViewed() ? t1.get$yes() : t1.get$no(), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "project":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
return A.Text$(t1._list[t2].projectState.$get$1(0, credit.projectId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t2[t3].projectState.$get$1(0, credit.projectId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "vendor":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
return A.Text$(t1._list[t2].vendorState.$get$1(0, credit.vendorId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t2[t3].vendorState.$get$1(0, credit.vendorId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_state":
return A.Text$(client.state, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_city":
return A.Text$(client.city, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_postal_code":
return A.Text$(client.postalCode, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_country":
t1 = state.staticState.countryMap;
t2 = client.countryId;
t2 = t1._map$_map.$index(0, t2);
t1 = t2 == null ? _null : t2.name;
return A.Text$(t1 == null ? "" : t1, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "contact_name":
case "contact_email":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
contact = A.creditContactSelector(credit, t1._list[t2].clientState.$get$1(0, credit.clientId));
contact = A.creditContactSelector(credit, t2[t3].clientState.$get$1(0, t5));
if (field === "contact_name") {
t1 = contact == null ? _null : contact.get$fullName();
return A.Text$(t1 == null ? "" : t1, _null, _null, _null, _null, _null, _null, _null, _null, _null);
@ -377443,6 +377474,10 @@
t7.push("vendor");
t7.push("contact_name");
t7.push("contact_email");
t7.push("client_state");
t7.push("client_city");
t7.push("client_postal_code");
t7.push("client_country");
t8 = A._setArrayType(["status", "number", "client", "amount", "date", "remaining"], t6);
t6 = A._setArrayType(["number", "amount", "updated_at"], t6);
t7 = A.AppBottomBar$(company.getCustomFieldValues$2$excludeBlank("invoice1", true), company.getCustomFieldValues$2$excludeBlank("invoice2", true), company.getCustomFieldValues$2$excludeBlank("invoice3", true), company.getCustomFieldValues$2$excludeBlank("invoice4", true), t8, B.EntityType_credit, false, B.List_empty16, new A.CreditScreen_build_closure(store), new A.CreditScreen_build_closure0(store), new A.CreditScreen_build_closure1(store), new A.CreditScreen_build_closure2(store), new A.CreditScreen_build_closure3(store), new A.CreditScreen_build_closure4(store), new A.CreditScreen_build_closure5(store), _null, t6, B.List_empty17, t7);
@ -389858,10 +389893,16 @@
A.InvoicePdfVM.prototype = {};
A.InvoicePresenter.prototype = {
getField$2$context$field(context, field) {
var t2, contact, _this = this, _null = null,
var t4, t5, client, contact, _this = this, _null = null,
t1 = A.Localizations_of(context, B.Type_AppLocalization_KyD, type$.legacy_AppLocalization),
state = A._lateReadCheck(A.StoreProvider_of(context, type$.legacy_AppState).__Store__state, "_state"),
invoice = type$.legacy_InvoiceEntity._as(_this.entity);
invoice = type$.legacy_InvoiceEntity._as(_this.entity),
t2 = state.userCompanyStates,
t3 = state.uiState.selectedCompanyIndex;
t2 = t2._list;
t4 = t2[t3].clientState;
t5 = invoice.clientId;
client = t4.$get$1(0, t5);
switch (field) {
case "status":
return new A.EntityStatusChip(invoice, 105, _null);
@ -389869,20 +389910,12 @@
t2 = invoice.number;
return A.Text$(t2.length === 0 ? t1.get$pending(t1) : t2, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
t2 = t1._list[t2].clientState.map;
t1 = invoice.clientId;
t2 = t2._map$_map.$index(0, t1);
return A.Text$((t2 == null ? A.ClientEntity_ClientEntity(_null, t1, _null, _null) : t2).displayName, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t1 = t2[t3].clientState.map._map$_map.$index(0, t5);
return A.Text$((t1 == null ? A.ClientEntity_ClientEntity(_null, t5, _null, _null) : t1).displayName, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "project":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
return A.Text$(t1._list[t2].projectState.$get$1(0, invoice.projectId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t2[t3].projectState.$get$1(0, invoice.projectId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "vendor":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
return A.Text$(t1._list[t2].vendorState.$get$1(0, invoice.vendorId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t2[t3].vendorState.$get$1(0, invoice.vendorId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "date":
return A.Text$(A.formatDate(invoice.date, context, true, true, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "last_sent_date":
@ -389898,10 +389931,9 @@
case "reminder_last_sent":
return A.Text$(A.formatDate(invoice.reminderLastSent, context, true, true, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "amount":
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(invoice.amount, context, invoice.clientId, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(invoice.amount, context, t5, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
case "balance":
t1 = invoice.statusId !== "1" ? invoice.balance : invoice.amount;
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(t1, context, invoice.clientId, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(invoice.statusId !== "1" ? invoice.balance : invoice.amount, context, t5, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
case "due_date":
return A.Text$(A.formatDate(invoice.dueDate, context, true, true, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "custom1":
@ -389919,24 +389951,34 @@
case "discount":
t1 = invoice.isAmountDiscount;
t2 = invoice.discount;
return A.Text$(t1 ? A.formatNumber(t2, context, invoice.clientId, _null, B.FormatNumberType_0, true, _null, false) : A.formatNumber(t2, context, _null, _null, B.FormatNumberType_1, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t1 ? A.formatNumber(t2, context, t5, _null, B.FormatNumberType_0, true, _null, false) : A.formatNumber(t2, context, _null, _null, B.FormatNumberType_1, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "po_number":
return A.Text$(invoice.poNumber, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "documents":
return A.Text$("" + invoice.documents._list.length, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "tax_amount":
return A.Text$(A.formatNumber(invoice.taxAmount, context, invoice.clientId, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(A.formatNumber(invoice.taxAmount, context, t5, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "exchange_rate":
return A.Text$(A.formatNumber(invoice.exchangeRate, context, _null, _null, B.FormatNumberType_3, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "is_viewed":
return A.Text$(invoice.get$isViewed() ? t1.get$yes() : t1.get$no(), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "auto_bill_enabled":
return A.Text$(t1.lookup$1(invoice.autoBillEnabled ? t1.get$yes() : t1.get$no()), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_state":
return A.Text$(client.state, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_city":
return A.Text$(client.city, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_postal_code":
return A.Text$(client.postalCode, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_country":
t1 = state.staticState.countryMap;
t2 = client.countryId;
t2 = t1._map$_map.$index(0, t2);
t1 = t2 == null ? _null : t2.name;
return A.Text$(t1 == null ? "" : t1, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "contact_name":
case "contact_email":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
contact = A.invoiceContactSelector(invoice, t1._list[t2].clientState.$get$1(0, invoice.clientId));
contact = A.invoiceContactSelector(invoice, t2[t3].clientState.$get$1(0, t5));
if (field === "contact_name") {
t1 = contact == null ? _null : contact.get$fullName();
return A.Text$(t1 == null ? "" : t1, _null, _null, _null, _null, _null, _null, _null, _null, _null);
@ -389993,6 +390035,10 @@
t6.push("vendor");
t6.push("contact_name");
t6.push("contact_email");
t6.push("client_state");
t6.push("client_city");
t6.push("client_postal_code");
t6.push("client_country");
t7 = A._setArrayType(["status", "number", "client", "amount", "balance", "date", "due_date"], t5);
t5 = A._setArrayType(["number", "date", "due_date", "updated_at"], t5);
t6 = A.AppBottomBar$(company.getCustomFieldValues$2$excludeBlank("invoice1", true), company.getCustomFieldValues$2$excludeBlank("invoice2", true), company.getCustomFieldValues$2$excludeBlank("invoice3", true), company.getCustomFieldValues$2$excludeBlank("invoice4", true), t7, B.EntityType_invoice, false, B.List_empty16, new A.InvoiceScreen_build_closure6(store), new A.InvoiceScreen_build_closure7(store), new A.InvoiceScreen_build_closure8(store), new A.InvoiceScreen_build_closure9(store), new A.InvoiceScreen_build_closure10(store), new A.InvoiceScreen_build_closure11(store), new A.InvoiceScreen_build_closure12(store), new A.InvoiceScreen_build_closure13(store), t5, statuses, t6);
@ -396442,10 +396488,16 @@
A.QuotePdfVM.prototype = {};
A.QuotePresenter.prototype = {
getField$2$context$field(context, field) {
var t2, contact, _this = this, _null = null,
var t4, t5, client, contact, _this = this, _null = null,
t1 = A.Localizations_of(context, B.Type_AppLocalization_KyD, type$.legacy_AppLocalization),
state = A._lateReadCheck(A.StoreProvider_of(context, type$.legacy_AppState).__Store__state, "_state"),
quote = type$.legacy_InvoiceEntity._as(_this.entity);
quote = type$.legacy_InvoiceEntity._as(_this.entity),
t2 = state.userCompanyStates,
t3 = state.uiState.selectedCompanyIndex;
t2 = t2._list;
t4 = t2[t3].clientState;
t5 = quote.clientId;
client = t4.$get$1(0, t5);
switch (field) {
case "status":
return new A.EntityStatusChip(quote, 105, _null);
@ -396453,18 +396505,14 @@
t2 = quote.number;
return A.Text$(t2.length === 0 ? t1.get$pending(t1) : t2, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
t2 = t1._list[t2].clientState.map;
t1 = quote.clientId;
t2 = t2._map$_map.$index(0, t1);
return A.Text$((t2 == null ? A.ClientEntity_ClientEntity(_null, t1, _null, _null) : t2).displayName, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t1 = t2[t3].clientState.map._map$_map.$index(0, t5);
return A.Text$((t1 == null ? A.ClientEntity_ClientEntity(_null, t5, _null, _null) : t1).displayName, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "date":
return A.Text$(A.formatDate(quote.date, context, true, true, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "last_sent_date":
return A.Text$(A.formatDate(quote.lastSentDate, context, true, true, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "amount":
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(quote.amount, context, quote.clientId, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
return new A.Align(B.Alignment_1_0, _null, _null, A.Text$(A.formatNumber(quote.amount, context, t5, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null), _null);
case "valid_until":
return A.Text$(A.formatDate(quote.dueDate, context, true, true, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "custom1":
@ -396482,30 +396530,36 @@
case "discount":
t1 = quote.isAmountDiscount;
t2 = quote.discount;
return A.Text$(t1 ? A.formatNumber(t2, context, quote.clientId, _null, B.FormatNumberType_0, true, _null, false) : A.formatNumber(t2, context, _null, _null, B.FormatNumberType_1, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t1 ? A.formatNumber(t2, context, t5, _null, B.FormatNumberType_0, true, _null, false) : A.formatNumber(t2, context, _null, _null, B.FormatNumberType_1, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "po_number":
return A.Text$(quote.poNumber, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "documents":
return A.Text$("" + quote.documents._list.length, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "tax_amount":
return A.Text$(A.formatNumber(quote.taxAmount, context, quote.clientId, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(A.formatNumber(quote.taxAmount, context, t5, _null, B.FormatNumberType_0, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "exchange_rate":
return A.Text$(A.formatNumber(quote.exchangeRate, context, _null, _null, B.FormatNumberType_3, true, _null, false), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "is_viewed":
return A.Text$(quote.get$isViewed() ? t1.get$yes() : t1.get$no(), _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "project":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
return A.Text$(t1._list[t2].projectState.$get$1(0, quote.projectId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t2[t3].projectState.$get$1(0, quote.projectId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "vendor":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
return A.Text$(t1._list[t2].vendorState.$get$1(0, quote.vendorId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
return A.Text$(t2[t3].vendorState.$get$1(0, quote.vendorId).name, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_state":
return A.Text$(client.state, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_city":
return A.Text$(client.city, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_postal_code":
return A.Text$(client.postalCode, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "client_country":
t1 = state.staticState.countryMap;
t2 = client.countryId;
t2 = t1._map$_map.$index(0, t2);
t1 = t2 == null ? _null : t2.name;
return A.Text$(t1 == null ? "" : t1, _null, _null, _null, _null, _null, _null, _null, _null, _null);
case "contact_name":
case "contact_email":
t1 = state.userCompanyStates;
t2 = state.uiState.selectedCompanyIndex;
contact = A.quoteContactSelector(quote, t1._list[t2].clientState.$get$1(0, quote.clientId));
contact = A.quoteContactSelector(quote, t2[t3].clientState.$get$1(0, t5));
if (field === "contact_name") {
t1 = contact == null ? _null : contact.get$fullName();
return A.Text$(t1 == null ? "" : t1, _null, _null, _null, _null, _null, _null, _null, _null, _null);
@ -396556,6 +396610,10 @@
t6.push("vendor");
t6.push("contact_name");
t6.push("contact_email");
t6.push("client_state");
t6.push("client_city");
t6.push("client_postal_code");
t6.push("client_country");
t7 = A._setArrayType(["status", "number", "client", "amount", "date", "valid_until"], t5);
t6 = A.AppBottomBar$(company.getCustomFieldValues$2$excludeBlank("invoice1", true), company.getCustomFieldValues$2$excludeBlank("invoice2", true), company.getCustomFieldValues$2$excludeBlank("invoice3", true), company.getCustomFieldValues$2$excludeBlank("invoice4", true), t7, B.EntityType_quote, false, B.List_empty16, new A.QuoteScreen_build_closure4(store), new A.QuoteScreen_build_closure5(store), new A.QuoteScreen_build_closure6(store), new A.QuoteScreen_build_closure7(store), new A.QuoteScreen_build_closure8(store), new A.QuoteScreen_build_closure9(store), new A.QuoteScreen_build_closure10(store), new A.QuoteScreen_build_closure11(store), A._setArrayType(["number", "date", "valid_until", "updated_at"], t5), statuses, t6);
t5 = state.prefState;
@ -401536,26 +401594,28 @@
t7 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "plan");
if (t7 == null)
t7 = "";
if (account.trialPlan.length !== 0) {
t8 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "pro");
t8 = A.S(t8 == null ? J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), "pro") : t8) + " \u2022 ";
t9 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), _s10_);
t8 += A.S(t9 == null ? J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s10_) : t9);
} else {
t8 = account.plan;
if (t8.length === 0) {
t9 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "free");
if (t9 == null)
t9 = "";
} else if (account.trialPlan.length !== 0) {
t9 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "pro");
t9 = A.S(t9 == null ? J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), "pro") : t9) + " \u2022 ";
t10 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), _s10_);
t9 += A.S(t10 == null ? J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s10_) : t10);
t8 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "free");
if (t8 == null)
t8 = "";
} else
t9 = t1.lookup$1(t8);
t10 = type$.JSArray_legacy_Widget;
t9 = A._setArrayType([new A.AppHeader(t7, t9, secondLabel, secondValue, _null)], t10);
t8 = t1.lookup$1(t8);
}
t9 = type$.JSArray_legacy_Widget;
t8 = A._setArrayType([new A.AppHeader(t7, t8, secondLabel, secondValue, _null)], t9);
t7 = t3[t4].userCompany;
if (t7.company.id !== t7.account.defaultCompanyId) {
t7 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), _s19_);
if (t7 == null)
t7 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s19_);
t9.push(new A.Padding(B.EdgeInsets_16_0_16_8, new A.AppButton(_null, B.IconData_57627_MaterialIcons_null_false, t7.toUpperCase(), new A._AccountOverview_build_closure(_this, context), _null, _null), _null));
t8.push(new A.Padding(B.EdgeInsets_16_0_16_8, new A.AppButton(_null, B.IconData_57627_MaterialIcons_null_false, t7.toUpperCase(), new A._AccountOverview_build_closure(_this, context), _null, _null), _null));
}
if (t3[t4].userCompany.ninjaPortalUrl.length !== 0)
if (!A.isApple())
@ -401565,7 +401625,7 @@
else
t7 = false;
if (t7) {
if (account.trialStarted.length === 0 && t8 === "") {
if (account.trialStarted.length === 0 && account.plan === "") {
t7 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), _s16_);
if (t7 == null)
t7 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s16_);
@ -401574,36 +401634,36 @@
if (t7 == null)
t7 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s11_);
}
t9.push(new A.Padding(B.EdgeInsets_16_16_16_0, A.OutlinedButton$(new A.Padding(B.EdgeInsets_8_8_8_8, new A.IconText(t7.toUpperCase(), B._MdiIconData_ujl, _null, _null, _null), _null), new A._AccountOverview_build_closure0(state), _null), _null));
t8.push(new A.Padding(B.EdgeInsets_16_16_16_0, A.OutlinedButton$(new A.Padding(B.EdgeInsets_8_8_8_8, new A.IconText(t7.toUpperCase(), B._MdiIconData_ujl, _null, _null, _null), _null), new A._AccountOverview_build_closure0(state), _null), _null));
}
t7 = company.isDisabled;
t8 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "activate_company");
t8 = A.Text$(t8 == null ? "" : t8, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t10 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "activate_company");
t10 = A.Text$(t10 == null ? "" : t10, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t11 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "activate_company_help");
t11 = A.Text$(t11 == null ? "" : t11, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t7 = A.SwitchListTile$(A.Theme_of(context).colorScheme.secondary, _null, new A._AccountOverview_build_closure1(_this, company), _null, t11, t8, !t7);
t8 = company.markdownEnabled;
t7 = A.SwitchListTile$(A.Theme_of(context).colorScheme.secondary, _null, new A._AccountOverview_build_closure1(_this, company), _null, t11, t10, !t7);
t10 = company.markdownEnabled;
t11 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), _s15_);
t11 = A.Text$(t11 == null ? J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s15_) : t11, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t12 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), _s20_);
t12 = A.Text$(t12 == null ? J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s20_) : t12, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t8 = A.SwitchListTile$(A.Theme_of(context).colorScheme.secondary, _null, new A._AccountOverview_build_closure2(_this, company), _null, t12, t11, t8);
t10 = A.SwitchListTile$(A.Theme_of(context).colorScheme.secondary, _null, new A._AccountOverview_build_closure2(_this, company), _null, t12, t11, t10);
t11 = company.reportIncludeDrafts;
t12 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), _s14_);
t12 = A.Text$(t12 == null ? J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s14_) : t12, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t13 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), _s19_0);
t13 = A.Text$(t13 == null ? J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _s2_), _s19_0) : t13, _null, _null, _null, _null, _null, _null, _null, _null, _null);
t9.push(A.FormCard$(_null, A._setArrayType([t7, t8, A.SwitchListTile$(A.Theme_of(context).colorScheme.secondary, _null, new A._AccountOverview_build_closure3(_this, company), _null, t13, t12, t11)], t10), _null, 4, false, _null, false, _null));
t8.push(A.FormCard$(_null, A._setArrayType([t7, t10, A.SwitchListTile$(A.Theme_of(context).colorScheme.secondary, _null, new A._AccountOverview_build_closure3(_this, company), _null, t13, t12, t11)], t9), _null, 4, false, _null, false, _null));
t7 = t5.get$isHosted();
if (!t7) {
t7 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "purchase_license");
if (t7 == null)
t7 = "";
t8 = A.getLayout(context) === B.AppLayout_mobile ? _null : B.IconData_57714_MaterialIcons_null_false;
t7 = A.Expanded$(new A.AppButton(_null, t8, t7.toUpperCase(), new A._AccountOverview_build_closure4(), _null, _null), 1);
t8 = t1.get$applyLicense();
t10 = A.getLayout(context) === B.AppLayout_mobile ? _null : B.IconData_57714_MaterialIcons_null_false;
t7 = A.Expanded$(new A.AppButton(_null, t10, t7.toUpperCase(), new A._AccountOverview_build_closure4(), _null, _null), 1);
t10 = t1.get$applyLicense();
t11 = A.getLayout(context) === B.AppLayout_mobile ? _null : B.IconData_57713_MaterialIcons_null_false;
B.JSArray_methods.addAll$1(t9, A._setArrayType([new A.Padding(B.EdgeInsets_16_16_16_16, A.Row$(A._setArrayType([t7, new A.SizedBox(16, _null, _null, _null), A.Expanded$(new A.AppButton(_null, t11, t8.toUpperCase(), new A._AccountOverview_build_closure5(_this, context, t1), _null, _null), 1)], t10), B.CrossAxisAlignment_2, B.MainAxisAlignment_0, B.MainAxisSize_1, _null), _null), new A.Padding(B.EdgeInsets_16_16_16_0, new A.ListDivider(_null), _null)], t10));
B.JSArray_methods.addAll$1(t8, A._setArrayType([new A.Padding(B.EdgeInsets_16_16_16_16, A.Row$(A._setArrayType([t7, new A.SizedBox(16, _null, _null, _null), A.Expanded$(new A.AppButton(_null, t11, t10.toUpperCase(), new A._AccountOverview_build_closure5(_this, context, t1), _null, _null), 1)], t9), B.CrossAxisAlignment_2, B.MainAxisAlignment_0, B.MainAxisSize_1, _null), _null), new A.Padding(B.EdgeInsets_16_16_16_0, new A.ListDivider(_null), _null)], t9));
}
if (!(A.cleanApiUrl(t5.url) !== "https://invoicing.co" || t3[t4].userCompany.account.plan === "enterprise" || t3[t4].userCompany.account.plan === "pro")) {
t5 = t5.get$isHosted();
@ -401620,7 +401680,7 @@
if (t4 == null)
t4 = "";
t5 = A.getLayout(context) === B.AppLayout_mobile ? _null : A.getEntityIcon(B.EntityType_webhook);
t9.push(new A.Padding(B.EdgeInsets_16_16_16_16, A.Row$(A._setArrayType([t3, new A.SizedBox(16, _null, _null, _null), A.Expanded$(new A.AppButton(_null, t5, t4.toUpperCase(), new A._AccountOverview_build_closure7(store), _null, _null), 1)], t10), B.CrossAxisAlignment_2, B.MainAxisAlignment_0, B.MainAxisSize_1, _null), _null));
t8.push(new A.Padding(B.EdgeInsets_16_16_16_16, A.Row$(A._setArrayType([t3, new A.SizedBox(16, _null, _null, _null), A.Expanded$(new A.AppButton(_null, t5, t4.toUpperCase(), new A._AccountOverview_build_closure7(store), _null, _null), 1)], t9), B.CrossAxisAlignment_2, B.MainAxisAlignment_0, B.MainAxisSize_1, _null), _null));
}
t3 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "api_docs");
if (t3 == null)
@ -401628,8 +401688,8 @@
t4 = A.getLayout(context) === B.AppLayout_mobile ? _null : B._MdiIconData_uXI;
t3 = A.Expanded$(new A.AppButton(_null, t4, t3.toUpperCase(), new A._AccountOverview_build_closure8(), _null, _null), 1);
t4 = A.getLayout(context) === B.AppLayout_mobile ? _null : B._MdiIconData_Qa6;
t9.push(new A.Padding(B.EdgeInsets_16_16_16_16, A.Row$(A._setArrayType([t3, new A.SizedBox(16, _null, _null, _null), A.Expanded$(new A.AppButton(_null, t4, "Zapier", new A._AccountOverview_build_closure9(), _null, _null), 1)], t10), B.CrossAxisAlignment_2, B.MainAxisAlignment_0, B.MainAxisSize_1, _null), _null));
t9.push(new A.Padding(B.EdgeInsets_16_16_16_0, new A.ListDivider(_null), _null));
t8.push(new A.Padding(B.EdgeInsets_16_16_16_16, A.Row$(A._setArrayType([t3, new A.SizedBox(16, _null, _null, _null), A.Expanded$(new A.AppButton(_null, t4, "Zapier", new A._AccountOverview_build_closure9(), _null, _null), 1)], t9), B.CrossAxisAlignment_2, B.MainAxisAlignment_0, B.MainAxisSize_1, _null), _null));
t8.push(new A.Padding(B.EdgeInsets_16_16_16_0, new A.ListDivider(_null), _null));
t4 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "purge_data");
t3 = t4 == null ? "" : t4;
t4 = A.getLayout(context) === B.AppLayout_mobile ? _null : B.IconData_57785_MaterialIcons_null_false;
@ -401646,8 +401706,8 @@
t4 = t4.toUpperCase();
}
t5 = A.getLayout(context) === B.AppLayout_mobile ? _null : B.IconData_57785_MaterialIcons_null_false;
t9.push(new A.Padding(B.EdgeInsets_16_16_16_16, A.Row$(A._setArrayType([t3, new A.SizedBox(16, _null, _null, _null), A.Expanded$(new A.AppButton(B.MaterialColor_Map_JNc9P_4294198070, t5, t4, new A._AccountOverview_build_closure11(_this, companies, t1, company, t2, context), _null, _null), 1)], t10), B.CrossAxisAlignment_2, B.MainAxisAlignment_0, B.MainAxisSize_1, _null), _null));
return new A.ScrollableListView(t9, _null, _null, _null);
t8.push(new A.Padding(B.EdgeInsets_16_16_16_16, A.Row$(A._setArrayType([t3, new A.SizedBox(16, _null, _null, _null), A.Expanded$(new A.AppButton(B.MaterialColor_Map_JNc9P_4294198070, t5, t4, new A._AccountOverview_build_closure11(_this, companies, t1, company, t2, context), _null, _null), 1)], t9), B.CrossAxisAlignment_2, B.MainAxisAlignment_0, B.MainAxisSize_1, _null), _null));
return new A.ScrollableListView(t8, _null, _null, _null);
}
};
A._AccountOverview_build__getDataStats.prototype = {
@ -410200,6 +410260,7 @@
},
build$1(_, context) {
var company, t5, t6, enableCustomEmail, t7, t8, t9, t10, t11, editor, _this = this, _null = null,
_s20_ = "https://invoicing.co",
t1 = A.Localizations_of(context, B.Type_AppLocalization_KyD, type$.legacy_AppLocalization),
viewModel = _this._widget.viewModel,
state = viewModel.state,
@ -410212,9 +410273,14 @@
company = t2[t4].userCompany.company;
t5 = state.authState;
t6 = t5.get$isHosted();
if (t6)
enableCustomEmail = A.cleanApiUrl(t5.url) !== "https://invoicing.co" || t2[t4].userCompany.account.plan === "enterprise" || t2[t4].userCompany.account.plan === "pro";
else
if (t6) {
t6 = t5.url;
if (!(A.cleanApiUrl(t6) !== _s20_ || t2[t4].userCompany.account.plan === "enterprise" || t2[t4].userCompany.account.plan === "pro")) {
t6 = A.cleanApiUrl(t6) !== _s20_ || t2[t4].userCompany.account.plan === "enterprise" || t2[t4].userCompany.account.plan === "pro";
enableCustomEmail = t6;
} else
enableCustomEmail = true;
} else
enableCustomEmail = true;
t6 = t1.localeCode;
t7 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, t6), "template");

View File

@ -11,7 +11,7 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $font_name, Helvetica, sans-serif;
font-size: "$font_size";
font-size: $font_size;
zoom: 80%;
}

View File

@ -1,4 +1,4 @@
@if ($entity->documents->count() > 0 || $entity->company->documents->count() > 0 || ($entity->expense->exists() && $entity->expense->invoice_documents))
@if ($entity->documents->count() > 0 || $entity->company->documents->count() > 0 || ($entity->expense && $entity->expense->invoice_documents))
<div class="bg-white shadow sm:rounded-lg my-4">
<div class="px-4 py-5 sm:p-6">
<div class="sm:flex sm:items-start sm:justify-between">
@ -42,7 +42,7 @@
</div>
@endforeach
@if($entity->expense->exists() && $entity->expense->invoice_documents)
@if($entity->expense && $entity->expense->invoice_documents)
@foreach ($entity->expense->documents as $document)
<div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"

View File

@ -175,7 +175,7 @@ class LoginTest extends TestCase
$this->assertTrue($user->companies !== null);
$this->assertTrue($user->company_users !== null);
$this->assertTrue($user->company_users->first() !== null);
$this->assertTrue($user->company_user->account !== null);
$this->assertTrue($user->company_user()->account !== null);
$this->assertEquals($user->email, 'test@example.com');
$this->assertTrue(\Hash::check('123456', $user->password));