<div class="tlo-default">
<?php if (isset($id)):  
    $tytul = 'Edytuj zadanie';
 else: 
    $tytul = 'Dodaj zadanie';
 endif; ?> 
<?php
echo form_open('');
?>
<div class="container-fluid"> 
    <h1 class="section-title dash-left"><?php echo $this->company; ?></h1>
</div>

<div class="container">

    <div class="col-xs-12 col-sm-12 col-md-9 offset-md-3 col-lg-9 offset-lg-3 ramka">
        <div class="row margtop20">
        <h2 class="karta_tytul"><?php echo $tytul; ?></h2>
        </div>    
        <form>
            <div class="row margtop20">
                <div class="col-sm-4 col-sm-offset-2 input_label">
                    Projekt
                </div>
                <div class="col-sm-8">
                    <?php echo form_dropdown($project_id, $project_array, $project_select); ?>   
                </div>    
            </div>

            <div class="row margtop20">
                <div class="col-sm-4 col-sm-offset-2 input_label">
                    Nazwa zadania
                </div>
                <div class="col-sm-8">
                    <?php echo form_input($task_name); ?>     
                </div>    
            </div>        
        
            <div class="row margtop20">
                <div class="col-sm-4 col-sm-offset-2 input_label">
                    Opis zadania
                </div>
                <div class="col-sm-8">
                    <?php echo form_textarea($description); ?>   
                </div>    
            </div>        
        
            <div class="row margtop20">
                <div class="col-sm-4 col-sm-offset-2 input_label">
                    Data rozpoczęcia
                </div>
                <div class="col-sm-8">
                    <?php echo form_input($date_start); ?>     
                </div>    
            </div>      
        
            <div class="row margtop20">
                <div class="col-sm-4 col-sm-offset-2 input_label">
                    Data zakończenia
                </div>
                <div class="col-sm-8">
                    <?php echo form_input($date_stop); ?>     
                </div>    
            </div>      
        
            <div class="row margtop20">
                <div class="col-sm-4 col-sm-offset-2 input_label">
                    Czas trwania w godzinach
                </div>
                <div class="col-sm-8">
                    <?php echo form_input($duration); ?>     
                </div>    
            </div>      
        
             <hr />
            <div class="row margtop20 text-right">
                <div class="col-sm-12">
                    <button type="submit" class="submitZielony">Zapisz</button>
                </div>
            </div>  
        </form>
    </div>
    
    
<?php
echo form_close();
if (is_numeric($id)):
    ?>    
    <div class="col-sm-12" id="professions">        
        <h1>Lista stanowisk : </h1>
        <div class="table-responsive">
            <table class="table table-hover">
                <thead>  
                <th>        
                    Stanowisko
                </th>                
                <th>        
                    Ilość studentów
                </th>    
                <th>        
                    Usuń
                </th>                
                </thead>
                <tbody>
                    <?php
                    if (!empty($task_professions)) :
                        foreach ($task_professions as $data):
                            ?>
                            <tr>
                                <td>        
                                    <?php echo $data['profession_name']; ?>
                                </td>                
                                <td>        
                                    <?php echo $data['number_of_students']; ?>                                
                                </td>    
                                <td>        
                                    <?php echo anchor(base_url('tasks/delete_profession/' . $data['task_id'] . '/' . $data['profession_id']), '<img src="' . base_url('assets/img/nowe/ikona_usun.png') . '">'); ?>
                                </td>                
                            </tr>
                            <?php
                        endforeach;
                    else:
                        ?>
                        <tr>
                            <td colspan="5">
                                <b style="color:red">Zadanie nie ma przypisanych jeszcze żadnych stanowisk</b>
                            </td>
                        </tr>
                    <?php endif;
                    ?>
                </tbody>
            </table>
        </div>    
        <?php
        $this->load->view('tasks/form_add_professions');
        ?>
    </div>    
<?php endif;
?>

</div>
</div>

<script>
    $(function () {
        $(".datepicker").datepicker({
            format: 'yyyy-mm-dd'
        });
    });
</script>
