@@ -83,37 +83,70 @@ <h2>👨🔧 Request Service</h2>
8383</ div >
8484
8585< script >
86- // --- 1. SHEETDB & WHATSAPP LOGIC ---
86+ < div class = "card" >
87+ < h2 > 👨🔧 Request Service</ h2 >
88+ < form id = "sheetdb-form" >
89+ < input type = "text" name = "data[name]" id = "userName" placeholder = "Your Name" required >
90+
91+ < textarea name = "data[message]" id = "userMsg" rows = "4" placeholder = "Describe the machine problem..." required > </ textarea >
92+
93+ < button type = "submit" id = "submitBtn" class = "btn btn-wa" > 💬 Send to Excel & WhatsApp </ button >
94+ </ form >
95+ </ div >
96+
97+ < script >
8798 const form = document.getElementById('sheetdb-form');
99+
88100 form.addEventListener("submit", e => {
89101 e . preventDefault ( ) ;
102+
90103 const btn = document . getElementById ( 'submitBtn' ) ;
91- const nameVal = document . getElementById ( 'name ' ) . value ;
92- const msgVal = document . getElementById ( 'message ' ) . value ;
104+ const nameVal = document . getElementById ( 'userName ' ) . value ;
105+ const msgVal = document . getElementById ( 'userMsg ' ) . value ;
93106
107+ Mallattoo processing agarsiisuu
94108 btn . innerText = "Processing... ⏳" ;
95109 btn . disabled = true ;
96110
111+ Gara SheetDB erguu
97112 fetch ( 'https://sheetdb.io/api/v1/49bhx2brvk9r3' , {
98113 method : 'POST' ,
99114 body : new FormData ( form ) ,
100115 } )
101116 . then ( res => {
102117 if ( res . ok ) {
103- alert ( "✅ Success! Data saved to Excel." ) ;
104- window . open ( `https://wa.me/251904267186?text=Hello Abdurhaman, I am ${ nameVal } . Issue: ${ msgVal } ` , '_blank' ) ;
118+ alert ( "✅ Galatoomi! Odeeffannoon kee Excel irratti galmaa'eera." ) ;
119+
120+ WhatsApp banuu ( Kun sirriitti hojjeta )
121+ let whatsappURL = `https://wa.me/251904267186?text=Hello Abdurhaman, I am ${ nameVal } . Issue: ${ msgVal } ` ;
122+ window . open ( whatsappURL , '_blank' ) ;
123+
105124 form . reset ( ) ;
106125 } else {
107- alert ( "❌ API Error. Check SheetDB settings ." ) ;
126+ alert ( "❌ Database Error: API Link kee ilaali ." ) ;
108127 }
109128 } )
110- . catch ( err => alert ( "❌ Network Error. Please check your connection." ) )
129+ . catch ( err => {
130+ alert ( "❌ Network Error: Internet kee ilaali." ) ;
131+ } )
111132 . finally ( ( ) => {
133+ Button deebisanii hojjechiisuu
112134 btn . innerText = "💬 Send to Excel & WhatsApp" ;
113135 btn . disabled = false ;
114136 } ) ;
115137 } );
116138
139+ Search fi Diagnostics (Akkuma duraatti itti fufa) ---
140+ function searchParts() {
141+ let input = document . getElementById ( "partSearch" ) . value . toUpperCase ( ) ;
142+ let tr = document . getElementById ( "partsTable" ) . getElementsByTagName ( "tr" ) ;
143+ for ( let i = 1 ; i < tr . length ; i ++ ) {
144+ let td = tr [ i ] . getElementsByTagName ( "td" ) [ 0 ] ;
145+ if ( td ) tr [ i ] . style . display = td . innerText . toUpperCase ( ) . indexOf ( input ) > - 1 ? "" : "none" ;
146+ }
147+ }
148+ </ script >
149+
117150 // --- 2. SEARCH LOGIC ---
118151 function searchParts() {
119152 let input = document.getElementById("partSearch").value.toUpperCase();
0 commit comments