Merge branch 'master' of gitlab.com:jankstudio/resq into 660-add-customer-and-customer-vehicle-in-warranty-upload

This commit is contained in:
Korina Cordero 2022-05-04 09:26:50 +00:00
commit 39be9e94ed
9 changed files with 225 additions and 10 deletions

View file

@ -630,8 +630,8 @@ class APIController extends Controller implements LoggedController
->setPlateNumber($req->request->get('plate_num')) ->setPlateNumber($req->request->get('plate_num'))
->setModelYear($req->request->get('model_year')) ->setModelYear($req->request->get('model_year'))
->setColor($req->request->get('color')) ->setColor($req->request->get('color'))
->setFuelType($req->request->get('fuel_type')) ->setFuelType($this->normalizeString($req->request->get('fuel_type')))
->setStatusCondition($req->request->get('condition')); ->setStatusCondition($this->normalizeString($req->request->get('condition')));
// set warranty code and expiration // set warranty code and expiration
// TODO: check warranty requirements // TODO: check warranty requirements
@ -4695,4 +4695,9 @@ class APIController extends Controller implements LoggedController
return $jo_data; return $jo_data;
} }
protected function normalizeString($string)
{
return trim(strtolower($string));
}
} }

View file

@ -4,6 +4,8 @@ namespace App\Controller;
use App\Ramcar\TicketType; use App\Ramcar\TicketType;
use App\Ramcar\TicketStatus; use App\Ramcar\TicketStatus;
use App\Ramcar\SourceOfAwareness;
use App\Entity\Ticket; use App\Entity\Ticket;
use App\Entity\Customer; use App\Entity\Customer;
use App\Entity\JobOrder; use App\Entity\JobOrder;
@ -172,6 +174,7 @@ class TicketController extends Controller
$params['statuses'] = TicketStatus::getCollection(); $params['statuses'] = TicketStatus::getCollection();
$params['other_ticket_type'] = TicketType::OTHER; $params['other_ticket_type'] = TicketType::OTHER;
$params['redirect_url'] = $this->generateUrl('ticket_list'); $params['redirect_url'] = $this->generateUrl('ticket_list');
$params['soa_types'] = SourceOfAwareness::getCollection();
// set redirect url // set redirect url
if ($customer) if ($customer)
@ -240,6 +243,12 @@ class TicketController extends Controller
$other_ticket_type = $req->request->get('other_ticket_type'); $other_ticket_type = $req->request->get('other_ticket_type');
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
// set and save values // set and save values
$obj->setFirstName($first_name) $obj->setFirstName($first_name)
->setLastName($last_name) ->setLastName($last_name)
@ -250,7 +259,9 @@ class TicketController extends Controller
->setDetails($req->request->get('details')) ->setDetails($req->request->get('details'))
->setPlateNumber($req->request->get('plate_number')) ->setPlateNumber($req->request->get('plate_number'))
->setDateCreate(new DateTime()) ->setDateCreate(new DateTime())
->setCreatedBy($this->getUser()); ->setCreatedBy($this->getUser())
->setSourceOfAwareness($soa_type)
->setRemarks($remarks);
// if assigned to customer, set association // if assigned to customer, set association
if ($customer_id) { if ($customer_id) {
@ -326,6 +337,7 @@ class TicketController extends Controller
$params['statuses'] = TicketStatus::getCollection(); $params['statuses'] = TicketStatus::getCollection();
$params['other_ticket_type'] = TicketType::OTHER; $params['other_ticket_type'] = TicketType::OTHER;
$params['redirect_url'] = $this->generateUrl('ticket_list'); $params['redirect_url'] = $this->generateUrl('ticket_list');
$params['soa_types'] = SourceOfAwareness::getCollection();
// set redirect url // set redirect url
if ($customer) if ($customer)
@ -423,6 +435,12 @@ class TicketController extends Controller
$other_ticket_type = $req->request->get('other_ticket_type'); $other_ticket_type = $req->request->get('other_ticket_type');
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
// set and save values // set and save values
$obj->setFirstName($first_name) $obj->setFirstName($first_name)
->setLastName($last_name) ->setLastName($last_name)
@ -431,7 +449,9 @@ class TicketController extends Controller
->setTicketType($ticket_type) ->setTicketType($ticket_type)
->setOtherTicketType($other_ticket_type) ->setOtherTicketType($other_ticket_type)
->setDetails($req->request->get('details')) ->setDetails($req->request->get('details'))
->setPlateNumber($req->request->get('plate_number')); ->setPlateNumber($req->request->get('plate_number'))
->setSourceOfAwareness($soa_type)
->setRemarks($remarks);
// initialize error list // initialize error list
$error_array = []; $error_array = [];

View file

@ -372,6 +372,18 @@ class JobOrder
*/ */
protected $rating; protected $rating;
// source of awareness
/**
* @ORM\Column(type="string", length=80, nullable=true)
*/
protected $source_of_awareness;
// remarks related to source of awareness
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $remarks;
public function __construct() public function __construct()
{ {
$this->date_create = new DateTime(); $this->date_create = new DateTime();
@ -1061,4 +1073,26 @@ class JobOrder
{ {
return $this->rating; return $this->rating;
} }
public function setSourceOfAwareness($source_of_awareness)
{
$this->source_of_awareness = $source_of_awareness;
return $this;
}
public function getSourceOfAwareness()
{
return $this->source_of_awareness;
}
public function setRemarks($remarks)
{
$this->remarks = $remarks;
return $this;
}
public function getRemarks()
{
return $this->remarks;
}
} }

View file

@ -108,6 +108,18 @@ class Ticket
*/ */
protected $job_order; protected $job_order;
// source of awareness
/**
* @ORM\Column(type="string", length=80, nullable=true)
*/
protected $source_of_awareness;
// remarks related to source of awareness
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $remarks;
public function __construct() public function __construct()
{ {
$this->date_create = new DateTime(); $this->date_create = new DateTime();
@ -265,4 +277,27 @@ class Ticket
{ {
return $this->job_order; return $this->job_order;
} }
public function setSourceOfAwareness($source_of_awareness)
{
$this->source_of_awareness = $source_of_awareness;
return $this;
}
public function getSourceOfAwareness()
{
return $this->source_of_awareness;
}
public function setRemarks($remarks)
{
$this->remarks = $remarks;
return $this;
}
public function getRemarks()
{
return $this->remarks;
}
} }

View file

@ -0,0 +1,27 @@
<?php
namespace App\Ramcar;
class SourceOfAwareness extends NameValue
{
const FACEBOOK = 'facebook';
const INSTAGRAM = 'instagram';
const RADIO_ADS = 'radio_ads';
const TARP_ADS = 'tarp_ads';
const FLYERS = 'flyers';
const WORD_OF_MOUTH = 'word_of_mouth';
const OTHER = 'other';
const REFERRAL = 'referral';
const COLLECTION = [
'facebook' => 'Facebook',
'instagram' => 'Instagram',
'radio_ads' => 'Radio Ads',
'tarp_ads' => 'Tarp Ads',
'flyers' => 'Flyers',
'word_of_mouth' => 'Word of Mouth',
'referral' => 'Referral',
'other' => 'Other',
];
}

View file

@ -36,7 +36,7 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
const OTHER_SERVICES_FEE = 200; const OTHER_SERVICES_FEE = 200;
const COOLANT_FEE = 1600; const COOLANT_FEE = 1600;
const REFUEL_FEE_GAS = 320; const REFUEL_FEE_GAS = 320;
const REFUEL_FEE_DIESEL = 280; const REFUEL_FEE_DIESEL = 340;
private $security; private $security;
protected $em; protected $em;

View file

@ -44,6 +44,7 @@ use App\Ramcar\WillingToWaitContent;
use App\Ramcar\WarrantySource; use App\Ramcar\WarrantySource;
use App\Ramcar\HubCriteria; use App\Ramcar\HubCriteria;
use App\Ramcar\DeliveryStatus; use App\Ramcar\DeliveryStatus;
use App\Ramcar\SourceOfAwareness;
use App\Service\InvoiceGeneratorInterface; use App\Service\InvoiceGeneratorInterface;
use App\Service\JobOrderHandlerInterface; use App\Service\JobOrderHandlerInterface;
@ -396,6 +397,12 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
} }
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
// TODO: check status before saving since JO might already // TODO: check status before saving since JO might already
// have a status that needs to be retained // have a status that needs to be retained
@ -427,7 +434,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setWillWait($req->request->get('flag_willing_to_wait')) ->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason) ->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason) ->setNotWaitingNotes($more_reason)
->setNoTradeInReason($no_trade_in_reason); ->setNoTradeInReason($no_trade_in_reason)
->setSourceOfAwareness($soa_type)
->setRemarks($remarks);
// 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)
@ -622,6 +631,12 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
} }
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
if (empty($error_array)) if (empty($error_array))
{ {
// get current user // get current user
@ -648,7 +663,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setWillWait($req->request->get('flag_willing_to_wait')) ->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason) ->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason) ->setNotWaitingNotes($more_reason)
->setNoTradeInReason($no_trade_in_reason); ->setNoTradeInReason($no_trade_in_reason)
->setSourceOfAwareness($soa_type)
->setRemarks($remarks);
// did they change invoice? // did they change invoice?
$invoice_items = $req->request->get('invoice_items', []); $invoice_items = $req->request->get('invoice_items', []);
@ -794,6 +811,12 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$more_reason = $req->request->get('not_wait_notes'); $more_reason = $req->request->get('not_wait_notes');
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
if (empty($error_array)) if (empty($error_array))
{ {
// coordinates // coordinates
@ -817,7 +840,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setLandmark($req->request->get('landmark')) ->setLandmark($req->request->get('landmark'))
->setWillWait($req->request->get('flag_willing_to_wait')) ->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason) ->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason); ->setNotWaitingNotes($more_reason)
->setSourceOfAwareness($soa_type)
->setRemarks($remarks);
// validate // validate
$errors = $this->validator->validate($obj); $errors = $this->validator->validate($obj);
@ -909,6 +934,12 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$more_reason = $req->request->get('not_wait_notes'); $more_reason = $req->request->get('not_wait_notes');
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
// get current user // get current user
$user = $this->security->getUser(); $user = $this->security->getUser();
@ -934,7 +965,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setWillWait($req->request->get('flag_willing_to_wait')) ->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason) ->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason) ->setNotWaitingNotes($more_reason)
->setDeliveryStatus(DeliveryStatus::RIDER_ASSIGN); ->setDeliveryStatus(DeliveryStatus::RIDER_ASSIGN)
->setSourceOfAwareness($soa_type)
->setRemarks($remarks);
if ($user != null) if ($user != null)
{ {
@ -1015,6 +1048,12 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$more_reason = $req->request->get('not_wait_notes'); $more_reason = $req->request->get('not_wait_notes');
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
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'));
@ -1034,7 +1073,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setWillWait($req->request->get('flag_willing_to_wait')) ->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason) ->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason) ->setNotWaitingNotes($more_reason)
->setDeliveryStatus(DeliveryStatus::FULFILLED); ->setDeliveryStatus(DeliveryStatus::FULFILLED)
->setSourceOfAwareness($soa_type)
->setRemarks($remarks);
// validate // validate
$errors = $this->validator->validate($obj); $errors = $this->validator->validate($obj);
@ -1235,6 +1276,12 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$more_reason = $req->request->get('not_wait_notes'); $more_reason = $req->request->get('not_wait_notes');
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
// get previously assigned hub, if any // get previously assigned hub, if any
$old_hub = $obj->getHub(); $old_hub = $obj->getHub();
@ -1269,6 +1316,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setWillWait($req->request->get('flag_willing_to_wait')) ->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason) ->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason) ->setNotWaitingNotes($more_reason)
->setSourceOfAwareness($soa_type)
->setRemarks($remarks)
->clearRider(); ->clearRider();
if ($user != null) if ($user != null)
@ -1465,6 +1514,12 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$more_reason = $req->request->get('not_wait_notes'); $more_reason = $req->request->get('not_wait_notes');
} }
// get source of awareness if any
$soa_type = $req->request->get('source_of_awareness');
// get remarks
$remarks = $req->request->get('remarks', '');
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
@ -1505,6 +1560,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setWillWait($req->request->get('flag_willing_to_wait')) ->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason) ->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason) ->setNotWaitingNotes($more_reason)
->setSourceOfAwareness($soa_type)
->setRemarks($remarks)
->setDeliveryStatus(DeliveryStatus::RIDER_ASSIGN); ->setDeliveryStatus(DeliveryStatus::RIDER_ASSIGN);
if ($user != null) if ($user != null)
@ -3011,6 +3068,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$params['willing_to_wait_content'] = WillingToWaitContent::getCollection(); $params['willing_to_wait_content'] = WillingToWaitContent::getCollection();
$params['no_wait_reasons'] = CustomerNotWaitReason::getCollection(); $params['no_wait_reasons'] = CustomerNotWaitReason::getCollection();
$params['no_trade_in_reasons'] = NoTradeInReason::getCollection(); $params['no_trade_in_reasons'] = NoTradeInReason::getCollection();
$params['soa_types'] = SourceOfAwareness::getCollection();
} }
protected function initFormTags(&$params) protected function initFormTags(&$params)

