Using inline css with DomPDF and Laravel - php

I am having a problem with my inline css. So, I am trying to add a border under the data rendered from the database. The problem is the rendered data is under the name, the How can I move the border-bottom and the rendered data at the right of the word "Name"?
here's the html code
<table style="border:none;border-collapse: collapse;font-size:12px;text-align: left;">
<tr>
<td colspan="3"><b>I. PERSONAL AND FAMILY DATA</b></td><td colspan="2"><b>Date today</b> <u>{{ \Carbon\Carbon::parse($infomodel->date_last_updated)->format('m-d-Y') }}</u></td>
</tr>
<tr >
<td colspan="3"><b>Name </b><div style="border-bottom:.7px solid black;height:15px;padding:0px;width:290px;overflow:hidden;">{!! $usermodel->last_name !!}, {!! $usermodel->first_name!!} {!! $usermodel->middle_name !!}.
</div>
</td>
<td colspan="2"><b>Sex </b><u>{!! $infomodel->gender !!}</u></td>
</tr>
<tr>
<td colspan="5"><b>Home Address </b><div style="border-bottom:.7px solid black;height:15px;padding:0px;width:450px;overflow:hidden;">{!! $infomodel->mailing_address !!}
</div>
</td>
</tr>
</table><br />
Here is the pdf view

Print the output in the styled element. And make the element to an inline element.
Example:
Change this :
<td colspan="3"><b>Name </b><div style="border-bottom:.7px solid black;height:15px;padding:0px;width:290px;overflow:hidden;">{!! $usermodel->last_name !!}, {!! $usermodel->first_name!!} {!! $usermodel->middle_name !!}.
</div>
</td>
to this:
<td colspan="3"><b>Name </b>
<div style="display: inline; border-bottom:.7px solid black;height:15px;padding:0px;width:290px;overflow:hidden;">{!! $usermodel->last_name !!}, {!! $usermodel->first_name!!} {!! $usermodel->middle_name !!}.
</div>
</td>
<table style="border:none;border-collapse: collapse;font-size:12px;text-align: left;">
<tr>
<td colspan="3"><b>I. PERSONAL AND FAMILY DATA</b></td><td colspan="2"><b>Date today</b> <u>{{ \Carbon\Carbon::parse($infomodel->date_last_updated)->format('m-d-Y') }}</u></td>
</tr>
<tr >
<td colspan="3"><b>Name </b><div style="display: inline; border-bottom:.7px solid black;height:10px;padding:0px;width:290px;overflow:hidden;">
{!! $usermodel->last_name !!}, {!! $usermodel->first_name!!} {!! $usermodel->middle_name !!}.
</div>
</td>
<td colspan="2"><b>Sex </b><u>{!! $infomodel->gender !!}</u></td>
</tr>
<tr>
<td colspan="5"><b>Home Address </b>{!! $infomodel->mailing_address !!}
<div style="border-bottom:.7px solid black;height:15px;padding:0px;width:450px;overflow:hidden;">
</div>
</td>
</tr>
</table><br />

Related

Create a laravel post to create a variant product creator system

