index.ctp 3.46 KB

<div class="emprunts index">
<?php echo '<h2><i class="icon-list"></i> Liste des emprunts ('.$nbEmprunts.')</h2>'; ?>
    <table style="border-collapse: separate; border-spacing: 0;">
        <thead>
            <tr>
            	<th class="actions"><?= __('') ?></th>
            
                <th><?= $this->Paginator->sort('id', 'N°') ?></th>
                <th><?= $this->Paginator->sort('materiel_id', 'Matériel') ?></th>
                <th><?= $this->Paginator->sort('numero_laboratoire', 'N° interne (labo)') ?></th>
                <th><?= $this->Paginator->sort('emprunt_interne', 'Type') ?></th>
                <th><?= $this->Paginator->sort('date_emprunt' ,'Date emprunt') ?></th>
                <th><?= $this->Paginator->sort('date_retour_emprunt', 'Date retour') ?></th>
				<th><?= $this->Paginator->sort('nom_emprunteur', 'Emprunteur') ?></th>
				<th><?= $this->Paginator->sort('site_id', 'Lieu stockage') ?></th>
         		
         		
            </tr>
        </thead>
        <tbody>
            <?php foreach ($emprunts as $emprunt): ?>
            <tr>
                <td class="actions" style="padding: 6px 0; text-align: left;">
                     <?php if(($role == 'Utilisateur' && in_array($username, [$emprunt->nom_createur, $emprunt->nom_emprunteur])) || (in_array($role, ['Responsable', 'Administration', 'Administration Plus', 'Super Administrateur']))) { ?>
                    <?= $this->Html->link(__('<i class="icon-pencil"></i>'), ['action' => 'edit', $emprunt->id], ['title' => 'Editer', 'style' => 'margin: 0 2px', 'escape' => false ]) ?>
                    <?= $this->Form->postLink(__('<i class="icon-trash"></i>'), ['action' => 'delete', $emprunt->id], ['title' => 'Supprimer', 'style' => 'margin: 0 2px', 'escape' => false, 'confirm' => __('Êtes-vous sur de vouloir supprimer # {0}?', $emprunt->id)]) ?>
               		<?php } ?>
                </td>
            
                <td class="smallText"><?php echo $this->Html->link('Emprunt '.$this->Number->format($emprunt->id), ['action' => 'view', $emprunt->id])?></td>
                <td class="smallText"><?= $emprunt->has('materiel') ? $this->Html->link($emprunt->materiel->designation, ['controller' => 'Materiels', 'action' => 'view', $emprunt->materiel->id]) : '' ?></td>
                <td class="smallText"><?= $emprunt->has('materiel') ? h($emprunt->materiel->numero_laboratoire) : '' ?></td>
                <td class="smallText"><?php if (h($emprunt->emprunt_interne) == '1') { echo 'Interne'; } else { echo 'Externe'; } ?></td>
                <td class="smallText"><?= h($emprunt->date_emprunt) ?></td>
                <td class="smallText"><?= h($emprunt->date_retour_emprunt) ?></td>
                <td class="smallText"><?= h($emprunt->nom_emprunteur) ?></td>
                <td class="smallText"><?php if (h($emprunt->emprunt_interne) == '1') { echo h($emprunt->site->nom).' - '.h($emprunt->e_lieu_detail); } else { echo h($emprunt->laboratoire); }  ?></td>


            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    
      	<p><?= $this->Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?></p>
      	
   	<div class="paging">
            <?= $this->Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?>
            <?= $this->Paginator->numbers(['separator' => '']) ?>
            <?= $this->Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?>
    </div>
</div>

    	<div class="actions">
			<?php echo $this->element('menu') ?>
		</div>