Ver Fonte

Merge branch 'master' of http://host.webmagistri.biz:3000/parisio/iao_team

Luca Parisio há 1 ano atrás
pai
commit
82d7d1c9bc

+ 3 - 2
app/Http/Livewire/Record.php

@@ -191,7 +191,7 @@ class Record extends Component
                 }
                 else
                 {
-                    $amount = 0;
+                    $amount = $data->amount;
                 }
                 /*$when = sizeof(json_decode($data->when));
 
@@ -230,7 +230,8 @@ class Record extends Component
 
                 $this->records[$causal][$data->payment_method->name][$data->type] = $amount;
 
-                $this->totals[$data->payment_method->name][$data->type] += $amount; // $data->amount;//$this->records[$causal][$data->payment_method->name][$data->type];
+                if (!$data->deleted)
+                    $this->totals[$data->payment_method->name][$data->type] += $amount; // $data->amount;//$this->records[$causal][$data->payment_method->name][$data->type];
 
             }
 

+ 1 - 1
public/css/extra.css

@@ -23,4 +23,4 @@ table.tableHead thead {
     position: sticky;
     z-index: 100;
     top: 0;
-}
+}

+ 26 - 3
resources/views/livewire/course_list.blade.php

@@ -120,6 +120,7 @@
             <table class="table tablesaw tableHead tablesaw-stack pagamento--corsi display nowrap" id="tablesaw-350" width="100%">
                 <thead>
                     <tr>
+                        <th scope="col"></th>
                         <th scope="col">Cognome</th>
                         <th scope="col">Nome</th>
                         <th scope="col">Iscrizione</th>
@@ -186,7 +187,14 @@
         {
             padding-right:5px !important;
         }
-
+        /*.container-fluid
+        {
+            display: table-row !important;
+        }
+        .row.row.header--gestionale
+        {
+            padding-left:20px !important;
+        }*/
     </style>
     <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
     <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
@@ -394,6 +402,13 @@
                 'th': {'background-color': 'blue'}
                 },
                 columns: [
+                    {
+                        data: 'column_18',
+                        "orderable": false,
+                        render: function (data, type, row, meta){
+                            return data;
+                        }
+                    },
                     {
                         data: 'column_0',
                         render: function (data, type, row){
@@ -665,7 +680,7 @@
                     },
                     top1C :'search',
                 },
-                order: [[0, 'asc'], [1, 'asc']],
+                order: [[1, 'asc'], [2, 'asc']],
                 pagingType: 'numbers',
                 "language": {
                     "url": "/assets/js/Italian.json"
@@ -699,7 +714,12 @@
 
                     }
 
-                }
+                }/*,
+                fixedColumns: {
+                    start: 1,
+                    end: 1
+                },
+                scrollX: true*/
             });
             $('#tablesaw-350 thead tr th').addClass('col');
             $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
@@ -744,9 +764,11 @@
             if (selectedMemberId > 0 && selectedMemberId != member_id)
             {
                 months = [];
+                subscription = false;
             }
             if (selectedMemberCourseId != id)
             {
+                $(".sub_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
                 $(".lnk_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
             }
             selectedCourseId = course_id;
@@ -779,6 +801,7 @@
             {
                 $(".sub_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
                 $(".lnk_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
+                months = [];
                 subscription = false;
             }
             selectedCourseId = course_id;

+ 18 - 4
resources/views/livewire/member.blade.php

@@ -1,4 +1,4 @@
-
+<div>
         @if($showDetail)
 
         <div class="col col-lg-12" style="margin-bottom:100px;">
@@ -1631,7 +1631,7 @@
                 </div>
             </div>
         </div>
-
+    </div>
 @push('scripts')
     <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
     <style>
@@ -2248,7 +2248,7 @@
                         render: function (data){
                             // Split class and text
                             const d = data.split("|");
-                            var ret = '<a href="#" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
+                            var ret = '<a style="cursor:pointer" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
                             return ret;
                         }
                     },
@@ -2257,7 +2257,7 @@
                         render: function (data){
                             // Split class and text
                             const d = data.split("|");
-                            var ret = '<a href="#" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
+                            var ret = '<a style="cursor:pointer" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
                             return ret;
                         }
                     },
@@ -2507,5 +2507,19 @@
             window.location.href = "#top";
         });
 
