mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-11-04 06:23:17 -05:00 
			
		
		
		
	Refactor estimate pdf template
This commit is contained in:
		@ -1,11 +1,11 @@
 | 
			
		||||
@if($estimate->user->billingaddress)
 | 
			
		||||
    <p class="bill-to">Bill To,</p>
 | 
			
		||||
    <p class="billing-address-label">Bill To,</p>
 | 
			
		||||
    @if($estimate->user->billingaddress->name)
 | 
			
		||||
        <p class="bill-user-name">
 | 
			
		||||
        <p class="billing-address-name">
 | 
			
		||||
            {{$estimate->user->billingaddress->name}}
 | 
			
		||||
        </p>
 | 
			
		||||
    @endif
 | 
			
		||||
    <p class="bill-user-address">
 | 
			
		||||
    <p class="billing-address-text">
 | 
			
		||||
        @if($estimate->user->billingaddress->address_street_1)
 | 
			
		||||
            {!! nl2br(htmlspecialchars($estimate->user->billingaddress->address_street_1)) !!}<br>
 | 
			
		||||
        @endif
 | 
			
		||||
@ -31,7 +31,7 @@
 | 
			
		||||
        @endif
 | 
			
		||||
 | 
			
		||||
        @if($estimate->user->billingaddress->phone)
 | 
			
		||||
            <p class="bill-user-phone">
 | 
			
		||||
            <p class="billing-address-text">
 | 
			
		||||
                Phone :{{$estimate->user->billingaddress->phone}}
 | 
			
		||||
            </p>
 | 
			
		||||
        @endif
 | 
			
		||||
 | 
			
		||||
@ -1,9 +1,9 @@
 | 
			
		||||
@if($estimate->user->company)
 | 
			
		||||
    <h1> {{$estimate->user->company->name}} </h1>
 | 
			
		||||
    <p class="company-address-heading"> {{$estimate->user->company->name}} </p>
 | 
			
		||||
@endif
 | 
			
		||||
 | 
			
		||||
@if($company_address)
 | 
			
		||||
    <p class="company-add">
 | 
			
		||||
    <p class="company-address-text">
 | 
			
		||||
        @if($company_address->addresses[0]['address_street_1'])
 | 
			
		||||
            {!! nl2br(htmlspecialchars($company_address->addresses[0]['address_street_1'])) !!} <br>
 | 
			
		||||
        @endif
 | 
			
		||||
 | 
			
		||||
@ -1,11 +1,11 @@
 | 
			
		||||
@if($estimate->user->shippingaddress)
 | 
			
		||||
    <p class="ship-to">Ship To,</p>
 | 
			
		||||
    <p class="shipping-address-label">Ship To,</p>
 | 
			
		||||
    @if($estimate->user->shippingaddress->name)
 | 
			
		||||
        <p class="ship-user-name">
 | 
			
		||||
        <p class="shipping-address-name">
 | 
			
		||||
            {{$estimate->user->shippingaddress->name}}
 | 
			
		||||
        </p>
 | 
			
		||||
    @endif
 | 
			
		||||
    <p class="ship-user-address">
 | 
			
		||||
    <p class="shipping-address-text">
 | 
			
		||||
        @if($estimate->user->shippingaddress->address_street_1)
 | 
			
		||||
            {!! nl2br(htmlspecialchars($estimate->user->shippingaddress->address_street_1)) !!}<br>
 | 
			
		||||
        @endif
 | 
			
		||||
@ -31,7 +31,7 @@
 | 
			
		||||
        @endif
 | 
			
		||||
 | 
			
		||||
        @if($estimate->user->phone)
 | 
			
		||||
            <p class="ship-user-phone">
 | 
			
		||||
            <p class="shipping-address-text">
 | 
			
		||||
                Phone :{{$estimate->user->shippingaddress->phone}}
 | 
			
		||||
            </p>
 | 
			
		||||
        @endif
 | 
			
		||||
 | 
			
		||||
