Recherche en autocomplete dans les références
This commit is contained in:
parent
49c749e0c9
commit
c57e11ef0a
@ -9,6 +9,7 @@ class DashboardController extends Zend_Controller_Action
|
||||
public function init()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -171,8 +172,35 @@ class DashboardController extends Zend_Controller_Action
|
||||
*/
|
||||
public function rcomptageAction()
|
||||
{
|
||||
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$q = strtolower($this->getRequest()->getParam('q', ''));
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$criteresM = new Application_Model_Criteres($db);
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
|
||||
->where("idClient = ?", $user->idClient)
|
||||
->where("login = ?", $user->username)
|
||||
->where("reference LIKE ?", $q.'%');
|
||||
$rows = $criteresM->fetchAll($sql);
|
||||
if (count($rows)>0){
|
||||
$separator = " , ";
|
||||
foreach ($rows as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->reference . $separator . $item->date,
|
||||
'value' => $item->reference,
|
||||
'url' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblagedetail', 'id'=>$item->id)),
|
||||
);
|
||||
}
|
||||
}
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
}
|
@ -8,14 +8,13 @@
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages'))?>">Historique de vos ciblages</a> - Profil d'exportation - Préférences et configuration de l'application
|
||||
</div>
|
||||
|
||||
<div style="margin:5px 0;">
|
||||
<div id="rechercheCiblage">
|
||||
<h2>Rechercher dans vos ciblages</h2>
|
||||
<input type="text" name="searchCiblage" />
|
||||
<input type="text" name="searchCiblage" class="searchCiblage" />
|
||||
<input type="submit" value="Rechercher" class="submit"/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div style="margin:5px 0;">
|
||||
<div id="lastCiblage" style="">
|
||||
<h2>Vos derniers ciblages</h2>
|
||||
<?php if(count($this->comptages)>0):?>
|
||||
|
||||
@ -26,7 +25,7 @@
|
||||
<th>Nombre d'entité</th>
|
||||
<th>Unité Insee</th>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -1,5 +1,16 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
|
||||
//Autocomplete de recherche
|
||||
$('input.searchCiblage').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/dashboard/rcomptage', { q: request.term },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
window.location.href=ui.item.url;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
34
public/themes/default/styles/dashboard.css
Normal file
34
public/themes/default/styles/dashboard.css
Normal file
@ -0,0 +1,34 @@
|
||||
#rechercheCiblage {
|
||||
margin:5px 0;
|
||||
}
|
||||
|
||||
#rechercheCiblage input.searchCiblage {
|
||||
border:1px solid;
|
||||
padding:3px 5px;
|
||||
}
|
||||
|
||||
#rechercheCiblage input.searchCiblage:focus {
|
||||
border:1px solid #4D90FE;
|
||||
}
|
||||
|
||||
#rechercheCiblage input.submit {
|
||||
font-weight:bold;
|
||||
padding:2px 5px;
|
||||
background-color:#4D90FE;
|
||||
color:#ffffff;
|
||||
border:1px solid #3079ED;
|
||||
}
|
||||
|
||||
|
||||
ul.ui-autocomplete {
|
||||
width:250px;
|
||||
font-size:0.9em;
|
||||
}
|
||||
|
||||
.ui-autocomplete-loading {
|
||||
background:white url('/themes/jqueryui/smoothness/ui-anim_basic_16x16.gif') right center no-repeat;
|
||||
}
|
||||
|
||||
#lastCiblage {
|
||||
margin:5px 0;
|
||||
}
|
BIN
public/themes/jqueryui/smoothness/ui-anim_basic_16x16.gif
Normal file
BIN
public/themes/jqueryui/smoothness/ui-anim_basic_16x16.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in New Issue
Block a user