Merge branch '739-add-customer-location-to-jo' into 'master'
Resolve "Add customer location to JO" Closes #739 See merge request jankstudio/resq!854
This commit is contained in:
commit
e2498beca7
11 changed files with 860 additions and 6 deletions
|
|
@ -586,3 +586,17 @@ access_keys:
|
||||||
label: Update
|
label: Update
|
||||||
- id: ownership_type.delete
|
- id: ownership_type.delete
|
||||||
label: Delete
|
label: Delete
|
||||||
|
|
||||||
|
- id: customer_location
|
||||||
|
label: Customer Location Access
|
||||||
|
acls:
|
||||||
|
- id: cust_location.menu
|
||||||
|
label: Menu
|
||||||
|
- id: cust_location.list
|
||||||
|
label: List
|
||||||
|
- id: cust_location.add
|
||||||
|
label: Add
|
||||||
|
- id: cust_location.update
|
||||||
|
label: Update
|
||||||
|
- id: cust_location.delete
|
||||||
|
label: Delete
|
||||||
|
|
|
||||||
|
|
@ -249,3 +249,7 @@ main_menu:
|
||||||
acl: ownership_type.menu
|
acl: ownership_type.menu
|
||||||
label: Ownership Types
|
label: Ownership Types
|
||||||
parent: database
|
parent: database
|
||||||
|
- id: customer_location_list
|
||||||
|
acl: cust_location.menu
|
||||||
|
label: Customer Locations
|
||||||
|
parent: database
|
||||||
|
|
|
||||||
35
config/routes/customer_location.yaml
Normal file
35
config/routes/customer_location.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
customer_location_list:
|
||||||
|
path: /customer-locations
|
||||||
|
controller: App\Controller\CustomerLocationController::index
|
||||||
|
methods: [GET]
|
||||||
|
|
||||||
|
customer_location_rows:
|
||||||
|
path: /customer-locations/rowdata
|
||||||
|
controller: App\Controller\CustomerLocationController::datatableRows
|
||||||
|
methods: [POST]
|
||||||
|
|
||||||
|
customer_location_add_form:
|
||||||
|
path: /customer-locations/newform
|
||||||
|
controller: App\Controller\CustomerLocationController::addForm
|
||||||
|
methods: [GET]
|
||||||
|
|
||||||
|
customer_location_add_submit:
|
||||||
|
path: /customer-locations
|
||||||
|
controller: App\Controller\CustomerLocationController::addSubmit
|
||||||
|
methods: [POST]
|
||||||
|
|
||||||
|
customer_location_update_form:
|
||||||
|
path: /customer-locations/{id}
|
||||||
|
controller: App\Controller\CustomerLocationController::updateForm
|
||||||
|
methods: [GET]
|
||||||
|
|
||||||
|
customer_location_update_submit:
|
||||||
|
path: /customer-locations/{id}
|
||||||
|
controller: App\Controller\CustomerLocationController::updateSubmit
|
||||||
|
methods: [POST]
|
||||||
|
|
||||||
|
customer_location_delete:
|
||||||
|
path: /customer-locations/{id}
|
||||||
|
controller: App\Controller\CustomerLocationController::deleteSubmit
|
||||||
|
methods: [DELETE]
|
||||||
|
|
||||||
253
src/Controller/CustomerLocationController.php
Normal file
253
src/Controller/CustomerLocationController.php
Normal file
|
|
@ -0,0 +1,253 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\CustomerLocation;
|
||||||
|
|
||||||
|
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 CustomerLocationController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @Menu(selected="customer_location_list")
|
||||||
|
* @IsGranted("cust_location.list")
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return $this->render('customer-location/list.html.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @IsGranted("cust_location.list")
|
||||||
|
*/
|
||||||
|
public function datatableRows(Request $req)
|
||||||
|
{
|
||||||
|
// get query builder
|
||||||
|
$qb = $this->getDoctrine()
|
||||||
|
->getRepository(CustomerLocation::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('cust_location.update'))
|
||||||
|
$row['meta']['update_url'] = $this->generateUrl('customer_location_update_form', ['id' => $row['id']]);
|
||||||
|
if ($this->isGranted('cust_location.delete'))
|
||||||
|
$row['meta']['delete_url'] = $this->generateUrl('customer_location_delete', ['id' => $row['id']]);
|
||||||
|
|
||||||
|
$rows[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
// response
|
||||||
|
return $this->json([
|
||||||
|
'meta' => $meta,
|
||||||
|
'data' => $rows
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Menu(selected="customer_location.list")
|
||||||
|
* @IsGranted("cust_location.add")
|
||||||
|
*/
|
||||||
|
public function addForm()
|
||||||
|
{
|
||||||
|
$cust_location = new CustomerLocation();
|
||||||
|
$params = [
|
||||||
|
'cust_location' => $cust_location,
|
||||||
|
'mode' => 'create',
|
||||||
|
];
|
||||||
|
|
||||||
|
// response
|
||||||
|
return $this->render('customer-location/form.html.twig', $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @IsGranted("cust_location.add")
|
||||||
|
*/
|
||||||
|
public function addSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator)
|
||||||
|
{
|
||||||
|
$cust_location = new CustomerLocation();
|
||||||
|
|
||||||
|
$this->setObject($cust_location, $req);
|
||||||
|
|
||||||
|
// validate
|
||||||
|
$errors = $validator->validate($cust_location);
|
||||||
|
|
||||||
|
// 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($cust_location);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
// return successful response
|
||||||
|
return $this->json([
|
||||||
|
'success' => 'Changes have been saved!'
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Menu(selected="customer_location_list")
|
||||||
|
* @ParamConverter("cust_location", class="App\Entity\CustomerLocation")
|
||||||
|
* @IsGranted("cust_location.update")
|
||||||
|
*/
|
||||||
|
public function updateForm($id, EntityManagerInterface $em, CustomerLocation $cust_location)
|
||||||
|
{
|
||||||
|
$params = [];
|
||||||
|
$params['cust_location'] = $cust_location;
|
||||||
|
$params['mode'] = 'update';
|
||||||
|
|
||||||
|
// response
|
||||||
|
return $this->render('customer-location/form.html.twig', $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ParamConverter("cust_location", class="App\Entity\CustomerLocation")
|
||||||
|
* @IsGranted("cust_location.update")
|
||||||
|
*/
|
||||||
|
public function updateSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator, CustomerLocation $cust_location)
|
||||||
|
{
|
||||||
|
$this->setObject($cust_location, $req);
|
||||||
|
|
||||||
|
// validate
|
||||||
|
$errors = $validator->validate($cust_location);
|
||||||
|
|
||||||
|
// 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("cust_location", class="App\Entity\CustomerLocation")
|
||||||
|
* @IsGranted("cust_location.update")
|
||||||
|
*/
|
||||||
|
public function deleteSubmit(EntityManagerInterface $em, CustomerLocation $cust_location)
|
||||||
|
{
|
||||||
|
// delete this object
|
||||||
|
$em->remove($cust_location);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
// response
|
||||||
|
$response = new Response();
|
||||||
|
$response->setStatusCode(Response::HTTP_OK);
|
||||||
|
$response->send();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function setObject(CustomerLocation $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'] . '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
63
src/Entity/CustomerLocation.php
Normal file
63
src/Entity/CustomerLocation.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="customer_location", indexes={
|
||||||
|
* @ORM\Index(name="cust_location_idx", columns={"code"}),
|
||||||
|
* })
|
||||||
|
*/
|
||||||
|
class CustomerLocation
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -422,6 +422,13 @@ class JobOrder
|
||||||
*/
|
*/
|
||||||
protected $ownership_type;
|
protected $ownership_type;
|
||||||
|
|
||||||
|
// customer location
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="CustomerLocation", inversedBy="job_orders")
|
||||||
|
* @ORM\JoinColumn(name="cust_location_id", referencedColumnName="id", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $cust_location;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->date_create = new DateTime();
|
$this->date_create = new DateTime();
|
||||||
|
|
@ -1199,4 +1206,15 @@ class JobOrder
|
||||||
{
|
{
|
||||||
return $this->ownership_type;
|
return $this->ownership_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCustomerLocation(CustomerLocation $cust_location = null)
|
||||||
|
{
|
||||||
|
$this->cust_location = $cust_location;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCustomerLocation()
|
||||||
|
{
|
||||||
|
return $this->cust_location;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ use App\Entity\Customer;
|
||||||
use App\Entity\CustomerTag;
|
use App\Entity\CustomerTag;
|
||||||
use App\Entity\EmergencyType;
|
use App\Entity\EmergencyType;
|
||||||
use App\Entity\OwnershipType;
|
use App\Entity\OwnershipType;
|
||||||
|
use App\Entity\CustomerLocation;
|
||||||
|
|
||||||
use App\Ramcar\InvoiceCriteria;
|
use App\Ramcar\InvoiceCriteria;
|
||||||
use App\Ramcar\ServiceType;
|
use App\Ramcar\ServiceType;
|
||||||
|
|
@ -424,6 +425,19 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if customer location is set
|
||||||
|
$cust_location_id = $req->request->get('cust_location', 0);
|
||||||
|
if ($cust_location_id == 0)
|
||||||
|
$error_array['cust_location'] = 'Customer location is required.';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get customer location
|
||||||
|
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||||
|
|
||||||
|
if ($cust_location == null)
|
||||||
|
$error_array['cust_location'] = 'Invalid customer location';
|
||||||
|
}
|
||||||
|
|
||||||
// get source of awareness if any
|
// get source of awareness if any
|
||||||
$soa_type = $req->request->get('source_of_awareness', '');
|
$soa_type = $req->request->get('source_of_awareness', '');
|
||||||
|
|
||||||
|
|
@ -489,7 +503,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
->setCallerClassification($caller_class)
|
->setCallerClassification($caller_class)
|
||||||
->setGender($gender)
|
->setGender($gender)
|
||||||
->setEmergencyType($etype)
|
->setEmergencyType($etype)
|
||||||
->setOwnershipType($owner_type);
|
->setOwnershipType($owner_type)
|
||||||
|
->setCustomerLocation($cust_location);
|
||||||
|
|
||||||
// check if user is null, meaning call to create came from API
|
// check if user is null, meaning call to create came from API
|
||||||
if ($user != null)
|
if ($user != null)
|
||||||
|
|
@ -710,6 +725,19 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||||
|
|
||||||
|
// check if customer location is set
|
||||||
|
$cust_location_id = $req->request->get('cust_location', 0);
|
||||||
|
if ($cust_location_id == 0)
|
||||||
|
$error_array['cust_location'] = 'Customer location is required.';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get customer location
|
||||||
|
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||||
|
|
||||||
|
if ($cust_location == null)
|
||||||
|
$error_array['cust_location'] = 'Invalid customer location';
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($error_array))
|
if (empty($error_array))
|
||||||
{
|
{
|
||||||
// get current user
|
// get current user
|
||||||
|
|
@ -744,7 +772,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
->setCallerClassification($caller_class)
|
->setCallerClassification($caller_class)
|
||||||
->setGender($gender)
|
->setGender($gender)
|
||||||
->setEmergencyType($etype)
|
->setEmergencyType($etype)
|
||||||
->setOwnershipType($owner_type);
|
->setOwnershipType($owner_type)
|
||||||
|
->setCustomerLocation($cust_location);
|
||||||
|
|
||||||
// did they change invoice?
|
// did they change invoice?
|
||||||
$invoice_items = $req->request->get('invoice_items', []);
|
$invoice_items = $req->request->get('invoice_items', []);
|
||||||
|
|
@ -916,6 +945,19 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||||
|
|
||||||
|
// check if customer location is set
|
||||||
|
$cust_location_id = $req->request->get('cust_location', 0);
|
||||||
|
if ($cust_location_id == 0)
|
||||||
|
$error_array['cust_location'] = 'Customer location is required.';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get customer location
|
||||||
|
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||||
|
|
||||||
|
if ($cust_location == null)
|
||||||
|
$error_array['cust_location'] = 'Invalid customer location';
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($error_array))
|
if (empty($error_array))
|
||||||
{
|
{
|
||||||
// coordinates
|
// coordinates
|
||||||
|
|
@ -947,7 +989,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
->setGender($gender)
|
->setGender($gender)
|
||||||
->setCallerClassification($caller_class)
|
->setCallerClassification($caller_class)
|
||||||
->setEmergencyType($etype)
|
->setEmergencyType($etype)
|
||||||
->setOwnershipType($owner_type);
|
->setOwnershipType($owner_type)
|
||||||
|
->setCustomerLocation($cust_location);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
$errors = $this->validator->validate($obj);
|
$errors = $this->validator->validate($obj);
|
||||||
|
|
@ -1065,6 +1108,19 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||||
|
|
||||||
|
// check if customer location is set
|
||||||
|
$cust_location_id = $req->request->get('cust_location', 0);
|
||||||
|
if ($cust_location_id == 0)
|
||||||
|
$error_array['cust_location'] = 'Customer location is required.';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get customer location
|
||||||
|
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||||
|
|
||||||
|
if ($cust_location == null)
|
||||||
|
$error_array['cust_location'] = 'Invalid customer location';
|
||||||
|
}
|
||||||
|
|
||||||
// get current user
|
// get current user
|
||||||
$user = $this->security->getUser();
|
$user = $this->security->getUser();
|
||||||
|
|
||||||
|
|
@ -1098,7 +1154,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
->setCallerClassification($caller_class)
|
->setCallerClassification($caller_class)
|
||||||
->setGender($gender)
|
->setGender($gender)
|
||||||
->setEmergencyType($etype)
|
->setEmergencyType($etype)
|
||||||
->setOwnershipType($owner_type);
|
->setOwnershipType($owner_type)
|
||||||
|
->setCustomerLocation($cust_location);
|
||||||
|
|
||||||
if ($user != null)
|
if ($user != null)
|
||||||
{
|
{
|
||||||
|
|
@ -1205,6 +1262,19 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||||
|
|
||||||
|
// check if customer location is set
|
||||||
|
$cust_location_id = $req->request->get('cust_location', 0);
|
||||||
|
if ($cust_location_id == 0)
|
||||||
|
$error_array['cust_location'] = 'Customer location is required.';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get customer location
|
||||||
|
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||||
|
|
||||||
|
if ($cust_location == null)
|
||||||
|
$error_array['cust_location'] = 'Invalid customer location';
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($error_array)) {
|
if (empty($error_array)) {
|
||||||
// coordinates
|
// coordinates
|
||||||
$point = new Point($req->request->get('coord_lng'), $req->request->get('coord_lat'));
|
$point = new Point($req->request->get('coord_lng'), $req->request->get('coord_lat'));
|
||||||
|
|
@ -1232,7 +1302,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
->setGender($gender)
|
->setGender($gender)
|
||||||
->setCallerClassification($caller_class)
|
->setCallerClassification($caller_class)
|
||||||
->setEmergencyType($etype)
|
->setEmergencyType($etype)
|
||||||
->setOwnershipType($owner_type);
|
->setOwnershipType($owner_type)
|
||||||
|
->setCustomerLocation($cust_location);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
$errors = $this->validator->validate($obj);
|
$errors = $this->validator->validate($obj);
|
||||||
|
|
@ -1459,6 +1530,19 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||||
|
|
||||||
|
// check if customer location is set
|
||||||
|
$cust_location_id = $req->request->get('cust_location', 0);
|
||||||
|
if ($cust_location_id == 0)
|
||||||
|
$error_array['cust_location'] = 'Customer location is required.';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get customer location
|
||||||
|
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||||
|
|
||||||
|
if ($cust_location == null)
|
||||||
|
$error_array['cust_location'] = 'Invalid customer location';
|
||||||
|
}
|
||||||
|
|
||||||
// get previously assigned hub, if any
|
// get previously assigned hub, if any
|
||||||
$old_hub = $obj->getHub();
|
$old_hub = $obj->getHub();
|
||||||
|
|
||||||
|
|
@ -1517,6 +1601,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
->setCallerClassification($caller_class)
|
->setCallerClassification($caller_class)
|
||||||
->setEmergencyType($etype)
|
->setEmergencyType($etype)
|
||||||
->setOwnershipType($owner_type)
|
->setOwnershipType($owner_type)
|
||||||
|
->setCustomerLocation($cust_location)
|
||||||
->clearRider();
|
->clearRider();
|
||||||
|
|
||||||
if ($user != null)
|
if ($user != null)
|
||||||
|
|
@ -1741,6 +1826,19 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$ownertype_id = $req->request->get('ownership_type', 0);
|
$ownertype_id = $req->request->get('ownership_type', 0);
|
||||||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||||
|
|
||||||
|
// check if customer location is set
|
||||||
|
$cust_location_id = $req->request->get('cust_location', 0);
|
||||||
|
if ($cust_location_id == 0)
|
||||||
|
$error_array['cust_location'] = 'Customer location is required.';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get customer location
|
||||||
|
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||||
|
|
||||||
|
if ($cust_location == null)
|
||||||
|
$error_array['cust_location'] = 'Invalid customer location';
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($error_array)) {
|
if (empty($error_array)) {
|
||||||
// rider mqtt event
|
// rider mqtt event
|
||||||
// NOTE: need to send this before saving because rider will be cleared
|
// NOTE: need to send this before saving because rider will be cleared
|
||||||
|
|
@ -1793,7 +1891,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
->setGender($gender)
|
->setGender($gender)
|
||||||
->setCallerClassification($caller_class)
|
->setCallerClassification($caller_class)
|
||||||
->setEmergencyType($etype)
|
->setEmergencyType($etype)
|
||||||
->setOwnershipType($owner_type);
|
->setOwnershipType($owner_type)
|
||||||
|
->setCustomerLocation($cust_location);
|
||||||
|
|
||||||
if ($user != null)
|
if ($user != null)
|
||||||
{
|
{
|
||||||
|
|
@ -3357,6 +3456,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
}
|
}
|
||||||
$params['ownership_types'] = $ownership_types;
|
$params['ownership_types'] = $ownership_types;
|
||||||
|
|
||||||
|
// list of customer locations
|
||||||
|
$cust_locations = $em->getRepository(CustomerLocation::class)->findBy([], ['name' => 'ASC']);
|
||||||
|
$c_locations = [];
|
||||||
|
foreach ($cust_locations as $cust_location)
|
||||||
|
{
|
||||||
|
$c_locations[$cust_location->getID()] = $cust_location->getName();
|
||||||
|
}
|
||||||
|
$params['cust_locations'] = $c_locations;
|
||||||
|
|
||||||
// list of hubs
|
// list of hubs
|
||||||
$hubs = $em->getRepository(Hub::class)->findBy([], ['name' => 'ASC']);
|
$hubs = $em->getRepository(Hub::class)->findBy([], ['name' => 'ASC']);
|
||||||
$fac_hubs = [];
|
$fac_hubs = [];
|
||||||
|
|
|
||||||
142
templates/customer-location/form.html.twig
Normal file
142
templates/customer-location/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">Customer Locations</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>{{ cust_location.getName() }}</small>
|
||||||
|
{% else %}
|
||||||
|
New Customer Location
|
||||||
|
{% 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('customer_location_update_submit', {'id': cust_location.getId()}) : url('customer_location_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="{{ cust_location.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="{{ cust_location.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('customer_location_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('customer_location_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/customer-location/list.html.twig
Normal file
146
templates/customer-location/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">
|
||||||
|
Customer Locations
|
||||||
|
</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('customer_location_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 Customer Location</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("customer_location_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 %}
|
||||||
|
|
@ -560,6 +560,24 @@
|
||||||
Location
|
Location
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group m-form__group row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label for="cust_location" data-field="cust_location"> Customer Location </label>
|
||||||
|
<select class="form-control m-input" id="cust-location" name="cust_location">
|
||||||
|
<option value=""></option>
|
||||||
|
{% for id, label in cust_locations %}
|
||||||
|
{% if obj.getCustomerLocation %}
|
||||||
|
<option value="{{ id }}"{{ obj.getCustomerLocation.getID == id ? ' selected' }}>{{ label }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ id }}">{{ label }}</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
<div class="form-control-feedback hide" data-field="cust_location"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group m-form__group row">
|
<div class="form-group m-form__group row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<label data-field="delivery_address">Delivery Address</label>
|
<label data-field="delivery_address">Delivery Address</label>
|
||||||
|
|
|
||||||
53
utils/customer_locations/insert_customer_locations.sql
Normal file
53
utils/customer_locations/insert_customer_locations.sql
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
-- MySQL dump 10.19 Distrib 10.3.36-MariaDB, for Linux (x86_64)
|
||||||
|
--
|
||||||
|
-- Host: localhost Database: resq
|
||||||
|
-- ------------------------------------------------------
|
||||||
|
-- Server version 10.3.36-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 `customer_location`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `customer_location`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `customer_location` (
|
||||||
|
`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 `cust_location_idx` (`code`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `customer_location`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `customer_location` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `customer_location` DISABLE KEYS */;
|
||||||
|
INSERT INTO `customer_location` VALUES (1,'residence','Residence'),(2,'office','Office'),(3,'on_the_road','On the Road'),(4,'commercial','Commercial');
|
||||||
|
/*!40000 ALTER TABLE `customer_location` 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 2023-02-23 8:03:35
|
||||||
Loading…
Reference in a new issue