@ -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">
 | 
			
		||||
        <th width="2%" class="item-table-heading" style="text-align: right; color: #55547A; padding-right: 20px">#</th>
 | 
			
		||||
        <th width="40%" class="item-table-heading" style="text-align: left; color: #55547A; 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" style="text-align: right; color: #55547A; padding-right: 20px">Price</th>
 | 
			
		||||
        <th width="2%" class="item-table-heading text-right" style="padding-right: 20px">#</th>
 | 
			
		||||
        <th width="40%" class="item-table-heading text-left" style="padding-left: 0px">Items</th>
 | 
			
		||||
        <th class="item-table-heading text-right" style="padding-right: 20px">Quantity</th>
 | 
			
		||||
        <th class="item-table-heading text-right" style="padding-right: 20px">Price</th>
 | 
			
		||||
        @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
 | 
			
		||||
        <th class="item-table-heading" style="text-align: right; color: #55547A;">Amount</th>
 | 
			
		||||
        <th class="item-table-heading text-right">Amount</th>
 | 
			
		||||
    </tr>
 | 
			
		||||
    @php
 | 
			
		||||
        $index = 1
 | 
			
		||||
@ -15,36 +15,37 @@
 | 
			
		||||
    @foreach ($estimate->items as $item)
 | 
			
		||||
        <tr class="item-row">
 | 
			
		||||
            <td
 | 
			
		||||
                class="inv-item item-cell"
 | 
			
		||||
                style="text-align: right; color: #040405; padding-right: 20px; vertical-align: top;"
 | 
			
		||||
                class="item-cell text-right"
 | 
			
		||||
                style="padding-right: 20px; vertical-align: top;"
 | 
			
		||||
            >
 | 
			
		||||
                {{$index}}
 | 
			
		||||
            </td>
 | 
			
		||||
            <td
 | 
			
		||||
                class="inv-item item-cell"
 | 
			
		||||
                style="text-align: left; color: #040405;padding-left: 0px"
 | 
			
		||||
                class="item-cell text-left"
 | 
			
		||||
                style="padding-left: 0px"
 | 
			
		||||
            >
 | 
			
		||||
                <span>{{ $item->name }}</span><br>
 | 
			
		||||
                <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)) !!}
 | 
			
		||||
                </span>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td
 | 
			
		||||
                class="inv-item item-cell"
 | 
			
		||||
                style="text-align: right; color: #040405; padding-right: 20px"
 | 
			
		||||
                class="item-cell text-right"
 | 
			
		||||
                style="padding-right: 20px"
 | 
			
		||||
            >
 | 
			
		||||
                {{$item->quantity}}
 | 
			
		||||
            </td>
 | 
			
		||||
            <td
 | 
			
		||||
                class="inv-item item-cell"
 | 
			
		||||
                style="text-align: right; color: #040405; padding-right: 20px"
 | 
			
		||||
                class="item-cell text-right"
 | 
			
		||||
                style="padding-right: 20px"
 | 
			
		||||
            >
 | 
			
		||||
                {!! format_money_pdf($item->price, $estimate->user->currency) !!}
 | 
			
		||||
            </td>
 | 
			
		||||
            @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')
 | 
			
		||||
                        {!! format_money_pdf($item->discount_val, $estimate->user->currency) !!}
 | 
			
		||||
                    @endif
 | 
			
		||||
@ -53,7 +54,7 @@
 | 
			
		||||
                    @endif
 | 
			
		||||
                </td>
 | 
			
		||||
            @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) !!}
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
@ -65,9 +66,9 @@
 | 
			
		||||
 | 
			
		||||
<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>
 | 
			
		||||
        <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"
 | 
			
		||||
            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>
 | 
			
		||||
@ -75,10 +76,10 @@
 | 
			
		||||
    @if ($estimate->tax_per_item === 'YES')
 | 
			
		||||
        @for ($i = 0; $i < count($labels); $i++)
 | 
			
		||||
            <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]}}
 | 
			
		||||
                </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) !!}
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
@ -86,10 +87,10 @@
 | 
			
		||||
    @else
 | 
			
		||||
        @foreach ($estimate->taxes as $tax)
 | 
			
		||||
            <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.'%)'}}
 | 
			
		||||
                </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) !!}
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user