Refactor estimate pdf template

This commit is contained in:
radhu587
2020-05-05 18:21:25 +05:30
parent f8ccfece09
commit 189141c84d
5 changed files with 122 additions and 143 deletions

View File

@ -13,31 +13,31 @@
html { html {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
margin-top: 50px;
} }
table { table {
border-collapse: collapse; border-collapse: collapse;
} }
.header-line {
color: rgba(0, 0, 0, 0.2);
position: absolute;
top: 90px;
left: 0px;
width: 100%;
}
hr { hr {
margin: 0 30px 0 30px; margin: 0 30px 0 30px;
color: rgba(0, 0, 0, 0.2); color: rgba(0, 0, 0, 0.2);
border: 0.5px solid #EAF1FB; border: 0.5px solid #EAF1FB;
} }
.header-center { /* -------------------------- */
text-align: center /* header style */
.header-bottom-divider {
color: rgba(0, 0, 0, 0.2);
position: absolute;
top: 90px;
left: 0px;
width: 100%;
} }
.header-table { .header-container {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 90px; height: 90px;
@ -64,41 +64,38 @@
padding-bottom: 20px; padding-bottom: 20px;
} }
.address { .company-details-container {
/* display: inline-block; */ padding-top: 30px;
padding-top: 30px
} }
.company { /* -------------------------- */
/* company address style */
.company-address-container {
float: left; float: left;
padding-left: 30px; padding-left: 30px;
font-weight: normal;
width: 30%; width: 30%;
text-transform: capitalize; text-transform: capitalize;
margin-bottom: 2px; margin-bottom: 2px;
} }
.company h1 { .company-address-heading {
font-style: normal;
font-weight: normal;
font-size: 15px; font-size: 15px;
line-height: 22px; line-height: 22px;
letter-spacing: 0.05em; letter-spacing: 0.05em;
margin-bottom: 0px; margin-bottom: 0px;
margin-top: 10px;
} }
.company-address { .company-address-text {
margin-top: 2px; margin-top: 2px;
text-align: left; text-align: left;
font-style: normal;
font-weight: normal;
font-size: 12px; font-size: 12px;
line-height: 15px; line-height: 15px;
color: #595959; color: #595959;
} }
.job-add { .estimate-details-container {
/* display: inline; */
float: right; float: right;
padding: 10px 30px 0 0; padding: 10px 30px 0 0;
} }
@ -108,22 +105,24 @@
} }
.attribute-label { .attribute-label {
font-style: normal;
font-weight: normal;
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
padding-right: 40px; padding-right: 40px;
text-align: left;
color: #55547A
} }
.attribute-value { .attribute-value {
font-style: normal;
font-weight: normal;
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
text-align: right; text-align: right;
} }
.bill-add {
/* -------------------------- */
/* customer address style */
.customer-address-container {
width: 45%; width: 45%;
padding: 0px 0 0 0px; padding: 0px 0 0 0px;
} }
@ -131,14 +130,17 @@
/* -------------------------- */ /* -------------------------- */
/* shipping style */ /* shipping style */
.ship-address-container { .shipping-address-container {
float: right; float: right;
padding-left: 30px; padding-left: 30px;
} }
.ship-to { .shipping-address-container--left {
font-style: normal; float: left;
font-weight: normal; padding-left: 30px;
}
.shipping-address-label {
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
padding: 0px; padding: 0px;
@ -146,18 +148,15 @@
margin-bottom: 0px; margin-bottom: 0px;
} }
.ship-user-name { .shipping-address-name {
max-width: 250px font-style: normal; max-width: 250px;
font-weight: normal;
font-size: 15px; font-size: 15px;
line-height: 22px; line-height: 22px;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
.ship-user-address { .shipping-address-text {
font-style: normal;
font-weight: normal;
font-size: 10px; font-size: 10px;
line-height: 15px; line-height: 15px;
color: #595959; color: #595959;
@ -166,27 +165,15 @@
width: 160px; width: 160px;
} }
.ship-user-phone {
font-style: normal;
font-weight: normal;
font-size: 10px;
line-height: 15px;
color: #595959;
padding: 0px;
margin: 0px;
}
/* -------------------------- */ /* -------------------------- */
/* billing style */ /* billing style */
.bill-address-container { .billing-address-container {
float: left; float: left;
padding-left: 30px; padding-left: 30px;
} }
.bill-to { .billing-address-label {
font-style: normal;
font-weight: normal;
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
padding: 0px; padding: 0px;
@ -194,18 +181,15 @@
margin-bottom: 0px; margin-bottom: 0px;
} }
.bill-user-name { .billing-address-name {
max-width: 250px font-style: normal; max-width: 250px;
font-weight: normal;
font-size: 15px; font-size: 15px;
line-height: 22px; line-height: 22px;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
.bill-user-address { .billing-address-text {
font-style: normal;
font-weight: normal;
font-size: 10px; font-size: 10px;
line-height: 15px; line-height: 15px;
color: #595959; color: #595959;
@ -214,24 +198,14 @@
width: 160px; width: 160px;
} }
.bill-user-phone { .item-table {
font-style: normal;
font-weight: normal;
font-size: 10px;
line-height: 15px;
color: #595959;
padding: 0px;
margin: 0px;
}
.table2 {
margin-top: 35px; margin-top: 35px;
padding: 0px 30px 10px 30px; padding: 0px 30px 10px 30px;
page-break-before: avoid; page-break-before: avoid;
page-break-after: auto; page-break-after: auto;
} }
.table2 hr { .item-table hr {
height: 0.1px; height: 0.1px;
} }
@ -245,8 +219,6 @@
tr.item-table-heading-row th { tr.item-table-heading-row th {
border-bottom: 0.620315px solid #E8E8E8; border-bottom: 0.620315px solid #E8E8E8;
font-style: normal;
font-weight: normal;
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
} }
@ -256,18 +228,17 @@
} }
tr.item-row td { tr.item-row td {
font-style: normal;
font-weight: normal;
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
} }
.item-cell { .item-cell {
font-size: 13; font-size: 13;
color: rgba(0, 0, 0, 0.6); color: #040405;
text-align: center; text-align: center;
padding: 5px; padding: 5px;
padding-top: 10px; padding-top: 10px;
border-color: #d9d9d9;
} }
.padd8 { .padd8 {
@ -280,14 +251,15 @@
padding-bottom: 2px; padding-bottom: 2px;
} }
.table3 { .total-display-table {
border-top: none; border-top: none;
box-sizing: border-box; box-sizing: border-box;
width: 630px; width: 630px;
page-break-inside: avoid; page-break-inside: avoid;
page-break-before: auto; page-break-before: auto;
page-break-after: auto; page-break-after: auto;
margin-left:420px;
margin-top: 10px
} }
.total-border-left { .total-border-left {
@ -302,21 +274,13 @@
border-left: 0px !important; border-left: 0px !important;
padding-top: 0px; padding-top: 0px;
padding: 8px !important; padding: 8px !important;
} }
.inv-item { .inv-item {
border-color: #d9d9d9; border-color: red;
} }
.no-border {
border: none;
}
.notes { .notes {
font-style: normal;
font-weight: 300;
font-size: 12px; font-size: 12px;
color: #595959; color: #595959;
margin-top: 15px; margin-top: 15px;
@ -327,8 +291,6 @@
} }
.notes-label { .notes-label {
font-style: normal;
font-weight: normal;
font-size: 15px; font-size: 15px;
line-height: 22px; line-height: 22px;
letter-spacing: 0.05em; letter-spacing: 0.05em;
@ -337,14 +299,30 @@
height: 19.87px; height: 19.87px;
padding-bottom: 10px; padding-bottom: 10px;
} }
.text-center {
text-align: center
}
table .text-left {
text-align: left;
}
table .text-right {
text-align: right;
}
.no-border {
border: none;
}
</style> </style>
</head> </head>
<body> <body>
<div class="header-table"> <div class="header-container">
<table width="100%"> <table width="100%">
<tr> <tr>
<td class="header-center"> <td class="text-center">
@if($logo) @if($logo)
<img class="header-logo" src="{{ $logo }}" alt="Company Logo"> <img class="header-logo" src="{{ $logo }}" alt="Company Logo">
@else @else
@ -355,43 +333,43 @@
</td> </td>
</tr> </tr>
</table> </table>
<hr class="header-line" /> <hr class="header-bottom-divider" />
</div> </div>
<div class="wrapper"> <div class="wrapper">
<div class="address"> <div class="company-details-container">
<div class="company"> <div class="company-address-container">
@include('app.pdf.estimate.partials.company-address') @include('app.pdf.estimate.partials.company-address')
</div> </div>
<div class="job-add"> <div class="estimate-details-container">
<table> <table class="estimate-details-table">
<tr> <tr>
<td class="attribute-label" style="text-align: left; color: #55547A">Estimate Number</td> <td class="attribute-label">Estimate Number</td>
<td class="attribute-value"> &nbsp;{{$estimate->estimate_number}}</td> <td class="attribute-value"> &nbsp;{{$estimate->estimate_number}}</td>
</tr> </tr>
<tr> <tr>
<td class="attribute-label" style="text-align: left; color: #55547A">Estimate Date </td> <td class="attribute-label">Estimate Date </td>
<td class="attribute-value"> &nbsp;{{$estimate->formattedEstimateDate}}</td> <td class="attribute-value"> &nbsp;{{$estimate->formattedEstimateDate}}</td>
</tr> </tr>
<tr> <tr>
<td class="attribute-label" style="text-align: left; color: #55547A">Expiry Date</td> <td class="attribute-label">Expiry Date</td>
<td class="attribute-value"> &nbsp;{{$estimate->formattedExpiryDate}}</td> <td class="attribute-value"> &nbsp;{{$estimate->formattedExpiryDate}}</td>
</tr> </tr>
</table> </table>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
<div class="bill-add"> <div class="customer-address-container">
<div class="bill-address-container"> <div class="billing-address-container">
@include('app.pdf.estimate.partials.billing-address') @include('app.pdf.estimate.partials.billing-address')
</div> </div>
@if($estimate->user->billingaddress) @if($estimate->user->billingaddress)
<div class="ship-address-container"> <div class="shipping-address-container">
@else @else
<div class="ship-address-container " style="float:left;padding-left:0px;"> <div class="shipping-address-container--left">
@endif @endif
@include('app.pdf.estimate.partials.shipping-address') @include('app.pdf.estimate.partials.shipping-address')
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
<div style="position:relative"> <div style="position:relative">
@include('app.pdf.estimate.partials.table') @include('app.pdf.estimate.partials.table')
@ -400,4 +378,4 @@
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,11 +1,11 @@
@if($estimate->user->billingaddress) @if($estimate->user->billingaddress)
<p class="bill-to">Bill To,</p> <p class="billing-address-label">Bill To,</p>
@if($estimate->user->billingaddress->name) @if($estimate->user->billingaddress->name)
<p class="bill-user-name"> <p class="billing-address-name">
{{$estimate->user->billingaddress->name}} {{$estimate->user->billingaddress->name}}
</p> </p>
@endif @endif
<p class="bill-user-address"> <p class="billing-address-text">
@if($estimate->user->billingaddress->address_street_1) @if($estimate->user->billingaddress->address_street_1)
{!! nl2br(htmlspecialchars($estimate->user->billingaddress->address_street_1)) !!}<br> {!! nl2br(htmlspecialchars($estimate->user->billingaddress->address_street_1)) !!}<br>
@endif @endif
@ -31,7 +31,7 @@
@endif @endif
@if($estimate->user->billingaddress->phone) @if($estimate->user->billingaddress->phone)
<p class="bill-user-phone"> <p class="billing-address-text">
Phone :{{$estimate->user->billingaddress->phone}} Phone :{{$estimate->user->billingaddress->phone}}
</p> </p>
@endif @endif

View File

@ -1,9 +1,9 @@
@if($estimate->user->company) @if($estimate->user->company)
<h1> {{$estimate->user->company->name}} </h1> <p class="company-address-heading"> {{$estimate->user->company->name}} </p>
@endif @endif
@if($company_address) @if($company_address)
<p class="company-add"> <p class="company-address-text">
@if($company_address->addresses[0]['address_street_1']) @if($company_address->addresses[0]['address_street_1'])
{!! nl2br(htmlspecialchars($company_address->addresses[0]['address_street_1'])) !!} <br> {!! nl2br(htmlspecialchars($company_address->addresses[0]['address_street_1'])) !!} <br>
@endif @endif

View File

@ -1,11 +1,11 @@
@if($estimate->user->shippingaddress) @if($estimate->user->shippingaddress)
<p class="ship-to">Ship To,</p> <p class="shipping-address-label">Ship To,</p>
@if($estimate->user->shippingaddress->name) @if($estimate->user->shippingaddress->name)
<p class="ship-user-name"> <p class="shipping-address-name">
{{$estimate->user->shippingaddress->name}} {{$estimate->user->shippingaddress->name}}
</p> </p>
@endif @endif
<p class="ship-user-address"> <p class="shipping-address-text">
@if($estimate->user->shippingaddress->address_street_1) @if($estimate->user->shippingaddress->address_street_1)
{!! nl2br(htmlspecialchars($estimate->user->shippingaddress->address_street_1)) !!}<br> {!! nl2br(htmlspecialchars($estimate->user->shippingaddress->address_street_1)) !!}<br>
@endif @endif
@ -31,7 +31,7 @@
@endif @endif
@if($estimate->user->phone) @if($estimate->user->phone)
<p class="ship-user-phone"> <p class="shipping-address-text">
Phone :{{$estimate->user->shippingaddress->phone}} Phone :{{$estimate->user->shippingaddress->phone}}
</p> </p>
@endif @endif

View File

@ -1,13 +1,13 @@
<table width="100%" class="table2" cellspacing="0" border="0"> <table width="100%" class="item-table" cellspacing="0" border="0">
<tr class="item-table-heading-row"> <tr class="item-table-heading-row">
<th width="2%" class="item-table-heading" style="text-align: right; color: #55547A; padding-right: 20px">#</th> <th width="2%" class="item-table-heading text-right" style="padding-right: 20px">#</th>
<th width="40%" class="item-table-heading" style="text-align: left; color: #55547A; padding-left: 0px">Items</th> <th width="40%" class="item-table-heading text-left" style="padding-left: 0px">Items</th>
<th class="item-table-heading" style="text-align: right; color: #55547A; padding-right: 20px">Quantity</th> <th class="item-table-heading text-right" style="padding-right: 20px">Quantity</th>
<th class="item-table-heading" style="text-align: right; color: #55547A; padding-right: 20px">Price</th> <th class="item-table-heading text-right" style="padding-right: 20px">Price</th>
@if($estimate->discount_per_item === 'YES') @if($estimate->discount_per_item === 'YES')
<th class="item-table-heading" style="text-align: right; color: #55547A; padding-left: 10px">Discount</th> <th class="item-table-heading text-right" style="padding-left: 10px">Discount</th>
@endif @endif
<th class="item-table-heading" style="text-align: right; color: #55547A;">Amount</th> <th class="item-table-heading text-right">Amount</th>
</tr> </tr>
@php @php
$index = 1 $index = 1
@ -15,36 +15,37 @@
@foreach ($estimate->items as $item) @foreach ($estimate->items as $item)
<tr class="item-row"> <tr class="item-row">
<td <td
class="inv-item item-cell" class="item-cell text-right"
style="text-align: right; color: #040405; padding-right: 20px; vertical-align: top;" style="padding-right: 20px; vertical-align: top;"
> >
{{$index}} {{$index}}
</td> </td>
<td <td
class="inv-item item-cell" class="item-cell text-left"
style="text-align: left; color: #040405;padding-left: 0px" style="padding-left: 0px"
> >
<span>{{ $item->name }}</span><br> <span>{{ $item->name }}</span><br>
<span <span
style="text-align: left; color: #595959; font-size: 9px; font-weight:300; line-height: 12px;" class="text-left"
style="color: #595959; font-size: 9px; font-weight:300; line-height: 12px;"
> >
{!! nl2br(htmlspecialchars($item->description)) !!} {!! nl2br(htmlspecialchars($item->description)) !!}
</span> </span>
</td> </td>
<td <td
class="inv-item item-cell" class="item-cell text-right"
style="text-align: right; color: #040405; padding-right: 20px" style="padding-right: 20px"
> >
{{$item->quantity}} {{$item->quantity}}
</td> </td>
<td <td
class="inv-item item-cell" class="item-cell text-right"
style="text-align: right; color: #040405; padding-right: 20px" style="padding-right: 20px"
> >
{!! format_money_pdf($item->price, $estimate->user->currency) !!} {!! format_money_pdf($item->price, $estimate->user->currency) !!}
</td> </td>
@if($estimate->discount_per_item === 'YES') @if($estimate->discount_per_item === 'YES')
<td class="inv-item item-cell" style="text-align: right; color: #040405; padding-left: 10px"> <td class="item-cell text-right" style="padding-left: 10px">
@if($item->discount_type === 'fixed') @if($item->discount_type === 'fixed')
{!! format_money_pdf($item->discount_val, $estimate->user->currency) !!} {!! format_money_pdf($item->discount_val, $estimate->user->currency) !!}
@endif @endif
@ -53,7 +54,7 @@
@endif @endif
</td> </td>
@endif @endif
<td class="inv-item item-cell" style="text-align: right; color: #040405;"> <td class="item-cell text-right">
{!! format_money_pdf($item->total, $estimate->user->currency) !!} {!! format_money_pdf($item->total, $estimate->user->currency) !!}
</td> </td>
</tr> </tr>
@ -65,9 +66,9 @@
<hr class="items-table-hr"> <hr class="items-table-hr">
<table width="100%" cellspacing="0px" style="margin-left:420px;margin-top: 10px" border="0" class="table3 @if(count($estimate->items) > 12) page-break @endif"> <table width="100%" cellspacing="0px" border="0" class="total-display-table @if(count($estimate->items) > 12) page-break @endif">
<tr> <tr>
<td class="no-borde" style="color: #55547A; padding-left:10px; font-size:12px;">Subtotal</td> <td class="no-border" style="color: #55547A; padding-left:10px; font-size:12px;">Subtotal</td>
<td class="no-border item-cell" <td class="no-border item-cell"
style="padding-right:10px; text-align: right; font-size:12px; color: #040405; font-weight: 500;">{!! format_money_pdf($estimate->sub_total, $estimate->user->currency) !!}</td> style="padding-right:10px; text-align: right; font-size:12px; color: #040405; font-weight: 500;">{!! format_money_pdf($estimate->sub_total, $estimate->user->currency) !!}</td>
</tr> </tr>
@ -75,10 +76,10 @@
@if ($estimate->tax_per_item === 'YES') @if ($estimate->tax_per_item === 'YES')
@for ($i = 0; $i < count($labels); $i++) @for ($i = 0; $i < count($labels); $i++)
<tr> <tr>
<td class="no-border" style="padding-left:10px; text-align:left; font-size:12px; color: #55547A;"> <td class="no-border text-left" style="padding-left:10px; font-size:12px; color: #55547A;">
{{$labels[$i]}} {{$labels[$i]}}
</td> </td>
<td class="no-border item-cell padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405"> <td class="no-border item-cell padd2 text-right" style="padding-right:10px; font-weight: 500; font-size:12px; color: #040405">
{!! format_money_pdf($taxes[$i], $estimate->user->currency) !!} {!! format_money_pdf($taxes[$i], $estimate->user->currency) !!}
</td> </td>
</tr> </tr>
@ -86,10 +87,10 @@
@else @else
@foreach ($estimate->taxes as $tax) @foreach ($estimate->taxes as $tax)
<tr> <tr>
<td class="no-border" style="padding-left:10px; text-align:left; font-size:12px; color: #55547A;"> <td class="no-border text-left" style="padding-left:10px; font-size:12px; color: #55547A;">
{{$tax->name.' ('.$tax->percent.'%)'}} {{$tax->name.' ('.$tax->percent.'%)'}}
</td> </td>
<td class="no-border item-cell padd2" style="padding-right:10px; font-weight: 500; text-align: right; font-size:12px; color: #040405"> <td class="no-border item-cell padd2 text-right" style="padding-right:10px; font-weight: 500; font-size:12px; color: #040405">
{!! format_money_pdf($tax->amount, $estimate->user->currency) !!} {!! format_money_pdf($tax->amount, $estimate->user->currency) !!}
</td> </td>
</tr> </tr>