I am creating a CMS for an E-commerce and I am having problems developing a system to create variants of products.
I have the frontend developed and it seems like the image:
As you can see, the system generates possible variants using the type of product in question. Then, the admin has to select which variants wants to create and click the submit button.
What I think is to make a form post, and get the request on the controller. With this approach, the request only contains the selected variants. But now, I have to create the variants and store them on DB, and with this information, I don't know how to make a dynamic iteration for each variant selected.
For example, if I press the submit button on the image, I get the following request:
{
"_token":"OQElUkt7zMaxr1JkZU6fw1r9gcaBuLa6gXHKSsex",
"row-check-0":"0001-0001",
"row-check-1":"0001-0002",
"row-check-2":"0001-0003",
"row-check-3":"0001-0004",
"row-check-4":"0001-0005"
}
To create a variant I need the N.º de producto and the Referencia values. For example, row1 would be a variant with code: "0001-0001" and value:"1"
This is the HTML code:
<div class="inside">
{!! Form::open(['url' => '/admin/products/'.$product->id.'/variants/new']) !!}
<table class="table table-striped">
<thead>
<tr>
<th scope="col" style="text-align: center; width:5%">
<input type="checkbox" id="masterCheck" value="checkUncheckAll">
</th>
<th scope="col">N.º de producto</th>
<th scope="col">{{$product->type_product->name}}</th>
</tr>
</thead>
<tbody>
<?php
$count = 0;
$last_code = 0;
?>
#foreach($no_used_values as $no_used_value)
<?php
$last_code = getNextCode($last_code);
?>
<tr>
<td class="table-text" style="padding: 0px; text-align: center; vertical-align: middle;">
<input type="checkbox" id="row{{$count}}" name="row-check-{{$count}}" value="{{$product->code.'-'.$last_code}}">
</td>
<td class="table-text">{{$product->code.'-'.$last_code}}</td>
<td class="table-text">{{$no_used_value->value}}</td>
</tr>
<?php
$count++;
?>
#endforeach
</tbody>
</table>
<div id="dialog-button-bar-variants" class="dialog-button-bar">
<button type="button" class="btn btn-primary" onclick="goToValues()"><< Atrás</button>
{!! Form::submit('Crear Variantes', ['class' => 'btn btn-primary']) !!}
<div>
{!! Form::close() !!}
</div>
</div>
</div>
// EDIT
<div class="inside">
{!! Form::open(['url' => '/admin/products/'.$product->id.'/variants/new']) !!}
<table class="table table-striped">
<thead>
<tr>
<th scope="col" style="text-align: center; width:5%">
<input type="checkbox" id="masterCheck" value="checkUncheckAll">
</th>
<th scope="col">N.º de producto</th>
<th scope="col">{{$product->type_product->name}}</th>
</tr>
</thead>
<tbody>
<?php
$count = 0;
$last_code = 0;
?>
#foreach($no_used_values as $no_used_value)
<?php
$last_code = getNextCode($last_code);
?>
<tr>
<td class="table-text" style="padding: 0px; text-align: center; vertical-align: middle;">
<input type="checkbox" id="row{{$count}}" key="row-check" name="last_codes[{{$product->code.'-'.$last_code}}]" value="{{$no_used_value->value}}" >
</td>
<td class="table-text">{{$product->code.'-'.$last_code}}</td>
<td class="table-text">{{$no_used_value->value}}</td>
</tr>
<?php
$count++;
?>
#endforeach
</tbody>
</table>
<div id="dialog-button-bar-variants" class="dialog-button-bar">
<button type="button" class="btn btn-primary" onclick="goToValues()"><< Atrás</button>
{!! Form::submit('Crear Variantes', ['class' => 'btn btn-primary']) !!}
<div>
{!! Form::close() !!}
</div>
</div>
</div>
Controller code:
public function postProductsVariantCreator($id, Request $request){
//$product = Product::findOrFail($id);
foreach ($request->last_codes as $key => $value) {
//code to store the variants
}
}
I hope someone can help me to find a solution to achieve it.
Try changing you checkbox input to this
<td class="table-text" style="padding: 0px; text-align: center; vertical-align: middle;">
<input type="hidden" name="{{$product->code.'-'.$last_code}}" value="0">
<input type="checkbox" id="row{{$count}}" name="{{$product->code.'-'.$last_code}}" value="1">
</td>
You will receive in your request
{
"_token":"OQElUkt7zMaxr1JkZU6fw1r9gcaBuLa6gXHKSsex",
"0001-0001":"1",
"0001-0002":"0",
"0001-0003":"1",
"0001-0004":"1",
"0001-0005":"0"
}
Where the value will be 0 or 1 depending if the checkbox is checked or not
--EDIT--
A better solution is to use the structure of an array.
<td class="table-text" style="padding: 0px; text-align: center; vertical-align: middle;">
<input type="hidden" name="{{$product->code.'-'.$last_code}}" value="0">
<input type="checkbox" id="row{{$count}}" name="last_codes[{{$product->code}}][{{$last_code}}]" value="1">
</td>
This will result in a data structure like this
{
"_token":"OQElUkt7zMaxr1JkZU6fw1r9gcaBuLa6gXHKSsex",
"last_codes":[
"0001":[
"0001":"1",
"0002":"0",
"0003":"1",
"0004":"1",
"0005":"0"
]
]
}
Controller Code
public function postProductsVariantCreator($id, Request $request){
//$product = Product::findOrFail($id);
foreach ($request->last_codes as $productCode => $lastCodes) {
//here you can fetch the product using the $productCode
foreach($lastCodes as $lastCode => $enabled) {
//here you have access to $lastCode && $enabled where $enabled = 1 or 0
}
}
}

