page.sheet.employee.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php
  2. global $conf,$myUser,$myFirm;
  3. User::check_access('employee','read');
  4. require_once(__DIR__.SLASH.'Employee.class.php');
  5. require_once(__DIR__.SLASH.'EmployeeWorkTime.class.php');
  6. $employee = Employee::provide();
  7. $myEmployee = Employee::load(array('account'=>$myUser->login));
  8. if($employee->id == 0){
  9. $employee->date = time();
  10. if(is_object($myEmployee)) $employee->manager = $myEmployee->id;
  11. }else{
  12. if(!$myUser->can('employee','configure')){
  13. if(!$myEmployee) throw new Exception('Vous n\'avez pas la permission de voir cette fiche');
  14. if(!$myEmployee->can($employee,'read')) throw new Exception('Vous n\'avez pas la permission de voir cette fiche');
  15. }
  16. }
  17. $hardwares = !empty($employee->hardware) ? json_decode($employee->hardware,true): array();
  18. ?>
  19. <div class="plugin-employee">
  20. <div id="employee-form" class="row justify-content-md-center employee-form" data-action="employee_save" data-id="<?php echo $employee->id; ?>">
  21. <div class="col-md-6 shadow-sm bg-white p-3">
  22. <h3><i class="fas fa-user-tie"></i> Fiche employé
  23. <div onclick="employee_save();" class="btn btn-small btn-save btn-success right"><i class="fas fa-check"></i> Enregistrer</div>
  24. <?php if($myUser->can('export', 'read') && $myFirm->has_plugin('fr.core.export')) : ?>
  25. <div class="btn btn-primary btn-small right mx-2" data-type="export-model" data-parameters='<?php echo stripslashes(json_encode(array("plugin"=>"employee","dataset"=>"employee-sheet","id"=>$employee->id))); ?>'><i class="far fa-file"></i> Exporter en word</div>
  26. <?php endif; ?>
  27. <a href="index.php?module=employee&page=list.employee" class="btn btn-small btn-dark right ">Retour</a></h3>
  28. <div class="row">
  29. <div class="col-md-3">
  30. <input value="" class="component-file-cover bg-light shadow-sm rounded-sm" type="text" data-type="file" data-limit="1" data-extension="jpg,png,bmp,jpeg,gif" data-action="employee_employee_photo" data-id="photo" data-data='{"id":"<?php echo $employee->id; ?>"}' id="photo" >
  31. </div>
  32. <div class="col-md-7">
  33. <div class="row">
  34. <div class="col-md-6">
  35. <label for="birthName">Nom de naissance</label>
  36. <input value="<?php echo $employee->birthName; ?>" onblur="if(!$('#name').val()) $('#name').val($(this).val())" class="form-control" type="text" id="birthName" >
  37. </div>
  38. <div class="col-md-6">
  39. <label for="name">Nom marital</label>
  40. <input value="<?php echo $employee->name; ?>" class="form-control" type="text" id="name" >
  41. </div>
  42. </div>
  43. <label for="firstname">Prénom</label>
  44. <input value="<?php echo $employee->firstname; ?>" class="form-control" type="text" id="firstname" >
  45. </div>
  46. </div>
  47. <label for="job">Poste</label>
  48. <select class="form-control select-control" type="text" data-type="dictionary" data-slug="employee_employee_job" data-depth="1" key=data-disable-label data-value="<?php echo $employee->job; ?>" id="job" ></select>
  49. <label for="jobDescription">Rôle/Missions</label>
  50. <textarea class="" type="text" data-type="wysiwyg" id="jobDescription"><?php echo $employee->jobDescription; ?></textarea>
  51. <label for="manager">Responsable</label>
  52. <input value="<?php echo $employee->manager; ?>" class="form-control" data-type="employee" type="text" id="manager" >
  53. <label for="account">Compte lié</label>
  54. <input value="<?php echo $employee->account; ?>" class="form-control" type="text" data-type="user" id="account" >
  55. <label for="workplace">Lieu de travail</label>
  56. <input value="<?php echo $employee->workplace; ?>" class="form-control" type="text" data-type="location" id="workplace" >
  57. <label for="hardware">Mise a disposition de matériel</label><br>
  58. <?php foreach(Dictionary::bySlug('employee_employee_hardware',true) as $item): ?>
  59. <label><input type="checkbox" <?php echo (in_array($item->id, $hardwares) ? 'checked="checked"':'' ) ?> data-id="<?php echo $item->id; ?>" class="hardware" data-type="checkbox"> <?php echo $item->label; ?></label>
  60. <?php endforeach; ?>
  61. <br/>
  62. <label for="date">Date</label>
  63. <input value="<?php if(!empty($employee->date)) echo date('d/m/Y',$employee->date); ?>" class="form-control" type="text" data-type="date" title="format jj/mm/aaaa" placeholder="JJ/MM/AAAA" id="date" >
  64. <br/>
  65. <label for="comment">Information sur le recrutement</label>
  66. <textarea class="" type="text" data-type="wysiwyg" id="comment"><?php echo $employee->comment; ?></textarea>
  67. <br/>
  68. <label for="attachments">Pièces jointes</label>
  69. <input value="" class="component-file-default bg-light shadow-sm rounded-sm" type="text" data-type="file" data-extension="jpg,png,bmp,jpeg,gif,docx,xlsx,pptx,msg,eml,pdf,zip,doc,xls,ppt,txt,csv" data-action="employee_employee_attachments" data-id="attachments" data-data='{"id":"<?php echo $employee->id; ?>"}' id="attachments" >
  70. </div>
  71. <div class="col-md-3 ml-3">
  72. <div class="row">
  73. <div class="col-md-12 shadow-sm bg-white p-3">
  74. <h5><i class="fas fa-file-signature"></i> HISTORIQUE CONTRATS</h5>
  75. <!-- présentation tableau -->
  76. <table id="employee-contracts" class="table table-striped " data-entity-search="employee_employee_contract_search">
  77. <thead>
  78. <tr>
  79. <th data-sortable="start">Contrat</th>
  80. <th data-sortable="worktime">Tps travail</th>
  81. <th><div onclick="employee_employee_contract_edit(this);" class="btn btn-mini btn-success btn-squarred right" title="Ajouter un contrat"><i class="fas fa-plus"></i></div></th>
  82. </tr>
  83. </thead>
  84. <tbody>
  85. <tr data-id="{{id}}" class="hidden item-line">
  86. <td class="align-middle"><strong>{{start-readable}} - {{#end-readable}} {{end-readable}}{{/end-readable}}{{^end-readable}}<span class="success text-info">Aujourd'hui</span>{{/end-readable}}</strong><br><small class="text-muted">{{type.label}} - {{statute.label}}</small></td>
  87. <td class="align-middle">{{worktime.label}}</td>
  88. <td class="align-middle text-right">
  89. <div class="btn-group btn-group-sm" role="group">
  90. <div onclick="employee_employee_contract_edit(this);" class="btn text-info" title="Éditer employee_contract"><i class="fas fa-pencil-alt"></i></div>
  91. <div class="btn text-danger" title="Supprimer employee_contract" onclick="employee_employee_contract_delete(this);"><i class="far fa-trash-alt"></i></div>
  92. </div>
  93. </td>
  94. </tr>
  95. </tbody>
  96. </table>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. <!-- Modal -->
  103. <div class="modal fade" id="contractModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  104. <div class="modal-dialog">
  105. <div class="modal-content">
  106. <div class="modal-header">
  107. <h5 class="modal-title" id="exampleModalLabel">Edition contrat</h5>
  108. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  109. <span aria-hidden="true">&times;</span>
  110. </button>
  111. </div>
  112. <div class="modal-body">
  113. <label for="contractType">Type de contrat</label>
  114. <select class="form-control select-control" type="text" data-type="dictionary" data-slug="employee_employeecontract_type" data-depth="1" key=data-disable-label data-value="" id="type" ></select>
  115. <label for="statute">Statut</label>
  116. <select class="form-control select-control" type="text" data-type="dictionary" data-slug="employee_employeecontract_statute" data-depth="1" key=data-disable-label data-value="" id="statute" ></select>
  117. <label for="contractStart">Date de début de contrat</label>
  118. <input value="" class="form-control" type="text" data-type="date" title="format jj/mm/aaaa" placeholder="JJ/MM/AAAA" id="start" >
  119. <label for="contractEnd">Date de fin (si CDD)</label>
  120. <input value="" class="form-control" type="text" data-type="date" title="format jj/mm/aaaa" placeholder="JJ/MM/AAAA" id="end">
  121. <label for="salary">Rémunération annuelle brute</label>
  122. <input class="form-control" type="text" data-type="price" value="" id="salary" >
  123. <label for="workTime">Temps de travail</label>
  124. <select class="form-control select-control" id="worktime" >
  125. <?php foreach(EmployeeWorkTime::loadAll() as $workTime): ?>
  126. <option value="<?php echo $workTime->id; ?>">
  127. <?php echo $workTime->label; ?>
  128. </option>
  129. <?php endforeach; ?>
  130. </select>
  131. <label for="cddComment">Commentaire</label>
  132. <textarea class="form-control" type="text" id="comment"></textarea>
  133. </div>
  134. <div class="modal-footer">
  135. <div type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</div>
  136. <div onclick="employee_employee_contract_save()" type="button" class="btn btn-primary">Enregistrer</div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>