Fixes for plain design

This commit is contained in:
David Bomba 2022-03-15 23:28:16 +11:00
parent 256ea3bdee
commit e035a75cc3
9 changed files with 136 additions and 76 deletions

View File

@ -33,6 +33,7 @@ class Company extends BaseModel
use CompanySettingsSaver;
use ThrottlesEmail;
use AppSetup;
use \Awobaz\Compoships\Compoships;
const ENTITY_RECURRING_INVOICE = 'recurring_invoice';
const ENTITY_CREDIT = 'credit';
@ -471,7 +472,7 @@ class Company extends BaseModel
public function company_users()
{
return $this->hasMany(CompanyUser::class);
return $this->hasMany(CompanyUser::class)->withTrashed();
}
public function owner()

View File

@ -17,6 +17,7 @@ class CompanyToken extends BaseModel
{
use SoftDeletes;
use Filterable;
use \Awobaz\Compoships\Compoships;
protected $fillable = [
'name',

View File

@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class CompanyUser extends Pivot
{
use SoftDeletes;
use \Awobaz\Compoships\Compoships;
// protected $guarded = ['id'];

View File

@ -44,6 +44,7 @@ class User extends Authenticatable implements MustVerifyEmail
use UserSettings;
use Filterable;
use HasFactory;
use \Awobaz\Compoships\Compoships;
protected $guard = 'user';
@ -250,18 +251,19 @@ class User extends Authenticatable implements MustVerifyEmail
public function company_user()
{
// return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'user_id', 'id', 'user_id')
// ->withTrashed();
if($this->companyId())
return $this->belongsTo(CompanyUser::class)->where('company_id', $this->companyId())->withTrashed();
$truth = app()->make(TruthSource::class);
if($truth->getCompanyUser()){
if($truth->getCompanyUser())
return $truth->getCompanyUser();
}
return $this->token()->cu;
// return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'user_id', 'id', 'user_id')
// ->withTrashed();
}
/**

View File

@ -645,8 +645,8 @@ class Design extends BaseDesign
if ($this->type === self::STATEMENT) {
return [
['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [
['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: flex; align-items: flex-start;'], 'elements' => [
['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'overflow: visible !important; display: block; page-break-inside: auto; height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: block; align-items: flex-start; page-break-inside: avoid; visible !important;'], 'elements' => [
['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'overflow: visible !important; display: block; page-break-inside: avoid; height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
]],
]],
];
@ -667,8 +667,8 @@ class Design extends BaseDesign
['element' => 'span', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.terms']), $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']],
]],
['element' => 'img', 'properties' => ['style' => 'max-width: 50%; height: auto;', 'src' => '$contact.signature', 'id' => 'contact-signature']],
['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: flex; align-items: flex-start;'], 'elements' => [
['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'overflow: visible !important; display: block; page-break-inside:auto; height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: block; align-items: flex-start; page-break-inside: avoid; visible !important;'], 'elements' => [
['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'overflow: visible !important; display: block; page-break-inside: avoid; height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
]],
]],
['element' => 'div', 'properties' => ['class' => 'totals-table-right-side', 'dir' => '$dir'], 'elements' => []],

View File

@ -33,6 +33,7 @@
"afosto/yaac": "^1.4",
"asm/php-ansible": "^3",
"authorizenet/authorizenet": "^2.0",
"awobaz/compoships": "^2.1",
"bacon/bacon-qr-code": "^2.0",
"beganovich/snappdf": "^1.7",
"braintree/braintree_php": "^6.0",

170
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7deb0e188126e67042fb4a872f0ad5fb",
"content-hash": "757a9ac77c2ab087200bef004b00c6e1",
"packages": [
{
"name": "afosto/yaac",
@ -322,6 +322,66 @@
},
"time": "2021-03-31T18:22:14+00:00"
},
{
"name": "awobaz/compoships",
"version": "2.1.3",
"source": {
"type": "git",
"url": "https://github.com/topclaudy/compoships.git",
"reference": "c5b107f16a2a8650fb2dbc21babd4a65a0f48585"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/topclaudy/compoships/zipball/c5b107f16a2a8650fb2dbc21babd4a65a0f48585",
"reference": "c5b107f16a2a8650fb2dbc21babd4a65a0f48585",
"shasum": ""
},
"require": {
"illuminate/database": ">=5.6 <10.0"
},
"require-dev": {
"ext-sqlite3": "*"
},
"suggest": {
"awobaz/blade-active": "Blade directives for the Laravel 'Active' package",
"awobaz/eloquent-auto-append": "Automatically append accessors to model serialization",
"awobaz/eloquent-mutators": "Reusable mutators (getters/setters) for Laravel 5's Eloquent",
"awobaz/syntactic": "Syntactic sugar for named and indexed parameters call."
},
"type": "library",
"autoload": {
"psr-4": {
"Awobaz\\Compoships\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Claudin J. Daniel",
"email": "cdaniel@awobaz.com"
}
],
"description": "Laravel relationships with support for composite/multiple keys",
"keywords": [
"laravel",
"laravel composite keys",
"laravel relationships"
],
"support": {
"issues": "https://github.com/topclaudy/compoships/issues",
"source": "https://github.com/topclaudy/compoships/tree/2.1.3"
},
"funding": [
{
"url": "https://paypal.me/awobaz",
"type": "custom"
}
],
"time": "2021-11-29T22:11:22+00:00"
},
{
"name": "aws/aws-crt-php",
"version": "v1.0.2",
@ -374,16 +434,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.212.7",
"version": "3.213.0",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "7f4c976df8a0fbe8d786e4b479d44e22478ce8af"
"reference": "61875282d6ec1c441ca0af94fc00a5f516db12ef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/7f4c976df8a0fbe8d786e4b479d44e22478ce8af",
"reference": "7f4c976df8a0fbe8d786e4b479d44e22478ce8af",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/61875282d6ec1c441ca0af94fc00a5f516db12ef",
"reference": "61875282d6ec1c441ca0af94fc00a5f516db12ef",
"shasum": ""
},
"require": {
@ -459,22 +519,22 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.212.7"
"source": "https://github.com/aws/aws-sdk-php/tree/3.213.0"
},
"time": "2022-03-11T19:14:33+00:00"
"time": "2022-03-14T18:26:52+00:00"
},
{
"name": "bacon/bacon-qr-code",
"version": "2.0.6",
"version": "2.0.7",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
"reference": "0069435e2a01a57193b25790f105a5d3168653c1"
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/0069435e2a01a57193b25790f105a5d3168653c1",
"reference": "0069435e2a01a57193b25790f105a5d3168653c1",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
"shasum": ""
},
"require": {
@ -513,9 +573,9 @@
"homepage": "https://github.com/Bacon/BaconQrCode",
"support": {
"issues": "https://github.com/Bacon/BaconQrCode/issues",
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.6"
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.7"
},
"time": "2022-02-04T20:16:05+00:00"
"time": "2022-03-14T02:02:36+00:00"
},
{
"name": "beganovich/snappdf",
@ -1340,16 +1400,16 @@
},
{
"name": "composer/semver",
"version": "3.2.9",
"version": "3.3.0",
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649"
"reference": "f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649",
"reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649",
"url": "https://api.github.com/repos/composer/semver/zipball/f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b",
"reference": "f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b",
"shasum": ""
},
"require": {
@ -1401,7 +1461,7 @@
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/3.2.9"
"source": "https://github.com/composer/semver/tree/3.3.0"
},
"funding": [
{
@ -1417,7 +1477,7 @@
"type": "tidelift"
}
],
"time": "2022-02-04T13:58:43+00:00"
"time": "2022-03-15T08:35:57+00:00"
},
{
"name": "composer/spdx-licenses",
@ -2775,16 +2835,16 @@
},
{
"name": "google/apiclient-services",
"version": "v0.238.1",
"version": "v0.239.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "a9866fd963f53e9a7d26d36f20c471f73a90a719"
"reference": "ce8e34d618bdef9e824fd1728d505a468818712c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/a9866fd963f53e9a7d26d36f20c471f73a90a719",
"reference": "a9866fd963f53e9a7d26d36f20c471f73a90a719",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ce8e34d618bdef9e824fd1728d505a468818712c",
"reference": "ce8e34d618bdef9e824fd1728d505a468818712c",
"shasum": ""
},
"require": {
@ -2813,9 +2873,9 @@
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.238.1"
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.239.0"
},
"time": "2022-03-07T18:23:49+00:00"
"time": "2022-03-13T01:20:35+00:00"
},
{
"name": "google/auth",
@ -5351,16 +5411,16 @@
},
{
"name": "monolog/monolog",
"version": "2.3.5",
"version": "2.4.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "fd4380d6fc37626e2f799f29d91195040137eba9"
"reference": "d7fd7450628561ba697b7097d86db72662f54aef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9",
"reference": "fd4380d6fc37626e2f799f29d91195040137eba9",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef",
"reference": "d7fd7450628561ba697b7097d86db72662f54aef",
"shasum": ""
},
"require": {
@ -5382,7 +5442,7 @@
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5",
"predis/predis": "^1.1",
"rollbar/rollbar": "^1.3",
"rollbar/rollbar": "^1.3 || ^2 || ^3",
"ruflin/elastica": ">=0.90@dev",
"swiftmailer/swiftmailer": "^5.3|^6.0"
},
@ -5434,7 +5494,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.3.5"
"source": "https://github.com/Seldaek/monolog/tree/2.4.0"
},
"funding": [
{
@ -5446,7 +5506,7 @@
"type": "tidelift"
}
],
"time": "2021-10-01T21:08:31+00:00"
"time": "2022-03-14T12:44:37+00:00"
},
{
"name": "mtdowling/jmespath.php",
@ -8379,16 +8439,16 @@
},
{
"name": "sentry/sentry",
"version": "3.3.7",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-php.git",
"reference": "32e5415803ff0349ccb5e5b5e77b016320762786"
"reference": "a92443883df6a55cbe7a062f76949f23dda66772"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/32e5415803ff0349ccb5e5b5e77b016320762786",
"reference": "32e5415803ff0349ccb5e5b5e77b016320762786",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/a92443883df6a55cbe7a062f76949f23dda66772",
"reference": "a92443883df6a55cbe7a062f76949f23dda66772",
"shasum": ""
},
"require": {
@ -8400,7 +8460,7 @@
"php": "^7.2|^8.0",
"php-http/async-client-implementation": "^1.0",
"php-http/client-common": "^1.5|^2.0",
"php-http/discovery": "^1.6.1",
"php-http/discovery": "^1.11",
"php-http/httplug": "^1.1|^2.0",
"php-http/message": "^1.5",
"psr/http-factory": "^1.0",
@ -8434,7 +8494,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3.x-dev"
"dev-master": "3.4.x-dev"
}
},
"autoload": {
@ -8468,7 +8528,7 @@
],
"support": {
"issues": "https://github.com/getsentry/sentry-php/issues",
"source": "https://github.com/getsentry/sentry-php/tree/3.3.7"
"source": "https://github.com/getsentry/sentry-php/tree/3.4.0"
},
"funding": [
{
@ -8480,7 +8540,7 @@
"type": "custom"
}
],
"time": "2022-01-19T08:46:27+00:00"
"time": "2022-03-13T12:38:01+00:00"
},
{
"name": "sentry/sentry-laravel",
@ -14135,16 +14195,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.18",
"version": "9.5.19",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "1b5856028273bfd855e60a887278857d872ec67a"
"reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b5856028273bfd855e60a887278857d872ec67a",
"reference": "1b5856028273bfd855e60a887278857d872ec67a",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807",
"reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807",
"shasum": ""
},
"require": {
@ -14174,7 +14234,7 @@
"sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^2.3.4",
"sebastian/type": "^3.0",
"sebastian/version": "^3.0.2"
},
"require-dev": {
@ -14222,7 +14282,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.18"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19"
},
"funding": [
{
@ -14234,7 +14294,7 @@
"type": "github"
}
],
"time": "2022-03-08T06:52:28+00:00"
"time": "2022-03-15T09:57:31+00:00"
},
{
"name": "sebastian/cli-parser",
@ -15093,28 +15153,28 @@
},
{
"name": "sebastian/type",
"version": "2.3.4",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914"
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^9.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
@ -15137,7 +15197,7 @@
"homepage": "https://github.com/sebastianbergmann/type",
"support": {
"issues": "https://github.com/sebastianbergmann/type/issues",
"source": "https://github.com/sebastianbergmann/type/tree/2.3.4"
"source": "https://github.com/sebastianbergmann/type/tree/3.0.0"
},
"funding": [
{
@ -15145,7 +15205,7 @@
"type": "github"
}
],
"time": "2021-06-15T12:49:02+00:00"
"time": "2022-03-15T09:54:48+00:00"
},
{
"name": "sebastian/version",

View File

@ -94,7 +94,7 @@
}
[data-ref="table"] {
margin-top: 3rem;
margin-top: 1rem;
/* margin-bottom: 200px; */
min-width: 100%;
table-layout: fixed;
@ -140,10 +140,6 @@
background-color: #f5f5f5;
}
#table-totals {
page-break-inside: avoid;
}
#table-totals {
margin-top: 0rem;
display: grid;
@ -321,7 +317,7 @@
$entity_images
<div class="repeating-footer" id="footer">
<div class="repeating-footerx" id="footer">
<p data-ref="total_table-footer">$entity_footer</p>

View File

@ -106,10 +106,6 @@
text-align: right;
}
#table-totals {
page-break-inside: avoid;
}
#table-totals {
margin-top: 0rem;
display: grid;
@ -118,6 +114,8 @@
padding-left: 1rem;
margin-right: .75rem;
gap: 80px;
page-break-inside:auto;
overflow: visible !important;
}
#table-totals .totals-table-right-side>* {
@ -290,7 +288,7 @@
$entity_images
<div class="repeating-footer" id="footer">
<div class="repeating-footerx" id="footer">
<p data-ref="total_table-footer">$entity_footer</p>
<script>