<?php require dirname(__DIR__).'/app/core.php';require_roles(['admin','standard']);$id=(int)($_GET['id']??0);$a=['serial_number'=>'','owned_by'=>'sefiso','model'=>'InMetro','asset_condition'=>'new','designation'=>'For sale','current_location'=>'Receiving','notes'=>''];if($id){$s=$pdo->prepare('SELECT * FROM afguards WHERE id=?');$s->execute([$id]);$a=$s->fetch()?:exit('Not found');}$title=$id?'Edit Sensor':'Add Sensor';require dirname(__DIR__).'/views/head.php';?><h1><?=e($title)?></h1><form class="panel" method="post" action="asset-save.php"><input type="hidden" name="csrf" value="<?=e(token())?>"><input type="hidden" name="id" value="<?=$id?>"><?php foreach(['serial_number','notes'] as $n):?><label><span><?=e(ucwords(str_replace('_',' ',$n)))?></span><input id="<?=$n?>" name="<?=$n?>" value="<?=e($a[$n])?>" required></label><?php endforeach;?><label><span>Owned by</span><select name="owned_by"><option>sefiso</option><option>client</option></select></label><label><span>Model</span><select name="model"><option>InMetro</option><option>Offshore</option></select></label><label><span>Condition</span><select name="asset_condition"><option>new</option><option>used</option><option>scrap</option></select></label><label><span>Designation</span><select name="designation"><option>For sale</option><option>Rental</option><option>Loan</option><option>Recertification</option><option>Interim Recert</option><option>Recalibration</option></select></label><label><span>Location</span><select name="current_location"><option>SERM1</option><option>Receiving</option><option>Laboratory</option><option>Shipping</option><option>GmbH</option><option>Lost</option></select></label><button>Save</button></form><?php require dirname(__DIR__).'/views/foot.php';?>