|
@@ -1,5 +1,18 @@
|
|
|
@extends ('layouts/template')
|
|
|
@section('content')
|
|
|
+ <?php
|
|
|
+ $multiProView = !!request()->input('multi-pro');
|
|
|
+ $multiPros = [];
|
|
|
+ if(request()->input('multi-pro-uids')) {
|
|
|
+ $uids = explode(',', request()->input('multi-pro-uids'));
|
|
|
+ foreach ($uids as $uid) {
|
|
|
+ $multiPro = \App\Models\Pro::where('uid', $uid)->first();
|
|
|
+ if($multiPro) {
|
|
|
+ $multiPros[] = $multiPro;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ?>
|
|
|
<link rel="stylesheet" href="/jstree/themes/default/style.min.css" />
|
|
|
<script src="/jstree/jstree.min.js"></script>
|
|
|
<div class="mcp-theme-1">
|
|
@@ -62,16 +75,21 @@
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
- @if($statTree->pro_id)
|
|
|
- <a href="{{route('practice-management.statTrees.list')}}" class="text-decoration-none font-weight-bold text-primary ml-auto">
|
|
|
+ @if(!$multiProView)
|
|
|
+ <a href="{{ route('practice-management.statTrees.view.edit', $statTree) }}?multi-pro=1" class="text-decoration-none font-weight-bold text-primary ml-auto">
|
|
|
<i class="fa fa-users mr-1"></i>
|
|
|
Multi-Pro View
|
|
|
</a>
|
|
|
+ @else
|
|
|
+ <a href="{{ route('practice-management.statTrees.view.edit', $statTree) }}" class="text-decoration-none font-weight-bold text-primary ml-auto">
|
|
|
+ <i class="fa fa-edit mr-1"></i>
|
|
|
+ Edit View
|
|
|
+ </a>
|
|
|
@endif
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="card-body p-0 flex-grow-1">
|
|
|
- <div id="statTreeEdit-{{$statTree->id}}" class="row m-0 h-100">
|
|
|
+ <div id="statTreeEdit-{{$statTree->id}}" class="row m-0 h-100 {{$multiProView ? 'multi-pro-view' : ''}}">
|
|
|
|
|
|
<!-- clauses -->
|
|
|
<div class="col-3 p-0 h-100">
|
|
@@ -182,9 +200,9 @@
|
|
|
<label class="text-secondary text-sm mb-1">Field Type</label>
|
|
|
<select class="form-control form-control-sm" name="fieldType" required>
|
|
|
<option value="">-- select --</option>
|
|
|
- <option value="number">Number</option>
|
|
|
+ <option value="numeric">Number</option>
|
|
|
<option value="date">Date</option>
|
|
|
- <option value="string">String</option>
|
|
|
+ <option value="text">String</option>
|
|
|
<option value="bool">Boolean</option>
|
|
|
</select>
|
|
|
</div>
|
|
@@ -209,9 +227,9 @@
|
|
|
<label class="text-secondary text-sm mb-1">Field Type</label>
|
|
|
<select class="form-control form-control-sm" name="fieldType" required>
|
|
|
<option value="">-- select --</option>
|
|
|
- <option value="number">Number</option>
|
|
|
+ <option value="numeric">Number</option>
|
|
|
<option value="date">Date</option>
|
|
|
- <option value="string">String</option>
|
|
|
+ <option value="text">String</option>
|
|
|
<option value="bool">Boolean</option>
|
|
|
</select>
|
|
|
</div>
|
|
@@ -244,11 +262,27 @@
|
|
|
|
|
|
|
|
|
<!-- tree -->
|
|
|
- <div class="col-5 p-0 h-100 border-left border-right tree-column">
|
|
|
+ <div class="{{ !$multiProView ? 'col-5' : 'col-9' }} p-0 h-100 border-left border-right tree-column">
|
|
|
<div class="d-flex flex-column h-100">
|
|
|
<div class="d-flex align-items-center pl-2 height-35px border-bottom bg-light">
|
|
|
<h6 class="font-weight-bold m-0 text-secondary">{{$statTree->name}}</h6>
|
|
|
<span class="text-danger d-none if-changed ml-2 text-sm">(modified *)</span>
|
|
|
+ @if($multiProView)
|
|
|
+ <div moe class="ml-3">
|
|
|
+ <a href="#" start show>Add Pro</a>
|
|
|
+ <div url="/nop">
|
|
|
+ <div class="mb-2">
|
|
|
+ <select id="proUid" class="form-control input-sm" provider-search provider-type="hcp">
|
|
|
+ <option value="">--select--</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="d-flex align-items-center">
|
|
|
+ <button class="btn btn-sm btn-primary mr-2 btn-add-pro" type="button">Add</button>
|
|
|
+ <button class="btn btn-sm btn-default mr-2 border" type="button" cancel>Cancel</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ @endif
|
|
|
<a href="#" id="refresh-counts" class="ml-3">Refresh Counts</a>
|
|
|
<a href="#" class="tree-expand-all ml-3" title="Expand All"><i class="fa fa-angle-double-down text-secondary"></i></a>
|
|
|
<a href="#" class="tree-collapse-all ml-2" title="Collapse All"><i class="fa fa-angle-double-up text-secondary"></i></a>
|
|
@@ -258,79 +292,133 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flex-grow-1 overflow-overlay-on-hover">
|
|
|
- <div class="stat-tree-view overflow-auto" id="stat-tree-view-{{$statTree->id}}"></div>
|
|
|
+ @if(!$multiProView)
|
|
|
+ <div class="stat-tree-view overflow-auto" id="stat-tree-view-{{$statTree->id}}"></div>
|
|
|
+ @else
|
|
|
+ <div class="d-flex align-items-start">
|
|
|
+ <div class="">
|
|
|
+ <div class="multi-pro-view-stat-label">Stat</div>
|
|
|
+ <div class="stat-tree-view overflow-auto" id="stat-tree-view-{{$statTree->id}}"></div>
|
|
|
+ </div>
|
|
|
+ <div class="flex-grow-1">
|
|
|
+ <table class="table table-sm multi-pro-stats-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th {{$statTree->pro ? 'data-pro-uid="' . $statTree->pro->uid . '"' : ''}}>
|
|
|
+ <div class="pro-label" title="{{$statTree->pro ? $statTree->pro->name_display : 'Total'}}">{{$statTree->pro ? $statTree->pro->name_display : 'Total'}}</div>
|
|
|
+ </th>
|
|
|
+ @foreach($multiPros as $multiPro)
|
|
|
+ <th data-pro-uid="{{$multiPro->uid}}" count-required>
|
|
|
+ <div class="pro-label" title="{{$multiPro->name_display}}">{{$multiPro->name_display}}</div>
|
|
|
+ </th>
|
|
|
+ @endforeach
|
|
|
+ <th></th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ @foreach($linesFlat as $line)
|
|
|
+ <tr data-line-uid="{{$line->uid}}">
|
|
|
+ <td class="p-0">
|
|
|
+ <div class="count-label">
|
|
|
+ <div class="count">{{$line->last_refresh_count}}</div>
|
|
|
+ <div class="drop-percent">50% ⤵</div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ @foreach($multiPros as $multiPro)
|
|
|
+ <td class="p-0" data-pro-uid="{{$multiPro->uid}}">
|
|
|
+ <div class="count-label">
|
|
|
+ <div class="count">0</div>
|
|
|
+ <div class="drop-percent">0% ⤵</div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ @endforeach
|
|
|
+ <td></td>
|
|
|
+ </tr>
|
|
|
+ @endforeach
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ @endif
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<!-- selected line properties -->
|
|
|
- <div class="col-4 p-0 h-100 setup-column d-none" id="line-properties-column">
|
|
|
- <div class="d-flex flex-column h-100">
|
|
|
- <div class="d-flex align-items-center pl-2 height-35px border-bottom bg-light">
|
|
|
- <h6 class="font-weight-bold m-0 text-secondary">Selected Line Properties</h6>
|
|
|
- </div>
|
|
|
- <div class="flex-grow-1 overflow-overlay-on-hover">
|
|
|
- <div class="mb-3 d-flex align-items-baseline p-2 border-bottom font-weight-bold">
|
|
|
- <span line-label></span>
|
|
|
- </div>
|
|
|
- <div class="d-flex align-items-baseline mb-2 px-2">
|
|
|
- <h6 class="font-weight-bold m-0 text-secondary">Argument Values</h6>
|
|
|
- <!--<a href="#" class="ml-3 text-sm" onclick="$('.parent-arg').toggle(); return false;">Toggle Parent Clause Args</a>-->
|
|
|
+ @if(!$multiProView)
|
|
|
+ <div class="col-4 p-0 h-100 setup-column d-none" id="line-properties-column">
|
|
|
+ <div class="d-flex flex-column h-100">
|
|
|
+ <div class="d-flex align-items-center pl-2 height-35px border-bottom bg-light">
|
|
|
+ <h6 class="font-weight-bold m-0 text-secondary">Selected Line Properties</h6>
|
|
|
</div>
|
|
|
- <div class="px-2">
|
|
|
- <table class="table table-sm table-bordered table-striped">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th class="border-bottom-0 w-35">Arg</th>
|
|
|
- <th class="border-bottom-0 w-35">Value</th>
|
|
|
- <th class="border-bottom-0">Access</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody line-args>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
- <div class="d-flex align-items-baseline mb-2 border-top pt-3 px-2">
|
|
|
- <h6 class="font-weight-bold m-0 text-secondary">Report Columns</h6>
|
|
|
- </div>
|
|
|
- <div class="px-2">
|
|
|
- <div class="mb-2 d-flex align-items-baseline">
|
|
|
- <span class="text-secondary mr-1 text-nowrap">Quick Add:</span>
|
|
|
- <div class="flex-grow-1 position-relative">
|
|
|
- <input type="text"
|
|
|
- name="displayKey"
|
|
|
- class="form-control form-control-sm"
|
|
|
- placeholder="Column name"
|
|
|
- stag-suggest stag-suggest-left
|
|
|
- stag-suggest-ep="/column-suggest"
|
|
|
- stag-suggest-extra="table={{$statTree->model}}"
|
|
|
- autocomplete="off">
|
|
|
+ <div class="flex-grow-1 overflow-overlay-on-hover">
|
|
|
+ <div class="mb-3 d-flex align-items-baseline p-2 border-bottom font-weight-bold">
|
|
|
+ <span line-label></span>
|
|
|
+ </div>
|
|
|
+ <div class="d-flex align-items-baseline mb-2 px-2">
|
|
|
+ <h6 class="font-weight-bold m-0 text-secondary">Argument Values</h6>
|
|
|
+ <!--<a href="#" class="ml-3 text-sm" onclick="$('.parent-arg').toggle(); return false;">Toggle Parent Clause Args</a>-->
|
|
|
+ </div>
|
|
|
+ <div class="px-2">
|
|
|
+ <table class="table table-sm table-bordered table-striped">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th class="border-bottom-0 w-35">Arg</th>
|
|
|
+ <th class="border-bottom-0 w-35">Value</th>
|
|
|
+ <th class="border-bottom-0">Access</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody line-args>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class="d-flex align-items-baseline mb-2 border-top pt-3 px-2">
|
|
|
+ <h6 class="font-weight-bold m-0 text-secondary">Report Columns</h6>
|
|
|
+ </div>
|
|
|
+ <div class="px-2">
|
|
|
+ <div class="mb-2 d-flex align-items-baseline">
|
|
|
+ <span class="text-secondary mr-1 text-nowrap">Quick Add:</span>
|
|
|
+ <div class="flex-grow-1 position-relative">
|
|
|
+ <input type="text"
|
|
|
+ name="displayKey"
|
|
|
+ class="form-control form-control-sm"
|
|
|
+ placeholder="Column name"
|
|
|
+ stag-suggest stag-suggest-left
|
|
|
+ stag-suggest-ep="/column-suggest"
|
|
|
+ stag-suggest-extra="table={{$statTree->model}}"
|
|
|
+ autocomplete="off">
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <table class="table table-sm table-bordered table-striped">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th class="border-bottom-0 width-30px">#</th>
|
|
|
+ <th class="border-bottom-0 w-35">Label</th>
|
|
|
+ <th class="border-bottom-0">Column</th>
|
|
|
+ <th class="border-bottom-0 width-60px"></th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody line-columns>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
</div>
|
|
|
- <table class="table table-sm table-bordered table-striped">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th class="border-bottom-0 width-30px">#</th>
|
|
|
- <th class="border-bottom-0 w-35">Label</th>
|
|
|
- <th class="border-bottom-0">Column</th>
|
|
|
- <th class="border-bottom-0 width-60px"></th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody line-columns>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ @endif
|
|
|
|
|
|
</div>
|
|
|
<script>
|
|
|
(function() {
|
|
|
function init() {
|
|
|
|
|
|
- let linePropsColumn = $('#line-properties-column');
|
|
|
+ let linePropsColumn = $('#line-properties-column'),
|
|
|
+ multiViewPros = [];
|
|
|
+
|
|
|
+ @if(request()->input('multi-pro-uids'))
|
|
|
+ multiViewPros = '{{request()->input('multi-pro-uids')}}'.split(',');
|
|
|
+ @endif
|
|
|
|
|
|
function fillAndInvokeMoe(_id, _node) {
|
|
|
let moe = $(_id);
|
|
@@ -424,6 +512,15 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ @if($multiProView)
|
|
|
+ (function ($, undefined) {
|
|
|
+ "use strict";
|
|
|
+ $.jstree.plugins.noclose = function () {
|
|
|
+ this.close_node = $.noop;
|
|
|
+ };
|
|
|
+ })(jQuery);
|
|
|
+ @endif
|
|
|
+
|
|
|
// stat tree
|
|
|
let StatTree = {
|
|
|
el: $('#stat-tree-view-{{$statTree->id}}'),
|
|
@@ -459,14 +556,19 @@
|
|
|
.on('copy_node.jstree', (_e, _data) => { StatTree.dropped(_e, _data); })
|
|
|
.on('select_node.jstree', () => { StatTree.onSelected(); })
|
|
|
.on('deselect_node.jstree', () => { StatTree.onDeselected(); })
|
|
|
+ @if(!$multiProView)
|
|
|
.on('redraw.jstree', () => { StatTree.dropVisualize(); })
|
|
|
+ @endif
|
|
|
.jstree({
|
|
|
"core": {
|
|
|
+ @if(!$multiProView)
|
|
|
"check_callback": true,
|
|
|
+ @endif
|
|
|
"multiple": false,
|
|
|
"animation": 0,
|
|
|
'data': _data
|
|
|
},
|
|
|
+ @if(!$multiProView)
|
|
|
"dnd": {
|
|
|
"is_draggable": function(_node, _e) {
|
|
|
return _node[0].data && _node[0].data.type === 'stat_tree_line';
|
|
@@ -478,6 +580,7 @@
|
|
|
if(node.data.type === 'stat_tree_line') { // stat_tree_line
|
|
|
return {
|
|
|
|
|
|
+ @if(!$multiProView)
|
|
|
"data": {
|
|
|
"label": "<span class='text-sm'>View Data</span>",
|
|
|
"action": function (obj) {
|
|
@@ -489,6 +592,8 @@
|
|
|
},
|
|
|
separator_after: true,
|
|
|
},
|
|
|
+ @endif
|
|
|
+
|
|
|
"cut": {
|
|
|
"label": "<span class='text-sm'>Cut</span>",
|
|
|
"action": function (obj) {
|
|
@@ -555,10 +660,15 @@
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
+ @endif
|
|
|
"plugins": [
|
|
|
"wholerow",
|
|
|
+ @if(!$multiProView)
|
|
|
"dnd",
|
|
|
"contextmenu",
|
|
|
+ @else
|
|
|
+ "noclose",
|
|
|
+ @endif
|
|
|
"state"
|
|
|
]
|
|
|
});
|
|
@@ -775,6 +885,11 @@
|
|
|
},
|
|
|
|
|
|
onSelected: function(_e, _data) {
|
|
|
+
|
|
|
+ @if($multiProView)
|
|
|
+ return;
|
|
|
+ @endif
|
|
|
+
|
|
|
let selected = this.selectedNode();
|
|
|
|
|
|
if(selected) console.log(selected.data)
|
|
@@ -967,6 +1082,14 @@
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
+ $(document)
|
|
|
+ .off('click', '.btn-add-pro')
|
|
|
+ .on('click', '.btn-add-pro', function() {
|
|
|
+ multiViewPros.push($(this).closest('[moe]').find('#proUid').val());
|
|
|
+ fastLoad('{{ route('practice-management.statTrees.view.edit', $statTree) }}?multi-pro=1&multi-pro-uids=' + multiViewPros.join(','));
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
$(document)
|
|
|
.off('input change paste', '.frm-clause-add-edit input[name="question"], .frm-clause-add-edit input[name="answer"]')
|
|
|
.on('input change paste', '.frm-clause-add-edit input[name="question"], .frm-clause-add-edit input[name="answer"]', function() {
|
|
@@ -994,6 +1117,19 @@
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
+ @if($multiProView)
|
|
|
+ $('[count-required]').each(function() {
|
|
|
+ $.post('{{route('practice-management.api.statTree.getCountsForPro')}}', {
|
|
|
+ uid: '{{$statTree->uid}}',
|
|
|
+ proUid: $(this).attr('data-pro-uid')
|
|
|
+ }, _data => {
|
|
|
+ for(let x in _data) {
|
|
|
+ $('.multi-pro-stats-table tr[data-line-uid="' + x + '"] td[data-pro-uid="' + $(this).attr('data-pro-uid') + '"] .count').text(_data[x]);
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ });
|
|
|
+ @endif
|
|
|
+
|
|
|
ClausesTree.load();
|
|
|
StatTree.load();
|
|
|
initMoes();
|