Replace hardcoded country code prefixes with variables set in .env and messages files. #309

This commit is contained in:
Korina Cordero 2020-01-24 04:05:48 +00:00
parent cf4c7b2f28
commit 69f0612a2d
12 changed files with 34 additions and 25 deletions

View file

@ -11,6 +11,7 @@ parameters:
app_acl_file: 'acl.yaml'
app_access_key: 'access_keys'
cvu_brand_id: "%env(CVU_BRAND_ID)%"
country_code: "%env(COUNTRY_CODE)%"
services:
# default configuration for services in *this* file

View file

@ -584,11 +584,14 @@ class CustomerController extends Controller
// build vehicles array
$vehicles = [];
// get country code from services.yaml
$country_code = $this->getParameter('country_code');
foreach ($obj_rows as $cv) {
$cust = $cv->getCustomer();
$vehicles[] = [
'id' => $cv->getID(),
'text' => $cv->getPlateNumber() . ' ' . $cust->getFirstName() . ' ' . $cust->getLastName() . ' (+63' . $cust->getPhoneMobile() . ')',
'text' => $cv->getPlateNumber() . ' ' . $cust->getFirstName() . ' ' . $cust->getLastName() . ' (' . $country_code . $cust->getPhoneMobile() . ')',
];
}

View file

@ -1977,6 +1977,9 @@ class JobOrderController extends Controller
$translated_title = $translator->trans('jo_title_pdf');
$translated_logo = $translator->trans('image_jo_pdf');
// get the country code from services.yaml
$country_code = $this->getParameter('country_code');
// generate the pdf
$pdf = new FPDF('P', 'mm', 'letter');
$pdf->AddPage();
@ -2029,7 +2032,7 @@ class JobOrderController extends Controller
$pdf->SetXY($col2_x, $y);
$pdf->Cell($label_width, $line_height, 'Mobile Phone:');
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneMobile() ? '+63' . $customer->getPhoneMobile() : '', 0, 'L');
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneMobile() ? $country_code . $customer->getPhoneMobile() : '', 0, 'L');
// get Y after right cell
$y2 = $pdf->GetY();
@ -2046,7 +2049,7 @@ class JobOrderController extends Controller
$pdf->SetXY($col2_x, $y);
$pdf->Cell($label_width, $line_height, 'Landline:');
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneLandline() ? '+63' . $customer->getPhoneLandline() : '', 0, 'L');
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneLandline() ? $country_code . $customer->getPhoneLandline() : '', 0, 'L');
// get Y after right cell
$y2 = $pdf->GetY();
@ -2056,11 +2059,11 @@ class JobOrderController extends Controller
$pdf->SetXY($col2_x, $y);
$pdf->Cell($label_width, $line_height, 'Office Phone:');
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneOffice() ? '+63' . $customer->getPhoneOffice() : '', 0, 'L');
$pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneOffice() ? $country_code . $customer->getPhoneOffice() : '', 0, 'L');
$pdf->SetX($col2_x);
$pdf->Cell($label_width, $line_height, 'Fax:');
$pdf->MultiCell($val_width, $line_height, $customer && $customer->getPhoneFax() ? '+63' . $customer->getPhoneFax() : '', 0, 'L');
$pdf->MultiCell($val_width, $line_height, $customer && $customer->getPhoneFax() ? $country_code . $customer->getPhoneFax() : '', 0, 'L');
// insert vehicle info
$cv = $obj->getCustomerVehicle();

View file

@ -258,16 +258,16 @@ class Customer
$phones = [];
if (!empty($this->phone_mobile))
$phones[] = '+63' . $this->phone_mobile;
$phones[] = $this->phone_mobile;
if (!empty($this->phone_landline))
$phones[] = '+63' . $this->phone_landline;
$phones[] = $this->phone_landline;
if (!empty($this->phone_office))
$phones[] = '+63' . $this->phone_office;
$phones[] = $this->phone_office;
if (!empty($this->phone_fax))
$phones[] = '+63' . $this->phone_fax;
$phones[] = $this->phone_fax;
return $phones;
}

View file

@ -131,7 +131,7 @@
Mobile Phone
</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="phone_mobile" class="form-control m-input" value="{{ obj.getPhoneMobile|default('') }}" data-name="phone_mobile">
<div class="form-control-feedback hide" data-field="phone_mobile"></div>
</div>
@ -141,7 +141,7 @@
Landline
</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="phone_landline" class="form-control m-input" value="{{ obj.getPhoneLandline|default('') }}" data-name="phone_landline">
<div class="form-control-feedback hide" data-field="phone_landline"></div>
</div>
@ -153,7 +153,7 @@
Office Phone
</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="phone_office" class="form-control m-input" value="{{ obj.getPhoneOffice|default('') }}" data-name="phone_office">
<div class="form-control-feedback hide" data-field="phone_office"></div>
</div>
@ -163,7 +163,7 @@
Fax
</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="phone_fax" class="form-control m-input" value="{{ obj.getPhoneFax|default('') }}" data-name="phone_fax">
<div class="form-control-feedback hide" data-field="phone_fax"></div>
</div>
@ -600,7 +600,7 @@
// input mask
$("#mobile-number").inputmask("mask", {
mask: "639999999999",
mask: "{% trans %}country_code_prefix{% endtrans %}9999999999",
placeholder: ""
});

