Merge branch 'master' of gitlab.com:jankstudio/resq into 686-move-apicontroller-methods-into-capi
Conflicts: src/Ramcar/TransactionOrigin.php
This commit is contained in:
commit
35d6e34128
27 changed files with 947 additions and 113 deletions
|
|
@ -568,3 +568,17 @@ access_keys:
|
|||
label: Update
|
||||
- id: emergency_type.delete
|
||||
label: Delete
|
||||
|
||||
- id: ownership_type
|
||||
label: Ownership Type Access
|
||||
acls:
|
||||
- id: ownership_type.menu
|
||||
label: Menu
|
||||
- id: ownership_type.list
|
||||
label: List
|
||||
- id: ownership_type.add
|
||||
label: Add
|
||||
- id: ownership_type.update
|
||||
label: Update
|
||||
- id: ownership_type.delete
|
||||
label: Delete
|
||||
|
|
|
|||
|
|
@ -245,3 +245,7 @@ main_menu:
|
|||
acl: emergency_type.menu
|
||||
label: Emergency Types
|
||||
parent: database
|
||||
- id: ownership_type_list
|
||||
acl: ownership_type.menu
|
||||
label: Ownership Types
|
||||
parent: database
|
||||
|
|
|
|||
35
config/routes/ownership_type.yaml
Normal file
35
config/routes/ownership_type.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
ownership_type_list:
|
||||
path: /ownership-types
|
||||
controller: App\Controller\OwnershipTypeController::index
|
||||
methods: [GET]
|
||||
|
||||
ownership_type_rows:
|
||||
path: /ownership-types/rowdata
|
||||
controller: App\Controller\OwnershipTypeController::datatableRows
|
||||
methods: [POST]
|
||||
|
||||
ownership_type_add_form:
|
||||
path: /ownership-types/newform
|
||||
controller: App\Controller\OwnershipTypeController::addForm
|
||||
methods: [GET]
|
||||
|
||||
ownership_type_add_submit:
|
||||
path: /ownership-types
|
||||
controller: App\Controller\OwnershipTypeController::addSubmit
|
||||
methods: [POST]
|
||||
|
||||
ownership_type_update_form:
|
||||
path: /ownership-types/{id}
|
||||
controller: App\Controller\OwnershipTypeController::updateForm
|
||||
methods: [GET]
|
||||
|
||||
ownership_type_update_submit:
|
||||
path: /ownership-types/{id}
|
||||
controller: App\Controller\OwnershipTypeController::updateSubmit
|
||||
methods: [POST]
|
||||
|
||||
ownership_type_delete:
|
||||
path: /ownership-types/{id}
|
||||
controller: App\Controller\OwnershipTypeController::deleteSubmit
|
||||
methods: [DELETE]
|
||||
|
||||
|
|
@ -902,7 +902,7 @@ class APIController extends Controller implements LoggedController
|
|||
{
|
||||
// TODO: put geofence error message in config file somewhere
|
||||
$res->setError(true)
|
||||
->setErrorMessage('Oops! Our service is limited to some areas in Metro Manila, Laguna, and Baguio only. We will update you as soon as we are able to cover your area');
|
||||
->setErrorMessage($this->getGeoErrorMessage());
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
|
||||
|
|
@ -2308,7 +2308,7 @@ class APIController extends Controller implements LoggedController
|
|||
if (!$is_covered)
|
||||
{
|
||||
$res->setError(true)
|
||||
->setErrorMessage('Oops! Our service is limited to some areas in Metro Manila, Laguna, and Baguio only. We will update you as soon as we are able to cover your area');
|
||||
->setErrorMessage($this->getGeoErrorMessage());
|
||||
}
|
||||
|
||||
return $res->getReturnResponse();
|
||||
|
|
@ -2769,7 +2769,7 @@ class APIController extends Controller implements LoggedController
|
|||
{
|
||||
// TODO: put geofence error message in config file somewhere
|
||||
$res->setError(true)
|
||||
->setErrorMessage('Oops! Our service is limited to some areas in Metro Manila, Laguna, and Baguio only. We will update you as soon as we are able to cover your area');
|
||||
->setErrorMessage($this->getGeoErrorMessage());
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
|
||||
|
|
@ -4033,12 +4033,20 @@ class APIController extends Controller implements LoggedController
|
|||
$warr->setVehicle($vehicle);
|
||||
}
|
||||
|
||||
// TODO: make a standard clean plate number service
|
||||
// clean plate number
|
||||
$plate = $req->request->get('plate_number');
|
||||
// upper case and remove spaces
|
||||
$plate = strtoupper(str_replace(' ', '', $plate));
|
||||
// remove special characters
|
||||
$plate = preg_replace('/[^A-Za-z0-9. -]/', '', $plate);
|
||||
|
||||
// create or update warranty entry
|
||||
$warr->setSerial($serial)
|
||||
->setFirstName($req->request->get('first_name'))
|
||||
->setLastName($req->request->get('last_name'))
|
||||
->setEmail($req->request->get('email'))
|
||||
->setPlateNumber($req->request->get('plate_number'))
|
||||
->setPlateNumber($plate)
|
||||
// TODO: figure out how to compute date of purchase
|
||||
->setDatePurchase($date_pur)
|
||||
// TODO: set status
|
||||
|
|
@ -4700,4 +4708,8 @@ class APIController extends Controller implements LoggedController
|
|||
{
|
||||
return trim(strtolower($string));
|
||||
}
|
||||
|
||||
protected function getGeoErrorMessage() {
|
||||
return 'Oops! Our service is limited to some areas in Metro Manila, Laguna, Cavite, Pampanga and Baguio only. We will update you as soon as we are able to cover your area';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
255
src/Controller/OwnershipTypeController.php
Normal file
255
src/Controller/OwnershipTypeController.php
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\OwnershipType;
|
||||
|
||||
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 Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
class OwnershipTypeController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Menu(selected="ownership_type_list")
|
||||
* @IsGranted("ownership_type.list")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ownership_type.list', null, 'No access.');
|
||||
|
||||
return $this->render('ownership-type/list.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @IsGranted("ownership_type.list")
|
||||
*/
|
||||
public function datatableRows(Request $req)
|
||||
{
|
||||
// get query builder
|
||||
$qb = $this->getDoctrine()
|
||||
->getRepository(OwnershipType::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['name'] = $orow->getName();
|
||||
|
||||
// add row metadata
|
||||
$row['meta'] = [
|
||||
'update_url' => '',
|
||||
'delete_url' => ''
|
||||
];
|
||||
|
||||
// add crud urls
|
||||
if ($this->isGranted('ownership_type.update'))
|
||||
$row['meta']['update_url'] = $this->generateUrl('ownership_type_update_form', ['id' => $row['id']]);
|
||||
if ($this->isGranted('ownership_type.delete'))
|
||||
$row['meta']['delete_url'] = $this->generateUrl('ownership_type_delete', ['id' => $row['id']]);
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
// response
|
||||
return $this->json([
|
||||
'meta' => $meta,
|
||||
'data' => $rows
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="ownership_type.list")
|
||||
* @IsGranted("ownership_type.add")
|
||||
*/
|
||||
public function addForm()
|
||||
{
|
||||
$ownership_type = new OwnershipType();
|
||||
$params = [
|
||||
'ownership_type' => $ownership_type,
|
||||
'mode' => 'create',
|
||||
];
|
||||
|
||||
// response
|
||||
return $this->render('ownership-type/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @IsGranted("ownership_type.add")
|
||||
*/
|
||||
public function addSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator)
|
||||
{
|
||||
$ownership_type = new OwnershipType();
|
||||
|
||||
$this->setObject($ownership_type, $req);
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($ownership_type);
|
||||
|
||||
// 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($ownership_type);
|
||||
$em->flush();
|
||||
|
||||
// return successful response
|
||||
return $this->json([
|
||||
'success' => 'Changes have been saved!'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="ownership_type_list")
|
||||
* @ParamConverter("ownership_type", class="App\Entity\OwnershipType")
|
||||
* @IsGranted("ownership_type.update")
|
||||
*/
|
||||
public function updateForm($id, EntityManagerInterface $em, OwnershipType $ownership_type)
|
||||
{
|
||||
$params = [];
|
||||
$params['ownership_type'] = $ownership_type;
|
||||
$params['mode'] = 'update';
|
||||
|
||||
// response
|
||||
return $this->render('ownership-type/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ParamConverter("ownership_type", class="App\Entity\OwnershipType")
|
||||
* @IsGranted("ownership_type.update")
|
||||
*/
|
||||
public function updateSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator, OwnershipType $ownership_type)
|
||||
{
|
||||
$this->setObject($ownership_type, $req);
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($ownership_type);
|
||||
|
||||
// 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();
|
||||
|
||||
// return successful response
|
||||
return $this->json([
|
||||
'success' => 'Changes have been saved!'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ParamConverter("ownership_type", class="App\Entity\OwnershipType")
|
||||
* @IsGranted("ownership_type.update")
|
||||
*/
|
||||
public function deleteSubmit(EntityManagerInterface $em, OwnershipType $ownership_type)
|
||||
{
|
||||
// delete this object
|
||||
$em->remove($ownership_type);
|
||||
$em->flush();
|
||||
|
||||
// response
|
||||
$response = new Response();
|
||||
$response->setStatusCode(Response::HTTP_OK);
|
||||
$response->send();
|
||||
}
|
||||
|
||||
|
||||
protected function setObject(OwnershipType $obj, Request $req)
|
||||
{
|
||||
// set and save values
|
||||
$obj->setName($req->request->get('name'))
|
||||
->setCode($req->request->get('code'));
|
||||
}
|
||||
|
||||
protected function setQueryFilters($datatable, QueryBuilder $query)
|
||||
{
|
||||
if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) {
|
||||
$query->where('q.name LIKE :filter')
|
||||
->setParameter('filter', '%' . $datatable['query']['data-rows-search'] . '%');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -251,6 +251,9 @@ class TicketController extends Controller
|
|||
$ttype_id = $req->request->get('new_ticket_type');
|
||||
$sub_ttype_id = $req->request->get('sub_ticket_type');
|
||||
|
||||
// get other description if any
|
||||
$other_desc = $req->request->get('other_desc');
|
||||
|
||||
// get source of awareness if any
|
||||
$soa_type = $req->request->get('source_of_awareness');
|
||||
|
||||
|
|
@ -269,7 +272,8 @@ class TicketController extends Controller
|
|||
->setDateCreate(new DateTime())
|
||||
->setCreatedBy($this->getUser())
|
||||
->setSourceOfAwareness($soa_type)
|
||||
->setRemarks($remarks);
|
||||
->setRemarks($remarks)
|
||||
->setOtherDescription($other_desc);
|
||||
|
||||
// if assigned to customer, set association
|
||||
if ($customer_id) {
|
||||
|
|
@ -458,6 +462,9 @@ class TicketController extends Controller
|
|||
$ttype_id = $req->request->get('new_ticket_type');
|
||||
$sub_ttype_id = $req->request->get('sub_ticket_type');
|
||||
|
||||
// get other description if any
|
||||
$other_desc = $req->request->get('other_desc');
|
||||
|
||||
// get source of awareness if any
|
||||
$soa_type = $req->request->get('source_of_awareness');
|
||||
|
||||
|
|
@ -474,7 +481,8 @@ class TicketController extends Controller
|
|||
->setDetails($req->request->get('details'))
|
||||
->setPlateNumber($req->request->get('plate_number'))
|
||||
->setSourceOfAwareness($soa_type)
|
||||
->setRemarks($remarks);
|
||||
->setRemarks($remarks)
|
||||
->setOtherDescription($other_desc);
|
||||
|
||||
// initialize error list
|
||||
$error_array = [];
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class JobOrder
|
|||
|
||||
// where requested job order came from (transaction origin)
|
||||
/**
|
||||
* @ORM\Column(type="string", length=15)
|
||||
* @ORM\Column(type="string", length=30)
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
|
|
@ -415,6 +415,13 @@ class JobOrder
|
|||
*/
|
||||
protected $emergency_type;
|
||||
|
||||
// new ownership type
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="OwnershipType", inversedBy="job_orders")
|
||||
* @ORM\JoinColumn(name="ownership_type_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
protected $ownership_type;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -1182,4 +1189,14 @@ class JobOrder
|
|||
return $this->emergency_type;
|
||||
}
|
||||
|
||||
public function setOwnershipType(OwnershipType $ownership_type = null)
|
||||
{
|
||||
$this->ownership_type = $ownership_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOwnershipType()
|
||||
{
|
||||
return $this->ownership_type;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
63
src/Entity/OwnershipType.php
Normal file
63
src/Entity/OwnershipType.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="ownership_type", indexes={
|
||||
* @ORM\Index(name="ownership_type_idx", columns={"code"}),
|
||||
* })
|
||||
*/
|
||||
class OwnershipType
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=25)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $code;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=25)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setCode($code)
|
||||
{
|
||||
$this->code = $code;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCode()
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
}
|
||||
|
|
@ -133,6 +133,12 @@ class Ticket
|
|||
*/
|
||||
protected $subticket_type;
|
||||
|
||||
// text field for Other subticket type
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
protected $other_description;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -337,4 +343,15 @@ class Ticket
|
|||
{
|
||||
return $this->subticket_type;
|
||||
}
|
||||
|
||||
public function setOtherDescription($other_description)
|
||||
{
|
||||
$this->other_description = $other_description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOtherDescription()
|
||||
{
|
||||
return $this->other_description;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class ModeOfPayment extends NameValue
|
|||
const DEBIT_CARD = 'debit_card';
|
||||
const INSTALLMENT = 'installment';
|
||||
const GCASH = 'gcash';
|
||||
const CREDIT_CARD_AMEX = 'credit_card_amex';
|
||||
|
||||
const COLLECTION = [
|
||||
'cash' => 'Cash',
|
||||
|
|
@ -16,5 +17,6 @@ class ModeOfPayment extends NameValue
|
|||
'debit_card' => 'Debit Card',
|
||||
'installment' => 'Installment - BDO',
|
||||
'gcash' => 'GCash',
|
||||
'credit_card_amex' => 'Credit Card - AMEX',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,13 @@ class TransactionOrigin extends NameValue
|
|||
const WALK_IN = 'walk_in';
|
||||
const LAZADA = 'lazada';
|
||||
const THIRD_PARTY = 'third_party';
|
||||
const YOKOHAMA_OP_FACEBOOK = 'yokohama_op_facebook';
|
||||
const YOKOHAMA_TWITTER = 'yokohama_twitter';
|
||||
const YOKOHAMA_INSTAGRAM = 'yokohama_instagram';
|
||||
const YOKOHAMA_CAROUSELL = 'yokohama_carousell';
|
||||
|
||||
// TODO: for now, resq also gets the walk-in option
|
||||
// resq also gets new YOKOHAMA options
|
||||
const COLLECTION = [
|
||||
'call' => 'Hotline',
|
||||
'online' => 'Online',
|
||||
|
|
@ -23,5 +28,9 @@ class TransactionOrigin extends NameValue
|
|||
'walk_in' => 'Walk-in',
|
||||
'lazada' => 'Lazada',
|
||||
'third_party' => 'Third Party',
|
||||
'yokohama_op_facebook' => 'Yokohama OP Facebook',
|
||||
'yokohama_twitter' => 'Yokohama Twitter',
|
||||
'yokohama_instagram' => 'Yokohama Instagram',
|
||||
'yokohama_carousell' => 'Yokohama Carousell',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
|
|||
const WARRANTY_FEE = 0;
|
||||
const OTHER_SERVICES_FEE = 200;
|
||||
const COOLANT_FEE = 1600;
|
||||
const REFUEL_FEE_GAS = 380;
|
||||
const REFUEL_FEE_DIESEL = 360;
|
||||
const REFUEL_FEE_GAS = 340; // for 4 liters
|
||||
const REFUEL_FEE_DIESEL = 360; // for 4 liters
|
||||
|
||||
private $security;
|
||||
protected $em;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use App\Entity\Warranty;
|
|||
use App\Entity\Customer;
|
||||
use App\Entity\CustomerTag;
|
||||
use App\Entity\EmergencyType;
|
||||
use App\Entity\OwnershipType;
|
||||
|
||||
use App\Ramcar\InvoiceCriteria;
|
||||
use App\Ramcar\ServiceType;
|
||||
|
|
@ -445,6 +446,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$etype_id = $req->request->get('emergency_type', 0);
|
||||
$etype = $em->getRepository(EmergencyType::class)->find($etype_id);
|
||||
|
||||
// get ownership type if any
|
||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// TODO: check status before saving since JO might already
|
||||
// have a status that needs to be retained
|
||||
|
||||
|
|
@ -483,7 +488,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setInitialConcernNotes($initial_concern_notes)
|
||||
->setCallerClassification($caller_class)
|
||||
->setGender($gender)
|
||||
->setEmergencyType($etype);
|
||||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type);
|
||||
|
||||
// check if user is null, meaning call to create came from API
|
||||
if ($user != null)
|
||||
|
|
@ -700,6 +706,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$etype_id = $req->request->get('emergency_type', 0);
|
||||
$etype = $em->getRepository(EmergencyType::class)->find($etype_id);
|
||||
|
||||
// get ownership type if any
|
||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
if (empty($error_array))
|
||||
{
|
||||
// get current user
|
||||
|
|
@ -733,7 +743,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setInitialConcernNotes($initial_concern_notes)
|
||||
->setCallerClassification($caller_class)
|
||||
->setGender($gender)
|
||||
->setEmergencyType($etype);
|
||||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type);
|
||||
|
||||
// did they change invoice?
|
||||
$invoice_items = $req->request->get('invoice_items', []);
|
||||
|
|
@ -901,6 +912,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$etype_id = $req->request->get('emergency_type', 0);
|
||||
$etype = $em->getRepository(EmergencyType::class)->find($etype_id);
|
||||
|
||||
// get ownership type if any
|
||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
if (empty($error_array))
|
||||
{
|
||||
// coordinates
|
||||
|
|
@ -931,7 +946,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setInitialConcernNotes($initial_concern_notes)
|
||||
->setGender($gender)
|
||||
->setCallerClassification($caller_class)
|
||||
->setEmergencyType($etype);
|
||||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type);
|
||||
|
||||
// validate
|
||||
$errors = $this->validator->validate($obj);
|
||||
|
|
@ -1045,6 +1061,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$etype_id = $req->request->get('emergency_type', 0);
|
||||
$etype = $em->getRepository(EmergencyType::class)->find($etype_id);
|
||||
|
||||
// get ownership type if any
|
||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// get current user
|
||||
$user = $this->security->getUser();
|
||||
|
||||
|
|
@ -1077,7 +1097,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setInitialConcernNotes($initial_concern_notes)
|
||||
->setCallerClassification($caller_class)
|
||||
->setGender($gender)
|
||||
->setEmergencyType($etype);
|
||||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type);
|
||||
|
||||
if ($user != null)
|
||||
{
|
||||
|
|
@ -1180,6 +1201,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$etype_id = $req->request->get('emergency_type', 0);
|
||||
$etype = $em->getRepository(EmergencyType::class)->find($etype_id);
|
||||
|
||||
// get ownership type if any
|
||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
if (empty($error_array)) {
|
||||
// coordinates
|
||||
$point = new Point($req->request->get('coord_lng'), $req->request->get('coord_lat'));
|
||||
|
|
@ -1206,7 +1231,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setInitialConcernNotes($initial_concern_notes)
|
||||
->setGender($gender)
|
||||
->setCallerClassification($caller_class)
|
||||
->setEmergencyType($etype);
|
||||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type);
|
||||
|
||||
// validate
|
||||
$errors = $this->validator->validate($obj);
|
||||
|
|
@ -1429,6 +1455,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$etype_id = $req->request->get('emergency_type', 0);
|
||||
$etype = $em->getRepository(EmergencyType::class)->find($etype_id);
|
||||
|
||||
// get ownership type if any
|
||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// get previously assigned hub, if any
|
||||
$old_hub = $obj->getHub();
|
||||
|
||||
|
|
@ -1486,6 +1516,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setGender($gender)
|
||||
->setCallerClassification($caller_class)
|
||||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type)
|
||||
->clearRider();
|
||||
|
||||
if ($user != null)
|
||||
|
|
@ -1704,6 +1735,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$etype_id = $req->request->get('emergency_type', 0);
|
||||
$etype = $em->getRepository(EmergencyType::class)->find($etype_id);
|
||||
|
||||
// get ownership type if any
|
||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
if (empty($error_array)) {
|
||||
// rider mqtt event
|
||||
// NOTE: need to send this before saving because rider will be cleared
|
||||
|
|
@ -1755,7 +1790,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setInitialConcernNotes($initial_concern_notes)
|
||||
->setGender($gender)
|
||||
->setCallerClassification($caller_class)
|
||||
->setEmergencyType($etype);
|
||||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type);
|
||||
|
||||
if ($user != null)
|
||||
{
|
||||
|
|
@ -2425,13 +2461,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$mres = $motiv->getInventory($branch_codes, $skus);
|
||||
foreach ($mres as $mres_item)
|
||||
{
|
||||
$bcode = $mres_item['BranchCode'];
|
||||
$inv_count = $mres_item['Quantity'];
|
||||
if (isset($inv_data[$bcode]))
|
||||
// check if we have a valid response from motiv, ignore otherwise
|
||||
if (isset($mres_item['BranchCode']))
|
||||
{
|
||||
$hub_id = $inv_data[$bcode]['hub_id'];
|
||||
$bcode = $mres_item['BranchCode'];
|
||||
$inv_count = $mres_item['Quantity'];
|
||||
if (isset($inv_data[$bcode]))
|
||||
{
|
||||
$hub_id = $inv_data[$bcode]['hub_id'];
|
||||
|
||||
$params['hubs'][$hub_id]['inventory'] = $inv_count;
|
||||
$params['hubs'][$hub_id]['inventory'] = $inv_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2728,13 +2768,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$mres = $motiv->getInventory($branch_codes, $skus);
|
||||
foreach ($mres as $mres_item)
|
||||
{
|
||||
$bcode = $mres_item['BranchCode'];
|
||||
$inv_count = $mres_item['Quantity'];
|
||||
if (isset($inv_data[$bcode]))
|
||||
// check if we have a valid response from motiv, ignore otherwise
|
||||
if (isset($mres_item['BranchCode']))
|
||||
{
|
||||
$hub_id = $inv_data[$bcode]['hub_id'];
|
||||
$bcode = $mres_item['BranchCode'];
|
||||
$inv_count = $mres_item['Quantity'];
|
||||
if (isset($inv_data[$bcode]))
|
||||
{
|
||||
$hub_id = $inv_data[$bcode]['hub_id'];
|
||||
|
||||
$params['hubs'][$hub_id]['inventory'] = $inv_count;
|
||||
$params['hubs'][$hub_id]['inventory'] = $inv_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3246,6 +3290,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
}
|
||||
$params['emergency_types'] = $emergency_types;
|
||||
|
||||
// list of ownership types
|
||||
$owner_types = $em->getRepository(OwnershipType::class)->findBy([]);
|
||||
$ownership_types = [];
|
||||
foreach ($owner_types as $ownership_type)
|
||||
{
|
||||
$ownership_types[$ownership_type->getID()] = $ownership_type->getName();
|
||||
}
|
||||
$params['ownership_types'] = $ownership_types;
|
||||
|
||||
// list of hubs
|
||||
$hubs = $em->getRepository(Hub::class)->findBy([], ['name' => 'ASC']);
|
||||
$fac_hubs = [];
|
||||
|
|
|
|||
|
|
@ -32,7 +32,13 @@ class MotivConnector
|
|||
|
||||
$res = $this->curlPost('InventoryService', $body_text);
|
||||
|
||||
return json_decode($res, true);
|
||||
$inv_res = json_decode($res, true);
|
||||
|
||||
// check result
|
||||
if ($inv_res == null)
|
||||
return [];
|
||||
|
||||
return $inv_res;
|
||||
}
|
||||
|
||||
protected function curlPost($url, $body)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use App\Entity\CustomerVehicle;
|
|||
use App\Service\WarrantyAPILogger;
|
||||
|
||||
use App\Ramcar\WarrantyClass;
|
||||
use App\Ramcar\WarrantyStatus;
|
||||
|
||||
use DateTime;
|
||||
use DateInterval;
|
||||
|
|
@ -33,12 +34,10 @@ class WarrantyHandler
|
|||
$batt_list, DateTime $date_purchase, $warranty_class, $user_id,
|
||||
$source, $customer, $cust_vehicle)
|
||||
{
|
||||
$bmodel_id = '';
|
||||
$bsize_id = '';
|
||||
$bmodel_name = '';
|
||||
$bsize_name ='';
|
||||
$sap_batt_id = '';
|
||||
$w_serial = null;
|
||||
$bty_model = null;
|
||||
$bty_size = null;
|
||||
$sap_batt = null;
|
||||
$w_serial = '';
|
||||
|
||||
foreach ($batt_list as $battery)
|
||||
{
|
||||
|
|
@ -61,20 +60,7 @@ class WarrantyHandler
|
|||
if (!empty($sap_code))
|
||||
{
|
||||
// find sap battery
|
||||
/*
|
||||
$conn = $this->em->getConnection();
|
||||
$sql = 'SELECT sap.id FROM sap_battery sap WHERE sap.id = :id';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array('id' => $sap_code));
|
||||
|
||||
$query_results = $stmt->fetchAll();
|
||||
|
||||
foreach($query_results as $row)
|
||||
{
|
||||
$sap_batt_id = $row['id'];
|
||||
}
|
||||
*/
|
||||
$sap_batt_id = $sap_code;
|
||||
$sap_batt = $this->em->getRepository(SAPBattery::class)->find($sap_code);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -91,62 +77,31 @@ class WarrantyHandler
|
|||
if (trim($serial) != '')
|
||||
$w_serial = $serial;
|
||||
|
||||
// insert warranty
|
||||
$q = $this->em->createQuery('INSERT App\Entity\Warranty w
|
||||
SET w.serial = :serial,
|
||||
w.plate_number = :plate_number,
|
||||
w.first_name = :first_name,
|
||||
w.last_name = :last_name,
|
||||
w.mobile_number = :mobile_number,
|
||||
w.date_purchase = :date_purchase,
|
||||
w.warranty_class = :warranty_class,
|
||||
w.create_source = :create_source,
|
||||
w.customer_id = :customer_id,
|
||||
w.vehicle_id = :vehicle_id,
|
||||
w.bty_model_id = :bmodel_id,
|
||||
w.bty_size_id = :bsize_id,
|
||||
w.sap_bty_id = :sap_batt_id,
|
||||
w.date_expire = :date_expire')
|
||||
->setParameters([
|
||||
'serial' => $serial,
|
||||
'plate_number' => $plate_number,
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'mobile_number' => $mobile_number,
|
||||
'date_purchase' => $date_purchase,
|
||||
'warranty_class' => $warranty_class,
|
||||
'create_source' => $source,
|
||||
'customer_id' => $customer->getID(),
|
||||
'vehicle_id' => $cust_vehicle->getID(),
|
||||
'bmodel_id' => $bmodel_id,
|
||||
'bsize_id' => $bsize_id,
|
||||
'sap_batt_id' => $sap_batt_id,
|
||||
'date_expire' => $date_expire]);
|
||||
$q->execute();
|
||||
$warranty = new Warranty();
|
||||
$warranty->setWarrantyClass($warranty_class)
|
||||
->setPlateNumber($plate_number)
|
||||
->setFirstName($first_name)
|
||||
->setLastName($last_name)
|
||||
->setMobileNumber($mobile_number)
|
||||
->setBatteryModel($bty_model)
|
||||
->setBatterySize($bty_size)
|
||||
->setSAPBattery($sap_batt)
|
||||
->setDatePurchase($date_purchase)
|
||||
->setCustomer($customer)
|
||||
->setVehicle($cust_vehicle)
|
||||
->setCreateSource($source);
|
||||
|
||||
// log warranty creation
|
||||
$action = 'create';
|
||||
$exp_date = '';
|
||||
// set serial
|
||||
if (!empty($w_serial))
|
||||
$warranty->setSerial($w_serial);
|
||||
|
||||
// set date expire
|
||||
if ($date_expire != null)
|
||||
$exp_date = $date_expire->format('d-M-y');
|
||||
$warranty->setDateExpire($date_expire);
|
||||
|
||||
$log_data = [
|
||||
'serial' => $serial,
|
||||
'warranty_class' => $warranty_class,
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'mobile_number' => $mobile_number,
|
||||
'date_purchase' => $date_purchase->format('d-M-y'),
|
||||
'date_expire' => $exp_date,
|
||||
'battery_model' => $bmodel_name,
|
||||
'battery_size' => $bsize_name,
|
||||
'sap_battery' => $sap_batt_id,
|
||||
'plate_number' => $plate_number,
|
||||
];
|
||||
//$this->logger->logWarrantyInfo($log_data, '', $user_id, $action, $source);
|
||||
$this->em->persist($warranty);
|
||||
$this->em->flush();
|
||||
|
||||
// update customer vehicle with warranty info
|
||||
//$this->updateCustomerVehicle($serial, $batt_list, $plate_number, $date_expire);
|
||||
}
|
||||
|
||||
public function updateCustomerVehicle($serial, $batteries, $plate_number, $date_expire)
|
||||
|
|
|
|||
|
|
@ -517,6 +517,22 @@
|
|||
</select>
|
||||
<div class="form-control-feedback hide" data-field="source_of_awareness"></div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label for="ownership_type" data-field="ownership_type"> Ownership Type </label>
|
||||
<select class="form-control m-input" id="ownership-type" name="ownership_type">
|
||||
<option value=""></option>
|
||||
{% for id, label in ownership_types %}
|
||||
{% if obj.getOwnershipType %}
|
||||
<option value="{{ id }}"{{ obj.getOwnershipType.getID == id ? ' selected' }}>{{ label }}</option>
|
||||
{% else %}
|
||||
<option value="{{ id }}">{{ label }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="ownership_type"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label for="remarks" data-field="remarks"> Remarks </label>
|
||||
<textarea class="form-control m-input" id="remarks" rows="6" name="remarks">{{ obj.getRemarks }}</textarea>
|
||||
|
|
|
|||
142
templates/ownership-type/form.html.twig
Normal file
142
templates/ownership-type/form.html.twig
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
{% 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">Ownership Types</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 Ownership Type
|
||||
<small>{{ ownership_type.getName() }}</small>
|
||||
{% else %}
|
||||
New Ownership 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('ownership_type_update_submit', {'id': ownership_type.getId()}) : url('ownership_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="code">
|
||||
Code:
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<input type="text" name="code" class="form-control m-input" value="{{ ownership_type.getCode() }}">
|
||||
<div class="form-control-feedback hide" data-field="code"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<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="{{ ownership_type.getName() }}">
|
||||
<div class="form-control-feedback hide" data-field="name"></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('ownership_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('ownership_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 %}
|
||||
146
templates/ownership-type/list.html.twig
Normal file
146
templates/ownership-type/list.html.twig
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
{% 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">
|
||||
Ownership Types
|
||||
</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('ownership_type_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 Ownership Type</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("ownership_type_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: 'name',
|
||||
title: 'Name'
|
||||
},
|
||||
{
|
||||
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 %}
|
||||
|
|
@ -93,6 +93,13 @@
|
|||
<div class="form-control-feedback hide" data-field="sub_ticket_type"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-12">
|
||||
<label for="other_desc" data-field="remarks"> Description </label>
|
||||
<textarea class="form-control m-input" id="other-desc" rows="4" name="other_desc">{{ obj.getOtherDescription }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="other_desc"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-4">
|
||||
<label data-field="first_name">First Name</label>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ DROP TABLE IF EXISTS `emergency_type`;
|
|||
CREATE TABLE `emergency_type` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
`code` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `emergency_type_idx` (`code`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
|
@ -35,7 +37,7 @@ CREATE TABLE `emergency_type` (
|
|||
|
||||
LOCK TABLES `emergency_type` WRITE;
|
||||
/*!40000 ALTER TABLE `emergency_type` DISABLE KEYS */;
|
||||
INSERT INTO `emergency_type` VALUES (1,'Emergency Situation Related to Vehicle Problem'),(2,'Avoiding Towing'),(3,'Road Obstruction'),(4,'Along the Road'),(5,'With Babies or Kids Inside the Car'),(6,'Senior Citizen'),(7,'Buying Medicine'),(8,'Going to Hospital'),(9,'Uniformed Officials');
|
||||
INSERT INTO `emergency_type` VALUES (1,'Emergency Situation Related to Vehicle Problem','emergency_situation_related_to_vehicle_problem'),(2,'Avoiding Towing','avoiding_towing'),(3,'Road Obstruction','road_obstruction'),(4,'Along the Road','along_the_road'),(5,'With Babies or Kids Inside the Car','with_babies_or_kids_inside_the_car'),(6,'Senior Citizen','senior_citizen'),(7,'Buying Medicine','buying_medicine'),(8,'Going to Hospital','going_to_hospital'),(9,'Uniformed Officials','uniformed_officials');
|
||||
/*!40000 ALTER TABLE `emergency_type` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
|
@ -48,4 +50,4 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2022-06-06 8:52:11
|
||||
-- Dump completed on 2022-06-10 8:31:30
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use MicrosoftAzure\Storage\Common\ServiceException;
|
|||
// $blob_url = 'https://popappshopprodstorage.blob.core.windows.net';
|
||||
$blob_url = 'https://motivstorageaccount.blob.core.windows.net';
|
||||
|
||||
$sas_token = 'sp=r&st=2022-06-16T04:09:13Z&se=2030-06-16T12:09:13Z&spr=https&sv=2021-06-08&sr=c&sig=x26qUFEMIqg4JgTCVHoDv%2FtTqCprjogEqtOsTpBjkWA%3D';
|
||||
$sas_token = 'sp=r&st=2022-08-30T03:39:37Z&se=2030-09-30T11:39:37Z&sv=2021-06-08&sr=c&sig=9eETL%2F%2B2mbOPtW%2Fa4dZBnC8s61NwJpPZu6tsJS7frmk%3D';
|
||||
|
||||
$conn_string = "BlobEndpoint=$blob_url;\nSharedAccessSignature=$sas_token";
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use Symfony\Component\Dotenv\Dotenv;
|
|||
$csv = fopen($argv[1], 'r');
|
||||
$output_file = $argv[2];
|
||||
|
||||
$output_fh = fopen($output_file, "w");
|
||||
$output_fh = fopen($output_file, "a");
|
||||
|
||||
if (!file_exists($argv[1]))
|
||||
{
|
||||
|
|
|
|||
53
utils/ownership_types/ownership_type.sql
Normal file
53
utils/ownership_types/ownership_type.sql
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
-- MySQL dump 10.19 Distrib 10.3.32-MariaDB, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: resq
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.3.32-MariaDB
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `ownership_type`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `ownership_type`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `ownership_type` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`code` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`name` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `ownership_type_idx` (`code`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `ownership_type`
|
||||
--
|
||||
|
||||
LOCK TABLES `ownership_type` WRITE;
|
||||
/*!40000 ALTER TABLE `ownership_type` DISABLE KEYS */;
|
||||
INSERT INTO `ownership_type` VALUES (1,'first','First'),(2,'second','Second'),(3,'not_determined','Not Determined');
|
||||
/*!40000 ALTER TABLE `ownership_type` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2022-08-16 8:04:30
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -28,7 +28,7 @@ CREATE TABLE `ticket_type` (
|
|||
`code` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `ticket_type_idx` (`code`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
|
|
@ -37,7 +37,7 @@ CREATE TABLE `ticket_type` (
|
|||
|
||||
LOCK TABLES `ticket_type` WRITE;
|
||||
/*!40000 ALTER TABLE `ticket_type` DISABLE KEYS */;
|
||||
INSERT INTO `ticket_type` VALUES (1,'Complaint','complaint'),(2,'Follow up','follow_up'),(3,'Inquiry','inquiry'),(4,'Others','others');
|
||||
INSERT INTO `ticket_type` VALUES (1,'Complaint','complaint'),(2,'Follow up','follow_up'),(3,'Inquiry','inquiry'),(4,'Others','others'),(5,'Yokohama OP Facebook','yokohama_op_facebook'),(6,'Yokohama Twitter','yokohama_twitter'),(7,'Yokohama Instagram','yokohama_instagram'),(8,'Yokohama Carousell','yokohama_carousell');
|
||||
/*!40000 ALTER TABLE `ticket_type` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
|
@ -50,4 +50,4 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2022-06-10 6:44:12
|
||||
-- Dump completed on 2022-08-12 10:25:41
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
proc_date=`date +%m-%d-%y`
|
||||
load_status_file="/tmp/warranty_load_status_$proc_date.txt"
|
||||
touch /tmp/warranty_download_serial.csv
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 04-01-22 /tmp/warranty_download_serial.csv 1
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 04-02-22 /tmp/warranty_download_serial.csv 0
|
||||
|
|
@ -77,5 +79,12 @@ touch /tmp/warranty_download_serial.csv
|
|||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-14-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-15-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-16-22 /tmp/warranty_download_serial.csv 0
|
||||
touch /tmp/warranty_load_status.txt
|
||||
/usr/bin/php /var/www/resq/utils/load_warranty_serial/bulk_load_serials.php /tmp/warranty_download_serial.csv /tmp/warranty_load_status.txt
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-17-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-18-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-19-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-20-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-21-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-22-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-23-22 /tmp/warranty_download_serial.csv 0
|
||||
touch $load_status_file
|
||||
/usr/bin/php /var/www/resq/utils/load_warranty_serial/bulk_load_serials.php /tmp/warranty_download_serial.csv $load_status_file
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
proc_date=`date +%m-%d-%y`
|
||||
load_status_file="/tmp/warranty_load_status_$proc_date.txt"
|
||||
touch /tmp/warranty_download_serial.csv
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 04-01-22 /tmp/warranty_download_serial.csv 1
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 04-02-22 /tmp/warranty_download_serial.csv 0
|
||||
|
|
@ -77,5 +79,12 @@ touch /tmp/warranty_download_serial.csv
|
|||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-14-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-15-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-16-22 /tmp/warranty_download_serial.csv 0
|
||||
touch /tmp/warranty_load_status.txt
|
||||
/usr/bin/php /var/www/resq/utils/load_warranty_serial/bulk_load_serials.php /tmp/warranty_download_serial.csv /tmp/warranty_load_status.txt
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-17-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-18-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-19-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-20-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-21-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-22-22 /tmp/warranty_download_serial.csv 0
|
||||
/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-23-22 /tmp/warranty_download_serial.csv 0
|
||||
touch $load_status_file
|
||||
/usr/bin/php /var/www/resq/utils/load_warranty_serial/bulk_load_serials.php /tmp/warranty_download_serial.csv $load_status_file
|
||||
|
|
|
|||
Loading…
Reference in a new issue