Add fulfillment job order list and form #15
This commit is contained in:
parent
61a5a988cc
commit
db2904f4de
6 changed files with 414 additions and 86 deletions
|
|
@ -189,6 +189,8 @@ access_keys:
|
||||||
label: Processing
|
label: Processing
|
||||||
- id: jo_assign.list
|
- id: jo_assign.list
|
||||||
label: Assigning
|
label: Assigning
|
||||||
|
- id: jo_fulfill.list
|
||||||
|
label: Fulfillment
|
||||||
|
|
||||||
- id: support
|
- id: support
|
||||||
label: Customer Support Access
|
label: Customer Support Access
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,10 @@ main_menu:
|
||||||
acl: jo_assign.list
|
acl: jo_assign.list
|
||||||
label: Assigning
|
label: Assigning
|
||||||
parent: joborder
|
parent: joborder
|
||||||
|
- id: jo_fulfill
|
||||||
|
acl: jo_fulfill.list
|
||||||
|
label: Fulfillment
|
||||||
|
parent: joborder
|
||||||
|
|
||||||
- id: support
|
- id: support
|
||||||
acl: support.menu
|
acl: support.menu
|
||||||
|
|
|
||||||
|
|
@ -58,3 +58,25 @@ jo_gen_invoice:
|
||||||
path: /job-order/generate-invoice
|
path: /job-order/generate-invoice
|
||||||
controller: App\Controller\JobOrderController::generateInvoice
|
controller: App\Controller\JobOrderController::generateInvoice
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
|
jo_fulfill:
|
||||||
|
path: /job-order/fulfillment
|
||||||
|
controller: App\Controller\JobOrderController::listFulfillment
|
||||||
|
methods: [GET]
|
||||||
|
|
||||||
|
jo_fulfill_rows:
|
||||||
|
path: /job-order/fulfillment-rows
|
||||||
|
controller: App\Controller\JobOrderController::getRows
|
||||||
|
methods: [POST]
|
||||||
|
defaults:
|
||||||
|
tier: "fulfill"
|
||||||
|
|
||||||
|
jo_fulfill_form:
|
||||||
|
path: /job-order/fulfillment/{id}
|
||||||
|
controller: App\Controller\JobOrderController::fulfillmentForm
|
||||||
|
methods: [GET]
|
||||||
|
|
||||||
|
jo_fulfill_submit:
|
||||||
|
path: /job-order/fulfillment/{id}
|
||||||
|
controller: App\Controller\JobOrderController::fulfillmentSubmit
|
||||||
|
methods: [POST]
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,16 @@ class JobOrderController extends BaseController
|
||||||
$edit_route = 'jo_assign_form';
|
$edit_route = 'jo_assign_form';
|
||||||
$jo_status = JOStatus::RIDER_ASSIGN;
|
$jo_status = JOStatus::RIDER_ASSIGN;
|
||||||
break;
|
break;
|
||||||
|
case 'fulfill':
|
||||||
|
$tier_key = 'jo_fulfill';
|
||||||
|
$tier_name = 'Fullfillment';
|
||||||
|
$rows_route = 'jo_fulfill_rows';
|
||||||
|
$edit_route = 'jo_fulfill_form';
|
||||||
|
$jo_status = [
|
||||||
|
JOStatus::ASSIGNED,
|
||||||
|
JOStatus::IN_PROGRESS
|
||||||
|
];
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$exception = $this->createAccessDeniedException('No access.');
|
$exception = $this->createAccessDeniedException('No access.');
|
||||||
throw $exception;
|
throw $exception;
|
||||||
|
|
@ -221,6 +231,15 @@ class JobOrderController extends BaseController
|
||||||
return $this->render('job-order/list.assigning.html.twig', $params);
|
return $this->render('job-order/list.assigning.html.twig', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function listFulfillment()
|
||||||
|
{
|
||||||
|
$params = $this->initParameters('jo_fulfill');
|
||||||
|
|
||||||
|
$params['table_refresh_rate'] = $this->container->getParameter('job_order_refresh_interval');
|
||||||
|
|
||||||
|
return $this->render('job-order/list.fulfillment.html.twig', $params);
|
||||||
|
}
|
||||||
|
|
||||||
public function listRows($tier)
|
public function listRows($tier)
|
||||||
{
|
{
|
||||||
// check which job order tier is being called for and confirm access
|
// check which job order tier is being called for and confirm access
|
||||||
|
|
@ -597,37 +616,6 @@ class JobOrderController extends BaseController
|
||||||
$params['discount_apply'] = DiscountApply::getCollection();
|
$params['discount_apply'] = DiscountApply::getCollection();
|
||||||
$params['trade_in_types'] = TradeInType::getCollection();
|
$params['trade_in_types'] = TradeInType::getCollection();
|
||||||
|
|
||||||
// get closest hubs
|
|
||||||
$hubs = $map_tools->getClosestHubs($obj->getCoordinates(), 10, date("H:i:s"));
|
|
||||||
|
|
||||||
$params['hubs'] = [];
|
|
||||||
|
|
||||||
// format duration and distance into friendly time
|
|
||||||
foreach ($hubs as $hub) {
|
|
||||||
// duration
|
|
||||||
$seconds = $hub['duration'];
|
|
||||||
|
|
||||||
if (!empty($seconds) && $seconds > 0) {
|
|
||||||
$hours = floor($seconds / 3600);
|
|
||||||
$minutes = ceil(($seconds / 60) % 60);
|
|
||||||
|
|
||||||
$hub['duration'] = ($hours > 0 ? number_format($hours) . " hr" . ($hours > 1 ? "s" : '') . ($minutes > 0 ? ", " : '') : '') . ($minutes > 0 ? number_format($minutes) . " min" . ($minutes > 1 ? "s" : '') : '');
|
|
||||||
} else {
|
|
||||||
$hub['duration'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// distance
|
|
||||||
$meters = $hub['distance'];
|
|
||||||
|
|
||||||
if (!empty($meters) && $meters > 0) {
|
|
||||||
$hub['distance'] = round($meters / 1000) . " km";
|
|
||||||
} else {
|
|
||||||
$hub['distance'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$params['hubs'][] = $hub;
|
|
||||||
}
|
|
||||||
|
|
||||||
$params['obj'] = $obj;
|
$params['obj'] = $obj;
|
||||||
$params['submit_url'] = $this->generateUrl('jo_assign_submit', ['id' => $obj->getID()]);
|
$params['submit_url'] = $this->generateUrl('jo_assign_submit', ['id' => $obj->getID()]);
|
||||||
$params['return_url'] = $this->generateUrl('jo_assign');
|
$params['return_url'] = $this->generateUrl('jo_assign');
|
||||||
|
|
@ -715,19 +703,155 @@ class JobOrderController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function fulfillmentForm(MapTools $map_tools, $id)
|
||||||
|
{
|
||||||
|
$this->denyAccessUnlessGranted('jo_assign.list', null, 'No access.');
|
||||||
|
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
$params = $this->initParameters('jo_assign');
|
||||||
|
$params['mode'] = 'update-fulfillment';
|
||||||
|
|
||||||
|
// get row data
|
||||||
|
$obj = $em->getRepository(JobOrder::class)->find($id);
|
||||||
|
|
||||||
|
// make sure this row exists
|
||||||
|
if (empty($obj))
|
||||||
|
{
|
||||||
|
throw $this->createNotFoundException('The job order does not exist');
|
||||||
|
}
|
||||||
|
|
||||||
|
// check status
|
||||||
|
if (!in_array($obj->getStatus(), [JOStatus::ASSIGNED, JOStatus::IN_PROGRESS]))
|
||||||
|
{
|
||||||
|
throw $this->createNotFoundException('The job order does not have a fulfillment status');
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if hub is assigned to current user
|
||||||
|
$user_hubs = $this->getUser()->getHubs();
|
||||||
|
if (!in_array($obj->getHub()->getID(), $user_hubs))
|
||||||
|
{
|
||||||
|
throw $this->createNotFoundException('The job order is not on a hub assigned to this user');
|
||||||
|
}
|
||||||
|
|
||||||
|
// get parent associations
|
||||||
|
$params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll();
|
||||||
|
$params['customers'] = $em->getRepository(Customer::class)->findAll();
|
||||||
|
$params['service_types'] = ServiceType::getCollection();
|
||||||
|
$params['warranty_classes'] = WarrantyClass::getCollection();
|
||||||
|
$params['statuses'] = JOStatus::getCollection();
|
||||||
|
$params['promos'] = $em->getRepository(Promo::class)->findAll();
|
||||||
|
$params['discount_apply'] = DiscountApply::getCollection();
|
||||||
|
$params['trade_in_types'] = TradeInType::getCollection();
|
||||||
|
|
||||||
|
$params['obj'] = $obj;
|
||||||
|
$params['submit_url'] = $this->generateUrl('jo_fulfill_submit', ['id' => $obj->getID()]);
|
||||||
|
$params['return_url'] = $this->generateUrl('jo_fulfill');
|
||||||
|
|
||||||
|
// response
|
||||||
|
return $this->render('job-order/form.html.twig', $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fulfillmentSubmit(Request $req, ValidatorInterface $validator, $id)
|
||||||
|
{
|
||||||
|
$this->denyAccessUnlessGranted('jo_assign.list', null, 'No access.');
|
||||||
|
|
||||||
|
// initialize error list
|
||||||
|
$error_array = [];
|
||||||
|
|
||||||
|
// get object data
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$obj = $em->getRepository(JobOrder::class)->find($id);
|
||||||
|
|
||||||
|
// make sure this object exists
|
||||||
|
if (empty($obj))
|
||||||
|
throw $this->createNotFoundException('The item does not exist');
|
||||||
|
|
||||||
|
// check if lat and lng are provided
|
||||||
|
if (empty($req->request->get('coord_lng')) || empty($req->request->get('coord_lat'))) {
|
||||||
|
$error_array['coordinates'] = 'No map coordinates provided. Please click on a location on the map.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($error_array)) {
|
||||||
|
// coordinates
|
||||||
|
$point = new Point($req->request->get('coord_lng'), $req->request->get('coord_lat'));
|
||||||
|
|
||||||
|
// set and save values
|
||||||
|
$obj->setDateSchedule(DateTime::createFromFormat("d M Y h:i A", $req->request->get('date_schedule_date') . " " . $req->request->get('date_schedule_time')))
|
||||||
|
->setCoordinates($point)
|
||||||
|
->setAdvanceOrder($req->request->get('flag_advance') ?? false)
|
||||||
|
->setServiceType($req->request->get('service_type'))
|
||||||
|
->setWarrantyClass($req->request->get('warranty_class'))
|
||||||
|
->setSource('web')
|
||||||
|
->setStatus(JOStatus::FULFILLED)
|
||||||
|
->setDeliveryInstructions($req->request->get('delivery_instructions'))
|
||||||
|
->setAgentNotes($req->request->get('agent_notes'))
|
||||||
|
->setDeliveryAddress($req->request->get('delivery_address'));
|
||||||
|
|
||||||
|
// validate
|
||||||
|
$errors = $validator->validate($obj);
|
||||||
|
|
||||||
|
// 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!'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: re-enable search, figure out how to group the orWhere filters into one, so can execute that plus the pending filter
|
// TODO: re-enable search, figure out how to group the orWhere filters into one, so can execute that plus the pending filter
|
||||||
|
|
||||||
// check if datatable filter is present and append to query
|
// check if datatable filter is present and append to query
|
||||||
protected function setQueryFilters($datatable, &$query, $qb, $hubs, $tier, $status)
|
protected function setQueryFilters($datatable, &$query, $qb, $hubs, $tier, $status)
|
||||||
{
|
{
|
||||||
$query->where('q.status = :status')
|
switch ($tier)
|
||||||
->setParameter('status', $status);
|
|
||||||
|
|
||||||
// on assigning, filter by assigned hub
|
|
||||||
if ($tier == 'assign')
|
|
||||||
{
|
{
|
||||||
$query->andWhere('q.hub IN (:hubs)')
|
case 'fulfill':
|
||||||
->setParameter('hubs', $hubs, Connection::PARAM_STR_ARRAY);
|
$query->where('q.status IN (:statuses)')
|
||||||
|
->andWhere('q.hub IN (:hubs)')
|
||||||
|
->setParameter('statuses', $status, Connection::PARAM_STR_ARRAY)
|
||||||
|
->setParameter('hubs', $hubs, Connection::PARAM_STR_ARRAY);
|
||||||
|
break;
|
||||||
|
case 'assign':
|
||||||
|
$query->where('q.status = :status')
|
||||||
|
->andWhere('q.hub IN (:hubs)')
|
||||||
|
->setParameter('status', $status)
|
||||||
|
->setParameter('hubs', $hubs, Connection::PARAM_STR_ARRAY);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$query->where('q.status = :status')
|
||||||
|
->setParameter('status', $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get only pending rows
|
// get only pending rows
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,7 @@
|
||||||
<div id="hub_map" style="height:600px;"></div>
|
<div id="hub_map" style="height:600px;"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if mode == 'update-assigning' %}
|
{% if mode in ['update-assigning', 'update-fulfillment'] %}
|
||||||
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
||||||
{% if obj.getHub %}
|
{% if obj.getHub %}
|
||||||
<div class="m-form__section">
|
<div class="m-form__section">
|
||||||
|
|
@ -469,56 +469,100 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
|
||||||
<div class="m-form__section m-form__section--last">
|
|
||||||
<div class="m-form__heading">
|
|
||||||
<h3 class="m-form__heading-title">
|
|
||||||
Rider Assignment
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<div class="form-group m-form__group row">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<label>Click on a row to select a rider</label>
|
|
||||||
<div class="form-control-feedback hide" data-field="rider"></div>
|
|
||||||
<div class="table-frame" data-name="rider">
|
|
||||||
<table id="riders-table" class="table table-compact table-hover table-clickable table-vcenter m-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>First Name</th>
|
|
||||||
<th>Last Name</th>
|
|
||||||
<th>Contact No.</th>
|
|
||||||
<th>Plate Number</th>
|
|
||||||
<th>Status</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="placeholder-row{{ obj.getHub and obj.getHub.getRiders|length > 0 ? ' hide' }}">
|
|
||||||
<td colspan="6">
|
|
||||||
No items to display.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% if obj.getHub %}
|
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
||||||
{% for rider in obj.getHub.getRiders %}
|
|
||||||
<tr data-id="{{ rider.getID }}"{{ obj.getRider and obj.getRider.getID == rider.getID ? ' class="m-table__row--primary"' }}>
|
{% if mode == 'update-assigning' %}
|
||||||
<td>
|
<div class="m-form__section m-form__section--last">
|
||||||
<div class="user-portrait-sm" style="background-image: url('{{ rider.getImageFile ? "/uploads/" ~ rider.getImageFile : "/assets/images/user.gif" }}');"></div>
|
<div class="m-form__heading">
|
||||||
</td>
|
<h3 class="m-form__heading-title">
|
||||||
<td>{{ rider.getFirstName }}</td>
|
Rider Assignment
|
||||||
<td>{{ rider.getLastName }}</td>
|
</h3>
|
||||||
<td>{{ rider.getContactNumber }}</td>
|
</div>
|
||||||
<td>{{ rider.getPlateNumber }}</td>
|
<div class="form-group m-form__group row">
|
||||||
<td></td>
|
<div class="col-lg-12">
|
||||||
</tr>
|
<label>Click on a row to select a rider</label>
|
||||||
{% endfor %}
|
<div class="form-control-feedback hide" data-field="rider"></div>
|
||||||
{% endif %}
|
<div class="table-frame" data-name="rider">
|
||||||
</tbody>
|
<table id="riders-table" class="table table-compact table-hover table-clickable table-vcenter m-table">
|
||||||
</table>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>First Name</th>
|
||||||
|
<th>Last Name</th>
|
||||||
|
<th>Contact No.</th>
|
||||||
|
<th>Plate Number</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="placeholder-row{{ obj.getHub and obj.getHub.getRiders|length > 0 ? ' hide' }}">
|
||||||
|
<td colspan="6">
|
||||||
|
No items to display.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% if obj.getHub %}
|
||||||
|
{% for rider in obj.getHub.getRiders %}
|
||||||
|
<tr data-id="{{ rider.getID }}"{{ obj.getRider and obj.getRider.getID == rider.getID ? ' class="m-table__row--primary"' }}>
|
||||||
|
<td>
|
||||||
|
<div class="user-portrait-sm" style="background-image: url('{{ rider.getImageFile ? "/uploads/" ~ rider.getImageFile : "/assets/images/user.gif" }}');"></div>
|
||||||
|
</td>
|
||||||
|
<td>{{ rider.getFirstName }}</td>
|
||||||
|
<td>{{ rider.getLastName }}</td>
|
||||||
|
<td>{{ rider.getContactNumber }}</td>
|
||||||
|
<td>{{ rider.getPlateNumber }}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
|
|
||||||
|
{% if mode == 'update-fulfillment' %}
|
||||||
|
<div class="m-form__section m-form__section--last">
|
||||||
|
<div class="m-form__heading">
|
||||||
|
<h3 class="m-form__heading-title">
|
||||||
|
Rider Details
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="form-group m-form__group row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label data-field="rider_first_name">First Name</label>
|
||||||
|
<input type="text" name="rider_first_name" id="rider-first-name" class="form-control m-input" value="{{ obj.getRider.getFirstName }}" disabled>
|
||||||
|
<div class="form-control-feedback hide" data-field="rider_first_name"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label data-field="rider_last_name">Last Name</label>
|
||||||
|
<input type="text" name="rider_last_name" id="rider-last-name" class="form-control m-input" value="{{obj.getRider.getLastName }}" disabled>
|
||||||
|
<div class="form-control-feedback hide" data-field="rider_last_name"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group m-form__group row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label data-field="rider_contact_no">Contact Number</label>
|
||||||
|
<input type="text" name="rider_contact_no" id="rider-contact-no" class="form-control m-input" value="{{ obj.getRider.getContactNumber }}" disabled>
|
||||||
|
<div class="form-control-feedback hide" data-field="rider_contact_no"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label data-field="rider_plate_number">Plate Number</label>
|
||||||
|
<input type="text" name="rider_plate_number" id="rider-plate-number" class="form-control m-input" value="{{obj.getRider.getPlateNumber }}" disabled>
|
||||||
|
<div class="form-control-feedback hide" data-field="rider_plate_number"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group m-form__group row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<label data-field="rider_picture">Picture</label>
|
||||||
|
<div class="portrait-box" style="background-image: url('{{ obj.getRider.getImageFile ? '/uploads/' ~ obj.getRider.getImageFile : '/assets/images/user.gif' }}');"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -526,7 +570,7 @@
|
||||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<button type="submit" class="btn btn-success">Submit</button>
|
<button type="submit" class="btn btn-success">{{ mode == 'update-fulfillment' ? 'Fulfill' : 'Submit' }}</button>
|
||||||
{% if mode != 'create' %}
|
{% if mode != 'create' %}
|
||||||
<a href="{{ return_url }}" class="btn btn-secondary">Cancel</a>
|
<a href="{{ return_url }}" class="btn btn-secondary">Cancel</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
132
templates/job-order/list.fulfillment.html.twig
Normal file
132
templates/job-order/list.fulfillment.html.twig
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
{% 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">
|
||||||
|
Job Orders (Fulfillment)
|
||||||
|
</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-12">
|
||||||
|
<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>
|
||||||
|
</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('jo_fulfill_rows') }}',
|
||||||
|
method: 'POST'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
saveState: {
|
||||||
|
cookie: false,
|
||||||
|
webstorage: false
|
||||||
|
},
|
||||||
|
pageSize: 10,
|
||||||
|
serverPaging: true,
|
||||||
|
serverFiltering: true,
|
||||||
|
serverSorting: true
|
||||||
|
},
|
||||||
|
rows: {
|
||||||
|
beforeTemplate: function (row, data, index) {
|
||||||
|
if (data.flag_advance) {
|
||||||
|
$(row).addClass('m-table__row--danger');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
field: 'id',
|
||||||
|
title: 'JO Number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'delivery_address',
|
||||||
|
title: 'Customer Area'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'service_type',
|
||||||
|
title: 'Type of Transaction'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'date_schedule',
|
||||||
|
title: 'Scheduled Date'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'status',
|
||||||
|
title: 'Status'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'processor',
|
||||||
|
title: 'Processor'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'assignor',
|
||||||
|
title: 'Assignor'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'Actions',
|
||||||
|
width: 110,
|
||||||
|
title: 'Actions',
|
||||||
|
sortable: false,
|
||||||
|
overflow: 'visible',
|
||||||
|
template: function (row, index, datatable) {
|
||||||
|
var 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" title="View / Edit"><i class="la la-edit"></i></a>';
|
||||||
|
|
||||||
|
return actions;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
search: {
|
||||||
|
onEnter: false,
|
||||||
|
input: $('#data-rows-search'),
|
||||||
|
delay: 400
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var table = $("#data-rows").mDatatable(options);
|
||||||
|
|
||||||
|
// auto refresh table
|
||||||
|
setInterval(function() {
|
||||||
|
table.reload();
|
||||||
|
}, {{ table_refresh_rate }});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
Loading…
Reference in a new issue