Integrated availabilities type in backend section (#185).

This commit is contained in:
Alex Tselegidis 2016-07-20 21:19:52 +02:00
parent c9b6153df5
commit 29a694e5de
4 changed files with 25 additions and 1 deletions

View file

@ -81,5 +81,8 @@ define('ANY_PROVIDER', 'any-provider');
define('CALENDAR_VIEW_DEFAULT', 'default');
define('CALENDAR_VIEW_TABLE', 'table');
define('AVAILABILITIES_TYPE_FLEXIBLE', 'flexible');
define('AVAILABILITIES_TYPE_FIXED', 'fixed');
/* End of file constants.php */
/* Location: ./application/config/constants.php */

View file

@ -135,6 +135,13 @@ class Services_Model extends CI_Model {
}
}
// Availabilities type must have the correct value.
if ($service['availabilities_type'] !== NULL && $service['availabilities_type'] !== AVAILABILITIES_TYPE_FLEXIBLE
&& $service['availabilities_type'] !== AVAILABILITIES_TYPE_FIXED) {
throw new Exception('Service availabilities type must be either ' . AVAILABILITIES_TYPE_FLEXIBLE
. ' or ' . AVAILABILITIES_TYPE_FIXED . ' (given ' . $service['availabilities_type'] . ')');
}
return TRUE;
}

View file

@ -119,6 +119,18 @@
<select id="service-category" class="form-control"></select>
</div>
<div class="form-group">
<label for="service-availabilities-type"><?php echo $this->lang->line('availabilities_type'); ?></label>
<select id="service-availabilities-type" class="form-control">
<option value="<?php echo AVAILABILITIES_TYPE_FLEXIBLE; ?>">
<?php echo $this->lang->line('flexible'); ?>
</option>
<option value="<?php echo AVAILABILITIES_TYPE_FIXED; ?>">
<?php echo $this->lang->line('fixed'); ?>
</option>
</select>
</div>
<div class="form-group">
<label for="service-description"><?php echo $this->lang->line('description'); ?></label>
<textarea id="service-description" rows="4" class="form-control"></textarea>

View file

@ -112,7 +112,8 @@
duration: $('#service-duration').val(),
price: $('#service-price').val(),
currency: $('#service-currency').val(),
description: $('#service-description').val()
description: $('#service-description').val(),
availabilities_type: $('#service-availabilities-type').val()
};
if ($('#service-category').val() !== 'null') {
@ -277,6 +278,7 @@
$('#service-price').val(service.price);
$('#service-currency').val(service.currency);
$('#service-description').val(service.description);
$('#service-availabilities-type').val(service.availabilities_type);
var categoryId = (service.id_service_categories !== null) ? service.id_service_categories : 'null';
$('#service-category').val(categoryId);