| @@ -387,14 +387,10 @@ | ||
| 387 | 387 | var $btn = $(this); |
| 388 | 388 | var itemIndex = $btn.data('item-index'); |
| 389 | 389 | // Find the closest item container (either invoice-item or quote-item) |
| 390 | 390 | var $itemContainer = $btn.closest('.invoice-item, .quote-item'); |
| 391 | - | |
| 392 | - console.log('Save to Library - Item container found:', $itemContainer.length); | |
| 393 | - console.log('Save to Library - Item index:', itemIndex); | |
| 394 | - | |
| 391 | + | |
| 395 | 392 | if (!$itemContainer.length) { |
| 396 | - console.error('Save to Library - Could not find item container'); | |
| 397 | 393 | return; |
| 398 | 394 | } |
| 399 | 395 | |
| 400 | 396 | // Get item data from the form |
| @@ -425,17 +421,13 @@ | ||
| 425 | 421 | } |
| 426 | 422 | } |
| 427 | 423 | }); |
| 428 | 424 | |
| 429 | - console.log('Save to Library - Extracted raw data:', itemData); | |
| 430 | - | |
| 431 | 425 | // Convert numeric fields |
| 432 | 426 | itemData.price = parseFloat(itemData.price) || 0; |
| 433 | 427 | itemData.quantity = parseInt(itemData.quantity) || 0; |
| 434 | 428 | itemData.taxable = parseInt(itemData.taxable) || 0; |
| 435 | - | |
| 436 | - console.log('Save to Library - Processed data:', itemData); | |
| 437 | - | |
| 429 | + | |
| 438 | 430 | // Validate required fields |
| 439 | 431 | if (!itemData.title || !itemData.title.trim()) { |
| 440 | 432 | if (typeof EasyInvoiceToast !== 'undefined') { |
| 441 | 433 | EasyInvoiceToast.error('Please fill in item title before saving to library'); |