2017 © Pedro Peláez
 

yii2-extension schedule-widget-yii2

Wrapper for angular-gantt

image

datalayerru/schedule-widget-yii2

Wrapper for angular-gantt

  • Thursday, September 1, 2016
  • by SergioMadness
  • Repository
  • 1 Watchers
  • 0 Stars
  • 408 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

ScheduleWidgetYII2

Yii2 widget. Wrapper for angular-gantt, (*1)

Composer

ScheduleWidgetYII2 is available through composer, (*2)

composer require professionalweb/schedule-widget-yii2 "dev-master"

Alternatively you can add the following to the require section in your composer.json manually:, (*3)

"professionalweb/schedule-widget-yii2": "dev-master"

Run composer update afterwards., (*4)

In your PHP project

Data

Example:, (*5)

use professionalweb\ScheduleWidget\ScheduleWidget;

echo ScheduleWidget::widget([
    'clientOptions' => [
        'daily' => 'true', 
        'column-magnet' => 'column', 
        'time-frames-magnet' => false
    ],
    'plugins' => [
        ScheduleWidget::PLUGIN_MOVABLE => [],
        ScheduleWidget::PLUGIN_TABLE => [
            'headers' => [
                'model.name' => 'Name'
            ]
        ], 
        ScheduleWidget::PLUGIN_TOOLTIP => []
    ],
    'events' => [
        ScheduleWidget::EVENT_TASK_MOVEEND => new JsExpression('function(task){'
                .'console.log(task.row.model);'
                .'}')
    ],
    'data' => '[
        {"name":"Row №1","sortable":"false","tasks":[]},
        {"name":"Row №2","sortable":"false","tasks":[]},
        {"name":"Row №3","sortable":"false","tasks":[
            {"name":"Task №1","from":"2015 04 16","to":"2015 04 23"}
          ]
        }
      ]'
]);

Or you can use wrappers for data preparation, (*6)

$result = [];

$eventRow       = new Row();
$eventRow->name = Yii::t('app', 'Rent');
$result[]       = $eventRow;
foreach (Room::find()->all() as $room) {
    $rowRent         = new Row();
    $rowRent->name   = $room->ROOM_NUMBER;
    $rowRent->parent = $eventRow->name;
    foreach (Event::find()->andWhere(['ROOM_ID' => $room->id)->all() as $event) {
        $task          = new Task();
        $task->name    = $event->CLIENT_NAME;
        $task->from    = Yii::$app->formatter->asDate($event->START_DATE,
                'Y-MM-dd');
        $task->to      = Yii::$app->formatter->asDate($event->END_DATE,
                'Y-MM-dd');
        $task->classes = ['event-row'];

        $rowRent->tasks[] = $task;
    }

    $result[] = $rowRent;
}

Events

'events' => [
    ScheduleWidget::EVENT_TASK_ROW_CHANGE => new JsExpression('function(task){'
            .'if(task.row.model.parent===\'Rent\') {'
            .'task.$element.addClass(\'event-row\');'
            .'task.$element.removeClass(\'request-row\');'
            .'} else {'
            .'task.$element.removeClass(\'event-row\');'
            .'task.$element.addClass(\'request-row\');'
            .'}'
            .'}'),
    ScheduleWidget::EVENT_TASK_DBLCLICK => new JsExpression('function(task){console.log(task);}')
]

Also included

HTMLFilter for angular., (*7)

Example:, (*8)

ScheduleWidget::PLUGIN_TOOLTIP => [
    'date-format'=>'\'DD.MM.YYYY\'',
    'content' => '\'<div ng-bind-html="task.model.name | unsafe"></div>{{getFromLabel() +" - "+getToLabel()}}\''
],

Dependencies

The MIT License

The MIT License (MIT), (*9)

Copyright (c) 2016 Sergey Zinchenko, Professional web, (*10)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:, (*11)

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software., (*12)

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE., (*13)

The Versions

01/09 2016

dev-master

9999999-dev

Wrapper for angular-gantt

  Sources   Download

MIT

The Requires

  • bower-asset/angular-ui-tree 2.1.5
  • bower-asset/moment-range ~1
  • yiisoft/yii2 ^2.0
  • bower-asset/angular-latest 1.5.8
  • bower-asset/css-element-queries 0.3.2

 

yii2 angular-gantt gantt diagramm professional web

01/09 2016

0.5.6

0.5.6.0

Wrapper for angular-gantt

  Sources   Download

MIT

The Requires

  • yiisoft/yii2 ^2.0
  • bower-asset/angular-latest 1.5.8
  • bower-asset/angular-ui-tree 2.1.5
  • bower-asset/moment-range ~1
  • bower-asset/css-element-queries 0.3.2

 

yii2 angular-gantt gantt diagramm professional web

01/09 2016

dev-dev

dev-dev

Wrapper for angular-gantt

  Sources   Download

MIT

The Requires

  • bower-asset/angular-ui-tree 2.1.5
  • bower-asset/moment-range ~1
  • yiisoft/yii2 ^2.0
  • bower-asset/angular-latest 1.5.8
  • bower-asset/css-element-queries 0.3.2

 

yii2 angular-gantt gantt diagramm professional web

20/06 2016

0.5.5

0.5.5.0

Wrapper for angular-gantt

  Sources   Download

MIT

The Requires

  • yiisoft/yii2 *
  • bower-asset/angular-latest *
  • bower-asset/angular-ui-tree 2.1.5
  • bower-asset/jquery 2.1.*@stable | 1.11.*@stable
  • bower-asset/moment-range ~1
  • bower-asset/css-element-queries *

 

yii2 angular-gantt gantt diagramm professional web

09/03 2016

0.5.4

0.5.4.0

Wrapper for angular-gantt

  Sources   Download

MIT

The Requires

  • yiisoft/yii2 *
  • bower-asset/angular-latest *
  • bower-asset/angular-ui-tree 2.1.5
  • bower-asset/jquery 2.1.*@stable | 1.11.*@stable
  • bower-asset/moment-range ~1
  • bower-asset/css-element-queries *

 

yii2 angular-gantt gantt diagramm professional web

29/04 2015

0.5.3

0.5.3.0

Wrapper for angular-gantt

  Sources   Download

MIT

The Requires

  • yiisoft/yii2 *
  • bower-asset/angular ~1.4.0
  • bower-asset/angular-ui-tree 2.1.5
  • bower-asset/jquery 2.1.*@stable | 1.11.*@stable
  • bower-asset/moment-range ~1

 

yii2 angular-gantt gantt diagramm

24/04 2015

0.4.3

0.4.3.0

Wrapper for angular-gantt

  Sources   Download

MIT

The Requires

  • yiisoft/yii2 *
  • bower-asset/angular ~1.4.0
  • bower-asset/angular-ui-tree 2.1.5
  • bower-asset/jquery 2.1.*@stable | 1.11.*@stable
  • bower-asset/moment-range ~1

 

yii2 angular-gantt gantt diagramm