[% META title = 'Devices' %]

  <div id="headimg">
    <img src="/grafik/area.jpg" width="869" height="69" alt="" />
  </div>
  <div id="headtxt">Konfigurieren Sie Ihre Endgeräte.</div>
  
  <div id="main">
      
    <div id="topmsg">
        <p> [% messages.topmsg %] </p>
    </div>
    <div id="toperr">
        <p> [% messages.toperr %] </p>
        <p> [% messages.prov_error %] </p>
    </div>
 
    <div class="sperrehead"> 
        <h3>Test</h3>
        <h2 class="umleitungfuer">Einstellungen für [% subscriber.active_number %]</h2>
    </div>

    <div id="spalten11">

        <div class="spalte1">
			<div class="[% dev.spa.active ? "devwin_active" : "devwin_inactive" %]">
				<h3>Konfiguration SPA9000 PBX</h3>
				[% IF dev.spa.active %]
					<fieldset class="devmask">
						<form action="/device/spa" method="post">
							<table>
								<tr>
									<td><label for="spaip">IP Adresse:</td>
									<td><input type="text" size="30" name="ip" id="spaip" value="[% dev.spa.ip %]"/>
								</tr>
								<tr>
									<td><label for="spamac">MAC Adresse:</td>
									<td><input type="text" size="30" name="mac" id="spamac" value="[% dev.spa.mac %]"/>
								</tr>

								<tr>
									<td><label for="spagroup">Gruppen:</td>
									<td>
										<input type="text" size="4" name="group" id="spagroup" value=""/>
										<button name="addgrp" value="1">+</button>
									</td>
								</tr>
								[% FOREACH group IN dev.spa.groups %]
									<tr>
										<td/>
										<td>
											[% group.ext %]
											<button name="delgrp" value="[% group.ext %]">-</button>
										</td>
									</tr>
								[% END %]
								
								<tr>
									<td><label for="spaext">Durchwahl Port 1:</td>
									<td>
										<input type="text" size="4" name="spafxs1" id="spafxs1" value="[% dev.spa.fxs1.ext %]"/> in Gruppe 
											<select name="fxs1grp" id="fxs1grp">
													<option></option>
												[% FOREACH group IN dev.spa.groups %]
													<option [% 'selected' IF dev.spa.fxs1.group == group.ext %]>[% group.ext %]</option>
												[% END %]
											</select>
									</td>
								</tr>
								<tr>
									<td><label for="spaext">Durchwahl Port 2:</td>
									<td>
										<input type="text" size="4" name="spafxs2" id="spafxs2" value="[% dev.spa.fxs2.ext %]"/> in Gruppe 
											<select name="fxs2grp" id="fxs2grp">
													<option></option>
												[% FOREACH group IN dev.spa.groups %]
													<option [% 'selected' IF dev.spa.fxs2.group == group.ext %]>[% group.ext %]</option>
												[% END %]
											</select>
									</td>
								</tr>

								<tr>
									<td><label for="spaext">Durchwahlen:</td>
									<td>
										<input type="text" size="4" name="ext" id="spaext" value=""/> in Gruppe 
											<select name="grp" id="phonegrp">
													<option></option>
												[% FOREACH group IN dev.spa.groups %]
													<option>[% group.ext %]</option>
												[% END %]
											</select>
										<button name="addext" value="1">+</button>
									</td>
								</tr>
								[% FOREACH phone IN dev.spa.children %]
									<tr>
										<td/>
										<td>
											[% phone.ext %] [% IF phone.group %]([% phone.group %])[% END %]
											<button name="delext" value="[% phone.ext %]">-</button>
										</td>
									</tr>
								[% END %]
								<tr>
									<td colspan="2">
										<input type="submit" name="savespa" value="Speichern"/>
									</td>
								</tr>
							</table>
						</form>
					</fieldset>
				[% ELSE %]
					<table>
						<tr>
							<td>IP Adresse:</td>
							<td>[% dev.spa.ip %]</td>
						</tr>
						<tr>
							<td>MAC Adresse:</td>
							<td>[% dev.spa.mac %]</td>
						</tr>
						[% IF dev.spa.sync %]
							<tr>
								<td colspan="2"><a href="[% dev.spa.sync %]" target="_blank">Jetz synchronisieren</a></td>
							</tr>
						[% END %]
					</table>
					<form action="/device/spa" method="post">
						<button type="submit" name="confspa" value="1">Ändern</button>
					</form>
				[% END %]
			</div>

			[% FOREACH phone IN dev.spa.children %]
				<div class="[% phone.active ? "devwin_active" : "devwin_inactive" %]"
					<h3>Konfiguration Telefon DW [% phone.ext %][% IF phone.usr %] ([% phone.usr %])[% END %]</h3>
					[% IF phone.active %]
						<fieldset class="devmask">
							<form action="/device/phone" method="post">
								<table>
									<tr>
										<td><label for="phoneip">IP Adresse:</td>
										<td><input type="text" size="30" name="ip" id="phoneip" value="[% phone.ip %]"/>
									</tr>
									<tr>
										<td><label for="phonemac">MAC Adresse:</td>
										<td><input type="text" size="30" name="mac" id="phonemac" value="[% phone.mac %]"/>
									</tr>
									<tr>
										<td><label for="phoneusr">Name:</td>
										<td><input type="text" size="30" name="usr" id="phoneusr" value="[% phone.usr %]"/>
									</tr>
									<tr>
										<td><label for="phonepass1">Passwort:</td>
										<td><input type="password" size="30" name="pass1" id="phonepass1" value="[% phone.subscriber.password %]"/>
									</tr>
									<tr>
										<td><label for="phonepass2">Passwort wiederholen:</td>
										<td><input type="password" size="30" name="pass2" id="phonepass2" value="[% phone.subscriber.password %]"/>
									</tr>
									<tr>
										<td colspan="2">
											<button type="submit" name="savephone" value="[% phone.ext %]">Speichern</button>
										</td>
									</tr>
								</table>
							</form>
						</fieldset>
					[% ELSE %]
						[% IF phone.configured%]
							<table>
								<tr>
									<td>IP Adresse:</td>
									<td>[% phone.ip %]</td>
								</tr>
								<tr>
									<td>MAC Adresse:</td>
									<td>[% phone.mac %]</td>
								</tr>
								[% IF phone.sync %]
								<tr>
									<td colspan="2"><a href="[% phone.sync %]" target="_blank">Jetz synchronisieren</a></td>
								</tr>
								[% END %]
							</table>
							<form action="/device/phone" method="post">
								<button type="submit" name="confphone" value="[% phone.ext %]">Ändern</button>
							</form>
						[% ELSE %]
							<div>Noch nicht konfiguriert</div>
						[% END %]
					[% END %]
				</div>
			[% END %]
		</div>

        <div class="spalte2">
        </div>
    </div>

  </div><br clear="all" />

