Skip to content

Commit

Permalink
change update task
Browse files Browse the repository at this point in the history
  • Loading branch information
jggj21 authored Aug 29, 2024
1 parent 4cf97f9 commit fa2ef29
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions resources/views/tasks.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<div class="modal fade" id="editTaskModal" tabindex="-1" role="dialog" aria-labelledby="editTaskModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form id="editTaskForm" method="POST" enctype="multipart/form-data" action="{{ route('task.update', ['id' => '']) }}">
<form id="editTaskForm" method="POST" enctype="multipart/form-data" action="">
{{ csrf_field() }}
@method('PUT')

Expand Down Expand Up @@ -196,22 +196,19 @@
});
const editTaskModal = document.getElementById('editTaskModal');
const editButtons = document.querySelectorAll('.edit-task-btn');
function updateModalContent(event) {
const button = event.relatedTarget;
const taskId = button.getAttribute('data-task-id');
const taskName = button.getAttribute('data-task-name');
const taskFile = button.getAttribute('data-task-file');
const modal = editTaskModal;
document.getElementById('editTaskModal').addEventListener('show.bs.modal', function (event) {
var button = event.relatedTarget;
var taskId = button.getAttribute('data-task-id');
var taskName = button.getAttribute('data-task-name');
var taskFile = button.getAttribute('data-task-file');
var modal = document.getElementById('editTaskModal');
modal.querySelector('#editTaskId').value = taskId;
modal.querySelector('#editTaskName').value = taskName;
}
editTaskModal.addEventListener('show.bs.modal', updateModalContent);
modal.querySelector('#editTaskName').value = taskName;
var form = modal.querySelector('#editTaskForm');
form.action = '/task/' + taskId;
});
});
</script>
@endsection

0 comments on commit fa2ef29

Please sign in to comment.