<style type="text/css">
::-webkit-scrollbar {
    display: none;
}
#dynamic-content-container{background: #fff;}
    .navbar-default.navbar-static-side{display: none !important;}
    #page-wrapper{margin: 0px !important; padding: 0 !important;}
    .row.border-bottom{display: none !important;}
    .footer.fixed{display: none;}
    .ibox-content{padding: 0 !important;}
    body {
    -webkit-print-color-adjust:exact;
    background: #fff;
    }

</style>

<table style="width: 100%; background: #fff;">
    <tr>
        <td><img style="width: 100%; height: 200px;" src="<?= get_branch_image('report'); ?>"></td>
    </tr>
</table>

<table style="width: 100%; margin: 15px 0px; background: #fff;">
    <tr style="margin: 10px 0px;">
        <td style="width: 50%;"><span style="color: #bb0d0d !important; padding: 4px;"><strong style="color: #bb0d0d !important; font-size: 15px;"><?= strtoupper(print_lang($app_lang,'type')); ?>:</strong></span> <strong style="font-size: 14px;"><?php echo print_lang($app_lang,'projects_assigning_report'); ?></strong></td>
        <td style="width: 50%;"><span style="color: #bb0d0d !important; padding: 4px;"><strong style="color: #bb0d0d !important; font-size: 15px;"><?= strtoupper(print_lang($app_lang,'date')); ?>:</strong></span> <strong style="font-size: 14px;"><?php echo display_true_date(date('Y-m-d')); ?></strong></td>
    </tr>
</table>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">

                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th class="text-center" style="min-width:50px; max-width:50px;"><?= print_lang($app_lang,'sr_#'); ?></th>
                                    <th class="text-center"><?= print_lang($app_lang,'date'); ?></th>
                                    <th class="text-center"><?= print_lang($app_lang,'project'); ?></th>
                                    <th class="text-center"><?= print_lang($app_lang,'type'); ?></th>

                                    <th class="text-center"><?= print_lang($app_lang,'name'); ?></th>
                                    <th class="text-center"><?= print_lang($app_lang,'comments'); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $i = 1; foreach($pageData as $row){ ?>
                                    <tr class="text-center">
                                        <td><?= $i++; ?></td>
                                        <td><?= display_true_date($row['created_at']); ?></td>
                                        <td><?= array_key_exists($row['project'],$projects) ? $projects[$row['project']]['name'] : NULL; ?></td>
                                        <td><?= print_lang($app_lang,$row['assign_type']); ?></td>

                                        <?php
                                            $name = NULL;
                                            $comments = NULL;
                                            if($row['assign_type'] == 'employee')
                                            {
                                                $employee_uid = array_key_exists($row['employee'],$ccontracts) ? $ccontracts[$row['employee']]['employee'] : NULL;
                                                $employee_duration_type = array_key_exists($row['employee'],$ccontracts) ? $ccontracts[$row['employee']]['duration_type'] : NULL;
                                                $employee_duration_type = print_lang($app_lang,$employee_duration_type);
                                                $name = array_key_exists($employee_uid,$employees) ? $employees[$employee_uid]['name'] : NULL;
                                                $name = $name.'('.$employee_duration_type.')';
                                                $comments = $row['employee_comments'];
                                            }

                                            if($row['assign_type'] == 'machinery')
                                            {
                                                $name = array_key_exists($row['machinery'],$ccontracts) ? $ccontracts[$row['machinery']]['machinery_name'] : NULL;
                                                $comments = $row['machinery_comments'];
                                            }
                                            
                                            if($row['assign_type'] == 'material')
                                            {
                                                $name = array_key_exists($row['item'],$items) ? $items[$row['item']]['name'] : NULL;
                                                $comments = $row['material_comments'];
                                            }
                                        ?>
                                        <td><?= $name; ?></td>
                                        <td><?= $comments; ?></td>
                                    </tr>
                                <?php } ?>
                            </tbody>
                        </table>    
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>