View file

@ -110,7 +110,7 @@
<div class="col-lg-6">
<label data-field="customer_phone_mobile">Mobile Phone</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_phone_mobile" id="customer-phone-mobile" class="form-control m-input" value="{{ obj.getCustomer.getPhoneMobile|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_phone_mobile"></div>
</div>
@ -118,7 +118,7 @@
<div class="col-lg-6">
<label data-field="customer_phone_landline">Landline</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_phone_landline" id="customer-phone-landline" class="form-control m-input" value="{{ obj.getCustomer.getPhoneLandline|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_phone_landline"></div>
</div>
@ -128,7 +128,7 @@
<div class="col-lg-6">
<label data-field="customer_phone_office">Office Phone</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_phone_office" id="customer-phone-office" class="form-control m-input" value="{{ obj.getCustomer.getPhoneOffice|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_phone_office"></div>
</div>
@ -136,7 +136,7 @@
<div class="col-lg-6">
<label data-field="customer_phone_fax">Fax</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_phone_fax" id="customer-phone-fax" class="form-control m-input" value="{{ obj.getCustomer.getPhoneFax|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_phone_fax"></div>
</div>

View file

@ -89,7 +89,7 @@
<div class="col-lg-6">
<label data-field="customer_phone_mobile">Mobile Phone</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_phone_mobile" id="customer-phone-mobile" class="form-control m-input" value="{{ obj.getCustomer.getPhoneMobile|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_phone_mobile"></div>
</div>
@ -97,7 +97,7 @@
<div class="col-lg-6">
<label data-field="customer_phone_landline">Landline</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_phone_landline" id="customer-phone-landline" class="form-control m-input" value="{{ obj.getCustomer.getPhoneLandline|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_phone_landline"></div>
</div>

View file

@ -53,7 +53,7 @@
<div class="col-lg-6">
<label data-field="customer_phone_mobile">Mobile Phone</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_phone_mobile" id="customer-phone-mobile" class="form-control m-input" value="{{ data.getCustMobile|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_phone_mobile"></div>
</div>
@ -61,7 +61,7 @@
<div class="col-lg-6">
<label data-field="customer_phone_landline">Landline</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_phone_landline" id="customer-phone-landline" class="form-control m-input" value="{{ data.getCustLandline|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_phone_landline"></div>
</div>
@ -71,7 +71,7 @@
<div class="col-lg-6">
<label data-field="customer_contact">Contact</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="customer_contact" id="customer-contact" class="form-control m-input" value="{{ data.getCustContact|default('') }}" data-vehicle-field="1" disabled>
<div class="form-control-feedback hide" data-field="customer_contact"></div>
</div>

View file

@ -71,7 +71,7 @@
<div class="col-lg-4">
<label data-field="contact_num">Contact Number</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="contact_num" class="form-control m-input" value="{{ customer and mode == 'create' and customer.getPhoneMobile is not empty ? customer.getPhoneMobile : obj.getContactNumber }}"{{ customer ? ' disabled' }}>
<div class="form-control-feedback hide" data-field="contact_num"></div>
</div>

View file

@ -86,7 +86,7 @@
Mobile Phone
</label>
<div class="input-group m-input-group">
<span class="input-group-addon">+63</span>
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
<input type="text" name="mobile_number" class="form-control m-input" value="{{ obj.getMobileNumber|default('') }}" data-name="mobile_number">
<div class="form-control-feedback hide" data-field="mobile_number"></div>
</div>

View file

@ -10,6 +10,7 @@ battery_size_tradein_premium: Trade-in Premium
battery_size_tradein_other: Trade-in Other
add_cust_vehicle_battery_info: This vehicle is using a Motolite battery
jo_title_pdf: Motolite Res-Q Job Order
country_code_prefix: '+63'
# # images
image_logo_login: /assets/images/logo-resq.png

View file

@ -10,6 +10,7 @@ battery_size_tradein_premium: Trade-in Premium
battery_size_tradein_other: Trade-in Other
add_cust_vehicle_battery_info: This vehicle is using a Motolite battery
jo_title_pdf: Motolite Res-Q Job Order
country_code_prefix: '+63'
# images
image_logo_login: /assets/images/logo-resq.png