我有一个指向搜索导航formExterne的表单链接
当用户使用搜索栏时,当然只有“ Externe”的结果出现在数据表的正确选项卡上
如果将“ formExterne”替换为其他表单“ formInterne”,则仅显示“ Interne”的结果。我想要的是一个链接到搜索导航的表单,该链接同时针对数据表的每个选项卡中的每个类别(“外部”和“内部”)同时提交结果时显示。这可能吗 ?预先感谢。
这是我的index.html.twig中的formExterne
{% extends 'base.html.twig' %}
{% block body %}
<ul id="slide-out" class="sidenav col s12">
<div class="container bg-container form-scroller">
<div class="row">
<div class="titre-top">
<span class="contact2-form-title">
RECHERCHE DE CORRESPONDANTS MÉDICAUX
</span>
</div id="form_search">
{{ form_start(formExterne,{'action' : path('rechercher')}) }}
<ul class="collapsible">
<li class="active">
<div class="collapsible-header white-text center-align"><i class="material-icons">person</i><p class="label_sidenav">Identité</p> <p class="id">(<span id="showid"></span>/3)</p></div>
<div class="collapsible-body">
<div class="input-field col s12" id="choice0">
{{ form_widget(formExterne.medNom, {'attr': {'class': 'validate', 'onchange' :'idCompleted()'}}) }}
<label for="corr_med_ext_medNom">Nom</label>
</div>
<div class="input-field col s12" id="choice1">
{{ form_widget(formExterne.medPren, {'attr': {'class': 'validate', 'onchange' :'idCompleted()'}}) }}
<label for="corr_med_ext_medPren">Prénom</label>
</div>
<div class="input-field col s12" id="choice2">
{{ form_widget(formExterne.mednomEp, {'attr': {'class': 'validate', 'onchange' :'idCompleted()'}}) }}
<label for="corr_med_ext_mednomEp">Nom marital</label>
</div>
</div>
</li>
<li>
<div class="collapsible-header white-text"><i class="material-icons">work</i><p class="label_sidenav">Renseignements</p><p class="re">(<span id="showre"></span>/5)</p></div>
<div class="collapsible-body">
<div class="input-field col s12" id="choice3">
{{ form_widget(formExterne.medcpltTitre, {'attr': {'class': 'validate', 'onchange' : 'reCompleted()'}}) }}
<label for="corr_med_ext_medcpltTitre">Complément Titre</label>
</div>
<div class="input-field col s12" id="choice4">
{{ form_widget(formExterne.medSpec, {'attr': {'class': 'validate', 'onchange' : 'reCompleted()'}}) }}
<label for="corr_med_ext_medSpec">Spécialité</label>
</div>
<div class="input-field col s12 taille" id="choice5">
{{ form_widget(formExterne.rpps, {'attr': {'class': 'validate', 'maxlength':'11', 'pattern' : '[0-9]{11}', 'onchange' :'reCompleted()'}}) }}
<label for="corr_med_ext_rpps">RPPS</label>
</div>
<div class="input-field col s12 taille" id="choice6">
{{ form_widget(formExterne.adresseApicrypt, {'attr': {'class': 'validate', 'onchange' :'reCompleted()', 'pattern' : "[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}"}}) }}
<label for="corr_med_ext_adresseApicrypt">Adresse Électronique Sécurisée</label>
</div>
<div class="date col s12 taille" id="choice7">
<label id="labelDate" for="corr_med_ext_gdatecreation">Date de Création</label>
{{ form_widget(formExterne.gdatecreation, {'attr': {'class':'date', 'type':'date', 'onchange' :'reCompleted()'}}) }}
</div>
</div>
</li>
<li>
<div class="collapsible-header white-text"><i class="material-icons">location_on</i><p class="label_sidenav">Adresse</p><p class="adr">(<span id="showad"></span>/3)</p></div>
<div class="collapsible-body">
<div class="input-field col s12" id="choice8">
{{ form_widget(formExterne.medadrL1, {'attr': {'class': 'validate', 'onchange' :'adCompleted()'}}) }}
<label for="corr_med_ext_medadrL1">Adresse</label>
</div>
<div class="input-field col s12" id="choice9">
{{ form_widget(formExterne.medadrCo, {'attr': {'class': 'validate', 'onchange' :'adCompleted()'}}) }}
<label for="corr_med_ext_medadrCo">Commune</label>
</div>
<div class="input-field col s12 taille" id="choice10">
{{ form_widget(formExterne.medadrCp, {'attr': {'class': 'validate', 'onchange' :'adCompleted()', 'pattern' : '[0-9]{4,5}','maxlength':'5'}}) }}
<label for="corr_med_ext_medadrCp">Code Postal</label>
</div>
</div>
</li>
</ul>
<div class="checking">
<button class="ok-btn sidenav-close" id="toggle" type="submit" name="action" data-target="slide-out"
data-url='path{{'rechercher'}}'>VALIDER</button>
{{ form_end(formExterne) }}
<button class="ok-btn" id="reset" type="reset">REINITIALISER</button>
</div>
</div>
</div>
<p id="version">Version {{version}}</p>
</ul>
<div class="nav-wrapper">
<div class="bouton-sidenav">
<a id="recherche" href="#" data-target="slide-out" class="sidenav-trigger"><img src="/img/loupe-white.png"
alt="">Rechercher</a>
</div>
{% if is_granted('ROLE_USER') %}
<!--Modal trigger-->
{% if int is empty or ext is empty and int!='defaut' %}
<div id="addIcon" class="bouton-ajouter">
<a class="popup" data-target="{{ path('ajouter')}}" href="#modal"><img src="/img/icon-add.png" alt=""></a>
</div>
{% endif %}
{% endif %}
{% if is_granted('ROLE_ADMIN') %}
{% if int is empty or ext is empty and int!='defaut' %}
<div id="toolIcon" class="bouton-tool">
<a id="gestion" class="popup" data-target="{{path('gestion')}}" href="#modal" ><img src="/img/tool-icon.png" alt=""></a>
</div>
{% endif %}
{% endif %}
<!--<div class="logo-emplacement"><img class="logo" src="img/logogris.png" alt=""></div>-->
{% if is_granted('ROLE_USER') %}
<a class='profil dropdown-trigger' href='#' data-target='dropdown1'><img src="/img/icon.png" alt="" width="30"></a>
<ul id='dropdown1' class='dropdown-content deco'>
<li>
<a href="{{path('logout')}}">
<i class="material-icons">exit_to_app</i>Déconnexion</a>
</li>
</ul>
{% endif %}
<div class="logo-emplacement center container">
<img src="img/logo3.png" alt="">
</div>
</div>
<!--TABLEAU-->
{% if int =='defaut' or (int is empty and ext is empty and recherche == false)%}
<main style="display:block">
<div id="parent" class="col s8 m12 l12">
<div class="placement-illu"><img class="illu" src="/img/illu-recherche.png" alt=""></div>
</div>
</main>
<footer>
<div id="parent" class="col s8 m12 l12">
<div class="logo-chu"><img class="logo-chu" src="/img/logo-chu.png" alt=""></div>
</div>
</footer>
{% elseif int is empty and ext is empty and recherche == true %}
<main>
<div id="parent" class="col s8 m12 l12">
<div class="placement-illu"><img class="illu" src="/img/illu-recherche.png" alt=""></div>
</div>
<div id="modal1" class="modal small_popup">
<div id="modal-content" class="modal-content-popup ">
<div id='div_table'>
<div class="row modal-header">
<a class="js-modal-close modal-close close-popup">X</a>
<i style='' class="large material-icons">error</i>
</div>
<div class='row column_popup'>
<span class='span_table'>Il n'existe pas de résultat à votre recherche.</span>
<span class='span_table'>Si vous le souhaitez vous pouvez modifer votre recherche ou ajouter un nouveau
correspondant externe.</span>
</div>
</div>
</div>
</div>
</main>
<footer>
<div id="parent" class="col s8 m12 l12">
<div class="logo-chu"><img class="logo-chu" src="/img/logo-chu.png" alt=""></div>
</div>
</footer>
{% elseif int is empty or ext is empty %}
<main>
<div class="table-responsive">
<div id="appear">
<div class="container tableau">
<div class="row">
<div class="col s12">
<ul class="tabs">
{% if int is empty %}
<li class="tab col s12 m6 l6"><a href="#interne">Interne ({{nb_int}})</a></li>
<li class="tab col s12 m6 l6"><a href="#externe" class="active">Externe ({{nb_ext}})</a></li>
{% else %}
<li class="tab col s12 m6 l6"><a href="#interne">Interne ({{nb_int}})</a></li>
<li class="tab col s12 m6 l6"><a href="#externe">Externe ({{nb_ext}})</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
<div class="container tableau">
<div class="row card">
<div id="interne" class="col s12">
{% if int is empty %}
<span class='span_table'>Il n'existe pas d'interne correspondant à votre recherche.</span>
{% else %}
<div class="row">
<table id="tabledata2" class="display nowrap" style="width:100%">
<thead class="tabheader">
<tr>
<th class="column1">Civilité</th>
<th class="column2">Nom</th>
<th class="column3">Prénom</th>
<th class="column4">Nom marital</th>
<th class="column5">Spécialité</th>
<th class="column6">Adresse</th>
<th class="column6">Commune</th>
<th class="column6">Code postal</th>
<th class="column6">Pays</th>
<th class="column6">RPPS</th>
<th class="column6">Profil</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
</div>
<div class="container tableau">
<div class="row card">
<div id="externe" class="col s12">
{% if ext is empty %}
<span class='span_table'>Il n'existe pas d'externe correspondant à votre recherche.</span>
{% else %}
<div class="row">
<table id="tabledata" class="display nowrap highlight" style="width:100%">
<thead>
<tr>
<th class="column1">Civilité</th>
<th class="column2">Nom</th>
<th class="column3">Prénom</th>
<th class="column4">Nom marital</th>
<th class="column5">Spécialité</th>
<th class="column6">Adresse</th>
<th class="column7">Commune</th>
<th class="column8">Code postal</th>
<th class="column9">Pays</th>
<th class="column10">RPPS</th>
</tr>
</thead>
<tbody id="extern_body">
{% for key in ext %}
{% if key.annulation == 'T' %}
{% if key.corrMat != focus %}
<tr class="fondtr tr_tab" data-target="{{ path('recherche_edit', {id: key.corrMat})}}">
{% else %}
<tr class="fondtr tr_tab" data-target="{{ path('recherche_edit', {id: key.corrMat})}}" style="font-weight : bold">
{% endif %}
{% if key.medTitre == 'Mme' or key.medTitre == 'MME'%}
<td class="column1" title="FEMININ ANNULE"><img class="feminin" src="/img/signe-feminin-annule.png">
<p class="sort">1</p>
</td>
{% elseif key.medTitre == 'M'%}
<td class="column1" title="MASCULIN ANNULE"><img class="masculin" src="/img/signe-masculin-annule.png">
<p class="sort">2</p>
</td>
{% else %}
<td class="column1" title="AUTRE ANNULE"><img class="indifferent" src="/img/signe-medical-annule.png">
<p class="sort">0</p>
</td>
{% endif %}
{% else %}
{% if key.corrMat != focus %}
<tr class="tr_tab" data-target="{{ path('recherche_edit', {id: key.corrMat})}}">
{% else %}
<tr class="tr_tab" data-target="{{ path('recherche_edit', {id: key.corrMat})}}" style="font-weight : bold">
{% endif %}
{% if key.medTitre == 'Mme' or key.medTitre %}
<td class="column1" title="FEMININ"><img class="feminin" src="/img/signe-feminin.png">
<p class="sort">1</p>
</td>
{% elseif key.medTitre == 'M'%}
<td class="column1" title="MASCULIN"><img class="masculin" src="/img/signe-masculin.png">
<p class="sort">2</p>
</td>
{% else %}
<td class="column1" title="AUTRE"><img class="indifferent" src="/img/signe-medical.png">
<p class="sort">0</p>
</td>
{% endif %}
{% endif %}
<td class="column2" title="{{ key.medNom }}">{{ key.medNom }}</td>
<td class="column3" title="{{ key.medPren}}">{{ key.medPren }}</td>
<td class="column4" title="{{ key.mednomEp}}">{{ key.mednomEp }}</td>
<td class="column5" title="{{ key.medSpec }}">{{ key.medSpec }}</td>
<td class="column6" title="{{ key.medadrL1}}">{{ key.medadrL1 }}</td>
<td class="column7" title="{{ key.medadrCo }}">{{ key.medadrCo }}</td>
<td class="column8" title="{{ key.medadrCp }}">{{ key.medadrCp }}</td>
<td class="column9" title="{{ key.medadrPays }}">{{ key.medadrPays }}</td>
<td class="column10" title="{{ key.rpps }}">{{ key.rpps}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% if is_granted('ROLE_USER') %}
<section class="col s12">
<div id="buttons" class="excel"></div>
<p class="export">Exporter vers :</p>
</section>
{% endif %}
</main>
<img class="responsive-img" src="/img/fond-recherche.png" alt="" width="100%" height="100%">
{% endif %}
{% endblock %}
{% block javascripts %}{% endblock %}
这是我的表格
class CorrMedExtType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('corrMaitre', HiddenType::class)
->add('corrMatMaitre', HiddenType::class)
->add('medTitre', HiddenType::class)
->add('medcpltTitre' , ChoiceType::class, ['required'=>false,
'choices' =>[
''=>'',
'LA DIETETICIENNE'=>'LA DIETETICIENNE',
'LA PUERICULTRICE'=>'LA PUERICULTRICE',
'LA SAGE FEMME'=>'LA SAGE FEMME',
'L\'ASSISTANTE SOCIALE'=>'L\'ASSISTANTE SOCIALE',
'LE DOCTEUR'=> 'LE DOCTEUR',
]
])
->add('medNom', TextType::class,['required'=>false])
->add('medPren', TextType::class,['required'=>false])
->add('mednomEp', TextType::class,['required'=>false])
->add('medadrL1', TextType::class,['required'=>false])
->add('medadrL2', HiddenType::class)
->add('medadrLoc', HiddenType::class)
->add('medSpec', ChoiceType::class,
[ 'required'=>false,
'choices' =>[
''=>'',
'BIOLOGIE' =>'B05_BIOLOGIE',
'CANCEROLOGIE' =>'M06_CANCEROLOGIE',
'MEDECINE GENERALE'=>'M61_MEDECINE GENERALE',
'MEDECINE INTERNE'=>'M25_MEDECINE INTERNE',
'MEDECINE NUCLEAIRE'=>'M27_MEDECINE NUCLEAIRE',
]
])
->add('medadrCp')
->add('medadrCo')
->add('medadrPays', HiddenType::class)
->add('medSexe', HiddenType::class)
->add('medCmt', HiddenType::class)
->add('annulation', HiddenType::class)
->add('telListRouge', HiddenType::class)
->add('adresseelectr', HiddenType::class)
->add('gdatecreation', DateType::class,['required'=>false, 'widget'=>'single_text'])
->add('gdatemodificat', HiddenType::class)
->add('grdnannuaire', HiddenType::class)
->add('identifiantFt', HiddenType::class)
->add('creePar', HiddenType::class)
->add('matricule100', HiddenType::class)
->add('rpps', NumberType::class, ['required'=>false])
->add('adresseApicrypt', EmailType::class,['required'=>false])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => CorrMedExt::class,
]);
}
}
这是我的资料库
class CorrMedExtRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, CorrMedExt::class);
}
// /**
// * @return CorrMedExt[] Returns an array of CorrMedExt objects
// */
public function Recherche($prenom,$nom,$nomMarital,$cpltTitre,$specialite,$adresse,$commune,$cp,$apicrypt,$rpps,$datecrea,$table)
{
//Si tous les champs sont vides, on recherche les contacts fait à la date du jour
if ($prenom == NULL && $nom== NULL && $nomMarital== NULL
&& $cpltTitre== NULL && $specialite== NULL && $adresse== NULL && $commune== NULL && $cp== NULL
&& $apicrypt== NULL && $rpps == NULL && $datecrea == NULL
&& $prenom=='' && $nom=='' && $nomMarital==''
&& $cpltTitre=='' && $specialite =='' && $adresse =='' && $commune =='' && $cp =='' && $apicrypt =='' && $rpps =='' && $datecrea ==''){
$dateTime = new \DateTime('today');
return $this->createQueryBuilder('table')
->Where('table.gdatecreation = :date')
->setParameter('date', $dateTime)
->getQuery()
->execute();
}
//Sinon on vérifie chaque champs
else {
$query = $this->createQueryBuilder('table');
if($prenom != NULL && $prenom !=''){
$query->andWhere('table.medPren like :prenom');
$query->setParameter('prenom', '%'.$prenom.'%');
}
if ($nom != NULL && $nom !=''){
$query->andWhere('table.medNom like :nom');
$query->setParameter('nom', '%'.$nom.'%');
}
if ($nomMarital != NULL && $nomMarital !=''){
$query->andWhere('table.mednomEp like :nomEp');
$query->setParameter('nomEp', '%'.$nomMarital.'%');
}
if($cpltTitre != NULL && $cpltTitre !=''){
$query->andWhere('table.medcpltTitre like :cpltTitre');
$query->setParameter('cpltTitre', '%'.$cpltTitre.'%');
}
if($specialite != NULL && $specialite !=''){
$query->andWhere('table.medSpec like :spec');
$query->setParameter('spec', '%'.$specialite.'%');
}
if($adresse != NULL && $adresse !=''){
$query->andWhere('(table.medadrL1 like :adr or table.medadrL2 like :adr)');
$query->setParameter('adr', '%'.$adresse.'%');
}
if($commune != NULL && $commune !=''){
$query->andWhere('table.medadrCo like :commune');
$query->setParameter('commune', '%'.$commune.'%');
}
if($cp != NULL && $cp !=''){
$query->andWhere('table.medadrCp like :cp');
$query->setParameter('cp', '%'.$cp.'%');
}
if($apicrypt != NULL && $apicrypt !=''){
$query->andWhere('table.adresseApicrypt like :adresseApicrypt');
$query->setParameter('$adresseApicrypt', '%'.$apicrypt.'%');
}
if($rpps != NULL && $rpps !=''){
$query->andWhere('table.rpps like :rpps');
$query->setParameter('rpps', '%'.$rpps.'%');
}
if($datecrea != NULL && $datecrea !=''){
$query->andWhere('table.gdatecreation = :date');
$query->setParameter('date',$datecrea);
}
return $query->getQuery()
->execute();
}
}
}
还有我的.js
/RESET/
$(document).ready(function() {
adCompleted();
idCompleted();
reCompleted();
//Fonction pour réinitialiser le formulaire de recherche
$('button:reset').click(function(){
//RAZ des champs textes et dates
$('#corr_med_ext_medNom').attr('value','');
$('#corr_med_ext_medPren').attr('value','');
$('#corr_med_ext_mednomEp').attr('value','');
$('#corr_med_ext_adresseApicrypt').attr('value','');
$('#corr_med_ext_rpps').attr('value','');
$('#corr_med_ext_medadrL1').attr('value','');
$('#corr_med_ext_medadrCo').attr('value','');
$('#corr_med_ext_medadrCp').attr('value','');
$('#corr_med_ext_gdatecreation').attr('value','');
//RAZ des select
$('option',$('#corr_med_ext_medcpltTitre')).each(function(element){
$(this).removeAttr('selected').prop('selected', false);
});
$('option',$('#corr_med_ext_medSpec')).each(function(element){
$(this).removeAttr('selected').prop('selected', false);
});
idCompleted();
reCompleted();
adCompleted();
//Refresh champs
M.updateTextFields();
$('#showid').html('0');
$('#showad').html('0');
$('#showre').html('0');
})
});
//sidenav collapse
$(document).ready(function(){
$('.collapsible').collapsible();
});
//tab
setTimeout(function(){
//table width
var table = $('#tabledata').removeAttr('style').DataTable( {
scrollX:true,
bPaginate:false,
bInfo:false,
bFilter:false,
orderClasses:false,
} );
//export
var buttons = new $.fn.dataTable.Buttons(table, {
buttons: [
'excelHtml5',
]
}).container().appendTo($('#buttons'));
document.getElementsByClassName("dt-button")[0].id="excel_button";
var button_excel = document.getElementById('excel_button');
button_excel.innerHTML="";
}, 20);