Updated confirmDeleteModal action

Updated confirmDeleteModal action
Made consistency in all the index blade files to use the component
This commit is contained in:
cp6 2022-10-20 11:56:35 +11:00
parent 9c1a853d6a
commit 7b602d3616
12 changed files with 29 additions and 79 deletions

View File

@ -8,10 +8,10 @@
showModal: false showModal: false
}, },
methods: { methods: {
modalForm(event) { confirmDeleteModal(event) {
this.showModal = true; this.showModal = true;
this.modal_hostname = event.target.id.replace('btn-', ''); this.modal_hostname = event.target.title;
this.modal_id = event.target.title; this.modal_id = event.target.id;
this.delete_form_action = '{{$uri}}/' + this.modal_id; this.delete_form_action = '{{$uri}}/' + this.modal_id;
} }
} }

View File

@ -42,8 +42,8 @@
<i class="fas fa-pen" title="edit"></i></a> <i class="fas fa-pen" title="edit"></i></a>
@csrf @csrf
@method('DELETE') @method('DELETE')
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="confirmDeleteModal"
id="btn-{{$dns->hostname}}" title="{{$dns->id}}"></i> id="{{$dns->id}}" title="{{$dns->hostname}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -48,8 +48,8 @@
<i class="fas fa-pen" title="edit"></i></a> <i class="fas fa-pen" title="edit"></i></a>
@csrf @csrf
@method('DELETE') @method('DELETE')
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="confirmDeleteModal"
id="btn-{{$domain->domain}}" title="{{$domain->id}}"></i> id="{{$domain->id}}" title="{{$domain->domain}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -41,8 +41,8 @@
<form action="{{ route('IPs.destroy', $ip->id) }}" method="POST"> <form action="{{ route('IPs.destroy', $ip->id) }}" method="POST">
@csrf @csrf
@method('DELETE') @method('DELETE')
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="confirmDeleteModal"
id="btn-{{$ip->hostname}}" title="{{$ip->id}}"></i> id="{{$ip->id}}" title="{{$ip->hostname}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -36,8 +36,8 @@
class="text-body mx-1"> class="text-body mx-1">
<i class="fas fa-eye" title="view"></i></a> <i class="fas fa-eye" title="view"></i></a>
@csrf @csrf
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="confirmDeleteModal"
id="btn-{{$label->label}}" title="{{$label->id}}"></i> id="{{$label->id}}" title="{{$label->label}}"></i>
</form> </form>
</td> </td>
</tr> </tr>
@ -75,6 +75,6 @@
}); });
</script> </script>
<x-modal-delete-script> <x-modal-delete-script>
<x-slot name="uri">locations</x-slot> <x-slot name="uri">labels</x-slot>
</x-modal-delete-script> </x-modal-delete-script>
</x-app-layout> </x-app-layout>

View File

@ -51,8 +51,8 @@
</a> </a>
@csrf @csrf
@method('DELETE') @method('DELETE')
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="confirmDeleteModal"
id="btn-{{$m->name}}" title="{{$m->id}}"></i> id="{{$m->name}}" title="{{$m->id}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -32,8 +32,8 @@
<td class="text-nowrap">{{ $o->name }}</td> <td class="text-nowrap">{{ $o->name }}</td>
<td class="text-nowrap"> <td class="text-nowrap">
<form action="{{ route('locations.destroy', $o->id) }}" method="POST"> <form action="{{ route('locations.destroy', $o->id) }}" method="POST">
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="confirmDeleteModal"
id="btn-{{$o->name}}" title="{{$o->id}}"></i> id="{{$o->id}}" title="{{$o->name}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -35,8 +35,8 @@
<a href="{{ route('providers.show', $provider->id) }}" <a href="{{ route('providers.show', $provider->id) }}"
class="text-body mx-1"> class="text-body mx-1">
<i class="fas fa-eye" title="view"></i></a> <i class="fas fa-eye" title="view"></i></a>
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="confirmDeleteModal"
id="btn-{{$provider->name}}" title="{{$provider->id}}"></i> id="{{$provider->id}}" title="{{$provider->name}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -80,23 +80,7 @@
</p> </p>
@endif @endif
</div> </div>
<script> <x-modal-delete-script>
let app = new Vue({ <x-slot name="uri">reseller</x-slot>
el: "#app", </x-modal-delete-script>
data: {
"modal_hostname": '',
"modal_id": '',
"delete_form_action": '',
showModal: false
},
methods: {
confirmDeleteModal(event) {
this.showModal = true;
this.modal_hostname = event.target.title;
this.modal_id = event.target.id;
this.delete_form_action = 'reseller/' + this.modal_id;
}
}
});
</script>
</x-app-layout> </x-app-layout>

View File

@ -101,24 +101,7 @@
v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})</small></p> v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})</small></p>
@endif @endif
</div> </div>
<x-modal-delete-script>
<script> <x-slot name="uri">seedboxes</x-slot>
let app = new Vue({ </x-modal-delete-script>
el: "#app",
data: {
"modal_hostname": '',
"modal_id": '',
"delete_form_action": '',
showModal: false
},
methods: {
confirmDeleteModal(event) {
this.showModal = true;
this.modal_hostname = event.target.title;
this.modal_id = event.target.id;
this.delete_form_action = 'seedboxes/' + this.modal_id;
}
}
});
</script>
</x-app-layout> </x-app-layout>

View File

@ -79,24 +79,7 @@
v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})</small></p> v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})</small></p>
@endif @endif
</div> </div>
<x-modal-delete-script>
<script> <x-slot name="uri">shared</x-slot>
let app = new Vue({ </x-modal-delete-script>
el: "#app",
data: {
"modal_hostname": '',
"modal_id": '',
"delete_form_action": '',
showModal: false
},
methods: {
confirmDeleteModal(event) {
this.showModal = true;
this.modal_hostname = event.target.title;
this.modal_id = event.target.id;
this.delete_form_action = 'shared/' + this.modal_id;
}
}
});
</script>
</x-app-layout> </x-app-layout>

View File

@ -64,8 +64,8 @@
<i class="fas fa-eye" title="view"></i> <i class="fas fa-eye" title="view"></i>
</a> </a>
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="confirmDeleteModal"
id="btn-{{$yab->server->hostname}}" title="{{$yab->id}}"></i> id="{{$yab->id}}" title="{{$yab->server->hostname}}"></i>
</form> </form>
</td> </td>
</tr> </tr>