Add annotations to controllers for outlet, promo, report, rider, search, and test. #222
This commit is contained in:
parent
0925dbd574
commit
5a0bf45983
6 changed files with 93 additions and 72 deletions
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Ramcar\BaseController;
|
||||
use App\Entity\Outlet;
|
||||
use App\Entity\Hub;
|
||||
|
||||
|
|
@ -12,19 +11,23 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
||||
use DateTime;
|
||||
|
||||
class OutletController extends BaseController
|
||||
class OutletController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Menu(selected="outlet_list")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('outlet.list', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('outlet_list');
|
||||
|
||||
return $this->render('outlet/list.html.twig', $params);
|
||||
return $this->render('outlet/list.html.twig');
|
||||
}
|
||||
|
||||
public function rows(Request $req)
|
||||
|
|
@ -126,11 +129,13 @@ class OutletController extends BaseController
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="outlet_list")
|
||||
*/
|
||||
public function addForm()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('outlet.add', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('outlet_list');
|
||||
$params['obj'] = new Outlet();
|
||||
$params['mode'] = 'create';
|
||||
|
||||
|
|
@ -241,12 +246,13 @@ class OutletController extends BaseController
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="outlet_list")
|
||||
*/
|
||||
public function updateForm($id)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('outlet.update', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('outlet_list');
|
||||
|
||||
// get row data
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$obj = $em->getRepository(Outlet::class)->find($id);
|
||||
|
|
@ -329,9 +335,7 @@ class OutletController extends BaseController
|
|||
{
|
||||
$this->denyAccessUnlessGranted('outlet.delete', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('outlet_list');
|
||||
|
||||
// get objext data
|
||||
// get object data
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$obj = $em->getRepository(Outlet::class)->find($id);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Ramcar\BaseController;
|
||||
use App\Ramcar\DiscountApply;
|
||||
use App\Entity\Promo;
|
||||
|
||||
|
|
@ -11,17 +10,22 @@ use Doctrine\ORM\QueryBuilder;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class PromoController extends BaseController
|
||||
class PromoController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Menu(selected="promo_list")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('promo.list', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('promo_list');
|
||||
|
||||
return $this->render('promo/list.html.twig', $params);
|
||||
return $this->render('promo/list.html.twig');
|
||||
}
|
||||
|
||||
public function rows(Request $req)
|
||||
|
|
@ -130,11 +134,13 @@ class PromoController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="promo_list")
|
||||
*/
|
||||
public function addForm()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('promo.add', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('promo_list');
|
||||
$params['obj'] = new Promo();
|
||||
$params['mode'] = 'create';
|
||||
$params['discount_apply'] = DiscountApply::getCollection();
|
||||
|
|
@ -183,12 +189,13 @@ class PromoController extends BaseController
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="promo_list")
|
||||
*/
|
||||
public function updateForm($id)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('promo.update', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('promo_list');
|
||||
|
||||
// get row data
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$obj = $em->getRepository(Promo::class)->find($id);
|
||||
|
|
@ -252,9 +259,7 @@ class PromoController extends BaseController
|
|||
{
|
||||
$this->denyAccessUnlessGranted('promo.delete', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('promo_list');
|
||||
|
||||
// get objext data
|
||||
// get object data
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$obj = $em->getRepository(Promo::class)->find($id);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Ramcar\BaseController;
|
||||
use App\Ramcar\JORejectionReason;
|
||||
use App\Ramcar\ServiceType;
|
||||
use App\Ramcar\JOStatus;
|
||||
|
|
@ -18,19 +17,23 @@ use Symfony\Component\HttpFoundation\Response;
|
|||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
||||
use DateTime;
|
||||
|
||||
class ReportController extends BaseController
|
||||
class ReportController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Menu(selected="outlet_list")
|
||||
*/
|
||||
public function rejectSummaryForm()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('report.reject', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('outlet_list');
|
||||
|
||||
return $this->render('report/rejection/summary_form.html.twig', $params);
|
||||
return $this->render('report/rejection/summary_form.html.twig');
|
||||
}
|
||||
|
||||
public function rejectSummarySubmit(Request $req)
|
||||
|
|
@ -152,13 +155,14 @@ class ReportController extends BaseController
|
|||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="outlet_list")
|
||||
*/
|
||||
public function rejectDetailForm()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('report.reject', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('outlet_list');
|
||||
|
||||
return $this->render('report/rejection/detail_form.html.twig', $params);
|
||||
return $this->render('report/rejection/detail_form.html.twig');
|
||||
}
|
||||
|
||||
public function rejectDetailSubmit(Request $req)
|
||||
|
|
@ -264,13 +268,14 @@ class ReportController extends BaseController
|
|||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="outlet_list")
|
||||
*/
|
||||
public function batteryConflictForm()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('report.battery.conflict', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('outlet_list');
|
||||
|
||||
return $this->render('report/battery/batt_conflict_form.html.twig', $params);
|
||||
return $this->render('report/battery/batt_conflict_form.html.twig');
|
||||
}
|
||||
|
||||
public function batteryConflictSubmit(Request $req)
|
||||
|
|
@ -393,9 +398,5 @@ class ReportController extends BaseController
|
|||
$resp->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '"');
|
||||
|
||||
return $resp;
|
||||
|
||||
//return $this->json([
|
||||
// 'result' => $results,
|
||||
//]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Ramcar\BaseController;
|
||||
use App\Ramcar\DayOfWeek;
|
||||
use App\Entity\Rider;
|
||||
use App\Entity\RiderSchedule;
|
||||
|
|
@ -16,18 +15,22 @@ use Symfony\Component\HttpFoundation\Response;
|
|||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class RiderController extends BaseController
|
||||
class RiderController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Menu(selected="rider_list")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('rider.list', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('rider_list');
|
||||
|
||||
return $this->render('rider/list.html.twig', $params);
|
||||
return $this->render('rider/list.html.twig');
|
||||
}
|
||||
|
||||
public function rows(Request $req)
|
||||
|
|
@ -131,11 +134,13 @@ class RiderController extends BaseController
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="rider_list")
|
||||
*/
|
||||
public function addForm()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('rider.add', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('rider_list');
|
||||
$params['obj'] = new Rider();
|
||||
$params['mode'] = 'create';
|
||||
|
||||
|
|
@ -279,11 +284,13 @@ class RiderController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="rider_list")
|
||||
*/
|
||||
public function updateForm($id)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('rider.update', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('rider_list');
|
||||
$params['mode'] = 'update';
|
||||
|
||||
// get row data
|
||||
|
|
@ -450,8 +457,6 @@ class RiderController extends BaseController
|
|||
{
|
||||
$this->denyAccessUnlessGranted('rider.delete', null, 'No access.');
|
||||
|
||||
$params = $this->initParameters('rider_list');
|
||||
|
||||
// get row data
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$row = $em->getRepository(Rider::class)->find($id);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Ramcar\BaseController;
|
||||
|
||||
use App\Service\GeneralSearch;
|
||||
|
||||
use App\Entity\LegacyJobOrder;
|
||||
|
|
@ -11,30 +9,30 @@ use App\Entity\LegacyJobOrderRow;
|
|||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
use App\Menu\Generator as MenuGenerator;
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
class SearchController extends BaseController
|
||||
class SearchController extends Controller
|
||||
{
|
||||
public function __construct(MenuGenerator $menu_gen)
|
||||
{
|
||||
parent::__construct($menu_gen);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="general_search")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->denyaccessUnlessGranted('general.search', null, 'No access.');
|
||||
$params = $this->initParameters('general_search');
|
||||
$params["mode"] = "form";
|
||||
|
||||
// response
|
||||
return $this->render('search/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="general_search")
|
||||
*/
|
||||
public function search(Request $req, GeneralSearch $search)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('general.search', null, 'No access.');
|
||||
$params = $this->initParameters('general_search');
|
||||
|
||||
$search_term = $req->query->get('search');
|
||||
$results = $search->search($search_term);
|
||||
|
|
@ -47,6 +45,9 @@ class SearchController extends BaseController
|
|||
return $this->render('search/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="general_search")
|
||||
*/
|
||||
public function legacyJODetails($id)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('general.search', null, 'No access.');
|
||||
|
|
@ -55,7 +56,6 @@ class SearchController extends BaseController
|
|||
$em = $this->getDoctrine()->getManager();
|
||||
$legacy_jo = $em->getRepository(LegacyJobOrder::class)->find($id);
|
||||
|
||||
$params = $this->initParameters('general.search');
|
||||
$params['data'] = $legacy_jo;
|
||||
$params['mode'] = "details";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Ramcar\BaseController;
|
||||
use Catalyst\AuthBundle\Service\ACLGenerator;
|
||||
|
||||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
||||
|
|
@ -11,39 +10,46 @@ use App\Entity\Outlet;
|
|||
use GuzzleHttp\Client as GuzzleClient;
|
||||
use App\Service\MapTools;
|
||||
use Doctrine\Common\Util\Debug;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
class TestController extends BaseController
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
class TestController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Menu(selected="home")
|
||||
*/
|
||||
public function index(ACLGenerator $acl_gen)
|
||||
{
|
||||
$params = $this->initParameters('home');
|
||||
|
||||
$acl_data = $acl_gen->getACL();
|
||||
error_log(print_r($acl_data, true));
|
||||
|
||||
return $this->render('home.html.twig', $params);
|
||||
return $this->render('home.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="home")
|
||||
*/
|
||||
public function testIsGranted()
|
||||
{
|
||||
$params = $this->initParameters('home');
|
||||
|
||||
error_log(print_r($this->isGranted('dashboard.menu'), true));
|
||||
|
||||
return $this->render('home.html.twig', $params);
|
||||
return $this->render('home.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="home")
|
||||
*/
|
||||
public function gmap()
|
||||
{
|
||||
$params = $this->initParameters('home');
|
||||
|
||||
return $this->render('test/map.html.twig', $params);
|
||||
return $this->render('test/map.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="home")
|
||||
*/
|
||||
public function distance(MapTools $map_tools)
|
||||
{
|
||||
$params = $this->initParameters('home');
|
||||
|
||||
$point = new Point(121.0495453, 14.6042567);
|
||||
// $point = new Point(120.343692, 16.048560);
|
||||
|
||||
|
|
@ -55,6 +61,6 @@ class TestController extends BaseController
|
|||
error_log($data['duration']);
|
||||
}
|
||||
|
||||
return $this->render('home.html.twig', $params);
|
||||
return $this->render('home.html.twig');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue