Browse Source

Merge branch 'develop'

master
Guillaume Bourgeois 3 months ago
parent
commit
5ec6b1a1e9
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      domain/Distribution/Distribution/Export/DistributionShoppingCartLabelsPdfGenerator.php

+ 18
- 1
domain/Distribution/Distribution/Export/DistributionShoppingCartLabelsPdfGenerator.php View File

@@ -48,6 +48,7 @@ use domain\Producer\Producer\ProducerSolver;
use kartik\mpdf\Pdf;
use domain\_\AbstractGenerator;
use yii\base\ErrorException;
use yii\helpers\BaseStringHelper;

class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator implements DistributionExportGeneratorInterface
{
@@ -176,6 +177,7 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
'username' => 14,
'phoneNumber' => 10,
'pointSale' => 10,
'comment' => 8,
'products' => 10,
'amount' => 10,
],
@@ -183,6 +185,7 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
'username' => 18,
'phoneNumber' => 14,
'pointSale' => 14,
'comment' => 12,
'products' => 14,
'amount' => 14,
]
@@ -220,6 +223,12 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
margin-bottom: 3px;
}
.shopping-cart-label .comment {
font-size: '.$fontSizeArray['comment'].'px;
margin-bottom: 3px;
font-style: italic;
}
.shopping-cart-label .products {
font-size: '.$fontSizeArray['products'].'px;
}
@@ -289,6 +298,8 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple

public function getShoppingCartLabelAsHtml(Order $order, int $index, bool $isSpecificFormat, int $specificFormatWidth, int $specificFormatHeight, bool $pdfInCartLabelSpecificFormat): string
{
$isSpecificFormatBig = $isSpecificFormat && $specificFormatWidth >= 100 && $specificFormatHeight >= 150;

$amountAndPayment = '';
if($isSpecificFormat) {
$amountAndPayment = '<div class="amount-and-payment">';
@@ -305,10 +316,15 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
}

$producerLogo = '';
if($isSpecificFormat && $specificFormatWidth >= 100 && $specificFormatHeight >= 150) {
if($isSpecificFormatBig) {
$producerLogo = '<div class="producer-logo"><img src="'.$this->producerSolver->getUrlLogo($this->getProducerContext()).'" /></div>';
}

$comment = '';
if($isSpecificFormatBig && strlen($order->comment)) {
$comment = '<div class="comment">« '.BaseStringHelper::truncate($order->comment, 50).' »</div>';
}

$phoneNumber = '';
if($this->orderSolver->hasPhone($order)) {
$phoneNumber = '<div class="phonenumber">'.$this->orderSolver->getPhone($order).'</div>';
@@ -325,6 +341,7 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
'.date('d/m', strtotime($order->distribution->date)).' &bull;
'.$order->pointSale->name.'
</div>
'.$comment.'
<div class="products">
'.$this->orderRepository->getCartSummary($order).'
</div>

Loading…
Cancel
Save