kaoshaos commited on
Commit
74e1ba8
·
verified ·
1 Parent(s): a6ca940

удали все давай начнем заново

Browse files
Files changed (4) hide show
  1. components/navbar.js +6 -27
  2. index.html +7 -51
  3. script.js +2 -206
  4. style.css +3 -95
components/navbar.js CHANGED
@@ -3,35 +3,14 @@ class CustomNavbar extends HTMLElement {
3
  this.attachShadow({ mode: 'open' });
4
  this.shadowRoot.innerHTML = `
5
  <style>
6
- .navbar {
7
- @apply bg-white border-b border-gray-200 fixed w-full z-10;
8
- height: 60px;
9
- }
10
- .search-input {
11
- @apply block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm;
12
  }
13
  </style>
14
- <nav class="navbar px-4 flex items-center justify-between">
15
- <div class="flex items-center">
16
- <button id="sidebarToggle" class="mr-4 text-gray-500 hover:text-gray-600">
17
- <i data-feather="menu"></i>
18
- </button>
19
- <div class="relative">
20
- <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
21
- <i data-feather="search" class="h-4 w-4 text-gray-400"></i>
22
- </div>
23
- <input type="text" class="search-input" placeholder="Search deals, clients, suppliers...">
24
- </div>
25
- </div>
26
- <div class="flex items-center space-x-4">
27
- <button class="p-1 text-gray-400 hover:text-gray-500">
28
- <i data-feather="bell"></i>
29
- </button>
30
- <div class="flex items-center">
31
- <img class="h-8 w-8 rounded-full" src="http://static.photos/people/200x200/3" alt="User avatar">
32
- <span class="ml-2 text-sm font-medium text-gray-700">Admin</span>
33
- </div>
34
- </div>
35
  </nav>
36
  `;
37
  }
 
3
  this.attachShadow({ mode: 'open' });
4
  this.shadowRoot.innerHTML = `
5
  <style>
6
+ nav {
7
+ background: white;
8
+ padding: 1rem;
9
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
 
 
10
  }
11
  </style>
12
+ <nav>
13
+ <h2 class="text-xl font-bold">DealFlow Tracker</h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  </nav>
15
  `;
16
  }
index.html CHANGED
@@ -3,61 +3,17 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>DealFlow Tracker - Sales Management</title>
7
  <link rel="stylesheet" href="style.css">
8
  <script src="https://cdn.tailwindcss.com"></script>
9
- <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
- <script src="https://unpkg.com/feather-icons"></script>
11
- <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
12
- <script src="components/navbar.js"></script>
13
- <script src="components/sidebar.js"></script>
14
- <script src="components/quick-stats.js"></script>
15
- <script src="components/recent-deals.js"></script>
16
- <script src="components/sales-chart.js"></script>
17
- <script src="components/product-table.js"></script>
18
- <script src="components/client-card.js"></script>
19
  </head>
20
- <body class="bg-gray-50">
21
- <custom-navbar></custom-navbar>
22
- <div class="flex">
23
- <custom-sidebar></custom-sidebar>
24
-
25
- <main class="flex-1 p-8">
26
- <h1 class="text-3xl font-bold text-gray-800 mb-6">Dashboard</h1>
27
-
28
- <custom-quick-stats></custom-quick-stats>
29
-
30
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mt-8">
31
- <div class="bg-white rounded-lg shadow p-6">
32
- <div class="flex justify-between items-center mb-4">
33
- <h2 class="text-xl font-semibold text-gray-700">Sales Statistics</h2>
34
- <select class="bg-gray-100 border border-gray-300 rounded px-3 py-1 text-sm">
35
- <option>Last 7 days</option>
36
- <option>Last 30 days</option>
37
- <option>Last Quarter</option>
38
- <option>This Year</option>
39
- </select>
40
- </div>
41
- <custom-sales-chart></custom-sales-chart>
42
- </div>
43
-
44
- <div class="bg-white rounded-lg shadow p-6">
45
- <div class="flex justify-between items-center mb-4">
46
- <h2 class="text-xl font-semibold text-gray-700">Recent Deals</h2>
47
- <a href="deals.html" class="text-blue-600 hover:text-blue-800 text-sm flex items-center">
48
- View All <i data-feather="chevron-right" class="w-4 h-4 ml-1"></i>
49
- </a>
50
- </div>
51
- <custom-recent-deals></custom-recent-deals>
52
- </div>
53
- </div>
54
- </main>
55
  </div>
