예제 #1
0
 private function showTicketDetails(&$ticket)
 {
     $tabs = [];
     $crumbs = base::crumbs([['url' => '#', 'text' => "({$ticket['id']}) {$ticket['ticket_title']}"]]);
     // Tab #1 is going to be split. So lets create the span6 that we will need.
     // Update Active Queue
     $_SESSION['activeQueue'] = $ticket['queue_id'];
     $replyContent = "\n\t\t\t\t<div class='row-fluid'>\n\t\t\t\t\t\t\t<div class='span6'>" . $this->getTicketReplies($ticket) . "</div>\n\t\t\t\t\t\t\t<div class='span6'>" . $this->getFiles($ticket) . $this->getCompanyNotes($ticket) . $this->getTicketBilled($ticket) . $this->getIncidentStanding($ticket) . "</div>\n\t\t\t\t\t\t</div>";
     // Counter Init
     $maincount = $this->returnCountFromTable("replies", "ticket_id='{$ticket['id']}' AND reply_isinternal = false");
     $subcount = $this->returnCountFromTable("subtickets", "ticket_id='{$ticket['id']}' AND subticket_isclosed = false");
     $ttlcount = $this->returnCountFromTable("tickets", "company_id='{$ticket['company_id']}'");
     // Tab Creation
     $tabs[] = ['class' => 'active', 'id' => 'ticketTrail', 'title' => "<i class='icon-comments'></i> <span class='badge badge-success'>{$maincount}</span> Main Communication", 'content' => $replyContent];
     if ($this->isProvidingCompany()) {
         $tabs[] = ['id' => 'subTickets', 'title' => "<i class='icon-tasks'></i> <span class='badge badge-warning'>{$subcount}</span> Ticket Tasks", 'content' => $this->getSubTickets($ticket)];
     }
     $tabs[] = ['id' => 'history', 'title' => "<i class='icon-calendar'></i> <span class='badge badge-inverse'>{$ttlcount}</span> History", 'content' => $this->getHistory($ticket)];
     if ($this->canSeeBilling() || !$this->isProvidingCompany()) {
         $tabs[] = ['id' => 'sow', 'title' => "<i class='icon-bookmark'></i> Statement of Work", 'content' => $this->getStatementOfWork($ticket)];
     }
     if ($this->canSeeBilling() && $this->isProvidingCompany()) {
         $tabs[] = ['id' => 'billing', 'title' => "<i class='icon-money'></i> Billing", 'content' => $this->getBillingTab($ticket)];
     }
     $buttons = button::init()->text('Add Reply')->isModalLauncher()->url('#createReplyModal')->addStyle('btn-inverse')->icon('comment')->render();
     $buttons .= button::init()->text('Upload File')->isModalLauncher()->url('#uploadFile')->addStyle('btn-info')->icon('arrow-up')->render();
     $buttons .= button::init()->text('Close Ticket')->url("/close/{$ticket['id']}/")->addStyle('btn-danger')->addStyle('get')->icon('remove')->render();
     $fbuttons = $buttons;
     $fbuttons .= button::init()->text('Back to Top')->url("#")->addStyle('btn-warning')->addStyle('top')->icon('arrow-up')->render();
     $fbuttons .= button::init()->text('Ticket List')->url("/")->addStyle('btn-primary')->icon('arrow-left')->render();
     $widget = widget::init()->span(12)->icon('edit')->header($ticket['ticket_title'])->isTabs($tabs)->rightHeader($buttons)->footer($fbuttons)->render();
     $data = base::row($widget);
     $save = button::init()->formid('newReplyForm')->addStyle('mpost')->postVar('createReply')->text('Add Reply')->addStyle('btn-success')->icon('ok')->message('Submitting..')->id($ticket['id'])->render();
     $this->exportModal(modal::init()->id('createReplyModal')->header('Add Reply')->content($this->createReplyForm($ticket))->footer($save)->render());
     $saveFile = button::init()->formid('newUploadForm')->addStyle('mpost')->postVar('createAttachment')->text('Save Attachment')->addStyle('btn-success')->icon('ok')->message('Submitting..')->id($ticket['id'])->render();
     $this->exportModal(modal::init()->id('uploadFile')->header('Upload Attachment')->content($this->createUploadForm($ticket))->footer($saveFile)->render());
     $this->export($data);
     $this->exportjs(js::scrollBottom());
     $this->exportjs(js::scrollTop('top'));
 }
