<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>

    <!-- start page title -->
    <div class="row">
      <div class="col-12">
        <div class="page-title-box">
          <div class="page-title-right">
            <ol class="breadcrumb m-0">
              <li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>">the-tool</a></li>
              <li class="breadcrumb-item"><a href="<?=self::getUrl("Network")?>">Netzgebiete</a></li>
              <li class="breadcrumb-item active"><?=($network->id) ? "bearbeiten" : "Neu" ?></li>
            </ol>
          </div>
          <h4 class="page-title">Netzgebiete</h4>
        </div>
      </div>
    </div>
    <!-- end page title -->
    
    <div class="row">
      <div class="col-lg-12">
        
        <div class="card">
          <div class="card-body">
            <h4 class="header-title mb-2"><?=($network->id) ? "Netzbereich bearbeiten" : "Neuer Netzbereich"?></h4>
            
            <form class="form-horizontal" method="post" action="<?=self::getUrl("Network", "save")?>">
              <div class="card">
                <div class="card-body">
                  
                  <input type="hidden" name="id" value="<?=$network->id?>" />
                  
                  <div class="form-group row">
                    <label class="col-lg-2 col-form-label" for="name">Name</label>
                    <div class="col-lg-10">
                      <input type="text" class="form-control" name="name" id="name" value="<?=$network->name?>">
                    </div>
                  </div>
                  
                  <div class="form-group row">
                    <label class="col-lg-2 col-form-label" for="owner_id">Besitzer</label>
                    <div class="col-lg-10">
                      <select class="select2 form-control " name="owner_id" id="owner_id">
                        <option></option>
                        <?php foreach($owners as $owner): ?>
                          <option value="<?=$owner->id?>" <?=($network->owner_id == $owner->id) ? "selected='selected'" : ""?>><?=($owner->getCompanyOrName())?></option>
                        <?php endforeach; ?>
                      </select>
                    </div>
                  </div>
                  
                  <div class="form-group row">
                    <label class="col-lg-2 col-form-label" for="sytemowner_action_status">Workorder Filter (Admins)</label>
                    <div class="col-lg-10">
                      <select class="select2 form-control " name="sytemowner_action_status" id="sytemowner_action_status">
                        <option></option>
                        <option value="pipework_needed" <?=($network->sytemowner_action_status == "pipework_needed") ? "selected='selected'" : ""?>>Tiefbau ausständig</option>
                        <option value="building_connected" <?=($network->sytemowner_action_status == "building_connected") ? "selected='selected'" : ""?>>Tiefbau erledigt</option>
                        <option value="term_connected" <?=($network->sytemowner_action_status == "term_connected") ? "selected='selected'" : ""?>>Anschluss passiv erschlossen</option>
                      </select>
                    </div>
                  </div>
                  
                </div>
                
              </div>
              
              <div class="card">
                <div class="card-body">
                  <div class="form-group row">
                    <label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
                    <div class="col-lg-10">
                      <textarea id="note" class="form-control" name="note" rows="5"><?=$network->note?></textarea>
                    </div>
                  </div>
                </div>
              </div>
              
              <div class="form-group row">
                <label class="col-lg-2"></label>
                <div class="col-lg-10">
                  <button type="submit" class="btn btn-primary">Speichern</button>
                </div>
              </div>
              
              
              
            </form>
          </div>
        </div>
        
      </div>
    </div>

<script type="text/javascript">
  $("#parent_id").select2({
    allowClear: true,
    placeholder: ""
  });
  $("#addresstypes").select2();
</script>

<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>