Revize 5b4bc51b
Přidáno uživatelem Ondřej Anděl před více než 3 roky(ů)
application/view/modals/editUserModal.html | ||
---|---|---|
23 | 23 |
<input type="password" class="min-wdth" id="password"/> |
24 | 24 |
</div> |
25 | 25 |
</div> |
26 |
<div class="row my-1"> |
|
27 |
<div class="col-xs-12 col-sm-4"> |
|
28 |
<label for="email">Email: <b class="required">*</b></label> |
|
29 |
</div> |
|
30 |
<div class="col-xs-12 col-sm-8"> |
|
31 |
<input class="min-wdth" id="email"/> |
|
32 |
</div> |
|
33 |
</div> |
|
34 | 26 |
<div class="row my-1"> |
35 | 27 |
<div class="col-xs-12 col-sm-4"> |
36 | 28 |
<label for="rights">Práva: <b class="required">*</b></label> |
... | ... | |
70 | 62 |
modal.find('#submit-but').click(() => createData(modal)); |
71 | 63 |
|
72 | 64 |
enableSubmit(modal, true); |
73 |
modal.find("#email").change(() => enableSubmit(modal, true)); |
|
74 | 65 |
modal.find("#rights").change(() => enableSubmit(modal, true)); |
75 | 66 |
modal.find("#username").change(() => enableSubmit(modal, true)); |
76 | 67 |
} else { |
... | ... | |
82 | 73 |
prefill(modal, data_obj); |
83 | 74 |
|
84 | 75 |
enableSubmit(modal, false); |
85 |
modal.find("#email").change(() => enableSubmit(modal, true)); |
|
86 | 76 |
modal.find("#rights").change(() => enableSubmit(modal, true)); |
87 | 77 |
modal.find("#username").change(() => enableSubmit(modal, true)); |
88 | 78 |
} |
... | ... | |
90 | 80 |
|
91 | 81 |
function enableSubmit(modal, createNew){ |
92 | 82 |
if( |
93 |
modal.find("#email")[0].value === "" || |
|
94 | 83 |
modal.find("#rights")[0].value === "" || |
95 | 84 |
(modal.find("#username")[0].value === "" && !createNew) |
96 | 85 |
){ |
... | ... | |
103 | 92 |
function prefill(modal, data = null){ |
104 | 93 |
modal.find("#username").val(""); |
105 | 94 |
modal.find("#password").val(""); |
106 |
modal.find("#email").val(""); |
|
107 | 95 |
modal.find("#rights").val(""); |
108 | 96 |
|
109 | 97 |
if(data !== null){ |
110 |
modal.find("#email").val(data.email); |
|
111 | 98 |
modal.find("#rights").val(data.role); |
112 | 99 |
} |
113 | 100 |
} |
... | ... | |
127 | 114 |
function prepareFormData(modal) { |
128 | 115 |
const formData = new FormData(); |
129 | 116 |
formData.append("role", modal.find("#rights")[0].value); |
130 |
formData.append("email", modal.find("#email")[0].value); |
|
131 | 117 |
|
132 | 118 |
return formData; |
133 | 119 |
} |
Také k dispozici: Unified diff
bugfix: email removal