View file

@ -449,6 +449,23 @@
<div class="form-control-feedback hide" data-field="date_transaction"></div> <div class="form-control-feedback hide" data-field="date_transaction"></div>
</div> </div>
</div> </div>
</div>
<div class="form-group m-form__group row">
<div class="col-lg-6">
<label data-field="status">Source of Awareness</label>
<select class="form-control m-input" id="source-of-awareness" name="source_of_awareness">
<option value=""></option>
{% for key, soa in soa_types %}
<option value="{{ key }}"{{ key == obj.getSourceOfAwareness ? ' selected' }}>{{ soa }}</option>
{% endfor %}
</select>
<div class="form-control-feedback hide" data-field="source_of_awareness"></div>
</div>
<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>
<div class="form-control-feedback hide" data-field="remarks"></div>
</div>
</div> </div>
<!-- <!--
<div class="form-group m-form__group row"> <div class="form-group m-form__group row">

View file

@ -84,6 +84,25 @@
<div class="form-control-feedback hide" data-field="plate_number"></div> <div class="form-control-feedback hide" data-field="plate_number"></div>
</div> </div>
</div> </div>
<div class="form-group m-form__group row no-border">
<div class="col-lg-4">
<label data-field="status">Source of Awareness</label>
<select class="form-control m-input" id="source-of-awareness" name="source_of_awareness">
<option value=""></option>
{% for key, soa in soa_types %}
<option value="{{ key }}"{{ key == obj.getSourceOfAwareness ? ' selected' }}>{{ soa }}</option>
{% endfor %}
</select>
<div class="form-control-feedback hide" data-field="source_of_awareness"></div>
</div>
</div>
<div class="form-group m-form__group row no-border">
<div class="col-lg-12">
<label for="remarks" data-field="remarks"> Remarks </label>
<textarea class="form-control m-input" id="remarks" rows="6" name="remarks">{{ obj.getRemarks }}</textarea>
<div class="form-control-feedback hide" data-field="remarks"></div>
</div>
</div>
<div class="form-group m-form__group row no-border"> <div class="form-group m-form__group row no-border">
<div class="col-lg-4"> <div class="col-lg-4">
<label data-field="status">Status</label> <label data-field="status">Status</label>