Skip to content

Commit

Permalink
UPD: manager reports list
Browse files Browse the repository at this point in the history
  • Loading branch information
Itskiprotich committed Sep 10, 2024
1 parent 32240e3 commit c5c698b
Show file tree
Hide file tree
Showing 16 changed files with 1,203 additions and 737 deletions.
6 changes: 1 addition & 5 deletions src/Controller/FeedbacksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ public function add()

if ($this->Auth->User('id')) {
$this->paginate['limit'] = 5;
$previous_messages = $this->paginate($this->Feedbacks);
// $this->paginate['conditions'] = array('user_id' => $this->Auth->User('id'));
//
// $previous_messages = $this->Feedback->find('all', array('conditions' => array('id' => $this->Auth->User('id'))));
// $previous_messages = $this->paginate();
$previous_messages = $this->paginate($this->Feedbacks);
}
$users = $this->Feedbacks->Users->find('list', ['limit' => 200])->all();
$this->set(compact('feedback', 'users'));
Expand Down
14 changes: 11 additions & 3 deletions src/Controller/Manager/AggregatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,26 @@
*/
class AggregatesController extends AppController
{


public $page_options = array('5' => '5', '10' => '10', '25' => '25', '50' => '50', '100' => '100');
/**
* Index method
*
* @return \Cake\Http\Response|null|void Renders view
*/
public function index()
{

$limit = $this->request->getQuery('pages', 1000); // Default to 10 if 'pages' is not set

$this->paginate = [
'contain' => ['Users', 'Counties', 'SubCounties', 'Designations'],
];
$aggregates = $this->paginate($this->Aggregates);

'limit'=>$limit

];
$aggregates = $this->paginate($this->Aggregates->find('search', ['search' => $this->request->getQuery()]));
$this->set('page_options', $this->page_options);
$this->set(compact('aggregates'));
}

Expand Down
10 changes: 9 additions & 1 deletion src/Controller/Manager/DrugsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ class DrugsController extends AppController
*/
public function index()
{
$drugs = $this->paginate($this->Drugs);

$limit = $this->request->getQuery('pages', 1000); // Default to 10 if 'pages' is not set

$this->paginate = [
'contain' => [],
'limit'=>$limit

];
$drugs = $this->paginate($this->Drugs->find('search', ['search' => $this->request->getQuery()]));
$this->set('page_options', $this->page_options);
$this->set(compact('drugs'));
}
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/Manager/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
use App\Controller\AppController;

