1434 |
ariadna |
1 |
$('#id_customfield_courseeventscheckavailability').on('change', function(event) {
|
|
|
2 |
if($('#id_customfield_courseeventscheckavailability').is(':checked')){
|
|
|
3 |
$('#id_customfield_courseeventscheckdateavailability').removeAttr('disabled');
|
|
|
4 |
$('#id_customfield_courseeventscheckgroupavailability').removeAttr('disabled');
|
|
|
5 |
}
|
|
|
6 |
else{
|
|
|
7 |
$('#id_customfield_courseeventscheckdateavailability').attr('disabled', 'disabled');
|
|
|
8 |
$('#id_customfield_courseeventscheckgroupavailability').attr('disabled', 'disabled');
|
|
|
9 |
}
|
|
|
10 |
});
|
|
|
11 |
|
|
|
12 |
function initCheckAvailability(state){
|
|
|
13 |
if(!state){
|
|
|
14 |
$('#id_customfield_courseeventscheckdateavailability').attr('disabled', 'disabled');
|
|
|
15 |
$('#id_customfield_courseeventscheckgroupavailability').attr('disabled', 'disabled');
|
|
|
16 |
}
|
|
|
17 |
}
|
|
|
18 |
|
|
|
19 |
function initModuleCheckAvailability(state, dateElement, groupElement){
|
|
|
20 |
if(!state){
|
|
|
21 |
$(dateElement).attr('disabled', 'disabled');
|
|
|
22 |
$(groupElement).attr('disabled', 'disabled');
|
|
|
23 |
}
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
// Champs de fusion.
|
|
|
27 |
const allChampsFusion = document.querySelectorAll(
|
|
|
28 |
"table.merge-fields td:first-child"
|
|
|
29 |
);
|
|
|
30 |
|
|
|
31 |
allChampsFusion.forEach((champsFusion) => {
|
|
|
32 |
champsFusion.style.cursor = "pointer";
|
|
|
33 |
champsFusion.addEventListener("click", (e) => {
|
|
|
34 |
$(".copyAlert").remove();
|
|
|
35 |
const textTocopy = champsFusion.innerHTML;
|
|
|
36 |
const alertContainer = document.createElement("span");
|
|
|
37 |
alertContainer.append(M.str.local_moofactory_notification.copied);
|
|
|
38 |
alertContainer.classList.add("copyAlert");
|
|
|
39 |
|
|
|
40 |
$(champsFusion).append($(alertContainer));
|
|
|
41 |
$(alertContainer).fadeIn(200);
|
|
|
42 |
|
|
|
43 |
setTimeout(() => {
|
|
|
44 |
$(alertContainer).fadeOut(200, function() {
|
|
|
45 |
$(this).remove();
|
|
|
46 |
});
|
|
|
47 |
}, 1000);
|
|
|
48 |
navigator.clipboard.writeText(textTocopy);
|
|
|
49 |
});
|
|
|
50 |
});
|
|
|
51 |
|
|
|
52 |
const style = document.createElement("style");
|
|
|
53 |
document.head.appendChild(style);
|
|
|
54 |
style.sheet.insertRule(`
|
|
|
55 |
.copyAlert {
|
|
|
56 |
display: none;
|
|
|
57 |
color: #fff;
|
|
|
58 |
background: #4BB543;
|
|
|
59 |
border-radius: 5px;
|
|
|
60 |
margin-left: 0.3em;
|
|
|
61 |
padding: 2px 5px;
|
|
|
62 |
position: relative;
|
|
|
63 |
}
|
|
|
64 |
`);
|