<?php
/* Smarty version 4.5.3, created on 2025-11-12 22:52:05
  from 'E:\GITHUB\phpnuxbill\ui\ui\admin\odp\edit.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.3',
  'unifunc' => 'content_6914ad25e4e200_12292973',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '7c8a277fc67869bcc62af6f3dfbe9d1a36b5c323' => 
    array (
      0 => 'E:\\GITHUB\\phpnuxbill\\ui\\ui\\admin\\odp\\edit.tpl',
      1 => 1762962716,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:sections/header.tpl' => 1,
    'file:sections/footer.tpl' => 1,
  ),
),false)) {
function content_6914ad25e4e200_12292973 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_subTemplateRender("file:sections/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>

<div class="row">
	<div class="col-sm-12 col-md-12">
	    <div class="panel panel-primary panel-hovered panel-stacked mb30">
		    <div class="panel-heading"><?php echo Lang::T('Edit Optical Distribution Points');?>
</div>
		    <div class="panel-body">

                <form class="form-horizontal" method="post" role="form" action="<?php echo Text::url('');?>
odp/edit-post" >
                    <input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['id'];?>
">
                    <div class="form-group">
						<label class="col-md-2 control-label"><?php echo Lang::T('Name');?>
</label>
						<div class="col-md-6">
							<input type="text" class="form-control" id="name" name="name" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['name'];?>
" readonly>
						</div>
                    </div>
                    <div class="form-group">
						<label class="col-md-2 control-label"><?php echo Lang::T('Amount Port');?>
</label>
						<div class="col-md-6">
							<input type="number" class="form-control" id="amount_port" name="amount_port" placeholder="8" max="16" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['amount_port'];?>
">
						</div>
                    </div>
                    <div class="form-group">
						<label class="col-md-2 control-label"><?php echo Lang::T('Attenuation');?>
</label>
						<div class="col-md-6">
							<input type="text" class="form-control" id="attenuation" name="attenuation" placeholder="-18.15" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['attenuation'];?>
">
						</div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label"><?php echo Lang::T('Address');?>
</label>
                        <div class="col-md-6">
                            <textarea name="address" id="address" class="form-control"><?php echo $_smarty_tpl->tpl_vars['d']->value['address'];?>
</textarea>
                        </div>
                    </div>
                    <div class="form-group">
						<label class="col-md-2 control-label"><?php echo Lang::T('Coordinates');?>
</label>
						<div class="col-md-6">
							<input type="text" name="coordinates" id="coordinates" class="form-control"
                                   placeholder="6.465422, 3.406448" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['coordinates'];?>
">
                            <div id="map" class="mt-2" style="width: 100%; height: 200px; min-height: 150px;"></div>
						</div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label"><?php echo Lang::T('Coverage (meters)');?>
</label>
                        <div class="col-md-6">
                            <input type="number" name="coverage" id="coverage" class="form-control"
                                   placeholder="500" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['coverage'];?>
">
                        </div>
                    </div>
					<div class="form-group">
						<div class="col-lg-offset-2 col-lg-10">
							<button class="btn btn-primary" onclick="return ask(this, '<?php echo Lang::T("Continue the ODP addition process?");?>
')" type="submit"><?php echo Lang::T('Save Changes');?>
</button>
							Or <a href="<?php echo Text::url('');?>
odp/list"><?php echo Lang::T('Cancel');?>
</a>
						</div>
					</div>
                </form>
			</div>
		</div>
	</div>
</div>


    <?php echo '<script'; ?>
 src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"><?php echo '</script'; ?>
>
    <?php echo '<script'; ?>
>
        function getLocation() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(showPosition);
            } else {
                setupMap(51.505, -0.09);
            }
        }

        function showPosition(position) {
            setupMap(position.coords.latitude, position.coords.longitude);
            document.getElementById('coordinates').value = position.coords.latitude + ',' + position.coords.longitude;
        }

        function setupMap(lat, lon) {
            var map = L.map('map').setView([lat, lon], 13);
            L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png', {
                attribution:
                    '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
                    subdomains: 'abcd',
                    maxZoom: 20
            }).addTo(map);
            var marker = L.marker([lat, lon]).addTo(map);
            map.on('click', function(e){
                var coord = e.latlng;
                var lat = coord.lat;
                var lng = coord.lng;
                var newLatLng = new L.LatLng(lat, lng);
                marker.setLatLng(newLatLng);
                $('#coordinates').val(lat + ',' + lng);
            });
        }
        window.onload = function() {
            
            <?php if ($_smarty_tpl->tpl_vars['d']->value['coordinates']) {?>
                setupMap(<?php echo $_smarty_tpl->tpl_vars['d']->value['coordinates'];?>
);
                document.getElementById('coordinates').value = "<?php echo $_smarty_tpl->tpl_vars['d']->value['coordinates'];?>
";
            <?php } else { ?>
                getLocation();
            <?php }?>
            
        }
    <?php echo '</script'; ?>
>


<?php $_smarty_tpl->_subTemplateRender("file:sections/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
}
}
