PageRenderTime 74ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/lms_debug/protected/views/dashboard/dashboard_09_june_2014.php

https://gitlab.com/badelal143/lms_debug
PHP | 457 lines | 404 code | 38 blank | 15 comment | 43 complexity | b7c4dab9d8cab086125f577469241016 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0, LGPL-2.0
  1. <script>
  2. $(function(){
  3. $("#loader").show();
  4. $("#myteamworkload").load('index.php?r=dashboard/myteamworkload',function (responseText, textStatus, XMLHttpRequest) {
  5. if (textStatus == "success") {
  6. $("#loader").hide();
  7. // all good!
  8. }
  9. if (textStatus == "error") {
  10. // oh noes!
  11. }
  12. });
  13. });
  14. </script><?php if(Yii::app()->session['isRenewalUser']=='yes'){
  15. @$this->redirect(array('dashboard/renewal'));
  16. }
  17. ?>
  18. <style>
  19. #fancybox-wrap{
  20. z-index:9999999 !important;
  21. }
  22. </style>
  23. <div class="rightSection">
  24. <div class="toolbarheaderContainer"> Dashboard
  25. <table border="0" cellspacing="0" cellpadding="0" class="toolbarheaderContainer_date">
  26. <?php $form=$this->beginWidget('CActiveForm',array(
  27. 'id'=>'dashboard_update',
  28. 'action'=> Yii::app()->createUrl('dashboard/dashboard'),
  29. ));
  30. ?>
  31. <tr>
  32. <td>Select Date :</td>
  33. <td>
  34. <?php
  35. $this->widget('zii.widgets.jui.CJuiDatePicker', array(
  36. 'name' => 'searchDashboard',
  37. 'id' => 'textfield2',
  38. 'value'=>''.@$_POST['searchDashboard']?stripslashes($_POST['searchDashboard']):'Select Date'.'',
  39. 'options' => array(
  40. // how to change the input format? see http://docs.jquery.com/UI/Datepicker/formatDate
  41. 'dateFormat'=>'dd-M-yy',
  42. // user will be able to change month and year
  43. 'changeMonth' => 'true',
  44. 'changeYear' => 'true',
  45. // speed at which the datepicker appears, time in ms or "slow", "normal" or "fast"
  46. 'duration'=>'fast',
  47. // animation effect, see http://docs.jquery.com/UI/Effects
  48. 'showAnim' =>'slide',
  49. ),
  50. 'htmlOptions' => array(
  51. 'maxlength' => '10', // textField maxlength
  52. 'class'=>'txtfield_calendericon_select',
  53. 'onclick'=>'javascript:this.value=""',
  54. 'onblur'=> 'this.value = ( this.value == "" ) ? "Select Date" : this.value;',
  55. ),
  56. ));
  57. ?>
  58. </td>
  59. <td><input name="image" type="image" img src="<?php echo Yii::app()->request->baseUrl;?>/images/go.png" border="none" class="go"/></td>
  60. </tr>
  61. <?php $this->endWidget(); ?>
  62. </table>
  63. <div class="cl"></div>
  64. </div>
  65. <script src="js/excanvas.js"></script>
  66. <?php
  67. $relationManager = $_SESSION['relationalManager'];
  68. $managerMemberId = implode(",",array_unique(@$relationManager));
  69. Yii::app()->getClientScript()->registerScriptFile(Yii::app()->baseUrl.'/js/fullcalendar.js');
  70. $todayTime = strtotime(date('d M Y'));
  71. /* $models = Yii::app()->db->createCommand("SELECT startDate, count(*) AS total,leadFollowupId FROM leadFollowup WHERE
  72. userId = '".@$_SESSION['id']."' AND STATUS = 'Pending' AND (actionType = 'Meeting' OR actionType = 'Follow Up') AND startDate = '".@$todayTime."' GROUP BY startDate DESC")->queryAll();*/
  73. /* $models = Yii::app()->db->createCommand("SELECT startDate, count(*) AS total,leadFollowupId FROM leadFollowup WHERE
  74. userId IN (".@$managerMemberId.") AND STATUS = 'Pending' AND (actionType = 'Meeting' OR actionType = 'Follow Up') AND startDate = '".@$todayTime."' GROUP BY startDate DESC")->queryAll();
  75. */
  76. $timbefore3days = strtotime('-3 days', time());
  77. $timafter3days = strtotime('+3 days', time());
  78. $models = Yii::app()->db->createCommand("SELECT startDate, count(*) AS total,leadFollowupId FROM leadFollowup WHERE
  79. userId IN (".@$managerMemberId.") AND STATUS = 'Pending' AND (actionType = 'Meeting' OR actionType = 'Follow Up') AND (startDate >= $timbefore3days and startDate <= $timafter3days ) GROUP BY startDate DESC")->queryAll();
  80. $meetingArray = array();
  81. for($i=0;$i<count($models);$i++){
  82. $meetingDate = @$models[$i]['startDate'];
  83. $totalCount = @$models[$i]['total'];
  84. $monthValue = date('m',@$models[$i]['startDate']);
  85. $meetingArray[$i]['totalCount'] = @$totalCount;
  86. $meetingArray[$i]['day'] = date('d',@$models[$i]['startDate']);
  87. $meetingArray[$i]['month'] = $monthValue-1;
  88. $meetingArray[$i]['year'] = date('Y',@$models[$i]['startDate']);
  89. $meetingArray[$i]['leadFollowupId'] = @$models[$i]['leadFollowupId'];
  90. //$meetingModels = LeadFollowup::model()->findAll(array("condition"=>"startDate = '".@$meetingDate."' AND userId = '".@$_SESSION['id']."' AND STATUS = 'Pending' AND (actionType = 'Meeting' OR actionType = 'Follow Up') ORDER BY hour DESC"));
  91. $meetingModels = LeadFollowup::model()->findAll(array("condition"=>"startDate = '".@$meetingDate."' AND userId IN(".@$managerMemberId.") AND STATUS = 'Pending' AND (actionType = 'Meeting' OR actionType = 'Follow Up') ORDER BY hour DESC"));
  92. $meetingArray[$i]['finalDescription'] = '';
  93. for($j=0;$j<count($meetingModels);$j++) {
  94. $srno = $j+1;
  95. $meetingArray[$i]['finalDescription'] = @$meetingDate;
  96. }
  97. }
  98. ?>
  99. <link href="<?php echo Yii::app()->request->baseUrl;?>/css/fullcalendar.css" rel="stylesheet" type="text/css" />
  100. <link href="<?php echo Yii::app()->request->baseUrl;?>/css/fullcalendar.print.css" rel="stylesheet" type="text/css" />
  101. <script>
  102. $(document).ready(function() {
  103. var date = new Date();
  104. var d = date.getDate();
  105. var m = date.getMonth();
  106. var y = date.getFullYear();
  107. //alert(y+'-'+m+'-'+d);
  108. $('#calendar').fullCalendar({
  109. theme: true,
  110. header: {
  111. left: 'prev today',
  112. center: 'title',
  113. right: 'next'
  114. },
  115. editable: true,
  116. events: [
  117. <?php
  118. $g=1;
  119. for($i=0;$i<count($meetingArray);$i++) { ?>
  120. {
  121. title: '<?php echo @$meetingArray[$i]['totalCount']?>',
  122. start: new Date(<?php echo @$meetingArray[$i]['year']?>, <?php echo @$meetingArray[$i]['month']?>, <?php echo @$meetingArray[$i]['day']?>, 0),
  123. allDay: false,
  124. rel: "myrel",
  125. 'class': 'class-link',
  126. url: '<?php echo Yii::app()->request->baseUrl;?>/index.php?r=leads/ViewCalenderActs&id=<?php echo $meetingArray[$i]['finalDescription']; ?>',
  127. }
  128. <?php if(count($meetingArray) > $g){
  129. echo ",";
  130. }
  131. $g++;
  132. } ?>
  133. ],
  134. eventClick : function(event) {
  135. //parent.$.fancybox.close();
  136. $.fancybox(
  137. {
  138. 'autoDimensions' : false,
  139. 'type' : 'iframe',
  140. 'href' : event.url,
  141. 'width' : 700,
  142. 'height' : 316,
  143. 'transitionIn' : 'none',
  144. 'transitionOut' : 'none',
  145. 'onClosed' : function(){
  146. $.fn.yiiGridView.update("acc-payment-recei-grid2");
  147. $.fn.yiiGridView.update("acc-payment-recei-grid4");
  148. }
  149. }
  150. );
  151. return false;
  152. }
  153. });
  154. });
  155. </script>
  156. <div class="opentaskside fl">
  157. <div class="fullcontainer">
  158. <p> Leads for Today</p>
  159. <?php if(isset($dataProviderc) && !empty($dataProviderc)) {
  160. $alert="Are you sure you want to Change Status? ";
  161. $this->widget('zii.widgets.grid.CGridView', array(
  162. 'id'=>'acc-payment-recei-grid11',
  163. 'htmlOptions' => array('class' => 'items'),
  164. 'ajaxUpdate'=>false,
  165. 'pager' => array(
  166. 'header' => '&nbsp;',
  167. 'prevPageLabel' => 'Prev',
  168. 'nextPageLabel' => 'Next',
  169. ),
  170. 'dataProvider'=>@$dataProviderc,
  171. 'columns'=>array(
  172. array( // display 'create_time' using an expression
  173. 'header'=>'',
  174. 'name'=>'getparent',
  175. 'value'=>function($data){
  176. $primary = LeadStatus::model()->findByPk($data['me_id']);
  177. if(@$primary['parentId'] > 0){
  178. $parentName = LeadStatus::model()->findByPk(@$primary['parentId']);
  179. @$pname=@$parentName['leadStatus'];
  180. } else {
  181. @$pname="Primary";
  182. }
  183. echo @$pname;
  184. },
  185. ), array( // display 'create_time' using an expression
  186. 'header'=>'',
  187. 'name'=>'child',
  188. 'value'=>'@$data[me_leadStatus]',
  189. ), array( // display 'create_time' using an expression
  190. 'header'=>'',
  191. 'name'=>'total',
  192. 'value'=>function($data){
  193. if(strlen(@$data['total'])==1){ $resd = "00".@$data['total']; } else if(strlen(@$data['total'])==2){ $resd= "0".@$data['total']; } else { $resd= @$data['total']; }
  194. echo '<span class="followBox"><a href="'.Yii::app()->createUrl('dashboard/ViewLeadSummaryData',array('leadStatusId'=>$data['me_id'])).'" class=" class-link" style="color:#FFFFFF; text-decoration:none;cursor:pointer;">'.@$resd.'</a></span>';
  195. },
  196. ),
  197. ),
  198. ));
  199. }
  200. ?>
  201. </div>
  202. <div id="myteamworkload">
  203. <p>My Team (Workload)</p>
  204. <div id="loaderteam"><img src="images/loading.gif" height="30" width="30" /></div>
  205. </div>
  206. <div class="fullcontainer">
  207. <p>Speedometer</p>
  208. <?php $form=$this->beginWidget('CActiveForm',array(
  209. 'id'=>'speedometer',
  210. 'action'=>Yii::app()->createUrl('dashboard/dashboard'),
  211. 'htmlOptions'=>array(
  212. 'name'=>'speedometer_form'
  213. )
  214. ));
  215. ?>
  216. <div class="dropdownBoxdash fr mrgnDropbox">
  217. <select class="styled" name="speedmeterUser" onchange="this.form.submit();">
  218. <option value="">Select User</option>
  219. <?php if(count($managerDetailsArr) > 0 && isset($managerDetailsArr) && !empty($managerDetailsArr)){
  220. foreach($managerDetailsArr as $key=>$value){
  221. ?>
  222. <option value="<?php echo @$value['id']; ?>" <?php if(@$_REQUEST['speedmeterUser']==@$value['id']) { echo "selected"; } ?>><?php echo @$value['firstName']."&nbsp;".@$value['lastName']; ?></option>
  223. <?php }
  224. } ?>
  225. </select>
  226. </div>
  227. <?php $this->endWidget();
  228. $totalClosedAmount=intval(@$totalAmountOfSpeedometer[0]['totalAmount']);
  229. if($totalClosedAmount > 1000000){
  230. $totalClosedAmount=1000000;
  231. }
  232. $totalclosedAmount=1000000;
  233. if($totalClosedAmount > 0){
  234. $totalClosedAmount = $totalClosedAmount;
  235. } else {
  236. $totalClosedAmount = 1;
  237. }
  238. $chartAmount=intval($totalclosedAmount-$totalClosedAmount);
  239. ?>
  240. <div class="barnotation">
  241. <div class="barnotationheading"><span class="followBoxDashboard" style="background-color:#FFFF01;">&nbsp;</span>&nbsp;Close Lead Amount (<?php if($totalClosedAmount=='1') { echo 0; } else { echo @$totalClosedAmount; } ?>) </div>
  242. <div class="barnotationheading"><span class="followBoxDashboard" style="background-color:#4D4D4D;">&nbsp;</span>&nbsp;Target 10 Lakh </div>
  243. </div>
  244. <?php
  245. $graphbg = Yii::app()->image->createUrl('images',YiiBase::getPathOfAlias('webroot.images').'/graphBg.png');
  246. ?>
  247. <div class="dashboardBox" style="background:url(<?php echo $graphbg;?>) center center no-repeat;">
  248. <?php
  249. $this->widget(
  250. 'chartjs.widgets.ChPie',
  251. array(
  252. 'width' => 400,
  253. 'height' => 189,
  254. 'datasets' => array(
  255. array(
  256. 'value'=>$totalClosedAmount,
  257. 'color'=>'#FFFF01',
  258. ),
  259. array(
  260. 'value'=>$chartAmount,
  261. 'color'=>'#4d4d4d',
  262. ),
  263. ),
  264. 'options' => array('centerTop'=>830, // Distance from widget's left side to the center of pie chart
  265. 'centerLeft'=>130, // Distance from widget's top side to the center of pie chart
  266. 'radius'=>100)
  267. )
  268. );
  269. ?>
  270. <span class="fr">
  271. </span>
  272. </div>
  273. </div>
  274. </div>
  275. <?php $form=$this->beginWidget('CActiveForm',array(
  276. 'id'=>'add_plan_type',
  277. 'action'=>'',
  278. 'htmlOptions'=>array(
  279. 'name'=>'plan_type_form'
  280. )
  281. ));
  282. ?>
  283. <div class="opentaskside fr">
  284. <div class="formHeadContainerrght">
  285. <h1>Meetings/Followups</h1>
  286. </div>
  287. <div class="formBox">
  288. <div class="formBoxScrollrght">
  289. <div id='calendar'></div>
  290. <div>
  291. <?php echo CHtml::link('View All Calenders Follow-Up/Call-later',array('dashboard/fullcalender'),array('style'=>'color:#545454;font:13px Calibri,Helvetica Neue,Tahoma,sans-serif;','target'=>'_blank'));?>
  292. </div>
  293. </div>
  294. </div>
  295. <div class="fullcontainer">
  296. <p>Performance</p>
  297. <table cellspacing="0" cellpadding="0" class="items">
  298. <tr>
  299. <th>Team Member</th>
  300. <th>Closures</th>
  301. <th>Amount</th>
  302. <th>Detalis</th>
  303. </tr>
  304. <?php
  305. if(count($managerDetailsArr) > 0 && isset($managerDetailsArr) && !empty($managerDetailsArr)){
  306. $start = 1;
  307. foreach($managerDetailsArr as $key=>$value){
  308. if($start <= 10){
  309. $closeLeads=Lead::model()->closeLeads($value['id']);
  310. $totalAmount=Lead::model()->closedLeadsAmount($value['id']);
  311. ?>
  312. <tr>
  313. <td><?php echo @$value['firstName']."&nbsp;".@$value['lastName']; ?></td>
  314. <td><?php echo $closeLeads; ?></td>
  315. <td><?php echo $totalAmount[0]['totalAmount']?$totalAmount[0]['totalAmount']:0; ?></td>
  316. <td><?php echo CHtml::link('View', Yii::app()->createUrl('dashboard/ViewFancyboxData',array('id'=>$value['id'])), array('class' => 'viewNav class-link')); ?></td>
  317. </tr>
  318. <?php }
  319. $start++;
  320. }
  321. } else { ?>
  322. <tr><td colspan="4">No Records Found</td></tr>
  323. <?php } if(count($managerDetailsArr) > 10){ ?>
  324. <tr>
  325. <td colspan="4" align="right" style="text-align:right;"><a style="color:#545454; text-decoration:none;cursor:pointer;" href="<?php echo Yii::app()->createUrl('dashboard/ViewAllPerformanceData'); ?>" rel="myrel" class="class-link">View All</a></td>
  326. </tr>
  327. <?php } ?>
  328. </table>
  329. </div>
  330. <div class="fullcontainer">
  331. <p>Announcements</p>
  332. <table cellspacing="0" cellpadding="0" class="items">
  333. <?php
  334. if(count(@$notifications)>0 && isset($notifications) && !empty($notifications)){
  335. foreach(@$notifications as $key2=>$value2){
  336. if($notifications[$key2]['type']=='TEXT'){
  337. if($notifications[$key2]['description']!=''){
  338. $data=str_replace("<p>","",$notifications[$key2]['description']);
  339. $data=str_replace("</p>","",$data);
  340. ?>
  341. <tr>
  342. <td><?php echo stripslashes(@$data); ?></td>
  343. </tr>
  344. <?php } }
  345. }
  346. } else {
  347. ?>
  348. <tr>
  349. <td>No Data Available</td>
  350. </tr>
  351. <?php
  352. }
  353. ?>
  354. </table>
  355. </div>
  356. <div class="fullcontainer" style="display:none;">
  357. <p>Activity</p>
  358. <div class="formBox">
  359. <div class="formBoxScroll">
  360. <?php
  361. $activationrelationManager = $_SESSION['relationalManager'];
  362. $activationmanagerMemberId = implode(",",array_unique(@$activationrelationManager));
  363. $dataProvider=new CActiveDataProvider('LeadFollowup', array('criteria'=>array(
  364. 'condition'=>"userId = '".@$_SESSION['id']."' AND STATUS = 'Pending'",
  365. 'order'=>'leadFollowupId DESC',
  366. )));
  367. $alert="Are you sure you want to Change Status? ";
  368. $this->widget('zii.widgets.grid.CGridView', array(
  369. 'id'=>'acc-payment-recei-grid2',
  370. 'htmlOptions' => array('class' => 'items'),
  371. 'ajaxUpdate'=>true,
  372. 'enableSorting'=>true,
  373. 'enablePagination' => true,
  374. 'pager' => array(
  375. 'header' => '&nbsp;',
  376. 'prevPageLabel' => 'Prev',
  377. 'nextPageLabel' => 'Next',
  378. ),
  379. 'dataProvider'=>$dataProvider,
  380. 'columns'=>array(
  381. array( // display 'create_time' using an expression
  382. 'name'=>'Date',
  383. 'value'=>'Yii::app()->dateFormatter->format("d MMM y",$data->createdOn)',
  384. ),
  385. array( // display 'create_time' using an expression
  386. 'name'=>'Mobile',
  387. 'value'=>'@$data->leadDetails->mobile',
  388. ),
  389. array( // display 'create_time' using an expression
  390. 'name'=>'Description',
  391. 'type'=>'raw',
  392. 'value'=>'CHtml::link(substr($data->description,0,15),Yii::app()->createUrl("leads/ViewLeadActivity",array("id"=>$data->leadFollowupId)),array("title"=>"","class"=>"class-link","rel"=>"myrel"))',
  393. ),
  394. array( // display 'create_time' using an expression
  395. 'header'=>'Edit',
  396. 'type'=>'raw',
  397. 'visible'=>'0',
  398. 'value'=>'CHtml::link(substr("Edit",0,15),Yii::app()->createUrl("leads/leads_details",array("actionId"=>$data->leadFollowupId,"leadId"=>$data->leadId)),array("title"=>"Edit Details"))',
  399. ),
  400. ),
  401. ));
  402. ?>
  403. </div>
  404. </div>
  405. </div>
  406. </div>
  407. <?php
  408. if(count($notifications)>0 && isset($notifications) && !empty($notifications)){
  409. foreach($notifications as $key2=>$value2){
  410. if($notifications[$key2]['type']=='BANNER'){
  411. if(@$notifications[$key2]['banner']!=''){
  412. ?>
  413. <div class="footerBanner fl" style="text-align:left !important;"><img src="<?php echo Yii::app()->request->baseUrl;?>/siteupload/<?php echo @$notifications[$key2]['banner']; ?>" width="529" height="63" /></div>
  414. <?php }
  415. }
  416. } } else { ?> <?php } ?>
  417. <?php $this->endWidget(); ?>
  418. <div class="cl"></div>
  419. </div>