mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 03:01:32 +00:00
update dockerfiles based on latest streamline image
The latest images incorporate all changes previously added by the dockerfiles. The arm image however is still missing/unreliable from the registry and must be built independently.
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is inspired by Builder from Laravel ChartJS - Brian Faust
|
||||
*/
|
||||
|
||||
namespace Fx3costa\LaravelChartJs;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class Builder
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $charts = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $defaults = [
|
||||
'datasets' => [],
|
||||
'labels' => [],
|
||||
'type' => 'line',
|
||||
'options' => [],
|
||||
'size' => ['width' => null, 'height' => null]
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $types = [
|
||||
'bar',
|
||||
'horizontalBar',
|
||||
'bubble',
|
||||
'scatter',
|
||||
'doughnut',
|
||||
'line',
|
||||
'pie',
|
||||
'polarArea',
|
||||
'radar'
|
||||
];
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
public function name($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->charts[$name] = $this->defaults;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $element
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function element($element)
|
||||
{
|
||||
return $this->set('element', $element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $labels
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function labels(array $labels)
|
||||
{
|
||||
return $this->set('labels', $labels);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $datasets
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function datasets(array $datasets)
|
||||
{
|
||||
return $this->set('datasets', $datasets);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function type($type)
|
||||
{
|
||||
if (!in_array($type, $this->types)) {
|
||||
throw new \InvalidArgumentException('Invalid Chart type.');
|
||||
}
|
||||
return $this->set('type', $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $size
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function size($size)
|
||||
{
|
||||
return $this->set('size', $size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
public function options(array $options)
|
||||
{
|
||||
foreach ($options as $key => $value) {
|
||||
$this->set('options.' . $key, $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|array $optionsRaw
|
||||
* @return \self
|
||||
*/
|
||||
public function optionsRaw($optionsRaw)
|
||||
{
|
||||
if (is_array($optionsRaw)) {
|
||||
$this->set('optionsRaw', json_encode($optionsRaw, true));
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->set('optionsRaw', $optionsRaw);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$chart = $this->charts[$this->name];
|
||||
|
||||
return view('chart-template::chart-template')
|
||||
->with('datasets', $chart['datasets'])
|
||||
->with('element', $this->name)
|
||||
->with('labels', $chart['labels'])
|
||||
->with('options', isset($chart['options']) ? $chart['options'] : '')
|
||||
->with('optionsRaw', isset($chart['optionsRaw']) ? $chart['optionsRaw'] : '')
|
||||
->with('type', $chart['type'])
|
||||
->with('size', $chart['size']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function get($key)
|
||||
{
|
||||
return Arr::get($this->charts[$this->name], $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $value
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
private function set($key, $value)
|
||||
{
|
||||
Arr::set($this->charts[$this->name], $key, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Vendored
Executable
+37
@@ -0,0 +1,37 @@
|
||||
<?php namespace Fx3costa\LaravelChartJs\Providers;
|
||||
|
||||
use Fx3costa\LaravelChartJs\Builder;
|
||||
use Fx3costa\LaravelChartJs\ChartBar;
|
||||
use Fx3costa\LaravelChartJs\ChartLine;
|
||||
use Fx3costa\LaravelChartJs\ChartPieAndDoughnut;
|
||||
use Fx3costa\LaravelChartJs\ChartRadar;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ChartjsServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Array with colours configuration of the chartjs config file
|
||||
* @var array
|
||||
*/
|
||||
protected $colours = [];
|
||||
|
||||
public function boot()
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'chart-template');
|
||||
$this->colours = config('chartjs.colours');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind('chartjs', function() {
|
||||
return new Builder();
|
||||
});
|
||||
}
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
<canvas id="{!! $element !!}" width="{!! $size['width'] !!}" height="{!! $size['height'] !!}">
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
(function() {
|
||||
"use strict";
|
||||
var ctx = document.getElementById("{!! $element !!}");
|
||||
window.{!! $element !!} = new Chart(ctx, {
|
||||
type: '{!! $type !!}',
|
||||
data: {
|
||||
labels: {!! json_encode($labels) !!},
|
||||
datasets: {!! json_encode($datasets) !!}
|
||||
},
|
||||
@if(!empty($optionsRaw))
|
||||
options: {!! $optionsRaw !!}
|
||||
@elseif(!empty($options))
|
||||
options: {!! json_encode($options) !!}
|
||||
@endif
|
||||
});
|
||||
})();
|
||||
});
|
||||
</script>
|
||||
</canvas>
|
||||
Reference in New Issue
Block a user