2022-01-29 00:00:11 +03:00
|
|
|
import $ from 'jquery';
|
2021-10-16 20:28:04 +03:00
|
|
|
import {initCompLabelEdit} from './comp/LabelEdit.js';
|
2023-02-19 07:06:14 +03:00
|
|
|
import {hideElem, showElem} from '../utils/dom.js';
|
2021-10-16 20:28:04 +03:00
|
|
|
|
|
|
|
export function initCommonOrganization() {
|
|
|
|
if ($('.organization').length === 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($('.organization.settings.options').length > 0) {
|
|
|
|
$('#org_name').on('keyup', function () {
|
|
|
|
const $prompt = $('#org-name-change-prompt');
|
|
|
|
const $prompt_redirect = $('#org-name-change-redirect-prompt');
|
|
|
|
if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) {
|
2023-02-19 07:06:14 +03:00
|
|
|
showElem($prompt);
|
|
|
|
showElem($prompt_redirect);
|
2021-10-16 20:28:04 +03:00
|
|
|
} else {
|
2023-02-19 07:06:14 +03:00
|
|
|
hideElem($prompt);
|
|
|
|
hideElem($prompt_redirect);
|
2021-10-16 20:28:04 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Labels
|
|
|
|
initCompLabelEdit('.organization.settings.labels');
|
|
|
|
}
|