|
4 | 4 | <div class="modal-content">
|
5 | 5 | <h2>Update work log</h2>
|
6 | 6 | <form class="modal-form" id="modal-form-update" method="PUT" action="{{ endpoint }}">
|
7 |
| - <input type="hidden" name="workLogId-update" value=""> |
| 7 | + <input type="hidden" name="worklogid-update" value=""> |
8 | 8 | <input type="hidden" name="start-update" value="">
|
9 | 9 | <input type="hidden" name="duration-update" value="">
|
10 | 10 | <label for="issue-update">Issue:</label>
|
|
27 | 27 | // Show the modal when needed
|
28 | 28 | function showUpdateModal(eventObj) {
|
29 | 29 | hideCreateModal();
|
| 30 | + |
30 | 31 | const workLogId = eventObj.extendedProps.worklogId;
|
31 | 32 | const issueId = eventObj.extendedProps.issueId;
|
32 |
| - const workLogIdInput = document.querySelector('input[name="workLogId-update"]'); |
| 33 | + console.log(workLogId + " " + issueId); |
| 34 | + const workLogIdInput = document.querySelector('input[name="worklogid-update"]'); |
33 | 35 | workLogIdInput.value = workLogId;
|
34 | 36 |
|
35 | 37 | const startInput = document.querySelector('input[name="start-update"]');
|
|
54 | 56 | function handleUpdateSubmit(event) {
|
55 | 57 | showLoading();
|
56 | 58 | event.preventDefault();
|
57 |
| - const form = document.getElementById('modal-form-update'); |
58 |
| - const formData = new FormData(form); |
59 | 59 |
|
60 | 60 | const reqBody = {
|
61 |
| - issueId: formData.get("issue-update"), |
62 |
| - comment: formData.get("comment-update"), |
63 |
| - start: formData.get("start-update"), |
64 |
| - duration: formData.get("duration-update") |
| 61 | + issueId: document.querySelector("input[name=issue-update]").value, |
| 62 | + comment: document.getElementById('comment-update').value, |
| 63 | + start: document.querySelector("input[name=start-update]").value, |
| 64 | + duration: document.querySelector("input[name=duration-update]").value |
65 | 65 | };
|
66 |
| - return fetch('{{ endpoint }}' +formData.get("workLogId-update"), { |
| 66 | + return fetch('{{ endpoint }}' +document.querySelector("input[name=worklogid-update]").value, { |
67 | 67 | method: 'PUT',
|
68 | 68 | headers: {
|
69 | 69 | 'Content-Type': 'application/json'
|
|
87 | 87 | function handleUpdateDelete(event) {
|
88 | 88 | showLoading();
|
89 | 89 | event.preventDefault();
|
90 |
| - const form = document.getElementById('modal-form-update'); |
91 |
| - const formData = new FormData(form); |
92 | 90 |
|
93 | 91 | if (confirm('Are you sure you want to delete this work log ?')) {
|
94 |
| - return fetch('{{ endpoint }}' + formData.get("workLogId-update") + '?issueId=' + formData.get("issue-update"), { |
| 92 | + return fetch('{{ endpoint }}' + document.querySelector("input[name=worklogid-update]").value + '?issueId=' + document.querySelector("input[name=issue-update]").value, { |
95 | 93 | method: 'DELETE',
|
96 | 94 | })
|
97 | 95 | .then(response => {
|
|
0 commit comments