123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- {% extends 'manager-base.html' %}
- {% block content %}
- <!--cart-->
- <div class="row">
- <div class="col-sm-6 col-md-6">
- <div class="card text-white mb-3" style="background: linear-gradient(to bottom left, #cc3300 0%, #ffcc00 100%);">
- <div class="card-header"><h5 class="card-title">Google <span><i class="fa fa-google" aria-hidden="true"></i></span></h5></div>
- <div class="card-body">
- <table class="table">
- <tr>
- <td>
- <i class="fa fa-pencil-square-o" aria-hidden="true"></i> Review Count
- </td>
- <td>
- <i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Positive (5* & 4*)
- </td>
- <td>
- <i class="fa fa-thumbs-o-down" aria-hidden="true"></i> Negative (3* & Less)
- </td>
- </tr>
- <td>This month (so far)</td>
- <td>{{ google_this_month_pos }}</td>
- <td>{{ google_this_month_neg }}</td>
- </tr>
- <tr>
- <td>Last month</td>
- <td>{{ google_last_month_pos }}</td>
- <td>{{ google_last_month_neg }}</td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- <!-- <div class="col-sm-6 col-md-4">-->
- <!-- <div class="card text-white bg-danger mb-3">-->
- <!-- <div class="card-header"><h5 class="card-title">Yelp <span><i class="fa fa-yelp" aria-hidden="true"></i></span></h5></div>-->
- <!-- <div class="card-body">-->
- <!-- <table class="table">-->
- <!-- <tr>-->
- <!-- <td><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Total Review</td>-->
- <!-- <td>{{ yelp_total }}</td>-->
- <!-- </tr>-->
- <!-- <tr>-->
- <!-- <td><i class="fa fa-line-chart" aria-hidden="true"></i> Growth</td>-->
- <!-- <td>{{ yelp_total_growth }}%</td>-->
- <!-- </tr>-->
- <!-- </table>-->
- <!-- </div>-->
- <!-- </div>-->
- <!-- </div>-->
- <div class="col-sm-6 col-md-6">
- <div class="card text-white mb-3" style="background: linear-gradient(to bottom left, #000099 0%, #00ccff 100%);">
- <div class="card-header"><h5 class="card-title">Facebook <span><i class="fa fa-facebook" aria-hidden="true"></i></span></h5></div>
- <div class="card-body">
- <table class="table">
- <tr>
- <td>
- <i class="fa fa-pencil-square-o" aria-hidden="true"></i> Review Count
- </td>
- <td>
- <i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Recommended
- </td>
- <td>
- <i class="fa fa-thumbs-o-down" aria-hidden="true"></i> Not Recommended
- </td>
- </tr>
- <tr>
- <td>This month (so far)</td>
- <td>{{ facebook_this_month_pos }}</td>
- <td>{{ facebook_this_month_neg }}</td>
- </tr>
- <tr>
- <td>Last month</td>
- <td>{{ facebook_last_month_pos }}</td>
- <td>{{ facebook_last_month_neg }}</td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- </div>
- <!-- canvas-->
- <canvas class="my-4" id="myChart" width="900" height="300"></canvas>
- </div>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.bundle.min.js" integrity="sha256-TQq84xX6vkwR0Qs1qH5ADkP+MvH0W+9E7TdHJsoIQiM=" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script>
- <script>
- var ctx = document.getElementById("myChart");
- var location_id = document.getElementById("location_id").value;
- console.log(location_id);
- var endpoint = '/user/api/analytics';
- params = {
- "location_id":location_id.trim()
- }
- console.log(params)
- $.ajax({
- type: "get",
- url: endpoint,
- data: params,
- dataType: 'json',
- success: function(data) {
- console.log(data)
- var myBarChart = new Chart(ctx, {
- type: 'bar',
- data: {
- labels: data.label,
- datasets: [
- {
- label: 'Google',
- data: data.google,
- borderColor: 'rgb(255, 204, 0)',
- backgroundColor: 'rgb(255, 204, 0)',
- borderWidth: 1,
- fill: false
- },
- {
- label: 'Facebook',
- data: data.facebook,
- borderColor: 'rgb(0, 51, 204)',
- backgroundColor: 'rgb(0, 51, 204)',
- borderWidth: 1,
- fill: false
- }]
- },
- options: {
- scales: {
- yAxes: [{
- display: true,
- scaleLabel: {
- display: true,
- fontSize: 16,
- fontStyle: 'italic',
- labelString: 'Total review count'
- },
- ticks: {
- beginAtZero: true,
- stepSize: 1
- }
- }],
- xAxes: [{
- display: true,
- scaleLabel: {
- display: true,
- fontSize: 16,
- fontStyle: 'italic',
- labelString: 'Day of the month'
- },
- gridLines: {
- drawOnChartArea:false
- }
- }]
- },
- title: {
- display: true,
- fontSize: 16,
- text: "Review of this month in all platforms."
- }
- }
- });
- },
- error: function(error_data) {
- console.log(error_data);
- }
- });
- </script>
- {% endblock %}
|