Spaces:
Running
Running
File size: 2,355 Bytes
159f0e1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | class DataTable extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
table {
width: 100%;
border-collapse: collapse;
margin: 1rem 0;
box-shadow: 0 0 20px rgba(0,0,0,0.1);
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #4CAF50;
color: white;
position: sticky;
top: 0;
}
tr:hover {
background-color: #f5f5f5;
}
.actions {
display: flex;
gap: 5px;
}
button {
padding: 5px 10px;
border: none;
border-radius: 3px;
cursor: pointer;
}
.edit-btn {
background-color: #2196F3;
color: white;
}
.delete-btn {
background-color: #f44336;
color: white;
}
.filter-btn {
background-color: #ff9800;
color: white;
}
.search-container {
margin-bottom: 20px;
display: flex;
gap: 10px;
align-items: center;
}
.add-btn {
background-color: #4CAF50;
color: white;
padding: 8px 16px;
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
}
input[type="text"] {
padding: 8px;
width: 300px;
border: 1px solid #ddd;
border-radius: 4px;
}
</style>
<div class="search-container">
<input type="text" placeholder="Search...">
<button class="filter-btn">Filter Duplicates</button>
<button class="add-btn" id="addCustomerBtn">Add Customer</button>
</div>
<table>
<thead>
<tr>
<th>Phone</th>
<th>Customer Name</th>
<th>Facebook</th>
<th>Date</th>
<th>Report 1</th>
<th>Report 2</th>
<th>Report 3</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- Data will be inserted here -->
</tbody>
</table>
`;
}
}
customElements.define('data-table', DataTable); |