Skip to content

Commit

Permalink
Merge pull request #1617 from suraj-webkul/quote#1611
Browse files Browse the repository at this point in the history
issue #1611 fixed.
  • Loading branch information
devansh-webkul authored Sep 24, 2024
2 parents 6046a6b + 8df1fd1 commit dcd84b9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 79 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ APP_DEBUG=true
APP_URL=http://localhost
APP_TIMEZONE=Asia/Kolkata
APP_LOCALE=en
APP_CURRENCY=USD

VITE_HOST=
VITE_PORT=
Expand Down
107 changes: 28 additions & 79 deletions packages/Webkul/Admin/src/Resources/views/quotes/pdf.blade.php
Original file line number Diff line number Diff line change
@@ -1,94 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
lang="{{ app()->getLocale() }}"
dir="{{ app()->getLocale () }}"
lang="{{ $locale = app()->getLocale() }}"
dir="{{ in_array($locale, ['fa', 'ar']) ? 'rtl' : 'ltr' }}"
>
<head>
<!-- meta tags -->
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta
http-equiv="Cache-control"
content="no-cache"
>

@php
$fontPath = [];
$fontFamily = [
'regular' => 'Arial, sans-serif',
'bold' => 'Arial, sans-serif',
];
<meta
http-equiv="Content-Type"
content="text/html; charset=utf-8"
/>

if (in_array(app()->getLocale(), ['ar', 'he', 'fa', 'tr', 'ru', 'uk'])) {
@php
if ($locale == 'en') {
$fontFamily = [
'regular' => 'DejaVu Sans',
'bold' => 'DejaVu Sans',
];
} elseif (app()->getLocale() == 'zh_CN') {
$fontPath = [
'regular' => asset('fonts/NotoSansSC-Regular.ttf'),
'bold' => asset('fonts/NotoSansSC-Bold.ttf'),
];
$fontFamily = [
'regular' => 'Noto Sans SC',
'bold' => 'Noto Sans SC Bold',
];
} elseif (app()->getLocale() == 'ja') {
$fontPath = [
'regular' => asset('fonts/NotoSansJP-Regular.ttf'),
'bold' => asset('fonts/NotoSansJP-Bold.ttf'),
];
$fontFamily = [
'regular' => 'Noto Sans JP',
'bold' => 'Noto Sans JP Bold',
];
} elseif (app()->getLocale() == 'hi_IN') {
$fontPath = [
'regular' => asset('fonts/Hind-Regular.ttf'),
'bold' => asset('fonts/Hind-Bold.ttf'),
];
} else {
$fontFamily = [
'regular' => 'Hind',
'bold' => 'Hind Bold',
'regular' => 'Arial, sans-serif',
'bold' => 'Arial, sans-serif',
];
} elseif (app()->getLocale() == 'bn') {
$fontPath = [
'regular' => asset('fonts/NotoSansBengali-Regular.ttf'),
'bold' => asset('fonts/NotoSansBengali-Bold.ttf'),
];
$fontFamily = [
'regular' => 'Noto Sans Bengali',
'bold' => 'Noto Sans Bengali Bold',
];
} elseif (app()->getLocale() == 'sin') {
$fontPath = [
'regular' => asset('fonts/NotoSansSinhala-Regular.ttf'),
'bold' => asset('fonts/NotoSansSinhala-Bold.ttf'),
];
}
if (in_array($locale, ['ar', 'fa', 'tr'])) {
$fontFamily = [
'regular' => 'Noto Sans Sinhala',
'bold' => 'Noto Sans Sinhala Bold',
'regular' => 'DejaVu Sans',
'bold' => 'DejaVu Sans',
];
}
@endphp

<!-- lang supports inclusion -->
<style type="text/css">
@if (! empty($fontPath['regular']))
@font-face {
src: url({{ $fontPath['regular'] }}) format('truetype');
font-family: {{ $fontFamily['regular'] }};
}
@endif
@if (! empty($fontPath['bold']))
@font-face {
src: url({{ $fontPath['bold'] }}) format('truetype');
font-family: {{ $fontFamily['bold'] }};
font-style: bold;
}
@endif
* {
Expand Down Expand Up @@ -212,7 +161,7 @@
</style>
</head>

<body dir="{{ app()->getLocale() }}">
<body dir="{{ $locale }}">
<div class="page">
<!-- Header -->
<div class="page-header">
Expand Down Expand Up @@ -272,7 +221,7 @@
</table>

<!-- Billing & Shipping Address -->
<table class="{{ app()->getLocale() }}">
<table class="{{ $locale }}">
<thead>
<tr>
@if ($quote->billing_address)
Expand All @@ -297,23 +246,23 @@
<tr>
@if ($quote->billing_address)
<td style="width: 50%">
<div>{{ $quote->billing_address['address'] }}</div>
<div>{{ $quote->billing_address['address'] ?? '' }}</div>

<div>{{ $quote->billing_address['postcode'] . ' ' .$quote->billing_address['city'] }} </div>
<div>{{ $quote->billing_address['postcode'] ?? '' . ' ' .$quote->billing_address['city'] ?? '' }} </div>

<div>{{ $quote->billing_address['state'] }}</div>
<div>{{ $quote->billing_address['state'] ?? '' }}</div>

<div>{{ core()->country_name($quote->billing_address['country'] ?? '') }}</div>
</td>
@endif

@if ($quote->shipping_address)
<td style="width: 50%">
<div>{{ $quote->shipping_address['address'] }}</div>
<div>{{ $quote->shipping_address['address'] ?? ''}}</div>

<div>{{ $quote->shipping_address['postcode'] . ' ' .$quote->shipping_address['city'] }} </div>
<div>{{ $quote->shipping_address['postcode'] ?? '' . ' ' .$quote->shipping_address['city'] ?? '' }} </div>

<div>{{ $quote->shipping_address['state'] }}</div>
<div>{{ $quote->shipping_address['state'] ?? '' }}</div>

<div>{{ core()->country_name($quote->shipping_address['country'] ?? '') }}</div>
</td>
Expand Down

0 comments on commit dcd84b9

Please sign in to comment.