예제 #1
0
 /**
  * Displays a map of all open tickets
  * @return mixed
  */
 public function actionMap()
 {
     $tickets = ArrayHelper::map(Ticket::find()->active()->all(), 'id', 'fullName', 'invoice_id');
     $locations = Location::find()->where(['id' => array_keys($tickets)])->with('client')->all();
     Url::remember();
     return $this->render('map', ['locations' => $locations, 'tickets' => $tickets]);
 }
예제 #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 = 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;
 }
예제 #4
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;
 }
 /**
  * Lists all Ticket models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Ticket::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
예제 #6
0
파일: _form.php 프로젝트: jslight/helpdesk
<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);
}
?>
예제 #7
0
 public function actionAjaxUnscheduled()
 {
     return $this->renderAjax('_unscheduled', ['unscheduled' => Ticket::find()->active()->unscheduled()->all()]);
 }
예제 #8
0
파일: _form.php 프로젝트: jslight/helpdesk
            <?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);
예제 #9
0
?>
</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'])) {
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();
예제 #11
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');
?>
예제 #12
0
 /**
  * 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]);
 }
예제 #13
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];
 }
 public function actionList()
 {
     $dataProvider = new ActiveDataProvider(['query' => Ticket::find()->joinWith('cdata')->where(array('user_id' => Yii::$app->user->identity->id)), 'pagination' => array('pageSize' => 5)]);
     return $this->render('list', ['dataProvider' => $dataProvider]);
 }