Yapay zekaya stok programı yazdırıyorum. %95 bitti ama çok çok basit yerlerde ne dersem diyeyim yapamıyor. İstediğim Arama kutularının hepsini yatay döşemesi. Kodları buraya eklesem bana nasıl yapacağımı tarif eder misiniz. Satırlar daralacak.
Not: Kodlama bilgim yok.
Not: Kodlama bilgim yok.
Kod:
<!DOCTYPE html>
<html>
<head>
<title>Stok Yönetim Sistemi</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
padding: 20px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 20px 60px rgba(0,0,0,0.1);
overflow: hidden;
}
.header {
background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
color: white;
padding: 20px;
text-align: center;
}
.header h1 {
font-size: 1.8rem;
font-weight: 300;
letter-spacing: 1px;
margin: 0;
}
.content {
padding: 30px;
}
.stok-search-section {
display: grid;
grid-template-columns: 1fr;
gap: 8px;
margin-bottom: 30px;
}
.stok-search-field {
display: flex;
align-items: center;
gap: 15px;
position: relative;
}
.stok-search-field label {
min-width: 140px;
font-weight: bold;
color: #34495e;
font-size: 16px;
}
.stok-search-field select,
.stok-search-field input {
flex: 1;
padding: 12px;
border: 2px solid #e0e0e0;
border-radius: 8px;
font-size: 16px;
transition: border-color 0.3s;
}
.stok-search-field select:focus,
.stok-search-field input:focus {
outline: none;
border-color: #e74c3c;
}
.stok-filter-section {
margin: 20px 0;
padding: 25px;
border: 2px solid #3498db;
border-radius: 10px;
background: linear-gradient(145deg, #fff 0%, #f8f9fa 100%);
box-shadow: 0 6px 20px rgba(52, 152, 219, 0.15);
display: none;
position: relative;
}
.stok-filter-section.active {
display: block;
}
.stok-filter-section::before {
content: "?? PARAMETRİK FİLTRELEME";
position: absolute;
top: -12px;
left: 20px;
background: #3498db;
color: white;
padding: 5px 15px;
border-radius: 20px;
font-weight: bold;
font-size: 14px;
}
.stok-filter-title {
color: #3498db;
margin: 10px 0 20px 0;
text-align: center;
font-size: 18px;
font-weight: bold;
}
.stok-filter-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
margin-top: 20px;
}
.stok-filter-item {
display: flex;
flex-direction: column;
}
.stok-filter-item label {
font-weight: bold;
margin-bottom: 5px;
color: #2c3e50;
}
.stok-filter-item input,
.stok-filter-item select {
padding: 10px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 14px;
}
.stok-filter-buttons {
text-align: center;
margin-top: 20px;
}
.stok-filter-btn {
background: #3498db;
color: white;
border: none;
padding: 10px 20px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
margin: 0 5px;
transition: background 0.3s;
}
.stok-filter-btn:hover {
background: #2980b9;
}
.stok-filter-btn.secondary {
background: #95a5a6;
}
.stok-filter-btn.secondary:hover {
background: #7f8c8d;
}
.stok-results-section {
margin-top: 30px;
}
.stok-results-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.stok-results-title {
color: #2c3e50;
font-size: 18px;
font-weight: bold;
}
.stok-results-count {
background: #3498db;
color: white;
padding: 6px 15px;
border-radius: 20px;
font-size: 14px;
}
.stok-table-container {
overflow-x: auto;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.stok-table {
width: 100%;
border-collapse: collapse;
background: white;
}
.stok-table th {
background: #2c3e50;
color: white;
padding: 15px;
text-align: left;
font-weight: bold;
position: sticky;
top: 0;
z-index: 10;
}
.stok-table td {
padding: 15px;
border-bottom: 1px solid #eee;
position: relative;
}
.stok-table tr:hover {
background: #f8f9fa;
}
.stok-no-results {
text-align: center;
padding: 40px;
color: #7f8c8d;
font-size: 16px;
}
.stok-export-section {
margin-top: 20px;
text-align: right;
}
.stok-export-btn {
background: #27ae60;
color: white;
border: none;
padding: 12px 25px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: background 0.3s;
}
.stok-export-btn:hover {
background: #229954;
}
.stok-clear-btn {
background: #95a5a6;
color: white;
border: none;
padding: 12px 25px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
margin-right: 10px;
transition: background 0.3s;
}
.stok-clear-btn:hover {
background: #7f8c8d;
}
.stok-autocomplete {
position: relative;
}
.stok-autocomplete-items {
position: absolute;
border: 1px solid #d4d4d4;
border-bottom: none;
border-top: none;
z-index: 99;
top: 100%;
left: 0;
right: 0;
max-height: 200px;
overflow-y: auto;
background-color: white;
border-radius: 0 0 6px 6px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.stok-autocomplete-items div {
padding: 10px;
cursor: pointer;
border-bottom: 1px solid #d4d4d4;
}
.stok-autocomplete-items div:hover {
background-color: #e9e9e9;
}
.stok-autocomplete-active {
background-color: #e74c3c !important;
color: white;
}
.stok-range-filter {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
}
.stok-range-filter input {
width: 100%;
max-width: 80px;
}
.stok-loading {
text-align: center;
padding: 20px;
color: #3498db;
}
.stok-error {
text-align: center;
padding: 20px;
color: #e74c3c;
font-weight: bold;
}
.stok-adet-container {
display: flex;
align-items: center;
gap: 8px;
}
.stok-adet-input {
width: 60px;
padding: 5px;
border: 1px solid #ddd;
border-radius: 4px;
text-align: center;
font-size: 14px;
z-index: 10;
position: relative;
}
.stok-adet-btn {
background: #3498db;
color: white;
border: none;
border-radius: 4px;
padding: 5px 10px;
cursor: pointer;
font-size: 14px;
transition: background 0.3s;
min-width: 30px;
z-index: 10;
position: relative;
}
.stok-adet-btn:hover {
background: #2980b9;
}
.stok-adet-btn.azalt {
background: #e74c3c;
}
.stok-adet-btn.azalt:hover {
background: #c0392b;
}
.stok-adet-value {
font-weight: bold;
min-width: 40px;
text-align: center;
padding: 5px;
background: #f8f9fa;
border-radius: 4px;
}
* {
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
-webkit-touch-callout: none !important;
-webkit-tap-highlight-color: transparent !important;
}
input:not([type="button"]):not([type="submit"]):not([type="reset"]),
textarea,
.stok-adet-input {
-webkit-user-select: text !important;
-moz-user-select: text !important;
-ms-user-select: text !important;
user-select: text !important;
-webkit-touch-callout: default !important;
}
*::selection,
* *::selection,
* * *::selection,
*::selection *,
* *::selection *,
* * *::selection * {
background: transparent !important;
color: inherit !important;
}
*::-moz-selection,
* *::-moz-selection,
* * *::-moz-selection,
*::-moz-selection *,
* *::-moz-selection *,
* * *::-moz-selection * {
background: transparent !important;
color: inherit !important;
}
.stok-table td,
.stok-table th {
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
pointer-events: none !important;
cursor: default !important;
-webkit-touch-callout: none !important;
}
.stok-adet-btn,
.stok-filter-btn,
.stok-export-btn,
.stok-clear-btn,
button,
.stok-autocomplete-items div {
pointer-events: auto !important;
cursor: pointer !important;
z-index: 20 !important;
position: relative !important;
}
.stok-adet-input,
input:not([type="button"]):not([type="submit"]):not([type="reset"]),
select,
textarea {
pointer-events: auto !important;
cursor: text !important;
z-index: 20 !important;
position: relative !important;
}
.stok-table td:nth-child(n+6) {
position: relative !important;
pointer-events: none !important;
user-select: none !important;
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}
.package-display {
display: block !important;
position: relative !important;
pointer-events: none !important;
user-select: none !important;
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
cursor: default !important;
z-index: 1 !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}
.package-blocker {
position: absolute !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
z-index: 9999 !important;
pointer-events: auto !important;
background: transparent !important;
overflow: hidden !important;
}
@media (max-width: 768px) {
.stok-search-section {
grid-template-columns: 1fr;
}
.stok-filter-grid {
grid-template-columns: 1fr;
}
.stok-range-filter {
grid-template-columns: 1fr;
}
.stok-range-filter input {
max-width: 100%;
}
.stok-adet-container {
flex-direction: column;
gap: 5px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>?? STOK YÖNETİM SİSTEMİ</h1>
</div>
<div class="content">
<div class="stok-search-section">
<div class="stok-search-field">
<label for="malzeme_adi_select">Malzeme Adı:</label>
<select id="malzeme_adi_select" onchange="showParametricFilters(); applyFilters();">
<option value="">Malzeme adı seçin...</option>
</select>
</div>
<div class="stok-search-field">
<label for="malzeme_kodu_search">Malzeme Kodu:</label>
<div class="stok-autocomplete">
<input type="text" id="malzeme_kodu_search" placeholder="Malzeme kodu ile ara..." oninput="filterMalzemeKodlari()" onchange="applyFilters()">
</div>
</div>
<div class="stok-search-field">
<label for="tedarikci_search">Tedarikçi:</label>
<select id="tedarikci_search" onchange="applyFilters()">
<option value="">Tedarikçi seçin...</option>
</select>
</div>
<div class="stok-search-field">
<label for="kutu_no_search">Kutu No:</label>
<div class="stok-autocomplete">
<input type="text" id="kutu_no_search" placeholder="Kutu no ile ara..." oninput="filterKutuNo()" onchange="applyFilters()">
</div>
</div>
</div>
<div class="stok-filter-section" id="filter-section">
<div class="stok-filter-title">Parametrik Filtreler</div>
<div class="stok-filter-grid" id="filter-grid">
<!-- Dinamik olarak doldurulacak -->
</div>
<div class="stok-filter-buttons">
<button class="stok-filter-btn" onclick="applyFilters()">Filtrele</button>
<button class="stok-filter-btn secondary" onclick="clearFilters()">Temizle</button>
</div>
</div>
<div class="stok-results-section">
<div class="stok-results-header">
<div class="stok-results-title" id="results-title">Arama Sonuçları</div>
<div class="stok-results-count" id="results-count">0 sonuç</div>
</div>
<div class="stok-table-container">
<table class="stok-table" id="results-table">
<thead id="table-head">
<tr>
<th>Malzeme Kodu</th>
<th>Malzeme Adı</th>
<th>Adet</th>
<th>Kutu No</th>
<th>Tedarikçi</th>
</tr>
</thead>
<tbody id="table-body">
<tr>
<td colspan="5" class="stok-no-results">Arama yapmak için yukarıdaki alanları kullanın</td>
</tr>
</tbody>
</table>
</div>
<div class="stok-export-section">
<button class="stok-clear-btn" onclick="clearAll()">Temizle</button>
<button class="stok-export-btn" onclick="exportToCSV()">CSV'ye Dışa Aktar</button>
</div>
</div>
</div>
</div>
<script>
const malzemeParametreleri = {
"Transistor": [
{ adi: "V_CEO_Min", birim: "V", aciklama: "Min Collector-Emitter Voltage" },
{ adi: "V_CEO_Max", birim: "V", aciklama: "Max Collector-Emitter Voltage" },
{ adi: "I_C_Min", birim: "A", aciklama: "Min Collector Current" },
{ adi: "I_C_Max", birim: "A", aciklama: "Max Collector Current" },
{ adi: "h_FE", birim: "", aciklama: "DC Current Gain" },
{ adi: "Package", birim: "", aciklama: "Package/Case" },
{ adi: "Polarity", birim: "", aciklama: "Kutupluluk" },
{ adi: "Technology", birim: "", aciklama: "Technology" },
{ adi: "f_T", birim: "MHz", aciklama: "Transition Frequency" },
{ adi: "P_D", birim: "W", aciklama: "Power Dissipation" },
{ adi: "V_CBO", birim: "V", aciklama: "Collector-Base Voltage" }
],
"Direnç": [
{ adi: "Resistance", birim: "?", aciklama: "Direnç Değeri" },
{ adi: "Tolerance", birim: "%", aciklama: "Tolerans" },
{ adi: "Power_Rating", birim: "W", aciklama: "Güç Derecesi" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Temp_Coeff", birim: "ppm/°C", aciklama: "Sıcaklık Katsayısı" },
{ adi: "Voltage_Rating", birim: "V", aciklama: "Maksimum Gerilim" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"Diyot": [
{ adi: "V_RRM", birim: "V", aciklama: "Reverse Voltage" },
{ adi: "I_F", birim: "A", aciklama: "Forward Current" },
{ adi: "V_F", birim: "V", aciklama: "Forward Voltage" },
{ adi: "Trr", birim: "ns", aciklama: "Reverse Recovery Time" },
{ adi: "I_FSM", birim: "A", aciklama: "Surge Current" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Polarity", birim: "", aciklama: "Kutupluluk" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"MOSFET": [
{ adi: "V_DSS", birim: "V", aciklama: "Drain-Source Voltage" },
{ adi: "I_D_Min", birim: "A", aciklama: "Min Drain Current" },
{ adi: "I_D_Max", birim: "A", aciklama: "Max Drain Current" },
{ adi: "R_DS_on", birim: "m?", aciklama: "On-Resistance" },
{ adi: "V_GS_th", birim: "V", aciklama: "Threshold Voltage" },
{ adi: "Q_g", birim: "nC", aciklama: "Gate Charge" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Polarity", birim: "", aciklama: "Kutupluluk" },
{ adi: "P_D", birim: "W", aciklama: "Power Dissipation" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"IGBT": [
{ adi: "V_CE", birim: "V", aciklama: "Collector-Emitter Voltage" },
{ adi: "I_C_Min", birim: "A", aciklama: "Min Collector Current" },
{ adi: "I_C_Max", birim: "A", aciklama: "Max Collector Current" },
{ adi: "V_GE_th", birim: "V", aciklama: "Gate-Emitter Threshold" },
{ adi: "t_d_on", birim: "ns", aciklama: "Turn-On Delay Time" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Polarity", birim: "", aciklama: "Kutupluluk" },
{ adi: "P_D", birim: "W", aciklama: "Power Dissipation" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"Tristör": [
{ adi: "V_DRM", birim: "V", aciklama: "Repetitive Peak Voltage" },
{ adi: "I_T_Min", birim: "A", aciklama: "Min RMS On-State Current" },
{ adi: "I_T_Max", birim: "A", aciklama: "Max RMS On-State Current" },
{ adi: "V_GT", birim: "V", aciklama: "Gate Trigger Voltage" },
{ adi: "I_GT", birim: "mA", aciklama: "Gate Trigger Current" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Polarity", birim: "", aciklama: "Kutupluluk" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"Triac": [
{ adi: "V_DRM", birim: "V", aciklama: "Repetitive Peak Voltage" },
{ adi: "I_T_Min", birim: "A", aciklama: "Min RMS On-State Current" },
{ adi: "I_T_Max", birim: "A", aciklama: "Max RMS On-State Current" },
{ adi: "V_GT", birim: "V", aciklama: "Gate Trigger Voltage" },
{ adi: "I_GT", birim: "mA", aciklama: "Gate Trigger Current" },
{ adi: "dV_dt", birim: "V/µs", aciklama: "Critical Rate of Rise" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Polarity", birim: "", aciklama: "Kutupluluk" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"Kondansatör": [
{ adi: "Capacitance", birim: "F", aciklama: "Kapasitans" },
{ adi: "Voltage_Rating", birim: "V", aciklama: "Gerilim Derecesi" },
{ adi: "Tolerance", birim: "%", aciklama: "Tolerans" },
{ adi: "ESR", birim: "m?", aciklama: "Equivalent Series Resistance" },
{ adi: "Ripple_Current_Min", birim: "A", aciklama: "Min Dalga Akımı" },
{ adi: "Ripple_Current_Max", birim: "A", aciklama: "Max Dalga Akımı" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"Kristal": [
{ adi: "Frequency", birim: "Hz", aciklama: "Frekans" },
{ adi: "Freq_Tolerance", birim: "ppm", aciklama: "Frekans Toleransı" },
{ adi: "Load_Cap", birim: "pF", aciklama: "Yük Kapasitansı" },
{ adi: "ESR", birim: "?", aciklama: "Equivalent Series Resistance" },
{ adi: "Aging", birim: "ppm/year", aciklama: "Yaşlanma Oranı" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"İndüktör": [
{ adi: "Inductance", birim: "H", aciklama: "İndüktans" },
{ adi: "Current_Rating_Min", birim: "A", aciklama: "Min Akım Derecesi" },
{ adi: "Current_Rating_Max", birim: "A", aciklama: "Max Akım Derecesi" },
{ adi: "DCR", birim: "m?", aciklama: "DC Resistance" },
{ adi: "SRF", birim: "MHz", aciklama: "Self-Resonant Frequency" },
{ adi: "Q_Factor", birim: "", aciklama: "Kalite Faktörü" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"Entegre": [
{ adi: "Part_Number", birim: "", aciklama: "Ürün Kodu" },
{ adi: "Function", birim: "", aciklama: "Fonksiyon" },
{ adi: "Supply_Voltage", birim: "V", aciklama: "Besleme Gerilimi" },
{ adi: "Supply_Current_Min", birim: "mA", aciklama: "Min Besleme Akımı" },
{ adi: "Supply_Current_Max", birim: "mA", aciklama: "Max Besleme Akımı" },
{ adi: "Operating_Temp", birim: "°C", aciklama: "Çalışma Sıcaklığı" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
],
"Opto": [
{ adi: "Forward_Voltage", birim: "V", aciklama: "İleri Gerilim" },
{ adi: "Forward_Current_Min", birim: "mA", aciklama: "Min İleri Akım" },
{ adi: "Forward_Current_Max", birim: "mA", aciklama: "Max İleri Akım" },
{ adi: "Collector_Emitter_Voltage", birim: "V", aciklama: "Kollektör-Emitör Gerilimi" },
{ adi: "CTR", birim: "%", aciklama: "Current Transfer Ratio" },
{ adi: "Wavelength", birim: "nm", aciklama: "Dalga Boyu" },
{ adi: "Package", birim: "", aciklama: "Kılıf Tipi" },
{ adi: "Polarity", birim: "", aciklama: "Kutupluluk" },
{ adi: "Technology", birim: "", aciklama: "Technology" }
]
};
// Düzeltilmiş Polarity (Kutupluluk) değerleri
const defaultPolarityValues = {
"Transistor": [
"NPN", "PNP", "N-Channel", "P-Channel", "Darlington", "Sziklai", "Complementary",
"High Voltage NPN", "High Voltage PNP", "Low Voltage NPN", "Low Voltage PNP",
"RF NPN", "RF PNP", "Power NPN", "Power PNP", "Switching NPN", "Switching PNP"
],
"Diyot": [
"Standard", "Schottky", "Zener", "TVS", "LED", "Laser", "Photodiode", "Varactor",
"PIN", "Tunnel", "Backward", "Step Recovery", "Rectifier", "Signal", "Power",
"Fast Recovery", "Ultrafast", "High Voltage", "High Current", "Low Leakage",
"Low Capacitance", "Bridge", "Dual", "Common Cathode", "Common Anode", "Series"
],
"MOSFET": [
"N-Channel", "P-Channel", "Enhancement Mode", "Depletion Mode", "Logic Level",
"Standard Level", "High Voltage", "Low Voltage", "Power", "RF", "Microwave",
"Switching", "Amplifier", "Low RDS(on)", "High Speed", "Low Gate Charge"
],
"IGBT": [
"N-Channel", "P-Channel", "PT", "NPT", "Trench", "Field Stop", "Soft Switching",
"High Speed", "Standard Speed", "Ultrafast", "High Voltage", "High Current",
"Low Loss", "Low Saturation Voltage", "High Temperature", "Discrete", "Module"
],
"Tristör": [
"SCR", "Standard", "Sensitive Gate", "High Voltage", "High Current", "Phase Control",
"Motor Control", "Light Dimmer", "Heater Control", "Industrial", "Automotive",
"Gate Turn-off (GTO)", "MOS Controlled Thyristor (MCT)", "Static Induction Thyristor (SITH)",
"Reverse Blocking", "Reverse Conducting", "Bidirectional", "Unidirectional"
],
"Triac": [
"Standard", "Sensitive Gate", "Snubberless", "Logic Level", "High Voltage",
"High Current", "Low Gate Trigger", "High dV/dt", "Phase Control", "Motor Control",
"Light Dimmer", "Heater Control", "Industrial", "Automotive", "Consumer",
"Bidirectional", "Alternating Current", "AC Switch", "Static Switch"
],
"Opto": [
"Phototransistor", "Photodiode", "Photoresistor", "Photovoltaic", "Photodarlington",
"Photocoupler", "Optocoupler", "Optoisolator", "Solid State Relay", "Optical Switch",
"Input", "Output", "Bidirectional", "High Speed", "Low Power", "High CTR"
]
};
// Kapsamlı ve güncel Package değerleri
const defaultPackageValues = {
"Transistor": [
"TO-92", "TO-18", "TO-39", "TO-3", "TO-220", "TO-247", "TO-252", "TO-263", "TO-264",
"SOT-23", "SOT-223", "SOT-323", "SOT-363", "SOT-89", "SOT-143", "SOT-343",
"SC-59", "SC-70", "SC-74", "SC-75", "SC-88", "SC-90",
"DPAK", "D2PAK", "D3PAK", "IPAK", "I2PAK",
"SMD", "THT", "WLCSP", "CSP", "Flip-Chip"
],
"Direnç": [
"0201", "0402", "0603", "0805", "1206", "1210", "1806", "1812", "2010", "2512",
"0604", "0804", "0808", "1005", "1204", "1506", "1508", "2012", "2018", "2518",
"Axial", "Radial", "MELF", "MLL", "MiniMELF", "MicroMELF",
"SMD", "THT", "Chip", "Array", "Network", "Thick Film", "Thin Film", "Metal Film",
"Carbon Film", "Wirewound", "Fusible", "Precision", "High Power"
],
"Diyot": [
"DO-41", "DO-15", "DO-201", "DO-204", "DO-214", "DO-215",
"SOD-123", "SOD-323", "SOD-523", "SOD-723", "SOD-923",
"SMA", "SMB", "SMC", "SMAF", "SMBF", "SMCF",
"MELF", "LL-34", "LL-41", "DL-35", "DL-41",
"SMD", "THT", "Axial", "Radial", "Surface Mount", "Through Hole",
"Zener", "Schottky", "TVS", "Rectifier", "Signal", "Power", "Ultrafast"
],
"MOSFET": [
"TO-220", "TO-247", "TO-252", "TO-263", "TO-264", "TO-3P",
"SOT-23", "SOT-223", "SOT-89", "SOT-363", "SOT-343",
"DPAK", "D2PAK", "D3PAK", "IPAK", "I2PAK",
"QFN", "DFN", "WLCSP", "CSP", "Flip-Chip",
"PowerPAK", "PowerSO8", "SuperSO8", "LFPAK", "HSIP", "H2PAK",
"SMD", "THT", "Surface Mount", "Through Hole", "DirectFET", "Drain-Down"
],
"IGBT": [
"TO-220", "TO-247", "TO-252", "TO-263", "TO-264",
"SOT-223", "SOT-89",
"DPAK", "D2PAK", "D3PAK", "IPAK", "I2PAK",
"QFN", "DFN", "WLCSP", "CSP",
"PowerPAK", "PowerSO8", "SuperSO8", "LFPAK",
"SMD", "THT", "Surface Mount", "Through Hole",
"TO-3P", "ISOTOP", "MiniSKiiP", "SEMITOP", "EconoPACK"
],
"Tristör": [
"TO-220", "TO-247", "TO-252", "TO-263", "TO-264",
"SOT-223", "SOT-89",
"DPAK", "D2PAK", "D3PAK", "IPAK", "I2PAK",
"QFN", "DFN", "WLCSP", "CSP",
"PowerPAK", "PowerSO8", "SuperSO8", "LFPAK",
"SMD", "THT", "Surface Mount", "Through Hole",
"TO-3P", "ISOTOP", "MiniSKiiP", "SEMITOP", "EconoPACK"
],
"Triac": [
"TO-220", "TO-247", "TO-252", "TO-263", "TO-264",
"SOT-223", "SOT-89",
"DPAK", "D2PAK", "D3PAK", "IPAK", "I2PAK",
"QFN", "DFN", "WLCSP", "CSP",
"PowerPAK", "PowerSO8", "SuperSO8", "LFPAK",
"SMD", "THT", "Surface Mount", "Through Hole",
"TO-3P", "ISOTOP", "MiniSKiiP", "SEMITOP", "EconoPACK"
],
"Kondansatör": [
"0201", "0402", "0603", "0805", "1206", "1210", "1806", "1812", "2010", "2512",
"0604", "0804", "0808", "1005", "1204", "1506", "1508", "2012", "2018", "2518",
"Radial", "Axial", "SMD", "THT", "Chip", "Array", "Network",
"Ceramic", "Electrolytic", "Tantalum", "Film", "Mica", "Paper", "Polyester",
"Polypropylene", "Polystyrene", "Aluminum", "Niobium", "Polymer",
"Screw Terminal", "Snap-In", "Radial Lead", "Axial Lead", "Surface Mount",
"MLCC", "X5R", "X7R", "NP0", "C0G", "Y5V", "Z5U"
],
"Kristal": [
"HC-49/U", "HC-49/S", "HC-49/US", "HC-49/4H", "HC-49/6H",
"SMD", "Surface Mount", "Through Hole",
"TCXO", "OCXO", "VCXO", "VC-TCXO", "MCXO", "GPSDO",
"2-Pin", "3-Pin", "4-Pin", "6-Pin",
"Cylindrical", "Rectangular", "Square", "Oval",
"Metal Can", "Ceramic", "Plastic", "Hermetic",
"AT-Cut", "BT-Cut", "SC-Cut", "IT-Cut", "FT-Cut",
"Fundamental", "Overtone", "3rd Overtone", "5th Overtone"
],
"İndüktör": [
"0201", "0402", "0603", "0805", "1206", "1210", "1806", "1812", "2010", "2512",
"0604", "0804", "0808", "1005", "1204", "1506", "1508", "2012", "2018", "2518",
"Radial", "Axial", "SMD", "THT", "Chip", "Array", "Network",
"Shielded", "Unshielded", "Molded", "Bobbin", "Toroidal", "Drum Core",
"Ferrite Core", "Iron Powder Core", "Air Core", "Laminated Core",
"Wirewound", "Multilayer", "Thin Film", "Thick Film",
"Power Inductor", "RF Inductor", "Common Mode Choke", "Balun"
],
"Entegre": [
"DIP", "PDIP", "CDIP", "CerDIP", "Side Brazed",
"SOIC", "SOP", "TSOP", "SSOP", "TSSOP", "QSOP", "VSOP", "MSOP", "USOP",
"QFP", "TQFP", "LQFP", "PQFP", "VQFP", "HQFP", "MQFP", "SQFP",
"BGA", "FBGA", "LBGA", "uBGA", "CABGA", "PBGA", "CBGA", "TBGA", "TEBGA",
"QFN", "DFN", "LQFN", "VQFN", "HQFN", "WQFN", "TQFN", "MQFN",
"PLCC", "LCC", "CLCC", "PLC", "LGA", "LLP", "MLP", "SLP",
"WLCSP", "CSP", "uCSP", "Flip-Chip", "COB", "COF", "COG",
"SIP", "SIP", "ZIP", "SIMM", "DIMM", "RIMM", "SO-DIMM", "MicroDIMM"
],
"Opto": [
"DIP", "PDIP", "CDIP", "CerDIP",
"SOIC", "SOP", "TSOP", "SSOP", "TSSOP", "MSOP", "USOP",
"QFN", "DFN", "LQFN", "VQFN", "WQFN", "TQFN",
"SMD", "THT", "Surface Mount", "Through Hole",
"4-Pin", "5-Pin", "6-Pin", "8-Pin", "16-Pin",
"DIP-4", "DIP-6", "DIP-8", "SMD-4", "SMD-5", "SMD-6", "SMD-8",
"Photocoupler", "Optocoupler", "Optoisolator", "Phototransistor",
"Photodiode", "Photoresistor", "Photovoltaic", "Photodarlington"
]
};
// Kapsamlı ve güncel Technology değerleri
const defaultTechnologyValues = {
"Transistor": [
"Si", "Ge", "GaAs", "SiC", "GaN", "SiGe", "InP", "GaP", "InSb", "GaSb",
"AlGaAs", "InGaAs", "InGaP", "AlGaN", "InGaN", "GaInP", "AlInP",
"HBT", "HBT", "BJT", "FET", "JFET", "MESFET", "HEMT", "PHEMT",
"RF", "Microwave", "Power", "Switching", "Amplifier", "General Purpose",
"Low Noise", "High Frequency", "High Voltage", "High Current", "Low Power"
],
"Direnç": [
"Thick Film", "Thin Film", "Metal Film", "Carbon Film", "Wirewound", "Foil",
"Metal Oxide", "Cermet", "Precision", "High Precision", "Ultra Precision",
"General Purpose", "Power", "High Power", "Surface Mount", "Through Hole",
" fusible", "Non-fusible", "Zero Ohm", "Current Sense", "Shunt",
"Array", "Network", "Trimmer", "Variable", "Fixed", "Temperature Compensated",
"High Voltage", "High Temperature", "Low Temperature", "Moisture Resistant"
],
"Diyot": [
"Si", "Ge", "GaAs", "SiC", "GaN", "Schottky", "Zener", "TVS", "Rectifier",
"Signal", "Power", "Fast Recovery", "Ultrafast", "Standard Recovery",
"Switching", "Varactor", "PIN", "Tunnel", "Backward", "Step Recovery",
"Laser", "LED", "IR", "UV", "Visible", "High Voltage", "High Current",
"Low Leakage", "Low Capacitance", "High Temperature", "Surface Mount"
],
"MOSFET": [
"Si", "SiC", "GaN", "GaAs", "Enhancement Mode", "Depletion Mode",
"N-Channel", "P-Channel", "Logic Level", "Standard Level", "High Voltage",
"Power", "RF", "Microwave", "Switching", "Amplifier", "Low RDS(on)",
"High Speed", "Low Gate Charge", "Low Input Capacitance", "High Frequency",
"Automotive", "Industrial", "Consumer", "Telecom", "Military",
"Space Grade", "Rad Hard", "High Temperature", "Low Power"
],
"IGBT": [
"Si", "SiC", "PT", "NPT", "Trench", "Field Stop", "Soft Switching",
"High Speed", "Standard Speed", "Ultrafast", "High Voltage", "High Current",
"Low Loss", "Low Saturation Voltage", "High Temperature", "Power",
"Motor Control", "Inverter", "UPS", "Welding", "Induction Heating",
"Solar", "Wind", "EV", "HEV", "Industrial", "Automotive",
"Discrete", "Module", "Intelligent Power Module (IPM)"
],
"Tristör": [
"Si", "SCR", "Triac", "Diac", "SIDAC", "High Voltage", "High Current",
"Phase Control", "Motor Control", "Light Dimmer", "Heater Control",
"Industrial", "Automotive", "Consumer", "Power", "Switching",
"Gate Turn-off (GTO)", "MOS Controlled Thyristor (MCT)", "Static Induction Thyristor (SITH)",
"Reverse Blocking", "Reverse Conducting", "Bidirectional", "Unidirectional"
],
"Triac": [
"Si", "Standard", "Sensitive Gate", "Snubberless", "Logic Level",
"High Voltage", "High Current", "Low Gate Trigger", "High dV/dt",
"Phase Control", "Motor Control", "Light Dimmer", "Heater Control",
"Industrial", "Automotive", "Consumer", "Power", "Switching",
"Bidirectional", "Alternating Current", "AC Switch", "Static Switch",
"Random Phase", "Zero Voltage Switching", "Zero Current Switching"
],
"Kondansatör": [
"Ceramic", "Electrolytic", "Tantalum", "Film", "Mica", "Paper", "Polyester",
"Polypropylene", "Polystyrene", "Aluminum", "Niobium", "Polymer", "Double Layer",
"MLCC", "X5R", "X7R", "NP0", "C0G", "Y5V", "Z5U", "High K",
"Low ESR", "Ultra Low ESR", "High Frequency", "High Voltage", "High Temperature",
"Surface Mount", "Through Hole", "Radial", "Axial", "Chip", "Array",
"Decoupling", "Coupling", "Filtering", "Timing", "Tuning", "Power Supply"
],
"Kristal": [
"Quartz", "MEMS", "SAW", "BAW", "TCXO", "OCXO", "VCXO", "VC-TCXO",
"MCXO", "GPSDO", "Rubidium", "Cesium", "Atomic", "Fundamental", "Overtone",
"AT-Cut", "BT-Cut", "SC-Cut", "IT-Cut", "FT-Cut", "X-Cut", "Y-Cut",
"HC-49", "HC-49/U", "HC-49/S", "SMD", "Surface Mount", "Through Hole",
"Frequency", "Timing", "Oscillator", "Resonator", "Filter", "Sensor",
"High Stability", "Low Phase Noise", "Low Aging", "High Temperature", "Low Power"
],
"İndüktör": [
"Ferrite", "Iron Powder", "Air Core", "Laminated", "Powdered Iron", "Sendust",
"Wirewound", "Multilayer", "Thin Film", "Thick Film", "Chip", "Power",
"RF", "High Frequency", "Low Frequency", "High Current", "High Inductance",
"Shielded", "Unshielded", "Molded", "Bobbin", "Toroidal", "Drum Core",
"Surface Mount", "Through Hole", "Radial", "Axial", "Array", "Network",
"Common Mode Choke", "Differential Mode", "Balun", "Transformer", "Filter"
],
"Entegre": [
"CMOS", "BiCMOS", "TTL", "ECL", "I2L", "NMOS", "PMOS", "DMOS", "VMOS",
"Analog", "Digital", "Mixed Signal", "RF", "Microwave", "Power Management",
"Microcontroller", "Microprocessor", "DSP", "FPGA", "ASIC", "PLD", "CPLD",
"Memory", "Logic", "Interface", "Sensor", "Amplifier", "Comparator",
"Voltage Regulator", "Switching Regulator", "LDO", "DC-DC Converter", "AC-DC Converter",
"Op-Amp", "Instrumentation Amp", "Isolation Amp", "Programmable Gain Amp", "Current Sense Amp",
"Timer", "Oscillator", "Phase Locked Loop", "Frequency Synthesizer", "Clock Generator"
],
"Opto": [
"Phototransistor", "Photodiode", "Photoresistor", "Photovoltaic", "Photodarlington",
"Photocoupler", "Optocoupler", "Optoisolator", "Solid State Relay", "Optical Switch",
"IR", "Visible", "UV", "LED", "Laser", "VCSEL", "Photodiode Array",
"Position Sensor", "Proximity Sensor", "Ambient Light Sensor", "Color Sensor",
"High Speed", "Low Power", "High CTR", "High Isolation Voltage", "Wide Temperature Range",
"Surface Mount", "Through Hole", "Hermetic", "Non-Hermetic", "Industrial Grade", "Automotive Grade"
]
};
let userMalzemeKoduVeritabani = JSON.parse(localStorage.getItem('userMalzemeKoduVeritabani') || '{}');
let defaultMalzemeKoduVeritabani = {};
let malzemeKoduVeritabani = { ...defaultMalzemeKoduVeritabani, ...userMalzemeKoduVeritabani };
// Örnek veri ekleme fonksiyonu
function initializeSampleData() {
const sampleData = {
"BC547": {
malzemeAdi: "Transistor",
adet: "100",
kutuNo: "A1",
tedarikci: "STMicro",
V_CEO_Min: "45",
V_CEO_Max: "45",
I_C_Min: "0.1",
I_C_Max: "0.1",
h_FE: "110",
Package: "TO-92",
Polarity: "NPN",
Technology: "Si",
f_T: "300",
P_D: "0.5",
V_CBO: "50"
},
"2N2222": {
malzemeAdi: "Transistor",
adet: "50",
kutuNo: "B2",
tedarikci: "ON Semiconductor",
V_CEO_Min: "30",
V_CEO_Max: "30",
I_C_Min: "0.8",
I_C_Max: "0.8",
h_FE: "100",
Package: "TO-18",
Polarity: "NPN",
Technology: "Si",
f_T: "250",
P_D: "0.5",
V_CBO: "60"
},
"1N4007": {
malzemeAdi: "Diyot",
adet: "200",
kutuNo: "C3",
tedarikci: "Vishay",
V_RRM: "1000",
I_F: "1",
V_F: "1.1",
Trr: "30",
I_FSM: "30",
Package: "DO-41",
Polarity: "Standard",
Technology: "Si"
},
"IRF540": {
malzemeAdi: "MOSFET",
adet: "25",
kutuNo: "D4",
tedarikci: "International Rectifier",
V_DSS: "100",
I_D_Min: "28",
I_D_Max: "28",
R_DS_on: "44",
V_GS_th: "4",
Q_g: "72",
Package: "TO-220",
Polarity: "N-Channel",
P_D: "150",
Technology: "Si"
},
"4N35": {
malzemeAdi: "Opto",
adet: "30",
kutuNo: "E5",
tedarikci: "Vishay",
Forward_Voltage: "1.2",
Forward_Current_Min: "10",
Forward_Current_Max: "60",
Collector_Emitter_Voltage: "30",
CTR: "100",
Wavelength: "940",
Package: "DIP-6",
Polarity: "Phototransistor",
Technology: "Si"
}
};
// Örnek veriyi veritabanına ekle
Object.assign(malzemeKoduVeritabani, sampleData);
Object.assign(userMalzemeKoduVeritabani, sampleData);
localStorage.setItem('userMalzemeKoduVeritabani', JSON.stringify(userMalzemeKoduVeritabani));
}
function populateMalzemeAdlari() {
const select = document.getElementById('malzeme_adi_select');
select.innerHTML = '<option value="">Malzeme adı seçin...</option>';
const stokAdlari = [...new Set(Object.values(malzemeKoduVeritabani).map(item => item.malzemeAdi))];
const paramAdlari = Object.keys(malzemeParametreleri);
const allAdlari = [...new Set([...stokAdlari, ...paramAdlari])];
allAdlari.forEach(malzemeAdi => {
const option = document.createElement('option');
option.value = malzemeAdi;
option.textContent = malzemeAdi;
select.appendChild(option);
});
}
function populateTedarikciler() {
const select = document.getElementById('tedarikci_search');
select.innerHTML = '<option value="">Tedarikçi seçin...</option>';
const tedarikciler = [...new Set(Object.values(malzemeKoduVeritabani).map(item => item.tedarikci).filter(Boolean))];
tedarikciler.sort().forEach(tedarikci => {
const option = document.createElement('option');
option.value = tedarikci;
option.textContent = tedarikci;
select.appendChild(option);
});
}
function showParametricFilters() {
const malzemeAdi = document.getElementById('malzeme_adi_select').value;
const filterSection = document.getElementById('filter-section');
const filterGrid = document.getElementById('filter-grid');
if (!malzemeAdi) {
filterSection.classList.remove('active');
return;
}
filterSection.classList.add('active');
const params = malzemeParametreleri[malzemeAdi];
if (!params) {
filterGrid.innerHTML = '<div class="stok-no-results">Bu malzeme için parametre tanımlanmamış</div>';
return;
}
// Package değerlerini topla - hem varsayılan hem de veritabanındaki değerler
const defaultPackages = defaultPackageValues[malzemeAdi] || [];
const dbPackages = [...new Set(
Object.entries(malzemeKoduVeritabani)
.filter(([kod, veri]) => veri.malzemeAdi === malzemeAdi && veri.Package)
.map(([kod, veri]) => veri.Package)
)];
// Polarity değerlerini topla - hem varsayılan hem de veritabanındaki değerler
const defaultPolarities = defaultPolarityValues[malzemeAdi] || [];
const dbPolarities = [...new Set(
Object.entries(malzemeKoduVeritabani)
.filter(([kod, veri]) => veri.malzemeAdi === malzemeAdi && veri.Polarity)
.map(([kod, veri]) => veri.Polarity)
)];
// Technology değerlerini topla - hem varsayılan hem de veritabanındaki değerler
const defaultTechnologies = defaultTechnologyValues[malzemeAdi] || [];
const dbTechnologies = [...new Set(
Object.entries(malzemeKoduVeritabani)
.filter(([kod, veri]) => veri.malzemeAdi === malzemeAdi && veri.Technology)
.map(([kod, veri]) => veri.Technology)
)];
// Birleştir ve sırala
const packageValues = [...new Set([...defaultPackages, ...dbPackages])].sort();
const polarityValues = [...new Set([...defaultPolarities, ...dbPolarities])].sort();
const technologyValues = [...new Set([...defaultTechnologies, ...dbTechnologies])].sort();
let html = '';
params.forEach(param => {
if (param.adi === 'V_CEO_Min' || param.adi === 'V_CEO_Max') {
if (param.adi === 'V_CEO_Min') {
html += `
<div class="stok-filter-item">
<label>V_CEO Aralığı (V):</label>
<div class="stok-range-filter">
<input type="number" id="filter_V_CEO_Min" placeholder="Min" min="0" step="0.1">
<input type="number" id="filter_V_CEO_Max" placeholder="Max" min="0" step="0.1">
</div>
</div>
`;
}
} else if (param.adi === 'I_C_Min' || param.adi === 'I_C_Max') {
if (param.adi === 'I_C_Min') {
html += `
<div class="stok-filter-item">
<label>I_C Aralığı (A):</label>
<div class="stok-range-filter">
<input type="number" id="filter_I_C_Min" placeholder="Min" min="0" step="0.01">
<input type="number" id="filter_I_C_Max" placeholder="Max" min="0" step="0.01">
</div>
</div>
`;
}
} else if (param.adi === 'Package') {
html += `
<div class="stok-filter-item">
<label>${param.adi} ${param.birim ? '(' + param.birim + ')' : ''}:</label>
<select id="filter_${param.adi}">
<option value="">${param.aciklama}</option>
${packageValues.map(pkg =>
`<option value="${pkg}">${pkg}</option>`
).join('')}
</select>
</div>
`;
} else if (param.adi === 'Polarity') {
html += `
<div class="stok-filter-item">
<label>${param.adi} ${param.birim ? '(' + param.birim + ')' : ''}:</label>
<select id="filter_${param.adi}">
<option value="">${param.aciklama}</option>
${polarityValues.map(pol =>
`<option value="${pol}">${pol}</option>`
).join('')}
</select>
</div>
`;
} else if (param.adi === 'Technology') {
html += `
<div class="stok-filter-item">
<label>${param.adi} ${param.birim ? '(' + param.birim + ')' : ''}:</label>
<select id="filter_${param.adi}">
<option value="">${param.aciklama}</option>
${technologyValues.map(tech =>
`<option value="${tech}">${tech}</option>`
).join('')}
</select>
</div>
`;
} else {
html += `
<div class="stok-filter-item">
<label>${param.adi} ${param.birim ? '(' + param.birim + ')' : ''}:</label>
<input type="text" id="filter_${param.adi}" placeholder="${param.aciklama}">
</div>
`;
}
});
filterGrid.innerHTML = html;
}
function filterMalzemeKodlari() {
const input = document.getElementById('malzeme_kodu_search');
const malzemeAdi = document.getElementById('malzeme_adi_select').value;
const value = input.value.trim().toUpperCase();
closeAllLists();
if (!value) {
return;
}
let filteredKodlar = Object.keys(malzemeKoduVeritabani).filter(kod => {
const matchesSearch = kod.includes(value);
const matchesMalzemeAdi = !malzemeAdi || malzemeKoduVeritabani[kod].malzemeAdi === malzemeAdi;
return matchesSearch && matchesMalzemeAdi;
});
const a = document.createElement("DIV");
a.setAttribute("id", input.id + "autocomplete-list");
a.setAttribute("class", "stok-autocomplete-items");
input.parentNode.appendChild(a);
filteredKodlar.forEach(kod => {
const b = document.createElement("DIV");
const matchStart = kod.toUpperCase().indexOf(value);
const matchEnd = matchStart + value.length;
b.innerHTML = kod.substring(0, matchStart);
b.innerHTML += "<strong>" + kod.substring(matchStart, matchEnd) + "</strong>";
b.innerHTML += kod.substring(matchEnd);
b.innerHTML += "<input type='hidden' value='" + kod + "'>";
b.addEventListener("click", function(e) {
input.value = this.getElementsByTagName("input")[0].value;
closeAllLists();
applyFilters();
});
a.appendChild(b);
});
}
function filterKutuNo() {
const input = document.getElementById('kutu_no_search');
const value = input.value.trim().toLowerCase();
closeAllLists();
if (!value) {
return;
}
let filteredKutuNo = [...new Set(
Object.values(malzemeKoduVeritabani)
.map(veri => veri.kutuNo)
.filter(kutuNo => kutuNo && kutuNo.toLowerCase().includes(value))
)];
const a = document.createElement("DIV");
a.setAttribute("id", input.id + "autocomplete-list");
a.setAttribute("class", "stok-autocomplete-items");
input.parentNode.appendChild(a);
filteredKutuNo.forEach(kutuNo => {
const b = document.createElement("DIV");
const matchStart = kutuNo.toLowerCase().indexOf(value);
const matchEnd = matchStart + value.length;
b.innerHTML = kutuNo.substring(0, matchStart);
b.innerHTML += "<strong>" + kutuNo.substring(matchStart, matchEnd) + "</strong>";
b.innerHTML += kutuNo.substring(matchEnd);
b.innerHTML += "<input type='hidden' value='" + kutuNo + "'>";
b.addEventListener("click", function(e) {
input.value = this.getElementsByTagName("input")[0].value;
closeAllLists();
applyFilters();
});
a.appendChild(b);
});
}
function closeAllLists(elmnt) {
const x = document.getElementsByClassName("stok-autocomplete-items");
for (let i = 0; i < x.length; i++) {
if (elmnt != x[i] && elmnt != document.getElementById('malzeme_kodu_search') &&
elmnt != document.getElementById('kutu_no_search')) {
if (x[i].parentNode) {
x[i].parentNode.removeChild(x[i]);
}
}
}
}
function applyFilters() {
try {
showStokLoading();
const malzemeAdi = document.getElementById('malzeme_adi_select').value;
const malzemeKodu = document.getElementById('malzeme_kodu_search').value.trim().toUpperCase();
const tedarikci = document.getElementById('tedarikci_search').value;
const kutuNo = document.getElementById('kutu_no_search').value.trim();
const tableHead = document.getElementById('table-head');
const tableBody = document.getElementById('table-body');
const resultsTitle = document.getElementById('results-title');
const resultsCount = document.getElementById('results-count');
const filters = {};
if (malzemeAdi && malzemeParametreleri[malzemeAdi]) {
malzemeParametreleri[malzemeAdi].forEach(param => {
if (param.adi === 'V_CEO_Min' || param.adi === 'V_CEO_Max') {
if (param.adi === 'V_CEO_Min') {
const minInput = document.getElementById('filter_V_CEO_Min');
const maxInput = document.getElementById('filter_V_CEO_Max');
if (minInput && minInput.value.trim()) {
filters.V_CEO_Min = parseFloat(minInput.value);
}
if (maxInput && maxInput.value.trim()) {
filters.V_CEO_Max = parseFloat(maxInput.value);
}
}
} else if (param.adi === 'I_C_Min' || param.adi === 'I_C_Max') {
if (param.adi === 'I_C_Min') {
const minInput = document.getElementById('filter_I_C_Min');
const maxInput = document.getElementById('filter_I_C_Max');
if (minInput && minInput.value.trim()) {
filters.I_C_Min = parseFloat(minInput.value);
}
if (maxInput && maxInput.value.trim()) {
filters.I_C_Max = parseFloat(maxInput.value);
}
}
} else if (param.adi !== 'V_CEO_Max' && param.adi !== 'I_C_Max') {
const input = document.getElementById(`filter_${param.adi}`);
if (input) {
const filterValue = input.value.trim();
if (filterValue) {
filters[param.adi] = filterValue.toLowerCase();
}
}
}
});
}
let results = Object.entries(malzemeKoduVeritabani);
if (malzemeAdi) {
results = results.filter(([kod, veri]) => veri.malzemeAdi === malzemeAdi);
}
if (malzemeKodu) {
results = results.filter(([kod, veri]) => kod.includes(malzemeKodu));
}
if (tedarikci) {
results = results.filter(([kod, veri]) =>
(veri.tedarikci || '') === tedarikci
);
}
if (kutuNo) {
results = results.filter(([kod, veri]) =>
(veri.kutuNo || '').toLowerCase().includes(kutuNo.toLowerCase())
);
}
if (Object.keys(filters).length > 0) {
results = results.filter(([kod, veri]) => {
return Object.entries(filters).every(([param, value]) => {
if (param === 'V_CEO_Min' || param === 'V_CEO_Max') {
const vCeoMin = parseFloat(veri.V_CEO_Min) || 0;
const vCeoMax = parseFloat(veri.V_CEO_Max) || 0;
if (param === 'V_CEO_Min' && value !== undefined) {
return vCeoMin >= value;
}
if (param === 'V_CEO_Max' && value !== undefined) {
return vCeoMax <= value;
}
return true;
} else if (param === 'I_C_Min' || param === 'I_C_Max') {
const iCMin = parseFloat(veri.I_C_Min) || 0;
const iCMax = parseFloat(veri.I_C_Max) || 0;
if (param === 'I_C_Min' && value !== undefined) {
return iCMin >= value;
}
if (param === 'I_C_Max' && value !== undefined) {
return iCMax <= value;
}
return true;
} else {
const veriValue = String(veri[param] || '').toLowerCase();
return veriValue.includes(String(value).toLowerCase());
}
});
});
}
let titleParts = [];
if (malzemeAdi) titleParts.push(`Malzeme: ${malzemeAdi}`);
if (malzemeKodu) titleParts.push(`Kod: ${malzemeKodu}`);
if (tedarikci) titleParts.push(`Tedarikçi: ${tedarikci}`);
if (kutuNo) titleParts.push(`Kutu No: ${kutuNo}`);
if (Object.keys(filters).length > 0) titleParts.push('Parametrik Filtreler');
resultsTitle.textContent = titleParts.length > 0 ? titleParts.join(' | ') : 'Tüm Malzemeler';
resultsCount.textContent = `${results.length} sonuç`;
if (results.length === 0) {
tableBody.innerHTML = `<tr><td colspan="5" class="stok-no-results">Arama kriterlerine uygun malzeme bulunamadı</td></tr>`;
return;
}
let headers = ['Malzeme Kodu', 'Malzeme Adı', 'Adet', 'Kutu No', 'Tedarikçi'];
let allParams = new Set();
results.forEach(([kod, veri]) => {
Object.keys(veri).forEach(key => {
if (key !== 'malzemeAdi' && key !== 'adet' && key !== 'kutuNo' && key !== 'tedarikci') {
allParams.add(key);
}
});
});
headers.push(...Array.from(allParams));
tableHead.innerHTML = '<tr>' + headers.map(h => `<th>${h}</th>`).join('') + '</tr>';
let rows = '';
results.forEach(([kod, veri]) => {
let cells = [
`<td><strong>${kod}</strong></td>`,
`<td>${veri.malzemeAdi}</td>`,
`<td>
<div class="stok-adet-container">
<button class="stok-adet-btn azalt" onclick="updateAdet('${kod}', -1)">-</button>
<input type="number" class="stok-adet-input" id="adet_input_${kod}" value="0" min="0" max="9999">
<button class="stok-adet-btn" onclick="updateAdet('${kod}', 1)">+</button>
<span class="stok-adet-value">${veri.adet || 0}</span>
</div>
</td>`,
`<td>${veri.kutuNo || '-'}</td>`,
`<td>${veri.tedarikci || '-'}</td>`
];
headers.slice(5).forEach(param => {
const value = veri[param] || '-';
cells.push(`<td style="position: relative;">
<span class="package-display">${value}</span>
<div class="package-blocker"></div>
</td>`);
});
rows += '<tr>' + cells.join('') + '</tr>';
});
tableBody.innerHTML = rows;
setTimeout(() => {
applyFinalSelectionPrevention();
blockPackageCellCompletely();
removeTooltips();
}, 50);
} catch (error) {
console.error('Filtreleme hatası:', error);
showStokError('Bir hata oluştu: ' + error.message);
}
}
function blockPackageCellCompletely() {
const packageCells = document.querySelectorAll('.stok-table td:nth-child(n+6)');
packageCells.forEach(cell => {
const events = ['click', 'mousedown', 'mouseup', 'mouseover', 'mouseout',
'mousemove', 'mouseenter', 'mouseleave', 'contextmenu',
'dblclick', 'selectstart', 'dragstart', 'focus', 'blur',
'touchstart', 'touchend', 'touchmove', 'pointerdown',
'pointerup', 'pointermove', 'pointerover', 'pointerout',
'hover', 'mouseenter', 'mouseleave'];
events.forEach(eventType => {
cell.addEventListener(eventType, function(e) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
return false;
}, true);
});
cell.oncontextmenu = function() {
return false;
};
cell.onclick = function() {
return false;
};
cell.ondblclick = function() {
return false;
};
cell.ondragstart = function() {
return false;
};
cell.onselectstart = function() {
return false;
};
cell.style.cssText += `
pointer-events: none !important;
user-select: none !important;
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
cursor: default !important;
touch-action: none !important;
`;
cell.removeAttribute('title');
cell.removeAttribute('alt');
cell.removeAttribute('aria-label');
const children = cell.querySelectorAll('*');
children.forEach(child => {
events.forEach(eventType => {
child.addEventListener(eventType, function(e) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
return false;
}, true);
});
child.style.cssText += `
pointer-events: none !important;
user-select: none !important;
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
cursor: default !important;
touch-action: none !important;
`;
child.removeAttribute('title');
child.removeAttribute('alt');
child.removeAttribute('aria-label');
});
});
}
function removeTooltips() {
const tooltipSelectors = [
'[title]', '[data-title]', '[data-tooltip]', '[aria-label]',
'.tooltip', '.popup', '.balloon', '.hint', '.tip'
];
tooltipSelectors.forEach(selector => {
const elements = document.querySelectorAll(selector);
elements.forEach(element => {
if (element.closest('.stok-table td:nth-child(n+6)')) {
element.removeAttribute('title');
element.removeAttribute('data-title');
element.removeAttribute('data-tooltip');
element.removeAttribute('aria-label');
}
});
});
setInterval(() => {
const packageCells = document.querySelectorAll('.stok-table td:nth-child(n+6)');
packageCells.forEach(cell => {
if (cell.hasAttribute('title')) {
cell.removeAttribute('title');
}
if (cell.hasAttribute('data-title')) {
cell.removeAttribute('data-title');
}
if (cell.hasAttribute('aria-label')) {
cell.removeAttribute('aria-label');
}
const children = cell.querySelectorAll('*');
children.forEach(child => {
if (child.hasAttribute('title')) {
child.removeAttribute('title');
}
if (child.hasAttribute('data-title')) {
child.removeAttribute('data-title');
}
if (child.hasAttribute('aria-label')) {
child.removeAttribute('aria-label');
}
});
});
}, 1000);
}
function applyFinalSelectionPrevention() {
const tableCells = document.querySelectorAll('.stok-table td, .stok-table th');
tableCells.forEach(cell => {
cell.setAttribute('unselectable', 'on');
cell.setAttribute('onselectstart', 'return false');
cell.setAttribute('onmousedown', 'return false');
cell.setAttribute('ondragstart', 'return false');
cell.setAttribute('ondblclick', 'return false');
cell.setAttribute('oncontextmenu', 'return false');
cell.setAttribute('contenteditable', 'false');
cell.style.cssText = `
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
-webkit-touch-callout: none !important;
pointer-events: none !important;
cursor: default !important;
-webkit-tap-highlight-color: transparent !important;
`;
if (!cell.querySelector('.stok-adet-container') && cell.innerHTML.trim() !== '') {
const content = cell.innerHTML;
cell.innerHTML = `<span style="
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
pointer-events: none !important;
">${content}</span>`;
}
const cellIndex = Array.from(cell.parentNode.children).indexOf(cell);
if (cellIndex >= 5) {
cell.style.cssText += `
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
`;
}
});
const interactiveElements = document.querySelectorAll('.stok-adet-btn, .stok-adet-input');
interactiveElements.forEach(element => {
element.style.cssText = `
-webkit-user-select: ${element.classList.contains('stok-adet-input') ? 'text !important' : 'none !important'};
-moz-user-select: ${element.classList.contains('stok-adet-input') ? 'text !important' : 'none !important'};
-ms-user-select: ${element.classList.contains('stok-adet-input') ? 'text !important' : 'none !important'};
user-select: ${element.classList.contains('stok-adet-input') ? 'text !important' : 'none !important'};
pointer-events: auto !important;
z-index: 100 !important;
position: relative !important;
`;
});
}
function updateAdet(malzemeKodu, islem) {
try {
const inputElement = document.getElementById(`adet_input_${malzemeKodu}`);
const girilenDeger = parseInt(inputElement.value) || 0;
const mevcutAdet = parseInt(malzemeKoduVeritabani[malzemeKodu].adet || 0);
let yeniAdet;
if (islem === 1) {
yeniAdet = mevcutAdet + girilenDeger;
} else {
yeniAdet = Math.max(0, mevcutAdet - girilenDeger);
}
malzemeKoduVeritabani[malzemeKodu].adet = yeniAdet.toString();
userMalzemeKoduVeritabani[malzemeKodu] = malzemeKoduVeritabani[malzemeKodu];
localStorage.setItem('userMalzemeKoduVeritabani', JSON.stringify(userMalzemeKoduVeritabani));
applyFilters();
const islemAdi = islem === 1 ? 'eklendi' : 'çıkarıldı';
showStokMessage(`${malzemeKodu} için ${girilenDeger} adet ${islemAdi}. Yeni adet: ${yeniAdet}`);
} catch (error) {
console.error('Adet güncelleme hatası:', error);
showStokError('Adet güncellenirken bir hata oluştu: ' + error.message);
}
}
function showStokMessage(message) {
const tableBody = document.getElementById('table-body');
const messageRow = document.createElement('tr');
messageRow.innerHTML = `<td colspan="100%" style="background: #d4edda; color: #155724; text-align: center; padding: 10px; font-weight: bold;">${message}</td>`;
tableBody.insertBefore(messageRow, tableBody.firstChild);
setTimeout(() => {
if (messageRow.parentNode) {
messageRow.parentNode.removeChild(messageRow);
}
}, 3000);
}
function clearFilters() {
const filterInputs = document.querySelectorAll('#filter-grid input, #filter-grid select');
filterInputs.forEach(input => input.value = '');
applyFilters();
}
function clearAll() {
document.getElementById('malzeme_adi_select').value = '';
document.getElementById('malzeme_kodu_search').value = '';
document.getElementById('tedarikci_search').value = '';
document.getElementById('kutu_no_search').value = '';
document.getElementById('filter-section').classList.remove('active');
document.getElementById('table-head').innerHTML = '<tr><th>Malzeme Kodu</th><th>Malzeme Adı</th><th>Adet</th><th>Kutu No</th><th>Tedarikçi</th></tr>';
document.getElementById('table-body').innerHTML = '<tr><td colspan="5" class="stok-no-results">Arama yapmak için yukarıdaki alanları kullanın</td></tr>';
document.getElementById('results-title').textContent = 'Arama Sonuçları';
document.getElementById('results-count').textContent = '0 sonuç';
}
function exportToCSV() {
const table = document.getElementById('results-table');
const rows = table.querySelectorAll('tr');
if (rows.length <= 1) {
alert('Dışa aktarılacak veri bulunamadı!');
return;
}
let csv = [];
const headers = Array.from(rows[0].querySelectorAll('th')).map(th => th.textContent);
csv.push(headers.join(','));
for (let i = 1; i < rows.length; i++) {
const cells = rows[i].querySelectorAll('td');
const row = [];
cells.forEach(cell => {
if (cell.querySelector('.stok-adet-value')) {
row.push(cell.querySelector('.stok-adet-value').textContent);
} else {
row.push(cell.textContent);
}
});
csv.push(row.join(','));
}
const csvContent = csv.join('\n');
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', 'stok_listesi.csv');
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function showStokLoading() {
const tableBody = document.getElementById('table-body');
tableBody.innerHTML = '<tr><td colspan="100%" class="stok-loading">Yükleniyor...</td></tr>';
}
function showStokError(message) {
const tableBody = document.getElementById('table-body');
tableBody.innerHTML = `<tr><td colspan="100%" class="stok-error">${message}</td></tr>`;
}
window.onload = function() {
// Eğer veritabanı boşsa örnek veri yükle
if (Object.keys(malzemeKoduVeritabani).length === 0) {
initializeSampleData();
}
populateMalzemeAdlari();
populateTedarikciler();
document.addEventListener("click", function (e) {
closeAllLists(e.target);
});
document.addEventListener('selectstart', function(e) {
const target = e.target;
const tagName = target.tagName.toLowerCase();
if (tagName !== 'input' && tagName !== 'select') {
e.preventDefault();
e.stopPropagation();
return false;
}
if (tagName === 'input' && target.type !== 'text' && target.type !== 'number') {
e.preventDefault();
e.stopPropagation();
return false;
}
});
document.addEventListener('mousedown', function(e) {
const target = e.target;
if (target.closest('.stok-table') &&
!target.closest('.stok-adet-input') &&
!target.closest('button') &&
!target.closest('select')) {
e.preventDefault();
return false;
}
});
document.addEventListener('dragstart', function(e) {
if (e.target.closest('.stok-table')) {
e.preventDefault();
return false;
}
});
document.addEventListener('dblclick', function(e) {
if (e.target.closest('.stok-table') &&
!target.closest('.stok-adet-input')) {
e.preventDefault();
return false;
}
});
document.addEventListener('contextmenu', function(e) {
if (e.target.closest('.stok-table')) {
e.preventDefault();
e.stopPropagation();
return false;
}
});
document.addEventListener('click', function(e) {
if (e.target.closest('.stok-table td:nth-child(n+6)')) {
e.preventDefault();
e.stopPropagation();
return false;
}
});
document.addEventListener('touchstart', function(e) {
if (e.target.closest('.stok-table td:nth-child(n+6)')) {
e.preventDefault();
e.stopPropagation();
return false;
}
});
document.addEventListener('touchend', function(e) {
if (e.target.closest('.stok-table td:nth-child(n+6)')) {
e.preventDefault();
e.stopPropagation();
return false;
}
});
document.addEventListener('mouseover', function(e) {
if (e.target.closest('.stok-table td:nth-child(n+6)')) {
e.preventDefault();
e.stopPropagation();
return false;
}
});
document.addEventListener('mouseenter', function(e) {
if (e.target.closest('.stok-table td:nth-child(n+6)')) {
e.preventDefault();
e.stopPropagation();
return false;
}
});
setTimeout(() => {
applyFinalSelectionPrevention();
blockPackageCellCompletely();
removeTooltips();
}, 100);
};
</script>
</body>
</html>