index.ctp 5.14 KB
<div class="materiels index">
<?php echo '<h2><i class="icon-list"></i> Liste des matériels ('.$nbMateriels.')</h2>'; ?>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <th><?= $this->Paginator->sort('designation','Désignation') ?></th>
                <th><?= $this->Paginator->sort('numero_laboratoire', 'N° interne (labo)') ?></th>
                <th><?= $this->Paginator->sort('categorie_id', 'Catégorie') ?></th>
                <th><?= $this->Paginator->sort('organisme_id', 'Org.') ?></th>
                <th><?= $this->Paginator->sort('numero_inventaire_organisme', 'N° Invent. Org.') ?></th>
                <th><?= $this->Paginator->sort('nom_responsable', 'Responsable') ?></th>
                <th><?= $this->Paginator->sort('status', 'Statut') ?></th>
                <th><?= $this->Paginator->sort('date_acquisition', 'Date Achat') ?></th>
                <th><?= $this->Paginator->sort('etiquette', 'Et') ?></th>
                <th class="actions"><?= __('') ?></th>
                <th class="actions"><?= __('') ?></th>
                <th class="actions"><?= __('') ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($materiels as $materiel): ?>
            <tr>
 				<td><?= $materiel->has('designation') ? $this->Html->link($materiel->designation, ['controller' => 'Materiels', 'action' => 'view', $materiel->id]) : '' ?></td>
                <td><?= h($materiel->numero_laboratoire) ?></td>
                <td><?= $materiel->has('category') ? h($materiel->category->nom) : '' ?></td>
                <td><?= $materiel->has('organisme') ? h($materiel->organisme->nom) : '' ?></td>
                <td><?= h($materiel->numero_inventaire_organisme) ?></td>
                <td><?= h($materiel->nom_responsable) ?></td>
                <td><?= h($materiel->status) ?></td>
                <td><?= h($materiel->date_acquisition) ?></td>
                <td><?php if (h($materiel->etiquette) == '1') { echo 'Y'; } else { echo 'N'; } ?></td>

                <td class="actions" style="padding: 6px 0;">
                    <?= $this->Html->link(__('<i class="icon-pencil"></i>'), ['action' => 'edit', $materiel->id], ['title' => 'Editer', 'style' => 'margin: 0 2px', 'escape' => false ]) ?>
                </td>
                <td class="actions" style="padding: 6px 0;">
                    <?php 
                    if(h($materiel->status) == 'CREATED') {
                    	echo $this->Form->postLink('<i class="icon-ok-sign"></i>',
                    			['action' => 'statusValidated', $materiel->id],
                    			['title' => 'Valider', 'style' => 'margin: 0 2px', 'escape' => false,
                    			'confirm' => __('Êtes-vous sur de vouloir validé # {0}?', $materiel->designation)]);
                    } 
                    else if (h($materiel->status) == 'VALIDATED' && h($materiel->nom_responsable) == $username) {
                    	echo $this->Form->postLink('<i class="icon-inbox"></i>',
                    			['action' => 'statusToBeArchived', $materiel->id],
                    			['title' => 'Demander la sortie de l\'inventaire', 'style' => 'margin: 0 2px', 'escape' => false,
                    			'confirm' => __('Êtes-vous sur de vouloir faire une demande d\'archive # {0}?', $materiel->designation)]);
                    	
                    }
                    else if (h($materiel->status) == 'VALIDATED'){
                    	echo $this->Form->postLink('<i class="icon-inbox"></i>',
                    			['action' => 'statusArchived', $materiel->id],
                    			['title' => 'Sortir de l\'inventaire', 'style' => 'margin: 0 2px', 'escape' => false,
                    			'confirm' => __('Êtes-vous sur de vouloir archivé # {0}?', $materiel->designation)]);
                    }
                   
                    ?>
                </td>
                <td class="actions" style="padding: 6px 0;">
                   <?php 
                   if (h($materiel->status) == 'CREATED') {
                   		echo $this->Form->postLink(__('<i class="icon-trash"></i>'), ['action' => 'delete', $materiel->id], ['title' => 'Supprimer', 'style' => 'margin: 0 2px', 'escape' => false, 'confirm' => __('Êtes-vous sur de vouloir supprimer # {0}?', $materiel->designation)]);
                   }
                   ?>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    

    
    <div class="paging" style="color: black;">
      		<?= $this->Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>
    		<?= $this->Paginator->first('<< ' . __(''), ['class' => 'prev']) ?>
            <?= $this->Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?>
            <?= $this->Paginator->numbers(['separator' => '']) ?>
            <?= $this->Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?>
            <?= $this->Paginator->last(__('') . ' >>', ['class' => 'next']) ?>
    </div>
</div>


    	<div class="actions">
			<?php echo $this->element('menu') ?>
			<?php echo $this->element('menu_index', 
			[ 'pluralHumanName' => 'Matériels',
			'singularHumanName' => 'Matériel' ]) ?>
		</div>