/**
* Reports Controller
*
* @method \App\Model\Entity\Report[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*
*
*/
class ReportsController extends AppController
{
Expand All @@ -19,7 +18,8 @@ class ReportsController extends AppController
*/
public function index()
{
$reports = $this->paginate($this->Reports);

$reports =[];

$this->set(compact('reports'));
}
Expand Down
21 changes: 8 additions & 13 deletions src/Controller/Manager/SaefisController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,17 @@ class SaefisController extends AppController
*/
public function index()
{
$criteria = array();

// $criteria['Aefis.user_id'] = $this->Auth->user('id');

$limit = $this->request->getQuery('pages', 1000); // Default to 10 if 'pages' is not set

$this->paginate = [
'contain' => ['Users'],
'conditions' => $criteria
];
$saefis = $this->paginate($this->Saefis);

'contain' => [],
'limit'=>$limit

];
$saefis = $this->paginate($this->Saefis->find('search', ['search' => $this->request->getQuery()]));
$this->set('page_options', $this->page_options);
$this->set(compact('saefis'));

// $counties = $this->Saefis->Counties->find('list', array('order' => array('Counties.county_name' => 'ASC')));
// $this->set(compact('counties'));
// $designations = $this->Saefis->Designations->find('list', array('order' => array('Designations.name' => 'ASC')));
// $this->set(compact('designations'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Reporter/AefisController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class AefisController extends AppController
{

public $page_options = array('25' => '25', '50' => '50', '100' => '100');
/**
* Index method
Expand Down
3 changes: 3 additions & 0 deletions src/Model/Table/AggregatesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function initialize(array $config): void
$this->setPrimaryKey('id');

$this->addBehavior('Timestamp');
$this->addBehavior('Search.Search');
$this->searchManager()
->value('retention_status');

$this->belongsTo('Users', [
'foreignKey' => 'user_id',
Expand Down
11 changes: 11 additions & 0 deletions src/Model/Table/DrugsTable.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace App\Model\Table;
Expand Down Expand Up @@ -44,6 +45,16 @@ public function initialize(array $config): void
$this->setPrimaryKey('id');

$this->addBehavior('Timestamp');
$this->addBehavior('Search.Search');

$this->searchManager()
->value('retention_status')
->value('donation')
->value('manufacturer')
->value('brand_name')
->value('batch_number')
->value('registration_status')
->value('inn_name');
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Model/Table/SaefisTable.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace App\Model\Table;
Expand Down Expand Up @@ -51,6 +52,9 @@ public function initialize(array $config): void
$this->setPrimaryKey('id');

$this->addBehavior('Timestamp');
$this->addBehavior('Search.Search');
$this->searchManager()
->value('retention_status');

$this->belongsTo('Users', [
'foreignKey' => 'user_id',
Expand Down
155 changes: 2 additions & 153 deletions templates/Manager/Aggregates/index.php
Original file line number Diff line number Diff line change
@@ -1,154 +1,3 @@
<?php
/**
* @var \App\View\AppView $this
* @var iterable<\App\Model\Entity\Aggregate> $aggregates
*/
?>
<div class="aggregates index content">
<?= $this->Html->link(__('New Aggregate'), ['action' => 'add'], ['class' => 'button float-right']) ?>
<h3><?= __('Aggregates') ?></h3>
<div class="table-responsive">
<table>
<thead>
<tr>
<th><?= $this->Paginator->sort('id') ?></th>
<th><?= $this->Paginator->sort('user_id') ?></th>
<th><?= $this->Paginator->sort('aggregate_id') ?></th>
<th><?= $this->Paginator->sort('county_id') ?></th>
<th><?= $this->Paginator->sort('summary_available') ?></th>
<th><?= $this->Paginator->sort('sub_county_id') ?></th>
<th><?= $this->Paginator->sort('designation_id') ?></th>
<th><?= $this->Paginator->sort('reference_no') ?></th>
<th><?= $this->Paginator->sort('messageid') ?></th>
<th><?= $this->Paginator->sort('assigned_to') ?></th>
<th><?= $this->Paginator->sort('assigned_by') ?></th>
<th><?= $this->Paginator->sort('company_code') ?></th>
<th><?= $this->Paginator->sort('company_name') ?></th>
<th><?= $this->Paginator->sort('reporter_email') ?></th>
<th><?= $this->Paginator->sort('e2b_type') ?></th>
<th><?= $this->Paginator->sort('e2b_file') ?></th>
<th><?= $this->Paginator->sort('dir') ?></th>
<th><?= $this->Paginator->sort('size') ?></th>
<th><?= $this->Paginator->sort('type') ?></th>
<th><?= $this->Paginator->sort('assigned_date') ?></th>
<th><?= $this->Paginator->sort('signature') ?></th>
<th><?= $this->Paginator->sort('submitted') ?></th>
<th><?= $this->Paginator->sort('submitted_date') ?></th>
<th><?= $this->Paginator->sort('reporter_name') ?></th>
<th><?= $this->Paginator->sort('reporter_designation') ?></th>
<th><?= $this->Paginator->sort('reporter_phone') ?></th>
<th><?= $this->Paginator->sort('reporter_date') ?></th>
<th><?= $this->Paginator->sort('person_submitting') ?></th>
<th><?= $this->Paginator->sort('reporter_name_diff') ?></th>
<th><?= $this->Paginator->sort('reporter_designation_diff') ?></th>
<th><?= $this->Paginator->sort('reporter_email_diff') ?></th>
<th><?= $this->Paginator->sort('reporter_phone_diff') ?></th>
<th><?= $this->Paginator->sort('reporter_date_diff') ?></th>
<th><?= $this->Paginator->sort('resubmit') ?></th>
<th><?= $this->Paginator->sort('status') ?></th>
<th><?= $this->Paginator->sort('active') ?></th>
<th><?= $this->Paginator->sort('copied') ?></th>
<th><?= $this->Paginator->sort('archived') ?></th>
<th><?= $this->Paginator->sort('archived_date') ?></th>
<th><?= $this->Paginator->sort('created') ?></th>
<th><?= $this->Paginator->sort('modified') ?></th>
<th><?= $this->Paginator->sort('action_date') ?></th>
<th><?= $this->Paginator->sort('deleted') ?></th>
<th><?= $this->Paginator->sort('deleted_date') ?></th>
<th><?= $this->Paginator->sort('brand_name') ?></th>
<th><?= $this->Paginator->sort('inn_name') ?></th>
<th><?= $this->Paginator->sort('mah') ?></th>
<th><?= $this->Paginator->sort('local_technical') ?></th>
<th><?= $this->Paginator->sort('therapeutic_group') ?></th>
<th><?= $this->Paginator->sort('authorised_indications') ?></th>
<th><?= $this->Paginator->sort('form_strength') ?></th>
<th><?= $this->Paginator->sort('interval_code') ?></th>
<th><?= $this->Paginator->sort('submission_frequency') ?></th>
<th><?= $this->Paginator->sort('reminder_date') ?></th>
<th><?= $this->Paginator->sort('report_type') ?></th>
<th><?= $this->Paginator->sort('manager_initiated') ?></th>
<th><?= $this->Paginator->sort('manager_submitted') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($aggregates as $aggregate): ?>
<tr>
<td><?= $this->Number->format($aggregate->id) ?></td>
<td><?= $aggregate->has('user') ? $this->Html->link($aggregate->user->name, ['controller' => 'Users', 'action' => 'view', $aggregate->user->id]) : '' ?></td>
<td><?= $aggregate->aggregate_id === null ? '' : $this->Number->format($aggregate->aggregate_id) ?></td>
<td><?= $aggregate->has('county') ? $this->Html->link($aggregate->county->id, ['controller' => 'Counties', 'action' => 'view', $aggregate->county->id]) : '' ?></td>
<td><?= h($aggregate->summary_available) ?></td>
<td><?= $aggregate->has('sub_county') ? $this->Html->link($aggregate->sub_county->id, ['controller' => 'SubCounties', 'action' => 'view', $aggregate->sub_county->id]) : '' ?></td>
<td><?= $aggregate->has('designation') ? $this->Html->link($aggregate->designation->name, ['controller' => 'Designations', 'action' => 'view', $aggregate->designation->id]) : '' ?></td>
<td><?= h($aggregate->reference_no) ?></td>
<td><?= h($aggregate->messageid) ?></td>
<td><?= $aggregate->assigned_to === null ? '' : $this->Number->format($aggregate->assigned_to) ?></td>
<td><?= $aggregate->assigned_by === null ? '' : $this->Number->format($aggregate->assigned_by) ?></td>
<td><?= h($aggregate->company_code) ?></td>
<td><?= h($aggregate->company_name) ?></td>
<td><?= h($aggregate->reporter_email) ?></td>
<td><?= h($aggregate->e2b_type) ?></td>
<td><?= h($aggregate->e2b_file) ?></td>
<td><?= h($aggregate->dir) ?></td>
<td><?= h($aggregate->size) ?></td>
<td><?= h($aggregate->type) ?></td>
<td><?= h($aggregate->assigned_date) ?></td>
<td><?= h($aggregate->signature) ?></td>
<td><?= $aggregate->submitted === null ? '' : $this->Number->format($aggregate->submitted) ?></td>
<td><?= h($aggregate->submitted_date) ?></td>
<td><?= h($aggregate->reporter_name) ?></td>
<td><?= $aggregate->reporter_designation === null ? '' : $this->Number->format($aggregate->reporter_designation) ?></td>
<td><?= h($aggregate->reporter_phone) ?></td>
<td><?= h($aggregate->reporter_date) ?></td>
<td><?= h($aggregate->person_submitting) ?></td>
<td><?= h($aggregate->reporter_name_diff) ?></td>
<td><?= $aggregate->reporter_designation_diff === null ? '' : $this->Number->format($aggregate->reporter_designation_diff) ?></td>
<td><?= h($aggregate->reporter_email_diff) ?></td>
<td><?= h($aggregate->reporter_phone_diff) ?></td>
<td><?= h($aggregate->reporter_date_diff) ?></td>
<td><?= h($aggregate->resubmit) ?></td>
<td><?= h($aggregate->status) ?></td>
<td><?= $aggregate->active === null ? '' : $this->Number->format($aggregate->active) ?></td>
<td><?= $aggregate->copied === null ? '' : $this->Number->format($aggregate->copied) ?></td>
<td><?= $aggregate->archived === null ? '' : $this->Number->format($aggregate->archived) ?></td>
<td><?= h($aggregate->archived_date) ?></td>
<td><?= h($aggregate->created) ?></td>
<td><?= h($aggregate->modified) ?></td>
<td><?= h($aggregate->action_date) ?></td>
<td><?= h($aggregate->deleted) ?></td>
<td><?= h($aggregate->deleted_date) ?></td>
<td><?= h($aggregate->brand_name) ?></td>
<td><?= h($aggregate->inn_name) ?></td>
<td><?= h($aggregate->mah) ?></td>
<td><?= h($aggregate->local_technical) ?></td>
<td><?= h($aggregate->therapeutic_group) ?></td>
<td><?= h($aggregate->authorised_indications) ?></td>
<td><?= h($aggregate->form_strength) ?></td>
<td><?= $aggregate->interval_code === null ? '' : $this->Number->format($aggregate->interval_code) ?></td>
<td><?= h($aggregate->submission_frequency) ?></td>
<td><?= h($aggregate->reminder_date) ?></td>
<td><?= h($aggregate->report_type) ?></td>
<td><?= h($aggregate->manager_initiated) ?></td>
<td><?= h($aggregate->manager_submitted) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $aggregate->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $aggregate->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $aggregate->id], ['confirm' => __('Are you sure you want to delete # {0}?', $aggregate->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(__('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?></p>
</div>
</div>
$this->assign('AGGREGATE', 'active');
echo $this->element('aggregates/aggregates_index');
Loading

0 comments on commit c5c698b

Please sign in to comment.