almost finish repservice

This commit is contained in:
babak alizadeh 2024-06-02 14:44:24 +03:30
parent cac898f4d5
commit 0911144c04
2 changed files with 199 additions and 3 deletions

View file

@ -24,17 +24,19 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class PlugRepserviceController extends AbstractController class PlugRepserviceController extends AbstractController
{ {
#[Route('/p/rep/{bid}/{sharelink}', name: 'app_plug_repservice_order_view_front')] #[Route('/p/rep/{bid}/{sharelink}', name: 'app_plug_repservice_order_view_front')]
public function app_plug_repservice_order_view_front(string $bid,string $sharelink ,$provider, registryMGR $registryMGR, SMS $sms, Log $log, EntityManagerInterface $entityManagerInterface, Access $access, Request $request, Extractor $extractor): Response public function app_plug_repservice_order_view_front(string $bid,string $sharelink, EntityManagerInterface $entityManagerInterface): Response
{ {
$bid = $entityManagerInterface->getRepository(Business::class)->find($bid); $bid = $entityManagerInterface->getRepository(Business::class)->find($bid);
if(!$bid) throw $this->createNotFoundException(); if(!$bid) throw $this->createNotFoundException();
$order = $entityManagerInterface->getRepository(PlugRepserviceOrder::class)->findOneBy([ $order = $entityManagerInterface->getRepository(PlugRepserviceOrder::class)->findOneBy([
'bid' => $bid, 'bid' => $bid,
'sharelink' => $sharelink 'shortlink' => $sharelink
]); ]);
return $this->render('repservice/view.html.twig',[ return $this->render('repservice/view.html.twig',[
'order'=>$order 'order'=>$order,
'bid'=>$bid,
'person'=>$order->getPerson()
]); ]);
} }
@ -76,6 +78,7 @@ class PlugRepserviceController extends AbstractController
$order->setBid($acc['bid']); $order->setBid($acc['bid']);
$order->setcode($provider->getAccountingCode($acc['bid'], 'PlugRepservice')); $order->setcode($provider->getAccountingCode($acc['bid'], 'PlugRepservice'));
$order->setShortlink($provider->RandomString(6) . time()); $order->setShortlink($provider->RandomString(6) . time());
} else { } else {
$order = $entityManagerInterface->getRepository(PlugRepserviceOrder::class)->findOneBy([ $order = $entityManagerInterface->getRepository(PlugRepserviceOrder::class)->findOneBy([
'bid' => $acc['bid'], 'bid' => $acc['bid'],
@ -232,6 +235,33 @@ class PlugRepserviceController extends AbstractController
return $this->json($res); return $this->json($res);
} }
#[Route('/api/repservice/order/info/{code}', name: 'app_plug_repservice_order_info')]
public function app_plug_repservice_order_info(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, $code = 0): JsonResponse
{
$acc = $access->hasRole('plugRepservice');
if (!$acc)
throw $this->createAccessDeniedException();
$item = $entityManager->getRepository(PlugRepserviceOrder::class)->findOneBy(['bid' => $acc['bid'], 'code' => $code]);
if (!$item)
throw $this->createNotFoundException();
$temp = [
'update' => $item->getCode(),
'date'=>$item->getDate(),
'des'=>$item->getDes(),
'person'=>Explore::ExplorePerson($item->getPerson()),
'pelak'=>$item->getPelak(),
'serial'=>$item->getSerial(),
'motaleghat'=>$item->getMotaleghat(),
'commodity'=>Explore::ExploreCommodity($item->getCommodity()),
'sms'=>true
];
if($item->getPerson()->getMobile() == null || $item->getPerson()->getMobile() == ''){
$temp['sms'] = false;
}
return $this->json($temp);
}
#[Route('/api/repservice/order/remove/{code}', name: 'app_plug_repservice_order_remove')] #[Route('/api/repservice/order/remove/{code}', name: 'app_plug_repservice_order_remove')]
public function app_plug_repservice_order_remove(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, $code = 0): JsonResponse public function app_plug_repservice_order_remove(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, $code = 0): JsonResponse
{ {

View file

@ -0,0 +1,166 @@
{% extends 'blank.html.twig' %}
{% block title %}
مشاهده قبض تعمیرات
{% endblock %}
{% block body %}
<main
id="main-container">
<!-- Hero -->
<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">
<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>
<!-- END Hero -->
<!-- Page Content -->
<div
class="content content-boxed">
<!-- Invoice -->
<div class="block block-rounded">
<div class="block-header block-header-default">
<h3 class="block-title">
شماره قبض:
<span class="text-primary">
{{order.code}}
</span>
</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">
<i class="si si-printer me-1"></i>
چاپ قبض
</button>
</div>
</div>
<div class="block-content">
<div
class="p-sm-2 p-xl-1">
<!-- Invoice Info -->
<div
class="row mb-5">
<!-- Company Info -->
<div class="col-6">
<p class="h3">
{{bid.type}}
:
{{bid.name}}
</p>
<address>آدرس :
استان
{{bid.ostan}}
شهرستان
{{bid.shahrestan}}
{{bid.address}}
</address>
<div>
کد پستی:
{{bid.postalcode}}
</div>
<div>
تلفن :
{{bid.tel}}
</div>
<div>
موبایل :
{{bid.mobile}}
</div>
</div>
<!-- END Company Info -->
<!-- Client Info -->
<div class="col-6 text-end">
<p class="h3">مشتری:
{{ person.nikename }}
</p>
<address>آدرس :
استان
{{person.ostan}}
شهرستان
{{person.shahr}}
{{person.address}}
</address>
<div>
کد پستی:
{{person.postalcode}}
</div>
<div>
تلفن :
{{person.tel}}
</div>
<div>
موبایل :
{{person.mobile}}
</div>
</div>
<!-- END Client Info -->
</div>
<!-- END Invoice Info -->
<table class="table table-striped table-hover table-borderless table-vcenter">
<tbody>
<tr>
<td>
<div class="d-sm-flex">
<div class="ms-sm-2 me-sm-4 py-3">
<a class="item item-rounded bg-body-dark text-dark fs-2 mb-2 mx-auto" href="javascript:void(0)">
<i class="fa fa-fw fa-box"></i>
</a>
</div>
<div class="py-3">
<a class="link-fx h4 mb-1 d-inline-block text-dark" href="#">{{ order.commodity.name}}</a>
<div class="fs-sm fw-semibold text-muted mb-2">
تاریخ:
{{order.date}}</div>
<p class="text-muted mb-2">
شرح:
{{order.des}}
</p>
<p class="text-muted mb-2">
متعلقات:
{{order.des}}
</p>
<p class="text-muted mb-2">
سریال:
{{order.des}}
</p>
<p class="text-muted mb-2">
پلاک:
{{order.des}}
</p>
<div>
<span class="text-info">وضعیت</span>
<span class="badge bg-success">{{order.state.label}}</span>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<!-- Footer -->
<a href="https://hesabix.ir" class="p-4 mb-3text-primary text-center my-5">
حسابیکس
<label class="text-muted">سامانه جامع مالی رایگان ، ابری و متن باز</label>
</a>
<!-- END Footer -->
</div>
</div>
</div>
<!-- END Invoice -->
</div>
<!-- END Page Content -->
</main>
{% endblock %}