+        /*$(window).on('popstate', function(event) {
+            document.location.href = '/members';
+        });*/
+        $(function() {
+            if (window.history && window.history.pushState) {
+                window.history.pushState('', null, './');
+                $(window).on('popstate', function() {
+                    // alert('Back button was pressed.');
+                    //document.location.href = '#';
+                    document.location.href = '/members';
+                });
+            }
+        });
+
     </script>
 @endpush

+ 13 - 2
resources/views/livewire/records_in_out.blade.php

@@ -96,14 +96,25 @@
                             @endphp
                             @foreach($rows_in as $in)
                                 @if($filterCausalsIn == null || (sizeof($filterCausalsIn) == 0 || in_array($in["id"], $filterCausalsIn) || in_array($in["parent_id"], $filterCausalsIn) || in_array($in["first_parent_id"], $filterCausalsIn)))
-                                    @if($filterCausalsIn != null && !in_array($in["first_parent_id"], $filterCausalsIn) && !in_array($in["first_parent_id"] . "_" . $in["parent_id"], $aScritto))
+                                    @if($in["first_parent_name"] != "" && $filterCausalsIn != null && !in_array($in["first_parent_id"], $filterCausalsIn) && !in_array($in["first_parent_id"] . "_" . $in["parent_id"], $aScritto))
                                         @php
                                         $aScritto[] = $in["first_parent_id"] . "_" . $in["parent_id"];
                                         @endphp
                                         <tr>
-                                            <td colspan="20">
+                                            <td>
                                                 <b>{{$in["first_parent_name"]}} - {{$in["parent_name"]}}</b>
                                             </td>
+                                            @foreach($columns as $column)
+                                                <td class="cellBorder" style="text-align:right">
+                                                    @if(isset($records_in[$column][$in["parent_id"]]))
+                                                        <span class="tablesaw-cell-content {{$in["level"] == 0 ? 'primary' : ''}}" {{$in["level"] == 0 ? 'style="font-weight:bold;' : ''}}>
+                                                            {{formatPrice($records_in[$column][$in["parent_id"]])}}
+                                                        </span>
+                                                    @else
+                                                        &nbsp;
+                                                    @endif
+                                                </td>
+                                            @endforeach
                                         </tr>
                                     @endif
                                     <tr data-id="{{$in["id"]}}" data-parent="{{$filterCausalsIn == null || in_array($in["parent_id"], $filterCausalsIn) ? $in["parent_id"] : ''}}">

+ 9 - 105
routes/web.php

