|
@@ -1,10 +1,15 @@
|
|
@extends('app.stat-tree.stat-trees.single')
|
|
@extends('app.stat-tree.stat-trees.single')
|
|
@section('page')
|
|
@section('page')
|
|
|
|
|
|
-<div class="row">
|
|
|
|
|
|
+<div id="app" class="row">
|
|
@if(count($statTree->lines))
|
|
@if(count($statTree->lines))
|
|
<div class="col-12">
|
|
<div class="col-12">
|
|
- <h6 class="font-weight-bold">Lines</h6>
|
|
|
|
|
|
+ <div class="d-flex align-items-center justify-content-between mb-2">
|
|
|
|
+ <h6 class="font-weight-bold">Lines</h6>
|
|
|
|
+ <div>
|
|
|
|
+ <a href="#" @click="refreshTreeCountQueries" class="btn btn-sm btn-danger text-white"><i class="fas fa-sync-alt"></i> Refresh Counts</a>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
<div class="table-responsive">
|
|
<div class="table-responsive">
|
|
<table class="table table-condensed border p-0 m-0">
|
|
<table class="table table-condensed border p-0 m-0">
|
|
<thead class="bg-light">
|
|
<thead class="bg-light">
|
|
@@ -13,6 +18,7 @@
|
|
<th class="border-bottom-0">Clauses</th>
|
|
<th class="border-bottom-0">Clauses</th>
|
|
<th class="border-bottom-0">Query</th>
|
|
<th class="border-bottom-0">Query</th>
|
|
<th class="border-bottom-0">Count</th>
|
|
<th class="border-bottom-0">Count</th>
|
|
|
|
+ <th class="border-bottom-0">Actions</th>
|
|
</tr>
|
|
</tr>
|
|
</thead>
|
|
</thead>
|
|
<tbody>
|
|
<tbody>
|
|
@@ -31,11 +37,14 @@
|
|
<td>
|
|
<td>
|
|
SELECT COUNT(*) FROM {{ $statTree->model }} WHERE
|
|
SELECT COUNT(*) FROM {{ $statTree->model }} WHERE
|
|
@foreach($line->lineClauses as $c)
|
|
@foreach($line->lineClauses as $c)
|
|
- {{ $c->clause->clause_text }} @if(!$loop->last) AND @endif
|
|
|
|
|
|
+ {{ $c->clause->clause_text ?? '' }} @if(!$loop->last) AND @endif
|
|
@endforeach
|
|
@endforeach
|
|
</td>
|
|
</td>
|
|
<td>
|
|
<td>
|
|
- {{ $line->last_refresh_count }}
|
|
|
|
|
|
+ <span id="line-{{ $line->id }}">{{ $line->last_refresh_count }}</span>
|
|
|
|
+ </td>
|
|
|
|
+ <td>
|
|
|
|
+ <a href="#" data-id="{{$line->id}}" refresh-line-query>Refresh</a>
|
|
</td>
|
|
</td>
|
|
</tr>
|
|
</tr>
|
|
@endforeach
|
|
@endforeach
|
|
@@ -45,7 +54,7 @@
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endif
|
|
|
|
|
|
- <div id="app" class="col-12">
|
|
|
|
|
|
+ <div class="col-12">
|
|
<h6 class="font-weight-bold bg-light p-3 mt-3">Replace Stat Tree Lines</h6>
|
|
<h6 class="font-weight-bold bg-light p-3 mt-3">Replace Stat Tree Lines</h6>
|
|
<div class="row">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="col-md-6">
|
|
@@ -108,7 +117,9 @@
|
|
columns: [],
|
|
columns: [],
|
|
maxColumn: 0,
|
|
maxColumn: 0,
|
|
jsonStructure: '',
|
|
jsonStructure: '',
|
|
- isAutoFilled: false
|
|
|
|
|
|
+ isAutoFilled: false,
|
|
|
|
+ refreshing: false,
|
|
|
|
+ refreshingLine: false
|
|
},
|
|
},
|
|
delimiters: ['@{{', '}}'],
|
|
delimiters: ['@{{', '}}'],
|
|
methods: {
|
|
methods: {
|
|
@@ -180,6 +191,58 @@
|
|
}
|
|
}
|
|
}, 'json');
|
|
}, 'json');
|
|
},
|
|
},
|
|
|
|
+ refreshTreeCountQueries: function(evt) {
|
|
|
|
+ evt.preventDefault();
|
|
|
|
+ var self = this;
|
|
|
|
+ if (self.refreshing) return;
|
|
|
|
+
|
|
|
|
+ self.refreshing = true;
|
|
|
|
+ $.post("{{ route('practice-management.api.statTree.refreshTreeCountQueries') }}", {
|
|
|
|
+ statTreeID: "{{ $statTree->id }}"
|
|
|
|
+ }, function(response) {
|
|
|
|
+ self.refreshing = false;
|
|
|
|
+ if (response.success) {
|
|
|
|
+ location.href = "{{ route('practice-management.statTrees.view.dashboard', $statTree) }}";
|
|
|
|
+ } else {
|
|
|
|
+ toastr.error(response.message);
|
|
|
|
+ }
|
|
|
|
+ }, 'json');
|
|
|
|
+ },
|
|
|
|
+ initRefreshLineQuery: function() {
|
|
|
|
+ var self = this;
|
|
|
|
+
|
|
|
|
+ $('[refresh-line-query]').click(function() {
|
|
|
|
+ var element = $(this);
|
|
|
|
+ var id = element.data('id');
|
|
|
|
+ if (self.refreshingLine) return;
|
|
|
|
+ self.refreshingLine = true;
|
|
|
|
+ element.html('<i class="fas fa-circle-notch fa-spin"></i> Refreshing...');
|
|
|
|
+ $.post("{{ route('practice-management.api.statTreeLine.refreshCountQuery') }}", {
|
|
|
|
+ statTreeLineID: id
|
|
|
|
+ }, function(response) {
|
|
|
|
+ self.refreshingLine = false;
|
|
|
|
+ if (response.success) {
|
|
|
|
+ $('#line-' + id).text(response.data);
|
|
|
|
+ toastr.success('Updated value: ' + response.data);
|
|
|
|
+ } else {
|
|
|
|
+ toastr.error(reasponse.message);
|
|
|
|
+ }
|
|
|
|
+ element.html('Refresh');
|
|
|
|
+ }, 'json');
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ init: function() {
|
|
|
|
+ this.initRefreshLineQuery();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted: function() {
|
|
|
|
+ this.init();
|
|
|
|
+ },
|
|
|
|
+ updated: function(){
|
|
|
|
+ var self = this;
|
|
|
|
+ self.$nextTick(function(){
|
|
|
|
+
|
|
|
|
+ });
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
maxColumn(maxColumn) {
|
|
maxColumn(maxColumn) {
|