Made discount a dropdown. #434
This commit is contained in:
parent
9bb8380ca4
commit
6e07e24e93
3 changed files with 77 additions and 7 deletions
|
|
@ -1454,6 +1454,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$params['obj'] = $new_jo;
|
$params['obj'] = $new_jo;
|
||||||
$params['mode'] = 'onestep';
|
$params['mode'] = 'onestep';
|
||||||
$params['jo_service_charges'] = [];
|
$params['jo_service_charges'] = [];
|
||||||
|
$params['discounts'] = $this->generateDiscountOptions();
|
||||||
|
|
||||||
$this->fillDropdownParameters($params);
|
$this->fillDropdownParameters($params);
|
||||||
$this->fillFormTags($params);
|
$this->fillFormTags($params);
|
||||||
|
|
@ -1474,6 +1475,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$params['mode'] = 'onestep-edit';
|
$params['mode'] = 'onestep-edit';
|
||||||
$params['cvid'] = $obj->getCustomerVehicle()->getID();
|
$params['cvid'] = $obj->getCustomerVehicle()->getID();
|
||||||
$params['vid'] = $obj->getCustomerVehicle()->getVehicle()->getID();
|
$params['vid'] = $obj->getCustomerVehicle()->getVehicle()->getID();
|
||||||
|
$params['discounts'] = $this->generateDiscountOptions();
|
||||||
|
|
||||||
// get service charges
|
// get service charges
|
||||||
$sc_array = [];
|
$sc_array = [];
|
||||||
|
|
@ -1504,6 +1506,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
// get images if any
|
// get images if any
|
||||||
$jo_extra = $obj->getJOExtra();
|
$jo_extra = $obj->getJOExtra();
|
||||||
$pic_array = [];
|
$pic_array = [];
|
||||||
|
$params['signature'] = null;
|
||||||
if ($jo_extra != null)
|
if ($jo_extra != null)
|
||||||
{
|
{
|
||||||
$b_speed_img = $jo_extra->getBeforeSpeedImageFilename();
|
$b_speed_img = $jo_extra->getBeforeSpeedImageFilename();
|
||||||
|
|
@ -1605,6 +1608,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$params['mode'] = 'open_edit';
|
$params['mode'] = 'open_edit';
|
||||||
$params['cvid'] = $jo->getCustomerVehicle()->getID();
|
$params['cvid'] = $jo->getCustomerVehicle()->getID();
|
||||||
$params['vid'] = $jo->getCustomerVehicle()->getVehicle()->getID();
|
$params['vid'] = $jo->getCustomerVehicle()->getVehicle()->getID();
|
||||||
|
$params['discounts'] = $this->generateDiscountOptions();
|
||||||
|
|
||||||
$this->fillDropdownParameters($params);
|
$this->fillDropdownParameters($params);
|
||||||
$this->fillFormTags($params);
|
$this->fillFormTags($params);
|
||||||
|
|
@ -2518,6 +2522,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
|
|
||||||
$params['obj'] = $new_jo;
|
$params['obj'] = $new_jo;
|
||||||
$params['mode'] = 'walk-in';
|
$params['mode'] = 'walk-in';
|
||||||
|
$params['discounts'] = $this->generateDiscountOptions();
|
||||||
|
|
||||||
$this->fillDropdownParameters($params);
|
$this->fillDropdownParameters($params);
|
||||||
$this->fillFormTags($params);
|
$this->fillFormTags($params);
|
||||||
|
|
@ -2803,6 +2808,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$params['mode'] = 'walk-in-edit';
|
$params['mode'] = 'walk-in-edit';
|
||||||
$params['cvid'] = $obj->getCustomerVehicle()->getID();
|
$params['cvid'] = $obj->getCustomerVehicle()->getID();
|
||||||
$params['vid'] = $obj->getCustomerVehicle()->getVehicle()->getID();
|
$params['vid'] = $obj->getCustomerVehicle()->getVehicle()->getID();
|
||||||
|
$params['discounts'] = $this->generateDiscountOptions();
|
||||||
|
|
||||||
$this->fillDropdownParameters($params);
|
$this->fillDropdownParameters($params);
|
||||||
$this->fillFormTags($params);
|
$this->fillFormTags($params);
|
||||||
|
|
@ -3131,4 +3137,10 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
else
|
else
|
||||||
return 'jo_onestep_edit_form';
|
return 'jo_onestep_edit_form';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function generateDiscountOptions()
|
||||||
|
{
|
||||||
|
$discount_start = 0;
|
||||||
|
return range($discount_start, 60);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@
|
||||||
<div class="col-lg-3">
|
<div class="col-lg-3">
|
||||||
<label data-field="date_schedule">Scheduled Date</label>
|
<label data-field="date_schedule">Scheduled Date</label>
|
||||||
<div class="input-group date dp">
|
<div class="input-group date dp">
|
||||||
<input type="text" name="date_schedule_date" class="form-control m-input" data-default-value="{{ obj.getDateSchedule|default("now")|date('Y-m-d') }}" value="{{ obj.getDateSchedule|default("now")|date('d M Y') }}" readonly placeholder="Select a date" disabled>
|
<input type="text" id="date-schedule-date" name="date_schedule_date" class="form-control m-input" data-default-value="{{ obj.getDateSchedule|default("now")|date('Y-m-d') }}" value="{{ obj.getDateSchedule|default("now")|date('d M Y') }}" readonly placeholder="Select a date" disabled>
|
||||||
<span class="input-group-addon">
|
<span class="input-group-addon">
|
||||||
<i class="la la-calendar glyphicon-th"></i>
|
<i class="la la-calendar glyphicon-th"></i>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -288,7 +288,7 @@
|
||||||
<div class="col-lg-3">
|
<div class="col-lg-3">
|
||||||
<label data-field="date_schedule">Scheduled Time</label>
|
<label data-field="date_schedule">Scheduled Time</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="date_schedule_time" class="form-control m-input tp" data-default-value="{{ obj.getDateSchedule|default("now")|date('g:i A') }}" value="{{ obj.getDateSchedule|default("now")|date('g:i A') }}" readonly placeholder="Select a time" disabled>
|
<input type="text" id="date-schedule-time" name="date_schedule_time" class="form-control m-input tp" data-default-value="{{ obj.getDateSchedule|default("now")|date('g:i A') }}" value="{{ obj.getDateSchedule|default("now")|date('g:i A') }}" readonly placeholder="Select a time" disabled>
|
||||||
<span class="input-group-addon">
|
<span class="input-group-addon">
|
||||||
<i class="la la-clock-o glyphicon-th"></i>
|
<i class="la la-clock-o glyphicon-th"></i>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -656,10 +656,28 @@
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<label>Discount</label>
|
<label>Discount</label>
|
||||||
{% if ftags.invoice_edit %}
|
{% if ftags.invoice_edit %}
|
||||||
<input type="number" id="invoice-discount" name="invoice_discount" class="form-control m-input min = "0" max="60" value="{{ obj.getInvoice ? obj.getInvoice.getDiscount }}">
|
<select class="form-control m-input" id="invoice-discount" name="invoice_discount">
|
||||||
|
<option value=""></option>
|
||||||
|
{% for discount in discounts %}
|
||||||
|
{% if obj.getInvoice %}
|
||||||
|
<option value="{{ discount }}"{{ obj.getInvoice.getDiscount|number_format(0) == discount ? ' selected' }}>{{ discount }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ discount }}">{{ discount }}</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
<div class="form-control-feedback hide" data-field="invoice_discount"></div>
|
<div class="form-control-feedback hide" data-field="invoice_discount"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="number" id="invoice-discount" name="invoice_discount" class="form-control m-input min="0" max="60" value="{{ obj.getInvoice ? obj.getInvoice.getDiscount }}" disabled>
|
<select class="form-control m-input" id="invoice-discount" name="invoice_discount">
|
||||||
|
<option value=""></option>
|
||||||
|
{% for discount in discounts %}
|
||||||
|
{% if obj.getInvoice %}
|
||||||
|
<option value="{{ discount }}"{{ obj.getInvoice.getDiscount == discount ? ' selected' }} disabled>{{ discount }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ discount }}" disabled>{{ discount }}</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
|
|
@ -1162,6 +1180,28 @@ $(function() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check date schedule if it's earlier
|
||||||
|
// if so, show an alert to let user know
|
||||||
|
var date_time = $('#date-schedule-date').val() + ' ' + $('#date-schedule-time').val()
|
||||||
|
var date_schedule = new Date(date_time);
|
||||||
|
var current_date = new Date();
|
||||||
|
|
||||||
|
if (date_schedule < current_date)
|
||||||
|
{
|
||||||
|
//swal({
|
||||||
|
// title: 'Warning!',
|
||||||
|
// text: 'Schedule date and time is after today\'s date and time. Continue submission?',
|
||||||
|
// type: 'warning',
|
||||||
|
// showCancelButton: true,
|
||||||
|
//}).then(function(isConfirm) {
|
||||||
|
// if (isConfirm) {
|
||||||
|
// return true;
|
||||||
|
// } else {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
|
||||||
form_in_process = true;
|
form_in_process = true;
|
||||||
|
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
|
|
@ -1542,7 +1582,7 @@ $(function() {
|
||||||
|
|
||||||
// update invoice when promo is changed
|
// update invoice when promo is changed
|
||||||
$("#invoice-discount").change(function() {
|
$("#invoice-discount").change(function() {
|
||||||
generateInvoice();
|
generateInvoice();
|
||||||
});
|
});
|
||||||
|
|
||||||
// trigger update when service type is changed
|
// trigger update when service type is changed
|
||||||
|
|
|
||||||
|
|
@ -404,10 +404,28 @@
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<label>Discount</label>
|
<label>Discount</label>
|
||||||
{% if ftags.invoice_edit %}
|
{% if ftags.invoice_edit %}
|
||||||
<input type="number" id="invoice-discount" name="invoice_discount" class="form-control m-input min = "0" max="60" value="{{ obj.getInvoice ? obj.getInvoice.getDiscount }}">
|
<select class="form-control m-input" id="invoice-discount" name="invoice_discount">
|
||||||
|
<option value=""></option>
|
||||||
|
{% for discount in discounts %}
|
||||||
|
{% if obj.getInvoice %}
|
||||||
|
<option value="{{ discount }}"{{ obj.getInvoice.getDiscount|number_format(0) == discount ? ' selected' }}>{{ discount }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ discount }}">{{ discount }}</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
<div class="form-control-feedback hide" data-field="invoice_discount"></div>
|
<div class="form-control-feedback hide" data-field="invoice_discount"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="number" id="invoice-discount" name="invoice_discount" class="form-control m-input min="0" max="60" value="{{ obj.getInvoice ? obj.getInvoice.getDiscount }}" disabled>
|
<select class="form-control m-input" id="invoice-discount" name="invoice_discount">
|
||||||
|
<option value=""></option>
|
||||||
|
{% for discount in discounts %}
|
||||||
|
{% if obj.getInvoice %}
|
||||||
|
<option value="{{ discount }}"{{ obj.getInvoice.getDiscount == discount ? ' selected' }} disabled>{{ discount }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ discount }}" disabled>{{ discount }}</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue