Resolve "Move hardcoded text into translations file" #1572
11 changed files with 127 additions and 64 deletions
|
|
@ -7,11 +7,14 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use App\Service\RisingTideGateway;
|
||||
|
||||
class TestSMSCommand extends Command
|
||||
{
|
||||
protected $gateway;
|
||||
protected $translator;
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
|
|
@ -21,9 +24,10 @@ class TestSMSCommand extends Command
|
|||
->addArgument('destination', InputArgument::REQUIRED, 'Destination number to send to');
|
||||
}
|
||||
|
||||
public function __construct(RisingTideGateway $gateway)
|
||||
public function __construct(RisingTideGateway $gateway, TranslatorInterface $translator)
|
||||
{
|
||||
$this->gateway = $gateway;
|
||||
$this->translator = $translator;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -34,7 +38,7 @@ class TestSMSCommand extends Command
|
|||
|
||||
error_log('sending sms to ' . $number);
|
||||
$msg = 'This is a test.';
|
||||
$this->gateway->sendSMS($number, 'MOTOLITE', $msg);
|
||||
$this->gateway->sendSMS($number, $this->translator->trans('message.battery_brand_allcaps'), $msg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Service\RisingTideGateway;
|
||||
|
|
@ -18,6 +20,7 @@ class WarrantySMSCommand extends Command
|
|||
{
|
||||
protected $gateway;
|
||||
protected $em;
|
||||
protected $translator;
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
|
|
@ -27,10 +30,11 @@ class WarrantySMSCommand extends Command
|
|||
->addArgument('date', InputArgument::OPTIONAL, 'Date to use as basis of expiration. Defaults to current date.');
|
||||
}
|
||||
|
||||
public function __construct(EntityManagerInterface $em, RisingTideGateway $gateway)
|
||||
public function __construct(EntityManagerInterface $em, RisingTideGateway $gateway, TranslatorInterface $translator)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->gateway = $gateway;
|
||||
$this->translator = $translator;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -97,10 +101,10 @@ class WarrantySMSCommand extends Command
|
|||
error_log(print_r($valid_numbers, true));
|
||||
foreach ($valid_numbers as $wdata)
|
||||
{
|
||||
$msg = 'Hi ' . $wdata['name'] . ', the warranty for the ' . $wdata['batt'] . ' installed in your car(' . $wdata['plate'] . ') has expired already. Please call MOTOLITE EXPRESS HATID at 8370-6686 to have the status of your battery checked to avoid any inconvenience. Thank you for choosing Motolite.';
|
||||
$msg = 'Hi ' . $wdata['name'] . ', the warranty for the ' . $wdata['batt'] . ' installed in your car(' . $wdata['plate'] . $this->translator->trans('message.partial_warrantysms');
|
||||
error_log($wdata['number'] . ' - sending ' . $msg);
|
||||
|
||||
$this->gateway->sendSMS($wdata['number'], 'MOTOLITE', $msg);
|
||||
$this->gateway->sendSMS($wdata['number'], $this->translator->trans('message.battery_brand_allcaps'), $msg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -242,11 +242,11 @@ class APIController extends Controller implements LoggedController
|
|||
return sprintf("%06d", mt_rand(100000, 999999));
|
||||
}
|
||||
|
||||
protected function sendConfirmationCode(RisingTideGateway $rt, $phone_number, $code)
|
||||
protected function sendConfirmationCode(RisingTideGateway $rt, $phone_number, $code, TranslatorInterface $translator)
|
||||
{
|
||||
// send sms to number
|
||||
$message = "Your Resq confirmation code is $code.";
|
||||
$rt->sendSMS($phone_number, 'MOTOLITE', $message);
|
||||
$message = $translator->trans('message.confirmation_code') . ' ' . $code;
|
||||
$rt->sendSMS($phone_number, $translator->trans('message.battery_brand_allcaps'), $message);
|
||||
}
|
||||
|
||||
public function confirmNumber(RisingTideGateway $rt, Request $req)
|
||||
|
|
@ -4078,7 +4078,7 @@ class APIController extends Controller implements LoggedController
|
|||
|
||||
// send sms
|
||||
error_log('sending sms to - ' . $this->session->getPhoneNumber());
|
||||
$rt->sendSMS($this->session->getPhoneNumber(), 'MOTOLITE', $sms_msg);
|
||||
$rt->sendSMS($this->session->getPhoneNumber(), $trans->trans('message.battery_brand_allcaps'), $sms_msg);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -578,12 +578,12 @@ class CustomerWarrantyController extends APIController
|
|||
|
||||
|
||||
// send sms confirmation
|
||||
$this->sendSMSConfirmation($rt, $req->request->get('contact_num'), $sms_message);
|
||||
$this->sendSMSConfirmation($rt, $req->request->get('contact_num'), $sms_message, $trans);
|
||||
|
||||
return new APIResponse(true, 'Warranty registered.', $data);
|
||||
}
|
||||
|
||||
protected function sendSMSConfirmation($rt, $num, $message)
|
||||
protected function sendSMSConfirmation($rt, $num, $message, $trans)
|
||||
{
|
||||
$clean_num = trim($num);
|
||||
|
||||
|
|
@ -602,6 +602,6 @@ class CustomerWarrantyController extends APIController
|
|||
|
||||
error_log('sending sms to - ' . $clean_num);
|
||||
|
||||
$rt->sendSMS($clean_num, 'MOTOLITE', $message);
|
||||
$rt->sendSMS($clean_num, $trans->trans('message.battery_brand_allcaps'), $message);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
|
|
@ -747,7 +749,7 @@ class RiderAppController extends APIController
|
|||
}
|
||||
|
||||
public function payment(Request $req, EntityManagerInterface $em, JobOrderHandlerInterface $jo_handler,
|
||||
RisingTideGateway $rt, WarrantyHandler $wh, MQTTClient $mclient)
|
||||
RisingTideGateway $rt, WarrantyHandler $wh, MQTTClient $mclient, TranslatorInterface $translator)
|
||||
{
|
||||
$required_params = ['jo_id'];
|
||||
|
||||
|
|
@ -807,9 +809,8 @@ class RiderAppController extends APIController
|
|||
$phone_number = $jo->getCustomer()->getPhoneMobile();
|
||||
if (!empty($phone_number))
|
||||
{
|
||||
// TODO: put this in config file or somewhere
|
||||
$message = "Your Resq job order has been completed.";
|
||||
$rt->sendSMS($phone_number, 'MOTOLITE', $message);
|
||||
$message = $translator->trans('message.joborder_completed');
|
||||
$rt->sendSMS($phone_number, $translator->trans('message.battery_brand_allcaps'), $message);
|
||||
}
|
||||
|
||||
$em->flush();
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ class HubSelector
|
|||
{
|
||||
// send SMS message
|
||||
error_log('sending sms to - ' . $mobile_number);
|
||||
$this->rt->sendSMS($mobile_number, 'MOTOLITE', $message);
|
||||
$this->rt->sendSMS($mobile_number, $this->trans->trans('message.battery_brand_allcaps'), $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2539,7 +2539,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
// insert JO number
|
||||
$pdf->SetFont($font_face, 'B', $jo_font_size);
|
||||
$pdf->SetX($col2_x);
|
||||
$pdf->Cell($label_width, $jo_line_height, 'JO Number:');
|
||||
$pdf->Cell($label_width, $jo_line_height, $translator->trans('label.pdf.jo_number'));
|
||||
$pdf->SetTextColor(9, 65, 150);
|
||||
$pdf->Cell(0, $jo_line_height, $obj->getID());
|
||||
|
||||
|
|
@ -2554,14 +2554,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Customer Name:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.customer_name'));
|
||||
$pdf->MultiCell($val_width, $line_height, $customer ? $customer->getFirstName() . ' ' . $customer->getLastName() : '', 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Mobile Phone:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.mobile_phone'));
|
||||
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneMobile() ? $this->country_code . $customer->getPhoneMobile() : '', 0, 'L');
|
||||
|
||||
// get Y after right cell
|
||||
|
|
@ -2571,14 +2571,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Delivery Date:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.delivery_date'));
|
||||
$pdf->MultiCell($val_width, $line_height, $obj->getDateSchedule() ? $obj->getDateSchedule()->format("m/d/Y") : '', 0, 'left');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Landline:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.landline'));
|
||||
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneLandline() ? $this->country_code . $customer->getPhoneLandline() : '', 0, 'L');
|
||||
|
||||
// get Y after right cell
|
||||
|
|
@ -2588,11 +2588,11 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Office Phone:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.office_phone'));
|
||||
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneOffice() ? $this->country_code . $customer->getPhoneOffice() : '', 0, 'L');
|
||||
|
||||
$pdf->SetX($col2_x);
|
||||
$pdf->Cell($label_width, $line_height, 'Fax:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.fax'));
|
||||
$pdf->MultiCell($val_width, $line_height, $customer && $customer->getPhoneFax() ? $this->country_code . $customer->getPhoneFax() : '', 0, 'L');
|
||||
|
||||
// insert vehicle info
|
||||
|
|
@ -2600,21 +2600,21 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$vehicle = $cv->getVehicle();
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont($font_face, 'B', $header_font_size);
|
||||
$pdf->Cell($label_width, $line_height, 'Vehicle Details');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.vehicle_details'));
|
||||
$pdf->Ln($line_height * 2);
|
||||
|
||||
// get current Y
|
||||
$y = $pdf->GetY();
|
||||
|
||||
$pdf->SetFont($font_face, '', $body_font_size);
|
||||
$pdf->Cell($label_width, $line_height, 'Plate Number:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.plate_number'));
|
||||
$pdf->MultiCell($val_width, $line_height, $cv ? $cv->getPlateNumber() : '', 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Vehicle Color:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.vehicle_color'));
|
||||
$pdf->MultiCell(0, $line_height, $cv ? $cv->getColor() : '', 0, 'L');
|
||||
|
||||
// get Y after right cell
|
||||
|
|
@ -2624,14 +2624,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Brand:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.brand'));
|
||||
$pdf->MultiCell($val_width, $line_height, $vehicle && $vehicle->getManufacturer() ? $vehicle->getManufacturer()->getName() : '', 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Model / Year:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.model_year'));
|
||||
$pdf->MultiCell(0, $line_height, $cv ? $cv->getModelYear() : '', 0, 'L');
|
||||
|
||||
// get Y after right cell
|
||||
|
|
@ -2641,14 +2641,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Make:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.make'));
|
||||
$pdf->MultiCell($val_width, $line_height, $vehicle ? $vehicle->getMake() : '', 0, 'L');
|
||||
|
||||
// insert battery info
|
||||
$battery = $cv->getCurrentBattery();
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont($font_face, 'B', $header_font_size);
|
||||
$pdf->Cell($label_width, $line_height, 'Battery Details');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.battery_details'));
|
||||
$pdf->Ln($line_height * 2);
|
||||
|
||||
$pdf->SetFont($font_face, '', $body_font_size);
|
||||
|
|
@ -2656,14 +2656,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
// get current Y
|
||||
$y = $pdf->GetY();
|
||||
|
||||
$pdf->Cell($label_width, $line_height, 'Current Battery:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.current_battery'));
|
||||
$pdf->MultiCell($val_width, $line_height, $battery && $battery->getManufacturer() && $battery->getModel() && $battery->getSize() ? $battery->getManufacturer()->getName() . ' ' . $battery->getModel()->getName() . ' ' . $battery->getSize()->getName() . ' (' . $battery->getProductCode() . ')' : '', 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Serial Number:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.serial_number'));
|
||||
$pdf->MultiCell(0, $line_height, $cv ? $cv->getWarrantyCode() : '', 0, 'L');
|
||||
|
||||
// get Y after right cell
|
||||
|
|
@ -2673,13 +2673,13 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Wty. Exp. Date:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.warranty_exp_date'));
|
||||
$pdf->MultiCell($val_width, $line_height, $cv && $cv->getWarrantyExpiration() ? $cv->getWarrantyExpiration()->format("d/m/Y") : '', 0, 'L');
|
||||
|
||||
// insert transaction details
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont($font_face, 'B', $header_font_size);
|
||||
$pdf->Cell($label_width, $line_height, 'Transaction Details');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.transaction_details'));
|
||||
$pdf->Ln($line_height * 2);
|
||||
|
||||
$pdf->SetFont($font_face, '', $body_font_size);
|
||||
|
|
@ -2687,14 +2687,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
// get current Y
|
||||
$y = $pdf->GetY();
|
||||
|
||||
$pdf->Cell($label_width, $line_height, 'Warranty Class:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.warranty_class'));
|
||||
$pdf->MultiCell($val_width, $line_height, WarrantyClass::getName($obj->getWarrantyClass()), 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Mode of Payment:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.mode_of_payment'));
|
||||
$pdf->MultiCell(0, $line_height, ModeOfPayment::getName($obj->getModeOfPayment()), 0, 'L');
|
||||
|
||||
// get Y after right cell
|
||||
|
|
@ -2703,14 +2703,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
// get row height
|
||||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->Cell($label_width, $line_height, 'Delivery Address:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.delivery_address'));
|
||||
$pdf->MultiCell($val_width, $line_height, $obj->getDeliveryAddress(), 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Landmark:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.landmark'));
|
||||
$pdf->MultiCell(0, $line_height, $obj->getLandMark(), 0, 'L');
|
||||
|
||||
// get Y after right cell
|
||||
|
|
@ -2720,14 +2720,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Dispatch Time:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.dispatch_time'));
|
||||
$pdf->MultiCell($val_width, $line_height, $obj->getDateSchedule() ? $obj->getDateSchedule()->format("g:i A") : '', 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Dispatched By:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.dispatched_by'));
|
||||
$pdf->MultiCell(0, $line_height, $obj->getProcessedBy() ? $obj->getProcessedBy()->getFullName() : '', 0, 'L');
|
||||
|
||||
// get Y after right cell
|
||||
|
|
@ -2740,7 +2740,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$pdf->SetY($y);
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont($font_face, 'B', $header_font_size);
|
||||
$pdf->Cell(0, $line_height, 'Delivery Instructions');
|
||||
$pdf->Cell(0, $line_height, $translator->trans('label.pdf.delivery_instructions'));
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont($font_face, '', $body_font_size);
|
||||
|
|
@ -2749,16 +2749,16 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
// insert invoice details
|
||||
$pdf->Ln();
|
||||
$pdf->SetFont($font_face, 'B', $header_font_size);
|
||||
$pdf->Cell($label_width, $line_height, 'Invoice Details');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.invoice_details'));
|
||||
$pdf->Ln();
|
||||
|
||||
// invoice table headers
|
||||
$invoice = $obj->getInvoice();
|
||||
$pdf->SetFont($font_face, 'B', $header_font_size);
|
||||
$pdf->Cell($table_col_width * 6, $table_line_height, 'Item', 1, 0, 'L', 1);
|
||||
$pdf->Cell($table_col_width * 2, $table_line_height, 'Quantity', 1, 0, 'R', 1);
|
||||
$pdf->Cell($table_col_width * 2, $table_line_height, 'Unit Price', 1, 0, 'R', 1);
|
||||
$pdf->Cell($table_col_width * 2, $table_line_height, 'Amount', 1, 1, 'R', 1);
|
||||
$pdf->Cell($table_col_width * 6, $table_line_height, $translator->trans('label.pdf.item'), 1, 0, 'L', 1);
|
||||
$pdf->Cell($table_col_width * 2, $table_line_height, $translator->trans('label.pdf.quantity'), 1, 0, 'R', 1);
|
||||
$pdf->Cell($table_col_width * 2, $table_line_height, $translator->trans('label.pdf.unit_price'), 1, 0, 'R', 1);
|
||||
$pdf->Cell($table_col_width * 2, $table_line_height, $translator->trans('label.pdf.amount'), 1, 1, 'R', 1);
|
||||
$pdf->SetFont($font_face, '', $body_font_size);
|
||||
|
||||
// build invoice items table
|
||||
|
|
@ -2783,7 +2783,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = $pdf->GetY();
|
||||
|
||||
// insert invoice footer details
|
||||
$pdf->Cell($label_width, $line_height, 'Transaction Type:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.transaction_type'));
|
||||
$pdf->MultiCell($val_width, $line_height, ServiceType::getName($obj->getServiceType()), 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
|
|
@ -2791,7 +2791,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->SetFont($font_face, 'B');
|
||||
$pdf->Cell($label_width, $line_height, 'SUBTOTAL:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.subtotal'));
|
||||
$pdf->SetFont($font_face, '');
|
||||
$pdf->MultiCell(0, $line_height, $invoice ? number_format($invoice->getVATExclusivePrice(), 2) : '', 0, 'R');
|
||||
|
||||
|
|
@ -2802,7 +2802,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'OR Name:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.or_name'));
|
||||
$pdf->MultiCell($val_width, $line_height, $obj->getORName(), 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
|
|
@ -2810,7 +2810,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->SetFont($font_face, 'B');
|
||||
$pdf->Cell($label_width, $line_height, 'TAX:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.tax'));
|
||||
$pdf->SetFont($font_face, '');
|
||||
$pdf->MultiCell(0, $line_height, $invoice ? number_format($invoice->getVAT(), 2) : '', 0, 'R');
|
||||
|
||||
|
|
@ -2821,7 +2821,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Emp. ID/Card No./Ref. By:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.emp_id_ref'));
|
||||
$pdf->MultiCell($val_width, $line_height, $obj->getPromoDetail(), 0, 'L');
|
||||
|
||||
// get Y after left cell
|
||||
|
|
@ -2829,7 +2829,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->SetFont($font_face, 'B');
|
||||
$pdf->Cell($label_width, $line_height, 'DISCOUNT:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.discount'));
|
||||
$pdf->SetFont($font_face, '');
|
||||
$pdf->MultiCell(0, $line_height, $invoice ? number_format($invoice->getDiscount(), 2) : '', 0, 'R');
|
||||
|
||||
|
|
@ -2840,12 +2840,12 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$y = max($y1, $y2);
|
||||
|
||||
$pdf->SetXY($col1_x, $y);
|
||||
$pdf->Cell($label_width, $line_height, 'Discount Type:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.discount_type'));
|
||||
$pdf->MultiCell($val_width, $line_height, $invoice && $invoice->getPromo() ? $invoice->getPromo()->getName() : '', 0, 'L');
|
||||
|
||||
$pdf->SetXY($col2_x, $y);
|
||||
$pdf->SetFont($font_face, 'B');
|
||||
$pdf->Cell($label_width, $line_height, 'FINAL AMOUNT:');
|
||||
$pdf->Cell($label_width, $line_height, $translator->trans('label.pdf.final_amount'));
|
||||
$pdf->MultiCell(0, $line_height, $invoice ? number_format($invoice->getTotalPrice(), 2) : '', 0, 'R');
|
||||
$pdf->SetFont($font_face, '');
|
||||
|
||||
|
|
@ -3540,8 +3540,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
public function sendSMSToCustomer($phone_number)
|
||||
{
|
||||
// TODO: put this in config file or somewhere
|
||||
$message = "Your Resq job order has been completed.";
|
||||
$this->rt->sendSMS($phone_number, 'MOTOLITE', $message);
|
||||
$message = $this->translator->trans('message.joborder_completed');
|
||||
$this->rt->sendSMS($phone_number, $this->translator->trans('message.battery_brand_allcaps'), $message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use App\Ramcar\ServiceType;
|
||||
use App\Ramcar\TradeInType;
|
||||
use App\Ramcar\JOStatus;
|
||||
|
|
@ -57,7 +59,7 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
string $country_code, MQTTClient $mclient,
|
||||
WarrantyHandler $wh, JobOrderHandlerInterface $jo_handler,
|
||||
InvoiceGeneratorInterface $ic, RisingTideGateway $rt,
|
||||
RiderTracker $rider_tracker)
|
||||
RiderTracker $rider_tracker, TranslatorInterface $translator)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->redis = $redis;
|
||||
|
|
@ -70,6 +72,7 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
$this->ic = $ic;
|
||||
$this->rt = $rt;
|
||||
$this->rider_tracker = $rider_tracker;
|
||||
$this->translator = $translator;
|
||||
|
||||
// one device = one session, since we have control over the devices
|
||||
// when a rider logs in, we just change the rider assigned to the device
|
||||
|
|
@ -595,9 +598,8 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
$phone_number = $jo->getCustomer()->getPhoneMobile();
|
||||
if (!empty($phone_number))
|
||||
{
|
||||
// TODO: put this in config file or somewhere
|
||||
$message = "Your Resq job order has been completed.";
|
||||
$this->rt->sendSMS($phone_number, 'MOTOLITE', $message);
|
||||
$message = $this->translator->trans('message.joborder_completed');
|
||||
$this->rt->sendSMS($phone_number, $this->translator->trans('message.battery_brand_allcaps'), $message);
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ namespace App\Service\RiderAssignmentHandler;
|
|||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use App\Service\RiderAssignmentHandlerInterface;
|
||||
use App\Service\MQTTClient;
|
||||
use App\Service\APNSClient;
|
||||
|
|
@ -18,13 +20,15 @@ class ResqRiderAssignmentHandler implements RiderAssignmentHandlerInterface
|
|||
protected $em;
|
||||
protected $aclient;
|
||||
protected $mclient;
|
||||
protected $translator;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, MQTTClient $mclient,
|
||||
APNSClient $aclient)
|
||||
APNSClient $aclient, TranslatorInterface $translator)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->mclient = $mclient;
|
||||
$this->aclient = $aclient;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
// assign job order to rider
|
||||
|
|
@ -49,7 +53,7 @@ class ResqRiderAssignmentHandler implements RiderAssignmentHandlerInterface
|
|||
$this->mclient->sendRiderEvent($obj, $payload);
|
||||
|
||||
// send push notification
|
||||
$this->aclient->sendPush($obj, "A RESQ rider is on his way to you.");
|
||||
$this->aclient->sendPush($obj, $this->translator->trans('message.rider_otw'));
|
||||
|
||||
$this->em->flush();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@
|
|||
<span class="m-switch m-switch--icon block-switch">
|
||||
<label>
|
||||
<input type="checkbox" name="flag_motolite_battery" id="flag-motolite-battery" value="1" {{ obj.getCustomerVehicle.getCurrentBattery|default(false) ? obj.getCustomerVehicle.hasMotoliteBattery ? ' checked' }} disabled>
|
||||
<label class="switch-label">This vehicle is using a Motolite battery</label>
|
||||
<label class="switch-label">{% trans %}label.jo.vehicle_battery{% endtrans %}</label>
|
||||
<span></span>
|
||||
</label>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -31,3 +31,51 @@ default_region: ph
|
|||
# warranty text
|
||||
warranty_register_confirm: Congratulations! Your warranty has been successfully registered! Read about Motolite's privacy policy at https://www.motolite.com/privacy/.
|
||||
warranty_update_confirm: Congratulations! Your warranty has been successfully updated! Read about Motolite's privacy policy at https://www.motolite.com/privacy/.
|
||||
|
||||
# labels
|
||||
label.pdf.jo_number: 'JO Number:'
|
||||
label.pdf.customer_name: 'Customer Name:'
|
||||
label.pdf.mobile_phone: 'Mobile Phone:'
|
||||
label.pdf.delivery_date: 'Delivery Date:'
|
||||
label.pdf.landline: 'Landline:'
|
||||
label.pdf.office_phone: 'Office Phone:'
|
||||
label.pdf.fax: 'Fax:'
|
||||
label.pdf.vehicle_details: 'Vehicle Details'
|
||||
label.pdf.plate_number: 'Plate Number:'
|
||||
label.pdf.vehicle_color: 'Vehicle Color:'
|
||||
label.pdf.brand: 'Brand:'
|
||||
label.pdf.model_year: 'Model / Year:'
|
||||
label.pdf.make: 'Make:'
|
||||
label.pdf.battery_details: 'Battery Details'
|
||||
label.pdf.current_battery: 'Current Battery:'
|
||||
label.pdf.serial_number: 'Serial Number:'
|
||||
label.pdf.warranty_exp_date: 'Wty. Exp. Date:'
|
||||
label.pdf.transaction_details: 'Transaction Details'
|
||||
label.pdf.warranty_class: 'Warranty Class:'
|
||||
label.pdf.mode_of_payment: 'Mode of Payment:'
|
||||
label.pdf.delivery_address: 'Delivery Address:'
|
||||
label.pdf.landmark: 'Landmark:'
|
||||
label.pdf.dispatch_time: 'Dispatch Time:'
|
||||
label.pdf.dispatched_by: 'Dispatched By:'
|
||||
label.pdf.delivery_instructions: 'Delivery Instructions'
|
||||
label.pdf.invoice_details: 'Invoice Details'
|
||||
label.pdf.item: 'Item'
|
||||
label.pdf.quantity: 'Quantity'
|
||||
label.pdf.unit_price: 'Unit Price'
|
||||
label.pdf.amount: 'Amount'
|
||||
label.pdf.transaction_type: 'Transaction Type:'
|
||||
label.pdf.subtotal: 'SUBTOTAL:'
|
||||
label.pdf.or_name: 'OR Name:'
|
||||
label.pdf.tax: 'TAX:'
|
||||
label.pdf.emp_id_ref: 'Emp. ID/Card No./Ref. By:'
|
||||
label.pdf.discount: 'DISCOUNT:'
|
||||
label.pdf.discount_type: 'Discount Type:'
|
||||
label.pdf.final_amount: 'FINAL AMOUNT:'
|
||||
label.jo.vehicle_battery: 'This vehicle is using a Motolite battery'
|
||||
|
||||
# messages
|
||||
message.partial_warrantysms: ') has expired already. Please call MOTOLITE EXPRESS HATID at 8370-6686 to have the status of your battery checked to avoid any inconvenience. Thank you for choosing Motolite.'
|
||||
message.battery_brand_allcaps: 'MOTOLITE'
|
||||
message.confirmation_code: 'Your Resq confirmation code is'
|
||||
message.joborder_completed: 'Your Resq job order has been completed.'
|
||||
message.rider_otw: 'A RESQ rider is on his way to you.'
|
||||
|
|
|
|||
Loading…
Reference in a new issue