fix: [equipment] API URL 경로 /api 접두사 누락 수정
- 모든 HTMX hx-get 및 fetch() URL에 /api 접두사 추가 - /admin/equipment → /api/admin/equipment 일괄 변경 - 대상: index, create, edit, show, inspections, repairs 뷰 7개 파일
This commit is contained in:
@@ -174,7 +174,7 @@ class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-6 py-2 rounded-lg transiti
|
||||
const formData = new FormData(this);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
|
||||
fetch('/admin/equipment', {
|
||||
fetch('/api/admin/equipment', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -182,7 +182,7 @@ class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-6 py-2 rounded-lg transiti
|
||||
'model_name', 'serial_no', 'location', 'production_line', 'purchase_date', 'install_date',
|
||||
'purchase_price', 'useful_life', 'status', 'manager_id', 'memo'];
|
||||
|
||||
fetch(`/admin/equipment/${equipmentId}`, {
|
||||
fetch(`/api/admin/equipment/${equipmentId}`, {
|
||||
headers: { 'Accept': 'application/json', 'X-CSRF-TOKEN': '{{ csrf_token() }}' }
|
||||
})
|
||||
.then(r => r.json())
|
||||
@@ -206,7 +206,7 @@ class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-6 py-2 rounded-lg transiti
|
||||
const formData = new FormData(this);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
|
||||
fetch(`/admin/equipment/${equipmentId}`, {
|
||||
fetch(`/api/admin/equipment/${equipmentId}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -63,7 +63,7 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none foc
|
||||
|
||||
<!-- 테이블 영역 -->
|
||||
<div id="equipment-table"
|
||||
hx-get="/admin/equipment"
|
||||
hx-get="/api/admin/equipment"
|
||||
hx-trigger="load, filterSubmit from:body"
|
||||
hx-include="#filterForm"
|
||||
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
|
||||
@@ -85,7 +85,7 @@ class="bg-white rounded-lg shadow-sm">
|
||||
|
||||
function confirmDelete(id, name) {
|
||||
showDeleteConfirm(name, () => {
|
||||
fetch(`/admin/equipment/${id}`, {
|
||||
fetch(`/api/admin/equipment/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
||||
|
||||
@@ -45,7 +45,7 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none foc
|
||||
|
||||
<!-- 점검 그리드 -->
|
||||
<div id="inspection-grid"
|
||||
hx-get="/admin/equipment/inspections"
|
||||
hx-get="/api/admin/equipment/inspections"
|
||||
hx-trigger="load, filterSubmit from:body"
|
||||
hx-include="#inspectionFilter"
|
||||
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
|
||||
@@ -65,7 +65,7 @@ class="bg-white rounded-lg shadow-sm">
|
||||
});
|
||||
|
||||
function toggleCell(equipmentId, templateItemId, checkDate, cell) {
|
||||
fetch('/admin/equipment/inspections/detail', {
|
||||
fetch('/api/admin/equipment/inspections/detail', {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -110,7 +110,7 @@ class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-6 py-2 rounded-lg transiti
|
||||
const formData = new FormData(this);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
|
||||
fetch('/admin/equipment/repairs', {
|
||||
fetch('/api/admin/equipment/repairs', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -58,7 +58,7 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none foc
|
||||
|
||||
<!-- 테이블 -->
|
||||
<div id="repair-table"
|
||||
hx-get="/admin/equipment/repairs"
|
||||
hx-get="/api/admin/equipment/repairs"
|
||||
hx-trigger="load, filterSubmit from:body"
|
||||
hx-include="#repairFilter"
|
||||
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
|
||||
@@ -80,7 +80,7 @@ class="bg-white rounded-lg shadow-sm">
|
||||
|
||||
function confirmDeleteRepair(id) {
|
||||
showDeleteConfirm('수리이력', () => {
|
||||
fetch(`/admin/equipment/repairs/${id}`, {
|
||||
fetch(`/api/admin/equipment/repairs/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
||||
|
||||
@@ -80,7 +80,7 @@ function addTemplate() {
|
||||
const formData = new FormData(form);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
|
||||
fetch(`/admin/equipment/${equipmentId}/templates`, {
|
||||
fetch(`/api/admin/equipment/${equipmentId}/templates`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -103,7 +103,7 @@ function addTemplate() {
|
||||
// 점검항목 삭제
|
||||
function deleteTemplate(id) {
|
||||
showDeleteConfirm('점검항목', () => {
|
||||
fetch(`/admin/equipment/templates/${id}`, {
|
||||
fetch(`/api/admin/equipment/templates/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}', 'Accept': 'application/json' }
|
||||
})
|
||||
@@ -120,7 +120,7 @@ function deleteTemplate(id) {
|
||||
// 수리이력 삭제
|
||||
function deleteRepair(id) {
|
||||
showDeleteConfirm('수리이력', () => {
|
||||
fetch(`/admin/equipment/repairs/${id}`, {
|
||||
fetch(`/api/admin/equipment/repairs/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}', 'Accept': 'application/json' }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user