large commit

This commit is contained in:
Omair Saleh
2019-12-26 12:29:57 +08:00
parent 427c7c7ced
commit f4e1c8ab1e
2 changed files with 80 additions and 5 deletions
@@ -72,6 +72,11 @@ class OrderController extends Controller
}
public function print(String $orderId){
$order = order::findOrFail($orderId);
return $this->pdf->loadView('pages.pdf.qr', $order)->stream();
}
public function download(String $orderId, String $type){
$order = order::findOrFail($orderId);
$warehouse = OrderWarehouse::where('order_id', $orderId)->firstOrFail();
@@ -86,11 +91,7 @@ class OrderController extends Controller
'warehouse_contact' => $warehouseContact
];
$pdf = $this->pdf->loadView('pages.pdf.qr', compact('data'));
return $pdf->download('QR_Sticker_'.$order->marking.'.pdf');
// return view('pages.pdf.qr', $data);
return view('pages.pdf.qr', $data);
// return $this->pdf->loadView('pages.pdf.qr', $data)->stream();
}
@@ -0,0 +1,74 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>order-qr-{{$data['order']->marking}}</title>
</head>
<style>
@font-face {
font-family: 'HanWangYenHeavy';
font-style: normal;
font-weight: 400;
src: url(http://eclecticgeek.com/dompdf/fonts/cjk/fireflysung.ttf) format('truetype');
}
@page { margin: 0px; }
body { margin: 0px; }
body {
font-family: Firefly Sung, DejaVu Sans, sans-serif;
text-transform: uppercase;
}
.page-break {
page-break-after: always;
}
</style>
<body>
<table style="width: 100%; border: 2px solid #000000;">
<tbody>
@for ($i = 0; $i < 4; $i++)
<tr>
<td align="center" width="30%" style="border: 2px solid #000000;">
<table width="100%">
<tbody>
<tr align="center">
<td>
<img src="{{ url('https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl={"hash":"{1*23456}","id":'.$data['order']->id.'}') }}" />
</td>
</tr>
<tr align="center">
<td>
<h5 style="margin: 0 !important;"><strong>#{{$data['order']->marking}}</strong></h5>
</td>
</tr>
</tbody>
</table>
</td>
<td width="70%" style="border: 2px solid #000000; padding: 15px !important;">
<table>
<tbody>
<tr>
<td style="border-bottom: solid 2px #000000;">
<h3 style="margin-top: 0px !important; margin-bottom: 10px !important;">@if(strtolower($data['delivery_address']->state) === 'sabah') SB/ @elseif(strtolower($data['delivery_address']->state) === 'sarawak') SRW/ @endif{{$data['company']->marking}}/{{$data['order']->marking}}</h3>
</td>
</tr>
{{--<tr>--}}
{{--<td style="border-bottom: solid 1px #000000;">--}}
{{--<h5 style="margin-top: 10px !important; margin-bottom: 10px !important; word-wrap: break-word">{{$data['delivery_address']->street_one.' '.$data['delivery_address']->street_two.' '.$data['delivery_address']->city.' '.$data['delivery_address']->post_code.' '.$data['delivery_address']->state}}</h5>--}}
{{--</td>--}}
{{--</tr>--}}
<tr>
<td>
<p style="font-size: 12px; margin-bottom: 0 !important; margin-top: 10px !important;">仓库地址:</p>
<p style="margin-top: 5px !important; margin-bottom: 5px !important; word-wrap: break-word; font-size: 16px;">{{$data['warehouse_address']->street_one.' '.$data['warehouse_address']->street_two.' '.$data['warehouse_address']->city.' '.$data['warehouse_address']->state.' 邮编:'.$data['warehouse_address']->post_code}}</p>
<p style="margin-top: 5px !important; margin-bottom: 0px !important; font-size: 12px;">联系:{{$data['warehouse_contact'][0]->contact.' '.$data['warehouse_contact'][0]->name}} / {{$data['warehouse_contact'][1]->contact.' '.$data['warehouse_contact'][1]->name}}</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
@endfor
</tbody>
</table>
</body>
</html>