page.sheet.contact.person.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. User::check_access('contact','read');
  3. $contacts = array();
  4. $contactperson = ContactPerson::provide();
  5. if($contactperson->id==''){
  6. $contactperson->scope="contact_person";
  7. $contactperson->uid="";
  8. }else{
  9. $contactperson->uid = empty($contactperson->uid) ? $contactperson->id: $contactperson->uid;
  10. foreach (Contact::loadAll(array('scope'=>'contact_person','uid'=>$contactperson->id)) as $key => $contact) {
  11. $contacts[]= array(
  12. 'type'=>$contact->type,
  13. 'value'=>$contact->value,
  14. );
  15. }
  16. }
  17. ?>
  18. <div class="plugin-contact">
  19. <div id="contact-person-form" class="row justify-content-md-center contact-person-form" data-action="contact_contact_person_save" data-id="<?php echo $contactperson->id; ?>">
  20. <div class="col-md-4 shadow-sm bg-white p-3">
  21. <h3>Contact
  22. <div onclick="contact_contact_person_save();" class="btn btn-small btn-success right"><i class="fas fa-check"></i> Enregistrer</div>
  23. <div class="btn btn-small btn-info mb-2 btn-dark mr-2 right" data-scope="contactperson" data-uid="<?php echo $contactperson->id; ?>" data-show-important="true" data-type="history" data-tooltip title="Ouvrir l'historique"> <i class="far fa-comment-dots"></i></div>
  24. <a href="index.php?module=contact&page=list.contact.person" class="btn btn-small btn-dark right mr-2">Retour</a>
  25. </h3>
  26. <label for="name">Nom</label>
  27. <input value="<?php echo $contactperson->name; ?>" class="form-control" type="text" id="name" >
  28. <label for="firstname">Prénom</label>
  29. <input value="<?php echo $contactperson->firstname; ?>" class="form-control" type="text" id="firstname" >
  30. <label for="job">Métier</label>
  31. <input value="<?php echo $contactperson->job; ?>" class="form-control" type="text" id="job" >
  32. <label for="civility">Civilité</label>
  33. <select class="form-control select-control" type="text" id="civility">
  34. <?php foreach(ContactPerson::civilities() as $slug=>$item): ?>
  35. <option <?php echo $contactperson->civility == $slug ? 'selected="selected"' : '' ?> value="<?php echo $slug ?>" ><?php echo $item['label']; ?></option>
  36. <?php endforeach; ?>
  37. </select>
  38. <label for="tag">Etiquettes</label>
  39. <input value="<?php echo $contactperson->tag; ?>" class="form-control" type="text" data-type="tag" data-multiple=true id="tag" >
  40. <hr/>
  41. <label for="phones" class="text-muted font-weight-bold">TELEPHONES(S) & EMAILS(S)</label>
  42. <ul id="contact-list" class="contact-list">
  43. <li>
  44. <div class="input-group mb-3">
  45. <div class="input-group-prepend">
  46. <span class="input-group-text input-group-sm p-0">
  47. <select class="form-control type form-control-select input-sm p-0 bg-transparent border-0" onchange="contact_contact_save()">
  48. <?php foreach (Contact::types() as $key => $type): ?>
  49. <option value="<?php echo $key; ?>"><?php echo $type['label']; ?></option>
  50. <?php endforeach ?>
  51. </select>
  52. </span>
  53. </div>
  54. <input class="form-control value" type="text" value="" onchange="contact_contact_save()">
  55. <div class="input-group-append">
  56. <div class="btn pointer" onclick="contact_contact_remove(this)"><i class="fa fa-trash-alt text-muted"></i></div>
  57. <div class="btn pointer" onclick="contact_contact_add(this)"><i class="fa fa-plus text-muted"></i></div>
  58. </div>
  59. </div>
  60. </li>
  61. </ul>
  62. <input value="<?php echo base64_encode(json_encode($contacts)); ?>" class="form-control" type="hidden" id="contacts" >
  63. <input value="<?php echo $contactperson->scope; ?>" class="form-control" type="hidden" id="scope" >
  64. <input value="<?php echo $contactperson->uid; ?>" class="form-control" type="hidden" id="uid" >
  65. <br/>
  66. </div>
  67. <?php
  68. //Champs dynamiques
  69. global $myFirm;
  70. if($myFirm->has_plugin('fr.core.dynamicform')):
  71. Plugin::need('dynamicform/DynamicForm');
  72. $form = Dynamicform::show('contact-form',array(
  73. 'scope'=>'contact_person',
  74. 'uid'=>$contactperson->id
  75. ));
  76. if(!empty($form)):
  77. ?>
  78. <div class="col-md-4 shadow-sm bg-white p-3 ml-3">
  79. <h3>Informations complémentaires</h3>
  80. <?php
  81. echo $form;
  82. ?>
  83. </div>
  84. <?php endif; ?>
  85. <?php endif; ?>
  86. </div>
  87. </div>