// id pour l'entrée lozere nouvell vie
Configure::write('Constante.LNV', 1);
// email du coordonnateur on utilise la bdd maintenant
-configure::write('Email.Coordonnateur', 'reseauaccueil48@gmail.com');
+configure::write('Email.Coordonnateur', 'resacceuil48@gmail.com');
// hauteur des champs multiples
configure::write('Contante.hauteur', 5);
configure::write('Contante.hContenu', 8);
+// adresse email générale
+configure::write('email.reseau','resacceuil48@gmail.com');
+
// pagination (nombre par page)
configure::write('pagination.nombre',20);
public $gmail = array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
- 'username' => 'reseauaccueil48@gmail.com',
- 'password' => 'reseau48',
+ 'username' => 'resacceuil48@gmail.com',
+ 'password' => 'adullact',
'transport' => 'Smtp',
);
$Email = new CakeEmail('gmail');
$Email->to($dest)
->cc($coordonnateurEmail)
- ->from('reseauaccueil48@gmail.com')
+ ->from(configure::read('email.reseau'))
->subject($title)
->send($content);
}
public function send_email($dest, $subject, $send) {
$Email = new CakeEmail('gmail');
$Email->to($dest)
- ->from('reseauaccueil48@gmail.com')
+ ->from(configure::read('email.reseau'))
->subject($subject)
->send($send);
}
$this->request->data['Contact']['echeance'] = date('Y-m-d', strtotime($this->Duree->echeance() . ' month'));
if ($this->Contact->sauvegarde($this->request->data)) {
+ // envoie d'un email de confirmation au contact
+ $this->Mail->send_email($this->request->data['Contact']['couriel'], __d('email', 'message sujet add'), __d('email', 'message contenu add'));
$this->Session->setFlash(__d('flash', 'enregistrement reussi'), 'flash_custom');
$this->redirect(array('action' => 'success'));
}
$this->set('situations', $this->Contact->Situation->find('list'));
$this->set('entrees', $this->Contact->Entree->find('list'));
$this->set('projets', $this->Contact->Projet->find('list'));
- $this->set('typevoies', $this->Contact->Adresse->Typevoie->find('list'));
+ $this->set('typevoies', $this->Contact->Adresse->Typevoie->find('list', array(
+ 'order' => 'name'
+ )));
$this->set('niveaux', $this->Contact->Connaissance->Niveau->find('list'));
$id = $contact['Contact']['id'];
$this->set('etats', $this->Contact->Etat->find('list'));
+
$this->set('users', $this->Contact->User->find('list', array(
'conditions' => array(
'User.role_id <=' => Configure::read('Constante.referentId'),
'User.estactif' => true),
- 'fields' => array('username'),
- 'order' => 'username')));
+ 'fields' => array('NPS'),
+ 'order' => 'NPS')));
$this->set('types', $this->Contact->Echange->Type->find('list'));
// on recupere tous les echanges du contact
$this->set('listeEchange', $this->Contact->Echange->find('all', array(
'fields' => array('Echange.contact_id', 'Echange.user_id', 'Echange.sujet', 'Echange.contenu', 'Echange.type_id', 'Echange.created', 'User.nom', 'User.prenom', 'Type.name'),
- 'conditions' => array('Echange.contact_id' => $id)
+ 'conditions' => array('Echange.contact_id' => $id),
+ 'order' => array('Echange.created DESC')
)));
// on recupere toute les questions à l'user;
$this->set('listeQuestions', $this->Contact->Modification->find('all', array(
'fields' => array('Modification.contact_id', 'Modification.user_id', 'Modification.id', 'Modification.questions', 'Modification.created', 'Modification.estvue', 'User.nom', 'User.prenom'),
- 'conditions' => array('Modification.contact_id' => $id, 'Modification.estvue' => false)
+ 'conditions' => array('Modification.contact_id' => $id),
+ 'order' => array('Modification.created DESC')
)));
)));
}
+ /**
+ * supression d'une personne a cahrge
+ */
+ public function supprimerPersonne() {
+ $this->minReferent();
+ if ($this->request->is('Ajax')) {
+ $this->autoRender = false;
+ $this->loadModel('Personneacharge');
+
+
+
+ if ($this->Personneacharge->delete($this->request->data['id'])) {
+
+ $this->response->statusCode(200);
+ } else {
+ $this->response->statusCode(500);
+ }
+ }
+ }
+
+ /**
+ * supression d'une personne a cahrge
+ */
+ public function accepterContact() {
+ $this->minReferent();
+ if ($this->request->is('Ajax')) {
+ $this->autoRender = false;
+
+ $this->Contacts->id = $this->request->data['id'];
+
+
+ $confirm = array(
+ 'Contact' => array(
+ 'id' => $this->request->data['id'],
+ 'date_attribution' => null
+ )
+ );
+
+ if ($this->Contact->save($confirm)) {
+
+ $this->response->statusCode(200);
+ } else {
+ $this->response->statusCode(500);
+ }
+ }
+ }
+
}
$this->Paginator->settings = array(
'recursive' => -1,
- 'contain' => array('User'),
- 'fields' => array('Contact.nom', 'Contact.prenom', 'Contact.etat_id', 'Contact.id', 'User.id', 'User.prenom', 'User.nom'),
+ 'contain' => array('User', 'Etat'),
+ 'fields' => array('Contact.nom', 'Contact.prenom', 'Contact.etat_id', 'Etat.name', 'Contact.id', 'User.id', 'User.prenom', 'User.nom', 'User.structure'),
'order' => array('Contact.nom' => 'ASC'),
'limit' => configure::read('pagination.nombre')
);
$this->Paginator->settings = array(
'recursive' => -1,
+ 'contain' => array('Etat'),
'conditions' => array('Contact.user_id' => $uID),
- 'fields' => array('nom', 'prenom', 'id'),
+ 'fields' => array('Contact.nom', 'Contact.prenom', 'Contact.id', 'Etat.name'),
'order' => array('nom' => 'ASC'),
'limit' => configure::read('pagination.nombre')
);
+
$res = $this->Paginator->paginate('Contact');
+
+
$this->set('listeASuivre', $res);
$listeNouveauxRetard = $this->listeNouveauxRetard($uID);
$this->set('listeNouveauRetard', $listeNouveauxRetard);
$this->set('countNouveauRetard', count($listeNouveauxRetard));
-
-
+
+
// Liste contact arrivant à 6 mois
$listeSixMois = $this->listeContactSixMois($uID);
$this->set('listeSixMois', $listeSixMois);
$this->set('countSixMois', count($listeSixMois));
-
-
+
+
// Liste contact arrivant à maturation
$listeMaturation = $this->listeContactDelaiMaturation($uID);
$this->set('listeMaturation', $listeMaturation);
$this->set('countMaturation', count($listeMaturation));
-
-
-
-
-
}
/**
+ *
* Renvoie sur la fiche du contact en montrant que le contact a été consulté
*
+ *
+ * a supprimer car plus comme ca
*/
+ // TODO
public function consulter($id) {
// On verifie que c'est bien son refenrent qui consulte
'fields' => array('nom', 'prenom', 'echeance', 'id'),
'conditions' => array(
'Contact.user_id' => $uID,
+ 'Contact.etat_id' => array(
+ configure::read('etat.prospection'),
+ Configure::read('etat.maturation')
+ ),
'Contact.echeance <' => date('Y-m-d'),
'NOT' => array('Contact.echeance <' => date('Y-m-d', strtotime(- $this->Duree->retard() . ' days')))),
'order' => 'echeance'
$res = $this->Contact->find('all', array(
'recursive' => -1,
'fields' => array('nom', 'prenom', 'echeance', 'id'),
- 'conditions' => array('Contact.user_id' => $uID, 'Contact.echeance <' => date('Y-m-d', strtotime(- $this->Duree->retard() . ' days'))),
+ 'conditions' => array(
+ 'Contact.user_id' => $uID,
+ 'Contact.etat_id' => array(
+ configure::read('etat.prospection'),
+ Configure::read('etat.maturation')
+ ),
+ 'Contact.echeance <' => date('Y-m-d', strtotime(- $this->Duree->retard() . ' days'))),
'order' => 'echeance'
));
'created <' => date('Y-m-d', strtotime(- 6 . ' month')),
'etat_id' => configure::read('etat.prospection')
),
- 'fields' => array('created', 'nom', 'prenom','id'),
+ 'fields' => array('created', 'nom', 'prenom', 'id'),
'order' => 'created'
));
'etat_id' => configure::read('etat.maturation')
),
'fields' => array('created', 'nom', 'prenom', 'id'),
- 'order'=> 'created'
+ 'order' => 'created'
));
return $res;
$this->User->saveField('prenom', $data['prenom'],true);
$this->User->saveField('couriel', $data['couriel'],true);
$this->User->saveField('estactif', $data['estactif'],true);
-
+ $this->User->saveField('structure', $data['structure'],true);
// On commit la transaction
if ($dataSource->commit()) {
$this->Session->setFlash(__d('flash', 'maj enregistrees'), 'flash_custom');
// Recuperation de la date
$date = $this->request->data['Contact']['depuisLe'];
+
+ if($date['year'] =='' || $date['month']=='' || $date['day']=='' ){
+ $this->Session->setFlash(__d('flash', 'erreur date'),'flash_custom');
+ $this->redirect(array('action' => 'rechercher'));
+ }
// Formatage de la date
$date = '' . $date['year'] . '-' . $date['month'] . '-' . $date['day'];
$this->set('resultat', $this->recherche('Contact.created >', $date, 'Contact.created'));
}
- $this->render('rechercheresult');
+
+
+ //$this->render('rechercheresult');
}
}
'recursive' => -1,
'contain' => array('User'),
'conditions' => array($condition => $value),
- 'fields' => array('Contact.id', 'Contact.nom', 'Contact.prenom', 'Contact.created', 'User.nom', 'User.prenom'),
+ 'fields' => array('Contact.id', 'Contact.nom', 'Contact.prenom', 'Contact.created', 'User.nom', 'User.prenom', 'User.structure'),
'order' => $order
));
'recursive' => -1,
'contain' => array('Adresse', 'User'),
'conditions' => array('Adresse.codepostal like' => $departement),
- 'fields' => array('Contact.id', 'Contact.nom', 'Contact.prenom', 'Contact.created', 'User.nom', 'User.prenom', 'Adresse.codepostal'),
+ 'fields' => array('Contact.id', 'Contact.nom', 'Contact.prenom', 'Contact.created', 'User.nom', 'User.prenom', 'Adresse.codepostal', 'User.structure'),
'order' => 'Contact.nom'
));
+msgid "autre entree"
+msgstr "Autre entrée"
+
+
+msgid ""
+msgstr ""
+
+
+msgid ""
+msgstr ""
+
+
+msgid ""
+msgstr ""
+
+
msgid ""
msgstr ""
\ No newline at end of file
msgstr "\n"
+msgid "message sujet add"
+msgstr "Bienvenu sur le reseau accueil"
+
+msgid "message contenu add"
+msgstr "Bonjour,\nvotre inscrition sur le reseau accueil de la Lozère a bien été enregistrée.\nA bientôt"
msgstr "Erreur de mise à jour"
-msgid ""
-msgstr ""
+msgid "erreur date"
+msgstr "Veuillez remplir tous les champs de la date"
msgid ""
msgstr "Consultation utilisateur"
-msgid ""
-msgstr ""
+msgid "courriel"
+msgstr "Courriel"
-msgid ""
-msgstr ""
+msgid "structure"
+msgstr "Structure"
msgid ""
msgstr "non vue(s)"
-msgid ""
-msgstr ""
+
+
+msgid "ok"
+msgstr "Accepter le contact"
+
+
+msgid "referent delegue"
+msgstr "Référent délégué"
msgid ""
msgstr ""
+
msgstr "Contact(s) inscrit(s) depuis plus de 6 mois"
+msgid "structure"
+msgstr "Structure"
+
+
+msgid "etat"
+msgstr "Etat"
+
+
+msgid ""
+msgstr ""
+
+
+msgid ""
+msgstr ""
+
+
+msgid ""
+msgstr ""
+
+
msgid ""
msgstr ""
msgstr "Action"
-msgid ""
-msgstr ""
+msgid "structure"
+msgstr "Structure"
msgid ""
msgstr ""
App::uses('CakeEmail', 'Network/Email');
class Contact extends AppModel {
-
public $belongsTo = array(
'Entree' => array(
'foreignKey' => 'contact_id',
'associationForeignKey' => 'besoinsante_id')
);
-
-
// pour la situation familiale
const CELIBATAIRE = 1;
*/
public function sauvegarde($data) {
-
+
//debug($data);
-
- if(!$data){
+
+ if (!$data) {
return false;
}
-
+
$dataSource = $this->getDataSource();
// Demarrage la transaction
$dataSource->begin();
$this->linkConjointContact($data, $contact_id);
}
// on verifie si l'enregistrement vient bien du referent
- $this->ModifierNonReferent();
+ $this->ModifierNonReferent($contact_id);
// On commit la transaction
if ($dataSource->commit()) {
/**
* enregistre la modification si fait par un autre que son referent
*/
- private function ModifierNonReferent() {
+ private function ModifierNonReferent($contact_id) {
//id du referent
+ $this->id = $contact_id;
$referent = ($this->field('user_id'));
$currentUser = CakeSession::read("Auth.User.id");
// On verifie si l'utilisateur est son referent
+
+
if ($referent && $referent != $currentUser) {
$modification = array('Modification' => array(
'questions' => 'contenu fiche modifié',
));
- if($this->Modification->save($modification)){
+ if ($this->Modification->save($modification)) {
// Envoie un email au referent
$this->email($referent);
}
//on lie le conjoint au contact
if ($conjoint) {
-
+
return $conjoint['Contact']['id'];
} else {
return null;
//on le met a jour
$this->save($ct);
}
-
-
+
// Email en cas de modification
private function email($user_id) {
+
+
+
//email du referent
$usr = $this->User->find('first', array(
'recursive' => -1,
- 'conditions' =>array('User.id'=> $user_id),
+ 'conditions' => array('User.id' => $user_id),
'fields' => array('User.couriel')
));
-
+
$dest = $usr['User']['couriel'];
$subject = __d('email', 'sujet modif');
$send = __d('email', 'send modif');
-
+
$Email = new CakeEmail('gmail');
$Email->to($dest)
- ->from('reseauaccueil48@gmail.com')
+ ->from(configure::read('email.reseau'))
->subject($subject)
->send($send);
}
-
-
-
+
// pour un test bidon
public function bidon($nombre) {
- if($nombre > 10){
+ if ($nombre > 10) {
return true;
- }else{
+ } else {
return false;
}
}
return true;
}
+
+ public $virtualFields = array(
+ 'NPS' => "User.nom || ' ' || User.prenom || ' (' || User.structure || ')'"
+ );
+
}
<div class="col-md-offset-1 col-md-10">
+
+
<!--Creation des onglets-->
- <ul class="nav nav-tabs" id="myTab">
- <li class="active"><a href="#profil" data-toggle="tab">Profil</a></li>
- <li><a href="#projet" data-toggle="tab">Projet professionel</a></li>
- <li><a href="#lozere" data-toggle="tab">La Lozere</a></li>
- <?php if ($this->Login->isLogged() && $this->request->data): ?>
- <li><a href="#lesuivi" data-toggle="tab">Le suivi</a></li>
- <?php endif; ?>
- </ul>
+ <!-- si on est authentifié on peu swicher les onglets-->
+ <?php if (CakeSession::read("Auth.User.id") > 0): ?>
+ <?php if ($this->request->data): ?>
+ <ul class="nav nav-tabs" id="myTab">
+ <li class="active"><a href="#profil" data-toggle="tab">Profil</a></li>
+ <li><a href="#projet" data-toggle="tab">Projet professionel</a></li>
+ <li><a href="#lozere" data-toggle="tab">La Lozere</a></li>
+ <li ><a href="#lesuivi" data-toggle="tab">Le suivi</a></li>
+
+ </ul>
+ <?php else: ?>
+ <ul class="nav nav-tabs" id="myTab">
+ <li class="active"><a href="#profil" data-toggle="tab">Profil</a></li>
+ <li><a href="#projet" data-toggle="tab">Projet professionel</a></li>
+ <li><a href="#lozere" data-toggle="tab">La Lozere</a></li>
+ <?php if ($this->Login->isLogged() && $this->request->data): ?>
+ <li><a href="#lesuivi" data-toggle="tab">Le suivi</a></li>
+ <?php endif; ?>
+ </ul>
+ <?php endif; ?>
+ <?php else: ?>
+ <ul class="nav nav-tabs" id="myTab">
+ <li class="active"><a href="#profil">Profil</a></li>
+ <li><a href="#projet" >Projet professionel</a></li>
+ <li><a href="#lozere" >La Lozere</a></li>
+ <?php if ($this->Login->isLogged() && $this->request->data): ?>
+ <li><a href="#lesuivi">Le suivi</a></li>
+ <?php endif; ?>
+ </ul>
+
+ <?php endif; ?>
+
<div class="tab-content">
<!-- PROFESSION et EXPERIENCE-->
<?php echo $this->element('Contacts/profession_experience'); ?>
<!-- fin du permier onglet-->
+
+
+
</div>
</div>
<div id="troisieme">
<?php echo $this->element('Contacts/onglet_lozere'); ?>
</div>
- <div >
- <div class="pull-right">
- <?php
- echo $this->Form->end(array(
- 'label' => 'valider',
- 'class' => 'btn btn-success btn-lg',
- 'id' => 'bt_validation_form'));
- ?>
+
+
+
+
+
+
+
+ <!-- si on est loggé qu'il s'agit d'un edit et que le contact est classé-->
+ <?php
+ if ($this->request->data && CakeSession::read("Auth.User.id") > 0) :
+ ?>
+ <?php if ($this->Contact->isclasse($this->request->data['Contact']['id'])) : ?>
+ <div>
+ <div class="pull-right">
+ <?php
+ echo $this->Form->end(array(
+ 'label' => 'valider',
+ 'class' => 'btn btn-success btn-lg',
+ 'disabled' => 'disabled',
+ 'id' => 'bt_validation_form'));
+ ?>
+ </div>
+
+ </div>
+
+ <?php else: ?>
+
+ <div >
+ <div class="pull-right">
+ <?php
+ echo $this->Form->end(array(
+ 'label' => 'valider',
+ 'class' => 'btn btn-success btn-lg',
+ 'id' => 'bt_validation_form'));
+ ?>
+ </div>
+ </div>
+ <?php endif; ?>
+
+
+ <?php else : ?>
+
+
+ <div >
+ <div class="pull-right">
+ <?php
+ echo $this->Form->end(array(
+ 'label' => 'valider',
+ 'class' => 'btn btn-success btn-lg',
+ 'id' => 'bt_validation_form'));
+ ?>
+ </div>
</div>
- </div>
+ <?php endif; ?>
+
+
+
+
</div>
<!-- fin de la fiche lozere et du questionnaire internaute-->
+
+
const CELIBATAIRE = 1;
const UNION_LIBRE = 2;
const PACSE = 3;
}
}
+ /**
+ * page precedente
+ */
+ function precedent(p) {
+ $('#myTab li:eq(' + p + ') a').tab('show');
+ $('html,body').scrollTop(0);
+ }
+
+
+
/**
}
}
+ $(document).ready(function() {
+ // show/hide conjoint en fonction de la situation marital
+ $('#ContactSituationId').change(function() {
+ if (isCouple()) {
+ $('.conjoint').show();
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").attr('required', '');
+ } else {
+ $('.conjoint').hide();
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").removeAttr('required');
+ }
- /*
- show/hide des données concernant le conjoint en fonction de la situation et que les champs soient ou non obligatoires
- */
- $('#ContactSituationId option[value=' + CELIBATAIRE + '], #ContactSituationId option[value=' + VEUF + '],#ContactSituationId option[value=' + DIVORCE + ']').click(function() {
- $('.conjoint').hide();
- $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").removeAttr('required');
- });
- $('#ContactSituationId option[value=' + UNION_LIBRE + '],#ContactSituationId option[value=' + PACSE + '],#ContactSituationId option[value=' + MARIE + '] ').click(function() {
- $('.conjoint').show();
- $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").attr('required', '');
- });
- /*
- show/hide en fonction du projet
- */
- $('#ContactProjetId option[value=' + ENTREPRISE + ']').click(function() {
- $('.entreprise').show();
- $('.salarie, .sante , .autre-projet').hide();
- });
- $('#ContactProjetId option[value=' + SALARIE + ']').click(function() {
- $('.salarie').show();
- $('.entreprise, .sante, .autre-projet').hide();
- });
- $('#ContactProjetId option[value=' + SANTE + ']').click(function() {
- $('.sante').show();
- $('.salarie, .entreprise, .autre-projet').hide();
- });
- $('#ContactProjetId option[value=' + AUTRE + ']').click(function() {
- $('.autre-projet').show();
- $('.salarie, .entreprise, .sante').hide();
- });
- $(document).ready(function() {
+ });
+
+ /*
+ show/hide des données concernant le conjoint en fonction de la situation et que les champs soient ou non obligatoires
+ */
+ /* $('#ContactSituationId option[value=' + CELIBATAIRE + '], #ContactSituationId option[value=' + VEUF + '],#ContactSituationId option[value=' + DIVORCE + ']').click(function() {
+
+ $('.conjoint').hide();
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").removeAttr('required');
+ });
+ $('#ContactSituationId option[value=' + UNION_LIBRE + '],#ContactSituationId option[value=' + PACSE + '],#ContactSituationId option[value=' + MARIE + '] ').click(function() {
+
+ $('.conjoint').show();
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").attr('required', '');
+ });
+ /*
+ show/hide en fonction du projet
+ */
+
+ $('#ContactProjetId').change(function() {
+ $projet = $('#ContactProjetId option:selected').val();
+
+ if ($projet == ENTREPRISE) {
+ $('.entreprise').show();
+ $('.salarie, .sante , .autre-projet').hide();
+ }
+ if ($projet == SALARIE) {
+ $('.salarie').show();
+ $('.entreprise, .sante, .autre-projet').hide();
+ }
+ if ($projet == SANTE) {
+ $('.sante').show();
+ $('.salarie, .entreprise, .autre-projet').hide();
+ }
+ if ($projet == AUTRE) {
+ $('.autre-projet').show();
+ $('.salarie, .entreprise, .sante').hide();
+ }
+ });
+
+
+ /* $('#ContactProjetId option[value=' + ENTREPRISE + ']').click(function() {
+ $('.entreprise').show();
+ $('.salarie, .sante , .autre-projet').hide();
+ });
+ $('#ContactProjetId option[value=' + SALARIE + ']').click(function() {
+ $('.salarie').show();
+ $('.entreprise, .sante, .autre-projet').hide();
+ });
+ $('#ContactProjetId option[value=' + SANTE + ']').click(function() {
+ $('.sante').show();
+ $('.salarie, .entreprise, .autre-projet').hide();
+ });
+ $('#ContactProjetId option[value=' + AUTRE + ']').click(function() {
+ $('.autre-projet').show();
+ $('.salarie, .entreprise, .sante').hide();
+ });
+ */
+
+ //utiliser plutot la fonction isCouple
// pour que le conjoint n'apparaisse pas si pas en couple
$situation = $('#ContactSituationId option:selected').val();
if ($situation == CELIBATAIRE || $situation == DIVORCE || $situation == VEUF) {
}
if ($situation == UNION_LIBRE || $situation == PACSE || $situation == MARIE) {
+
$('.conjoint').show();
$("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").attr('required', '');
}
});
+
// Pour le suivi
// Affiche/cache
function change(table) {
}
});
// on efface la question
- $('#question' + modifId).hide();
+ $('#vu' + modifId).hide();
}
+
+ function supprimerPersonne(id) {
+ var data = {id: id};
+ var url = '<?php echo Router::url(array('controller' => 'Contacts', 'action' => 'supprimerPersonne')); ?>';
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: data,
+ success: function(response, status) {
+ $('#charge' + id).hide();
+ },
+ error: function(response, status) {
+ alert('impossible de le supprimer');
+ }
+ });
+
+ }
+
+
+ function accepterContact(id) {
+ var data = {id: id};
+ var url = '<?php echo Router::url(array('controller' => 'Contacts', 'action' => 'accepterContact')); ?>';
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: data,
+ success: function(response, status) {
+ $('#accepter-tr').hide();
+ },
+ error: function(response, status) {
+ alert('impossible');
+ }
+ });
+ }
+
+
</script>
--- /dev/null
+<!--Formulaire d'ajout de contact-->
+
+
+
+<div class="col-md-offset-1 col-md-10">
+
+
+
+ <!--Creation des onglets-->
+
+
+ <!-- si on est authentifié on peu swicher les onglets-->
+ <?php if (CakeSession::read("Auth.User.id") > 0): ?>
+ <ul class="nav nav-tabs" id="myTab">
+ <li class="active"><a href="#profil" data-toggle="tab">Profil</a></li>
+ <li><a href="#projet" data-toggle="tab">Projet professionel</a></li>
+ <li><a href="#lozere" data-toggle="tab">La Lozere</a></li>
+ <?php if ($this->Login->isLogged() && $this->request->data): ?>
+ <li><a href="#lesuivi" data-toggle="tab">Le suivi</a></li>
+ <?php endif; ?>
+ </ul>
+ <?php else: ?>
+ <ul class="nav nav-tabs" id="myTab">
+ <li class="active"><a href="#profil">Profil</a></li>
+ <li><a href="#projet" >Projet professionel</a></li>
+ <li><a href="#lozere" >La Lozere</a></li>
+ <?php if ($this->Login->isLogged() && $this->request->data): ?>
+ <li><a href="#lesuivi">Le suivi</a></li>
+ <?php endif; ?>
+ </ul>
+
+ <?php endif; ?>
+
+ <div class="tab-content">
+
+
+
+
+
+ <!-- Onglet le profil -->
+ <div class="tab-pane active" id="profil">
+ <!-- <div class="col-md-offset-1 col-md-10">-->
+
+ <!-- Creation du formulaire-->
+ <?php
+ //si la requete est non vide
+ if ($this->request->data) {
+ //on crée un formaulaire d'edit
+ echo $this->Form->create('Contact', array(
+ 'action' => 'edit',
+ $this->request->data['Contact']['id']));
+ } else {
+ // on crée un formulaire d'add
+ echo $this->Form->create('Contact', array(
+ 'action' => 'add'));
+ }
+ ?>
+
+
+
+
+ <?php
+ //on fait une serie d'input des id pour l'update !
+ echo $this->Form->input('Contact.id');
+ echo $this->Form->input('Adresse.id');
+ echo $this->Form->input('Connaissance.id');
+ echo $this->Form->input('Experience.id');
+ echo $this->Form->input('Installation.id');
+ echo $this->Form->input('Entreprise.id');
+ echo $this->Form->input('Evaluationprojet.id');
+ echo $this->Form->input('Conjoint.id');
+ echo $this->Form->input('Emploi.id');
+ ?>
+
+ <div id="premier">
+ <!-- ETAT CIVIL-->
+ <?php echo $this->element('Contacts/etat_civil'); ?>
+
+ <!-- PROFESSION et EXPERIENCE-->
+ <?php echo $this->element('Contacts/profession_experience'); ?>
+ <!-- fin du permier onglet-->
+ </div>
+
+ </div>
+
+
+
+
+
+
+ <!-- ONGLET PROJET-->
+
+ <div class="tab-pane" id="projet">
+ <div id="deuxieme">
+ <?php echo $this->element('Contacts/onglet_projet'); ?>
+ </div>
+
+ </div>
+
+
+
+ <!-- ONGLET LOZERE-->
+ <div class="tab-pane" id="lozere">
+ <div id="troisieme">
+ <?php echo $this->element('Contacts/onglet_lozere'); ?>
+ </div>
+
+
+
+
+
+
+
+ <!-- si on est loggé qu'il s'agit d'un edit et que le contact est classé-->
+ <?php
+ if ($this->request->data && CakeSession::read("Auth.User.id") > 0) :
+ ?>
+ <?php if ($this->Contact->isclasse($this->request->data['Contact']['id'])) : ?>
+ <div>
+ <div class="pull-right">
+ <?php
+ echo $this->Form->end(array(
+ 'label' => 'valider',
+ 'class' => 'btn btn-success btn-lg',
+ 'disabled' => 'disabled',
+ 'id' => 'bt_validation_form'));
+ ?>
+ </div>
+
+ </div>
+
+ <?php else: ?>
+
+ <div >
+ <div class="pull-right">
+ <?php
+ echo $this->Form->end(array(
+ 'label' => 'valider',
+ 'class' => 'btn btn-success btn-lg',
+ 'id' => 'bt_validation_form'));
+ ?>
+ </div>
+ </div>
+ <?php endif; ?>
+
+
+ <?php else : ?>
+
+
+ <div >
+ <div class="pull-right">
+ <?php
+ echo $this->Form->end(array(
+ 'label' => 'valider',
+ 'class' => 'btn btn-success btn-lg',
+ 'id' => 'bt_validation_form'));
+ ?>
+ </div>
+ </div>
+ <?php endif; ?>
+
+
+
+
+ </div>
+
+ <!-- fin de la fiche lozere et du questionnaire internaute-->
+
+
+
+
+ <!-- fiche de suivi dispo seulement en edit-->
+
+
+ <?php if ($this->Login->isLogged() && $this->request->data): ?>
+ <div class="tab-pane" id="lesuivi">
+
+
+ <?php echo $this->element('Contacts/suivi'); ?>
+
+ </div>
+ <?php endif; ?>
+
+ </div>
+
+</div>
+
+
+
+
+
+
+<script type='text/javascript'>
+
+
+
+$(document).ready(function() {
+
+
+ const CELIBATAIRE = 1;
+ const UNION_LIBRE = 2;
+ const PACSE = 3;
+ const MARIE = 4;
+ const DIVORCE = 5;
+ const VEUF = 6;
+ const ENTREPRISE = 1;
+ const SALARIE = 2;
+ const SANTE = 3;
+ const AUTRE = 4;
+ /**
+ * desactive la validation du form quand press enter
+ *
+ */
+
+
+
+ /**
+ * pour ajouter des personnes à charge
+ *
+ */
+ var lastRow = 0;
+
+
+ $('#ContactEditForm').bind("keyup keypress", function(e) {
+ var code = e.keyCode || e.which;
+ if (code == 13) {
+ e.preventDefault();
+ return false;
+ }
+ });
+
+ function addPersonne() {
+
+ lastRow++;
+ $("#personneacharge").clone(true).attr('id', 'personneacharge' + lastRow).removeAttr('style').insertBefore("#ajouter");
+ $("#personneacharge" + lastRow + " button").attr('onclick', 'removePersonne(' + lastRow + ')');
+ $("#personneacharge" + lastRow + " input:first").attr('name', 'data[Personneacharge][' + lastRow + '][age]').attr('id', 'age' + lastRow);
+ }
+ /**
+ * supprimer personnes à charge
+ *
+ */
+ function removePersonne(x) {
+ $("#personneacharge" + x).remove();
+ }
+
+
+
+ /**
+ * passer à l'onglet suivant
+ *
+ */
+ function page(p, onglet) {
+ if (verifier(onglet)) {
+ $('#myTab li:eq(' + p + ') a').tab('show');
+ $('html,body').scrollTop(0);
+ }
+ }
+
+
+
+ /**
+ * validation du form
+ */
+ $('#bt_validation_form').click(function() {
+ if (!verifier('#troisieme')) {
+ return false;
+ }
+
+ });
+ /**
+ * prevalidation du form
+ *
+ */
+ function verifier(onglet) {
+ var error = 0;
+ var regEmail = new RegExp('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$');
+ var regNb = new RegExp('^[0-9]+$');
+ // verificaion si c'est un couple que le conjoint est bien renseigné
+ if (onglet == '#premier') {
+ if (isCouple()) {
+ // Rend les champs obligatoires
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").attr('required', '');
+ } else {
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").removeAttr('required');
+ }
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").css('border', '1px solid #CCC');
+ // verification que l'email est valide
+ if (!regEmail.test($('#ContactCouriel').val())) {
+ $('#ContactCouriel').css('border', '2px solid red');
+ }
+ }
+
+
+
+
+
+ // Verification des champs obligatoires
+ $(':input[required]', onglet).each(function() {
+ $(this).css('border', '2px solid green');
+ if ($(this).val() == '') {
+ $(this).css('border', '2px solid red');
+ error = 1;
+ $(this).focus();
+ }
+ });
+ // verification que le number en sont bien
+ $(":input[type='number']", onglet).each(function() {
+ $(this).css('border', '2px solid green');
+ if ($(this).val() != '') {
+
+ if (!regNb.test($(this).val())) {
+ $(this).css('border', '2px solid red');
+ error = 1;
+ }
+ }
+
+ });
+ if (error > 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * verifie si est en couple
+ *
+ */
+ function isCouple() {
+ $situation = $('#ContactSituationId option:selected').val();
+ if ($situation == UNION_LIBRE || $situation == PACSE || $situation == MARIE) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+
+
+
+ /*
+ show/hide des données concernant le conjoint en fonction de la situation et que les champs soient ou non obligatoires
+ */
+ $('#ContactSituationId option[value=' + CELIBATAIRE + '], #ContactSituationId option[value=' + VEUF + '],#ContactSituationId option[value=' + DIVORCE + ']').click(function() {
+ alert(1);
+ $('.conjoint').hide();
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").removeAttr('required');
+ });
+ $('#ContactSituationId option[value=' + UNION_LIBRE + '],#ContactSituationId option[value=' + PACSE + '],#ContactSituationId option[value=' + MARIE + '] ').click(function() {
+
+ $('.conjoint').show();
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").attr('required', '');
+ });
+ /*
+ show/hide en fonction du projet
+ */
+ $('#ContactProjetId option[value=' + ENTREPRISE + ']').click(function() {
+ $('.entreprise').show();
+ $('.salarie, .sante , .autre-projet').hide();
+ });
+ $('#ContactProjetId option[value=' + SALARIE + ']').click(function() {
+ $('.salarie').show();
+ $('.entreprise, .sante, .autre-projet').hide();
+ });
+ $('#ContactProjetId option[value=' + SANTE + ']').click(function() {
+ $('.sante').show();
+ $('.salarie, .entreprise, .autre-projet').hide();
+ });
+ $('#ContactProjetId option[value=' + AUTRE + ']').click(function() {
+ $('.autre-projet').show();
+ $('.salarie, .entreprise, .sante').hide();
+ });
+
+ $(document).ready(function() {
+
+ // pour que le conjoint n'apparaisse pas si pas en couple
+ $situation = $('#ContactSituationId option:selected').val();
+ if ($situation == CELIBATAIRE || $situation == DIVORCE || $situation == VEUF) {
+
+ $('.conjoint').hide();
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").removeAttr('required');
+ }
+
+ if ($situation == UNION_LIBRE || $situation == PACSE || $situation == MARIE) {
+ $('.conjoint').show();
+ $("#ConjointNom, #ConjointPrenom, #ConjointDatenaissanceDay, #ConjointDatenaissanceMonth, #ConjointDatenaissanceYear").attr('required', '');
+ }
+
+
+
+
+ // pour que le bon projet apparaisse
+ $projet = $('#ContactProjetId option:selected').val();
+ if ($projet == ENTREPRISE) {
+ $('.entreprise').show();
+ $('.salarie, .sante, .autre-projet').hide();
+ }
+
+ if ($projet == SALARIE) {
+ $('.salarie').show();
+ $('.entreprise, .sante, .autre-projet').hide();
+ }
+
+ if ($projet == SANTE) {
+ $('.sante').show();
+ $('.salarie, .entreprise, .autre-projet').hide();
+ }
+
+ if ($projet == AUTRE) {
+ $('.autre-projet').show();
+ $('.salarie, .entreprise, .sante').hide();
+ }
+
+
+
+ });
+ // Pour le suivi
+ // Affiche/cache
+ function change(table) {
+ $(table).toggle(500);
+ }
+
+
+ //pour les echanges
+ $('#les-echanges').click(function() {
+ change('#liste-echange');
+ });
+ //pour les echanges
+ $('#les-modifications').click(function() {
+ change('#liste-modification');
+ });
+ //enregistrement des champs en ajax
+ function saveAjax(formId, routeAction) {
+ var data = $(formId).serialize();
+ var url = routeAction;
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: data,
+ success: function(response, status) {
+ alert('enregistrement effectué !');
+ },
+ error: function(response, status) {
+ alert('erreur d\'enregistrement');
+ }
+ });
+ }
+
+
+ // Enregistre les echanges
+ $('#echange-pop').click(function() {
+ saveAjax("#echange-form-pop", '<?php echo Router::url(array('controller' => 'Echanges', 'action' => 'saveajax')); ?>');
+ });
+ // Enregistre les modifications
+ $('#modification-pop').click(function() {
+ saveAjax("#modification-form-pop", '<?php echo Router::url(array('controller' => 'Modifications', 'action' => 'saveQuestionsAjax')); ?>');
+ });
+ // Enregistre les changements d'etat
+ $('#bt_change_etat').click(function() {
+ saveAjax("#change_etat", '<?php echo Router::url(array('controller' => 'Contacts', 'action' => 'changeEtatAjax')); ?>');
+ });
+ // Enregistre les changements de referent
+ $('#bt_change_user').click(function() {
+ saveAjax("#change_user", '<?php echo Router::url(array('controller' => 'Contacts', 'action' => 'changeUserAjax')); ?>');
+ });
+ function clickVu(modifId) {
+
+ // On recupere l'id de la modification
+ var data = {id: modifId};
+ var url = '<?php echo Router::url(array('controller' => 'Modifications', 'action' => 'vuAjax')); ?>';
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: data,
+ success: function(response, status) {
+
+ },
+ error: function(response, status) {
+
+ }
+ });
+ // on efface la question
+ $('#question' + modifId).hide();
+ }
+
+
+ /**
+ * Supression definitive d'un contact
+ *
+ */
+ function suppress(id) {
+
+ var r = confirm("voulez vous supprimer définitivement ce contact ?");
+ if (r == true) {
+ window.location.href = "<?php echo Router::url(array('controller' => 'Gestion', 'action' => 'remove')); ?>/" + id;
+ }
+ else {
+ return 0;
+ }
+ }
+
+});
+
+</script>
+
+
'label' => __d('contact', 'entree'),
'div' => array('class' => 'form-group'),
'class' => 'form-control'));
+
+ echo $this->Form->input('Contact.autreentree', array(
+ 'label' => __d('contact', 'autre entree'),
+ 'div' => array('class' => 'form-group'),
+ 'class' => 'form-control'));
+
+
?>
?>
</div>
- <div class="col-md-8">
+ <div class="col-md-8 perso-obligatoire">
<label><?php echo __d('contact', 'dateNaissance'); ?></label>
<div class="row">
<fieldset>
<legend class="perso-top-buffer"><?php echo __d('formulaire', 'conjoint'); ?></legend>
<div class="row">
- <div class="col-md-2">
+ <div class="col-md-3">
<?php
echo $this->Form->input('Conjoint.civilite_id', array(
'label' => __d('conjoint', 'civilite'),
'class' => 'form-control'));
?>
</div>
- <div class="col-md-5">
+ <div class="col-md-4">
<?php
echo $this->Form->input('Conjoint.nom', array(
'label' => __d('conjoint', 'nom'),
- 'div' => array('class' => 'form-group'),
+ 'div' => array('class' => 'form-group perso-obligatoire'),
'class' => 'form-control'));
?>
</div>
<?php
echo $this->Form->input('Conjoint.prenom', array(
'label' => __d('conjoint', 'prenom'),
- 'div' => array('class' => 'form-group'),
+ 'div' => array('class' => 'form-group perso-obligatoire'),
'class' => 'form-control'));
?>
</div>
</div>
- <div class="form-group">
- <label><?php echo __d('contact', 'dateNaissance'); ?></label>
+ <div class="form-group perso-obligatoire ">
+ <label><?php echo __d('contact', 'dateNaissance' ); ?></label>
<div class="row">
<div class="col-md-2">
<?php
echo $this->Form->day('Conjoint.datenaissance', array(
'empty' => "Jour",
- 'div' => array('class' => 'form-group'),
+ 'div' => array('class' => 'form-group '),
'class' => 'form-control'));
?>
</div>
<!-- affiche les personnes a charge si il s'agit d'un edit et que l'user est loggé-->
<?php if ($this->request->data && $this->Login->isLogged()) : ?>
-
+
<ul>
<?php foreach ($personneACharge as $personne): ?>
- <li><?php echo $personne['Personneacharge']['age'] ?> ans</li>
+ <li id="charge<?php echo $personne['Personneacharge']['id'] ?>">
+ <?php echo $personne['Personneacharge']['age'] ?>
+ ans <button type="button" class="btn btn-warning" onclick="supprimerPersonne(<?php echo $personne['Personneacharge']['id'] ?>)">supprimer</button>
+ </li>
<?php endforeach; ?>
</ul>
<!--pour les ajouts de personnes a charges-->
<div id="personneacharge" style="display:none;">
- <?php
- echo $this->Form->button(__d('formulaire', 'boutonSupprimer'), array(
- 'type' => 'button',
- 'class' => 'btn btn-warning'));
- ?>
+
<?php
echo $this->Form->input('age', array(
'label' => 'age : ',
'type' => 'text',
'size' => 3,
- 'after' => ' ans'));
+ 'after' => 'ans <button class="btn btn-warning" type="button" onclick="removePersonne(1)">Supprimer</button>'));
?>
+
</div>
echo $this->Form->input('Connaissance.commentsite', array(
'label' => __d('connaissance', 'commentSiteWeb'),
'rows' => 3,
- 'div' => array('class' => 'form-group'),
+ 'div' => array('class' => 'form-group perso-obligatoire'),
'class' => 'form-control'));
echo $this->Form->input('Connaissance.niveau_id', array(
'label' => __d('connaissance', 'niveau'),
- 'div' => array('class' => 'form-group'),
+ 'div' => array('class' => 'form-group perso-obligatoire'),
'class' => 'form-control'));
echo $this->Form->input('Raison.Raison', array(
echo $this->Form->input('Installation.periode', array(
'label' => __d('installation', 'periode'),
- 'div' => array('class' => 'form-group'),
+ 'div' => array('class' => 'form-group perso-obligatoire'),
'class' => 'form-control'));
echo $this->Form->input('Installation.localisation_id', array(
'label' => __d('installation', 'localisation'),
- 'div' => array('class' => 'form-group'),
+ 'div' => array('class' => 'form-group perso-obligatoire'),
'class' => 'form-control'));
echo $this->Form->input('Installation.autrelocalisation', array(
<?php
echo $this->Form->button(__d('formulaire', 'precedent'), array(
'type' => 'button',
- 'onclick' => 'page(1)',
+ 'onclick' => 'precedent(1)',
'class' => 'btn btn-primary'));
?>
</div>
<?php
echo $this->Form->input('projet_id', array(
'label' => __d('entreprise', 'projet.choix'),
- 'div' => array('class' => 'form-group'),
+ 'div' => array('class' => 'form-group perso-obligatoire'),
'class' => 'form-control'));
?>
?>
<div class="form-group">
- <label><?php echo __d('contact', 'demandeRenseignement?'); ?></label>
+ <label><?php echo __d('contact', 'demandeRenseignement?'); ?><span class="perso-etoile"> *</span></label>
<?php
echo $this->Form->radio('Contact.estdemandeurrenseign', array('1' => 'Oui', '0' => 'Non'), array('legend' => false));
<?php
echo $this->Form->button(__d('formulaire', 'precedent'), array(
'type' => 'button',
- 'onclick' => 'page(0)',
+ 'onclick' => 'precedent(0)',
'class' => 'btn btn-primary'));
?>
<?php
<div class="panel-body">
+ <?php // debug($this->request->data) ?>
<table class="table table-striped">
<!-- date creation / echeance-->
+ <?php
+ if ($this->Login->isreferent($this->request->data['User']['id']) &&
+ $this->request->data['Contact']['date_attribution']) :
+ ?>
+ <tr id="accepter-tr">
+ <td></td>
+ <td></td>
+ <td>
+ <!-- si il ne sont pas encore vu par le referent et si on est le referent designé-->
+
+ <button type="button" class="btn btn-lg btn-success"
+
+
+ onclick = "accepterContact(<?php echo $this->request->data['Contact']['id'] ?>)"> <?php echo __d('formulaire', 'ok') ?></button>
+
+
+
+ </td>
+ </tr>
+ <?php endif; ?>
<tr>
<td>
<b><?php echo __d('formulaire', 'dateCreaContact'); ?></b><br />
</tr>
+
+ <!--atribution referent delegué (uniquement le referent) -->
+
+ <tr>
+ <td><?php echo __d('formulaire', 'referent delegue'); ?></td>
+ <td>
+ <?php
+ if ($this->Login->isReferent($this->request->data['Contact']['user_id'])) {
+ echo $this->Form->input('Contact.referentdelegue', array(
+ 'label' => false,
+ 'options' => array(null => 'aucun', $users),
+ 'div' => array('class' => 'form-group'),
+ 'class' => 'form-control'));
+ } else {
+ echo $this->Form->input('Contact.referentdelegue', array(
+ 'label' => false,
+ 'options' => array(null => 'aucun', $users),
+ 'div' => array('class' => 'form-group'),
+ 'class' => 'form-control',
+ 'disabled' => 'disabled'));
+ }
+
+
+ echo $this->Form->end();
+ ?>
+ </td>
+ <td>
+
+ <?php if ($this->Login->isReferent($this->request->data['Contact']['user_id'])): ?>
+ <span title="<?php echo __d('hoverMouse', 'valider') ?>">
+ <button id="bt_referent" class="btn btn-lg btn-danger ">
+
+ <span class="glyphicon glyphicon-ok"></span>
+ </button>
+ </span>
+
+ <?php endif ?>
+
+ </td>
+
+ </tr>
+
+
+
<!-- Echanges-->
<tr>
<td>
<div class="well"><?php echo nl2br($question['Modification']['questions']); ?></div>
<?php
- if ($question['Modification']['estvue']) {
- echo 'message vu';
- } else {
+ if (!$question['Modification']['estvue']) {
?>
- <div class ="pull-right" >
+ <div class ="pull-right" id="vu<?php echo $modifId ?>" >
<button type="button" class="btn btn-primary" onClick="clickVu(<?php echo $modifId; ?>)">Vu</button>
</div>
<?php
<tr>
<th><?php echo __d('gestion', 'nom'); ?></th>
<th><?php echo __d('gestion', 'prenom'); ?></th>
+ <th><?php echo __d('gestion', 'etat'); ?></th>
<th><?php echo __d('gestion', 'referent'); ?></th>
+ <th><?php echo __d('gestion', 'structure'); ?></th>
<th><?php echo __d('gestion', 'action'); ?></th>
</tr>
<tr>
<td><?php echo $contact['Contact']['nom']; ?></td>
<td><?php echo $contact['Contact']['prenom']; ?></td>
+ <td><?php echo $contact['Etat']['name']; ?></td>
<td>
<?php echo $contact['User']['prenom']; ?>
<?php echo $contact['User']['nom']; ?>
</td>
+ <td><?php echo $contact['User']['structure']; ?></td>
<td>
<span title="<?php echo __d('hoverMouse', 'visualiser') ?>">
<button onclick = "location.href = '<?php echo $this->Html->url(array('controller' => 'Contacts', 'action' => 'edit', $contact['Contact']['id'])); ?>';" class="btn btn-default btn-lg">
<tr>
<th><?php echo __d('gestion', 'nom'); ?></th>
<th><?php echo __d('gestion', 'prenom'); ?></th>
+ <th><?php echo __d('gestion', 'etat'); ?></th>
<th><?php echo __d('gestion', 'action'); ?></th>
</tr>
<?php foreach ($listeASuivre as $aSuivre) : ?>
<tr>
<td><?php echo $aSuivre['Contact']['nom'] ?></td>
<td><?php echo $aSuivre['Contact']['prenom'] ?></td>
+ <td><?php echo $aSuivre['Etat']['name'] ?></td>
<td>
<span title="<?php echo __d('hoverMouse', 'visualiser') ?>">
<button onclick = "location.href = '<?php
<span title="<?php echo __d('hoverMouse', 'visualiser') ?>">
<button onclick = "location.href = '<?php
echo $this->Html->url(array(
- 'controller' => 'Gestion',
- 'action' => 'consulter',
+ 'controller' => 'Contacts',
+ 'action' => 'edit',
$nouveauRetard['Contact']['id']));
?>';" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-eye-open"></span> Visualiser
-<?php if ($listeEcheance) : ?>
+
+
+
+<?php if ($listeMaturation) : ?>
<div class="panel panel-warning perso-top-buffer-lg">
<div class="panel-heading">
- <h3 class="panel-title" id="echeance">
- <?php echo __d('gestion', 'contact echeance'); ?>
+ <h3 class="panel-title" id="maturation">
+ <?php echo __d('gestion', 'contacts maturation'); ?>
<span class="badge pull-right">
- <?php echo $countEcheance ?>
+ <?php echo $countMaturation ?>
</span>
</h3>
</div>
<div class="panel-body">
- <table class="table table-striped" id="echeance-table">
+ <table class="table table-striped" id="maturation-table">
<tr>
<th><?php echo __d('gestion', 'nom'); ?></th>
<th><?php echo __d('gestion', 'prenom'); ?></th>
- <th><?php echo __d('gestion', 'date'); ?></th>
+ <th><?php echo __d('gestion', 'date creation'); ?></th>
<th><?php echo __d('gestion', 'action'); ?></th>
</tr>
- <?php foreach ($listeEcheance as $echeance) : ?>
+ <?php foreach ($listeMaturation as $maturation) : ?>
<tr>
- <td><?php echo $echeance['Contact']['nom'] ?></td>
- <td><?php echo $echeance['Contact']['prenom'] ?></td>
-
- <td><?php echo $this->Time->format($echeance['Contact']['echeance'], '%d-%m-%Y', 'invalid'); ?></td>
- <td>
+ <td><?php echo $maturation['Contact']['nom'] ?></td>
+ <td><?php echo $maturation['Contact']['prenom'] ?></td>
+ <td><?php echo $this->Time->format($maturation['Contact']['created'], '%d-%m-%Y', 'invalid'); ?></td>
+
+ <td>
<span title="<?php echo __d('hoverMouse', 'visualiser') ?>">
<button onclick = "location.href = '<?php
echo $this->Html->url(array(
'controller' => 'Contacts',
'action' => 'edit',
- $echeance['Contact']['id']));
+ $maturation['Contact']['id']));
?>';" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-eye-open"></span> Visualiser
</button>
</span>
</td>
-
</tr>
<?php endforeach; ?>
</table>
-
</div>
</div>
<?php endif; ?>
-<?php if ($listeEcheanceRetard) : ?>
- <div class="panel panel-danger perso-top-buffer-lg">
+
+
+<?php if ($listeSixMois) : ?>
+ <div class="panel panel-warning perso-top-buffer-lg">
<div class="panel-heading">
- <h3 class="panel-title" id="echeance-retard">
- <?php echo __d('gestion', 'echeance retard'); ?>
+ <h3 class="panel-title" id="sixMois">
+ <?php echo __d('gestion', 'contacts six mois'); ?>
<span class="badge pull-right">
- <?php echo $countEcheanceRetard ?>
+ <?php echo $countSixMois ?>
</span>
</h3>
</div>
<div class="panel-body">
-
- <table class="table table-striped" id="echeance-retard-table">
+ <table class="table table-striped" id="sixMois-table">
<tr>
<th><?php echo __d('gestion', 'nom'); ?></th>
<th><?php echo __d('gestion', 'prenom'); ?></th>
- <th><?php echo __d('gestion', 'date echeance'); ?></th>
+ <th><?php echo __d('gestion', 'date creation'); ?></th>
<th><?php echo __d('gestion', 'action'); ?></th>
</tr>
- <?php foreach ($listeEcheanceRetard as $retardEcheance) : ?>
+ <?php foreach ($listeSixMois as $sixMois) : ?>
<tr>
- <td><?php echo $retardEcheance['Contact']['nom'] ?></td>
- <td><?php echo $retardEcheance['Contact']['prenom'] ?></td>
-
- <td><?php echo $this->Time->format($retardEcheance['Contact']['echeance'], '%d-%m-%Y', 'invalid'); ?></td>
- <td>
+ <td><?php echo $sixMois['Contact']['nom'] ?></td>
+ <td><?php echo $sixMois['Contact']['prenom'] ?></td>
+ <td><?php echo $this->Time->format($sixMois['Contact']['created'], '%d-%m-%Y', 'invalid'); ?></td>
+
+ <td>
<span title="<?php echo __d('hoverMouse', 'visualiser') ?>">
<button onclick = "location.href = '<?php
echo $this->Html->url(array(
'controller' => 'Contacts',
'action' => 'edit',
- $retardEcheance['Contact']['id']));
+ $sixMois['Contact']['id']));
?>';" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-eye-open"></span> Visualiser
</button>
</span>
-
</td>
-
</tr>
<?php endforeach; ?>
</table>
-
-
</div>
</div>
-
<?php endif; ?>
-<?php if ($listeMaturation) : ?>
- <div class="panel panel-success perso-top-buffer-lg">
+
+
+
+
+
+<?php if ($listeEcheance) : ?>
+ <div class="panel panel-warning perso-top-buffer-lg">
<div class="panel-heading">
- <h3 class="panel-title" id="nouveau">
- <?php echo __d('gestion', 'contacts maturation'); ?>
+ <h3 class="panel-title" id="echeance">
+ <?php echo __d('gestion', 'contact echeance'); ?>
<span class="badge pull-right">
- <?php echo $countMaturation ?>
+ <?php echo $countEcheance ?>
</span>
</h3>
</div>
<div class="panel-body">
- <table class="table table-striped" id="nouveau-table">
+ <table class="table table-striped" id="echeance-table">
<tr>
<th><?php echo __d('gestion', 'nom'); ?></th>
<th><?php echo __d('gestion', 'prenom'); ?></th>
- <th><?php echo __d('gestion', 'date creation'); ?></th>
+ <th><?php echo __d('gestion', 'date'); ?></th>
<th><?php echo __d('gestion', 'action'); ?></th>
</tr>
- <?php foreach ($listeMaturation as $maturation) : ?>
+ <?php foreach ($listeEcheance as $echeance) : ?>
<tr>
- <td><?php echo $maturation['Contact']['nom'] ?></td>
- <td><?php echo $maturation['Contact']['prenom'] ?></td>
- <td><?php echo $this->Time->format($maturation['Contact']['created'], '%d-%m-%Y', 'invalid'); ?></td>
- <!-- consulter() confirme qu'on a vu le contact et renvoie vers sa fiche-->
- <td>
+ <td><?php echo $echeance['Contact']['nom'] ?></td>
+ <td><?php echo $echeance['Contact']['prenom'] ?></td>
+
+ <td><?php echo $this->Time->format($echeance['Contact']['echeance'], '%d-%m-%Y', 'invalid'); ?></td>
+ <td>
<span title="<?php echo __d('hoverMouse', 'visualiser') ?>">
<button onclick = "location.href = '<?php
echo $this->Html->url(array(
'controller' => 'Contacts',
'action' => 'edit',
- $maturation['Contact']['id']));
+ $echeance['Contact']['id']));
?>';" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-eye-open"></span> Visualiser
</button>
</span>
</td>
+
</tr>
<?php endforeach; ?>
</table>
+
</div>
</div>
<?php endif; ?>
-
-
-
-
-
-<?php if ($listeSixMois) : ?>
+<?php if ($listeNouveaux) : ?>
<div class="panel panel-success perso-top-buffer-lg">
<div class="panel-heading">
<h3 class="panel-title" id="nouveau">
- <?php echo __d('gestion', 'contacts six mois'); ?>
+ <?php echo __d('gestion', 'nouveau contact'); ?>
<span class="badge pull-right">
- <?php echo $countSixMois ?>
+ <?php echo $countNouveau ?>
</span>
</h3>
</div>
<tr>
<th><?php echo __d('gestion', 'nom'); ?></th>
<th><?php echo __d('gestion', 'prenom'); ?></th>
- <th><?php echo __d('gestion', 'date creation'); ?></th>
+ <th><?php echo __d('gestion', 'date attribution'); ?></th>
<th><?php echo __d('gestion', 'action'); ?></th>
</tr>
- <?php foreach ($listeSixMois as $sixMois) : ?>
+ <?php foreach ($listeNouveaux as $nouveau) : ?>
<tr>
- <td><?php echo $sixMois['Contact']['nom'] ?></td>
- <td><?php echo $sixMois['Contact']['prenom'] ?></td>
- <td><?php echo $this->Time->format($sixMois['Contact']['created'], '%d-%m-%Y', 'invalid'); ?></td>
+ <td><?php echo $nouveau['Contact']['nom'] ?></td>
+ <td><?php echo $nouveau['Contact']['prenom'] ?></td>
+ <td><?php echo $this->Time->format($nouveau['Contact']['date_attribution'], '%d-%m-%Y', 'invalid'); ?></td>
<!-- consulter() confirme qu'on a vu le contact et renvoie vers sa fiche-->
<td>
<span title="<?php echo __d('hoverMouse', 'visualiser') ?>">
echo $this->Html->url(array(
'controller' => 'Contacts',
'action' => 'edit',
- $sixMois['Contact']['id']));
+ $nouveau['Contact']['id']));
?>';" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-eye-open"></span> Visualiser
</button>
</span>
</td>
+
</tr>
<?php endforeach; ?>
-
-
-
<?php if ($listeContactModifies) : ?>
<div class="panel panel-success perso-top-buffer-lg">
<div class="panel-heading">
$('#echeance').click(function() {
change('#echeance-table');
});
+
+ $('#maturation').click(function() {
+ change('#maturation-table');
+ });
+
+
+ $('#sixMois').click(function() {
+ change('#sixMois-table');
+ });
+
</div>
</div>
+ <div class="row">
+ <div class="col-md-12">
+ <?php
+ echo $this->Form->input('structure', array(
+ 'label' => __d('formUser', 'structure'),
+ 'div' => array('class' => 'form-group'),
+ 'class' => 'form-control'));
+ ?>
+ </div>
+ </div>
+
<div class="row">
<div class="col-md-8">
<?php
echo $this->Form->input('couriel', array(
- 'label' => __d('formUser', 'couriel'),
+ 'label' => __d('formUser', 'courriel'),
'div' => array('class' => 'form-group'),
'class' => 'form-control'));
?>
<tr>
<th><?php echo __d('gestionUser', 'nom') ?></th>
<th><?php echo __d('gestionUser', 'prenom') ?></th>
- <th><?php echo __d('gestionUser', 'username') ?></th>
+ <th><?php echo __d('gestionUser', 'structure') ?></th>
<th><?php echo __d('gestionUser', 'role') ?></th>
<th><?php echo __d('gestionUser', 'etat') ?></th>
<th><?php echo __d('gestionUser', 'action') ?></th>
<tr>
<td><?php echo $user['User']['nom']; ?></td>
<td><?php echo $user['User']['prenom']; ?></td>
- <td><?php echo $user['User']['username']; ?></td>
+ <td><?php echo $user['User']['structure']; ?></td>
<td><?php echo $user['Role']['name']; ?></td>
<td>
<?php if ($user['User']['estactif']): ?>
?>
</div>
</div>
+
+
+ <div class="row">
+ <div class="col-md-12">
+ <?php
+ echo $this->Form->input('structure', array(
+ 'label' => __d('formUser', 'structure'),
+ 'div' => array('class' => 'form-group'),
+ 'class' => 'form-control'));
+ ?>
+ </div>
+ </div>
<div class="row">
*
* @author rdubourget
*/
+App::uses("Contact", "Model");
-App::uses("Contact", "Model");
class ContactHelper extends AppHelper {
-
+
// function qui retourne vrai si il à son conjoint dans la base
public function isCouple($id) {
$contact = ClassRegistry::init('Contact');
'recursive' => -1,
'conditions' => array('id' => $id),
'fields' => array('contact_id')
-
));
-
- if($ct['Contact']['contact_id']){
-
+
+ if ($ct['Contact']['contact_id']) {
+
return true;
}
-
+
return false;
+ }
+
+ public function isClasse($id) {
+ $contact = ClassRegistry::init('Contact');
+ $res = $contact->find('first', array(
+ 'recursive' => -1,
+ 'conditions' => array('id' => $id),
+ 'fields' => array('etat_id')
+ ));
+
+ if ($res['Contact']['etat_id'] == null){
+ return false;
+ }
+ if ($res['Contact']['etat_id'] == configure::read('etat.prospection') || $res['Contact']['etat_id'] == configure::read('etat.maturation')) {
+ return false;
+ }else{
+ return true;
+ }
}
+
}
<th>Nom</th>
<th>Prenom</th>
<th>Référent</th>
+ <th>Structure</th>
<th>créé le</th>
<th>Action</th>
<?php echo $r['User']['prenom']; ?>
<?php echo $r['User']['nom']; ?>
</td>
+ <td><?php echo $r['User']['structure']; ?></td>
<td><?php echo $this->Time->format($r['Contact']['created'], '%d-%m-%Y', 'invalid'); ?></td>
<td>
form .required label:after {
-color: #e32;
-content: ' *';
-display:inline;
+ color: #e32;
+ content: ' *';
+ display:inline;
}
+.perso-obligatoire label:after {
+ color: #e32;
+ content: ' *';
+ display:inline;
+}
+
+.perso-etoile {
+ color: #e32;
+
+}
+
+
+
.perso-top-buffer { margin-top:30px; }
.perso-top-buffer-lg { margin-top:40px; }
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
- color: #262626;
- text-decoration: none;
- background-color: #178ACC;
+ color: #262626;
+ text-decoration: none;
+ background-color: #178ACC;
}