page.sheet.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?php
  2. global $myFirm;
  3. User::check_access('example','read');
  4. require_once(__DIR__.SLASH.'Contact.class.php');
  5. $contact = Contact::provide();
  6. $data = array(
  7. 'subject' => (!empty($contact->label) ? 'Envoi de la fiche contact de '.$contact->label : 'Envoi fiche contact'),
  8. 'message' => "Contenu du message envoyé",
  9. 'recipients' => array('to'=>array('claude@claude.fr', 'testouille@test.fr'), 'cc'=>array('carboncopy@test.net'), 'cci'=>array('another@email.fr')),
  10. 'attachments' => $contact->documents()
  11. );
  12. ?>
  13. <div class="container-small">
  14. <br>
  15. <label for="label">Composant Card</label>
  16. <small class="text-muted"> (Span data-type="card")</small>
  17. <h3>Fiche du contact <span data-type="card" data-show-delay="200" data-action="example_contact_card" data-parameters='<?php echo json_encode(array('id'=>$contact->id)); ?>'><?php echo html_decode_utf8($contact->label); ?></span></h3>
  18. <br>
  19. <form class="row" method="POST" enctype="multipart/form-data" id="contactForm" data-action="contact_save" data-id="<?php echo $contact->id; ?>">
  20. <div class="col-xl-12">
  21. <label for="label">Libellé</label>
  22. <small class="text-muted"> (Simple input texte)</small>
  23. <input type="text" value="<?php echo html_decode_utf8($contact->label); ?>" placeholder="Raison sociale ou nom" class="form-control" id="label" name="label"/>
  24. <br>
  25. <label for="phone">Téléphone</label>
  26. <small class="text-muted"> (Simple input texte)</small>
  27. <input type="text" value="<?php echo $contact->phone; ?>" placeholder="N° Téléphone" class="form-control" id="phone" name="phone"/>
  28. <br>
  29. <label for="birth">Date de naissance</label>
  30. <small class="text-muted"> (Input data-type="date")</small>
  31. <input type="text" data-type="date" value="<?php echo $contact->birth!=0?date('d/m/Y',$contact->birth):''; ?>" placeholder="La date de naissance" class="form-control" id="birth" name="birth"/>
  32. <br>
  33. <label for="hour">Heure de naissance</label>
  34. <small class="text-muted"> (Input data-type="hour")</small>
  35. <input type="text" data-type="hour" value="<?php echo $contact->hour!=0?date('H:i',$contact->hour):''; ?>" data-step="20" placeholder="L'heure de naissance" class="form-control" id="hour" name="hour"/>
  36. <br>
  37. <label for="manager">Manager</label>
  38. <small class="text-muted" data-placement="right" data-tooltip title="* data-multiple : Autorise l'utilisateur a sélectionner des entité multiples
  39. * data-types (default: user) : définis les entité sélectionnables (ex: user,rank) "> (Input data-type="user")</small>
  40. <div class="input-group mb-3">
  41. <input type="text" data-type="user" data-types="user" value="<?php echo $contact->manager; ?>" placeholder="Manager du contact" class="form-control" id="manager" name="manager"/>
  42. <input type="text" data-type="color" value="#55e6c1" onchange="$('#mainMenu').css('backgroundColor',$(this).val())" class="form-control" id="color" name="color"/>
  43. </div>
  44. <label for="color">Couleur</label>
  45. <small class="text-muted"> (Input data-type="color")</small>
  46. <input type="text" data-type="color" value="pink" class="form-control" id="color" name="color" onchange="$('#mainMenu').css('backgroundColor',$(this).val())"/>
  47. <br>
  48. <label for="author">Auteur</label>
  49. <small class="text-muted" data-placement="right" data-tooltip title="* data-multiple : Autorise l'utilisateur a sélectionner des entité multiples
  50. * data-types (default: user) : définis les entité sélectionnables (ex: user,rank) "> (Input data-type="user")</small>
  51. <input type="text" data-type="user" data-multiple data-types="user,rank" value="<?php echo $contact->author; ?>" placeholder="Auteur du contact" class="form-control" id="author" name="author"/>
  52. <br>
  53. <label for="picture">Image</label>
  54. <small class="text-muted"> (Input data-type="image")</small>
  55. <input type="file" data-type="image" value="<?php echo $contact->picture(); ?>" class="form-control-file" id="picture" name="picture" data-delete="contact_avatar_delete(this)" data-default-src="img/default-avatar.png">
  56. <br>
  57. <label for="icon">Icône</label>
  58. <small class="text-muted"> (Input data-type="icon")</small>
  59. <span class="icon-chooser contact-icon" id="basic-addon-icon-contact">
  60. <input id="icon" data-type="icon" name="icon" class="form-control" placeholder="Icône du contact" value="<?php echo !empty($contact->icon) ? $contact->icon : 'fab fa-btc'; ?>" type="text"></span>
  61. <br>
  62. <label for="vehicle">Véhicule</label>
  63. <small class="text-muted" data-placement="right" data-tooltip title="* data-depth : nb de profondeur de liste
  64. * data-slug : le slug de la liste mère à afficher
  65. * data-value : la valeur de l'entité à récup en base
  66. * data-disable-label : cache le label de sous-liste si mentionné">(Select data-type="dictionnary")</small>
  67. <select data-type="dictionnary" data-slug="vehicles" data-depth="3" data-value="<?php echo $contact->vehicle; ?>" class="form-control select-control" name="vehicle" id="vehicle"></select>
  68. <label for="vehicle2">Véhicule (tags)</label>
  69. <small class="text-muted" data-placement="right" data-tooltip title="* data-multiple : Autorise l'utilisateur a sélectionner des tag multiples
  70. * data-slug : le slug de la liste mère à afficher">(Select data-type="tag-list")</small>
  71. <input type="text" data-type="tag-list" data-slug="vehicles" class="form-control" />
  72. <label for="vehicle2">Catégories</label>
  73. <small class="text-muted" data-placement="right" data-tooltip title="* data-tags (json) :tags disponibles (eg.
  74. {
  75. 'bug':{'icon':'fas fa-bug','label':'Bug','color':'#cb2431'},
  76. 'feature':{'icon':'fas fa-check','label':'Demande','color':'#2cbe4e'}
  77. }
  78. )">(Select data-type="tagcloud")</small>
  79. <input type="text" data-type="tagcloud" data-tags='{"bug":{"icon":"fas fa-bug","label":"Bug","color":"#cb2431"},"feature":{"icon":"fas fa-check","label":"Demande","color":"#2cbe4e"},"question":{"icon":"far fa-question-circle","label":"Question","color":"#00BCD4"}}' class="form-control" value="bug,question"/>
  80. <label for="example-country">Pays</label>
  81. <small class="text-muted">(Select data-type="dictionnary")</small>
  82. <select data-type="dictionnary" data-slug="countries" data-depth="3" data-id="country" data-value="" class="form-control select-control" name="example-country" id="example-country"></select>
  83. <br>
  84. <label for="country">Etat</label>
  85. <small data-tooltip title="* data-icon : l'icone affichée près du label (optionnel)" class="text-muted">(Select data-type="dropdown-select")</small><br/>
  86. <select data-type="dropdown-select" id="state">
  87. <option selected="selected" value="active" style="background-color:#2cbe4e;color:#ffffff;" data-icon="far fa-check-circle">Actif</option>
  88. <option value="inactive" style="background-color:#c90000;color:#ffffff;" data-icon="far fa-times-circle">Inactif</option>
  89. </select><br/>
  90. <label for="address">Adresse</label>
  91. <small class="text-muted"> (Input data-type="location")</small>
  92. <input type="text" data-type="location" data-filter-geocode data-select-callback="example_location_select" data-geocode-callback="example_location_geocode" data-filter-country="FRA" value="<?php echo $contact->address; ?>" class="form-control" id="address" name="address"/>
  93. Ville : <span id="city">...</span><br>
  94. Pays : <span id="country">...</span>
  95. <br><br>
  96. <label for="document">Documents</label>
  97. <small class="text-muted" data-placement="right" data-tooltip title="* data-label : le label affiché dans la zone
  98. * data-delete : méthode de suppression de doc de l'entité
  99. * data-max-files : nombre de fichiers uploadables (defaut : 0 pour infini)
  100. * data-preview : Affiche l'apercu de l'image si possible
  101. * data-readonly : false/true Active désactive la possibilité d'envoyer du fichier
  102. * data-allowed : les extensions de fichier acceptées"> (Div data-type="dropzone")</small>
  103. <div data-type="dropzone" data-label="Faites glisser vos documents ici" data-delete="contact_delete_document" data-save="contact_add_document" data-allowed="docx,pdf,txt,jpg,bmp,gif,xlsx,png,iso" class="form-control" id="document" name="document">
  104. <?php echo json_encode($contact->documents()); ?>
  105. <!-- Template action custom pour la dropzone -->
  106. <div class="btn dropzone-custom-button hidden" onclick="alert('Je suis le fichier '+$(this).prev('a').text()+ '. Je vaux '+Math.floor((Math.random() * 10) + 1)+' bitcoins');" title="Une action custom" id="send-offer-button"><i class="fab fa-bitcoin"></i></div>
  107. </div>
  108. <br>
  109. <label for="story">Histoire</label>
  110. <small class="text-muted" data-placement="right" data-tooltip title="* data-label : le label affiché dans la zone
  111. * data-mention-user='true' :activer les mentions d'utilisateurs interne
  112. * data-mention-object='action' :activer les mentions # sur une action
  113. * data-script-allow : désactive la supression automatique des tags <scripts> et <link> (anti xss)
  114. "> (Textarea data-type="wysiwyg")</small>
  115. <textarea data-type="wysiwyg" class="" id="story" name="story" data-mention-user="true" data-mention-object='issue_autocomplete'><?php echo $contact->story; ?></textarea>
  116. <label for="storyShort">Histoire dans un input</label>
  117. <small class="text-muted"> (Textarea data-type="wysiwyg" et data-minimal)</small>
  118. <textarea data-type="wysiwyg" class="form-control m-0" data-minimal id="storyShort" name="storyShort" data-mention-user="true" data-mention-object='issue_autocomplete'><?php echo $contact->storyShort; ?></textarea>
  119. <br>
  120. <label for="login">Login</label>
  121. <small class="text-muted"> (Simple input texte)</small>
  122. <input type="text" value="<?php echo $contact->login; ?>" placeholder="Identifiant" class="form-control" id="login" name="login"/>
  123. <br>
  124. <label for="password">Password</label>
  125. <small class="text-muted"> (Input data-type="password")</small>
  126. <input type="text" data-type="password" data-toggle-event="hover" data-generator value="<?php echo $contact->password; ?>" placeholder="Mot de passe" class="form-control" id="password" name="password"/>
  127. <br>
  128. <label for="contact">Nom du tuteur :</label>
  129. <small class="text-muted"> (Div data-type="quickform")</small>
  130. <div class="quickform d-inline-block" data-type="quickform" data-title="Ajout rapide de tuteur :" data-loaded="example_quickform_buttons" data-action="contact_quick_create"><i title="Ajoutez rapidement un tuteur." class="fas fa-user-plus"></i></div>
  131. <input type="text" value="" placeholder="Nom du contact" class="form-control" id="contact" name="contact"/>
  132. <br>
  133. <label for="label">Donuts</label>
  134. <small class="text-muted"> (canvas data-type="doughnut")</small>
  135. <canvas data-type="doughnut" data-values="[1,3,4,7]" data-labels='["fib","on","acci"]' data-colors='["#f39c12","#2980b9","#27ae60"]'></canvas>
  136. <br>
  137. <label for="label">Line</label>
  138. <small class="text-muted"> (canvas data-type="line")</small>
  139. <canvas data-type="line" data-values="[1,3,4,7]" data-labels='["fib","on","acci"]' data-color='#8e44ad'>Graphique example</canvas>
  140. <br>
  141. <label for="label">Bar</label>
  142. <small class="text-muted"> (canvas data-type="bar")</small>
  143. <canvas data-type="bar" data-values="[2,3,4,7]" data-labels='["fib","on","acci"]' data-colors='["#f39c12","#2980b9","#27ae60"]'>Graphique example</canvas>
  144. <br>
  145. <div id="checkboxes">
  146. <label>Input checkbox</label>
  147. <small class="text-muted"> (Input data-type="checkbox")</small><br>
  148. <input type="checkbox" id="mycheckbox1" name="mycheckbox1" data-class="blink_me" data-type="checkbox"><label for="mycheckbox1">Ma checkbox 1 (avec id, non encapsulée)</label><br>
  149. <label for="checkbox_2"><input type="checkbox" id="checkbox_2" name="checkbox" data-class="" data-type="checkbox">Ma checkbox 2 (avec id, encapsulée)</label><br>
  150. <label><input type="checkbox" name="checkbox" data-class="" data-type="checkbox">Ma checkbox 3 (sans id, encapsulée)</label><br>
  151. <input type="checkbox" name="checkbox" data-class="" data-type="checkbox"><label>Ma checkbox 4 (sans id, non encapsulée)</label><br>
  152. <input type="checkbox" id="checkbox_5" name="checkbox" data-class="" data-type="checkbox" disabled><label for="checkbox_5">Ma checkbox 5 (avec id, disabled)</label><br>
  153. <label><input type="checkbox" name="checkbox" data-class="" data-type="checkbox" disabled>Ma checkbox 6 (sans id, disabled)</label><br>
  154. <input type="checkbox" id="checkbox_7" name="checkbox" data-class="" data-type="checkbox" disabled checked><label for="checkbox_7">Ma checkbox 7 (disabled, checked)</label><br>
  155. </div>
  156. <br>
  157. <div>
  158. <label>Input radio</label>
  159. <small class="text-muted"> (Input data-type="radio")</small><br>
  160. <input type="radio" id="case1" name="my-radio-button" data-type="radio" data-label="Hello"><br>
  161. <label><input type="radio" id="case2" name="my-radio-button" data-type="radio">Toto</label><br>
  162. <input type="radio" id="case3" name="my-radio-button" data-type="radio"><label for="case3">Coucou</label><br>
  163. <input type="radio" id="case4" name="my-radio-button" data-type="radio" disabled><label for="case4">Disabled avec id</label><br>
  164. <input type="radio" name="my-radio-button" data-type="radio"><label>Sans id</label><br>
  165. <input type="radio" name="my-radio-button" data-type="radio" disabled><label>Disabled sans id</label>
  166. </div>
  167. <br>
  168. <label for="label">Tableau d'une liste</label>
  169. <small class="text-muted"> (div data-type="dictionnary-table")</small>
  170. <div data-type="dictionnary-table" data-dictionnary="vehicles"></div>
  171. <br><br>
  172. <?php if($myFirm->has_plugin('fr.sys1.stripe')) : ?>
  173. <label for="checkbox">Formulaire de paiement en ligne (via API Stripe)</label>
  174. <small class="text-muted"> (Div data-type="payment")</small><br>
  175. <small class="text-muted">Il faut configurer les clés API en config avant de pouvoir réaliser un paiement. (Voir <a href="https://stripe.com/docs/testing#cards" target="_blank">cette page</a> pour des cartes bleues de tests)</small>
  176. <div data-type="payment" data-action="example_stripe_pay"></div>
  177. <?php endif; ?>
  178. </div>
  179. <div class="col-md-12 text-center noLabel">
  180. <div class="btn btn-success" onclick="contact_save();"><i class="fas fa-check"></i> Enregistrer</div>
  181. <?php if($myUser->can('export', 'read') && $myFirm->has_plugin('fr.sys1.export')) : ?>
  182. <div class="d-inline-block" data-type="export-model" data-pre-callback="contact_export_pre_callback" data-post-callback="contact_export_post_callback" data-parameters='<?php echo stripslashes(json_encode(array("plugin"=>"example","dataset"=>"contact-sheet","id"=>$contact->id,"destination"=>addslashes('contact'.SLASH.'documents'.SLASH.$contact->id.SLASH)))); ?>'>
  183. <div class="btn btn-primary"><i class="far fa-file"></i> Export modèle</div>
  184. </div>
  185. <?php endif; ?>
  186. <div class="btn btn-info" onclick='sendmail_preview(<?php echo json_encode($data); ?>);'><i class="fas fa-paper-plane"></i> Envoi mail</div>
  187. <br><br>
  188. </div>
  189. </form>
  190. </div>