Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 112.13 KB | None | 0 0
  1. <?php
  2. namespace CompleteSolar\HelioTrack\Views;
  3. use CompleteSolar\HelioTrack\Controllers\JobStateController;
  4. use CompleteSolar\HelioTrack\Models\HtDB;
  5. use CompleteSolar\HelioTrack\Models\State;
  6. use CompleteSolar\HelioTrack\Utilities\Substates;
  7. use CompleteSolar\HelioTrack\Utilities\Actions;
  8. use CompleteSolar\MVC\Html\Script;
  9. use CompleteSolar\MVC\Html\Style;
  10. use CompleteSolar\HelioTrack\Commission\Controllers\JobCommissionController;
  11. use CompleteSolar\HelioTrack\Utilities\JobCommissionTypes;
  12. use CompleteSolar\HelioTrack\Models\Job;
  13. use CompleteSolar\HelioTrack\Utilities\JobFields;
  14. use CompleteSolar\HelioTrack\Utilities\JobInfoFields;
  15. use CompleteSolar\HelioTrack\Utilities\JobInstallationStatus;
  16.  
  17. //includes that only pertain to the updateCommissionAnd Discounts method
  18. use CompleteSolar\HelioTrack\Utilities\JobInfo;
  19.  
  20. class JobStateView extends BaseView{
  21.     protected $state;
  22.     protected $subState;
  23.     protected $siteTechSubmitJob= false;
  24.     protected $action;
  25.     public $job;
  26.  
  27.     public function __construct($controller, $job){
  28.         parent::__construct($controller);
  29.         date_default_timezone_set('America/Los_Angeles');
  30.         $this->job = $job;
  31.     }
  32.  
  33.     public function getJobFields(){
  34.         return $this->controller->getJobFields();
  35.     }
  36.  
  37.     public function init(){
  38.     }
  39.  
  40.     public function setScripts($imports=array()) {
  41.         $imports[] = $this->createScript("js/plugins/datetimepicker-master/jquery.datetimepicker.js");
  42.         $imports[] = $this->createScript("js/jquery.numeric.js");
  43.         MustacheTemplateViews::assignJobToInstallerModalTemplate();
  44.         MustacheTemplateViews::jobCommentTemplate();
  45.         $imports[] = $this->createScript($this->getFrontEndFile("js/jobs.js"));
  46.         parent::setScripts($imports);
  47.     }
  48.     static public function createView($controller, $job){
  49.         $jobStateName = null;
  50.         $jobSubStateName = null;
  51.         if($controller != null){
  52.             $jobInfo = $controller->getJobInfo();
  53.             if($jobInfo != null){
  54.                 $jobStateName = $jobInfo->jobStateName;
  55.                 $jobSubStateName = $jobInfo->jobSubStateName;
  56.             }
  57.         }
  58.         if($jobStateName == State::OPEN){
  59.             if($jobSubStateName == Substates::ITEMS_MISSING){
  60.                 return new JobItemsMissingStateView($controller, $job);
  61.             }
  62.             return new JobOpenStateView($controller, $job);
  63.         }else if($jobStateName == State::WAITING){
  64.             return new JobWaitingStateView($controller, $job);
  65.         }else if($jobStateName == State::PENDING){
  66.             return new JobPendingStateView($controller, $job);
  67.         }else if($jobStateName == State::SITE_TECH_REQUIRED){
  68.             return new JobSiteTechRequiredStateView($controller, $job);
  69.         }else if($jobStateName == State::APPROVED){
  70.             if($jobSubStateName == Substates::JOB_IN_JEOPARDY){
  71.                 return new JobInJeopardySubstateView($controller, $job);
  72.             }else if($jobSubStateName == Substates::PIP_PENDING){
  73.                 return new JobPipPendingSubstateView($controller, $job);
  74.             }else if($jobSubStateName == Substates::PIP_APPROVED){
  75.                 return new JobPipApprovedSubstateView($controller, $job);
  76.             }else if($jobSubStateName == Substates::PIP_ITEMS_MISSING){
  77.                 return new JobPipItemsMissingSubstateView($controller, $job);
  78.             }
  79.             return new JobApprovedStateView($controller, $job);
  80.         }else if($jobStateName == State::INSTALL_COMPLETE){
  81.             return new JobFWTStateView($controller, $job);
  82.         }else {
  83.             return new JobStateView($controller, $job);
  84.         }
  85.     }
  86.  
  87.     public function getSiteTechSubmitJob(){
  88.         return $this->siteTechSubmitJob;
  89.     }
  90.  
  91.     public function setAction($action){
  92.         $this->action = $action;
  93.     }
  94.  
  95.  
  96.     public function process($submitType, $data){
  97.         if ($submitType == Actions::SAVE){
  98.             $this->processSave($data);
  99.         }else if ($submitType == Actions::SUBMIT){
  100.             $this->processSubmit($data);
  101.         }else if ($submitType == Actions::REQUEST_SITE_TECH ){
  102.             $this->processRequestSiteTech($data);
  103.         }else if($submitType == Actions::OPEN_JOB_SUBMISSION){
  104.             $this->processOpenJobSubmission($data);
  105.         }else if($submitType == Actions::APPROVE){
  106.             $this->processApprove($data);
  107.         }else if($submitType == Actions::JOB_IN_JEOPARDY){
  108.             $this->processJobInJeopardy($data);
  109.         }else if($submitType == Actions::ITEMS_MISSING){
  110.             $this->processItemsMissing($data);
  111.         }else if($submitType == Actions::REOPEN){
  112.             if(isset($data["fwt_date"])){
  113.                 //we need to clear FWT date when reopening a job
  114.                 $data["fwt_date"] = null;
  115.             }
  116.             $this->processReopen($data);
  117.  
  118.         }else if($submitType == Actions::INSTALL_COMPLETE){
  119.             $this->processFWT($data);
  120.         }else if($submitType == Actions::PIP_SUBMIT){
  121.             $this->processPipSubmit($data);
  122.         }else if($submitType == Actions::PIP_APPROVE){
  123.             $this->processPipApprove($data);
  124.         }else if($submitType == Actions::PIP_ITEMS_MISSING){
  125.             $this->processPipItemsMissing($data);
  126.         }
  127.     }
  128.     public function processSave($data){
  129.         if($this->okToExecuteSave()){
  130.             $this->controller->updateJob($data);
  131.             $this->controller->processSave();
  132.         }else{
  133.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  134.             exit(0);
  135.         }
  136.     }
  137.  
  138.     public function processSubmit($data=[]){
  139.         if($this->okToExecuteSubmit()){
  140.             $this->controller->updateJob($data);
  141.             $this->controller->processSubmit();
  142.         }else{
  143.             $jobInfo = $this->controller->getJobInfo();
  144.             header("Location: job.php?action=dispmsg&msg=invalidAction&&jobID=$jobInfo->jobId");
  145.             exit(0);
  146.         }
  147.     }
  148.  
  149.     public function processRequestSiteTech($data){
  150.         if($this->okToExecuteRequestSiteTech()){
  151.             $this->controller->updateJob($data);
  152.             $this->controller->processRequestSiteTech();
  153.         }else{
  154.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  155.             exit(0);
  156.         }
  157.     }
  158.  
  159.     public function processOpenJobSubmission($data){
  160.         if($this->okToExecuteOpenJobSubmission()){
  161.             $this->controller->updateJob($data);
  162.             $this->controller->processOpenJobSubmission();
  163.         }else{
  164.             $result = array();
  165.             $result['status']= "FAIL";
  166.             $result['error']= "invalid action";
  167.             echo json_encode($result);
  168.             exit(0);
  169.         }
  170.     }
  171.  
  172.     public function processApprove($data){
  173.         if($this->okToExecuteApprove()){
  174.             $this->controller->updateJob($data);
  175.             $this->controller->processApprove();
  176.         }else{
  177.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  178.             exit(0);
  179.         }
  180.     }
  181.  
  182.     public function processJobInJeopardy($data){
  183.         if($this->okToExecuteJobInJeopardy()){
  184.             $this->controller->updateJob($data);
  185.             $this->controller->processJobInJeopardy();
  186.         }else{
  187.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  188.             exit(0);
  189.         }
  190.     }
  191.  
  192.     public function processItemsMissing($data){
  193.         if($this->okToExecuteItemsMissing()){
  194.             $this->controller->updateJob($data);
  195.             $this->controller->processItemsMissing();
  196.         }else{
  197.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  198.             exit(0);
  199.         }
  200.     }
  201.  
  202.     public function processReopen($data){
  203.         if($this->okToExecuteReopen()){
  204.             $this->controller->updateJob($data);
  205.             $this->controller->processReopen();
  206.         }else{
  207.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  208.             exit(0);
  209.         }
  210.     }
  211.  
  212.  
  213.     public function processFWT($data){
  214.         if($this->okToExecuteFWT()){
  215.             $this->controller->updateJob($data);
  216.             $this->controller->processFWT();
  217.         }else{
  218.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  219.             exit(0);
  220.         }
  221.     }
  222.  
  223.     public function processPipSubmit($data){
  224.         if($this->okToExecutePipSubmit()){
  225.             $this->controller->updateJob($data);
  226.             $this->controller->processPipSubmit();
  227.         }else{
  228.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  229.             exit(0);
  230.         }
  231.     }
  232.  
  233.     public function processPipApprove($data){
  234.         if($this->okToExecutePipApprove()){
  235.             $this->controller->updateJob($data);
  236.             $this->controller->processPipApprove();
  237.         }else{
  238.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  239.             exit(0);
  240.         }
  241.     }
  242.  
  243.     public function processPipItemsMissing($data){
  244.         if($this->okToExecutePipItemsMissing()){
  245.             $this->controller->updateJob($data);
  246.             $this->controller->processPipItemsMissing();
  247.         }else{
  248.             header("Location: job.php?action=dispmsg&msg=invalidAction");
  249.             exit(0);
  250.         }
  251.     }
  252.  
  253.     public function addDiscountToJob($desc, $amount){
  254.         $this->controller->addDiscountToJob($desc, $amount);
  255.     }
  256.  
  257.     public function updateJobFields($data){
  258.         $this->controller->updateJobFields($data);
  259.     }
  260.  
  261.  
  262.  
  263.     //##########################
  264.     //##          HTML        ##
  265.     //##########################
  266.  
  267.     public function displayJob(){
  268.         if(!$this->controller->canUserViewJob()){
  269.             echo "User not authorized to view this job";
  270.             exit(0);
  271.         }
  272.         $this->setHead();
  273.  
  274.         //header-specific
  275.         $this->startBody("job-page");
  276.         $this->displayHeader();
  277.  
  278.         $this->startContainer();
  279.  
  280.         //echo "<br /><br /><br /> <pre>"; print_r($this->job);  echo "</pre>";
  281.  
  282.         //page-specific
  283.         $this->displayPageHeading();
  284.         $this->startForm();
  285.         $this->printHiddenItems();
  286.         $this->printJobInfoSection();
  287.         if($this->canViewCommissionSection()){
  288.           $this->printCommissionSection();
  289.         }
  290.  
  291.         $this->printSections($this->job->fields);
  292.         $this->printHistorySection();
  293.         echo "<div class=\" container end-buttons\"><div class=\"row\">"; $this->printButtons(false); echo "</div></div>";
  294.  
  295.         $this->endForm();
  296.         $this->displayOtherModule();
  297.         $this->displayOtherInverter();
  298.         $this->endContainer();
  299.         $this->displayFooter();
  300.         $this->setScripts();
  301.         $this->endBody();
  302.     }
  303.  
  304.     //##########################
  305.     // Section HTML Functions ##
  306.     //##########################
  307.  
  308.     public function printHiddenItems() {
  309.         $this->printHiddenItem("jobID", $this->job->id);
  310.         $this->printHiddenItem("jobTypeID", $this->job->jobTypeId->id);
  311.         $this->printHiddenItem("jobStateID", $this->job->jobStateId->id);
  312.         $this->printHiddenItem("opfError", null);
  313.         $this->printHiddenItem("job_system_size", $this->job->systemSize);
  314.         $this->printHiddenItem("job_solar_expert", $this->job->solarExpertId->id);
  315.         $this->printHiddenItem("submitType", "");
  316.     }
  317.  
  318.     public function displayMsg($msg) {
  319.         $this->setHead();
  320.         $this->startBody("job-page");
  321.         $this->displayHeader();
  322.         $this->startContainer();
  323.     ?>
  324.         <div class="container msg-error-div">
  325.             <span>Alert</span>
  326.         </div>
  327.         <div class="container msg-text-div">
  328.             <span><?= $msg ?></span>
  329.         </div>
  330.     <?php
  331.         $this->endContainer();
  332.         $this->displayFooter();
  333.         $this->endBody();
  334.     }
  335.  
  336.     public function displayPageHeading() {
  337.  
  338.     ?>
  339.         <div class="container header-container">
  340.             <div class="row header-title-row">
  341.                 <span class="status-title-text">Job Status:
  342.                 <?php
  343.                 if($this->controller->jobLocked()){
  344.                     echo "[Locked]";
  345.                 }else if($this->controller->jobINFWT()){
  346.                     echo "[FWT]";
  347.                 }
  348.                 ?>
  349.                 </span>
  350.             </div>
  351.             <div class="row header-status-row">
  352.                 <span><?= $this->printState() ?></span>
  353.             </div>
  354.             <div class="pending-state-history" style="text-align: center">
  355.                 <?php $this->printStateHistory() ?>
  356.             </div>
  357.         </div>
  358.     <?php
  359.     }
  360.  
  361.     public function startForm() {
  362.     ?>
  363.         <form id="htform" method="POST" action="<?php echo $this->controller->getHTDomain();?>job.php?action=submit" enctype="multipart/form-data">
  364.     <?php
  365.     }
  366.  
  367.     public function endForm() {
  368.     ?>
  369.         </form>
  370.     <?php
  371.     }
  372.  
  373.     public function printSections($fields) {
  374.         foreach($fields as $field) {
  375.            $this->printSection($field, 0);
  376.         }
  377.     }
  378.  
  379.     public function setApproved($field) {
  380.         $status;
  381.         $approved;
  382.         if ($field->needsApproval) {
  383.             if (isset($field->jobData->approved) && $field->jobData->approved == 1) {
  384.                 $status = "complete";
  385.                 $approved = 2;
  386.             } else {
  387.                 $approved = 1;
  388.                 if (isset($field->documents) && (count($field->documents) > 0)) {
  389.                     $status="info";
  390.                 } else {
  391.                     $status = "doc";
  392.                 }
  393.             }
  394.  
  395.         } else {
  396.             $approved = 0;
  397.             if ($field->controlType->id == 3) {
  398.                 if (isset($field->documents) && (count($field->documents) > 0)) {
  399.                     $status = "info";
  400.                 } else {
  401.                     $status = "doc";
  402.                 }
  403.             } else {
  404.                 $status = "info";
  405.             }
  406.         }
  407.         return array("status" => $status, "approved" => $approved);
  408.     }
  409.  
  410.     public function canComment($field) {
  411.         $messageBox;
  412.         if ($field->canComment || $field->id == 153) {
  413.             if (isset($field->jobData->comments) && count($field->jobData->comments) > 0) {
  414.                 $messageBox = 2;
  415.             } else {
  416.                 $messageBox = 1;
  417.             }
  418.         } else {
  419.             $messageBox = 0;
  420.         }
  421.         return $messageBox;
  422.     }
  423.  
  424.     public function canUseCheckbox() {
  425.         return $this->canUpdateFieldStatus() ? "enabled" : "disabled";
  426.     }
  427.  
  428.     public function isInFwt() {
  429.         return ($this->job->jobStateId->id == 5) ? false : true;
  430.     }
  431.  
  432.     public function printSection($field, $level=0) {
  433.         $jobFields = $this->getJobFields();
  434.         if(!$jobFields->canViewField($field->id)){
  435.            return;
  436.         }
  437.         $id = $field->id;
  438.         $parentId = (isset($field->parentId)) ? $field->parentId : null;
  439.         $title = $field->name;
  440.         $fieldType = strtolower($field->controlType->name);
  441.         if ($field->controlType->id == 8 || $field->controlType->id == 10) { return true; }
  442.         $topLevel = ($level == 0);
  443.         $endpointInputTypes = array(1,2,4,5,7,"1","2","4","5","7");
  444.         $jobComments = (isset($field->jobData->comments)) ? $field->jobData->comments : null;
  445.         $messageBox = $this->canComment($field);
  446.         $approval = $this->setApproved($field);
  447.         $approved = $approval["approved"];
  448.         $status = $approval["status"];
  449.  
  450.         if (count($field->fields) > 0 && count($field->documents) == 0) {
  451.             $childCount = 0;
  452.             $docCount = 0;
  453.             foreach ($field->fields as $child) {
  454.                 $childStatus = $this->setApproved($child);
  455.                 if ($child->controlType->id == 3) {
  456.                     $childCount++;
  457.                     if ($childStatus["status"] == "doc") {
  458.                         $docCount++;
  459.                     }
  460.                 }
  461.             }
  462.             if ($childCount == $docCount) {
  463.                 $status = "doc";
  464.             }
  465.         }
  466. ?>
  467.         <div class="auto-save">
  468. <?php
  469.         if ($topLevel) {
  470.             $this->openSection($id, $level, $fieldType, $status, $approved, $messageBox, $field->id == 20);
  471.             $this->insertHeading($id, $level, $title, $status, $approved, $messageBox, $field->id == 20, $field->canDownloadAll);
  472.             if ($messageBox > 0) {
  473.                 $this->printCommentSection($id, "top", $jobComments, $status);
  474.             }
  475.             $this->openSectionBody($title, $field->id == 20);
  476.         } else {
  477.             if (in_array($field->controlType->id, $endpointInputTypes)) {
  478.                 $this->printItem($field, $approved);
  479.             } else {
  480.                 $this->openSubsection($id, $level, $status, $parentId);
  481.                 $this->printSubsectionHeading($id, $level, $title, $status, $approved, $messageBox, false, $field);
  482.                 if ($messageBox > 0) {
  483.                     $show = ($field->name == "General Comments");
  484.                     $this->printCommentSection($id, "sub", $jobComments, $status, $show);
  485.                 }
  486.                 $this->openSubsectionItemList($id, $level, $status, $title, $messageBox, $jobComments);
  487.             }
  488.         }
  489.         if ($fieldType == "file") {
  490.             $this->printDocumentSubsection($id, $field->documents);
  491.         }
  492.         foreach ($field->fields as $subField) {
  493.             $this->printSection($subField, $level + 1);
  494.         }
  495.         if (!$topLevel) {
  496.             if (in_array($field->controlType->id, $endpointInputTypes)) {
  497.             } else {
  498.                 $this->closeSubsectionItemList();
  499.                 $this->closeSubsection();
  500.             }
  501.         } else {
  502.             if($field->name == "Job In Jeopardy"){
  503.                 $this->printJobInJeopardyContainer();
  504.             }
  505.             $this->closeSectionBody();
  506.             $this->closeSection();
  507.         }
  508. ?>
  509.         </div>
  510. <?php
  511.     }
  512.  
  513.     public function printJobInfoSection() {
  514.         $this->openSection("jobinfo-section", 0, "section", "info", 0, null, true);
  515.         $this->insertHeading("jobinfo-section", 0, "Job Information", "info", 0, null, true);
  516.         $this->openSectionBody("jobinfo", true);
  517.         $this->printJobInfoSectionCells();
  518.         $this->closeSectionBody();
  519.         $this->closeSection();
  520.     }
  521.  
  522.     public function printCommissionSection() {
  523.         $commissionField = $this->job->getFieldById(154);
  524.         $messageBox = 0;
  525.         if ($commissionField->canComment) {
  526.             $messageBox = (isset($commissionField->jobData->comments) &&
  527.                            count($commissionField->jobData->comments) > 0) ? 2 : 1;
  528.         }
  529.  
  530.         $commissionController = new JobCommissionController($this->controller->getLoggedInUser(), $this->job->id);
  531.         $this->openSection($commissionField->id, 0, "section", "info", $messageBox, true, true);
  532.         $this->insertHeading(154, 0, "Commission & Discounts", "info", 0, $messageBox, true);
  533.         $commentArray = (isset($commissionField->jobData->comments)) ? $commissionField->jobData->comments : array();
  534.         $this->printCommentSection(154, "top", $commentArray, "info", false);
  535.         $this->openSectionBody("commission", true);
  536.         if($this->canViewSolarExpertCommissionSection()){
  537.             $this->openSection("solarExpert", 1, "section", "info", 0, 1);
  538.             $this->printSubsectionHeading("solarExpert", 1, "Solar Experts", "info", 0, null);
  539.             $this->openSubsectionItemList(null, 1, "info", "commission", 0);
  540.             $this->printCommissionSectionTopInfo($commissionController);
  541.  
  542.             foreach ($this->job->commission->solarExpertCommissionList as $com) {
  543.                 $this->printCommissionTable($com);
  544.             }
  545.             if($this->canViewDiscounts()){
  546.                 $this->openSection("jobDiscounts", 1, "section", "info", 0, 1);
  547.                 $this->printSubsectionHeading("jobDiscounts", 1, "Discounts, Rebates & Commission Adjustments", "info", 0, null);
  548.                 $this->openSubsectionItemList(null, 1, "info", "commission", 0);
  549.                 $commissionAdjustments = $commissionController->getJobDiscounts($this->job->id);
  550.                 $this->printCommissionAdjustments($commissionAdjustments);
  551.                 $this->closeSubsectionItemList();
  552.                 $this->closeSection();
  553.             }
  554.             $this->closeSubsectionItemList();
  555.             $this->closeSection();
  556.         }
  557.         if($this->canViewInstallerCommissionSection($this->job->id)){
  558.             $this->openSection("installer", 1, "section", "info", 0, 1);
  559.             $this->printSubsectionHeading("Installer", 1, "Installers", "info", 0, null);
  560.             $this->openSubsectionItemList(null, 1, "info", "commission", 0);
  561.  
  562.             foreach($this->job->commission->installerCommissionList as $com){
  563.                 $this->printInstallerCommissionTable($com);
  564.             }
  565.             if($this->canViewInstallerDiscounts($this->job->id)){
  566.                 $this->openSection("installerDiscounts", 1, "section", "info", 0, 1);
  567.                 $this->printSubsectionHeading("installerDiscounts", 1, "Installer Discounts", "info", 0, null);
  568.                 $this->openSubsectionItemList(null, 1, "info", "commission", 0);
  569.                 $commissionAdjustments = $commissionController->getInstallerJobDiscounts($this->job->id);
  570.                 $this->printInstallerCommissionAdjustments($commissionAdjustments);
  571.                 $this->closeSubsectionItemList();
  572.                 $this->closeSection();
  573.             }
  574.             $this->closeSubsectionItemList();
  575.             $this->closeSection();
  576.         }
  577.         $this->closeSectionBody();
  578.         $this->closeSection();
  579.     }
  580.  
  581.     public function printHistorySection() {
  582.         $this->openSection("history-section", 0, "section", "info", 0, false);
  583.         $this->insertHeading("history-section", 0, "State Change History", "info", 0, 0);
  584.         $this->openSectionBody("history");
  585.         $this->printHistorySectionBody();
  586.         $this->printHistorySectionBodyMobile();
  587.         $this->closeSectionBody();
  588.         $this->closeSection();
  589.     }
  590.  
  591.     public function printJobInfoSectionBody($section) {
  592.         $sectionClass = strtolower(str_replace(" ", "_", $section));;
  593.         $this->printJobInfoSectionCells();
  594.     }
  595.     public function printJobInfoSectionCells() {
  596.         $restrictions = $this->controller->getJobInfoRestrictions($this->job->jobTypeId->id);
  597.         $cellInfo;
  598.         $cellInfo1;
  599.         $restriction;
  600.  
  601.         $this->openJobInfoColumn();
  602.         $this->printJobInfoHeader('Customer');
  603.  
  604.         $restrictionFirst = isset($restrictions["first_name"])? $restrictions["first_name"]: null;
  605.         $restrictionLast = isset($restrictions["last_name"])? $restrictions["last_name"]: null;
  606.         $this->printJobInfoNameFields([
  607.           ['title' => 'First Name', 'name' => 'customer_first_name', 'value' => $this->job->firstname, 'restriction' => $restrictionFirst, 'editable' => $this->canEditJobField(JobInfoFields::FIRST_NAME, $restrictionFirst)],
  608.           ['title' => 'Last Name', 'name' => 'customer_last_name', 'value' => $this->job->lastname, 'restriction' => $restrictionLast, 'editable' => $this->canEditJobField(JobInfoFields::LAST_NAME, $restrictionLast)]
  609.         ]);
  610.  
  611.         $cellData = array("id" => "", "val" => $this->job->street);
  612.         $restriction = isset($restrictions["street"])? $restrictions["street"]: null;
  613.         $this->printJobInfoSectionCellData(1, "Street", "customer_street_address", $cellData, null, $restriction, $this->canEditJobField("street", $restriction));
  614.  
  615.         $restrictionCity = isset($restrictions["city"])? $restrictions["city"]: null;
  616.         $restrictionState = isset($restrictions["state"])? $restrictions["state"]: null;
  617.         $restrictionZip = isset($restrictions["zip"])? $restrictions["zip"]: null;
  618.         $this->printJobInfoAddressFields([
  619.           ['title' => 'City', 'name' => 'customer_city', 'value' => $this->job->city, 'restriction' => $restrictionCity, 'editable' => $this->canEditJobField("city", $restrictionCity)],
  620.           ['title' => 'State', 'name' => 'customer_state', 'value' => $this->job->state, 'restriction' => $restrictionState, 'editable' => $this->canEditJobField("state", $restrictionState)],
  621.           ['title' => 'Zip', 'name' => 'customer_zip', 'value' => $this->job->zip, 'restriction' => $restrictionZip, 'editable' => $this->canEditJobField("zip", $restrictionZip)]
  622.         ]);
  623.  
  624.  
  625.         $cellInfo = (isset($this->job->email)) ? $this->job->email : "";
  626.         $cellData = array("id" => "", "val" => $cellInfo);
  627.         $restriction = isset($restrictions["customer_email"])? $restrictions["customer_email"]: null;
  628.         $this->printJobInfoSectionCellData(1, "Email", "customer_email", $cellData, "email", $restriction, $this->canEditJobField("customer_email", $restriction));
  629.  
  630.         $restriction = isset($restrictions["customer_phone"])? $restrictions["customer_phone"]: null;
  631.         $this->printJobInfoFieldWithCheckbox([
  632.           ['title' => 'Phone', 'name' => 'customer_phone', 'value' => $this->job->phone, 'restriction' => $restriction, 'editable' => $this->canEditJobField("customer_phone", $restriction)],
  633.           ['title' => 'Text OK', 'name' => 'text_ok', 'value' => $this->job->textOk, 'restriction' => $restriction, 'editable' => $this->canEditJobField("customer_phone", $restriction), 'type' => 'checkbox']
  634.         ]);
  635.  
  636.         /*secondary*/
  637.         $restrictionFirst = isset($restrictions["secondary_first_name"])? $restrictions["secondary_first_name"]: null;
  638.         $restrictionLast = isset($restrictions["secondary_last_name"])? $restrictions["secondary_last_name"]: null;
  639.         $this->printJobInfoNameFields([
  640.           ['title' => 'Secondary First Name', 'name' => 'secondary_first_name', 'value' => $this->job->secondaryFirstname, 'restriction' => $restrictionFirst, 'editable' => $this->canEditJobField(JobInfoFields::FIRST_NAME, $restrictionFirst)],
  641.           ['title' => 'Secondary Last Name', 'name' => 'secondary_last_name', 'value' => $this->job->secondaryLastname, 'restriction' => $restrictionLast, 'editable' => $this->canEditJobField(JobInfoFields::LAST_NAME, $restrictionLast)]
  642.         ]);
  643.  
  644.  
  645.         $cellInfo = (isset($this->job->secondaryEmail)) ? $this->job->secondaryEmail : "";
  646.         $cellData = array("id" => "", "val" => $cellInfo);
  647.         $restriction = isset($restrictions["customer_email"])? $restrictions["customer_email"]: null;
  648.         $this->printJobInfoSectionCellData(1, "Secondary Email", "secondary_email", $cellData, "email", $restriction, $this->canEditJobField("customer_email", $restriction));
  649.  
  650.         $restriction = isset($restrictions["customer_phone"])? $restrictions["customer_phone"]: null;
  651.         $this->printJobInfoFieldWithCheckbox([
  652.           ['title' => 'Secondary Phone', 'name' => 'secondary_phone', 'value' => $this->job->secondaryPhone, 'restriction' => $restriction, 'editable' => $this->canEditJobField("customer_phone", $restriction)],
  653.           ['title' => 'Text OK', 'name' => 'secondary_text_ok', 'value' => $this->job->secondaryTextOk, 'restriction' => $restriction, 'editable' => $this->canEditJobField("customer_phone", $restriction), 'type' => 'checkbox']
  654.         ]);
  655.  
  656.         /*****/
  657.         $cellData = array("id" => "", "val" => $this->job->advocateName);
  658.         $restriction = isset($restrictions["advocate_name"])? $restrictions["advocate_name"]: null;
  659.         $this->printJobInfoSectionCellData(1, "Advocate's Name", "advocate_name", $cellData, null, $restriction, $this->canEditJobField("advocate_name", $restriction));
  660.  
  661.  
  662.         $cellInfo = (isset($this->job->dealerId->id)) ? $this->job->dealerId->id : "";
  663.         $restriction = isset($restrictions["dealer_id"])? $restrictions["dealer_id"]: null;
  664.         $this->printJobInfoDropdownField(1, "Partner", "dealer_id", $cellInfo, $this->controller->getDealers(), $restriction, $this->canEditJobField("dealer_id", $restriction));
  665.  
  666.         $cellInfo = (isset($this->job->languageId->id)) ? $this->job->languageId->id : null;
  667.         $restriction = isset($restrictions["language_id"]) ? $restrictions["language_id"] : null;
  668.         $this->printJobInfoDropdownField(1, "Language", "language_id", $cellInfo, $this->controller->getLanguages(), $restriction, $this->canEditJobField("language_id", $restriction));
  669.  
  670.         $restrictionLead = isset($restrictions["sugar_lead_id"])? $restrictions["sugar_lead_id"]: null;
  671.         $restrictionCustomer = isset($restrictions["sugar_customer_id"])? $restrictions["sugar_customer_id"]: null;
  672.         $this->printJobInfoSugarFields([
  673.           ['title' => 'Sugar Lead', 'name' => 'sugar_lead_id', 'value' => $this->job->sugarLeadId, 'restriction' => $restrictionLead, 'editable' => $this->canEditJobField('sugar_lead_id', $restrictionLead), 'module' => 'Leads'],
  674.           ['title' => 'Sugar Customer', 'name' => 'sugar_customer_id', 'value' => $this->job->sugarCustomerId, 'restriction' => $restrictionCustomer, 'editable' => $this->canEditJobField('sugar_customer_id', $restrictionCustomer), 'module' => 'Opportunities']
  675.         ]);
  676.  
  677.         $this->endContainer();
  678.  
  679.         $this->openJobInfoColumn();
  680.             $this->printJobInfoHeader('Complete Solar');
  681.                 $cellInfo = (isset($this->job->solarExpertId->id)) ? $this->job->solarExpertId->id : "";
  682.                 $cellInfo1 = (isset($this->job->solarExpertId->firstName)) ? $this->job->solarExpertId->firstName . " " . $this->job->solarExpertId->lastName : "";
  683.                 $cellData = array("id" => $cellInfo, "val" => $cellInfo1);
  684.                 $restriction = isset($restrictions["solar_expert"])? $restrictions["solar_expert"]: null;
  685.             $this->printJobInfoSectionCellData(2, "Solar Expert", "solar_expert", $cellData, null, $restriction, $this->canEditJobField("solar_expert", $restriction));
  686.  
  687.                 $cellInfo = (isset($this->job->secSolarExpertId->id)) ? $this->job->secSolarExpertId->id : "";
  688.                 $cellInfo1 = (isset($this->job->secSolarExpertId->firstName)) ? $this->job->secSolarExpertId->firstName . " " . $this->job->secSolarExpertId->lastName : "";
  689.                 $cellData = array("id" => $cellInfo, "val" => $cellInfo1);
  690.                 $restriction = isset($restrictions["sec_solar_expert"])? $restrictions["sec_solar_expert"]: null;
  691.             $this->printJobInfoSectionCellData(2, "2nd Solar Expert", "sec_solar_expert", $cellData, null, $restriction, $this->canEditJobField("sec_solar_expert", $restriction));
  692.  
  693.                 $cellInfo = (isset($this->job->siteTechnician->id)) ? $this->job->siteTechnician->id : "";
  694.                 $cellInfo1 = (isset($this->job->siteTechnician->firstName)) ? $this->job->siteTechnician->firstName . " " . $this->job->siteTechnician->lastName : "";
  695.                 $cellData = array("id" => $cellInfo, "val" => $cellInfo1);
  696.                 $restriction = isset($restrictions["site_technician"])? $restrictions["site_technician"]: null;
  697.             $this->printJobInfoSectionCellData(2, "Site Technician", "site_technician", $cellData, null, $restriction, $this->canEditJobField("site_technician", $restriction));
  698.  
  699.                 $cellInfo = (isset($this->job->siteSurveyScheduled)) ? $this->job->siteSurveyScheduled : "";
  700.                 $cellData = array("id" => "", "val" => $cellInfo);
  701.                 $restriction = isset($restrictions["site_technician"])? $restrictions["site_technician"]: null;
  702.             $this->printJobInfoSectionCellData(2, "Site Visit Date", "site_survey_scheduled", $cellData, null, $restriction, $this->canEditJobField("site_survey_scheduled", $restriction));
  703.  
  704.  
  705.                 $cellInfo = (isset($this->job->accountManagerId->id)) ? $this->job->accountManagerId->id : null;
  706.                 $restriction = isset($restrictions["account_manager_id"]) ? $restrictions["account_manager_id"] : null;
  707.             $this->printJobInfoDropdownField(2, "Account Manager", "account_manager_id", $cellInfo, $this->controller->getActiveAccountManagers(), $restriction, $this->canEditJobField("account_manager_id", $restriction));
  708.  
  709.                 $id = (isset($this->job->installerId->id)) ? $this->job->installerId->id : "";
  710.                 $value = (isset($this->job->installerId->firstName)) ? $this->job->installerId->firstName . " " . $this->job->installerId->lastName : "";
  711.                 $cellData = array("id" => $id, "val" => $value, "additionalClasses" => 'js-init-assign-job');
  712.                 $restriction = isset($restrictions["installer_id"]) ? $restrictions["installer_id"] : null;
  713.                 /*
  714.                   NOTE: If you change the structure of how the Section Cell Data is generating
  715.                         you must change the AssignInstallerToJob.js file as well.  It is dependent
  716.                         on keeping the ids such that they are fID-installer_id and fID-installer
  717.                 */
  718.                 $this->printJobInfoSectionCellData(2, "Installer", "installer", $cellData, 'installer_field', $restriction, $this->canEditJobField("installer_id", $restriction));
  719.  
  720.                 $cellInfo = (isset($this->job->contractDate)) ? $this->job->contractDate : "";
  721.                 $cellData = array("id" => "", "val" => $cellInfo);
  722.                 $restriction = isset($restrictions["contract_date"])? $restrictions["contract_date"]: null;
  723.             $this->printJobInfoSectionCellData(2, "Contract Date", "contract_date", $cellData, null, $restriction, $this->canEditJobField("contract_date", $restriction));
  724.  
  725.                 $cellInfo = (isset($this->job->contractAmount)) ? number_format($this->job->contractAmount, 2) : "";
  726.                 $cellData = array("id" => "", "val" => $cellInfo);
  727.                 $restriction = isset($restrictions["contract_amount"])? $restrictions["contract_amount"]: null;
  728.             $this->printJobInfoSectionCellData(2, "Contract Amount", "contract_amount", $cellData, null, $restriction, $this->canEditJobField("contract_amount", $restriction));
  729.  
  730.                 $cellInfo = (isset($this->job->projectedLifetimeSavings)) ? $this->job->projectedLifetimeSavings : "";
  731.                 $cellData = array("id" => "", "val" => $cellInfo);
  732.                 $restriction = isset($restrictions["projected_lifetime_savings"])? $restrictions["projected_lifetime_savings"]: null;
  733.             $this->printJobInfoSectionCellData(2, "Projected Lifetime Savings", "projected_lifetime_savings", $cellData, null, $restriction, $this->canEditJobField("projected_lifetime_savings", $restriction));
  734.  
  735.                 $cellInfo = (isset($this->job->welcomeCallDate)) ? $this->job->welcomeCallDate : "";
  736.                 $cellData = array("id" => "", "val" => $cellInfo);
  737.                 $restriction = isset($restrictions["welcome_call_date"])? $restrictions["welcome_call_date"]: null;
  738.             $this->printJobInfoSectionCellData(2, "Welcome Call Date", "welcome_call_date", $cellData, null, $restriction, $this->canEditJobField("welcome_call_date", $restriction));
  739.  
  740.             $cellInfo = (isset($this->job->fwtDate)) ? $this->job->fwtDate : "";
  741.             $cellData = array("id" => "", "val" => $cellInfo);
  742.             $restriction = isset($restrictions["fwt_date"])? $restrictions["fwt_date"]: null;
  743.             $this->printJobInfoSectionCellData(2, "Install Complete Date", "fwt_date", $cellData, null, $restriction, $this->canEditJobField("fwt_date", $restriction));
  744.             $this->endContainer();
  745.  
  746.         $this->openJobInfoColumn(true);
  747.             $this->printJobInfoHeaderSystemTitle('System');
  748.                 $cellInfo = (isset($this->job->moduleNumber)) ? $this->job->moduleNumber : "";
  749.                 $cellData = array("id" => "", "val" => $cellInfo);
  750.                 $restriction = isset($restrictions["module_number"])? $restrictions["module_number"]: null;
  751.             $this->printJobInfoSectionCellData(3, "No. of Modules", "module_number", $cellData, null, $restriction, $this->canEditJobField("module_number", $restriction));
  752.  
  753.             $cellInfo = (isset($this->job->productTypeId->id)) ? $this->job->productTypeId->id : null;
  754.             $restriction = (isset($restrictions["productID"])) ? $restrictions["productID"] : null;
  755.             $this->printJobInfoDropdownField(3, "Financial Product", "productID", $cellInfo, $this->controller->getProductTypes(), $restriction, $this->canEditJobField("productID", $restriction));
  756.  
  757.             $cellInfo = (isset($this->job->moduleId->id)) ? $this->job->moduleId->id : null;
  758.             $restriction = (isset($restrictions["moduleId"])) ? $restrictions["moduleID"] : null;
  759.             $this->printModuleDropdownField(3, "Module", "moduleId", $cellInfo, $this->controller->getModules(), $restriction, $this->canEditJobField("moduleId", $restriction));
  760.  
  761.             $cellInfo = (isset($this->job->inverterId->id)) ? $this->job->inverterId->id : null;
  762.             $restriction = (isset($restrictions["inverterId"])) ? $restrictions["inverterID"] : null;
  763.             $this->printInverterDropdownField(3, "Inverter", "inverterId", $cellInfo, $this->controller->getInverters(), $restriction, $this->canEditJobField("inverterId", $restriction));
  764.  
  765.                 $cellInfo = (isset($this->job->monitorTypeId->id)) ? $this->job->monitorTypeId->id : null;
  766.                 $restriction = (isset($restrictions["monitor_type_id"])) ? $restrictions["monitor_type_id"] : null;
  767.             $this->printJobInfoDropdownField(3, "Monitor Type", "monitor_type_id", $cellInfo, $this->controller->getMonitorTypes(), $restriction, $this->canEditJobField("monitor_type_id", $restriction));
  768.  
  769.                 $cellInfo = (isset($this->job->monitorId)) ? $this->job->monitorId : "";
  770.                 $cellData = array("id" => "", "val" => $cellInfo);
  771.                 $restriction = isset($restrictions["monitor_id"])? $restrictions["monitor_id"]: null;
  772.             $this->printJobInfoSectionCellData(3, "Monitor ID", "monitor_id", $cellData, null, $restriction, $this->canEditJobField("monitor_id"));
  773.  
  774.                 $cellInfo = (isset($this->job->equipmentCost)) ? number_format($this->job->equipmentCost, 2) : "";
  775.                 $cellData = array("id" => "", "val" => $cellInfo);
  776.                 $restriction = isset($restrictions["equipment_cost"])? $restrictions["equipment_cost"]: null;
  777.             $this->printJobInfoSectionCellData(3, "Equipment Cost", "equipment_cost", $cellData, null, $restriction, $this->canEditJobField("equipment_cost", $restriction));
  778.  
  779.                 $cellInfo = (isset($this->job->systemSize)) ? number_format($this->job->systemSize, 3) : "";
  780.                 $cellData = array("id" => "", "val" => $cellInfo);
  781.                 $restriction = isset($restrictions["system_size"])? $restrictions["system_size"]: null;
  782.             $this->printJobInfoSectionCellData(3, "System Size", "system_size", $cellData, "null", $restriction, $this->canEditJobField("system_size", $restriction));
  783.  
  784.                 $cellInfo = (isset($this->job->annualProduction)) ? number_format($this->job->annualProduction, 2) : "";
  785.                 $cellData = array("id" => "", "val" => $cellInfo);
  786.                 $restriction = isset($restrictions["annual_production"])? $restrictions["annual_production"]: null;
  787.             $this->printJobInfoSectionCellData(3, "Annual Prod", "annual_production", $cellData, null, $restriction, $this->canEditJobField("annual_production", $restriction));
  788.  
  789.                 $cellInfo = (isset($this->job->utility->id)) ? $this->job->utility->id : "";
  790.                 $restriction = isset($restrictions["utility"]) ? $restrictions["utility"] : null;
  791.             $this->printJobInfoDropdownField(3, "Utility", "utility", $cellInfo, $this->controller->getUtilities(), $restriction, $this->canEditJobField("utility", $restriction));
  792.  
  793.             $cellInfo = ($this->job->dollarsPerKwh != null) ? ($this->job->dollarsPerKwh * 100): "";
  794.             $cellData = array("id" => "", "val" => $cellInfo);
  795.             $restriction = isset($restrictions["dollars_per_kwh"])? $restrictions["dollars_per_kwh"]: null;
  796.             $this->printJobInfoSectionCellData(3, "&cent/kWh", "dollars_per_kwh", $cellData, null, $restriction, $this->canEditJobField("dollars_per_kwh", $restriction));
  797.  
  798.             $restriction = isset($restrictions["home_held_in_trust"]) ? $restrictions["home_held_in_trust"] : null;
  799.             $checkBoxArray = array();
  800.             $checkBoxArray[] = array(
  801.                 'title' => "In HOA",
  802.                 'name' => "in_hoa",
  803.                 'value' => $this->job->inHoa,
  804.             );
  805.             $checkBoxArray[] = array(
  806.                 'title' => "Home in Trust",
  807.                 'name' => "home_held_in_trust",
  808.                 'value' => $this->job->homeHeldInTrust,
  809.             );
  810.         $this->printJobInfoCheckboxField($checkBoxArray, $restriction, $this->canEditJobField("home_held_in_trust", $restriction));
  811.  
  812.  
  813.         $this->endContainer();
  814.         /*
  815.         $this->printJobInfoSectionCellData(3, "Inverter Mfg", "inverter_manufacturer", $this->job->inverterManufacturer, "null", false);
  816.         $this->printJobInfoSectionCellData("Bill Offset", "bill_offset", $this->job->billOffset);
  817.         $this->printJobInfoSectionCellData("Module Size", "module_size", $this->job->moduleSize);
  818.         $cellInfo = (isset($this->job->referredBy->username)) ? $this->job->referredBy->username : "";
  819.         $this->printJobInfoSectionCellData("Referrer[STS])", "referrer", $cellInfo);
  820.         $cellInfo = (isset($this->job->office->name)) ? $this->job->office->name : "";
  821.         $this->printJobInfoSectionCellData("Office", "office_id", $cellInfo);
  822.         $cellInfo = (isset($this->job->checkedInBy->username)) ? $this->job->checkedInBy->username : "";
  823.         $this->printJobInfoSectionCellData("Checked In By", "checked_in_by", $cellInfo);
  824.         */
  825.         ?>
  826.         </div>
  827.        
  828.         <div class="row">
  829.             <?php if ($this->canEditJobSection()) { ?>
  830.                 <div class="col-xs-12 edit-info-div" data-edit="0">
  831.                     <div class="edit-info-btn sd-btn action col-xs-12 col-md-4 col-md-offset-4">Edit Fields</div>
  832.                     <div class="cancel-edit-info-btn sd-btn action col-xs-12 col-md-3 col-md-offset-3 action">Cancel</div>
  833.                     <div class="submit-edit-info-btn sd-btn action col-xs-12 col-md-3 action">Submit</div>
  834.                 </div>
  835.                 <?php if (empty($this->job->sugarCustomerId) ) { ?>
  836.                 <div class="col-xs-12 convert-lead-div">
  837.                     <div id="convertLeadInSugar" class="convert-lead-btn sd-btn action col-xs-12 col-md-4 col-md-offset-4" style="background-color: gray; border: 5px solid white">Convert Lead</div>
  838.                 </div>
  839.                 <?php } ?>
  840.             <?php } ?>
  841.             </div>
  842.         <?php
  843.     }
  844.  
  845.     public function printJobInfoCheckboxField($checkBoxArray, $restriction, $editable = true) {
  846.         if ($restriction != null && $restriction["can_view"] == 0) { return false; };
  847.         $editableClass = ($editable) ? "editable" : "noneditable";
  848.         $column_layout = 12 / count($checkBoxArray);
  849.         if($column_layout < 1) $column_layout = 1;
  850.     ?>
  851.         <div class="row">
  852.         <?php
  853.             for ($i = 0; $i < count($checkBoxArray); $i++) {
  854.                 if(!isset($checkBoxArray[$i]['value']) || $checkBoxArray[$i]['value'] == null ) {
  855.                     $value = "0";
  856.                     $checked = "";
  857.                 } else {
  858.                     $value = $checkBoxArray[$i]['value'];
  859.                     $checked = ($checkBoxArray[$i]['value'] > 0) ? "checked" : "";
  860.                 }
  861.         ?>
  862.             <div class="col-xs-<?= $column_layout ?> job-check-col">
  863.                 <div class="job-info-cell-title-div job-check-div">
  864.                     <span class="job-info-cell-title job-cell-check-title"><?= $checkBoxArray[$i]['title'] ?></span>
  865.                     <div class="checkbox-wrapper info">
  866.                         <div id="fID-<?= $checkBoxArray[$i]['name'] ?>" class="job-checkbox info <?= $checked ?> <?= $editableClass ?>" data-id="<?= $checkBoxArray[$i]['name'] ?>" data-val="<?= $value ?>" readonly></div>
  867.                         <input type="checkbox" class="checkbox-hidden <?= $editableClass ?>" name="fID-<?= $checkBoxArray[$i]['name'] ?>" data-id="<?= $checkBoxArray[$i]['name'] ?>" data-name="fID-<?= $checkBoxArray[$i]['name'] ?>" checked="checked" value="<?= $value ?>" style="display: none" readonly>
  868.                     </div>
  869.                 </div>
  870.             </div>
  871.         <?php } ?>
  872.         </div>
  873.     <?php
  874.     }
  875.  
  876.     public function printJobInfoDropdownField($columnNumber, $title, $name, $attr, $dropdown, $restriction, $editable=true) {
  877.         if ($restriction != null && $restriction["can_view"] == 0) { return false; };
  878.         $editableClass = ($editable) ? "editable" : "noneditable";
  879.     ?>
  880.         <div class="row">
  881.             <div class="col-xs-12 job-info-cell-title-div">
  882.                 <span class="job-info-cell-title"><?= $title ?></span>
  883.                 <select id="fID-<?= $name ?>" name="fID-<?= $name ?>" class="<?= $editableClass ?>" disabled>
  884.                     <?php if ($attr == null) { ?>
  885.                         <option value="" selected></option>
  886.                     <?php } else { ?>
  887.                         <option value=""></option>
  888.                     <?php } ?>
  889.                     <?php foreach ($dropdown as $item) {
  890.                         $selected = ($item["id"] == $attr) ? "selected" : "";
  891.                     ?>
  892.                     <option value="<?= $item["id"] ?>" <?= $selected ?>><?= $item["name"] ?></option>
  893.                     <?php } ?>
  894.                 </select>
  895.             </div>
  896.         </div>
  897.     <?php
  898.     }
  899.  
  900.     public function printModuleDropdownField($columnNumber, $title, $name, $attr, $dropdown, $restriction, $editable=true) {
  901.         if ($restriction != null && $restriction["can_view"] == 0) { return false; };
  902.         $editableClass = ($editable) ? "editable" : "noneditable";
  903.         ?>
  904.             <div class="row">
  905.                 <div class="col-xs-12 <?= $colWidth["title"] ?> job-info-cell-title-div">
  906.                     <span class="job-info-cell-title"><?= $title ?></span>
  907.                     <select id="fID-moduleId" name="fID-moduleId" data-original-value="<?= $attr ?>" class="<?= $editableClass ?>" disabled>
  908.                         <?php if ($attr == null) { ?>
  909.                             <option value="" selected></option>
  910.                         <?php } else { ?>
  911.                             <option value=""></option>
  912.                         <?php } ?>
  913.                         <?php foreach ($dropdown as $item) {
  914.                             $selected = ($item["id"] == $attr) ? "selected = \"selected\"" : "";
  915.                         ?>
  916.                         <option value="<?= $item["id"] ?>" <?= $selected ?>><?= $item["name"] ?></option>
  917.                         <?php } ?>
  918.                         <option value="other">Other</option>
  919.                     </select>
  920.                 </div>
  921.             </div>
  922.         <?php
  923.     }
  924.  
  925.     public function printInverterDropdownField($columnNumber, $title, $name, $attr, $dropdown, $restriction, $editable=true) {
  926.         if ($restriction != null && $restriction["can_view"] == 0) { return false; };
  927.         $editableClass = ($editable) ? "editable" : "noneditable";
  928.         ?>
  929.             <div class="row">
  930.                 <div class="col-xs-12 <?= $colWidth["title"] ?> job-info-cell-title-div">
  931.                     <span class="job-info-cell-title"><?= $title ?></span>
  932.                     <select id="fID-inverterId" name="fID-inverterId" data-original-value="<?= $attr ?>" class="<?= $editableClass ?>" disabled>
  933.                         <?php if ($attr == null) { ?>
  934.                             <option value="" selected></option>
  935.                         <?php } else { ?>
  936.                             <option value=""></option>
  937.                         <?php } ?>
  938.                         <?php foreach ($dropdown as $item) {
  939.                             $selected = ($item["id"] == $attr) ? "selected = \"selected\"" : "";
  940.                         ?>
  941.                         <option value="<?= $item["id"] ?>" <?= $selected ?>><?= $item["name"] ?></option>
  942.                         <?php } ?>
  943.                         <option value="other">Other</option>
  944.                     </select>
  945.                 </div>
  946.             </div>
  947.     <?php
  948.     }
  949.  
  950.     public function printJobInfoSectionCellData($columnNumber, $title, $name, $attrArray, $special="null", $restriction, $editable = true, $additionalClasses = null) {
  951.         if ($restriction != null && $restriction["can_view"] == 0) { return false; };
  952.         $specialTags = array("open"=>"", "close"=>"");
  953.         $val = $attrArray["val"];
  954.         if ($special == "email") {
  955.             $specialTags = array("open"=>"<a href=\"mailto:$val\" target=\"_top\">", "close"=>"</a>");
  956.         } else if (($special == "Leads" || $special == "Opportunities") && $val) {
  957.             $sugarPath = $this->controller->getSugarBasePath();
  958.             $specialTags = array("open"=>"<a href=\"".$sugarPath.(substr($sugarPath, -1) == "/" ? "" : "/")."#".$special."/".$val."\" target=\"_blank\">", "close"=>"</a>");
  959.         } else if ($special == "installer_field") {
  960.             $status = $this->controller->getInstallationStatusForInstallerOnJob($this->job->id, $this->job->installerId->id);
  961.             switch ($status) {
  962.                 case JobInstallationStatus::APPROVED:
  963.                     $jobStatusClass = "installation-status approved";
  964.                     $jobStatusInitial = 'A';
  965.                     $jobStatusTooltip = 'Approved';
  966.                     break;
  967.                 case JobInstallationStatus::REJECTED:
  968.                     $jobStatusClass = "installation-status rejected";
  969.                     $jobStatusInitial = 'R';
  970.                     $jobStatusTooltip = 'Rejected';
  971.                     break;
  972.                 default:
  973.                     $jobStatusClass = "installation-status pending";
  974.                     $jobStatusInitial = 'P';
  975.                     $jobStatusTooltip = 'Pending';
  976.                     break;
  977.             }
  978.             $jobStatusDisplayClass = $val ? '' : 'hide' ;
  979.         }
  980.         $editableClass = ($editable) ? "editable" : "noneditable";
  981.     ?>
  982.         <div class="row">
  983.             <div class="col-xs-12 job-info-cell-title-div <?= isset($jobStatusClass) ? $jobStatusClass : '' ?>">
  984.  
  985.             <?php if(isset($jobStatusClass)) { ?>
  986.                 <span class="icon <?= $jobStatusDisplayClass ?>" data-toggle="tooltip" data-placement="top" data-original-title="<?= $jobStatusTooltip ?>" ><?= $jobStatusInitial ?></span>
  987.             <?php } ?>
  988.  
  989.             <?php if ($special != "null") { ?>
  990.                     <?= $specialTags["open"] ?>
  991.                     <span class="job-info-cell-title"><?= $title ?></span>
  992.                     <?= $specialTags["close"] ?>
  993.             <?php } else { ?>
  994.                     <span class="job-info-cell-title"><?= $title ?></span>
  995.             <?php }  ?>
  996.             <input type="hidden" class="<?= $editableClass ?>" id="fID-<?= $name ?>_id" name="fID-<?= $name ?>_id" value="<?= $attrArray["id"] ?>"></input>
  997.             <input id="fID-<?= $name ?>" class="job-info-cell-input jobinfo-input <?= $editableClass ?> <?= $attrArray["additionalClasses"] ?>" type="text" name="fID-<?= $name ?>" value="<?= $attrArray["val"] ?>" readonly></input>
  998.             </div>
  999.         </div>
  1000.     <?php
  1001.     }
  1002.  
  1003.     public function printJobInfoNameFields($fields = []) {
  1004.     ?>
  1005.         <div class="row">
  1006.           <?php foreach ($fields as $field) {
  1007.             if ($field['restriction'] != null && $field['restriction']["can_view"] == 0) {
  1008.               echo '</div>';
  1009.               return false;
  1010.             };
  1011.             $editableClass = $field['editable'] ? "editable" : "noneditable";
  1012.           ?>
  1013.               <div class="col-xs-12 col-sm-6 job-info-cell-title-div">
  1014.                 <span class="job-info-cell-title"><?= $field['title'] ?></span>
  1015.                 <input type="hidden" class="<?= $editableClass ?>" id="fID-<?= $name ?>_id" name="fID-<?= $field['name'] ?>_id" value="<?= $field['value'] ?>"></input>
  1016.                 <input id="fID-<?= $field['name'] ?>" class="job-info-cell-input jobinfo-input <?= $editableClass ?>"
  1017.                        type="text" name="fID-<?= $field['name'] ?>" value="<?= $field['value'] ?>" readonly></input>
  1018.               </div>
  1019.           <?php } ?>
  1020.  
  1021.         </div>
  1022.     <?php
  1023.     }
  1024.     public function printJobInfoSugarFields($fields = []) {
  1025.         $sugarPath = $this->controller->getSugarBasePath();
  1026.         $sugarPath .= substr($sugarPath, -1) == "/" ? "" : "/";
  1027.     ?>
  1028.         <div class="row">
  1029.           <?php foreach ($fields as $field) {
  1030.             if ($field['restriction'] != null && $field['restriction']["can_view"] == 0) {
  1031.               echo '</div>';
  1032.               return false;
  1033.             }
  1034.             $editableClass = $field['editable'] ? "editable" : "noneditable";
  1035.             $id = $field['value'];
  1036.             $name = $field['name'];
  1037.             $title = $field['title'];
  1038.             $fullSugarPathNoId = $sugarPath."#".$field['module']."/";
  1039.             $linkClass = $id ? 'active' : '';
  1040.             $spanClass = $id ? '' : 'active';
  1041.           ?>
  1042.               <div class="col-xs-12 col-sm-6 job-info-cell-title-div js-sugar-field" data-url="<?= $fullSugarPathNoId ?>">
  1043.                 <div class="spacer"></div>
  1044.                 <a class="center-this js-sugar-link-toggle link-toggle <?= $linkClass ?>" href="<?= $fullSugarPathNoId.$id ?>" target="_blank">
  1045.                   <span class="job-info-cell-title"><?= $title ?></span>
  1046.                 </a>
  1047.                 <span class="center-this job-info-cell-title js-sugar-link-toggle span-toggle <?= $spanClass ?>"><?= $title ?></span>
  1048.  
  1049.                 <input type="hidden" class="<?= $editableClass ?>" id="fID-<?= $name ?>_id" name="fID-<?= $name ?>_id" value="<?= $id ?>"></input>
  1050.                 <input id="fID-<?= $name ?>" class="job-info-cell-input jobinfo-input sugar-field-swap hide <?= $editableClass ?>"
  1051.                        type="text" name="fID-<?= $name ?>" value="<?= $id ?>" readonly></input>
  1052.               </div>
  1053.           <?php } ?>
  1054.  
  1055.         </div>
  1056.         <div class="div"></div>
  1057.     <?php
  1058.     }
  1059.  
  1060.  
  1061.     public function printJobInfoFieldWithCheckbox($fields = []) {
  1062.     ?>
  1063.       <div class="row">
  1064.         <?php foreach ($fields as $key => $field) {
  1065.           if ($field['restriction'] != null && $field['restriction']["can_view"] == 0) {
  1066.             echo '</div>';
  1067.             return false;
  1068.           };
  1069.           $editableClass = ($field['editable']) ? "editable" : "noneditable";
  1070.           $column = '6';
  1071.         ?>
  1072.             <div class="col-xs-12 col-sm-<?= $column ?> job-info-cell-title-div">
  1073.               <?php if($field['type'] == 'checkbox') { ?>
  1074.                   <?php
  1075.                        $checked = ($field['value'] > 0) ? "checked" : "";
  1076.                  ?>
  1077.                      <div class="job-info-cell-title-div job-check-div">
  1078.                        <div class="spacer sm"></div>
  1079.                          <span class="job-info-cell-title job-cell-check-title"><?= $field['title'] ?></span>
  1080.                          <div class="checkbox-wrapper info">
  1081.                              <div id="fID-<?= $field['name'] ?>" class="job-checkbox info <?= $checked ?> <?= $editableClass ?>" data-id="<?= $field['name'] ?>" data-val="<?= $field['value'] ?>" readonly></div>
  1082.                              <input type="checkbox" class="checkbox-hidden <?= $editableClass ?>" name="fID-<?= $field['name'] ?>" data-id="<?= $field['name'] ?>" data-name="fID-<?= $field['name'] ?>" checked="checked" value="<?= $field['value'] ?>" style="display: none" readonly>
  1083.                          </div>
  1084.                      </div>
  1085.               <?php } else { ?>
  1086.                   <span class="job-info-cell-title"><?= $field['title'] ?></span>
  1087.                   <input type="hidden" class="<?= $editableClass ?>" id="fID-<?= $name ?>_id" name="fID-<?= $field['name'] ?>_id" value="<?= $field['value'] ?>"></input>
  1088.                   <input id="fID-<?= $field['name'] ?>" class="job-info-cell-input jobinfo-input <?= $editableClass ?>"
  1089.                          type="text" name="fID-<?= $field['name'] ?>" value="<?= $field['value'] ?>" readonly></input>
  1090.               <?php } ?>
  1091.             </div>
  1092.         <?php } ?>
  1093.  
  1094.       </div>
  1095.     <?php
  1096.     }
  1097.  
  1098.  
  1099.     public function printJobInfoAddressFields($fields = []) {
  1100.     ?>
  1101.         <div class="row">
  1102.           <?php foreach ($fields as $key => $field) {
  1103.             if ($field['restriction'] != null && $field['restriction']["can_view"] == 0) {
  1104.               continue;
  1105.             };
  1106.  
  1107.             $editableClass = ($field['editable']) ? "editable" : "noneditable";
  1108.             if($key == 0) {
  1109.               $width = '7';
  1110.             } else if($key == 1) {
  1111.               $width = '2';
  1112.             } else {
  1113.               $width = '3';
  1114.             }
  1115.           ?>
  1116.               <div class="col-xs-12 col-sm-<?= $width ?> job-info-cell-title-div">
  1117.                 <span class="job-info-cell-title"><?= $field['title'] ?></span>
  1118.                 <input type="hidden" class="<?= $editableClass ?>" id="fID-<?= $name ?>_id" name="fID-<?= $field['name'] ?>_id" value="<?= $field['value'] ?>"></input>
  1119.                 <input id="fID-<?= $field['name'] ?>" class="job-info-cell-input jobinfo-input <?= $editableClass ?>"
  1120.                        type="text" name="fID-<?= $field['name'] ?>" value="<?= $field['value'] ?>" readonly></input>
  1121.               </div>
  1122.           <?php } ?>
  1123.         </div>
  1124.     <?php
  1125.     }
  1126.  
  1127.     public function printCommissionSectionTopInfo($controller) {
  1128.         $com = $this->job->commission;
  1129.         if($com == null || count($com->solarExpertCommissionList) == 0){
  1130.            return;
  1131.         }
  1132.         $comType= JobCommissionTypes::SELF_START_BONUS;
  1133.         $comTypeString = "Self Generated";
  1134.         $dropDown = $controller->getDropDownValue($comType);
  1135.         $dropDownValue = $com->isSelfGen;
  1136.     ?>
  1137.         <div class="row">
  1138.             <div class="col-xs-12 col-md-3 commission-info">
  1139.                 <?= $comTypeString ?>:
  1140.                 <select name="<?= $comType ?>" id="<?= $comType ?>">
  1141.                 <?php
  1142.                 $i = 0;
  1143.                 foreach($dropDown as $d) {
  1144.                     $selected = ($dropDownValue == $i) ? "selected" : "";
  1145.                 ?>
  1146.                     <option value="<?= $i ?>" <?= $selected ?>><?= $d->value ?></option>
  1147.                 <?php
  1148.                 $i++;
  1149.                 }
  1150.                 ?>
  1151.                 </select>
  1152.             </div>
  1153.  
  1154.             <div class="col-xs-12 col-md-3 commission-info">
  1155.                 By:<input class="job-info-cell-input jobinfo-input self-started" id="selfStartedBy" type="text" name="selfStartedBy" value="<?=$com->selfStartedByName?>"></input>
  1156.                 <input type="hidden" class="editable" name="selfStartedById" id="selfStartedById" value="<?=$com->selfStartedById?>" \>
  1157.             </div>
  1158.         </div>
  1159.     <?php
  1160.     }
  1161.  
  1162.     public function printCommissionTable($com) {
  1163.         //only admin can see commissions on the job
  1164.         //also a logged in user can see his own commission on the job
  1165.         if(!($this->controller->canHtRoleSeeCommissionOnJob() || ($com->userId == $this->controller->getLoggedInUser()->userId))){
  1166.             return;
  1167.         }
  1168.         $total = 0.00;
  1169.     ?>
  1170.         <div class="commission-table-div" style="margin-left: 0px; padding: 0px">
  1171.             <div class="row">
  1172.                 <div class="com-table-mobile-title">
  1173.                     <div class="commission-details-title" style="padding-left: 30px; font-weight: normal">Commission Details:</div>
  1174.                 </div>
  1175.                 <div class="col-md-3 commission-info">Solar Expert: <?= $com->userName ?></div>
  1176.                 <div class="col-md-3 commission-info">Certification: <?= $com->certificationName ?></div>
  1177.                 <div class="col-md-3 commission-info">KW: <?= $com->kw ?></div>
  1178.  
  1179.                 <div class="col-md-3 commission-info">Rule: <?= $com->ruleName ?></div>
  1180.                 <?php if ($com->canUpdateCertificate == 1) { ?>
  1181.                 <div class="col-md-3 update-cert-btn-div">
  1182.                     <div class="update-cert sd-btn action" data-solarexpertid="<?= $com->userId ?>" data-certid="<?= $com->certificationId ?>">Update to Current Certification</div>
  1183.                 </div>
  1184.                 <?php } ?>
  1185.             </div>
  1186.             <div class="com-table-desktop-title">
  1187.                 <div class="commission-details-title" style=" font-weight: normal">Commission Details:</div>
  1188.             </div>
  1189.             <table class="commission-table">
  1190.                 <thead>
  1191.                     <tr>
  1192.                         <td>Type</td>
  1193.                         <td>Formula</td>
  1194.                         <td>Amount</td>
  1195.                     </tr>
  1196.                 </thead>
  1197.                 <tbody>
  1198.                     <?php foreach($com->commissionDetail as $row) {
  1199.                         $total += $row->amount;
  1200.                     ?>
  1201.                     <tr>
  1202.                         <td class="commission-table-column-1"><?= $row->type ?></td>
  1203.                         <td class="commission-table-column-2"><?= $row->formula ?></td>
  1204.                         <td class="commission-table-column-3">$<?= number_format($row->amount, 2) ?></td>
  1205.                     </tr>
  1206.                     <?php } ?>
  1207.                 </tbody>
  1208.                 <tfoot>
  1209.                     <tr class="commission-total-row">
  1210.                         <td></td>
  1211.                         <td class="table-total-text">Total:</td>
  1212.                         <td class="table-total-val">$<?= number_format($total, 2) ?></td>
  1213.                     </tr>
  1214.                 </tfoot>
  1215.             </table>
  1216.         </div>
  1217.     <?php
  1218.     }
  1219.  
  1220.     public function printInstallerCommissionTable($com) {
  1221.  
  1222.         if(!($this->controller->canHtRoleSeeInstallerCommissionOnJob() || ($com->userId == $this->controller->getLoggedInUser()->userId))){
  1223.             return;
  1224.         }
  1225.         $total = 0.00;
  1226.  
  1227.         ?>
  1228.             <div class="commission-table-div" style="margin-left: 0px; padding: 0px">
  1229.                 <div class="row">
  1230.                     <div class="com-table-mobile-title">
  1231.                         <div class="commission-details-title" style="padding-left: 30px; font-weight: normal">Commission Details:</div>
  1232.                     </div>
  1233.                     <div class="col-md-3 installer-commission-info">Installer: <?= $com->userName ?></div>
  1234.                     <div class="col-md-3 installer-commission-info">KW: <?= $com->kw ?></div>
  1235.                     <div class="col-md-3 installer-commission-info">Rule: <?= $com->ruleName ?></div>
  1236.                     <div class="col-md-3 installer-commission-info">Bonus Rule: <?= $com->bonusRuleName ?></div>
  1237.                 </div>
  1238.                  <div class="row">
  1239.                     <div class="installer-commission-info">Job Start Date: <?= $com->jobStartDate ?></div>
  1240.                  </div>
  1241.                  <div class="row">
  1242.                     <div class="installer-commission-info bottom-padding"><?= $com->detailMsg ?></div>
  1243.                  </div>
  1244.                     <?php if ($com->canUpdateCertificate == 1) { ?>
  1245.                     <div class="col-md-3 update-cert-btn-div">
  1246.                         <div class="update-cert sd-btn action" data-solarexpertid="<?= $com->userId ?>" data-certid="<?= $com->certificationId ?>">Update to Current Certification</div>
  1247.                     </div>
  1248.                     <?php } ?>
  1249.  
  1250.                 <div class="com-table-desktop-title">
  1251.                     <div class="commission-details-title" style=" font-weight: normal">Commission Details:</div>
  1252.                 </div>
  1253.                 <table class="commission-table">
  1254.                     <thead>
  1255.                         <tr>
  1256.                             <td>Type</td>
  1257.                             <td>Formula</td>
  1258.                             <td>Amount</td>
  1259.                         </tr>
  1260.                     </thead>
  1261.                     <tbody>
  1262.                         <?php foreach($com->commissionDetail as $row) {
  1263.                             $total += $row->amount;
  1264.                         ?>
  1265.                         <tr>
  1266.                             <td class="commission-table-column-1"><?= $row->type ?></td>
  1267.                             <td class="commission-table-column-2"><?= $row->formula ?></td>
  1268.                             <td class="commission-table-column-3">$<?= number_format($row->amount, 2) ?></td>
  1269.                         </tr>
  1270.                         <?php } ?>
  1271.                     </tbody>
  1272.                     <tfoot>
  1273.                         <tr class="commission-total-row">
  1274.                             <td></td>
  1275.                             <td class="table-total-text">Total:</td>
  1276.                             <td class="table-total-val">$<?= number_format($total, 2) ?></td>
  1277.                         </tr>
  1278.                     </tfoot>
  1279.                 </table>
  1280.             </div>
  1281.         <?php
  1282.         }
  1283.  
  1284.     public function printInstallerCommissionAdjustments($comAdjustments){
  1285.     ?>
  1286.         <div class="com-adj-section">
  1287.             <?php
  1288.             $this->printInstallerComAdjustment(array_reverse($comAdjustments), "Discount");
  1289.             if($this->canEditInstallerDiscounts()){
  1290.             ?>
  1291.             <div class="row new-adj-input-div">
  1292.                 <hr>
  1293.                 <div class="col-xs-offset-1 col-md-3 col-md-offset-3 new-adj-input-cell"><input id="new-installer-adj-input-desc" type="text" placeholder="Description"></input></div>
  1294.                 <div class="col-xs-4 new-adj-input-cell"></div>
  1295.                 <div class="col-xs-10 col-xs-offset-1 col-md-3 col-md-offset-0 new-adj-input-cell"><input id="new-installer-adj-input-amount" type="number" placeholder="Amount"></input></div>
  1296.                 <br>
  1297.             </div>
  1298.             <div class="row edit-adj-btn-div" data-edit="0">
  1299.                 <div class="col-xs-10 col-xs-offset-1 col-md-4 col-md-offset-4 new-adj-btn sd-btn action">Add New</div>
  1300.                 <div class="col-xs-10 col-xs-offset-1 col-md-3 col-md-offset-3 cancel-adj-btn sd-btn action">Cancel</div>
  1301.                 <div class="col-xs-10 col-xs-offset-1 col-md-3 col-md-offset-0 submit-adj-btn sd-btn action">Add</div>
  1302.             </div>
  1303.         </div>
  1304.     <?php
  1305.         }
  1306.     }
  1307.  
  1308.     public function printInstallerComAdjustment($list, $title) {
  1309.         $total = 0.00;
  1310.         $name = strtolower(str_replace(" ", "_", $title));
  1311.         ?>
  1312.             <div class="com-adj-subsection">
  1313.                 <div class="row com-adj-title-row">
  1314.                     <div class="com-adj-title"><span><?= $title ?>s</span></div>
  1315.                 </div>
  1316.  
  1317.                 <table class="com-adj-table">
  1318.                     <tr class="com-adj-row">
  1319.                         <th class="com-adj-cell col-1">Description</th>
  1320.                         <th class="com-adj-cell col-2">Date Added</th>
  1321.                         <th class="com-adj-cell col-3">Discount Amount</th>
  1322.                         <th class="com-adj-cell col-4"></th>
  1323.                         <th class="com-adj-cell col-5"></th>
  1324.                     </tr>
  1325.                     <?php foreach ($list as $item) {
  1326.                         $total += $item["amount"];
  1327.                     ?>
  1328.                     <tr class="com-adj-row installer" data-id="<?= $item["id"] ?>">
  1329.                         <td class="com-adj-cell col-1"><?= $item["description"] ?></td>
  1330.                         <td class="com-adj-cell col-3"><?= $item["time_submitted"]? (new \DateTime($item["time_submitted"]))->format("Y-m-d"):""?></td>
  1331.                         <td class="com-adj-cell col-3"><input type="text" value="<?= number_format($item["amount"], 2) ?>" name="<?= $name ?>-<?= $item["id"] ?>" data-id="<?= $item["id"] ?>"></input></td>
  1332.                         <?php if($this->canEditInstallerDiscounts()){?>
  1333.                         <td class="com-adj-cell col-4">
  1334.                                 <div class="com-adj-update-btn desktop sd-btn action" data-id="<?= $item["id"] ?>">Update</div>
  1335.                                 <div class="com-adj-update-btn mobile" data-id="<?= $item["id"] ?>"><img src="/images/update-icon.png"></div>
  1336.                         </td>
  1337.                         <td class="com-adj-cell col-5">
  1338.                             <div class="com-adj-del-btn mobile x-del-btn" data-id="<?= $item["id"] ?>"></div>
  1339.                             <div class="com-adj-del-btn desktop sd-btn action" data-id="<?= $item["id"] ?>">Delete</div>
  1340.                         </td>
  1341.                         <?php }else{?>
  1342.                         <td class="com-adj-cell col-4"></td>
  1343.                         <td class="com-adj-cell col-5"></td>
  1344.                         <?php }?>
  1345.                     </tr>
  1346.                     <?php } ?>
  1347.                     <tr>
  1348.                         <td colspan="2" class="com-adj-total-label">Total <?= $title ?>s:</td>
  1349.                         <td class="com-adj-total-value col-3">$<span id="com-adj-total-amount"><?= number_format($total, 2) ?></span></td>
  1350.                     </tr>
  1351.                 </table>
  1352.             </div>
  1353.         <?php
  1354.         }
  1355.  
  1356.     public function printCommissionAdjustments($comAdjustments) {
  1357.     ?>
  1358.         <div class="com-adj-section">
  1359.             <?php
  1360.             if (count($comAdjustments->discountList) > 0) {
  1361.                 $this->printComAdjustment($comAdjustments->discountList, "Discount");
  1362.             }
  1363.             if (count($comAdjustments->rebateList) > 0) {
  1364.                 $this->printComAdjustment($comAdjustments->rebateList, "Rebate");
  1365.             }
  1366.             if (count($comAdjustments->commAdjList) > 0) {
  1367.                 $this->printComAdjustment($comAdjustments->commAdjList, "Commission Adjustment");
  1368.             }
  1369.             ?>
  1370.             <div class="row new-adj-input-div">
  1371.                 <hr>
  1372.                 <div class="col-xs-4 new-adj-input-cell"><input id="new-adj-input-desc" type="text" placeholder="Description"></input></div>
  1373.                 <div class="col-xs-4 new-adj-input-cell">
  1374.                     <select id="new-adj-input-type" placeholder="Discount Type" style="width: 100%">
  1375.                         <option value="">Adjustment Type</option>
  1376.                         <option value="1">Discount</option>
  1377.                         <option value="2">Rebate</option>
  1378.                         <?php
  1379.                         if($this->controller->isAdminUser() || $this->controller->isAuditorUser()){
  1380.                         ?>
  1381.                         <option value="3">Com Adj</option>
  1382.                         <?php
  1383.                          }
  1384.                         ?>
  1385.                     </select>
  1386.                 </div>
  1387.                 <div class="col-xs-4 new-adj-input-cell"><input id="new-adj-input-amount" type="text" placeholder="Amount"></input></div>
  1388.             </div>
  1389.             <?php if(!$comAdjustments->viewOnly){ ?>
  1390.             <div class="row edit-adj-btn-div" data-edit="0">
  1391.                 <div class="col-xs-10 col-xs-offset-1 col-md-4 col-md-offset-4 new-adj-btn sd-btn action">Add New</div>
  1392.                 <div class="col-xs-10 col-xs-offset-1 col-md-3 col-md-offset-3 cancel-adj-btn sd-btn action">Cancel</div>
  1393.                 <div class="col-xs-10 col-xs-offset-1 col-md-3 col-md-offset-0 submit-adj-btn sd-btn action">Add</div>
  1394.             </div>
  1395.             <?php } ?>
  1396.         </div>
  1397.     <?php
  1398.     }
  1399.  
  1400.     public function printComAdjustment($list, $title) {
  1401.         $total = 0.00;
  1402.         $name = strtolower(str_replace(" ", "_", $title));
  1403.     ?>
  1404.         <div class="com-adj-subsection">
  1405.             <div class="row com-adj-title-row">
  1406.                 <div class="com-adj-title"><span><?= $title ?>s</span></div>
  1407.             </div>
  1408.  
  1409.             <table class="com-adj-table">
  1410.                 <?php foreach ($list as $item) {
  1411.                     $total += $item["amount"];
  1412.                 ?>
  1413.                 <tr class="com-adj-row" data-id="<?= $item["id"] ?>">
  1414.                     <td class="com-adj-cell col-1"><?= $item["description"] ?></td>
  1415.                     <td class="com-adj-cell col-2"><?= $title ?></td>
  1416.                     <td class="com-adj-cell col-3"><?= $item["timeSubmitted"]? (new \DateTime($item["timeSubmitted"]))->format("Y-m-d"):""?></td>
  1417.                     <td class="com-adj-cell col-4"><input type="text" value="<?= number_format($item["amount"], 2) ?>" name="<?= $name ?>-<?= $item["id"] ?>" data-id="<?= $item["id"] ?>"></input></td>
  1418.                     <td class="com-adj-cell col-5">
  1419.                         <?php if ($item["canUpdate"] == 1 && $this->job->jobStateId->name != State::WAITING) { ?>
  1420.                             <div class="com-adj-update-btn desktop sd-btn action" data-id="<?= $item["id"] ?>">Update</div>
  1421.                             <div class="com-adj-update-btn mobile" data-id="<?= $item["id"] ?>"><img src="/images/update-icon.png"></div>
  1422.                         <?php } ?>
  1423.                     </td>
  1424.                     <td class="com-adj-cell col-6">
  1425.                         <?php if ($item["canDelete"] == 1 && $this->job->jobStateId->name != State::WAITING) { ?>
  1426.                         <div class="com-adj-del-btn mobile x-del-btn" data-id="<?= $item["id"] ?>"></div>
  1427.                         <div class="com-adj-del-btn desktop sd-btn action" data-id="<?= $item["id"] ?>">Delete</div>
  1428.                         <?php } ?>
  1429.                     </td>
  1430.                 </tr>
  1431.                 <?php } ?>
  1432.                 <tr>
  1433.                     <td colspan="3" class="com-adj-total-label">Total <?= $title ?>s:</td>
  1434.                     <td class="com-adj-total-value col-4">$<span id="com-adj-total-amount"><?= number_format($total, 2) ?></span></td>
  1435.                 </tr>
  1436.             </table>
  1437.         </div>
  1438.     <?php
  1439.     }
  1440.  
  1441.     public function printHistorySectionBody() {
  1442.         ?>
  1443.          <div class="h-tbl-div desktop" id="history_div">
  1444.          <?php
  1445.          $this->printHistorySectionBodyContent();
  1446.          ?>
  1447.          </div>
  1448.          <?php
  1449.         if ($this->controller->userCanManageCommission()) { ?>
  1450.             <div class="update-history-btn-div">
  1451.             <div id="update-history-btn" class="sd-btn action" name="update-history-btn">Update</div>
  1452.             </div>
  1453.          <?php }
  1454.     }
  1455.     public function printHistorySectionBodyContent() {
  1456.         $num = count($this->job->stateChanges );
  1457.         echo "<input type=\"hidden\" id=\"numHistory\"  value=\"$num\">";
  1458.         ?>
  1459.             <table class="h-tbl">
  1460.                 <thead>
  1461.                     <tr class="h-tbl-header-row h-tbl-row">
  1462.                         <td class="h-tbl-h-cell h-tbl-cell">New State</td>
  1463.                         <td class="h-tbl-h-cell h-tbl-cell">Performed On</td>
  1464.                         <td class="h-tbl-h-cell h-tbl-cell"> Performed By</td>
  1465.                         <td class="h-tbl-h-cell h-tbl-cell">KW</td>
  1466.                         <?php if(!$this->controller->isInstallerUser()){ ?>
  1467.                         <td class="h-tbl-h-cell h-tbl-cell">Solar Expert</td>
  1468.                         <td class="h-tbl-h-cell h-tbl-cell">2nd Solar Expert</td>
  1469.                         <td class="h-tbl-h-cell h-tbl-cell">Is Adjustment</td>
  1470.                         <td class="h-tbl-h-cell h-tbl-cell">Partner</td>
  1471.                         <td class="h-tbl-h-cell h-tbl-cell">Contract Amt</td>
  1472.                         <td class="h-tbl-h-cell h-tbl-cell">Roof</td>
  1473.                         <td class="h-tbl-h-cell h-tbl-cell">MainPanel</td>
  1474.                         <td class="h-tbl-h-cell h-tbl-cell">Financial Prod</td>
  1475.                         <td class="h-tbl-h-cell h-tbl-cell">&cent/kWh</td>
  1476.                         <td class="h-tbl-h-cell h-tbl-cell">FWT</td>
  1477.                         <?php } ?>
  1478.                     </tr>
  1479.                 </thead>
  1480.                 <tbody class="h-tbl-body">
  1481.                     <?php $i = 1; ?>
  1482.                     <?php foreach($this->job->stateChanges as $stateChange) { ?>
  1483.                     <tr class="h-tbl-body-row h-tbl-row">
  1484.                         <?php  if($stateChange->newSubState != null){?>
  1485.                              <td class="h-tbl-b-cell h-tbl-cell"><?= $stateChange->newSubState->name ?></td>
  1486.                         <?php }else{?>
  1487.                             <td class="h-tbl-b-cell h-tbl-cell"><?= $stateChange->newState->name ?></td>
  1488.                         <?php }?>
  1489.                         <td class="h-tbl-b-cell h-tbl-cell">
  1490.                         <?php if ($this->controller->userCanManageCommission()) {?>
  1491.                             <input type="text" data-historyid="<?= $stateChange->id ?>" data-origdate="<?= date("m/d/Y h:i a", strtotime($stateChange->performedOn)) ?>" id="performedOn_<?= $i ?>" value="<?= date("m/d/Y h:i a", strtotime($stateChange->performedOn)) ?>"></input>
  1492.                         <?php } else { ?>
  1493.                             <?= date("m/d/Y", strtotime($stateChange->performedOn)) . '<br>' . date("h:i a", strtotime($stateChange->performedOn)) ?>
  1494.                         <?php } ?>
  1495.                         </td>
  1496.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->performedBy->firstName)) ? $stateChange->performedBy->firstName . " " . $stateChange->performedBy->lastName : "" ?></td>
  1497.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->kw)) ? $stateChange->kw : "" ?></td>
  1498.                         <?php if(!$this->controller->isInstallerUser()){ ?>
  1499.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->solarExpert->firstName)) ? $stateChange->solarExpert->firstName . " " . $stateChange->solarExpert->lastName : "" ?></td>
  1500.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->secondarySolarExpert)) ? $stateChange->secondarySolarExpert->firstName . " " . $stateChange->secondarySolarExpert->lastName : "" ?></td>
  1501.                         <td class="h-tbl-b-cell h-tbl-cell"><?= ($stateChange->isAdjustment == 1) ? "Yes" : "No" ?></td>
  1502.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->dealer->firstName)) ? $stateChange->dealer->firstName . " " . $stateChange->dealer->lastName : "" ?></td>
  1503.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->contractAmount)) ? $stateChange->contractAmount : "" ?></td>
  1504.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->roofType)) ? $stateChange->roofType->name : "" ?></td>
  1505.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->mainPanel)) ? $stateChange->mainPanel : "" ?></td>
  1506.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->productType)) ? $stateChange->productType->name : "" ?></td>
  1507.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->dollarsPerKwh)) ? ($stateChange->dollarsPerKwh * 100) : "" ?></td>
  1508.                         <td class="h-tbl-b-cell h-tbl-cell"><?= (isset($stateChange->fwtDate)) ? $stateChange->fwtDate : "" ?></td>
  1509.                         <?php } ?>
  1510.                     </tr>
  1511.                     <?php $i++ ?>
  1512.                     <?php } ?>
  1513.                 </tbody>
  1514.             </table>
  1515.             <?php
  1516.     }
  1517.  
  1518.     public function printHistorySectionBodyMobile() {
  1519.     ?>
  1520.         <div class="h-tbl-div mobile">
  1521.             <?php foreach($this->job->stateChanges as $stateChange) { ?>
  1522.             <div class="row no-margin-row h-tbl-title-div-mbl">
  1523.                 <div class="h-tbl-title-mbl"><?= $stateChange->newState->name ?></div>
  1524.             </div>
  1525.             <table class="h-tbl-mbl">
  1526.                 <tr><td>Performed On</td><td><?= $stateChange->performedOn ?></td></tr>
  1527.                 <tr><td>Performed By</td><td><?= $stateChange->performedBy->username ?></td></tr>
  1528.                 <tr><td>KW</td><td><?= $stateChange->kw ?></td></tr>
  1529.                 <?php if(!$this->controller->isInstallerUser()){ ?>
  1530.                 <tr><td>Solar Expert</td><td><?= (isset($stateChange->solarExpert->username)) ? $stateChange->solarExpert->username : "" ?></td></tr>
  1531.                 <tr><td>2nd Solar Expert</td><td><?= (isset($stateChange->secondarySolarExpert)) ? $stateChange->secondarySolarExpert->username : "" ?></td></tr>
  1532.                 <tr><td>Is Adjustment?</td><td><?= ($stateChange->isAdjustment == 1) ? "Yes" : "No" ?></td></tr>
  1533.                 <?php } ?>
  1534.             </table>
  1535.             <?php } ?>
  1536.         </div>
  1537.     <?php
  1538.     }
  1539.  
  1540.  
  1541.     //############################
  1542.     //## Section HTML Functions ##
  1543.     //############################
  1544.  
  1545.     public function openSection($id, $level, $fieldType, $status, $approved, $messageBox, $show=false) {
  1546.         $toShow = ($show == true) ? "maximized" : "minimized";
  1547.         $section;
  1548.         switch ($level) {
  1549.             case 0:
  1550.                 $section = "container section-container";
  1551.                 break;
  1552.             case 1:
  1553.                 $section = "col-xs-12 subsection";
  1554.                 break;
  1555.             default:
  1556.                 // $section = "subsection-expand-table-cell";
  1557.                 $section = "subsection";
  1558.         }
  1559.     ?>
  1560.         <div class="<?= $section ?> section msgs-inactive <?= $toShow ?> status-<?= $status ?>" data-type="<?= $fieldType ?>" data-id="<?= $id ?>" data-level="<?= $level ?>" data-status="<?= $status ?>">
  1561.     <?php
  1562.     }
  1563.  
  1564.     public function insertHeading($id, $level, $title, $status, $approved, $messageBox=0, $show=false, $canDownloadAll = false) {
  1565.         $canCheck = $this->canUseCheckbox();
  1566.         $toShow = ($show == true) ? "maximized" : "minimized";
  1567.         $className = strtolower(str_replace(" ", "_", $title));
  1568.         $message = ($messageBox > 1) ? "message" : "no-message";
  1569.     ?>
  1570.         <div class="row <?=$className?>-header section-heading <?=$status?>-header top-section-heading status-<?= $status ?>" data-id="<?= $id ?>" data-level="<?= $level ?>" data-status="<?= $status ?>">
  1571.             <div class="top-expand-btn-div section-expand expand-btn-div <?= $toShow ?>" data-id="<?=  $id ?>"></div>
  1572.             <?php if ($approved > 0) { $checked = ($approved == 2) ? "checked" : ""; ?>
  1573. <!--
  1574.             <div class="checkbox-wrapper top">
  1575.                 <div class="job-checkbox top <?= $checked ?>" data-id="<?= $id ?>" data-val="" name="fID-<?= $id ?>" <?= $canCheck ?>></div>
  1576.                 <input type="hidden" class="checkbox-hidden" name="fID-<?= $id ?>" data-id="<?= $id ?>" value="0" <?= $canCheck ?>\>
  1577.             </div>
  1578. -->
  1579.             <?php } ?>
  1580.             <div class="title-text-div <?= ($approved > 0) ? "box" : "no-box" ?>">
  1581.                 <span class="title-text"><?= $title ?></span>
  1582.             </div>
  1583.             <div class="title-action-buttons">
  1584.               <?php
  1585.                     if($canDownloadAll){
  1586.                         $this->displayDownloadAllSectionDocuments($id);
  1587.                     }
  1588.               ?>
  1589.               <?php if ($messageBox > 0) { ?>
  1590.                   <div class="message-icon top-msg <?= $message ?>" data-section="<?= $className ?>" data-level="<?= $level ?>" data-id="<?= $id ?>">
  1591.                       <img class="empty-comment" src="images/job_comment_white.png"></img>
  1592.                       <img class="full-comment" src="images/job_comment_pop.png"></img>
  1593.                   </div>
  1594.               <?php } ?>
  1595.             </div>
  1596.  
  1597.         </div>
  1598.             <div class="toplevel-arrow <?= $status ?> status-<?= $status ?>" data-id="<?= $id ?>" data-status="<?= $status ?>"></div>
  1599.     <?php
  1600.     }
  1601.  
  1602.     public function openSectionBody($title, $display=false) {
  1603.         $show = ($display) ? "display" : "no-display";
  1604.         $section = strtolower(str_replace(" ", "_", $title));
  1605.     ?>
  1606.         <div class="row section-body s-body <?= $show ?>" data-section="<?= $section ?>">
  1607.             <div class="section-body-content">
  1608.     <?php
  1609.     }
  1610.  
  1611.     public function openSubsection($id, $level, $status, $parentId) {
  1612.     ?>
  1613.         <div class="subsection-wrapper" data-id="<?= $id ?>" data-level="<?= $level ?>">
  1614.             <div class="col-xs-12 subsection section level-<?= $level . " " . $status ?> minimized msgs-inactive status-<?= $status ?>" data-id="<?= $id ?>" data-parent="<?= $parentId ?>" data-level="<?= $level ?>" data-status="<?= $status ?>">
  1615.     <?php
  1616.     }
  1617.  
  1618.     public function printSubsectionHeading($id, $level, $title, $status, $approved, $messageBox=0, $show=false, $field = null) {
  1619.         $canCheck = $this->canUseCheckbox();
  1620.         $message = ($messageBox == 2) ? "message" : "no-message";
  1621.         $longText = (strlen($title) > 35) ? "long-mobile" : "";
  1622.         $type = ($level == 1) ? "circle" : "nested";
  1623.         $rowColumn = ($level == 1) ? "row" : "col-xs-12";
  1624.         $showClass = ($show) ? "maximized" : "minimized";
  1625.  
  1626.         $status = ($field && $field->jobData) ? strtolower($field->jobData->getStatus()) : 'missing';
  1627.  
  1628.         $fieldType = strtolower($field->controlType->name);
  1629.         $fileUploadedClass = ($fieldType == "file" && count($field->documents)) ? ' file-uploaded' : '';
  1630.     ?>
  1631.         <div class="<?= $rowColumn ?> subsection-title-div section-heading <?= $showClass ?> status-<?= $status ?>" data-id="<?= $id ?>" data-level="<?= $level ?>" data-status="<?= $status ?>">
  1632.             <div class="level-3-title-bg"></div>
  1633.             <div class="subsection-expand-div section-expand status-<?= $status ?><?= $fileUploadedClass ?>" data-id="<?= $id ?>" data-level="<?= $level ?>" data-status="<?= $status ?>">
  1634.             </div>
  1635.  
  1636.             <div class="subsection-expand-text <?= ($approved > 0) ? "box" : "no-box" ?>">
  1637.                 <span><?= $title ?></span>
  1638.             </div>
  1639.           <?php if ($messageBox > 0) { ?>
  1640.                 <div class="message-icon sub-msg <?= $message ?>" data-level="<?= $level ?>" data-id="<?= $id ?>">
  1641.                     <img class="empty-comment" src="images/job_comment_empty.png"></img>
  1642.                     <img class="empty-comment-mobile" src="images/job_comment_white.png"></img>
  1643.                     <img class="full-comment" src="images/job_comment_pop.png"></img>
  1644.                 </div>
  1645.         <?php } ?>
  1646.  
  1647.  
  1648.         <?php if($level == 1 && $field->needsApproval) {  ?>
  1649.               <div class="sales-packet-status <?= $canCheck ?>" data-id="<?= $id ?>">
  1650.  
  1651.                 <?php $approvedClass = ($status == 'approved') ? 'active' : ''; ?>
  1652.                 <div class="status-container approved <?= $approvedClass ?>">
  1653.                   <div class="icon"></div>
  1654.                 </div>
  1655.  
  1656.                 <?php $pendingClass = ($status == 'pending') ? 'active' : ''; ?>
  1657.                 <div class="status-container pending <?= $pendingClass ?>">
  1658.                     <div class="icon"></div>
  1659.                 </div>
  1660.  
  1661.                 <?php $missingClass = ($status == 'missing') ? 'active' : ''; ?>
  1662.                 <div class="status-container missing <?= $missingClass ?>">
  1663.                     <div class="icon"></div>
  1664.                 </div>
  1665.  
  1666.                 <?php $naClass = ($status == 'not_applicable') ? 'active' : ''; ?>
  1667.                 <div class="status-container not_applicable <?= $naClass ?>">
  1668.                     <div class="icon"></div>
  1669.                 </div>
  1670.  
  1671.               </div>
  1672.         <?php } ?>
  1673.         </div>
  1674.     <?php
  1675.     }
  1676.  
  1677.     public function openSubsectionItemList($id, $level, $status, $title, $messageBox, $comments=null) {
  1678.         $showComment = ($title == "General Comments") ? "active" : "inactive";
  1679.     ?>
  1680.         <div class="col-xs-12 item-list-wrapper s-body no-display" data-id="<?= $id ?>" data-level="<?= $level ?>">
  1681.             <div class="col-xs-12 item-list status-<?= $status ?>"  data-level="<?= $level ?>" data-status="<?= $status ?>">
  1682.                 <div class=" row subsection-expand-table status-<?= $status ?>" data-level="<?= $level ?>" data-status="<?= $status ?>">
  1683.     <?php
  1684.     }
  1685.  
  1686.     public function closeSubsectionItemList() {
  1687.     ?>
  1688.                 </div>
  1689.             </div>
  1690.         </div>
  1691.     <?php
  1692.     }
  1693.  
  1694.     public function closeSubsection() {
  1695.     ?>
  1696.             </div>
  1697.         </div>
  1698.     <?php
  1699.     }
  1700.  
  1701.     public function closeSectionBody() {
  1702.     ?>
  1703.             </div>
  1704.         </div>
  1705.     <?php
  1706.     }
  1707.  
  1708.     public function closeSection() {
  1709.     ?>
  1710.         </div>
  1711.     <?php
  1712.     }
  1713.     public function openJobInfoColumn($last = false) {
  1714.         $lastClass = ($last) ? "last" : "";
  1715. ?>
  1716.             <div class="col-xs-12 col-md-4 job-info-column <?= $lastClass ?>">
  1717. <?php
  1718.     }
  1719.  
  1720.     public function printJobInfoHeader($title = null) {
  1721. ?>
  1722.         <div class="row">
  1723.             <div class="col-md-12">
  1724.                 <h4 class="job-info-subheader"><?= $title ?></h4>
  1725.             </div>
  1726.         </div>
  1727. <?php
  1728.     }
  1729.  
  1730.     public function printJobInfoHeaderSystemTitle($title = null) {
  1731. ?>
  1732.         <div class="row">
  1733.             <div class="col-md-12">
  1734.                 <h4 class="job-info-subheader"><?= $title ?>
  1735.                   <?php if($this->job->hqQuoteId) { ?>
  1736.                        - <a href="https://helioquote.completesolar.com/addresses?quote_id=<?= $this->job->hqQuoteId ?>" target="_blank">HQ</a>
  1737.                   <?php } ?>
  1738.                 </h4>
  1739.             </div>
  1740.         </div>
  1741. <?php
  1742.     }
  1743.     function printCommentSection($id, $section, $comments, $status, $show=false) {
  1744.         $active = ($show == true) ? "display" : "no-display";
  1745.     ?>
  1746.         <div class="row comments-section <?= $active ?> status-<?= $status ?>" data-id="<?= $id ?>" data-status="<?= $status ?>" data-section="<?= $section ?>">
  1747.  
  1748.             <div class="comments-container">
  1749.     <?php
  1750.         if (isset($comments)) {
  1751.             foreach($comments as $comment) {
  1752.                 $this->printComment($comment, false);
  1753.             }
  1754.         }
  1755.     ?>
  1756.             </div>
  1757.     <?php
  1758.             $this->displayAvatar();
  1759.         ?>
  1760.             <div class="col-xs-12 col-md-10 col-offset-md-1 new-comment-box">
  1761.                 <textarea name="ncID-<?= $id ?>" rows="4" placeholder="Type your comment here..."></textarea>
  1762.                 <div class="add-comment-button-div">
  1763.                     <div class="add-comment-btn sd-btn action" data-action="add_comment">Add</div>
  1764.                 </div>
  1765.             </div>
  1766.         </div>
  1767.     <?php
  1768.     }
  1769.  
  1770.     public function printComment($comment, $return=false) {
  1771.         if ($return) { ob_start(); }
  1772.     ?>
  1773.         <div class="general-comment-wrapper">
  1774.             <?php $this->displayAvatar($comment->commenter->id); ?>
  1775.             <div class="general-comment">
  1776.                 <div class="comment-header">
  1777.                     <span class="comment-username"><?= $comment->commenter->firstName ?> <?= $comment->commenter->lastName ?> - </span>
  1778.                     <span class="comment-userrole"><?= ucwords(strtolower($comment->commenter->role->name)) ?></span>
  1779.                 </div>
  1780.                 <span class="comment-datetime"><?= $comment->commentTime ?></span>
  1781.                 <p class="comment-comment"><?= $comment->content ?></p>
  1782.             </div>
  1783.         </div>
  1784.     <?php
  1785.         if ($return) {
  1786.             $return =  ob_get_contents();
  1787.             ob_end_clean();
  1788.             return $return;
  1789.     }
  1790.     }
  1791.  
  1792.     public function printDocumentSubsection($id, $docs) {
  1793.     ?>
  1794.         <div class="doc-area" data-id="<?= $id ?>">
  1795.             <?php
  1796.             $this->printDocList($id, $docs);
  1797.             $this->printDocUploadArea($id);
  1798.             ?>
  1799.         </div>
  1800.         <!-- <hr class="doc-hr"> -->
  1801.     <?php
  1802.     }
  1803.  
  1804.     public function printDocList($id, $docs) {
  1805.         $jobFields = $this->getJobFields();
  1806.     ?>
  1807.         <div class="doc-list" data-id="<?= $id ?>">
  1808.         <?php
  1809.         foreach($docs as $doc) {
  1810.             if (empty($doc->isDeleted)) {
  1811.                 $splitDoc = explode("-", $doc->name, 2);
  1812.                 $docTime = $splitDoc[0];
  1813.                 $docName = $splitDoc[1];
  1814.                 $dateFormat1 = 'M d, Y \a\t H:i:s';
  1815.                 $dateFormat2 = 'Y-m-d H:i:s';
  1816.         ?>
  1817.             <div class="document"data-id="<?= $id ?>" data-docid="<?= $doc->id ?>">
  1818.             <?php if($jobFields->canEditField($id) && $this->controller->okToUpdateJobDocs($this->job->id)){?>
  1819.                 <div class="js-job-delete-doc x-del-btn" data-docid="<?= $doc->id ?>"></div>
  1820.                 <?php }?>
  1821.                 <a href="<?= $this->controller->getHTDomain() ?>jobUpkeep.php?action=open&id=<?= $doc->id ?>" target="_blank">
  1822.                     <img class="doc-img" src="/images/document_icon.png"></img>
  1823.                     <div class="doc-name">
  1824.                         <span class="doc-name-title"><?= $docName ?></span><br />
  1825.                         <span class="doc-time"><?= date($dateFormat2, $docTime) ?></span>
  1826.                     </div>
  1827.                 </a>
  1828.             </div>
  1829.         <?php
  1830.             }
  1831.         }
  1832.         ?>
  1833.         </div>
  1834.     <?php
  1835.     }
  1836.  
  1837.     public function printDocUploadArea($id) {
  1838.        $jobFields = $this->getJobFields();
  1839.        if($jobFields->canEditField($id) && $this->controller->okToUpdateJobDocs($this->job->id)){
  1840.     ?>
  1841.         <div class="doc-upload-area">
  1842.             <?php if (false) { // temporary statement to hide the following section until drag & drop is implemented ?>
  1843.             <div class="desktop-upload" style="border: 1px dashed gray; text-align: center; height: 100px; margin: 10px">
  1844.                 <img src="images/upload_icon.png"></img>
  1845.                 <span>To attach files drag &amp; drop here or <span class="desktop-upload-text" style="position: relative">select files from your computer<input type="file" style="opacity: 0; position: absolute; top: 0; left: 0;"></input></span></span>
  1846.             </div>
  1847.             <div class="mobile-upload">
  1848.                 <div class="js-job-file-upload-btn choose-file-btn sd-btn action" style="width: 100px; display: block; margin: 10px auto; position: relative">Choose File<input type="file" style="opacity: 0; position: absolute; top: 0; left: 0;"></input></div>
  1849.             </div>
  1850.             <?php } ?>
  1851.             <div class="upload">
  1852.                 <div class="choose-file">
  1853.                     <input type="file" class="choose-file-btn" name="fID-<?= $id ?>[]" data-action="doc-upload" data-id="<?= $id ?>" multiple></input>
  1854.                     <div class="choose-file-btn-cover">
  1855.                         <div class="file-status">
  1856.                           <div class="choose-file-text">To attach files drag &amp; drop here or <span>select files from your computer...</span></div>
  1857.                           <div class="choose-file-value" data-id="<?= $id ?>"></div>
  1858.                         </div>
  1859.                     </div>
  1860.                     <div class="clear"></div>
  1861.                 </div>
  1862.                 <button id="up-doc-<?= $id ?>" class="js-job-file-upload-btn file-upload-btn upload-btn sd-btn action inverse no-display" data-id="<?= $id ?>" data-action="up-doc-<?= $id ?>">Upload</button>
  1863.             </div>
  1864.         </div>
  1865.     <?php
  1866.         }
  1867.     }
  1868.  
  1869.     public function printItem($field, $approved) {
  1870.         $canCheck = $this->canUseCheckbox();
  1871.         $isInputField = ($field->controlType->id == 1 || $field->controlType->id == 5) ? "col-xs-12 col-md-4 input-cell " : "col-xs-12 col-md-12 ";
  1872.         $type = (isset($field->controlType->id)) ? intval($field->controlType->id) : 0;
  1873.     ?>
  1874.         <div class="<?= $isInputField ?>subsection-expand-table-cell">
  1875.             <div class="subsection-cell-value-div">
  1876.                 <?php if ($approved > 0) {
  1877.                     $checked = ($approved == 2) ? "checked" : "";
  1878.                 ?>
  1879.                 <div class="checkbox-wrapper item">
  1880.                     <div class="job-checkbox end <?= $checked ?>"  data-id="<?= $field->id ?>" name="fID-<?= $field->id ?>"data-val="" <?= $canCheck ?>></div>
  1881.                     <input type="hidden" class="checkbox-hidden" name="fID-<?= $field->id ?>" data-id="<?= $field->id ?>" value="0" <?= $canCheck ?> \>
  1882.                 </div>
  1883.                 <?php } ?>
  1884.                 <span class="subsection-cell-title"><?= $field->name ?></span>
  1885.     <?php
  1886.             switch ($type) {
  1887.                 case 1:
  1888.                     $this->printTextItem($field);
  1889.                     break;
  1890.                 case 5:
  1891.                     $this->printDropDownItem($field);
  1892.                     break;
  1893.                 default:
  1894.             }
  1895.     ?>
  1896.             </div>
  1897.         </div>
  1898.     <?php
  1899.     }
  1900.  
  1901.     public function printLabelItem($field) {
  1902.     ?>
  1903.         <div class="subsection-expand-table-cell">
  1904.             <span class="subsection-cell-title"><?= $field->name ?></span>
  1905.         </div>
  1906.     <?php
  1907.     }
  1908.  
  1909.     public function printDropDownItem($field) {
  1910.         $dropdownArray = $field->getDataAccess();
  1911.         $jobFields = $this->getJobFields();
  1912.         $disabled = "";
  1913.         if(!$jobFields->canEditField($field->id)){
  1914.             $disabled = " disabled";
  1915.         }
  1916.     ?>
  1917.             <br />
  1918.             <select class="dropdown_field" name="fID-<?= $field->id ?>" data-id="<?= $field->id ?>" data-input="<?= $field->id ?>"  <?= $disabled ?>>
  1919.                 <?php
  1920.                 foreach($dropdownArray as $option) {
  1921.                     $selected = "";
  1922.                     if ($option->id == $field->jobData->value){
  1923.                         $selected = ' selected="selected" ';
  1924.                     }
  1925.                     echo "<option value=\"$option->id\"$selected>$option->value</option>";
  1926.                 }
  1927.                 ?>
  1928.             </select>
  1929.     <?php
  1930.     }
  1931.  
  1932.     public function printTextItem($field) {
  1933.         $jobFields = $this->getJobFields();
  1934.         $readonly = "";
  1935.         if(!$jobFields->canEditField($field->id)){
  1936.            $readonly = " readonly";
  1937.         }
  1938.         $dataId = (isset($field->jobData->id)) ? $field->jobData->id : $field->id;
  1939.         $id = $field->id;
  1940.         $value = (isset($field->jobData->value)) ? $field->jobData->value : "";
  1941.     ?>
  1942.             <br />
  1943.             <input class="job-text-field" type="text" name="fID-<?= $id ?>" id="fID-<?= $id ?>" data-input="<?= $dataId ?>" data-id="<?= $id ?>" value="<?= $value ?>"  <?= $readonly ?>></input>
  1944.     <?php
  1945.     }
  1946.  
  1947.     public function printHiddenField($field) {
  1948.     ?>
  1949.         <input class="hidden name="<?= strtolower(str_replace(" ", "_", $field->name)) ?>" <?= $field->jobData->id ?>" type="hidden" data-id="<?= $field->jobData->id ?>"></input>
  1950.     <?php
  1951.     }
  1952.  
  1953.     public function printHiddenItem($item, $val) {
  1954.     ?>
  1955.         <input class="hidden" id="<?= $item ?>" type="hidden" name="<?= $item ?>" data-name="<?= $item ?>" value="<?= $val ?>" data-id="<?= $val ?>"></input>
  1956.     <?php
  1957.     }
  1958.  
  1959.     public function printButtons($siteSurveyComplete){
  1960.      echo "<button class=\"sd-btn action download-documents\" type=\"button\">Download All Docs</button>";
  1961.     }
  1962.  
  1963.     public function printState(){
  1964.         echo $this->state;
  1965.     }
  1966.     public function printStateHistory() {
  1967.     }
  1968.     public function updateCommissionAndDiscounts($htdb, $loggedInUser, $jobId, $solarExpertOpen=false, $installerOpen=false) {
  1969.         if(!$this->canViewCommissionSection()){
  1970.            return;
  1971.         }
  1972.         $dbResult = $htdb->getJobInfo($jobId);
  1973.         if($dbResult->errors && count($dbResult->errors> 0)){
  1974.             // $this->log->addERROR("  failed ". $this->jobId ." ".$dbResult->errors[0]);
  1975.         }
  1976.  
  1977.         $row = $dbResult->data[0];
  1978.         $jobStateId = $row['job_state_id'];
  1979.         $jobStateName = $row['state_name'];
  1980.         $jobSubStateName = $row['sub_state_name'];
  1981.         $jobStateView = $jobStateController = null;
  1982.         $jobInfo = new JobInfo($jobId, $jobStateId, $jobStateName, $jobSubStateName);
  1983.         // echo "<pre>"; print_r($loggedInUser); echo "</pre>"; exit(0);
  1984.         $jobStateController = JobStateController::createController($loggedInUser, $jobInfo, $htdb);
  1985.         $jobCommissionController = new JobCommissionController($loggedInUser, $jobId);
  1986.         $jobCommissionInfo = $jobCommissionController->getJobCommissionFromJob($jobId);
  1987.         $jobObject = $jobStateController->getJob($jobId);
  1988.         $jobObject->setCommission($jobCommissionInfo);
  1989.         $jobStateView = JobStateView::createView($jobStateController, $jobObject);
  1990.         if(!$jobStateController->canUserViewJob()){
  1991.             header("Location: job.php?action=dispmsg&msg=nopermissiontoview");
  1992.             exit(0);
  1993.         }
  1994.         ob_start();
  1995.         $this->openSection("solarExpert", 1, "section", "info", 0, 1, $solarExpertOpen);
  1996.         $this->printSubsectionHeading("solarExpert", 1, "Solar Experts", "info", 0, null, $solarExpertOpen);
  1997.         $this->openSubsectionItemList(null, 1, "info", "commission", 0);
  1998.         $jobStateView->printCommissionSectionTopInfo($jobCommissionController);
  1999.         foreach ($jobStateView->job->commission->solarExpertCommissionList as $com) {
  2000.            $jobStateView->printCommissionTable($com);
  2001.         }
  2002.         if($this->canViewDiscounts()){
  2003.             $jobStateView->openSection("jobDiscounts", 1, "section", "info", 0, 1, $jobOpen);
  2004.             $jobStateView->printSubsectionHeading("jobDiscounts", 1, "Discounts, Rebates & Commission Adjustments", "info", 0, null, $jobOpen);
  2005.             $jobStateView->openSubsectionItemList(null, 1, "info", "commission", 0);
  2006.             $commissionAdjustments = $jobCommissionController->getJobDiscounts($jobId);
  2007.             $jobStateView->printCommissionAdjustments($commissionAdjustments);
  2008.             $jobStateView->closeSubsectionItemList();
  2009.             $this->closeSection();
  2010.         }
  2011.         $jobStateView->closeSubsectionItemList();
  2012.         $this->closeSection();
  2013.         $this->openSection("installer", 1, "section", "info", 0, 1, $installerOpen);
  2014.         $this->printSubsectionHeading("Installer", 1, "Installers", "info", 0, null, $installerOpen);
  2015.         $this->openSubsectionItemList(null, 1, "info", "commission", 0);
  2016.  
  2017.  
  2018.         foreach($jobStateView->job->commission->installerCommissionList as $com){
  2019.             $this->printInstallerCommissionTable($com);
  2020.         }
  2021.         if($this->canViewInstallerDiscounts($jobId)){
  2022.             $this->openSection("installerDiscounts", 1, "section", "info", 0, 1, $installerOpen);
  2023.             $this->printSubsectionHeading("installerDiscounts", 1, "Installer Discounts", "info", 0, null, $installerOpen);
  2024.             $this->openSubsectionItemList(null, 1, "info", "commission", 0);
  2025.             $commissionAdjustments = $jobCommissionController->getInstallerJobDiscounts($jobId);
  2026.             $this->printInstallerCommissionAdjustments($commissionAdjustments);
  2027.             $this->closeSubsectionItemList();
  2028.             $this->closeSection();
  2029.         }
  2030.  
  2031.         $this->closeSubsectionItemList();
  2032.         $this->closeSection();
  2033.  
  2034.         $html =  ob_get_contents();
  2035.         ob_end_clean();
  2036.         return $html;
  2037.     }
  2038.  
  2039.     public function displayOtherModule() {
  2040.     ?>
  2041.             <div id="othermodule" class="othermodule">
  2042.                 <div class="padded">
  2043.                     <p>Add a new module type:</p>
  2044.                     <form method="POST" id="subform" class="newModuleForm">
  2045.                         Manufacturer:<br>
  2046.                         <input type="text" name="newManufacturer" id="newManufacturer" class="enabled"><br>
  2047.                         Model:<br>
  2048.                         <input type="text" name="newModel" id="newModel" class="enabled"><br>
  2049.                         Size:<br>
  2050.                         <input type="text" name="newSize" id="newSize" class="enabled"><br><br>
  2051.                         <div id="submitModuleButton" class="sd-btn action enabled">Add Module</div>
  2052.                     </form>
  2053.                 </div>
  2054.             </div>
  2055.     <?php
  2056.     }
  2057.  
  2058.     public function displayOtherInverter() {
  2059.     ?>
  2060.         <div id="otherinverter" class="otherinverter">
  2061.             <div class="padded">
  2062.                 <p>Add a new inverter type:</p>
  2063.                 <form method="POST" id="subform" class="newInverterForm">
  2064.                     Manufacturer:<br>
  2065.                     <input type="text" name="newManufacturerInv" class="enabled" id="newManufacturerInv"><br>
  2066.                     Model:<br>
  2067.                     <input type="text" name="newModelInv" class="enabled" id="newModelInv"><br><br>
  2068.                   <div id="submitInverterButton" class="sd-btn action enabled">Add Inverter</div>
  2069.                 </form>
  2070.             </div>
  2071.         </div>
  2072.     <?php
  2073.     }
  2074.  
  2075.     /***********Job In Jeopardy Section********************/
  2076.  
  2077.     public function okToAddJobInJeopardyReason(){
  2078.         return false;
  2079.     }
  2080.  
  2081.     public function printJobInJeopardyContainer() {
  2082.         ?>
  2083.           <div class="job-in-jeopardy-container">
  2084.             <div class="pulse-loading-container">
  2085.               <h5>Loading</h5>
  2086.               <div class="throbber"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>
  2087.             </div>
  2088.           </div>
  2089.     <?php
  2090.         }
  2091.  
  2092.         public function printJobInJeopardySection($reasons = [], $jobInJeopardyTimeout = null) {
  2093.           if($jobInJeopardyTimeout == null){
  2094.              $jobInJeopardyTimeout = $this->controller->getJobInJeopardyDefaultTimeoutDate();
  2095.              $jobInJeopardyTimeout = $this->controller->convertToHTDate($jobInJeopardyTimeout->date, 'm/d/Y');
  2096.           }
  2097.           if($this->canMoveJobToJeopardy()){
  2098.     ?>
  2099.           <div class="hide"><?php print_r($timeoutDate); ?></div>
  2100.           <div class="row">
  2101.             <div class="col-sm-2">
  2102.               <div class="new-reason"><span class="plus-reason">+</span>Add Reason</div>
  2103.             </div>
  2104.             <div class="col-sm-10">
  2105.               <div class="reopen-date">This job will automatically re-open on
  2106.                   <input type="text" class="reopen-date-input datepicker" readonly value="<?= $jobInJeopardyTimeout; ?>" />
  2107.                   <div class="reopen-btn reopen-date-edit">Edit</div>
  2108.                   <div class="reopen-btn reopen-date-save hidden">Save</div>
  2109.               </div>
  2110.             </div>
  2111.           </div>
  2112.      <?php }?>
  2113.  
  2114.           <div class="row">
  2115.             <div class="col-sm-12">
  2116.               <table class="table">
  2117.                 <thead>
  2118.                   <tr>
  2119.                     <th>Why is this job in jeopardy?</th>
  2120.                     <th>Issue</th>
  2121.                     <th>Target Resolution Date?</th>
  2122.                     <th>Resolved</th>
  2123.                     <th class="completion-date-col">Completion Date</th>
  2124.                     <th class="action-btns"></th><!-- Actions -->
  2125.                   </tr>
  2126.                 </thead>
  2127.                 <tbody>
  2128.                   <?php
  2129.                       if($this->okToAddJobInJeopardyReason()) {
  2130.                         $this->printJobInJeopardyNewReason();
  2131.                       }
  2132.                   ?>
  2133.                   <?= $this->printJobInJeopardyReasons($reasons) ?>
  2134.  
  2135.                 </tbody>
  2136.               </table>
  2137.             </div>
  2138.           </div>
  2139.  
  2140.     <?php
  2141.         }
  2142.  
  2143.         public function printJobInJeopardyReasons($reasons) {
  2144.           foreach ($reasons as $reason) {
  2145.             $resolved = $reason['resolution'] == 'Closed' ? 1 : 0;
  2146.             $desc = $reason['description'];
  2147.     ?>
  2148.             <tr>
  2149.                 <input readonly name="id" type="hidden" class="reasons-id" value="<?= $reason['id'] ?>" />
  2150.               <td>
  2151.                 <?= $this->printJobInJeopardyReasonsSelect($reason['name'], true) ?>
  2152.               </td>
  2153.               <td><input readonly name="issue" type="text" title="<?= $desc ?>" value="<?= $desc ?>" /></td>
  2154.               <td><input readonly name="targetResolutionDate" type="text" class="datepicker" value="<?= $this->controller->convertToHTDate($reason['target_resolution_date_c']) ?>" /></td>
  2155.  
  2156.               <td><?= $this->createCustomCheckbox('resolved', $resolved) ?></td>
  2157.  
  2158.                 <?php $completionDate = empty($reason['resolved_on_c']) ? 'MM/DD/YYYY' : $this->controller->convertToHTDate($reason['resolved_on_c']); ?>
  2159.               <td class="completion-date-col"><input class="completion-date" readonly name="completionDate" type="text" value="<?= $completionDate ?>" /></td>
  2160.               <td></td><!-- Actions -->
  2161.             </tr>
  2162.     <?php
  2163.           }
  2164.         }
  2165.  
  2166.         public function printJobInJeopardyNewReason() {
  2167.     ?>
  2168.         <tr>
  2169.             <input readonly name="id" type="hidden" class="reasons-id" value="" />
  2170.           <td>
  2171.             <?php $this->printJobInJeopardyReasonsSelect() ?>
  2172.           </td>
  2173.           <td><input name="issue" type="text" /></td>
  2174.           <td><input name="targetResolutionDate" type="text" class="datepicker" /></td>
  2175.           <td><?= $this->createCustomCheckbox('resolved', 0) ?></td>
  2176.           <td class="completion-date-col"><input class="completion-date" name="completionDate" type="text" value="MM/DD/YYYY" readonly /></td>
  2177.           <td>
  2178.              <?= $this->printJobInJeopardyActionButtons() ?>
  2179.           </td><!-- Actions -->
  2180.         </tr>
  2181.  
  2182.     <?php
  2183.         }
  2184.  
  2185.         public function printJobInJeopardyReasonsSelect($selectedValue = null, $disabled = false) {
  2186.         $reasons = $this->controller->getDefaultJobInJeopardyReasons();
  2187.           if($disabled) {
  2188.             $disabledHtml = 'disabled';
  2189.           } else {
  2190.             $disabledHtml = '';
  2191.           }
  2192.     ?>
  2193.           <select <?= $disabledHtml ?> name="reason">
  2194.             <option value="">Choose One</option>
  2195.     <?php   if (!in_array($selectedValue, $reasons) && $selectedValue) { ?>
  2196.                 <option value="<?= $selectedValue ?>" selected="selected"><?= $selectedValue ?></option>
  2197.     <?php   }
  2198.  
  2199.             foreach ($reasons as $reason) { ?>
  2200.               <?php $selected = ($selectedValue == $reason ) ? 'selected="selected"' : ''; ?>
  2201.               <option value="<?= $reason ?>" <?= $selected ?>><?= $reason ?></option>
  2202.     <?php   }  ?>
  2203.           </select>
  2204.     <?php
  2205.         }
  2206.  
  2207.       public function printJobInJeopardyActionButtons() {
  2208.         if ($this->okToExecuteJobInJeopardy()) { ?>
  2209.           <div class="sd-btn action jij-new">JIJ</div> <?php
  2210.         }else{?>
  2211.           <div class="sd-btn action jij-submit">Submit</div> <?php
  2212.         }
  2213.       }
  2214.  
  2215.  
  2216.       public function displayDownloadAllSectionDocuments($sectionId){
  2217. ?>
  2218.         <i class="fa fa-download download-documents" aria-hidden="true" data-field-id="<?= $sectionId ?>"></i>
  2219. <?php
  2220.       }
  2221.  
  2222.  
  2223.       /********PERMISSIONS*****************/
  2224.       public function okToExecuteSave(){
  2225.           return false;
  2226.       }
  2227.       public function okToExecuteSubmit(){
  2228.           return false;
  2229.       }
  2230.       public function okToExecuteRequestSiteTech(){
  2231.           return false;
  2232.       }
  2233.       public function okToExecuteApprove(){
  2234.           return false;
  2235.       }
  2236.       public function okToExecuteJobInJeopardy(){
  2237.           return false;
  2238.       }
  2239.  
  2240.       public function okToExecuteClaimIt(){
  2241.           return false;
  2242.       }
  2243.       public function okToExecuteProcessDone(){
  2244.           return false;
  2245.       }
  2246.  
  2247.       public function okToExecuteOpenJobSubmission(){
  2248.           return false;
  2249.       }
  2250.  
  2251.       public function okToExecuteItemsMissing(){
  2252.           return false;
  2253.       }
  2254.       public function okToExecuteReopen(){
  2255.           return false;
  2256.       }
  2257.  
  2258.  
  2259.       public function okToExecutePipSubmit(){
  2260.           return false;
  2261.       }
  2262.  
  2263.       public function okToExecutePipApprove(){
  2264.           return false;
  2265.       }
  2266.       public function okToExecutePipItemsMissing(){
  2267.           return false;
  2268.       }
  2269.  
  2270.       public function okToExecuteFWT(){
  2271.           return false;
  2272.       }
  2273.       public function canUserViewJob(){
  2274.           return $this->controller->canUserViewJob();
  2275.       }
  2276.  
  2277.       public function canViewDiscounts(){
  2278.           return !$this->controller->isInstallerUser();
  2279.       }
  2280.  
  2281.       public function canViewCommissionSection(){
  2282.           return true;
  2283.       }
  2284.  
  2285.       public function canMoveJobToJeopardy(){
  2286.           return false;
  2287.       }
  2288.  
  2289.       public function canViewInstallerDiscounts($jobId){
  2290.           return $this->controller->canViewInstallerDiscounts($jobId);
  2291.       }
  2292.  
  2293.       public function canEditInstallerDiscounts(){
  2294.           return $this->controller->canEditInstallerDiscounts();
  2295.       }
  2296.  
  2297.       public function canEditJobField($field=null, $restriction=null){
  2298.       }
  2299.  
  2300.       public function canEditJobSection(){
  2301.           return $this->controller->canEditJobSection();
  2302.       }
  2303.  
  2304.       public function canUpdateFieldStatus(){
  2305.           return $this->controller->canUpdateFieldStatus();
  2306.       }
  2307.  
  2308.       public function canViewSolarExpertCommissionSection(){
  2309.           return $this->controller->canViewSolarExpertCommissionSection();
  2310.       }
  2311.  
  2312.       public function canViewInstallerCommissionSection($jobId){
  2313.           return $this->controller->canViewInstallerCommissionSection($jobId);
  2314.       }
  2315.  
  2316.  
  2317.  
  2318.  
  2319. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement