예제 #1
0
 /**
  * The created at tag line accessor.
  *
  * @return string
  */
 public function getCreatedAtTagLineAttribute()
 {
     $user = $this->user->name;
     $daysAgo = $this->created_at_human;
     $created = $this->resolution ? "created resolution {$daysAgo}" : "commented {$daysAgo}";
     $line = HTML::create('span', $created, ['class' => 'hidden-xs']);
     return sprintf('<strong>%s</strong> %s', $user, $line);
 }
예제 #2
0
 /**
  * Returns a label if the current users session is open,
  * otherwise it will return the out datetime.
  *
  * @return string
  */
 public function getOutLabel()
 {
     if (is_null($this->out)) {
         return HTML::create('span', 'Open', ['class' => 'label label-success']);
     } else {
         return $this->out;
     }
 }
예제 #3
0
 /**
  * Returns a new table for all services.
  *
  * @param Service $service
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function table(Service $service)
 {
     $service = $service->with('records');
     return $this->table->of('services', function (TableGrid $table) use($service) {
         $table->with($service)->paginate($this->perPage);
         $table->column('name', function (Column $column) {
             $column->value = function (Service $service) {
                 return link_to_route('services.records.index', $service->name, [$service->id]);
             };
         });
         $table->column('last_record_status')->label('Current Status');
         $table->column('description', function (Column $column) {
             $column->value = function (Service $service) {
                 if ($service->description) {
                     return $service->description;
                 }
                 return HTML::create('em', 'None');
             };
         });
     });
 }
 /**
  * Returns a new table of all statuses.
  *
  * @param Status $status
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function table(Status $status)
 {
     return $this->table->of('work-orders.statuses', function (TableGrid $table) use($status) {
         $table->with($status)->paginate($this->perPage);
         $table->column('Status', function (Column $column) {
             $column->value = function (Status $status) {
                 return link_to_route('maintenance.work-orders.statuses.edit', $status->getLabel(), [$status->getKey()]);
             };
         });
         $table->column('created_at');
         $table->column('created_by', function (Column $column) {
             $column->value = function (Status $status) {
                 if ($status->user instanceof User) {
                     return $status->user->getRecipientName();
                 } else {
                     return HTML::create('em', 'None');
                 }
             };
         });
     });
 }
 /**
  * Returns a new table of all movements for the specified inventory stock.
  *
  * @param Inventory      $item
  * @param InventoryStock $stock
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function tableMovements(Inventory $item, InventoryStock $stock)
 {
     $movements = $stock->movements();
     return $this->table->of('inventory.stocks.movements', function (TableGrid $table) use($item, $movements) {
         $table->with($movements)->paginate($this->perPage);
         $table->pageName = 'stock-movements';
         $table->column('before');
         $table->column('after');
         $table->column('change');
         $table->column('cost');
         $table->column('reason');
         $table->column('Change By', function (Column $column) {
             return $column->value = function (InventoryStockMovement $movement) {
                 if ($movement->user instanceof User) {
                     return $movement->user->getRecipientName();
                 }
                 return HTML::create('em', 'Unknown');
             };
         });
         $table->column('Change On', 'created_at');
     });
 }
예제 #6
0
 /**
  * Returns an html label with the color of the status.
  *
  * @return string
  */
 public function getLabel()
 {
     $color = $this->color;
     return HTML::create('span', $this->name, ['class' => "label label-{$color}"]);
 }
예제 #7
0
 /**
  * Creates a check mark or x icon depending if
  * bool is true or false.
  *
  * @param bool|false $bool
  * @param string     $text
  *
  * @return string
  */
 protected function createCheck($bool = false, $text = '')
 {
     if ($bool) {
         $check = HTML::create('i', '', ['class' => 'fa fa-check']);
         return HTML::raw("<span class='label label-success'>{$check} {$text}</span>");
     } else {
         $check = HTML::create('i', '', ['class' => 'fa fa-times']);
         return HTML::raw("<span class='label label-danger'>{$check} {$text}</span>");
     }
 }
예제 #8
0
 /**
  * Returns an HTML label for the work orders completed at date.
  *
  * @return string
  */
 public function getCompletedAtLabel()
 {
     if ($this->isComplete()) {
         $class = 'label label-success';
         $icon = 'fa fa-check';
         $message = $this->completed_at;
     } else {
         $class = 'label label-danger';
         $icon = 'fa fa-times';
         $message = 'No report has been created.';
     }
     $icon = HTML::create('i', '', ['class' => $icon]);
     return HTML::raw("<span class='{$class}'>{$icon} {$message}</span>");
 }
예제 #9
0
파일: Guide.php 프로젝트: stevebauman/ithub
 /**
  * Returns an HTML string of the published state of the current guide.
  *
  * @return string
  */
 public function getPublishedLabelAttribute()
 {
     $date = $this->published_on_human;
     $published = $this->published ? "{$date}" : 'No';
     $class = 'label ' . ($this->published ? 'label-success' : 'label-danger');
     return HTML::create('span', $published, compact('class'));
 }
예제 #10
0
 /**
  * Returns a new table of all revisions.
  *
  * @param string    $for
  * @param MorphMany $revisions
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function tableHistory($for, MorphMany $revisions)
 {
     return $this->table->of("{$for}.revisions", function (TableGrid $table) use($revisions) {
         $table->with($revisions)->paginate($this->perPage);
         $table->pageName = 'history';
         $table->column('user_responsible', function (Column $column) {
             $column->value = function (Revision $revision) {
                 $user = $revision->getUserResponsible();
                 if ($user instanceof User) {
                     return $user->getRecipientName();
                 }
                 return HTML::create('em', 'None');
             };
         });
         $table->column('changed', function (Column $column) {
             $column->value = function (Revision $revision) {
                 return $revision->getColumnName();
             };
         });
         $table->column('from', function (Column $column) {
             $column->value = function (Revision $revision) {
                 $old = $revision->getOldValue();
                 if (is_null($old)) {
                     return HTML::create('em', 'None');
                 }
                 return $old;
             };
         });
         $table->column('to', function (Column $column) {
             $column->value = function (Revision $revision) {
                 $new = $revision->getNewValue();
                 if (is_null($new)) {
                     return HTML::create('em', 'None');
                 }
                 return $new;
             };
         });
         $table->column('On', 'created_at');
     });
 }
예제 #11
0
 /**
  * The status label accessor.
  *
  * @return string
  */
 public function getStatusLabelAttribute()
 {
     return (string) HTML::create('span', $this->title, ['class' => "label label-{$this->color}"]);
 }
예제 #12
0
파일: Label.php 프로젝트: stevebauman/ithub
 /**
  * Displays a large version of the HTML label.
  *
  * @return string
  */
 public function getDisplayLargeAttribute()
 {
     return HTML::create('span', $this->display, ['class' => 'label-large']);
 }
예제 #13
0
 /**
  * Returns a large variant of the users label.
  *
  * @return string
  */
 public function labelLarge()
 {
     return HTML::create('span', $this->label(), ['class' => 'label-large']);
 }