Added attendants number setting in backend services page (#109).

This commit is contained in:
Alex Tselegidis 2016-07-21 20:33:43 +02:00
parent b873fc92ee
commit 081f916bf5
4 changed files with 19 additions and 6 deletions

View file

@ -142,6 +142,12 @@ class Services_Model extends CI_Model {
. ' or ' . AVAILABILITIES_TYPE_FIXED . ' (given ' . $service['availabilities_type'] . ')');
}
if ($service['attendants_number'] !== NULL && (!is_numeric($service['attendants_number'])
|| $service['attendants_number'] < 1)) {
throw new Exception('Service attendants number must be numeric and greater or equal to one: '
. $service['attendants_number']);
}
return TRUE;
}

View file

@ -131,6 +131,11 @@
</select>
</div>
<div class="form-group">
<label for="service-attendants-number"><?php echo $this->lang->line('attendants_number'); ?> *</label>
<input type="text" id="service-attendants-number" class="form-control required" />
</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

@ -47,8 +47,8 @@ window.BackendServices = window.BackendServices || {};
});
$('#service-category').append(new Option('- ' + EALang['no_category'] + ' -', null)).val('null');
$('#service-duration').spinner({
min: 0,
$('#service-duration, #service-attendants-number').spinner({
min: 1,
disabled: true // default
});

View file

@ -84,7 +84,7 @@
$('#services .save-cancel-group').show();
$('#services .record-details').find('input, textarea').prop('readonly', false);
$('#services .record-details').find('select').prop('disabled', false);
$('#service-duration').spinner('enable');
$('#service-duration, #service-attendants-number').spinner('enable');
$('#filter-services button').prop('disabled', true);
$('#filter-services .results').css('color', '#AAA');
@ -113,7 +113,8 @@
price: $('#service-price').val(),
currency: $('#service-currency').val(),
description: $('#service-description').val(),
availabilities_type: $('#service-availabilities-type').val()
availabilities_type: $('#service-availabilities-type').val(),
attendants_number: $('#service-attendants-number').val()
};
if ($('#service-category').val() !== 'null') {
@ -141,7 +142,7 @@
$('#services .save-cancel-group').show();
$('#services .record-details').find('input, textarea').prop('readonly', false);
$('#services .record-details select').prop('disabled', false);
$('#service-duration').spinner('enable');
$('#service-duration, #service-attendants-number').spinner('enable');
$('#filter-services button').prop('disabled', true);
$('#filter-services .results').css('color', '#AAA');
@ -259,7 +260,7 @@
$('#edit-service, #delete-service').prop('disabled', true);
$('#services .record-details').find('input, textarea').prop('readonly', true);
$('#service-category').prop('disabled', true);
$('#service-duration').spinner('disable');
$('#service-duration, #service-attendants-number').spinner('disable');
$('#filter-services .selected').removeClass('selected');
$('#filter-services button').prop('disabled', false);
@ -279,6 +280,7 @@
$('#service-currency').val(service.currency);
$('#service-description').val(service.description);
$('#service-availabilities-type').val(service.availabilities_type);
$('#service-attendants-number').val(service.attendants_number);
var categoryId = (service.id_service_categories !== null) ? service.id_service_categories : 'null';
$('#service-category').val(categoryId);