Browse Source

[Administration] Étiquettes : ajout du commentaire de la commande

develop
Guillaume Bourgeois 1 month ago
parent
commit
b8a758ebf1
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

use kartik\mpdf\Pdf; use kartik\mpdf\Pdf;
use domain\_\AbstractGenerator; use domain\_\AbstractGenerator;
use yii\base\ErrorException; use yii\base\ErrorException;
use yii\helpers\BaseStringHelper;


class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator implements DistributionExportGeneratorInterface class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator implements DistributionExportGeneratorInterface
{ {
'username' => 14, 'username' => 14,
'phoneNumber' => 10, 'phoneNumber' => 10,
'pointSale' => 10, 'pointSale' => 10,
'comment' => 8,
'products' => 10, 'products' => 10,
'amount' => 10, 'amount' => 10,
], ],
'username' => 18, 'username' => 18,
'phoneNumber' => 14, 'phoneNumber' => 14,
'pointSale' => 14, 'pointSale' => 14,
'comment' => 12,
'products' => 14, 'products' => 14,
'amount' => 14, 'amount' => 14,
] ]
margin-bottom: 3px; margin-bottom: 3px;
} }
.shopping-cart-label .comment {
font-size: '.$fontSizeArray['comment'].'px;
margin-bottom: 3px;
font-style: italic;
}
.shopping-cart-label .products { .shopping-cart-label .products {
font-size: '.$fontSizeArray['products'].'px; font-size: '.$fontSizeArray['products'].'px;
} }


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

$amountAndPayment = ''; $amountAndPayment = '';
if($isSpecificFormat) { if($isSpecificFormat) {
$amountAndPayment = '<div class="amount-and-payment">'; $amountAndPayment = '<div class="amount-and-payment">';
} }


$producerLogo = ''; $producerLogo = '';
if($isSpecificFormat && $specificFormatWidth >= 100 && $specificFormatHeight >= 150) {
if($isSpecificFormatBig) {
$producerLogo = '<div class="producer-logo"><img src="'.$this->producerSolver->getUrlLogo($this->getProducerContext()).'" /></div>'; $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 = ''; $phoneNumber = '';
if($this->orderSolver->hasPhone($order)) { if($this->orderSolver->hasPhone($order)) {
$phoneNumber = '<div class="phonenumber">'.$this->orderSolver->getPhone($order).'</div>'; $phoneNumber = '<div class="phonenumber">'.$this->orderSolver->getPhone($order).'</div>';
'.date('d/m', strtotime($order->distribution->date)).' &bull; '.date('d/m', strtotime($order->distribution->date)).' &bull;
'.$order->pointSale->name.' '.$order->pointSale->name.'
</div> </div>
'.$comment.'
<div class="products"> <div class="products">
'.$this->orderRepository->getCartSummary($order).' '.$this->orderRepository->getCartSummary($order).'
</div> </div>

Loading…
Cancel
Save