56
-
57
- <script>
58
- feather.replace();
59
- </script>
60
  <script src="script.js"></script>
61
- <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
62
  </body>
63
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>DealFlow Tracker</title>
7
  <link rel="stylesheet" href="style.css">
8
  <script src="https://cdn.tailwindcss.com"></script>
 
 
 
 
 
 
 
 
 
 
9
  </head>
10
+ <body class="bg-gray-100">
11
+ <div class="container mx-auto p-4">
12
+ <h1 class="text-3xl font-bold text-center mb-8">Welcome to DealFlow Tracker</h1>
13
+ <div class="bg-white rounded-lg shadow p-6 max-w-md mx-auto">
14
+ <p class="text-center">A fresh start for your sales management system</p>
15
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  </div>
 
 
 
 
17
  <script src="script.js"></script>
 
18
  </body>
19
  </html>
script.js CHANGED
@@ -1,207 +1,3 @@
1
  document.addEventListener('DOMContentLoaded', function() {
2
- // Initialize tooltips
3
- const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
4
- tooltipTriggerList.map(function (tooltipTriggerEl) {
5
- return new bootstrap.Tooltip(tooltipTriggerEl);
6
- });
7
-
8
- // Sample data for charts
9
- if (document.getElementById('salesChart')) {
10
- const ctx = document.getElementById('salesChart').getContext('2d');
11
- const salesChart = new Chart(ctx, {
12
- type: 'line',
13
- data: {
14
- labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
15
- datasets: [{
16
- label: 'Sales',
17
- data: [12000, 19000, 15000, 20000, 25000, 22000, 30000],
18
- backgroundColor: 'rgba(59, 130, 246, 0.05)',
19
- borderColor: 'rgba(59, 130, 246, 1)',
20
- borderWidth: 2,
21
- tension: 0.1,
22
- fill: true
23
- }]
24
- },
25
- options: {
26
- responsive: true,
27
- plugins: {
28
- legend: {
29
- display: false
30
- }
31
- },
32
- scales: {
33
- y: {
34
- beginAtZero: true,
35
- ticks: {
36
- callback: function(value) {
37
- return '€' + value.toLocaleString();
38
- }
39
- }
40
- }
41
- }
42
- }
43
- });
44
- }
45
-
46
- // Toggle sidebar
47
- document.getElementById('sidebarToggle')?.addEventListener('click', function() {
48
- const sidebar = document.getElementById('sidebar');
49
- sidebar.classList.toggle('-translate-x-full');
50
- });
51
- });
52
- // Deal creation modal
53
- function openDealModal() {
54
- const modal = document.querySelector('custom-deal-modal').shadowRoot.getElementById('dealModal');
55
- modal.classList.remove('hidden');
56
- document.body.classList.add('overflow-hidden');
57
- }
58
-
59
- function closeDealModal() {
60
- const modal = document.querySelector('custom-deal-modal').shadowRoot.getElementById('dealModal');
61
- modal.classList.add('hidden');
62
- document.body.classList.remove('overflow-hidden');
63
- }
64
-
65
- function createNewDeal() {
66
- const client = document.querySelector('custom-deal-modal').shadowRoot.getElementById('client').value;
67
- const dealDate = document.querySelector('custom-deal-modal').shadowRoot.getElementById('dealDate').value;
68
- const supplier = document.querySelector('custom-deal-modal').shadowRoot.getElementById('supplier').value;
69
- const status = document.querySelector('custom-deal-modal').shadowRoot.getElementById('status').value;
70
- const notes = document.querySelector('custom-deal-modal').shadowRoot.getElementById('notes').value;
71
-
72
- if (!client || !dealDate || !supplier || !status) {
73
- alert('Пожалуйста, заполните все обязательные поля');
74
- return;
75
- }
76
-
77
- // In a real app, you would send this data to the server
78
- console.log('Creating new deal:', {
79
- client,
80
- dealDate,
81
- supplier,
82
- status,
83
- notes
84
- });
85
-
86
- closeDealModal();
87
- alert('Новая сделка успешно создана');
88
- // You would typically refresh the deal list here
89
- }
90
- // Excel import/export functions
91
- function importExcel() {
92
- // TODO: Implement Excel import
93
- alert('Excel import functionality will be implemented here');
94
- }
95
-
96
- function exportExcel() {
97
- // TODO: Implement Excel export
98
- alert('Excel export functionality will be implemented here');
99
- }
100
- // Product table calculations
101
- function setupProductTable() {
102
- document.addEventListener('input', function(e) {
103
- if (e.target.classList.contains('purchase-price') ||
104
- e.target.classList.contains('qty') ||
105
- e.target.classList.contains('margin') ||
106
- e.target.classList.contains('sale-price')) {
107
- const row = e.target.closest('tr');
108
- calculateRowValues(row);
109
- }
110
- });
111
-
112
- // Add row button
113
- document.getElementById('addRow')?.addEventListener('click', function() {
114
- const table = document.querySelector('#productTable tbody');
115
- const newRow = document.createElement('tr');
116
- newRow.innerHTML = `
117
- <td>${table.rows.length + 1}</td>
118
- <td><input type="text" value=""></td>
119
- <td><input type="number" value="1" class="qty"></td>
120
- <td><input type="number" value="0" class="purchase-price"></td>
121
- <td>0 ₽</td>
122
- <td><input type="number" value="20" class="margin"></td>
123
- <td><input type="number" value="0" class="sale-price"></td>
124
- <td>0 ₽</td>
125
- <td>
126
- <select>
127
- <option>ООО "Техносила"</option>
128
- <option>ИП Петров</option>
129
- <option>Компьютерный мир</option>
130
- </select>
131
- </td>
132
- <td><input type="checkbox"></td>
133
- <td><button class="text-red-500 hover:text-red-700"><i data-feather="trash-2" class="w-4 h-4"></i></button></td>
134
- `;
135
- table.appendChild(newRow);
136
- feather.replace();
137
- });
138
-
139
- // Apply margin button
140
- document.getElementById('applyMargin')?.addEventListener('click', function() {
141
- const margin = prompt('Введите процент наценки:', '20');
142
- if (margin && !isNaN(margin)) {
143
- const rows = document.querySelectorAll('#productTable tbody tr');
144
- rows.forEach(row => {
145
- const marginInput = row.querySelector('.margin');
146
- marginInput.value = margin;
147
- calculateRowValues(row);
148
- });
149
- }
150
- });
151
-
152
- // Delete row
153
- document.addEventListener('click', function(e) {
154
- if (e.target.closest('button') && e.target.closest('i')?.getAttribute('data-feather') === 'trash-2') {
155
- const row = e.target.closest('tr');
156
- row.remove();
157
- // Renumber rows
158
- const rows = document.querySelectorAll('#productTable tbody tr');
159
- rows.forEach((row, index) => {
160
- row.cells[0].textContent = index + 1;
161
- });
162
- }
163
- });
164
- }
165
-
166
- function calculateRowValues(row) {
167
- const qty = parseFloat(row.querySelector('.qty').value) || 0;
168
- const purchasePrice = parseFloat(row.querySelector('.purchase-price').value) || 0;
169
- const margin = parseFloat(row.querySelector('.margin').value) || 0;
170
- const salePriceInput = row.querySelector('.sale-price');
171
-
172
- // Calculate purchase total
173
- const purchaseTotal = qty * purchasePrice;
174
- row.cells[4].textContent = formatCurrency(purchaseTotal);
175
-
176
- // Calculate sale price if margin changed
177
- if (e?.target?.classList?.contains('margin') || e?.target?.classList?.contains('purchase-price')) {
178
- const salePrice = purchasePrice * (1 + margin/100) * 1.05; // 5% VAT
179
- salePriceInput.value = salePrice.toFixed(2);
180
- }
181
-
182
- // Calculate sale total
183
- const salePrice = parseFloat(salePriceInput.value) || 0;
184
- const saleTotal = qty * salePrice;
185
- row.cells[7].textContent = formatCurrency(saleTotal);
186
- }
187
-
188
- function formatCurrency(amount) {
189
- return new Intl.NumberFormat('ru-RU', {
190
- style: 'currency',
191
- currency: 'RUB',
192
- maximumFractionDigits: 0
193
- }).format(amount).replace('₽', '₽');
194
- }
195
- // Initialize date pickers
196
- function initDatePickers() {
197
- flatpickr('.datepicker', {
198
- dateFormat: 'Y-m-d',
199
- allowInput: true
200
- });
201
- }
202
-
203
- // Initialize when page loads
204
- window.onload = function() {
205
- initDatePickers();
206
- feather.replace();
207
- };
 
