Compare commits
3 commits
AnsPractic
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
630796df85 | ||
| dedfb58a28 | |||
| 1b24e68f6b |
39 changed files with 273 additions and 1219 deletions
|
|
@ -90,7 +90,3 @@ HUB_JO_KEY=hub_jo_count
|
||||||
# hub geofence
|
# hub geofence
|
||||||
HUB_GEOFENCE_ENABLE=set_to_true_or_false
|
HUB_GEOFENCE_ENABLE=set_to_true_or_false
|
||||||
HUB_FILTER_ENABLE=set_to_true_or_false
|
HUB_FILTER_ENABLE=set_to_true_or_false
|
||||||
|
|
||||||
###> symfony/mailer ###
|
|
||||||
# MAILER_DSN=null://null
|
|
||||||
###< symfony/mailer ###
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
|
|
||||||
services:
|
|
||||||
###> symfony/mailer ###
|
|
||||||
mailer:
|
|
||||||
image: axllent/mailpit
|
|
||||||
ports:
|
|
||||||
- "1025"
|
|
||||||
- "8025"
|
|
||||||
environment:
|
|
||||||
MP_SMTP_AUTH_ACCEPT_ANY: 1
|
|
||||||
MP_SMTP_AUTH_ALLOW_INSECURE: 1
|
|
||||||
###< symfony/mailer ###
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
"ext-iconv": "*",
|
"ext-iconv": "*",
|
||||||
"composer/package-versions-deprecated": "1.11.99.4",
|
"composer/package-versions-deprecated": "1.11.99.4",
|
||||||
"data-dog/audit-bundle": "^0.1.10",
|
"data-dog/audit-bundle": "^0.1.10",
|
||||||
"doctrine/annotations": "^1.13",
|
|
||||||
"doctrine/common": "^2",
|
"doctrine/common": "^2",
|
||||||
"doctrine/doctrine-bundle": "^2",
|
"doctrine/doctrine-bundle": "^2",
|
||||||
"doctrine/doctrine-migrations-bundle": "^2",
|
"doctrine/doctrine-migrations-bundle": "^2",
|
||||||
|
|
|
||||||
19
composer.lock
generated
19
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "da765755121aaeb5c5a43aa74d7eeb76",
|
"content-hash": "653f8558c75614dd65421cb3eb48c29b",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "composer/package-versions-deprecated",
|
"name": "composer/package-versions-deprecated",
|
||||||
|
|
@ -4400,25 +4400,22 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/flex",
|
"name": "symfony/flex",
|
||||||
"version": "v1.21.8",
|
"version": "v1.17.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/flex.git",
|
"url": "https://github.com/symfony/flex.git",
|
||||||
"reference": "bda5f869ac51c8e985a6fe9f964c4cb78228a369"
|
"reference": "acd0b5018fe9c2f5be6c67367987b5c723c0e096"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/flex/zipball/bda5f869ac51c8e985a6fe9f964c4cb78228a369",
|
"url": "https://api.github.com/repos/symfony/flex/zipball/acd0b5018fe9c2f5be6c67367987b5c723c0e096",
|
||||||
"reference": "bda5f869ac51c8e985a6fe9f964c4cb78228a369",
|
"reference": "acd0b5018fe9c2f5be6c67367987b5c723c0e096",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"composer-plugin-api": "^1.0|^2.0",
|
"composer-plugin-api": "^1.0|^2.0",
|
||||||
"php": ">=7.1"
|
"php": ">=7.1"
|
||||||
},
|
},
|
||||||
"conflict": {
|
|
||||||
"composer/semver": "<1.7.2"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"composer/composer": "^1.0.2|^2.0",
|
"composer/composer": "^1.0.2|^2.0",
|
||||||
"symfony/dotenv": "^4.4|^5.0|^6.0",
|
"symfony/dotenv": "^4.4|^5.0|^6.0",
|
||||||
|
|
@ -4448,7 +4445,7 @@
|
||||||
"description": "Composer plugin for Symfony",
|
"description": "Composer plugin for Symfony",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/symfony/flex/issues",
|
"issues": "https://github.com/symfony/flex/issues",
|
||||||
"source": "https://github.com/symfony/flex/tree/v1.21.8"
|
"source": "https://github.com/symfony/flex/tree/v1.17.3"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|
@ -4464,7 +4461,7 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-10-07T08:51:39+00:00"
|
"time": "2021-11-22T18:48:50+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/framework-bundle",
|
"name": "symfony/framework-bundle",
|
||||||
|
|
@ -7972,5 +7969,5 @@
|
||||||
"ext-iconv": "*"
|
"ext-iconv": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.3.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -672,30 +672,6 @@ catalyst_auth:
|
||||||
acls:
|
acls:
|
||||||
- id: item_pricing.update
|
- id: item_pricing.update
|
||||||
label: Update
|
label: Update
|
||||||
|
|
||||||
- id: entity_list
|
|
||||||
label: EntityTypes
|
|
||||||
acls:
|
|
||||||
- id: entity.menu
|
|
||||||
label: Menu
|
|
||||||
- id: entity.add
|
|
||||||
label: Add
|
|
||||||
- id: entity.update
|
|
||||||
label: Update
|
|
||||||
- id: entity.delete
|
|
||||||
label: Delete
|
|
||||||
- id: entity.list
|
|
||||||
label: List
|
|
||||||
|
|
||||||
- id: leaflet
|
|
||||||
label: Leaflet
|
|
||||||
acls:
|
|
||||||
- id: leaflet.menu
|
|
||||||
label: Menu
|
|
||||||
- id: leaflet.update
|
|
||||||
label: Update
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
api:
|
api:
|
||||||
user_entity: "App\\Entity\\ApiUser"
|
user_entity: "App\\Entity\\ApiUser"
|
||||||
|
|
|
||||||
|
|
@ -306,12 +306,3 @@ catalyst_menu:
|
||||||
acl: item_pricing.update
|
acl: item_pricing.update
|
||||||
label: Item Pricing
|
label: Item Pricing
|
||||||
parent: item
|
parent: item
|
||||||
|
|
||||||
- id: entity_list
|
|
||||||
acl: entity.menu
|
|
||||||
label: EntityTypes
|
|
||||||
|
|
||||||
- id: leaflet
|
|
||||||
acl: leaflet.menu
|
|
||||||
label: Leaflet
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
framework:
|
|
||||||
mailer:
|
|
||||||
dsn: '%env(MAILER_DSN)%'
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
#index:
|
||||||
|
# path: /
|
||||||
|
# controller: App\Controller\DefaultController::index
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
leaflet:
|
|
||||||
path: /leaflet
|
|
||||||
controller: App\Controller\LeafletController::index
|
|
||||||
methods: [GET]
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
entity_list:
|
|
||||||
path: /test
|
|
||||||
controller: App\Controller\EntityController::index
|
|
||||||
methods: [GET]
|
|
||||||
|
|
||||||
entity_rows:
|
|
||||||
path: /test/rowdata
|
|
||||||
controller: App\Controller\EntityController::datatableRows
|
|
||||||
methods: [POST]
|
|
||||||
|
|
||||||
entity_add_form:
|
|
||||||
path: /test/newform
|
|
||||||
controller: App\Controller\EntityController::addForm
|
|
||||||
methods: [GET]
|
|
||||||
|
|
||||||
entity_add_submit:
|
|
||||||
path: /test
|
|
||||||
controller: App\Controller\EntityController::addSubmit
|
|
||||||
methods: [POST]
|
|
||||||
|
|
||||||
entity_update_form:
|
|
||||||
path: /test/{id}
|
|
||||||
controller: App\Controller\EntityController::updateForm
|
|
||||||
methods: [GET]
|
|
||||||
|
|
||||||
entity_update_submit:
|
|
||||||
path: /test/{id}
|
|
||||||
controller: App\Controller\EntityController::updateSubmit
|
|
||||||
methods: [POST]
|
|
||||||
|
|
||||||
entity_delete:
|
|
||||||
path: /test/{id}
|
|
||||||
controller: App\Controller\EntityController::deleteSubmit
|
|
||||||
methods: [DELETE]
|
|
||||||
|
|
@ -33,8 +33,6 @@ services:
|
||||||
resource: '../src/*'
|
resource: '../src/*'
|
||||||
exclude: '../src/{Entity,Migrations,Tests,Menu,Access}'
|
exclude: '../src/{Entity,Migrations,Tests,Menu,Access}'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# controllers are imported separately to make sure services can be injected
|
# controllers are imported separately to make sure services can be injected
|
||||||
# as action arguments even if you don't extend any base controller class
|
# as action arguments even if you don't extend any base controller class
|
||||||
App\Controller\:
|
App\Controller\:
|
||||||
|
|
@ -171,13 +169,6 @@ services:
|
||||||
#App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Bing"
|
#App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Bing"
|
||||||
App\Service\GISManagerInterface: "@App\\Service\\GISManager\\OpenStreet"
|
App\Service\GISManagerInterface: "@App\\Service\\GISManager\\OpenStreet"
|
||||||
#App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Google"
|
#App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Google"
|
||||||
|
|
||||||
App\EventListener\ProductAddedListener:
|
|
||||||
arguments:
|
|
||||||
$mailer: '@mailer' # Autowire the mailer service
|
|
||||||
$entityManager: '@doctrine.orm.entity_manager' # Autowire the EntityManager
|
|
||||||
tags:
|
|
||||||
- { name: 'kernel.event_listener', event: 'App\Event\ProductAdded', method: 'onProductAdded' }
|
|
||||||
|
|
||||||
App\EventListener\JobOrderActiveCacheListener:
|
App\EventListener\JobOrderActiveCacheListener:
|
||||||
arguments:
|
arguments:
|
||||||
|
|
|
||||||
0
id
0
id
0
item
0
item
0
price
0
price
|
|
@ -386,6 +386,7 @@ class RiderAppController extends ApiController
|
||||||
'flag_coolant' => $jo->hasCoolant(),
|
'flag_coolant' => $jo->hasCoolant(),
|
||||||
'has_motolite' => $cv->hasMotoliteBattery(),
|
'has_motolite' => $cv->hasMotoliteBattery(),
|
||||||
'delivery_status' => $jo->getDeliveryStatus(),
|
'delivery_status' => $jo->getDeliveryStatus(),
|
||||||
|
'flag_sealant' => $jo->hasSealant(),
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -1324,7 +1325,7 @@ class RiderAppController extends ApiController
|
||||||
return new APIResponse(false, 'Invalid promo id - ' . $promo_id);
|
return new APIResponse(false, 'Invalid promo id - ' . $promo_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get other parameters, if any: has motolite battery, has warranty doc, with coolant, payment method
|
// get other parameters, if any: has motolite battery, has warranty doc, with coolant, payment method, with sealant
|
||||||
if (isset($items['flag_motolite_battery']))
|
if (isset($items['flag_motolite_battery']))
|
||||||
{
|
{
|
||||||
// get customer vehicle from jo
|
// get customer vehicle from jo
|
||||||
|
|
@ -1359,6 +1360,15 @@ class RiderAppController extends ApiController
|
||||||
$jo->setModeOfPayment($payment_method);
|
$jo->setModeOfPayment($payment_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($items['flag_sealant']))
|
||||||
|
{
|
||||||
|
$has_sealant = $items['flag_sealant'];
|
||||||
|
if ($has_sealant == 'true')
|
||||||
|
$jo->setHasSealant(true);
|
||||||
|
else
|
||||||
|
$jo->setHasSealant(false);
|
||||||
|
}
|
||||||
|
|
||||||
// get capi user
|
// get capi user
|
||||||
$capi_user = $this->getUser();
|
$capi_user = $this->getUser();
|
||||||
if ($capi_user == null)
|
if ($capi_user == null)
|
||||||
|
|
@ -1443,6 +1453,13 @@ class RiderAppController extends ApiController
|
||||||
else
|
else
|
||||||
$jo->setHasCoolant(false);
|
$jo->setHasCoolant(false);
|
||||||
|
|
||||||
|
// sealant
|
||||||
|
$flag_sealant = $req->request->get('flag_sealant', 'false');
|
||||||
|
if ($flag_sealant == 'true')
|
||||||
|
$jo->setHasSealant(true);
|
||||||
|
else
|
||||||
|
$jo->setHasSealant(false);
|
||||||
|
|
||||||
// has motolite battery
|
// has motolite battery
|
||||||
$cv = $jo->getCustomerVehicle();
|
$cv = $jo->getCustomerVehicle();
|
||||||
$has_motolite = $req->request->get('has_motolite', 'false');
|
$has_motolite = $req->request->get('has_motolite', 'false');
|
||||||
|
|
@ -1543,6 +1560,9 @@ class RiderAppController extends ApiController
|
||||||
// get coolant if any
|
// get coolant if any
|
||||||
$flag_coolant = $jo->hasCoolant();
|
$flag_coolant = $jo->hasCoolant();
|
||||||
|
|
||||||
|
// get sealant if any
|
||||||
|
$flag_sealant = $jo->hasSealant();
|
||||||
|
|
||||||
// check if new promo is null
|
// check if new promo is null
|
||||||
if ($promo == null)
|
if ($promo == null)
|
||||||
{
|
{
|
||||||
|
|
@ -1561,6 +1581,7 @@ class RiderAppController extends ApiController
|
||||||
->setCustomerVehicle($cv)
|
->setCustomerVehicle($cv)
|
||||||
->setSource($source)
|
->setSource($source)
|
||||||
->setHasCoolant($flag_coolant)
|
->setHasCoolant($flag_coolant)
|
||||||
|
->setHasSealant($flag_sealant)
|
||||||
->setIsTaxable();
|
->setIsTaxable();
|
||||||
|
|
||||||
// set price tier
|
// set price tier
|
||||||
|
|
|
||||||
|
|
@ -1,272 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller;
|
|
||||||
|
|
||||||
use App\Entity\Entity;
|
|
||||||
use App\Event\ProductAdded;
|
|
||||||
use Doctrine\ORM\Query;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
|
||||||
|
|
||||||
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
|
||||||
|
|
||||||
use Catalyst\MenuBundle\Annotation\Menu;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EntityController extends Controller{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Menu(selected="entity_list")
|
|
||||||
* @IsGranted("entity.list")
|
|
||||||
*/
|
|
||||||
public function index ()
|
|
||||||
{
|
|
||||||
return $this->render('entity/list.html.twig');
|
|
||||||
}
|
|
||||||
|
|
||||||
private $eventDispatcher;
|
|
||||||
|
|
||||||
public function __construct(EventDispatcherInterface $eventDispatcher)
|
|
||||||
{
|
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Menu(selected="entity_list")
|
|
||||||
* @IsGranted("entity.add")
|
|
||||||
*/
|
|
||||||
public function addForm()
|
|
||||||
{
|
|
||||||
$entity = new Entity();
|
|
||||||
$params = [
|
|
||||||
'obj' => $entity,
|
|
||||||
'mode' => 'create',
|
|
||||||
];
|
|
||||||
|
|
||||||
// response
|
|
||||||
return $this->render('entity/form.html.twig', $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @IsGranted("entity.add")
|
|
||||||
*/
|
|
||||||
public function addSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator)
|
|
||||||
{
|
|
||||||
$test = new Entity();
|
|
||||||
|
|
||||||
$this->setObject($test, $req);
|
|
||||||
|
|
||||||
// validate
|
|
||||||
$errors = $validator->validate($test);
|
|
||||||
|
|
||||||
// initialize error list
|
|
||||||
$error_array = [];
|
|
||||||
|
|
||||||
// add errors to list
|
|
||||||
foreach ($errors as $error) {
|
|
||||||
$error_array[$error->getPropertyPath()] = $error->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if any errors were found
|
|
||||||
if (!empty($error_array)) {
|
|
||||||
// return validation failure response
|
|
||||||
return $this->json([
|
|
||||||
'success' => false,
|
|
||||||
'errors' => $error_array
|
|
||||||
], 422);
|
|
||||||
}
|
|
||||||
|
|
||||||
// validated! save the entity
|
|
||||||
$em->persist($test);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
$this->eventDispatcher->dispatch(new ProductAdded($test));
|
|
||||||
|
|
||||||
// return successful response
|
|
||||||
return $this->json([
|
|
||||||
'success' => 'Changes have been saved!'
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Menu(selected="entity_list")
|
|
||||||
* @IsGranted("entity.update")
|
|
||||||
*/
|
|
||||||
public function updateForm($id, EntityManagerInterface $em, Entity $e)
|
|
||||||
{
|
|
||||||
$params = [];
|
|
||||||
$params['obj'] = $e;
|
|
||||||
$params['mode'] = 'update';
|
|
||||||
|
|
||||||
// response
|
|
||||||
return $this->render('entity/form.html.twig', $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @IsGranted("entity.update")
|
|
||||||
*/
|
|
||||||
public function updateSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator, Entity $e)
|
|
||||||
{
|
|
||||||
$this->setObject($e, $req);
|
|
||||||
|
|
||||||
// validate
|
|
||||||
$errors = $validator->validate($e);
|
|
||||||
|
|
||||||
// initialize error list
|
|
||||||
$error_array = [];
|
|
||||||
|
|
||||||
// add errors to list
|
|
||||||
foreach ($errors as $error) {
|
|
||||||
$error_array[$error->getPropertyPath()] = $error->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if any errors were found
|
|
||||||
if (!empty($error_array)) {
|
|
||||||
// return validation failure response
|
|
||||||
return $this->json([
|
|
||||||
'success' => false,
|
|
||||||
'errors' => $error_array
|
|
||||||
], 422);
|
|
||||||
}
|
|
||||||
|
|
||||||
// validated! save the entity
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
$this->eventDispatcher->dispatch(new ProductAdded($e));
|
|
||||||
|
|
||||||
// return successful response
|
|
||||||
return $this->json([
|
|
||||||
'success' => 'Changes have been saved!'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @IsGranted("entity.delete")
|
|
||||||
*/
|
|
||||||
public function deleteSubmit(EntityManagerInterface $em, Entity $entity)
|
|
||||||
{
|
|
||||||
// delete this object
|
|
||||||
$em->remove($entity);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
// response
|
|
||||||
$response = new Response();
|
|
||||||
$response->setStatusCode(Response::HTTP_OK);
|
|
||||||
$response->send();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setObject(Entity $obj, Request $req)
|
|
||||||
{
|
|
||||||
// set and save values
|
|
||||||
$obj->setItem($req->request->get('item'))
|
|
||||||
->setPrice($req->request->get('price'))
|
|
||||||
->setDescription($req->request->get('description'));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setQueryFilters($datatable, QueryBuilder $query)
|
|
||||||
{
|
|
||||||
if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) {
|
|
||||||
$query->where('q.item LIKE :filter')
|
|
||||||
->setParameter('filter', '%' . $datatable['query']['data-rows-search'] . '%');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @IsGranted("entity.list")
|
|
||||||
*/
|
|
||||||
public function datatableRows(Request $req)
|
|
||||||
{
|
|
||||||
// get query builder
|
|
||||||
$qb = $this->getDoctrine()
|
|
||||||
->getRepository(Entity::class)
|
|
||||||
->createQueryBuilder('q');
|
|
||||||
|
|
||||||
// get datatable params
|
|
||||||
$datatable = $req->request->get('datatable');
|
|
||||||
|
|
||||||
// count total records
|
|
||||||
$tquery = $qb->select('COUNT(q)');
|
|
||||||
$this->setQueryFilters($datatable, $tquery);
|
|
||||||
$total = $tquery->getQuery()
|
|
||||||
->getSingleScalarResult();
|
|
||||||
|
|
||||||
// get current page number
|
|
||||||
$page = $datatable['pagination']['page'] ?? 1;
|
|
||||||
|
|
||||||
$perpage = $datatable['pagination']['perpage'];
|
|
||||||
$offset = ($page - 1) * $perpage;
|
|
||||||
|
|
||||||
// add metadata
|
|
||||||
$meta = [
|
|
||||||
'page' => $page,
|
|
||||||
'perpage' => $perpage,
|
|
||||||
'pages' => ceil($total / $perpage),
|
|
||||||
'total' => $total,
|
|
||||||
'sort' => 'asc',
|
|
||||||
'field' => 'id'
|
|
||||||
];
|
|
||||||
|
|
||||||
// build query
|
|
||||||
$query = $qb->select('q');
|
|
||||||
$this->setQueryFilters($datatable, $query);
|
|
||||||
|
|
||||||
// check if sorting is present, otherwise use default
|
|
||||||
if (isset($datatable['sort']['field']) && !empty($datatable['sort']['field'])) {
|
|
||||||
$order = $datatable['sort']['sort'] ?? 'asc';
|
|
||||||
$query->orderBy('q.' . $datatable['sort']['field'], $order);
|
|
||||||
} else {
|
|
||||||
$query->orderBy('q.id', 'asc');
|
|
||||||
}
|
|
||||||
|
|
||||||
// get rows for this page
|
|
||||||
$obj_rows = $query->setFirstResult($offset)
|
|
||||||
->setMaxResults($perpage)
|
|
||||||
->getQuery()
|
|
||||||
->getResult();
|
|
||||||
|
|
||||||
// process rows
|
|
||||||
$rows = [];
|
|
||||||
foreach ($obj_rows as $orow) {
|
|
||||||
// add row data
|
|
||||||
$row['id'] = $orow->getID();
|
|
||||||
$row['item'] = $orow->getItem();
|
|
||||||
$row['price'] = $orow->getPrice();
|
|
||||||
$row['description'] = $orow->getDescription();
|
|
||||||
|
|
||||||
|
|
||||||
// add row metadata
|
|
||||||
$row['meta'] = [
|
|
||||||
'update_url' => '',
|
|
||||||
'delete_url' => ''
|
|
||||||
];
|
|
||||||
|
|
||||||
// add crud urls
|
|
||||||
if ($this->isGranted('entity.update'))
|
|
||||||
$row['meta']['update_url'] = $this->generateUrl('entity_update_form', ['id' => $row['id']]);
|
|
||||||
if ($this->isGranted('entity.delete'))
|
|
||||||
$row['meta']['delete_url'] = $this->generateUrl('entity_delete', ['id' => $row['id']]);
|
|
||||||
|
|
||||||
$rows[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
// response
|
|
||||||
return $this->json([
|
|
||||||
'meta' => $meta,
|
|
||||||
'data' => $rows
|
|
||||||
]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -754,6 +754,8 @@ class JobOrderController extends Controller
|
||||||
$promo_id = $req->request->get('promo');
|
$promo_id = $req->request->get('promo');
|
||||||
$cvid = $req->request->get('cvid');
|
$cvid = $req->request->get('cvid');
|
||||||
$service_charges = $req->request->get('service_charges', []);
|
$service_charges = $req->request->get('service_charges', []);
|
||||||
|
$flag_coolant = $req->request->get('flag_coolant', false);
|
||||||
|
$flag_sealant = $req->request->get('flag_sealant', false);
|
||||||
|
|
||||||
// coordinates
|
// coordinates
|
||||||
// need to check if lng and lat are set
|
// need to check if lng and lat are set
|
||||||
|
|
@ -784,7 +786,9 @@ class JobOrderController extends Controller
|
||||||
->setCustomerVehicle($cv)
|
->setCustomerVehicle($cv)
|
||||||
->setIsTaxable()
|
->setIsTaxable()
|
||||||
->setSource(TransactionOrigin::CALL)
|
->setSource(TransactionOrigin::CALL)
|
||||||
->setPriceTier($price_tier);
|
->setPriceTier($price_tier)
|
||||||
|
->setHasCoolant($flag_coolant)
|
||||||
|
->setHasSealant($flag_sealant);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// if it's a jumpstart or troubleshoot only, we know what to charge already
|
// if it's a jumpstart or troubleshoot only, we know what to charge already
|
||||||
|
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// src/Controller/LeafletController.php
|
|
||||||
namespace App\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
|
||||||
|
|
||||||
use Catalyst\MenuBundle\Annotation\Menu;
|
|
||||||
|
|
||||||
class LeafletController extends AbstractController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @Menu(selected="leaflet")
|
|
||||||
* @IsGranted("leaflet.menu")
|
|
||||||
*/
|
|
||||||
public function index(): Response
|
|
||||||
{
|
|
||||||
return $this->render('leaflet/index.html.twig', [
|
|
||||||
'message' => 'Hello from LeafletController!',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity;
|
|
||||||
|
|
||||||
use App\Repository\TestRepository;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Entity(repositoryClass=TestRepository::class)
|
|
||||||
*/
|
|
||||||
class Entity
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\Id
|
|
||||||
* @ORM\GeneratedValue
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="string", length=255)
|
|
||||||
*/
|
|
||||||
private $item;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="decimal", precision=8, scale=2)
|
|
||||||
*/
|
|
||||||
private $price;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text")
|
|
||||||
*/
|
|
||||||
private $description;
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getItem(): ?string
|
|
||||||
{
|
|
||||||
return $this->item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setItem(string $item): self
|
|
||||||
{
|
|
||||||
$this->item = $item;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPrice(): ?string
|
|
||||||
{
|
|
||||||
return $this->price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setPrice(string $price): self
|
|
||||||
{
|
|
||||||
$this->price = $price;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDescription(): ?string
|
|
||||||
{
|
|
||||||
return $this->description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDescription(string $description): self
|
|
||||||
{
|
|
||||||
$this->description = $description;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -441,6 +441,12 @@ class JobOrder
|
||||||
*/
|
*/
|
||||||
protected $flag_cust_new;
|
protected $flag_cust_new;
|
||||||
|
|
||||||
|
// only for tire service, if it requires sealant or not
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
|
*/
|
||||||
|
protected $flag_sealant;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->date_create = new DateTime();
|
$this->date_create = new DateTime();
|
||||||
|
|
@ -458,6 +464,7 @@ class JobOrder
|
||||||
$this->trade_in_type = null;
|
$this->trade_in_type = null;
|
||||||
$this->flag_rider_rating = false;
|
$this->flag_rider_rating = false;
|
||||||
$this->flag_coolant = false;
|
$this->flag_coolant = false;
|
||||||
|
$this->flag_sealant = false;
|
||||||
|
|
||||||
$this->priority = 0;
|
$this->priority = 0;
|
||||||
$this->meta = [];
|
$this->meta = [];
|
||||||
|
|
@ -1256,4 +1263,15 @@ class JobOrder
|
||||||
return $this->flag_cust_new;
|
return $this->flag_cust_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setHasSealant($flag = true)
|
||||||
|
{
|
||||||
|
$this->flag_sealant = $flag;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasSealant()
|
||||||
|
{
|
||||||
|
return $this->flag_sealant;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<?php
|
|
||||||
// src/Event/ProductAdded.php
|
|
||||||
namespace App\Event;
|
|
||||||
use Symfony\Contracts\EventDispatcher\Event;
|
|
||||||
|
|
||||||
use App\Entity\Entity;
|
|
||||||
|
|
||||||
class ProductAdded
|
|
||||||
{
|
|
||||||
private $product;
|
|
||||||
|
|
||||||
public function __construct(Entity $product)
|
|
||||||
{
|
|
||||||
$this->product = $product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getProduct(): Entity
|
|
||||||
{
|
|
||||||
return $this->product;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\EventListener;
|
|
||||||
|
|
||||||
use App\Event\ProductAdded;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Component\Mailer\MailerInterface;
|
|
||||||
use Symfony\Component\Mime\Email;
|
|
||||||
|
|
||||||
class ProductAddedListener
|
|
||||||
{
|
|
||||||
private $mailer;
|
|
||||||
private $entityManager;
|
|
||||||
|
|
||||||
public function __construct(MailerInterface $mailer, EntityManagerInterface $entityManager)
|
|
||||||
{
|
|
||||||
$this->mailer = $mailer;
|
|
||||||
$this->entityManager = $entityManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onProductAdded(ProductAdded $event)
|
|
||||||
{
|
|
||||||
// Get all products in the database
|
|
||||||
$items = $this->entityManager->getRepository('App:Entity')->findAll();
|
|
||||||
|
|
||||||
// Convert to JSON format
|
|
||||||
$itemData = [];
|
|
||||||
foreach ($items as $item) {
|
|
||||||
$itemData[] = [
|
|
||||||
'id' => $item->getId(),
|
|
||||||
'item' => $item->getItem(),
|
|
||||||
'price' => $item->getPrice(),
|
|
||||||
'description' => $item->getDescription(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$jsonItems = json_encode($itemData, JSON_PRETTY_PRINT);
|
|
||||||
|
|
||||||
// Send an email with the JSON data
|
|
||||||
$email = (new Email())
|
|
||||||
->from('ansleytheking@gmail.coml')
|
|
||||||
->to('ansley.sze@foodgroup.ph')
|
|
||||||
->subject('New Product Added - Item List in JSON')
|
|
||||||
->text('A new product has been added. Here is the complete list of items in JSON format.')
|
|
||||||
->attach($jsonItems, 'items.json', 'application/json');
|
|
||||||
|
|
||||||
$this->mailer->send($email);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -31,6 +31,7 @@ class TireRepair implements InvoiceRuleInterface
|
||||||
public function compute($criteria, &$total)
|
public function compute($criteria, &$total)
|
||||||
{
|
{
|
||||||
$stype = $criteria->getServiceType();
|
$stype = $criteria->getServiceType();
|
||||||
|
$has_sealant = $criteria->hasSealant();
|
||||||
$pt_id = $criteria->getPriceTier();
|
$pt_id = $criteria->getPriceTier();
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
@ -56,8 +57,28 @@ class TireRepair implements InvoiceRuleInterface
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
];
|
];
|
||||||
|
|
||||||
$qty_price = bcmul($price, $qty, 2);
|
$qty_fee = bcmul($qty, $price, 2);
|
||||||
$total['total_price'] = bcadd($total['total_price'], $qty_price, 2);
|
$total_price = $qty_fee;
|
||||||
|
|
||||||
|
if ($has_sealant)
|
||||||
|
{
|
||||||
|
$sealant_fee_data = $this->getSealantFeeData();
|
||||||
|
|
||||||
|
$sealant_fee = $sealant_fee_data['fee'];
|
||||||
|
$sealant_title = $sealant_fee_data['title'];
|
||||||
|
|
||||||
|
$items[] = [
|
||||||
|
'service_type' => $this->getID(),
|
||||||
|
'qty' => $qty,
|
||||||
|
'title' => $sealant_title,
|
||||||
|
'price' => $sealant_fee,
|
||||||
|
];
|
||||||
|
|
||||||
|
$qty_price = bcmul($sealant_fee, $qty, 2);
|
||||||
|
$total_price = bcadd($total_price, $qty_price, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
$total['total_price'] = bcadd($total['total_price'], $total_price, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
|
|
@ -131,4 +152,28 @@ class TireRepair implements InvoiceRuleInterface
|
||||||
|
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSealantFeeData()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'fee' => 0.00,
|
||||||
|
'title' => '',
|
||||||
|
];
|
||||||
|
|
||||||
|
$code = 'tire_sealant_fee';
|
||||||
|
|
||||||
|
// find the service fee using the code
|
||||||
|
// if we can't find the fee, return 0
|
||||||
|
$fee = $this->em->getRepository(ServiceOffering::class)->findOneBy(['code' => $code]);
|
||||||
|
|
||||||
|
if ($fee != null)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'fee' => $fee->getFee(),
|
||||||
|
'title' => $fee->getName(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20241017062927 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription() : string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
|
||||||
|
|
||||||
$this->addSql('CREATE TABLE test (id INT AUTO_INCREMENT NOT NULL, placeholder VARCHAR(120) NOT NULL, password LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
|
||||||
$this->addSql('ALTER TABLE battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
|
||||||
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
|
||||||
|
|
||||||
$this->addSql('DROP TABLE test');
|
|
||||||
$this->addSql('ALTER TABLE battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20241018002028 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription() : string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
|
||||||
|
|
||||||
$this->addSql('ALTER TABLE battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
|
||||||
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
|
||||||
$this->addSql('ALTER TABLE test ADD item VARCHAR(255) NOT NULL, ADD price NUMERIC(10, 2) NOT NULL, DROP placeholder, CHANGE password description LONGTEXT NOT NULL');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
|
||||||
|
|
||||||
$this->addSql('ALTER TABLE battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->addSql('ALTER TABLE test ADD placeholder VARCHAR(120) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, DROP item, DROP price, CHANGE description password LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20241018012501 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription() : string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
|
||||||
|
|
||||||
$this->addSql('CREATE TABLE test (id INT AUTO_INCREMENT NOT NULL, item VARCHAR(255) NOT NULL, price NUMERIC(8, 2) NOT NULL, description LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
|
||||||
$this->addSql('ALTER TABLE battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
|
||||||
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
|
||||||
|
|
||||||
$this->addSql('DROP TABLE test');
|
|
||||||
$this->addSql('ALTER TABLE battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20241023070137 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription() : string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
|
||||||
|
|
||||||
$this->addSql('ALTER TABLE battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
|
||||||
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
|
||||||
|
|
||||||
$this->addSql('ALTER TABLE battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -18,6 +18,7 @@ class InvoiceCriteria
|
||||||
protected $flag_taxable;
|
protected $flag_taxable;
|
||||||
protected $source; // use Ramcar's TransactionOrigin
|
protected $source; // use Ramcar's TransactionOrigin
|
||||||
protected $price_tier;
|
protected $price_tier;
|
||||||
|
protected $flag_sealant;
|
||||||
|
|
||||||
// entries are battery and trade-in combos
|
// entries are battery and trade-in combos
|
||||||
protected $entries;
|
protected $entries;
|
||||||
|
|
@ -34,6 +35,7 @@ class InvoiceCriteria
|
||||||
$this->flag_taxable = false;
|
$this->flag_taxable = false;
|
||||||
$this->source = '';
|
$this->source = '';
|
||||||
$this->price_tier = 0; // set to default
|
$this->price_tier = 0; // set to default
|
||||||
|
$this->flag_sealant = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setServiceType($stype)
|
public function setServiceType($stype)
|
||||||
|
|
@ -202,4 +204,15 @@ class InvoiceCriteria
|
||||||
{
|
{
|
||||||
return $this->price_tier;
|
return $this->price_tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setHasSealant($flag = true)
|
||||||
|
{
|
||||||
|
$this->flag_sealant = $flag;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasSealant()
|
||||||
|
{
|
||||||
|
return $this->flag_sealant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repository;
|
|
||||||
|
|
||||||
use App\Entity\Notifs;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method Notifs|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method Notifs|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method Notifs[] findAll()
|
|
||||||
* @method Notifs[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
class NotifsRepository extends ServiceEntityRepository
|
|
||||||
{
|
|
||||||
public function __construct(ManagerRegistry $registry)
|
|
||||||
{
|
|
||||||
parent::__construct($registry, Notifs::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @return Notifs[] Returns an array of Notifs objects
|
|
||||||
// */
|
|
||||||
/*
|
|
||||||
public function findByExampleField($value)
|
|
||||||
{
|
|
||||||
return $this->createQueryBuilder('n')
|
|
||||||
->andWhere('n.exampleField = :val')
|
|
||||||
->setParameter('val', $value)
|
|
||||||
->orderBy('n.id', 'ASC')
|
|
||||||
->setMaxResults(10)
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
public function findOneBySomeField($value): ?Notifs
|
|
||||||
{
|
|
||||||
return $this->createQueryBuilder('n')
|
|
||||||
->andWhere('n.exampleField = :val')
|
|
||||||
->setParameter('val', $value)
|
|
||||||
->getQuery()
|
|
||||||
->getOneOrNullResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repository;
|
|
||||||
|
|
||||||
use App\Entity\Entity;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method Test|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method Test|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method Test[] findAll()
|
|
||||||
* @method Test[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
class TestRepository extends ServiceEntityRepository
|
|
||||||
{
|
|
||||||
public function __construct(ManagerRegistry $registry)
|
|
||||||
{
|
|
||||||
parent::__construct($registry, Entity::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @return Test[] Returns an array of Test objects
|
|
||||||
// */
|
|
||||||
/*
|
|
||||||
public function findByExampleField($value)
|
|
||||||
{
|
|
||||||
return $this->createQueryBuilder('t')
|
|
||||||
->andWhere('t.exampleField = :val')
|
|
||||||
->setParameter('val', $value)
|
|
||||||
->orderBy('t.id', 'ASC')
|
|
||||||
->setMaxResults(10)
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
public function findOneBySomeField($value): ?Test
|
|
||||||
{
|
|
||||||
return $this->createQueryBuilder('t')
|
|
||||||
->andWhere('t.exampleField = :val')
|
|
||||||
->setParameter('val', $value)
|
|
||||||
->getQuery()
|
|
||||||
->getOneOrNullResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
@ -69,6 +69,14 @@ class InvoiceManager implements InvoiceGeneratorInterface
|
||||||
->setCustomerVehicle($jo->getCustomerVehicle())
|
->setCustomerVehicle($jo->getCustomerVehicle())
|
||||||
->setPriceTier($price_tier);
|
->setPriceTier($price_tier);
|
||||||
|
|
||||||
|
if (($jo->getServiceType() == ServiceType::OVERHEAT_ASSISTANCE) &&
|
||||||
|
($jo->hasCoolant()))
|
||||||
|
$criteria->setHasCoolant(true);
|
||||||
|
|
||||||
|
if (($jo->getServiceType() == ServiceType::TIRE_REPAIR) &&
|
||||||
|
($jo->hasSealant()))
|
||||||
|
$criteria->setHasSealant(true);
|
||||||
|
|
||||||
// set if taxable
|
// set if taxable
|
||||||
// NOTE: ideally, this should be a parameter when calling generateInvoiceCriteria. But that
|
// NOTE: ideally, this should be a parameter when calling generateInvoiceCriteria. But that
|
||||||
// would mean adding it as a parameter to the call, impacting all calls
|
// would mean adding it as a parameter to the call, impacting all calls
|
||||||
|
|
|
||||||
12
symfony.lock
12
symfony.lock
|
|
@ -242,18 +242,6 @@
|
||||||
"symfony/inflector": {
|
"symfony/inflector": {
|
||||||
"version": "v4.0.2"
|
"version": "v4.0.2"
|
||||||
},
|
},
|
||||||
"symfony/mailer": {
|
|
||||||
"version": "4.4",
|
|
||||||
"recipe": {
|
|
||||||
"repo": "github.com/symfony/recipes",
|
|
||||||
"branch": "main",
|
|
||||||
"version": "4.3",
|
|
||||||
"ref": "df66ee1f226c46f01e85c29c2f7acce0596ba35a"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"config/packages/mailer.yaml"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"symfony/maker-bundle": {
|
"symfony/maker-bundle": {
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
|
|
||||||
|
|
@ -1,151 +0,0 @@
|
||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<!-- BEGIN: Subheader -->
|
|
||||||
<div class="m-subheader">
|
|
||||||
<div class="d-flex align-items-center">
|
|
||||||
<div class="mr-auto">
|
|
||||||
<h3 class="m-subheader__title">Product list</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- END: Subheader -->
|
|
||||||
<div class="m-content">
|
|
||||||
<!--Begin::Section-->
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xl-6">
|
|
||||||
<div class="m-portlet m-portlet--mobile">
|
|
||||||
<div class="m-portlet__head">
|
|
||||||
<div class="m-portlet__head-caption">
|
|
||||||
<div class="m-portlet__head-title">
|
|
||||||
<span class="m-portlet__head-icon">
|
|
||||||
<i class="la la-industry"></i>
|
|
||||||
</span>
|
|
||||||
<h3 class="m-portlet__head-text">
|
|
||||||
{% if mode == 'update' %}
|
|
||||||
Edit Product Type
|
|
||||||
<small>{{ obj.getItem() }}</small>
|
|
||||||
{% else %}
|
|
||||||
New Product Type
|
|
||||||
{% endif %}
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form id="row-form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ mode == 'update' ? url('entity_update_submit', {'id': obj.getId()}) : url('entity_add_submit') }}">
|
|
||||||
<div class="m-portlet__body">
|
|
||||||
<div class="form-group m-form__group row no-border">
|
|
||||||
<label class="col-lg-3 col-form-label" data-field="item">
|
|
||||||
Item:
|
|
||||||
</label>
|
|
||||||
<div class="col-lg-9">
|
|
||||||
<input type="text" name="item" class="form-control m-input" value="{{ obj.getItem() }}">
|
|
||||||
<div class="form-control-feedback hide" data-field="item"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group m-form__group row no-border">
|
|
||||||
<label class="col-lg-3 col-form-label" data-field="price">
|
|
||||||
Price:
|
|
||||||
</label>
|
|
||||||
<div class="col-lg-9">
|
|
||||||
<input type="number" step="0.01" name="price" class="form-control m-input" value="{{ obj.getPrice() }}">
|
|
||||||
<div class="form-control-feedback hide" data-field="price"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group m-form__group row no-border">
|
|
||||||
<label class="col-lg-3 col-form-label" data-field="description">
|
|
||||||
Description:
|
|
||||||
</label>
|
|
||||||
<div class="col-lg-9">
|
|
||||||
<textarea name="description" class="form-control m-input">{{ obj.getDescription() }}</textarea>
|
|
||||||
<div class="form-control-feedback hide" data-field="description"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="m-portlet__foot m-portlet__foot--fit">
|
|
||||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<button type="submit" class="btn btn-success">Submit</button>
|
|
||||||
<a href="{{ url('entity_list') }}" class="btn btn-secondary">Back</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block scripts %}
|
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
$("#row-form").submit(function(e) {
|
|
||||||
var form = $(this);
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
method: "POST",
|
|
||||||
url: form.prop('action'),
|
|
||||||
data: form.serialize()
|
|
||||||
}).done(function(response) {
|
|
||||||
// remove all error classes
|
|
||||||
removeErrors();
|
|
||||||
swal({
|
|
||||||
title: 'Done!',
|
|
||||||
text: 'Your changes have been saved!',
|
|
||||||
type: 'success',
|
|
||||||
onClose: function() {
|
|
||||||
window.location.href = "{{ url('entity_list') }}";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).fail(function(response) {
|
|
||||||
if (response.status == 422) {
|
|
||||||
var errors = response.responseJSON.errors;
|
|
||||||
var firstfield = false;
|
|
||||||
|
|
||||||
// remove all error classes first
|
|
||||||
removeErrors();
|
|
||||||
|
|
||||||
// display errors contextually
|
|
||||||
$.each(errors, function(field, msg) {
|
|
||||||
var formfield = $("[name='" + field + "']");
|
|
||||||
var label = $("label[data-field='" + field + "']");
|
|
||||||
var msgbox = $(".form-control-feedback[data-field='" + field + "']");
|
|
||||||
|
|
||||||
// add error classes to bad fields
|
|
||||||
formfield.addClass('form-control-danger');
|
|
||||||
label.addClass('has-danger');
|
|
||||||
msgbox.html(msg).addClass('has-danger').removeClass('hide');
|
|
||||||
|
|
||||||
// check if this field comes first in DOM
|
|
||||||
var domfield = formfield.get(0);
|
|
||||||
|
|
||||||
if (!firstfield || (firstfield && firstfield.compareDocumentPosition(domfield) === 2)) {
|
|
||||||
firstfield = domfield;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// focus on first bad field
|
|
||||||
firstfield.focus();
|
|
||||||
|
|
||||||
// scroll to above that field to make it visible
|
|
||||||
$('html, body').animate({
|
|
||||||
scrollTop: $(firstfield).offset().top - 200
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// remove all error classes
|
|
||||||
function removeErrors() {
|
|
||||||
$(".form-control-danger").removeClass('form-control-danger');
|
|
||||||
$("[data-field]").removeClass('has-danger');
|
|
||||||
$(".form-control-feedback[data-field]").addClass('hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -1,154 +0,0 @@
|
||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<!-- BEGIN: Subheader -->
|
|
||||||
<div class="m-subheader">
|
|
||||||
<div class="d-flex align-items-center">
|
|
||||||
<div class="mr-auto">
|
|
||||||
<h3 class="m-subheader__title">
|
|
||||||
Items
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- END: Subheader -->
|
|
||||||
<div class="m-content">
|
|
||||||
<!--Begin::Section-->
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xl-12">
|
|
||||||
<div class="m-portlet m-portlet--mobile">
|
|
||||||
<div class="m-portlet__body">
|
|
||||||
<div class="m-form m-form--label-align-right m--margin-top-20 m--margin-bottom-30">
|
|
||||||
<div class="row align-items-center">
|
|
||||||
<div class="col-xl-8 order-2 order-xl-1">
|
|
||||||
<div class="form-group m-form__group row align-items-center">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="m-input-icon m-input-icon--left">
|
|
||||||
<input type="text" class="form-control m-input m-input--solid" placeholder="Search..." id="data-rows-search">
|
|
||||||
<span class="m-input-icon__icon m-input-icon__icon--left">
|
|
||||||
<span><i class="la la-search"></i></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xl-4 order-1 order-xl-2 m--align-right">
|
|
||||||
<a href="{{ url('entity_add_form') }}" class="btn btn-focus m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
|
|
||||||
<span>
|
|
||||||
<i class="la la-industry"></i>
|
|
||||||
<span>New Item</span>
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
<div class="m-separator m-separator--dashed d-xl-none"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--begin: Datatable -->
|
|
||||||
<div id="data-rows"></div>
|
|
||||||
<!--end: Datatable -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block scripts %}
|
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
var options = {
|
|
||||||
data: {
|
|
||||||
type: 'remote',
|
|
||||||
source: {
|
|
||||||
read: {
|
|
||||||
url: '{{ url("entity_rows") }}',
|
|
||||||
method: 'POST'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
saveState: {
|
|
||||||
cookie: false,
|
|
||||||
webstorage: false
|
|
||||||
},
|
|
||||||
pageSize: 10,
|
|
||||||
serverPaging: true,
|
|
||||||
serverFiltering: true,
|
|
||||||
serverSorting: true
|
|
||||||
},
|
|
||||||
layout: {
|
|
||||||
scroll: true
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
field: 'id',
|
|
||||||
title: 'ID',
|
|
||||||
width: 30
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'item',
|
|
||||||
title: 'Name'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'price',
|
|
||||||
title: 'Price'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'description',
|
|
||||||
title: 'Description'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'Actions',
|
|
||||||
width: 110,
|
|
||||||
title: 'Actions',
|
|
||||||
sortable: false,
|
|
||||||
overflow: 'visible',
|
|
||||||
template: function (row, index, datatable) {
|
|
||||||
var actions = '';
|
|
||||||
|
|
||||||
if (row.meta.update_url != '') {
|
|
||||||
actions += '<a href="' + row.meta.update_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" data-id="' + row.name + '" title="Edit"><i class="la la-edit"></i></a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (row.meta.delete_url != '') {
|
|
||||||
actions += '<a href="' + row.meta.delete_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-danger m-btn--icon m-btn--icon-only m-btn--pill btn-delete" data-id="' + row.name + '" title="Delete"><i class="la la-trash"></i></a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return actions;
|
|
||||||
},
|
|
||||||
}
|
|
||||||
],
|
|
||||||
search: {
|
|
||||||
onEnter: false,
|
|
||||||
input: $('#data-rows-search'),
|
|
||||||
delay: 400
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var table = $("#data-rows").mDatatable(options);
|
|
||||||
|
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
|
||||||
var url = $(this).prop('href');
|
|
||||||
var id = $(this).data('id');
|
|
||||||
var btn = $(this);
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
swal({
|
|
||||||
title: 'Confirmation',
|
|
||||||
html: 'Are you sure you want to delete <strong>' + id + '</strong>?',
|
|
||||||
type: 'warning',
|
|
||||||
showCancelButton: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.value) {
|
|
||||||
$.ajax({
|
|
||||||
method: "DELETE",
|
|
||||||
url: url
|
|
||||||
}).done(function(response) {
|
|
||||||
table.row(btn.parents('tr')).remove();
|
|
||||||
table.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -10,5 +10,133 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- END: Subheader -->
|
<!-- END: Subheader -->
|
||||||
|
<div class="m-content">
|
||||||
|
<!--Begin::Section-->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<div class="m-portlet m-portlet--mobile">
|
||||||
|
<div class="m-portlet__head">
|
||||||
|
<div class="m-portlet__head-caption">
|
||||||
|
<div class="m-portlet__head-title">
|
||||||
|
<span class="m-portlet__head-icon">
|
||||||
|
<i class="la la-industry"></i>
|
||||||
|
</span>
|
||||||
|
<h3 class="m-portlet__head-text">
|
||||||
|
{% if mode == 'update' %}
|
||||||
|
Edit Item Type
|
||||||
|
<small>{{ obj.getName() }}</small>
|
||||||
|
{% else %}
|
||||||
|
New Item Type
|
||||||
|
{% endif %}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form id="row-form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ mode == 'update' ? url('item_type_update_submit', {'id': obj.getId()}) : url('item_type_add_submit') }}">
|
||||||
|
<div class="m-portlet__body">
|
||||||
|
<div class="form-group m-form__group row no-border">
|
||||||
|
<label class="col-lg-3 col-form-label" data-field="name">
|
||||||
|
Name:
|
||||||
|
</label>
|
||||||
|
<div class="col-lg-9">
|
||||||
|
<input type="text" name="name" class="form-control m-input" value="{{ obj.getName() }}">
|
||||||
|
<div class="form-control-feedback hide" data-field="name"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group m-form__group row no-border">
|
||||||
|
<label class="col-lg-3 col-form-label" data-field="code">
|
||||||
|
Code:
|
||||||
|
</label>
|
||||||
|
<div class="col-lg-9">
|
||||||
|
<input type="text" name="code" class="form-control m-input" value="{{ obj.getCode() }}">
|
||||||
|
<div class="form-control-feedback hide" data-field="code"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-portlet__foot m-portlet__foot--fit">
|
||||||
|
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<button type="submit" class="btn btn-success">Submit</button>
|
||||||
|
<a href="{{ url('item_type_list') }}" class="btn btn-secondary">Back</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$("#row-form").submit(function(e) {
|
||||||
|
var form = $(this);
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: form.prop('action'),
|
||||||
|
data: form.serialize()
|
||||||
|
}).done(function(response) {
|
||||||
|
// remove all error classes
|
||||||
|
removeErrors();
|
||||||
|
swal({
|
||||||
|
title: 'Done!',
|
||||||
|
text: 'Your changes have been saved!',
|
||||||
|
type: 'success',
|
||||||
|
onClose: function() {
|
||||||
|
window.location.href = "{{ url('item_type_list') }}";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).fail(function(response) {
|
||||||
|
if (response.status == 422) {
|
||||||
|
var errors = response.responseJSON.errors;
|
||||||
|
var firstfield = false;
|
||||||
|
|
||||||
|
// remove all error classes first
|
||||||
|
removeErrors();
|
||||||
|
|
||||||
|
// display errors contextually
|
||||||
|
$.each(errors, function(field, msg) {
|
||||||
|
var formfield = $("[name='" + field + "']");
|
||||||
|
var label = $("label[data-field='" + field + "']");
|
||||||
|
var msgbox = $(".form-control-feedback[data-field='" + field + "']");
|
||||||
|
|
||||||
|
// add error classes to bad fields
|
||||||
|
formfield.addClass('form-control-danger');
|
||||||
|
label.addClass('has-danger');
|
||||||
|
msgbox.html(msg).addClass('has-danger').removeClass('hide');
|
||||||
|
|
||||||
|
// check if this field comes first in DOM
|
||||||
|
var domfield = formfield.get(0);
|
||||||
|
|
||||||
|
if (!firstfield || (firstfield && firstfield.compareDocumentPosition(domfield) === 2)) {
|
||||||
|
firstfield = domfield;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// focus on first bad field
|
||||||
|
firstfield.focus();
|
||||||
|
|
||||||
|
// scroll to above that field to make it visible
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: $(firstfield).offset().top - 200
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// remove all error classes
|
||||||
|
function removeErrors() {
|
||||||
|
$(".form-control-danger").removeClass('form-control-danger');
|
||||||
|
$("[data-field]").removeClass('has-danger');
|
||||||
|
$(".form-control-feedback[data-field]").addClass('hide');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1207,6 +1207,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var invoiceItems = [];
|
var invoiceItems = [];
|
||||||
|
var hasCoolant = 0;
|
||||||
|
var hasSealant = 0;
|
||||||
|
|
||||||
// location search autocomplete
|
// location search autocomplete
|
||||||
var input = document.getElementById('m_gmap_address');
|
var input = document.getElementById('m_gmap_address');
|
||||||
|
|
@ -1270,6 +1272,19 @@ $(function() {
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
// need to check if jo has coolant or sealant
|
||||||
|
{% if obj.getServiceType == 'overheat' %}
|
||||||
|
{% if obj.hasCoolant == 1 %}
|
||||||
|
hasCoolant = 1;
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if obj.getServiceType == 'tire' %}
|
||||||
|
{% if obj.hasSealant == 1 %}
|
||||||
|
hasSealant = 1;
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1830,6 +1845,8 @@ $(function() {
|
||||||
'cvid': cvid,
|
'cvid': cvid,
|
||||||
'coord_lng': lng,
|
'coord_lng': lng,
|
||||||
'coord_lat': lat,
|
'coord_lat': lat,
|
||||||
|
'flag_coolant': hasCoolant,
|
||||||
|
'flag_sealant': hasSealant,
|
||||||
}
|
}
|
||||||
}).done(function(response) {
|
}).done(function(response) {
|
||||||
// mark as invoice changed
|
// mark as invoice changed
|
||||||
|
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Leaflet Map with Layers{% endblock %}
|
|
||||||
|
|
||||||
{% block stylesheets %}
|
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" />
|
|
||||||
<style>
|
|
||||||
#map {
|
|
||||||
height: 500px; /* You can adjust the height here */
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<h2>Leaflet Map</h2>
|
|
||||||
|
|
||||||
<div id="map" class="w-full h-96 mb-4"></div>
|
|
||||||
<div id="coordinates" class="text-gray-600 text-sm mt-4"></div>
|
|
||||||
|
|
||||||
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"></script>
|
|
||||||
<script>
|
|
||||||
// Base layers: Streets and Satellite
|
|
||||||
var streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
||||||
maxZoom: 19,
|
|
||||||
});
|
|
||||||
|
|
||||||
var satellite = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
|
||||||
maxZoom: 17,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initialize the map
|
|
||||||
var map = L.map('map', {
|
|
||||||
center: [14.5995, 120.9842], // Latitude, Longitude of Manila
|
|
||||||
zoom: 13,
|
|
||||||
layers: [streets] // Set default layer
|
|
||||||
});
|
|
||||||
|
|
||||||
// Base layers for diff map sets
|
|
||||||
var baseMaps = {
|
|
||||||
"Streets": streets,
|
|
||||||
"Satellite": satellite
|
|
||||||
};
|
|
||||||
|
|
||||||
// Switch between base layers
|
|
||||||
L.control.layers(baseMaps).addTo(map);
|
|
||||||
|
|
||||||
// Add markers for cities
|
|
||||||
var manilaMarker = L.marker([14.5995, 120.9842]).addTo(map)
|
|
||||||
.bindPopup("<b>Manila</b><br>Capital of the Philippines").openPopup();
|
|
||||||
|
|
||||||
var sanJuanMarker = L.marker([14.6042, 121.0293]).addTo(map)
|
|
||||||
.bindPopup("<b>San Juan City</b><br>Known for historical sites.");
|
|
||||||
|
|
||||||
var quezonMarker = L.marker([14.6760, 121.0437]).addTo(map)
|
|
||||||
.bindPopup("<b>Quezon City</b><br>Largest city in Metro Manila.");
|
|
||||||
|
|
||||||
// Add click event listener for adding new markers
|
|
||||||
map.on('click', function(e) {
|
|
||||||
var lat = e.latlng.lat; // Get latitude
|
|
||||||
var lng = e.latlng.lng; // Get longitude
|
|
||||||
|
|
||||||
// Create a new marker
|
|
||||||
var newMarker = L.marker([lat, lng]).addTo(map);
|
|
||||||
|
|
||||||
// Create a delete button inside the popup
|
|
||||||
var deleteButton = `<button onclick="deleteMarker(${lat}, ${lng})"
|
|
||||||
style='background-color: red; color: white; padding: 5px;'>Delete Marker</button>`;
|
|
||||||
|
|
||||||
// Add a popup to the marker with the "Save Marker" and "Delete" button
|
|
||||||
newMarker.bindPopup("<b>Save Marker</b><br>" + deleteButton).openPopup();
|
|
||||||
|
|
||||||
// Update the coordinates in the div
|
|
||||||
document.getElementById('coordinates').innerHTML =
|
|
||||||
'Coordinates: Latitude ' + lat + ', Longitude ' + lng;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to delete marker based on lat/lng
|
|
||||||
function deleteMarker(lat, lng) {
|
|
||||||
map.eachLayer(function (layer) {
|
|
||||||
if (layer instanceof L.Marker) {
|
|
||||||
if (layer.getLatLng().lat === lat && layer.getLatLng().lng === lng) {
|
|
||||||
map.removeLayer(layer); // Remove the marker
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
1
utils/service_offering/insert_sealant_fee.sql
Normal file
1
utils/service_offering/insert_sealant_fee.sql
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
INSERT INTO service_offering (name, code, fee) VALUES ('Tire Sealant Fee', 'tire_sealant_fee', '200.00');
|
||||||
Loading…
Reference in a new issue