Fixed up editing/creating
This commit is contained in:
parent
2238a52c40
commit
29f1eb3503
@ -307,7 +307,7 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix'])
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4><?php echo $hesklang['basicProperties']; ?></h4>
|
||||
<h4><?php echo $hesklang['cat_name_description']; ?></h4>
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-5 control-label"><?php echo $hesklang['cat_name']; ?></label>
|
||||
<div class="col-sm-7">
|
||||
@ -382,7 +382,7 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix'])
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h4>PROPERTIES [!]</h4>
|
||||
<h4><?php echo $hesklang['basicProperties']; ?></h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
@ -441,11 +441,19 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix'])
|
||||
<label for="type" class="col-sm-5 control-label">
|
||||
<?php echo $hesklang['visibility']; ?>
|
||||
</label>
|
||||
<div class="col-sm-7">
|
||||
<select name="type" class="form-control">
|
||||
<option value="0"><?php echo $hesklang['cat_public']; ?></option>
|
||||
<option value="1"><?php echo $hesklang['cat_private']; ?></option>
|
||||
</select>
|
||||
<div class="col-sm-7 form-inline">
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="type" value="0">
|
||||
<?php echo $hesklang['cat_public']; ?>
|
||||
</label>
|
||||
</div><br>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="type" value="1" checked>
|
||||
<?php echo $hesklang['cat_private']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -146,8 +146,8 @@ function bindEditModal() {
|
||||
var element = categories[$(this).parent().parent().find('[data-property="id"]').text()];
|
||||
var $modal = $('#category-modal');
|
||||
|
||||
$modal.find('#title-edit-category').show();
|
||||
$modal.find('#title-add-category').hide();
|
||||
$modal.find('#edit-label').show();
|
||||
$modal.find('#create-label').hide();
|
||||
|
||||
$modal.find('input[name="name"]').val(element.name).end()
|
||||
.find('select[name="priority"]').val(element.priority).end()
|
||||
@ -183,7 +183,8 @@ function bindEditModal() {
|
||||
$modal.find('input[name="cat-order"]').val(element.catOrder);
|
||||
$modal.find('input[name="autoassign"][value="' + (element.autoAssign ? 1 : 0) + '"]')
|
||||
.prop('checked', 'checked');
|
||||
$modal.find('input[name="type"][value="' + (element.type ? 1 : 0) + '"]');
|
||||
$modal.find('input[name="type"][value="' + (element.type ? 1 : 0) + '"]')
|
||||
.prop('checked', 'checked');
|
||||
$modal.find('textarea[name="description"]').val(element.description === null ? '' : element.description);
|
||||
|
||||
$modal.modal('show');
|
||||
@ -250,7 +251,7 @@ function bindFormSubmit() {
|
||||
foregroundColor: $modal.find('input[name="foreground-color"]').val() === '' ? 'AUTO' : $modal.find('input[name="foreground-color"]').val(),
|
||||
name: $modal.find('input[name="name"]').val(),
|
||||
priority: parseInt($modal.find('select[name="priority"]').val()),
|
||||
type: parseInt($modal.find('input[name="type"]').val()),
|
||||
type: parseInt($modal.find('input[name="type"]:checked').val()),
|
||||
usage: parseInt($modal.find('select[name="usage"]').val()),
|
||||
catOrder: parseInt($modal.find('input[name="cat-order"]').val())
|
||||
};
|
||||
@ -258,7 +259,7 @@ function bindFormSubmit() {
|
||||
var url = heskUrl + 'api/index.php/v1/categories/';
|
||||
var method = 'POST';
|
||||
|
||||
var categoryId = $modal.find('input[name="id"]').val();
|
||||
var categoryId = parseInt($modal.find('input[name="id"]').val());
|
||||
if (categoryId !== -1) {
|
||||
url += categoryId;
|
||||
method = 'PUT';
|
||||
@ -324,19 +325,18 @@ function bindDeleteButton() {
|
||||
}
|
||||
|
||||
function bindGenerateLinkModal() {
|
||||
$(document).on('click', '[data-property="generate-link"] i.fa-code', function () {
|
||||
|
||||
var $modal = $('#generate-link-modal');
|
||||
|
||||
$modal.find('.input-group-addon').click(function() {
|
||||
clipboard.copy($modal.find('input[type="text"]').val());
|
||||
mfhAlert.success('Copied to clipboard', 'Success');
|
||||
});
|
||||
|
||||
$(document).on('click', '[data-property="generate-link"] i.fa-code', function () {
|
||||
var heskUrl = $('p#hesk-url').text();
|
||||
|
||||
var url = heskUrl + '/index.php?a=add&catid=' + $(this).parent().data('category-id');
|
||||
|
||||
$modal.find('input[type="text"]').val(url).end()
|
||||
.find('.input-group-addon').click(function() {
|
||||
clipboard.copy($modal.find('input[type="text"]').val());
|
||||
mfhAlert.success('Copied to clipboard', 'Success');
|
||||
}).end()
|
||||
.modal('show');
|
||||
$modal.find('input[type="text"]').val(url).end().modal('show');
|
||||
});
|
||||
}
|
@ -2176,6 +2176,7 @@ $hesklang['an_error_occurred'] = 'An error occurred. Check the logs for more inf
|
||||
$hesklang['error_deleting_category'] = 'An error occurred when trying to delete the category.';
|
||||
$hesklang['cat_private'] = 'Private';
|
||||
$hesklang['cat_public'] = 'Public';
|
||||
$hesklang['cat_name_description'] = 'Name / Description';
|
||||
|
||||
// DO NOT CHANGE BELOW
|
||||
if (!defined('IN_SCRIPT')) die('PHP syntax OK!');
|
||||
|
Loading…
x
Reference in New Issue
Block a user