1
  document.addEventListener('DOMContentLoaded', function() {
2
+ console.log('DealFlow Tracker initialized');
3
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
style.css CHANGED
@@ -1,99 +1,7 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2
-
3
- * {
4
- font-family: 'Inter', sans-serif;
5
- }
6
-
7
  body {
8
- overflow-x: hidden;
9
- }
10
-
11
- ::-webkit-scrollbar {
12
- width: 6px;
13
- height: 6px;
14
- }
15
-
16
- ::-webkit-scrollbar-track {
17
- background: #f1f1f1;
18
- }
19
-
20
- ::-webkit-scrollbar-thumb {
21
- background: #888;
22
- border-radius: 3px;
23
- }
24
-
25
- ::-webkit-scrollbar-thumb:hover {
26
- background: #555;
27
- }
28
-
29
- /* Custom transition for sidebar */
30
- .sidebar-transition {
31
- transition: all 0.3s ease-in-out;
32
- }
33
-
34
- /* Deal status badges */
35
- .status-badge {
36
- @apply px-2 py-1 rounded-full text-xs font-medium;
37
- }
38
- .status-active {
39
- @apply bg-green-100 text-green-800;
40
- }
41
-
42
- .status-pending {
43
- @apply bg-yellow-100 text-yellow-800;
44
- }
45
-
46
- .status-completed {
47
- @apply bg-blue-100 text-blue-800;
48
- }
49
-
50
- .status-cancelled {
51
- @apply bg-red-100 text-red-800;
52
- }
53
-
54
- /* Compact table styles */
55
- .compact-table th {
56
- @apply px-3 py-2 text-xs;
57
- }
58
-
59
- .compact-table td {
60
- @apply px-3 py-2 text-sm;
61
- }
62
-
63
- .compact-table .status-badge {
64
- @apply px-1.5 py-0.5 text-xs;
65
- }
66
-
67
- .compact-table .action-link {
68
- @apply text-sm;
69
- }
70
- /* Table styles */
71
- .table-container {
72
- @apply overflow-x-auto;
73
- }
74
-
75
- .table {
76
- @apply min-w-full divide-y divide-gray-200;
77
- }
78
-
79
- .table th {
80
- @apply px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider;
81
- }
82
-
83
- .table td {
84
- @apply px-6 py-4 whitespace-nowrap text-sm text-gray-500;
85
- }
86
-
87
- /* Form input styles */
88
- .form-input {
89
- @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm;
90
- }
91
-
92
- /* Button styles */
93
- .btn-primary {
94
- @apply inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500;
95
  }
96
 
97
- .btn-secondary {
98
- @apply inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500;
99
  }
 
 
 
 
 
 
 
1
  body {
2
+ font-family: 'Inter', sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  }
4
 
5
+ .container {
6
+ max-width: 1200px;
7
  }