Dompdf giving error frame not found in cellmap

I want to use a PDF converter for my Laravel project so I thought Dompdf might be a good idea. I managed to get it to work to convert a simple invoice file. However when I wanted to structured my invoice more with tables tag and others to make it look nicer, it wouldn't convert for me and throws a:
domPDF exception: frame not found in cellmap
Here is my invoice.blade.php for reference:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Invoice</title>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" />
</head>
<body>
<div class="container">
<div class="card">
<div class="card-header">
<span class="float-left " > <img src="{{ asset('images/Logo.png') }}" style="width:60%;" alt="No Logo"></span>
<div class="float-center">
<h4>DC Signature Livingstyle SDN BHD</h4>
<small> 1-21-01,Menara Bangkok Bank,Berjaya Central Park,No 105,Jalan Ampang,50450 Kuala Lumpur,Malaysia </small><br>
<small>603-02818821   bujishu#gmail.com   www.bujishu.com </small>
</div>
<div class="float-right">
<strong>Invoice:[Invoice Number]</strong>
<br>
<strong>[Date Placeholder]</strong> <br>
<strong>Credit Term:[Cash]</strong>
</div>
</div>
<div class="card-body">
<div class="row mb-4">
<div class="col-sm-6">
<h6 class="mb-3">From:</h6>
<div>
<strong>[Panel Name]</strong>
</div>
<div>[Address 1]</div>
<div>[Address 2]</div>
<div>Email:[panel_email]</div>
<div>Phone: [panel_number]</div>
</div>
<div class="col-sm-6">
<h6 class="mb-3">To:</h6>
<div>
<strong>[Customer Name]</strong>
</div>
<div> [Shipping address 1] </div>
<div>[shipping address 2]</div>
<div>Email:[customer_email]</div>
<div>Phone: [customer_number]</div>
</div>
</div>
<div class="table-responsive-sm">
<table class="table table-striped">
<thead>
<tr>
<th class="center">No</th>
<th>Item</th>
<th>Description</th>
<th class="left">Quantity</th>
<th class="center">Unit Price (RM)</th>
<th class="right">Amount(RM)</th>
</tr>
</thead>
<tbody>
<tr>
<td class="center">1</td>
<td class="left strong">Electrical wire</td>
<td class="left">Longest wire ever</td>
<td class="center">1</td>
<td class="left">999,00</td>
<td class="right">999,00</td>
</tr>
<tr>
<td class="center">2</td>
<td class="left">Interior design</td>
<td class="left">Instalation and Customization (cost per hour)</td>
<td class="left">20</td>
<td class="center">150</td>
<td class="right">3.000,00</td>
</tr>
<tr>
<td class="center">3</td>
<td class="left">Table</td>
<td class="left">Round table</td>
<td class="left">1</td>
<td class="center">499,00</td>
<td class="right">499,00</td>
</tr>
</tbody>
</table>
</div>
<div class="row">
<div class="col-lg-4 col-sm-5 ml-auto " >
<table class="table table-clear ">
<th><strong> Payment Received </strong></th>
<tbody>
<tr>
<td class="left">
Payment Method: xxxxxx
</td>
</tr>
<tr>
<td class="left">
Reference No: 2192012
</td>
</tr>
<tr>
<td class="left">
Amount Paid: RM10,000.00
</td>
</tr>
<tbody>
</table>
</div>
<div class="col-lg-4 col-sm-5 ml-auto">
<table class="table table-clear">
<tbody>
<tr>
<td class="left">
<strong>Subtotal</strong>
</td>
<td class="right">8.497,00</td>
</tr>
<tr>
<td class="left">
<strong>Transportation(Klang Valley)</strong>
</td>
<td class="right">xxxxx</td>
</tr>
<tr>
<td class="left">
<strong>Grand Total</strong>
</td>
<td class="right">8.497,00</td>
</tr>
<tr>
<td class="left">
<strong>Discount (20%)</strong>
</td>
<td class="right">1,699,40</td>
</tr>
<tr>
<td class="left">
<strong>Amount Paid</strong>
</td>
<td class="right">679,76</td>
</tr>
<tr>
<td class="left">
<strong>Balance Due</strong>
</td>
<td class="right">
<strong>7.477,36</strong>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h6 style="margin-left:30%;">This invoice is computer generated,no signature is required.</h6>
</div>
</div>
</body>
</html>
Does anyone know how to resolve this?
Edit:
Validator returns this:
Error: Bad value {{ asset('css/app.css') }} for attribute href on element link: Illegal character in path segment: { is not allowed.
From line 8, column 2; to line 8, column 58
</title>↩ <link href="{{ asset('css/app.css') }}" rel="stylesheet"> ↩↩
Error: Bad value {{ asset('images/Logo.png') }} for attribute src on element img: Illegal character in path segment: { is not allowed.
From line 18, column 37; to line 18, column 111
-left " > <img src="{{ asset('images/Logo.png') }}" style="width:60%;" alt="No Logo"></span
Error: th start tag in table body.
From line 112, column 43; to line 113, column 12
e-clear ">↩ <th><stron

My Images getting smaller in next page - DOMPDF

Here's the first page
Here's the second page, the image is getting smaller
Created with DOMPDF and Laravel, the first page, my image is fine, but when the second page is getting smaller, i don't know why.. i've been trying to use div, but its still not working
i'm using table and here's my code
<table>
<tbody>
<tr>
<td>
<img src="{{$content['image2']}}" class="img kecil" />
</td>
<td>
{!! $content['paragraph2'] !!}
</td>
</tr>
<tr>
<td>
<img src="{{$content['image2']}}" class="img kecil" />
</td>
<td>
{!! $content['paragraph2'] !!}
</td>
</tr>
<tr>
<td>
<img src="{{$content['image2']}}" class="img kecil" />
</td>
<td>
{!! $content['paragraph2'] !!}
</td>
</tr>
<tr>
<td>
<img src="{{$content['image2']}}" class="img kecil" />
</td>
<td>
{!! $content['paragraph2'] !!}
</td>
</tr>
<tr>
<td>
<img src="{{$content['image2']}}" class="img kecil" />
</td>
<td>
{!! $content['paragraph2'] !!}
</td>
</tr>
<tr>
<td>
<img src="{{$content['image2']}}" class="img kecil" />
</td>
<td>
{!! $content['paragraph2'] !!}
</td>
</tr>
</tbody>
</table>
I also using bootstrap, what should i do to fix this? Thanks

Invoice pdf in php with wkhtmltopdf snappy Laravel

Hi every body i have to make an invoice pdf in my LARAVEL project.
I succeeed to generate a pdf with this code :
$path_name_file = '../ArchivePdf/'. $name_file . '.pdf';
if ($document->type->type == 'A'){
$pdf = SnappyPdf::loadView('ribbon.report.pdf-achat', ['document' =>$document])
->save($path_name_file);
}else{
$pdf = SnappyPdf::loadView('ribbon.report.pdf-new', ['document' =>$document])->save($path_name_file);
}
My problem is in the blade view (HTML template) that i want to put an header and a footer and a main table with items
I want that the footer will be on all pages
How can i do that?
Thanks
That is my actual html view:
<!DOCTYPE html>
<html>
<header>
<meta charset="utf-8">
<title>PDF Devis</title>
{{--<link href="{{ asset("/css/style_pdf.css")}}" rel="stylesheet" type="text/css" />--}}
<style>
.header-1{
border-top-left-radius: 7px;
border-top-right-radius: 7px;
/*left: 5%;*/
width: 100%;
border-style: solid;
font-size: 13px;
border-width: 2px;
}
th {
background-color: rgba(158, 158, 158, 0.22);
text-align: center;
}
.line{
width: 100%;
}
.line tr{
padding: 0;
}
.td-20{
width:20%
}
.td-30{
width:30%
}
.td-70{
width: 70%;
}
.td-40{
width: 40%;
}
.td-50{
width: 50%;
}
.img img{
width:100%; height:auto;
}
.name-soc{
font-size: 25px;
color: orangered;
direction: rtl;
font-family: arial;
font-style: bold;
}
.space{
padding-top: 20px;
}
.title{
font-weight: bold;
height: 50px;
color: white;
background-color: rgba(255, 87, 34, 0.89);
font-size: 25px;
border-radius: 5px;
bottom: 15px;
text-align: center;
}
.items{
}
.more_line{
height: 17px;
}
/*.items-table{*/
/*page-break-after: always;*/
/*page-break-inside: avoid;*/
/*}*/
thead { display: table-header-group }
tfoot { display: table-row-group }
.items-row { page-break-inside: avoid }
table { border-collapse: separate }
.note-table{
text-align: right;
width: 100%;
}
</style>
</header>
<body>
<table class="line">
<tr>
<td rowspan="4" class="td-30">
<div class="img"> <img src="{{ public_path('/ribbon/pdf/fre.jpg') }}" alt="logo"/></div>
</td>
<td class="td-30">
<div></div>
</td>
<td class="td-40">
<div class="name-soc">
דקופלוס פרקט בע״מ
</div>
</td>
</tr>
<tr>
<td class="td-30">
<div></div>
</td>
<td class="td-40">
<div class="name-soc">
</div>
</td>
</tr>
<tr>
<td class="td-20">
<div></div>
</td>
<td class="td-20">
<div></div>
</td>
</tr>
<tr>
<td class="td-20">
<div></div>
</td>
<td class="td-20">
<div></div>
</td>
</tr>
</table>
<table class="line">
<tr class="entete">
<td class="logo">
</td>
<td class="donnee_soc">
<div dir="rtl">{{trans('dcp_pdf.num_doc')}} : {{ $document->code }} </div>
</td>
</tr>
<tr>
<td class="td-50">
<div>
<table class="header-1" dir="rtl">
<tr>
<th colspan="2">{{trans('dcp_pdf.coord_cust')}}</th>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.name')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['name'] }} {{ $document['customer']['surname'] }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.adress')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['adress']['street'] }} {{ $document->adress->city->cityT[0]->texte }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.telephone')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['phone'] }} / {{ $document['customer']['phone2'] }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.mail')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['email'] }}</div>
</td>
</tr>
</table>
</div>
</td>
<td class="td-50">
<div>
<table class="header-1" dir="rtl">
<tr>
<th colspan="2">{{trans('dcp_pdf.coord_fact')}}</th>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.name')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['name'] }} {{ $document['customer']['surname'] }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.adress')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['adress']['street'] }} {{ $document->adress->city->cityT[0]->texte }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.telephone')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['phone'] }} / {{ $document['customer']['phone2'] }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.mail')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['email'] }}</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr >
<td colspan="2" class="space">
<div>
<table class="header-1" dir="rtl">
<tr>
<th colspan="2">{{trans('dcp_pdf.coord_livraison')}}</th>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.name')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['name'] }} {{ $document['customer']['surname'] }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.adress')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['adress']['street'] }} {{ $document->adress->city->cityT[0]->texte }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.telephone')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['phone'] }} / {{ $document['customer']['phone2'] }}</div>
</td>
</tr>
<tr class="" >
<td>
<div style="width: 20%">{{trans('dcp_pdf.mail')}}</div>
</td>
<td>
<div class="encadre_data">{{ $document['customer']['email'] }}</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr >
<td colspan="2" class="space">
<div class="title" dir="rtl">
{{ $document->type->typeT[0]->texte }} - {{ $document->code }}
</div>
</td>
</tr>
<tr >
<td colspan="2" class="space">
<table class="items header-1 items-table" dir="rtl">
<thead>
<tr class="more_line">
<th class="Désignation" >{{trans('dcp_pdf.desc_article')}}</th>
<th class="other">{{trans('dcp_pdf.conditionnement')}}</th>
<th class="other">{{trans('dcp_pdf.quantity_m2')}}</th>
<th class="other">{{trans('dcp_pdf.nb_colis')}}</th>
<th class="other">{{trans('dcp_pdf.pu_ht')}}</th>
<th class="other">{{trans('dcp_pdf.discount')}}</th>
<th class="other">{{trans('dcp_pdf.total_ht')}}</th>
</tr>
</thead>
#foreach($document->items as $item)
<tr class="1 items-row">
<td class="Designation" dir="rtl"><div dir="rtl">{{ $item->material->textes[0]->texte }}</div></td>
<td class="Cdt"></td>
<td class="Qtem2">{{ $item->quantity }}</td>
<td class="Nb_colis">{{ $item->qte_col }}</td>
<td class="PU">{{ number_format($item->price, 2, '.', ',') }}</td>
<td class="Rem">{{ number_format($item->discount, 2, '.', ',') }} {{ $item->typeRemise->code }}</td>
<td class="Total"> {{ number_format($item->price_wo_vat, 2, '.', ',') }}</td>
</tr>
#endforeach
#for ($i = $document->items->count(); $i < 20; $i++)
<tr class="more_line">
<td class="Designation" dir="rtl"><div dir="rtl"></div></td>
<td class="Cdt"></td>
<td class="Qtem2"></td>
<td class="Nb_colis"></td>
<td class="PU"></td>
<td class="Rem"></td>
<td class="Total"></td>
</tr>
#endfor
</table>
</td>
</tr>
<tr >
<td colspan="2" >
<table class="note-table" dir="rtl">
<tr class="" >
<td>
<div class="encadre_data">{{ $document['note'] }} </div>
</td>
</tr>
<tr class="" >
<td >
<div class="encadre_data">{{ $document['comment'] }} </div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="td-30">
<div>
<table class="header-1" dir="rtl">
<tr>
<td>{{trans('dcp_pdf.montant_ht')}}</td>
<td>{{ number_format($document->amount_wo_taxe, 2, '.', ',') }}</td>
</tr>
<tr>
<td>{{trans('dcp_pdf.dont_remise')}}</td>
<td></td>
</tr>
#if ($document['customer']['code_tva'] === 1)
<tr>
<td>{{trans('dcp_pdf.tva')}} {{ number_format($document->taxe, 2, '.', ',') }} %</td>
<td>{{ number_format($document->amount - $document->amount_wo_taxe, 2, '.', ',') }}</td>
</tr>
#endif
<tr>
<td>{{trans('dcp_pdf.montant_ttc')}}</td>
<td>{{ number_format($document->amount, 2, '.', ',') }}</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</div>
</td>
<td class="td-70">
<div>
<table class="header-1" dir="rtl">
<tr>
<th colspan="4">{{trans('dcp_pdf.reglements')}}</th>
</tr>
<tr>
<th>{{trans('dcp_pdf.date')}}</th>
<th>{{trans('dcp_pdf.description')}}</th>
<th>{{trans('dcp_pdf.montant')}}</th>
<th>{{trans('dcp_pdf.mode_paiement')}}</th>
</tr>
#foreach($document->reglements as $reglement)
<tr>
<td>{{ $reglement->date }}</td>
<td>{{ $reglement->description }}</td>
<td>{{ number_format($reglement->amount, 2, '.', ',') }}</td>
<td>{{ $reglement->mode->modePaiementT[0]->texte }}</td>
</tr>
#endforeach
</table>
</div>
</td>
</tr>
<tr>
<td>
<div></div>
</td>
<td>
<div></div>
</td>
</tr>
<tr>
<td>
<div></div>
</td>
<td>
<div></div>
</td>
</tr>
<tr>
<td>
<div></div>
</td>
<td>
<div></div>
</td>
</tr>
<tr>
<td>
<div></div>
</td>
<td>
<div></div>
</td>
</tr>
<tr>
<td>
<div></div>
</td>
<td>
<div></div>
</td>
</tr>
</table>
</body>
</html>
Here is the documentation about header and footer with Wkhtmltopdf support.
You can try
For Header
setOption('header-html', 'Your Header');
For Footer
setOption('footer-html', 'Your Footer');
Just make sure that you need to add <!DOCTYPE HTML><html lang='en-US'> in the beginning of your header/footer HTML!

How to get all values from input fields from a Form in Laravel?

I'm working on a form that has a list of users in each row. So What I'm suppose to do is to add an email to each user by clicking on a checkbox (that part works fine). But then after clicking on Submit I'm supposse to get a new page (order-summary page) and display ONLY the users that were assigned with an email. So far I'm able to add an email to a user and after clicking on the submit button I get to the order-summary page and display the email, however my issue is that I don't know how to display not only the email but the user's name and phone number along with the email.
Here's my code:
home.blade.php
#extends( 'template' )
#section( 'content' )
{!! Form::open(array('id' => 'activateForm')) !!}
{!! csrf_field() !!}
<div>
<div style="padding-left: 135px; width:815px;">
#if (count($errors) > 0)
<div class="alert alert-danger">
<ul class="login-error-messages" style="list-style-type:disc;">
#foreach ($errors->all() as $error)
<li>{!! $error !!}</li>
#endforeach
</ul>
</div>
#endif
</div>
<div class="home-rounded-border center-content" style="width:1040px;padding-left: 30px;float:left;font-family: 'proxima-nova', sans-serif;">
<br/>
<table style="padding: 20px;margin-left: -15px;margin-top:-38px;display: inline-block;">
<div style="padding:10px;">
<tr style="font-weight: bold">
<td align="center">Select All</td>
<td width="10"></td>
<td valign="bottom">Join</td>
<td width="440" align="center" valign="bottom">Name</td>
<td style="margin-right:20px;float: left;">Phone # / Extension</td>
{{--<td width="50"></td>--}}
<td style="padding-left: 100px;">Email</td>
</tr>
<?php $usersPhoneNumber = 0;?>
#foreach($resultArray as $key => $value)
#foreach($value as $key2 => $value2)
#if(is_array($value2))
#foreach($value2 as $key3 => $value3)
<?php
if (isset($value3['phoneNumber']))
$usersPhoneNumber = $value3['phoneNumber'];
else if (isset($value3['extension']))
$usersPhoneNumber = $value3['extension'];
?>
<tr>
#if($key3 == 0)
<td align="center"><input type="checkbox" id="checkAll" value = ""/></td>
#else
<td align="center"></td>
#endif
<td width="10"></td>
<td align="center" >
<input class="input_checkbox" type="checkbox" id="{{$key3}}customer-name-checkbox" name="{{$key3}} " value="">
</td>
<td width="420" style="">{{$value3['firstName']}} {{$value3['lastName']}}</td>
<td style="padding: 0px;" class = "usersPhoneNumber">{{$usersPhoneNumber}}</td>
<td style=""><input style="margin-left:-35px;float: right;" type="email" class="styled-text rounded" name="{{$key3}}" id="{{$key3}}customer-name-inputField" placeholder="" value=""/><br/><br/>
</td>
</tr>
#endforeach
#endif
#endforeach
#endforeach
</div>
</table>
<input type="submit" class="sign-in-button" style="text-align: center;margin-left: 365px;" value="Submit"/>
</br>
<div id="statusMsg" style="margin: 0px 40px 0px 40px; background-color: #ffffff;"></div>
<ul>
<li class="logout" style="text-align: center;padding-top: 5px; padding-right: 30px"><span>Logout</span>
</li>
</ul>
</div>
<br/><br/>
</div>
{!! Form::close() !!}

Categories