|
@@ -1,131 +1,134 @@
|
|
|
@extends('app.stat-tree.stat-trees.single')
|
|
|
@section('page')
|
|
|
|
|
|
-<div id="app" class="row">
|
|
|
- @if(count($statTree->lines))
|
|
|
- <div class="col-12">
|
|
|
- <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">
|
|
|
- <span v-if="!refreshing"><i class="fas fa-sync-alt"></i> Refresh Counts</span>
|
|
|
- <span v-else><i class="fas fa-circle-notch fa-spin"></i> Refreshing...</span>
|
|
|
- </a>
|
|
|
+<div id="statTreeViewPage">
|
|
|
+ <div id="statTreeView" class="row">
|
|
|
+ @if(count($statTree->lines))
|
|
|
+ <div class="col-12">
|
|
|
+ <div class="d-flex align-items-center justify-content-between mb-2">
|
|
|
+ <h6 class="font-weight-bold">Lines</h6>
|
|
|
+ <div>
|
|
|
+ <button @click="refreshTreeCountQueries" class="btn btn-sm btn-danger text-white">
|
|
|
+ <span v-if="!refreshing"><i class="fas fa-sync-alt"></i> Refresh Counts</span>
|
|
|
+ <span v-else><i class="fas fa-circle-notch fa-spin"></i> Refreshing...</span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="table-responsive">
|
|
|
+ <table class="table table-condensed border p-0 m-0">
|
|
|
+ <thead class="bg-light">
|
|
|
+ <tr>
|
|
|
+ <th class="border-bottom-0">#</th>
|
|
|
+ <th class="border-bottom-0">Clauses</th>
|
|
|
+ <th class="border-bottom-0">Query</th>
|
|
|
+ <th class="border-bottom-0">Count</th>
|
|
|
+ <th class="border-bottom-0">Actions</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ @foreach($statTree->lines as $line)
|
|
|
+ <tr>
|
|
|
+ <td>
|
|
|
+ <a href="{{ route('practice-management.statTreeLines.view.dashboard', $line) }}" native>
|
|
|
+ {{ $line->tree_order_position_index }}
|
|
|
+ </a>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ @foreach($line->lineClauses as $c)
|
|
|
+ | {{ $c->clause_label }}
|
|
|
+ @endforeach
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ SELECT COUNT(*) FROM {{ $statTree->model }} WHERE
|
|
|
+ @foreach($line->lineClauses as $c)
|
|
|
+ {{ $c->clause->clause_text ?? '' }} @if(!$loop->last) AND @endif
|
|
|
+ @endforeach
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <span id="line-{{ $line->id }}">{{ $line->last_refresh_count }}</span>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <a href="#" data-id="{{$line->id}}" refresh-line-query native>Refresh</a>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ @endforeach
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="table-responsive">
|
|
|
- <table class="table table-condensed border p-0 m-0">
|
|
|
- <thead class="bg-light">
|
|
|
- <tr>
|
|
|
- <th class="border-bottom-0">#</th>
|
|
|
- <th class="border-bottom-0">Clauses</th>
|
|
|
- <th class="border-bottom-0">Query</th>
|
|
|
- <th class="border-bottom-0">Count</th>
|
|
|
- <th class="border-bottom-0">Actions</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- @foreach($statTree->lines as $line)
|
|
|
- <tr>
|
|
|
- <td>
|
|
|
- <a href="{{ route('practice-management.statTreeLines.view.dashboard', $line) }}">
|
|
|
- {{ $line->tree_order_position_index }}
|
|
|
- </a>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- @foreach($line->lineClauses as $c)
|
|
|
- | {{ $c->clause_label }}
|
|
|
- @endforeach
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- SELECT COUNT(*) FROM {{ $statTree->model }} WHERE
|
|
|
- @foreach($line->lineClauses as $c)
|
|
|
- {{ $c->clause->clause_text ?? '' }} @if(!$loop->last) AND @endif
|
|
|
- @endforeach
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <span id="line-{{ $line->id }}">{{ $line->last_refresh_count }}</span>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <a href="#" data-id="{{$line->id}}" refresh-line-query>Refresh</a>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- @endforeach
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- @endif
|
|
|
+ @endif
|
|
|
|
|
|
- <div class="col-12">
|
|
|
- <h6 class="font-weight-bold bg-light p-3 mt-3">Replace Stat Tree Lines</h6>
|
|
|
- <div class="row">
|
|
|
- <div class="col-md-6">
|
|
|
- <div class="bg-white p-3">
|
|
|
- <h6 class="font-weight-bold">TSV</h6>
|
|
|
- <div class="input-group">
|
|
|
- <textarea v-model="content" class="form-control" rows="10" @keyup="splitContents"></textarea>
|
|
|
+ <div class="col-12">
|
|
|
+ <h6 class="font-weight-bold bg-light p-3 mt-3">Replace Stat Tree Lines</h6>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-6">
|
|
|
+ <div class="bg-white p-3">
|
|
|
+ <h6 class="font-weight-bold">TSV</h6>
|
|
|
+ <div class="input-group">
|
|
|
+ <textarea v-model="content" class="form-control" rows="10" @keyup="splitContents"></textarea>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="col-md-6">
|
|
|
- <div class="bg-white p-3">
|
|
|
- <h6 class="font-weight-bold">JSON Structure</h6>
|
|
|
- <textarea class="form-control" rows="10">@{{jsonStructure}}</textarea>
|
|
|
+ <div class="col-md-6">
|
|
|
+ <div class="bg-white p-3">
|
|
|
+ <h6 class="font-weight-bold">JSON Structure</h6>
|
|
|
+ <textarea class="form-control" rows="10">@{{jsonStructure}}</textarea>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <template v-if="rows.length">
|
|
|
- <div class="row my-3">
|
|
|
- <div class="col">
|
|
|
- <div class="bg-white p-3">
|
|
|
- <h6 class="font-weight-bold">Table output:</h6>
|
|
|
- <div class="table-responsive">
|
|
|
- <table class="table table-bordered table-hover">
|
|
|
- <tbody>
|
|
|
- <tr v-for="(row, rowIndex) in rows">
|
|
|
- <td v-for="(column, columnIndex) in columns[rowIndex]">
|
|
|
- <input class="border-0" type="text" v-model="columns[rowIndex][columnIndex]" @keyup="updateColumns(rowIndex, columnIndex)">
|
|
|
- </td>
|
|
|
- </td>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ <template v-if="rows.length">
|
|
|
+ <div class="row my-3">
|
|
|
+ <div class="col">
|
|
|
+ <div class="bg-white p-3">
|
|
|
+ <h6 class="font-weight-bold">Table output:</h6>
|
|
|
+ <div class="table-responsive">
|
|
|
+ <table class="table table-bordered table-hover">
|
|
|
+ <tbody>
|
|
|
+ <tr v-for="(row, rowIndex) in rows">
|
|
|
+ <td v-for="(column, columnIndex) in columns[rowIndex]">
|
|
|
+ <input class="border-0" type="text" v-model="columns[rowIndex][columnIndex]" @keyup="updateColumns(rowIndex, columnIndex)">
|
|
|
+ </td>
|
|
|
+ </td>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <div class="row">
|
|
|
- <div class="col-md-12">
|
|
|
- <div class="px-3">
|
|
|
- <button type="button" class="btn btn-sm btn-primary" @click="submit">Submit</button>
|
|
|
- <button type="button" class="btn btn-sm btn-secondary" @click="generateAutoFilledJson">Fill</button>
|
|
|
+ </template>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12">
|
|
|
+ <div class="px-3">
|
|
|
+ <button type="button" class="btn btn-sm btn-primary" @click="submit">Submit</button>
|
|
|
+ <button type="button" class="btn btn-sm btn-secondary" @click="generateAutoFilledJson">Fill</button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<script src="{{ asset('js/tsvToArray.js') }}"></script>
|
|
|
-
|
|
|
-<script type="text/javascript">
|
|
|
- var app = new Vue({
|
|
|
- el: '#app',
|
|
|
- data: {
|
|
|
- content: '',
|
|
|
- rowSplitter: '\n',
|
|
|
- columnSplitter: '\t',
|
|
|
- rows: [],
|
|
|
- columns: [],
|
|
|
- maxColumn: 0,
|
|
|
- jsonStructure: '',
|
|
|
- isAutoFilled: false,
|
|
|
- refreshing: false,
|
|
|
- refreshingLine: false
|
|
|
- },
|
|
|
- delimiters: ['@{{', '}}'],
|
|
|
- methods: {
|
|
|
+<script>
|
|
|
+ (function() {
|
|
|
+ function init() {
|
|
|
+ new Vue({
|
|
|
+ el: '#statTreeView',
|
|
|
+ data: {
|
|
|
+ content: '',
|
|
|
+ rowSplitter: '\n',
|
|
|
+ columnSplitter: '\t',
|
|
|
+ rows: [],
|
|
|
+ columns: [],
|
|
|
+ maxColumn: 0,
|
|
|
+ jsonStructure: '',
|
|
|
+ isAutoFilled: false,
|
|
|
+ refreshing: false,
|
|
|
+ refreshingLine: false
|
|
|
+ },
|
|
|
+ delimiters: ['@{{', '}}'],
|
|
|
+ methods: {
|
|
|
updateColumns(rowIndex, columnIndex) {
|
|
|
try {
|
|
|
this.rows[rowIndex] = this.columns[rowIndex].join(this.columnSplitter);
|
|
@@ -205,8 +208,9 @@
|
|
|
}, function(response) {
|
|
|
self.refreshing = false;
|
|
|
if (response.success) {
|
|
|
- // location.href = "{{ route('practice-management.statTrees.view.dashboard', $statTree) }}";
|
|
|
- location.reload();
|
|
|
+ fastLoad("{{ route('practice-management.statTrees.view.dashboard', $statTree) }}");
|
|
|
+ //fastReload()
|
|
|
+
|
|
|
} else {
|
|
|
toastr.error(response.message);
|
|
|
}
|
|
@@ -214,7 +218,7 @@
|
|
|
},
|
|
|
initRefreshLineQuery: function() {
|
|
|
var self = this;
|
|
|
-
|
|
|
+
|
|
|
$('[refresh-line-query]').click(function() {
|
|
|
var element = $(this);
|
|
|
var id = element.data('id');
|
|
@@ -242,10 +246,10 @@
|
|
|
mounted: function() {
|
|
|
this.init();
|
|
|
},
|
|
|
- updated: function(){
|
|
|
+ updated: function() {
|
|
|
var self = this;
|
|
|
- self.$nextTick(function(){
|
|
|
-
|
|
|
+ self.$nextTick(function() {
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
watch: {
|
|
@@ -260,7 +264,10 @@
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ addMCInitializer('statTreeView', init, '#statTreeViewPage')
|
|
|
+ }).call(window);
|
|
|
</script>
|
|
|
|
|
|
@endsection
|