@לימוד-בתורת-מרן הוספתי אפשרות אישור באנטר (במקום דווקא בכפתור "הגדר על שלוחה ראשית"):
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8">
<title>הגדרת מספר אישי</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(45deg, #0f2027, #203a43, #2c5364);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
color: #fff;
}
.container {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(15px);
padding: 40px;
border-radius: 25px;
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
width: 380px;
border: 1px solid rgba(255, 255, 255, 0.1);
text-align: center;
}
h2 { margin-bottom: 30px; font-weight: 300; letter-spacing: 1px; }
label {
display: block;
text-align: right;
font-size: 13px;
opacity: 0.8;
margin: 10px 2px 2px;
}
input {
width: 100%;
padding: 14px;
margin: 4px 0;
border: none;
border-radius: 12px;
background: rgba(255, 255, 255, 0.05);
color: #fff;
font-size: 16px;
border: 1px solid rgba(255, 255, 255, 0.2);
transition: 0.3s;
box-sizing: border-box;
}
input:focus {
outline: none;
background: rgba(255, 255, 255, 0.15);
border-color: #00d2ff;
}
button {
width: 100%;
padding: 15px;
margin-top: 25px;
border: none;
border-radius: 12px;
background: linear-gradient(to right, #00d2ff, #3a7bd5);
color: white;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.3s, opacity 0.2s;
}
button:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(0, 210, 255, 0.4);
}
button:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
#status {
margin-top: 25px;
font-size: 14px;
font-weight: bold;
min-height: 20px;
}
.success { color: #00ffcc; }
.error { color: #ff6666; }
</style>
</head>
<body>
<div class="container">
<h2>הגדרת מספר אישי</h2>
<label for="systemNum">מספר מערכת</label>
<input type="text" id="systemNum" placeholder="מספר מערכת" inputmode="numeric" autocomplete="off">
<label for="password">סיסמת ניהול</label>
<input type="password" id="password" placeholder="סיסמת ניהול" autocomplete="current-password">
<button id="submitBtn" onclick="setupRouting()">הגדר על שלוחה ראשית</button>
<div id="status" role="status" aria-live="polite"></div>
</div>
<script>
const numInput = document.getElementById('systemNum');
const passInput = document.getElementById('password');
const submitBtn = document.getElementById('submitBtn');
const statusDiv = document.getElementById('status');
// אפשר גם לשלוח עם Enter מתוך שדה הסיסמה, לא רק בלחיצה על הכפתור
passInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter') setupRouting();
});
async function setupRouting() {
const num = numInput.value.trim();
const pass = passInput.value;
if (!num || !pass) {
statusDiv.className = 'error';
statusDiv.innerText = 'אנא הזן מספר מערכת וסיסמה';
return;
}
submitBtn.disabled = true;
statusDiv.className = '';
statusDiv.innerText = 'מבצע הגדרה, נא להמתין...';
// קידוד תקין של כל פרמטר בנפרד - מונע שבירת הכתובת אם הסיסמה/המספר
// מכילים תווים מיוחדים כמו & # % + : וכד'.
const params = new URLSearchParams({
token: `${num}:${pass}`,
path: 'ivr2:/',
type: 'routing_yemot',
routing_yemot_number: num
});
const url = `https://www.call2all.co.il/ym/api/UpdateExtension?${params.toString()}`;
try {
const response = await fetch(url);
let data;
try {
data = await response.json();
} catch (parseErr) {
statusDiv.className = 'error';
statusDiv.innerText = 'התקבלה תשובה לא תקינה מהשרת';
return;
}
if (response.ok && data.responseStatus === 'OK') {
statusDiv.className = 'success';
statusDiv.innerText = `הוגדר בהצלחה מספר אישי למערכת ומספר המערכת: ${num}`;
} else {
statusDiv.className = 'error';
statusDiv.innerText = `לא ניתן להגדיר מספר אישי למערכת ${num}: סיסמה או מספר שגויים`;
}
} catch (error) {
statusDiv.className = 'error';
statusDiv.innerText = 'שגיאת תקשורת: ודא שיש חיבור אינטרנט תקין';
} finally {
submitBtn.disabled = false;
}
}
</script>
</body>
</html>