annotate resources/views/clients/index.blade.php @ 2:90296614b7e2 default tip

Adding in the base for the clients table
author luka
date Thu, 28 Aug 2025 20:55:40 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
1 <x-app-layout>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
2 <x-slot name="header">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
3 <h2 class="fw-semibold fs-4 text-dark">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
4 All {{ Str::plural(ucfirst('client')) }}
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
5 </h2>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
6 </x-slot>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
7
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
8 <div class="py-5">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
9 <div class="container">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
10 <div class="bg-white shadow-sm rounded p-4">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
11 <div class="d-flex align-items-center justify-content-between mb-3">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
12 <a href="{{ route('clients.create') }}" class="btn btn-primary">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
13 + New {{ ucfirst('client') }}
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
14 </a>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
15 </div>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
16 <div id="my-table"></div>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
17 </div>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
18 </div>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
19 </div>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
20
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
21 @include('includes.ServerTable')
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
22 @pushOnce('scripts')
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
23 <meta name="csrf-token" content="{{ csrf_token() }}">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
24 @endpushOnce
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
25 <script>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
26 document.addEventListener('DOMContentLoaded', function() {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
27 const el = document.getElementById('my-table');
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
28 if (el) {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
29 new ServerTable(el, {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
30 endpoint: '/clients/get_data',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
31 columns: [
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
32 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
33 name: 'name',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
34 label: 'Name',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
35 class: 'p-2'
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
36 },
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
37
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
38 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
39 name: 'email',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
40 label: 'Email',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
41 class: 'p-2'
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
42 },
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
43
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
44 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
45 name: 'phone_number',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
46 label: 'Phone Number',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
47 class: 'p-2'
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
48 },
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
49
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
50 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
51 name: 'address',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
52 label: 'Address',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
53 class: 'p-2'
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
54 },
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
55
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
56 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
57 name: 'notes',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
58 label: 'Notes',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
59 class: 'p-2'
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
60 },
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
61
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
62 {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
63 name: 'actions',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
64 label: ' ',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
65 render: function(row, col, i) {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
66 let actions = `
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
67 <div class="d-flex gap-2">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
68 <a href="{{ route('clients.show', 'PLACEHOLDER') }}" class="text-primary">View</a>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
69 <a href="{{ route('clients.edit', 'PLACEHOLDER') }}" class="text-warning">Edit</a>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
70 <form action="{{ route('clients.destroy', 'PLACEHOLDER') }}" method="POST"
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
71 class="d-inline">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
72 @csrf
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
73 @method('DELETE')
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
74 <button type="submit" class="btn btn-link text-danger p-0"
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
75 onclick="return confirm('Delete?')">Delete</button>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
76 </form>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
77 </div>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
78 `;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
79 actions = actions.split('PLACEHOLDER').join(row.id);
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
80 return actions;
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
81 }
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
82 }
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
83 ],
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
84 pageSize: 10,
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
85 initialSort: [{
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
86 col: 'created_at',
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
87 dir: 'desc'
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
88 }],
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
89 headers: {
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
90 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute(
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
91 'content')
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
92 },
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
93 skeleton: `
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
94 <div class="st-table-container">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
95 <table class="table table-hover">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
96 <thead>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
97 </thead>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
98 <tbody>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
99 <!-- Data rows will go here -->
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
100 </tbody>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
101 </table>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
102 <div class="st-controls">
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
103 <span class="st-pagination"></span>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
104 <span class="st-status"></span>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
105 </div>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
106 </div>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
107 `
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
108 });
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
109 }
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
110 });
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
111 </script>
90296614b7e2 Adding in the base for the clients table
luka
parents:
diff changeset
112 </x-app-layout>