@@ -669,6 +669,8 @@ Route::group(['middleware' => 'auth'],function(){
 
         $datas = [];
 
+        $xxx = 1;
+
         $member_course_totals = $member_course->get();
         foreach($member_course_totals as $x)
         {
@@ -750,7 +752,8 @@ Route::group(['middleware' => 'auth'],function(){
                 "column_14" => getColor($x->months, 8) . "§" . formatPrice(isset($prices[8]) ? $prices[8] : $price),
                 "column_15" => $x->course_id,
                 "column_16" => $x->id,
-                "column_17" => $x->member_id
+                "column_17" => $x->member_id,
+                "column_18" => $xxx++
             );
 
         }
@@ -792,114 +795,15 @@ Route::group(['middleware' => 'auth'],function(){
             $xx += 1;
         }
 
+        if (isset($_GET["order"]))
+            array_multisort(array_column($datas, 'column_' . ($_GET["order"][0]["column"] - 1)), $_GET["order"][0]["dir"] == "asc" ? SORT_ASC : SORT_DESC, SORT_NATURAL|SORT_FLAG_CASE, $datas);
 
-        //$member_course = $member_course->where('course_id', 999999);
-
-        /*
-
-        $start = 0;
-        $limit = 100000;
-
-        if (isset($_GET["start"]))
+        $xxx = 1;
+        foreach($datas as $yyy => $d)
         {
-            $start = $_GET["start"];
-            $limit = $_GET["length"];
+            $datas[$yyy]["column_18"] = $xxx++;
         }
 
-        //$member_course = $member_course->offset($start)->limit($limit)->get();
-        $member_course = $member_course->get();
-
-        $datas = [];
-
-        foreach($member_course as $x)
-        {
-
-            $price = 0;
-            $price = $x->course->price;
-            $subPrice = $x->course->subscription_price;
-            $records = \App\Models\Record::where('member_course_id', $x->id)->where('deleted', 0)->get();
-            $prices = [];
-            foreach ($records as $record)
-            {
-                foreach ($record->rows as $row)
-                {
-
-                    //if ($row->causal_id == $x->course->sub_causal_id || str_contains(strtolower($row->note), 'iscrizione'))
-                    if (str_contains(strtolower($row->note), 'iscrizione'))
-                    {
-                        $subPrice = $row->amount;
-                    }
-                    if ($row->causal_id == $x->course->causal_id && !str_contains(strtolower($row->note), 'iscrizione'))
-                    {
-                        $tot = sizeof(json_decode($row->when));
-                        foreach(json_decode($row->when) as $m)
-                        {
-                            $prices[$m->month] = $row->amount / $tot;
-                        }
-                    }
-                }
-            }
-
-            for($i=1; $i<=12; $i++)
-            {
-
-                $cls = getColor($x->months, $i);
-                if ($cls != 'grey')
-                {
-
-                    if (!isset($totals[$i]))
-                    {
-                        $totals[$i]['green'] = 0;
-                        $totals[$i]['orange'] = 0;
-                        $totals[$i]['yellow'] = 0;
-                    }
-
-
-                    if ($cls == 'yellow')
-                    {
-                        $prices[$i] = 0;
-                        $totals[$i][$cls] += 1;
-                    }
-                    else
-                    {
-                        $p = isset($prices[$i]) ? $prices[$i] : $price;
-                        $totals[$i][$cls] += $p;
-                    }
-                }
-            }
-
-            $sub = $x->subscribed ? "Y" : "N";
-            if (isset($totalIsc[$sub]))
-                $totalIsc[$sub] += $subPrice;
-            else
-                $totalIsc[$sub] = $subPrice;
-
-            $datas[] = array(
-                "column_0" => $x->member->last_name,
-                "column_1" => $x->member->first_name,
-                "column_2" => $x->subscribed . "§" . formatPrice($subPrice),
-                "column_3" => getColor($x->months, 9) . "§" . formatPrice(isset($prices[9]) ? $prices[9] : $price),
-                "column_4" => getColor($x->months, 10) . "§" . formatPrice(isset($prices[10]) ? $prices[10] : $price),
-                "column_5" => getColor($x->months, 11) . "§" . formatPrice(isset($prices[11]) ? $prices[11] : $price),
-                "column_6" => getColor($x->months, 12) . "§" . formatPrice(isset($prices[12]) ? $prices[12] : $price),
-                "column_7" => getColor($x->months, 1) . "§" . formatPrice(isset($prices[1]) ? $prices[1] : $price),
-                "column_8" => getColor($x->months, 2) . "§" . formatPrice(isset($prices[2]) ? $prices[2] : $price),
-                "column_9" => getColor($x->months, 3) . "§" . formatPrice(isset($prices[3]) ? $prices[3] : $price),
-                "column_10" => getColor($x->months, 4) . "§" . formatPrice(isset($prices[4]) ? $prices[4] : $price),
-                "column_11" => getColor($x->months, 5) . "§" . formatPrice(isset($prices[5]) ? $prices[5] : $price),
-                "column_12" => getColor($x->months, 6) . "§" . formatPrice(isset($prices[6]) ? $prices[6] : $price),
-                "column_13" => getColor($x->months, 7) . "§" . formatPrice(isset($prices[7]) ? $prices[7] : $price),
-                "column_14" => getColor($x->months, 8) . "§" . formatPrice(isset($prices[8]) ? $prices[8] : $price),
-                "column_15" => $x->course_id,
-                "column_16" => $x->id,
-                "column_17" => $x->member_id
-            );
-        }
-        */
-
-        if (isset($_GET["order"]))
-            array_multisort(array_column($datas, 'column_' . $_GET["order"][0]["column"]), $_GET["order"][0]["dir"] == "asc" ? SORT_ASC : SORT_DESC, SORT_NATURAL|SORT_FLAG_CASE, $datas);
-
         if (isset($_GET["start"]))
             $datas = array_slice($datas, $_GET["start"], $_GET["length"]);