Added calendar-view setting in the UI (#182).

This commit is contained in:
Alex Tselegidis 2016-07-18 23:46:15 +02:00
parent 9ef266b73c
commit 89725e75c0
10 changed files with 56 additions and 7 deletions

View file

@ -228,7 +228,7 @@ class Admins_Model extends CI_Model {
// Validate calendar view mode. // Validate calendar view mode.
if (isset($admin['settings']['calendar_view']) && ($admin['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT if (isset($admin['settings']['calendar_view']) && ($admin['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT
|| $admin['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE)) { && $admin['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE)) {
throw new Exception('The calendar view setting must be either "' . CALENDAR_VIEW_DEFAULT throw new Exception('The calendar view setting must be either "' . CALENDAR_VIEW_DEFAULT
. '" or "' . CALENDAR_VIEW_TABLE . '", given: ' . $admin['settings']['calendar_view']); . '" or "' . CALENDAR_VIEW_TABLE . '", given: ' . $admin['settings']['calendar_view']);
} }

View file

@ -260,7 +260,7 @@ class Providers_Model extends CI_Model {
// Validate calendar view mode. // Validate calendar view mode.
if (isset($provider['settings']['calendar_view']) && ($provider['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT if (isset($provider['settings']['calendar_view']) && ($provider['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT
|| $provider['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE)) { && $provider['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE)) {
throw new Exception('The calendar view setting must be either "' . CALENDAR_VIEW_DEFAULT throw new Exception('The calendar view setting must be either "' . CALENDAR_VIEW_DEFAULT
. '" or "' . CALENDAR_VIEW_TABLE . '", given: ' . $provider['settings']['calendar_view']); . '" or "' . CALENDAR_VIEW_TABLE . '", given: ' . $provider['settings']['calendar_view']);
} }

View file

@ -226,7 +226,7 @@ class Secretaries_Model extends CI_Model {
// Validate calendar view mode. // Validate calendar view mode.
if (isset($secretary['settings']['calendar_view']) && ($secretary['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT if (isset($secretary['settings']['calendar_view']) && ($secretary['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT
|| $secretary['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE)) { && $secretary['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE)) {
throw new Exception('The calendar view setting must be either "' . CALENDAR_VIEW_DEFAULT throw new Exception('The calendar view setting must be either "' . CALENDAR_VIEW_DEFAULT
. '" or "' . CALENDAR_VIEW_TABLE . '", given: ' . $secretary['settings']['calendar_view']); . '" or "' . CALENDAR_VIEW_TABLE . '", given: ' . $secretary['settings']['calendar_view']);
} }

View file

@ -415,6 +415,14 @@
<input type="password" id="retype-password" class="form-control" /> <input type="password" id="retype-password" class="form-control" />
</div> </div>
<div class="form-group">
<label for="calendar-view"><?php echo $this->lang->line('calendar'); ?> *</label>
<select id="calendar-view" class="form-control required">
<option value="default">Default</option>
<option value="table">Table</option>
</select>
</div>
<button type="button" id="user-notifications" class="btn btn-default" data-toggle="button"> <button type="button" id="user-notifications" class="btn btn-default" data-toggle="button">
<span class="glyphicon glyphicon-envelope"></span> <span class="glyphicon glyphicon-envelope"></span>
<?php echo $this->lang->line('receive_notifications'); ?> <?php echo $this->lang->line('receive_notifications'); ?>

View file

@ -180,6 +180,14 @@
<input type="password" id="admin-password-confirm" class="form-control required" /> <input type="password" id="admin-password-confirm" class="form-control required" />
</div> </div>
<div class="form-group">
<label for="admin-calendar-view"><?php echo $this->lang->line('calendar'); ?> *</label>
<select id="admin-calendar-view" class="form-control required">
<option value="default">Default</option>
<option value="table">Table</option>
</select>
</div>
<br> <br>
<button type="button" id="admin-notifications" class="btn btn-default" data-toggle="button"> <button type="button" id="admin-notifications" class="btn btn-default" data-toggle="button">
@ -330,6 +338,14 @@
<input type="password" id="provider-password-confirm" class="form-control required" /> <input type="password" id="provider-password-confirm" class="form-control required" />
</div> </div>
<div class="form-group">
<label for="provider-calendar-view"><?php echo $this->lang->line('calendar'); ?> *</label>
<select id="provider-calendar-view" class="form-control required">
<option value="default">Default</option>
<option value="table">Table</option>
</select>
</div>
<br> <br>
<button type="button" id="provider-notifications" class="btn btn-default" data-toggle="button"> <button type="button" id="provider-notifications" class="btn btn-default" data-toggle="button">
@ -595,6 +611,14 @@
<input type="password" id="secretary-password-confirm" class="form-control required" /> <input type="password" id="secretary-password-confirm" class="form-control required" />
</div> </div>
<div class="form-group">
<label for="secretary-calendar-view"><?php echo $this->lang->line('calendar'); ?> *</label>
<select id="secretary-calendar-view" class="form-control required">
<option value="default">Default</option>
<option value="table">Table</option>
</select>
</div>
<br> <br>
<button type="button" id="secretary-notifications" class="btn btn-default" data-toggle="button"> <button type="button" id="secretary-notifications" class="btn btn-default" data-toggle="button">

View file

@ -94,6 +94,7 @@ window.BackendSettings = window.BackendSettings || {};
$('#username').val(GlobalVariables.settings.user.settings.username); $('#username').val(GlobalVariables.settings.user.settings.username);
$('#password, #retype-password').val(''); $('#password, #retype-password').val('');
$('#calendar-view').val(GlobalVariables.settings.user.settings.calendar_view);
if (GlobalVariables.settings.user.settings.notifications == true) { if (GlobalVariables.settings.user.settings.notifications == true) {
$('#user-notifications').addClass('active'); $('#user-notifications').addClass('active');

View file

@ -40,7 +40,8 @@
notes: $('#notes').val(), notes: $('#notes').val(),
settings: { settings: {
username: $('#username').val(), username: $('#username').val(),
notifications: $('#user-notifications').hasClass('active') notifications: $('#user-notifications').hasClass('active'),
calendar_view: $('#calendar-view').val()
} }
}; };

View file

@ -85,6 +85,7 @@
$('#admins .add-edit-delete-group').hide(); $('#admins .add-edit-delete-group').hide();
$('#admins .save-cancel-group').show(); $('#admins .save-cancel-group').show();
$('#admins .record-details').find('input, textarea').prop('readonly', false); $('#admins .record-details').find('input, textarea').prop('readonly', false);
$('#admins .record-details').find('select').prop('disabled', false);
$('#admin-password, #admin-password-confirm').addClass('required'); $('#admin-password, #admin-password-confirm').addClass('required');
$('#admin-notifications').prop('disabled', false); $('#admin-notifications').prop('disabled', false);
$('#filter-admins button').prop('disabled', true); $('#filter-admins button').prop('disabled', true);
@ -98,6 +99,7 @@
$('#admins .add-edit-delete-group').hide(); $('#admins .add-edit-delete-group').hide();
$('#admins .save-cancel-group').show(); $('#admins .save-cancel-group').show();
$('#admins .record-details').find('input, textarea').prop('readonly', false); $('#admins .record-details').find('input, textarea').prop('readonly', false);
$('#admins .record-details').find('select').prop('disabled', false);
$('#admin-password, #admin-password-confirm').removeClass('required'); $('#admin-password, #admin-password-confirm').removeClass('required');
$('#admin-notifications').prop('disabled', false); $('#admin-notifications').prop('disabled', false);
@ -142,7 +144,8 @@
notes: $('#admin-notes').val(), notes: $('#admin-notes').val(),
settings: { settings: {
username: $('#admin-username').val(), username: $('#admin-username').val(),
notifications: $('#admin-notifications').hasClass('active') notifications: $('#admin-notifications').hasClass('active'),
calendar_view: $('#admin-calendar-view').val()
} }
}; };
@ -288,6 +291,7 @@
$('#admins .add-edit-delete-group').show(); $('#admins .add-edit-delete-group').show();
$('#admins .save-cancel-group').hide(); $('#admins .save-cancel-group').hide();
$('#admins .record-details').find('input, textarea').prop('readonly', true); $('#admins .record-details').find('input, textarea').prop('readonly', true);
$('#admins .record-details').find('select').prop('disabled', true);
$('#admins .form-message').hide(); $('#admins .form-message').hide();
$('#admin-notifications').prop('disabled', true); $('#admin-notifications').prop('disabled', true);
$('#admins .required').css('border', ''); $('#admins .required').css('border', '');
@ -320,6 +324,7 @@
$('#admin-notes').val(admin.notes); $('#admin-notes').val(admin.notes);
$('#admin-username').val(admin.settings.username); $('#admin-username').val(admin.settings.username);
$('#admin-calendar-view').val(admin.settings.calendar_view);
if (admin.settings.notifications == true) { if (admin.settings.notifications == true) {
$('#admin-notifications').addClass('active'); $('#admin-notifications').addClass('active');
} else { } else {

View file

@ -89,6 +89,7 @@
$('#providers .add-edit-delete-group').hide(); $('#providers .add-edit-delete-group').hide();
$('#providers .save-cancel-group').show(); $('#providers .save-cancel-group').show();
$('#providers .record-details').find('input, textarea').prop('readonly', false); $('#providers .record-details').find('input, textarea').prop('readonly', false);
$('#providers .record-details').find('select').prop('disabled', false);
$('#provider-password, #provider-password-confirm').addClass('required'); $('#provider-password, #provider-password-confirm').addClass('required');
$('#provider-notifications').prop('disabled', false); $('#provider-notifications').prop('disabled', false);
$('#providers').find('.add-break, .edit-break, .delete-break, #reset-working-plan').prop('disabled', false); $('#providers').find('.add-break, .edit-break, .delete-break, #reset-working-plan').prop('disabled', false);
@ -109,6 +110,7 @@
$('#filter-providers button').prop('disabled', true); $('#filter-providers button').prop('disabled', true);
$('#filter-providers .results').css('color', '#AAA'); $('#filter-providers .results').css('color', '#AAA');
$('#providers .record-details').find('input, textarea').prop('readonly', false); $('#providers .record-details').find('input, textarea').prop('readonly', false);
$('#providers .record-details').find('select').prop('disabled', false);
$('#provider-password, #provider-password-confirm').removeClass('required'); $('#provider-password, #provider-password-confirm').removeClass('required');
$('#provider-notifications').prop('disabled', false); $('#provider-notifications').prop('disabled', false);
$('#provider-services input[type="checkbox"]').prop('disabled', false); $('#provider-services input[type="checkbox"]').prop('disabled', false);
@ -154,7 +156,8 @@
settings: { settings: {
username: $('#provider-username').val(), username: $('#provider-username').val(),
working_plan: JSON.stringify(BackendUsers.wp.get()), working_plan: JSON.stringify(BackendUsers.wp.get()),
notifications: $('#provider-notifications').hasClass('active') notifications: $('#provider-notifications').hasClass('active'),
calendar_view: $('#provider-calendar-view').val()
} }
}; };
@ -343,6 +346,7 @@
$('#providers .save-cancel-group').hide(); $('#providers .save-cancel-group').hide();
$('#providers .record-details h3 a').remove(); $('#providers .record-details h3 a').remove();
$('#providers .record-details').find('input, textarea').prop('readonly', true); $('#providers .record-details').find('input, textarea').prop('readonly', true);
$('#providers .record-details').find('select').prop('disabled', true);
$('#providers .form-message').hide(); $('#providers .form-message').hide();
$('#provider-notifications').removeClass('active'); $('#provider-notifications').removeClass('active');
$('#provider-notifications').prop('disabled', true); $('#provider-notifications').prop('disabled', true);
@ -382,6 +386,7 @@
$('#provider-notes').val(provider.notes); $('#provider-notes').val(provider.notes);
$('#provider-username').val(provider.settings.username); $('#provider-username').val(provider.settings.username);
$('#provider-calendar-view').val(provider.settings.calendar_view);
if (provider.settings.notifications == true) { if (provider.settings.notifications == true) {
$('#provider-notifications').addClass('active'); $('#provider-notifications').addClass('active');
} else { } else {

View file

@ -91,6 +91,7 @@
$('#secretaries .add-edit-delete-group').hide(); $('#secretaries .add-edit-delete-group').hide();
$('#secretaries .save-cancel-group').show(); $('#secretaries .save-cancel-group').show();
$('#secretaries .record-details').find('input, textarea').prop('readonly', false); $('#secretaries .record-details').find('input, textarea').prop('readonly', false);
$('#secretaries .record-details').find('select').prop('disabled', false);
$('#secretary-password, #secretary-password-confirm').addClass('required'); $('#secretary-password, #secretary-password-confirm').addClass('required');
$('#secretary-notifications').prop('disabled', false); $('#secretary-notifications').prop('disabled', false);
$('#secretary-providers input[type="checkbox"]').prop('disabled', false); $('#secretary-providers input[type="checkbox"]').prop('disabled', false);
@ -105,6 +106,7 @@
$('#secretaries .add-edit-delete-group').hide(); $('#secretaries .add-edit-delete-group').hide();
$('#secretaries .save-cancel-group').show(); $('#secretaries .save-cancel-group').show();
$('#secretaries .record-details').find('input, textarea').prop('readonly', false); $('#secretaries .record-details').find('input, textarea').prop('readonly', false);
$('#secretaries .record-details').find('select').prop('disabled', false);
$('#secretary-password, #secretary-password-confirm').removeClass('required'); $('#secretary-password, #secretary-password-confirm').removeClass('required');
$('#secretary-notifications').prop('disabled', false); $('#secretary-notifications').prop('disabled', false);
$('#secretary-providers input[type="checkbox"]').prop('disabled', false); $('#secretary-providers input[type="checkbox"]').prop('disabled', false);
@ -147,7 +149,8 @@
notes: $('#secretary-notes').val(), notes: $('#secretary-notes').val(),
settings: { settings: {
username: $('#secretary-username').val(), username: $('#secretary-username').val(),
notifications: $('#secretary-notifications').hasClass('active') notifications: $('#secretary-notifications').hasClass('active'),
calendar_view: $('#secretary-calendar-view').val()
} }
}; };
@ -302,6 +305,7 @@
$('#secretaries .save-cancel-group').hide(); $('#secretaries .save-cancel-group').hide();
$('#edit-secretary, #delete-secretary').prop('disabled', true); $('#edit-secretary, #delete-secretary').prop('disabled', true);
$('#secretaries .record-details').find('input, textarea').prop('readonly', true); $('#secretaries .record-details').find('input, textarea').prop('readonly', true);
$('#secretaries .record-details').find('select').prop('disabled', true);
$('#secretaries .form-message').hide(); $('#secretaries .form-message').hide();
$('#secretary-notifications').removeClass('active'); $('#secretary-notifications').removeClass('active');
$('#secretary-notifications').prop('disabled', true); $('#secretary-notifications').prop('disabled', true);
@ -334,6 +338,7 @@
$('#secretary-notes').val(secretary.notes); $('#secretary-notes').val(secretary.notes);
$('#secretary-username').val(secretary.settings.username); $('#secretary-username').val(secretary.settings.username);
$('#secretary-calendar-view').val(secretary.settings.calendar_view);
if (secretary.settings.notifications == true) { if (secretary.settings.notifications == true) {
$('#secretary-notifications').addClass('active'); $('#secretary-notifications').addClass('active');
} else { } else {