예제 #2
0
 private function customerMain()
 {
     // Show tabs for all queues the agent has access to based on access level.
     $headers = ['#', 'Subject', 'Status', 'Last Updated', 'Assigned', 'Queue'];
     $tickets = $this->query("SELECT * from tickets WHERE company_id='{$this->company->id}' and ticket_isclosed = false");
     $rows = [];
     foreach ($tickets as $ticket) {
         $rows[] = [$ticket['id'], "<a href='/ticket/{$ticket['id']}/'>{$ticket['ticket_title']}</a>", $ticket['ticket_status'], $this->fbTime($ticket['ticket_lastupdated']), $ticket['ticket_assigned'] ? $this->getUserByID($ticket['ticket_assigned']) : "Awaiting Assignment", $this->returnFieldFromTable("queue_name", "queues", "id='{$ticket['queue_id']}'")];
     }
     $table = table::init()->headers($headers)->rows($rows)->render();
     $createTicket = button::init()->isModalLauncher()->url('#newTicket')->text('Create New Ticket')->addStyle('btn-inverse')->icon('tasks')->render();
     $widget = widget::init()->span(12)->header('Ticket List')->content($table)->isTable(true)->rightHeader($createTicket)->render();
     $data = base::row($widget);
     $save = button::init()->formid('newTicketForm')->addStyle('mpost')->postVar('createTicket')->text('Create Ticket')->addStyle('btn-success')->icon('ok')->render();
     $this->exportModal(modal::init()->id('newTicket')->header('Create New Ticket')->content($this->createTicketForm())->footer($save)->render());
     return $data;
 }
예제 #3
0
 public function showInvoices()
 {
     $nav = $this->billingNav('invoices');
     // Default to Credit.
     $data = base::span(4, $nav);
     //Just a simple table with a download button for downloading the invoices.
     $headers = ['Ticket', 'Date', 'Description', 'Type', 'Download'];
     $rows = [];
     $transactions = $this->query("SELECT * from transactions WHERE company_id='{$this->company->id}'");
     foreach ($transactions as $transaction) {
         switch ($transaction['transaction_source']) {
             case 'stripe':
                 $source = "Credit Card";
                 break;
             case 'dwolla':
                 $source = "Checking Draft";
                 break;
             case 'check':
                 $source = "Posted Check";
                 break;
             case 'cash':
                 $source = "Cash";
                 break;
         }
         $row = ["<a href='/ticket/{$transaction['ticket_id']}/'>{$transaction['ticket_id']}</a>", date("m/d/y", $transaction['transaction_ts']), $transaction['transaction_desc'], $source, button::init()->url("/billing/invoice/{$transaction['id']}/")->text("Download Invoice")->addStyle('btn-small')->addStyle('btn-info')->icon('arrow-down')->render()];
         $rows[] = $row;
     }
     $table = table::init()->rows($rows)->headers($headers)->render();
     $data .= widget::init()->span(8)->isTable()->header("Processed Transactions")->content($table)->render();
     $data = base::row($data);
     $this->export($data);
 }
예제 #4
0
 public function listClients()
 {
     // At a glance - Let's view the client's basic info, If you can see billing, then show subscription
     // and show total amount collected.  Put in a datatable so we can search.
     $headers = ["Client", "Address", "VIP", "Tickets"];
     if ($this->canSeeBilling()) {
         $billing = ['Subscription', 'Total Income'];
         $headers = array_merge($headers, $billing);
     }
     $rows = [];
     $companies = $this->query("SELECT * from companies ORDER by company_since DESC");
     foreach ($companies as $company) {
         $tcontent = null;
         $ticks = $this->query("SELECT id,ticket_title FROM tickets WHERE company_id='{$company['id']}' ORDER by ticket_opents DESC LIMIT 10");
         foreach ($ticks as $tick) {
             $tcontent .= "<a href='/ticket/{$tick['id']}/'>{$tick['ticket_title']}</a><br/>";
         }
         $ticketblock = base::popover("Ticket History", $tcontent, 'right');
         $row = ["<a href='/client/{$company['id']}/'>{$company['company_name']}</a>", "{$company['company_address']}, {$company['company_city']}, {$company['company_state']}", $company['company_vip'] ? "Yes" : "No", "<a href='#' {$ticketblock}>" . $this->returnCountFromTable("tickets", "company_id='{$company['id']}'") . "</a>"];
         if ($this->canSeeBilling()) {
             $plan = $this->query("SELECT * from plans WHERE id='{$company['company_plan']}'", true)[0];
             if (!$plan) {
                 $plandata = "No Subscription";
             } else {
                 $plandata = "{$plan['plan_name']} ({$plan['plan_amount']})";
             }
             $ttl = 0;
             $transactions = $this->query("SELECT transaction_amount FROM transactions WHERE company_id='{$company['id']}'");
             foreach ($transactions as $transaction) {
                 $ttl += $transaction['transaction_amount'];
             }
             $ttl = "\$" . number_format($ttl, 2);
             $new = [$plandata, $ttl];
             $row = array_merge($row, $new);
         }
         $rows[] = $row;
     }
     $this->exportJS(js::datatable('clientList'));
     $addButton = button::init()->text("Add Account")->icon('plus')->addStyle('btn-success')->url('/clients/create/')->render();
     $table = table::init()->headers($headers)->rows($rows)->id('clientList')->render();
     $widget = widget::init()->header("Customer List")->content($table)->isTable()->icon('user')->rightHeader($addButton)->render();
     $this->export(base::row($widget));
 }
예제 #5
0
 public function showTransactionLog()
 {
     $data = base::span(4, $this->adminNav('billing'));
     $headers = ['Merchant ID', 'Date', 'Amount', 'Fee', 'Net', 'Merchant', 'Description', 'Ticket', 'Company'];
     $transactions = $this->query("SELECT * from transactions ORDER by transaction_ts DESC");
     $rows = [];
     foreach ($transactions as $transaction) {
         $rows[] = [$transaction['transaction_merchant_id'], date("m/d/y h:ia", $transaction['transaction_ts']), number_format($transaction['transaction_amount'], 2), number_format($transaction['transaction_fee'], 2), number_format($transaction['transaction_net'], 2), $transaction['transaction_source'], $transaction['transaction_desc'], "<a href='/ticket/{$transaction['ticket_id']}/'>{$transaction['ticket_id']}</a>", $this->getCompanyById($transaction['company_id'])];
     }
     $table = table::init()->id('tlog')->headers($headers)->rows($rows)->render();
     $data .= widget::init()->span(6)->header('Transaction Log')->content($table)->icon('credit-card')->istable(true)->render();
     $this->exportjs(js::datatable('tlog', 50));
     $headers = ['Payout Schedule', 'Amount'];
     $rows = [];
     $now = time();
     $transfers = $this->query("SELECT * from transfers WHERE transfer_ts > {$now} ORDER by transfer_ts DESC");
     foreach ($transfers as $transfer) {
         $rows[] = [$this->fbTime($transfer['transfer_ts']), number_format($transfer['transfer_amt'] / 100, 2)];
     }
     $table = table::init()->headers($headers)->rows($rows)->render();
     $data .= widget::init()->span(2)->header('Payout Schedule')->icon('truck')->content($table)->istable(true)->render();
     $this->export(base::row($data, true));
 }