Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <?php
  2. /**
  3. * Copyright distrib (2018)
  4. *
  5. * contact@opendistrib.net
  6. *
  7. * Ce logiciel est un programme informatique servant à aider les producteurs
  8. * à distribuer leur production en circuits courts.
  9. *
  10. * Ce logiciel est régi par la licence CeCILL soumise au droit français et
  11. * respectant les principes de diffusion des logiciels libres. Vous pouvez
  12. * utiliser, modifier et/ou redistribuer ce programme sous les conditions
  13. * de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
  14. * sur le site "http://www.cecill.info".
  15. *
  16. * En contrepartie de l'accessibilité au code source et des droits de copie,
  17. * de modification et de redistribution accordés par cette licence, il n'est
  18. * offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
  19. * seule une responsabilité restreinte pèse sur l'auteur du programme, le
  20. * titulaire des droits patrimoniaux et les concédants successifs.
  21. *
  22. * A cet égard l'attention de l'utilisateur est attirée sur les risques
  23. * associés au chargement, à l'utilisation, à la modification et/ou au
  24. * développement et à la reproduction du logiciel par l'utilisateur étant
  25. * donné sa spécificité de logiciel libre, qui peut le rendre complexe à
  26. * manipuler et qui le réserve donc à des développeurs et des professionnels
  27. * avertis possédant des connaissances informatiques approfondies. Les
  28. * utilisateurs sont donc invités à charger et tester l'adéquation du
  29. * logiciel à leurs besoins dans des conditions permettant d'assurer la
  30. * sécurité de leurs systèmes et ou de leurs données et, plus généralement,
  31. * à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
  32. *
  33. * Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
  34. * pris connaissance de la licence CeCILL, et que vous en avez accepté les
  35. * termes.
  36. */
  37. use common\helpers\GlobalParam;
  38. use common\logic\Feature\Feature\Feature;
  39. use common\logic\User\User\Module\UserModule;
  40. $producerModule = $this->getProducerModule();
  41. $userModule = UserModule::getInstance();
  42. $userProducerModule = $this->getUserProducerModule();
  43. $ticketModule = $this->getTicketModule();
  44. $featureChecker = $this->getFeatureModule()->getChecker();
  45. $adminSettingBag = $this->getSettingModule()->getAdminSettingBag();
  46. $producer = GlobalParam::getCurrentProducer();
  47. $userCurrent = GlobalParam::getCurrentUser();
  48. $isUserCurrentGrantedAsAdministrator = $userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent);
  49. $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGrantedAsProducer($userCurrent);
  50. ?>
  51. <aside class="main-sidebar">
  52. <section class="sidebar">
  53. <?php
  54. $producer = GlobalParam::getCurrentProducer();
  55. $newVersionOpendistribLabel = '';
  56. if ($producer && !$producerModule->isUpToDateWithOpendistribVersion($producer)) {
  57. $newVersionOpendistribLabel = '<span class="pull-right-container"><small class="label pull-right bg-green">'.GlobalParam::getOpendistribVersion().'</small></span>';
  58. }
  59. $countTicketsProducerUnreadLabel = '';
  60. $countTicketsProducerUnread = $ticketModule->countTicketsUnreadByUser($this->getUserCurrent());
  61. if($countTicketsProducerUnread && !$isUserCurrentGrantedAsAdministrator) {
  62. $countTicketsProducerUnreadLabel = '<small class="label pull-right bg-blue">'.$countTicketsProducerUnread.'</small>';
  63. }
  64. $developerOnlineLabel = '';
  65. if($adminSettingBag->get('supportDeveloperOnline')) {
  66. $developerOnlineLabel = '<small class="label pull-right bg-green"><i class="fa fa-phone"></i></small>';
  67. }
  68. $countTicketsAdminUnreadLabel = '';
  69. $countTicketsAdminUnread = $ticketModule->countTicketsAdminUnreadByUser($this->getUserCurrent());
  70. if($countTicketsAdminUnread && $isUserCurrentGrantedAsAdministrator) {
  71. $countTicketsAdminUnreadLabel = '<span class="pull-right-container"><small class="label pull-right bg-green">'.$countTicketsAdminUnread.'</small></span>';
  72. }
  73. $sumUserProducerCredits = $userProducerModule->sumUserProducerCredits();
  74. $sumUserProducerCreditsLabel = '';
  75. //$sumUserProducerCreditsLabel = '<span class="pull-right-container"><small class="label pull-right '.($sumUserProducerCredits >= 0 ? 'bg-green' : 'bg-red') .'">'.number_format($sumUserProducerCredits, 2).' €</small></span>';
  76. ?>
  77. <?= dmstr\widgets\Menu::widget(
  78. [
  79. 'options' => ['class' => 'sidebar-menu tree', 'data-widget' => 'tree'],
  80. 'items' => [
  81. ['label' => "Besoin d'aide ?", 'options' => ['class' => 'header'], 'visible' => $isUserCurrentGrantedAsProducer],
  82. [
  83. 'label' => 'Support',
  84. 'icon' => 'comments',
  85. 'url' => ['support/index'],
  86. 'visible' => $isUserCurrentGrantedAsProducer,
  87. 'template' => '<a href="{url}">{icon} {label} <span class="pull-right-container">' . $developerOnlineLabel . $countTicketsProducerUnreadLabel . '</span></a>'
  88. ],
  89. ['label' => $producer->name, 'options' => ['class' => 'header'], 'visible' => $isUserCurrentGrantedAsProducer],
  90. ['label' => 'Tableau de bord', 'icon' => 'dashboard', 'url' => ['/dashboard/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  91. ['label' => 'Distributions', 'icon' => 'calendar', 'url' => ['/distribution/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  92. [
  93. 'label' => 'Produits',
  94. 'icon' => 'clone',
  95. 'url' => ['/product/index'],
  96. 'visible' => $isUserCurrentGrantedAsProducer,
  97. 'active' => Yii::$app->controller->id == 'product' || Yii::$app->controller->id == 'product-category',
  98. 'items' => [
  99. ['label' => 'Liste', 'icon' => 'th-list', 'url' => ['/product/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  100. ['label' => 'Catégories', 'icon' => 'book', 'url' => ['/product-category/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  101. ['label' => 'Import prix', 'icon' => 'upload', 'url' => ['/product/price-import'], 'visible' => $isUserCurrentGrantedAsProducer && $featureChecker->isEnabled(Feature::ALIAS_PRODUCT_PRICE_IMPORT)],
  102. ]
  103. ],
  104. ['label' => 'Points de vente', 'icon' => 'map-marker', 'url' => ['/point-sale/index'], 'visible' => $isUserCurrentGrantedAsProducer, 'active' => Yii::$app->controller->id == 'point-sale'],
  105. [
  106. 'label' => 'Utilisateurs',
  107. 'icon' => 'users',
  108. 'url' => ['/user/index'],
  109. 'items' => [
  110. ['label' => 'Liste', 'icon' => 'th-list', 'url' => ['/user/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  111. [
  112. 'label' => 'Crédit',
  113. 'icon' => 'euro',
  114. 'url' => ['/credit/index'],
  115. 'template' => '<a href="{url}">{icon} {label}' . $sumUserProducerCreditsLabel . '</a>',
  116. 'visible' => $isUserCurrentGrantedAsProducer && $producerModule->getConfig('credit')
  117. ],
  118. ['label' => 'Groupes', 'icon' => 'users', 'url' => ['/user-group/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  119. ['label' => 'Import', 'icon' => 'upload', 'url' => ['/user-import/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  120. ],
  121. ],
  122. ['label' => 'Abonnements', 'icon' => 'repeat', 'url' => ['/subscription/index'], 'visible' => $isUserCurrentGrantedAsProducer, 'active' => Yii::$app->controller->id == 'subscription'],
  123. ['label' => 'Communiquer', 'icon' => 'bullhorn', 'url' => ['/communicate/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  124. [
  125. 'label' => 'Documents',
  126. 'icon' => 'clone',
  127. 'url' => ['/delivery-note/index'],
  128. 'items' => [
  129. ['label' => 'Bons de livraison', 'icon' => 'sticky-note-o', 'url' => ['/delivery-note/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  130. ['label' => 'Factures', 'icon' => 'sticky-note-o', 'url' => ['/invoice/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  131. ['label' => 'Devis', 'icon' => 'sticky-note-o', 'url' => ['/quotation/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  132. ],
  133. ],
  134. [
  135. 'label' => 'Statistiques',
  136. 'icon' => 'line-chart',
  137. 'url' => ['/stats/index'],
  138. 'items' => [
  139. ['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  140. ['label' => 'Rapports', 'icon' => 'pencil-square-o', 'url' => ['/report/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  141. ['label' => 'Produits', 'icon' => 'table', 'url' => ['/stats/products'], 'visible' => $isUserCurrentGrantedAsProducer],
  142. ],
  143. ],
  144. ['label' => 'Paramètres', 'icon' => 'cog', 'url' => ['/producer/update'], 'visible' => $isUserCurrentGrantedAsProducer],
  145. ['label' => 'Accès', 'icon' => 'lock', 'url' => ['/access/index'], 'visible' => $isUserCurrentGrantedAsProducer],
  146. ['label' => "Opendistrib", 'options' => ['class' => 'header'], 'visible' => $isUserCurrentGrantedAsProducer],
  147. [
  148. 'label' => 'Mes factures',
  149. 'icon' => 'clone',
  150. 'url' => ['/producer-invoice/index'],
  151. 'visible' => $isUserCurrentGrantedAsProducer && Yii::$app->parameterBag->get('dolibarrApiKey'),
  152. 'active' => Yii::$app->controller->id == 'producer-invoice',
  153. ],
  154. ['label' => 'Tarifs & modules', 'icon' => 'euro', 'url' => ['/producer/billing'], 'visible' => $isUserCurrentGrantedAsProducer],
  155. [
  156. 'label' => 'Développement',
  157. 'icon' => 'code',
  158. 'url' => ['/development/index'],
  159. 'visible' => $isUserCurrentGrantedAsProducer,
  160. 'active' => Yii::$app->controller->id == 'development',
  161. 'template' => '<a href="{url}">{icon} {label}' . $newVersionOpendistribLabel . '</a>'
  162. ],
  163. ['label' => 'Administration', 'options' => ['class' => 'header'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  164. [
  165. 'label' => 'Tickets',
  166. 'icon' => 'comments',
  167. 'url' => ['support-admin/index'],
  168. 'visible' => $isUserCurrentGrantedAsAdministrator,
  169. 'template' => '<a href="{url}">{icon} {label}' . $countTicketsAdminUnreadLabel . '</a>'
  170. ],
  171. ['label' => 'Producteurs', 'icon' => 'th-list', 'url' => ['/producer-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  172. [
  173. 'label' => 'Statistiques',
  174. 'icon' => 'line-chart',
  175. 'url' => ['/stats-admin/matomo'],
  176. 'visible' => $isUserCurrentGrantedAsAdministrator,
  177. 'items' => [
  178. ['label' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  179. ['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats-admin/turnover'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  180. ['label' => 'Commandes clients', 'icon' => 'calendar', 'url' => ['/stats-admin/customer-orders'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  181. ],
  182. ],
  183. ['label' => 'Paramètres', 'icon' => 'cog', 'url' => ['/setting-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator && $featureChecker->isEnabled(Feature::ALIAS_SETTINGS)],
  184. ['label' => 'Fonctionnalités', 'icon' => 'flag', 'url' => ['/feature-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  185. ['label' => 'Tranches de prix', 'icon' => 'eur', 'url' => ['/producer-price-range-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  186. ['label' => 'Taxes', 'icon' => 'eur', 'url' => ['/tax-rate-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  187. ['label' => 'Communiquer', 'icon' => 'bullhorn', 'url' => ['/communicate-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  188. //['label' => 'Outils', 'options' => ['class' => 'header'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  189. //['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  190. //['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug'], 'visible' => $isUserCurrentGrantedAsAdministrator],
  191. ['label' => 'Login', 'url' => ['site/login'], 'visible' => !$userModule->isCurrentConnected()],
  192. ],
  193. ]
  194. ) ?>
  195. </section>
  196. </aside>