add bussiness avatar to shortlinks page for customer
This commit is contained in:
parent
ca95ec48aa
commit
453eb73c79
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Business;
|
||||
use App\Service\Access;
|
||||
use App\Service\Log;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
@ -16,6 +17,18 @@ use Symfony\Component\String\Slugger\SluggerInterface;
|
|||
|
||||
class AvatarController extends AbstractController
|
||||
{
|
||||
#[Route('/front/avatar/file/get/{id}', name: 'front_avatar_file_get')]
|
||||
public function front_avatar_file_get(string $id,EntityManagerInterface $entityManager,$code = 0): BinaryFileResponse
|
||||
{
|
||||
$bid = $entityManager->getRepository(Business::class)->find($id);
|
||||
if(! $bid)
|
||||
throw $this->createNotFoundException();
|
||||
$fileAdr = dirname(__DIR__,3) . '/hesabixArchive/avatars/'. $bid->getAvatar();
|
||||
if(!$bid->getAvatar()) return new BinaryFileResponse(dirname(__DIR__,3) . '/hesabixArchive/avatars/default.png');
|
||||
$response = new BinaryFileResponse($fileAdr);
|
||||
return $response;
|
||||
}
|
||||
|
||||
#[Route('/api/avatar/get', name: 'api_avatar_get')]
|
||||
public function api_avatar_get(Access $access): Response
|
||||
{
|
||||
|
|
|
@ -5,6 +5,8 @@ namespace App\Controller\Front;
|
|||
use App\Entity\Business;
|
||||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\HesabdariRow;
|
||||
use App\Entity\PrintOptions;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
@ -52,10 +54,63 @@ class ShortlinksController extends AbstractController
|
|||
return $this->render('shortlinks/sell.html.twig', [
|
||||
'bid' => $doc->getBid(),
|
||||
'doc' => $doc,
|
||||
'link'=>$link,
|
||||
'rows' => $items,
|
||||
'person'=> $person,
|
||||
'totalPays'=>$totalPays,
|
||||
'msg'=>$msg
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/slpdf/sell/{bid}/{link}', name: 'shortlinks_pdf')]
|
||||
public function shortlinks_pdf(string $bid, string $link, EntityManagerInterface $entityManager, Provider $provider): Response
|
||||
{
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'type' => 'sell',
|
||||
'id' => $link
|
||||
]);
|
||||
if (!$doc) throw $this->createNotFoundException();
|
||||
$bid = $entityManager->getRepository(Business::class)->find($bid);
|
||||
if (!$bid) throw $this->createNotFoundException();
|
||||
$person = null;
|
||||
$discount = 0;
|
||||
$transfer = 0;
|
||||
foreach ($doc->getHesabdariRows() as $item) {
|
||||
if ($item->getPerson()) {
|
||||
$person = $item->getPerson();
|
||||
} elseif ($item->getRef()->getCode() == 104) {
|
||||
$discount = $item->getBd();
|
||||
} elseif ($item->getRef()->getCode() == 61) {
|
||||
$transfer = $item->getBs();
|
||||
}
|
||||
}
|
||||
$printOptions = [
|
||||
'bidInfo' => true,
|
||||
'pays' =>true,
|
||||
'taxInfo' =>true,
|
||||
'discountInfo' =>true,
|
||||
'note' =>true,
|
||||
'paper' =>'A4-L'
|
||||
];
|
||||
$note = '';
|
||||
$printSettings = $entityManager->getRepository(PrintOptions::class)->findOneBy(['bid'=>$bid]);
|
||||
if($printSettings){$note = $printSettings->getSellNoteString();}
|
||||
$pdfPid = $provider->createPrint(
|
||||
$bid,
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/printers/sell.html.twig', [
|
||||
'bid' => $bid,
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
'person' => $person,
|
||||
'discount' => $discount,
|
||||
'transfer' => $transfer,
|
||||
'printOptions'=> $printOptions,
|
||||
'note'=> $note
|
||||
]),
|
||||
false,
|
||||
$printOptions['paper']
|
||||
);
|
||||
return $this->redirectToRoute('app_front_print',['id'=>$pdfPid]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,13 +10,10 @@
|
|||
<div class="bg-body-light d-print-none">
|
||||
<div class="content content-full">
|
||||
<div class="d-flex flex-column flex-sm-row justify-content-sm-between align-items-sm-center">
|
||||
<img src="/front/avatar/file/get/{{bid.id}}" class="img-fluid" width="80">
|
||||
<h2 class="flex-grow-1 fs-3 fw-semibold my-2 my-sm-3">
|
||||
مشاهده فاکتور
|
||||
</h2>
|
||||
<a class="btn btn-alt-primary my-2" href="https://hesabix.ir">
|
||||
<i class="fa fa-fw fa-door-open me-1"></i>
|
||||
ورود به حسابیکس
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -36,10 +33,10 @@
|
|||
</h3>
|
||||
<div class="block-options">
|
||||
<!-- Print Page functionality is initialized dmPrint() -->
|
||||
<button class="btn btn-sm btn-alt-secondary me-3" onclick="Dashmix.helpers('dm-print');" type="button">
|
||||
<a class="btn btn-sm btn-alt-secondary me-3" type="button" target="_blank" href="{{path('shortlinks_pdf',{bid:bid.id,link:link})}}">
|
||||
<i class="si si-printer me-1"></i>
|
||||
چاپ فاکتور
|
||||
</button>
|
||||
</a>
|
||||
{% if (totalPays < doc.amount) and bid.walletEnable %}
|
||||
<a href="{{ path('pay_sell',{'id':doc.id}) }}" class="btn btn-sm btn-success">
|
||||
<i class="fa fa-credit-card"></i>
|
||||
|
@ -177,6 +174,10 @@
|
|||
</div>
|
||||
<!-- END Table -->
|
||||
<div class="block block-rounded">
|
||||
جمع کل فاکتور:
|
||||
{{ doc.amount | number_format }}
|
||||
</div>
|
||||
<div class="block block-rounded">
|
||||
توضیحات:
|
||||
{{ doc.des }}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue