/**
  * Retrieves the current active board ID for this session
  * if not found an error is thrown
  * If found returns the board active record matching the ID
  *
  * @throws yii\web\NotFoundHttpException
  * @return \yii\db\ActiveRecord
  */
 public static function getActiveboard()
 {
     $session = Yii::$app->session;
     $currentBoardId = $session->get('currentBoardId');
     if ($currentBoardId == self::NO_ACTIVE_BOARD_STATUS_TEST) {
         throw new NotFoundHttpException(self::NO_ACTIVE_BOARD_MESSAGE);
     } else {
         Ticket::restrictQueryToBoard($currentBoardId);
         return self::findOne($currentBoardId);
     }
 }
Beispiel #2
0
 public function actionIndex()
 {
     $model = $this->findModel(Yii::$app->user->id);
     $laborTally = [];
     $laborTally['Hourly'] = Labor::find()->hourly()->tech($model->contact_id)->total();
     $laborTally['Proactive'] = Labor::find()->hourly(false)->tech($model->contact_id)->total();
     $openTickets = new ActiveDataProvider(['query' => Ticket::find()->active()->joinWith('invoice.location.client', false), 'pagination' => ['pageSize' => 10], 'sort' => ['defaultOrder' => ['status_id' => SORT_ASC, 'id' => SORT_ASC]]]);
     $openTickets->sort->attributes['location_id'] = ['asc' => [Client::tableName() . '.name' => SORT_ASC, Location::tableName() . '.name' => SORT_ASC], 'desc' => [Client::tableName() . '.name' => SORT_DESC, Location::tableName() . '.name' => SORT_DESC]];
     Url::remember();
     return $this->render('index', ['model' => $model, 'laborTally' => $laborTally, 'openTickets' => $openTickets]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PurchasedItem::find()->joinWith('ticket');
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['ticket_id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['item_type_id' => $this->item_type_id]);
     $query->andFilterWhere(['like', 'item_name', $this->item_name])->andFilterWhere(['or', ['ticket_id' => $this->ticket_id], ['like', Ticket::tableName() . '.title', $this->ticket_id]]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Ticket::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ticket_id' => $this->ticket_id, 't_date_time' => $this->t_date_time, 'case_id' => $this->case_id]);
     $query->andFilterWhere(['like', 'ticketnumber', $this->ticketnumber])->andFilterWhere(['like', 'ticket_note', $this->ticket_note])->andFilterWhere(['like', 'ticket_name', $this->ticket_name]);
     return $dataProvider;
 }
Beispiel #5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Ticket::find()->current()->joinWith(['invoice.location', 'invoice.location.client']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 50], 'sort' => ['defaultOrder' => ['status_id' => SORT_ASC]]]);
     $dataProvider->sort->attributes['location_id'] = ['asc' => [Client::tableName() . '.name' => SORT_ASC, Location::tableName() . '.name' => SORT_ASC], 'desc' => [Client::tableName() . '.name' => SORT_DESC, Location::tableName() . '.name' => SORT_DESC]];
     $dataProvider->sort->attributes['status_id'] = ['asc' => [Ticket::tableName() . '.status_id' => SORT_DESC], 'desc' => [Ticket::tableName() . '.status_id' => SORT_ASC]];
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere([Location::tableName() . '.id' => $this->location_id, Ticket::tableName() . '.status_id' => $this->status_id, Ticket::tableName() . '.priority_id' => $this->priority_id, Ticket::tableName() . '.bill_type_id' => $this->bill_type_id]);
     $query->andFilterWhere(['like', Ticket::tableName() . '.id', $this->id]);
     return $dataProvider;
 }
Beispiel #6
0
 /**
  * Creates a new Invoice model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @param integer $id  The Current Invoice ID to create the new invoice from
  * @return mixed
  */
 public function actionCreate($id)
 {
     $currentInvoice = $this->findModel($id, false);
     $ticketsIds = ArrayHelper::getColumn($currentInvoice->getTickets()->closed(true)->all(), 'id');
     $billableLaborTotal = Labor::find()->ticket($ticketsIds)->hourly()->total(true);
     $purchaseTotal = PurchasedItem::find()->ticket($ticketsIds)->total();
     $travelFeeTotal = Travel::find()->invoice($id)->before()->totalFee();
     $model = new Invoice();
     $model->loadDefaultValues();
     $model->location_id = $currentInvoice->location_id;
     $model->total = $billableLaborTotal + $purchaseTotal + $travelFeeTotal;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Ticket::updateAll(['invoice_id' => $model->id], ['id' => $ticketsIds]);
         Schedule::updateAll(['invoice_id' => $model->id], ['and', 'invoice_id=:invoice_id', 'start_time<:start_time'], [':invoice_id' => $model->location_id, ':start_time' => date(Invoice::BILLING_CUTOFF_DAY)]);
         return $this->redirect(['view', 'id' => $model->id]);
     } elseif (!Yii::$app->request->isPost) {
         $model->load(Yii::$app->request->get());
     }
     if (Yii::$app->request->isAjax) {
         return $this->renderAjax('_form', ['model' => $model]);
     }
     return $this->render('create', ['model' => $model]);
 }
Beispiel #7
0
 /**
  * @return TicketQuery
  */
 public function getTicket()
 {
     return $this->hasOne(Ticket::className(), ['id' => 'ticket_id'])->via('note')->inverseOf('labors');
 }
?>
</p>
                        <a href="<?php 
echo Url::to(['/sign-in/profile']);
?>
">
                            <i class="fa fa-circle text-success"></i>
                            <?php 
echo Yii::$app->formatter->asDatetime(time());
?>
                        </a>
                    </div>
                </div>
                <!-- sidebar menu: : style can be found in sidebar.less -->
                <?php 
echo Menu::widget(['options' => ['class' => 'sidebar-menu'], 'linkTemplate' => '<a href="{url}">{icon}<span>{label}</span>{right-icon}{badge}</a>', 'submenuTemplate' => "\n<ul class=\"treeview-menu\">\n{items}\n</ul>\n", 'activateParents' => true, 'items' => [['label' => Yii::t('backend', 'Main'), 'options' => ['class' => 'header']], ['label' => Yii::t('backend', 'Timeline'), 'icon' => '<i class="fa fa-bar-chart-o"></i>', 'url' => ['/timeline-event/index'], 'badge' => TimelineEvent::find()->today()->count(), 'badgeBgClass' => 'label-success'], ['label' => Yii::t('backend', 'Content'), 'url' => '#', 'icon' => '<i class="fa fa-edit"></i>', 'options' => ['class' => 'treeview'], 'items' => [['label' => Yii::t('backend', 'Static pages'), 'url' => ['/page/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'Articles'), 'url' => ['/article/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'Article Categories'), 'url' => ['/article-category/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'Text Widgets'), 'url' => ['/widget-text/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'Menu Widgets'), 'url' => ['/widget-menu/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'Carousel Widgets'), 'url' => ['/widget-carousel/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>']]], ['label' => Yii::t('backend', 'TicketCenter'), 'icon' => '<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span>', 'url' => ['/t-center/index'], 'badge' => \common\models\Ticket::find()->where(array('status_id' => \common\models\TicketStatus::CREATED))->count(), 'badgeBgClass' => 'label-info'], ['label' => Yii::t('backend', 'System'), 'options' => ['class' => 'header']], ['label' => Yii::t('backend', 'Users'), 'icon' => '<i class="fa fa-users"></i>', 'url' => ['/user/index'], 'visible' => Yii::$app->user->can('administrator')], ['label' => Yii::t('backend', 'Tickets'), 'url' => '#', 'icon' => '<i class="fa fa-th"></i>', 'options' => ['class' => 'treeview'], 'items' => [['label' => Yii::t('backend', 'ticket_list'), 'url' => ['/ticket/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'ticket_cdate'), 'url' => ['/ticket-cdata/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'ticket_type'), 'url' => ['/ticket-type/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'ticket_topic'), 'url' => ['/ticket-topic/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'file'), 'url' => ['/file/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>']]], ['label' => Yii::t('backend', 'Other'), 'url' => '#', 'icon' => '<i class="fa fa-cogs"></i>', 'options' => ['class' => 'treeview'], 'items' => [['label' => Yii::t('backend', 'i18n'), 'url' => '#', 'icon' => '<i class="fa fa-flag"></i>', 'options' => ['class' => 'treeview'], 'items' => [['label' => Yii::t('backend', 'i18n Source Message'), 'url' => ['/i18n/i18n-source-message/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'i18n Message'), 'url' => ['/i18n/i18n-message/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>']]], ['label' => Yii::t('backend', 'Key-Value Storage'), 'url' => ['/key-storage/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'File Storage'), 'url' => ['/file-storage/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'Cache'), 'url' => ['/cache/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'File Manager'), 'url' => ['/file-manager/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'System Information'), 'url' => ['/system-information/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ['label' => Yii::t('backend', 'Logs'), 'url' => ['/log/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>', 'badge' => \backend\models\SystemLog::find()->count(), 'badgeBgClass' => 'label-danger']]]]]);
?>
            </section>
            <!-- /.sidebar -->
        </aside>

        <!-- Right side column. Contains the navbar and content of the page -->
        <aside class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                    <?php 
echo $this->title;
?>
                    <?php 
if (isset($this->params['subtitle'])) {
Beispiel #9
0
 /**
  * @param integer $invoice_id
  * @return $this
  */
 public function invoice($invoice_id)
 {
     $this->andWhere([Ticket::tableName() . '.invoice_id' => $invoice_id]);
     return $this;
 }
Beispiel #10
0
 /**
  * @return mixed
  */
 public function actionAjaxTickets()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $output = [];
     if (!empty($parents = Yii::$app->request->post('depdrop_parents'))) {
         $location_id = $parents[0];
         $tickets = Ticket::find()->location($location_id)->open()->all();
         foreach ($tickets as $ticket) {
             $output[] = ['id' => $ticket->id, 'name' => $ticket->fullName];
         }
     }
     return ['output' => empty($output) ? '' : $output];
 }
Beispiel #11
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTickets()
 {
     return $this->hasMany(Ticket::className(), ['task_id' => 'id'])->inverseOf('task');
 }
Beispiel #12
0
<div class="note-form">

    <?php 
$form = ActiveForm::begin(['layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data']]);
?>

    <div>
        <?php 
echo $form->errorSummary($model);
?>
        <?php 
$this->beginBlock('main');
?>
        <p>
            <?php 
echo $form->field($model, 'ticket_id')->dropDownList(\yii\helpers\ArrayHelper::map(\common\models\Ticket::find()->open()->with('invoice.location.client')->all(), 'id', 'fullName', 'invoice.location.fullName'), ['prompt' => '']);
?>

            <?php 
echo $form->field($model, 'body')->textarea(['rows' => 8]);
?>

            <?php 
echo $form->field($model, 'attachFile')->widget(\kartik\file\FileInput::className(), ['options' => ['accept' => 'image/*,audio/*,video/*,text/*,application/pdf'], 'pluginOptions' => ['browseClass' => 'btn btn-info btn-xs', 'showCaption' => false, 'showRemove' => false, 'showUpload' => false, 'initialPreview' => [$model->hasAttachment() ? Yii::$app->formatter->asFile($model->attachment, ['attachment', 'id' => $model->id]) : null]]]);
?>

            <?php 
if (!$model->hasLabor()) {
    echo $form->field($model, 'public')->checkbox([], false);
}
?>
Beispiel #13
0
<?php

use kartik\datetime\DateTimePicker;
use kartik\depdrop\DepDrop;
use kartik\select2\Select2;
use kartik\tabs\TabsX;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model common\models\Schedule */
/* @var $note common\models\Note */
/* @var $ticket common\models\Ticket */
/* @var $remote boolean */
/* @var $form yii\bootstrap\ActiveForm */
$openTickets = yii\helpers\ArrayHelper::map(\common\models\Ticket::find()->location($model->invoice_id)->open()->all(), 'id', 'fullName');
?>

<div class="schedule-form">

    <?php 
$form = ActiveForm::begin(['layout' => 'horizontal']);
?>

    <div>
        <?php 
echo $form->errorSummary([$model, $note, $ticket]);
?>
        <?php 
$this->beginBlock('main');
?>
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTicket()
 {
     return $this->hasOne(Ticket::className(), ['ticket_id' => 'ticket_id']);
 }
Beispiel #15
0
 /**
  * @return TicketQuery
  */
 public function getTickets()
 {
     return $this->hasMany(Ticket::className(), ['opened_by' => 'id'])->inverseOf('openedBy');
 }
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\models\TicketHasTicketStatus */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="ticket-has-ticket-status-form">

    <?php 
$form = ActiveForm::begin();
?>

   

    <?php 
$ticket = Ticket::find()->all();
$listData = ArrayHelper::map($ticket, 'ticket_id', 'ticketnumber');
echo $form->field($model, 'ticket_id')->dropDownList($listData, ['prompt' => 'Select Ticket Number']);
?>

    

    <?php 
$ticket_status = TicketStatus::find()->all();
$listData = ArrayHelper::map($ticket_status, 'ticket_status_id', 'status_name');
echo $form->field($model, 'ticket_status_id')->dropDownList($listData, ['prompt' => 'Select Ticket Status']);
?>

    
   <?php 
$employee = Employee::find()->all();
Beispiel #17
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['invoice_id', 'tech_id', 'start_time', 'duration', 'ticketIds'], 'required', 'on' => self::SCENARIO_DEFAULT], [['invoice_id', 'start_time', 'duration'], 'required', 'on' => self::SCENARIO_REMOTE], [['invoice_id', 'tech_id'], 'integer'], [['onSite'], 'boolean'], [['start_time'], 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], [['duration'], 'integer', 'min' => '15'], [['description'], 'string'], [['ticketIds'], 'each', 'rule' => ['integer']], [['invoice_id'], 'exist', 'targetClass' => Location::className(), 'targetAttribute' => 'id'], [['tech_id'], 'exist', 'targetClass' => Tech::className(), 'targetAttribute' => 'contact_id'], [['ticketIds'], 'each', 'rule' => ['exist', 'targetClass' => Ticket::className(), 'targetAttribute' => 'id']]];
 }
 /**
  * Query to find all Completed Tickets
  *
  * @return yii\db\QueryInterface
  */
 public function findCompleted()
 {
     return Ticket::find()->where(['<', 'column_id', 0])->orderBy(['updated_at' => SORT_DESC]);
 }
 /**
  * @return \yii\db\ActiveRecord
  */
 public function getTickets()
 {
     return $this->hasMany(Ticket::className(), ['column_id' => 'id', 'board_id' => 'board_id'])->orderBy('ticket_order')->all();
 }
Beispiel #20
0
 /**
  * @return TicketQuery
  */
 public function getTicket()
 {
     return $this->hasOne(Ticket::className(), ['id' => 'ticket_id'])->inverseOf('purchasedItems');
 }
Beispiel #21
0
            <?php 
echo $form->field($model, 'invoice_id')->widget(\kartik\select2\Select2::className(), ['data' => \yii\helpers\ArrayHelper::map(\common\models\Location::find()->active()->all(), 'id', 'fullName'), 'options' => ['prompt' => '', 'id' => 'location-select']]);
?>

            <?php 
echo $form->field($model, 'tech_id')->dropDownList(yii\helpers\ArrayHelper::map(\common\models\Tech::find()->contact()->all(), 'contact_id', 'contact.name'), ['prompt' => '']);
?>

            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> New Ticket', ['ticket/create', 'close' => true, 'Ticket' => ['invoice_id' => $model->invoice_id]], ['id' => 'new-ticket-btn', 'class' => 'btn btn-success btn-xs pull-right', 'target' => '_blank']);
?>
            <?php 
echo Html::button('<span class="glyphicon glyphicon-refresh"></span>', ['class' => 'btn btn-default btn-xs pull-right', 'title' => 'Refresh tickets for selected location', 'onclick' => '$("#location-select").trigger("depdrop.change")']);
?>
            <?php 
echo $form->field($model, 'ticketIds')->widget(\kartik\depdrop\DepDrop::className(), ['type' => \kartik\depdrop\DepDrop::TYPE_SELECT2, 'data' => yii\helpers\ArrayHelper::map(\common\models\Ticket::find()->location($model->invoice_id)->open()->all(), 'id', 'fullName'), 'options' => ['multiple' => true], 'select2Options' => ['pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['location-select'], 'url' => Url::to(['/location/ajax-tickets']), 'placeholder' => false], 'pluginEvents' => ['depdrop.change' => 'function(event, id, value, count) {
                        console.log(event, id, value);
                        $("#new-ticket-btn").attr("href", "/ticket/create?close=true" + (value == null ? "" : ("&Ticket%5Binvoice_id%5D=" + value)));
                    }']]);
?>

            <?php 
echo $form->field($model, 'start_time')->widget(DateTimePicker::className(), ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:00', 'startDate' => date('Y-m-d'), 'initialDate' => date('Y-m-d H:00:00', strtotime('+1 hour')), 'todayHighlight' => true, 'showMeridian' => true, 'minuteStep' => 15, 'autoclose' => true]]);
?>

            <?php 
echo $form->field($model, 'duration')->input('number', ['min' => 15, 'step' => 5]);
?>

            <?php 
echo $form->field($model, 'onSite')->checkbox([], false);
Beispiel #22
0
 public function hourly($hourly = true)
 {
     $this->joinWith('note.ticket')->andWhere([\common\models\Ticket::tableName() . '.bill_type_id' => $hourly ? Ticket::BILL_HOURLY : Ticket::BILL_PROACTIVE]);
     return $this;
 }
Beispiel #23
0
 public function actionAjaxUnscheduled()
 {
     return $this->renderAjax('_unscheduled', ['unscheduled' => Ticket::find()->active()->unscheduled()->all()]);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTickets()
 {
     return $this->hasMany(Ticket::className(), ['case_id' => 'case_id']);
 }
 /**
  * Finds the Ticket model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Ticket the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Ticket::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #26
0
 /**
  * @return TicketQuery
  */
 public function getTickets()
 {
     return $this->hasMany(Ticket::className(), ['invoice_id' => 'id'])->via('invoices')->inverseOf('location');
 }