Merged pull request #260 - Add 'Location' option to Services [Not a required field]

This commit is contained in:
alext 2019-06-08 17:03:32 +02:00
parent 52e17063b7
commit 44cd035448
5 changed files with 19 additions and 20 deletions

View file

@ -482,26 +482,8 @@ class Appointments extends CI_Controller {
$provider = $this->providers_model->get_row($appointment['id_users_provider']);
$service = $this->services_model->get_row($appointment['id_services']);
if (empty($appointment['location'])) {
$location = [];
if (!empty($provider['address'])) {
$location[] = $provider['address'];
}
if (!empty($provider['city'])) {
$location[] = $provider['city'];
}
if (!empty($provider['state'])) {
$location[] = $provider['state'];
}
if (!empty($provider['zip_code'])) {
$location[] = $provider['zip_code'];
}
$appointment['location'] = implode(', ', $location);
if (empty($appointment['location']) && !empty($service['location'])) {
$appointment['location'] = $service['location'];
}
$customer_id = $this->customers_model->add($customer);

View file

@ -133,6 +133,11 @@
<input id="service-attendants-number" class="form-control required" type="number" min="1">
</div>
<div class="form-group">
<label for="service-location"><?= lang('location') ?></label>
<input id="service-location" class="form-control">
</div>
<div class="form-group">
<label for="service-description"><?= lang('description') ?></label>
<textarea id="service-description" rows="4" class="form-control"></textarea>

View file

@ -121,6 +121,7 @@
price: $('#service-price').val(),
currency: $('#service-currency').val(),
description: $('#service-description').val(),
location: $('#service-location').val(),
availabilities_type: $('#service-availabilities-type').val(),
attendants_number: $('#service-attendants-number').val()
};
@ -288,6 +289,7 @@
$('#service-price').val(service.price);
$('#service-currency').val(service.currency);
$('#service-description').val(service.description);
$('#service-location').val(service.location);
$('#service-availabilities-type').val(service.availabilities_type);
$('#service-attendants-number').val(service.attendants_number);

View file

@ -681,6 +681,10 @@ window.FrontendBook = window.FrontendBook || {};
html += '[' + EALang.price + ' ' + service.price + ' ' + service.currency + ']';
}
if (service.location != '' && service.location != null) {
html += '[' + EALang.location + ' ' + service.location + ']';
}
html += '<br>';
return false;

View file

@ -33,6 +33,7 @@ class Services implements ParsersInterface {
'price' => (float)$response['price'],
'currency' => $response['currency'],
'description' => $response['description'],
'location' => $response['location'],
'availabilitiesType' => $response['availabilities_type'],
'attendantsNumber' => (int)$response['attendants_number'],
'categoryId' => $response['id_service_categories'] !== NULL ? (int)$response['id_service_categories'] : NULL
@ -81,6 +82,11 @@ class Services implements ParsersInterface {
$decodedRequest['description'] = $request['description'];
}
if ( ! empty($request['location']))
{
$decodedRequest['location'] = $request['location'];
}
if ( ! empty($request['availabilitiesType']))
{
$decodedRequest['availabilities_type'] = $request['availabilitiesType'];