Luca Parisio 9 bulan lalu
induk
melakukan
37099adbf3

+ 7 - 3
app/Http/Livewire/Course.php

@@ -203,10 +203,14 @@ class Course extends Component
 
             $freq = '';
             if ($this->course_frequency_id > 0)
-                $freq = \App\Models\CourseLevel::findOrFail($this->course_frequency_id)->name;
+                $freq = \App\Models\CourseFrequency::findOrFail($this->course_frequency_id)->name;
 
+            $mFrom = getMonthName(date("n", strtotime($this->date_from)));
+            $mTo = getMonthName(date("n", strtotime($this->date_to)));
             // Creo le causali di pagamento
-            $causal = "Pagamento rata " . $this->name . " - " . $lev . " - " . $freq . " - " . $this->year;
+            //$causal = "PAGAMENTO CORSO [nome corso]-LIVELLO-FREQUENZA-ANNO-[tipo abbonamento]-[mese inizio]/[mese fine]
+
+            $causal = "PAGAMENTO CORSO " . $this->name . " - " . $lev . " - " . $freq . " - " . $this->year . " - " . $mFrom . "/" . $mTo;
             $cp = \App\Models\Causal::where('name', $causal)->first();
             if (!$cp)
             {
@@ -225,7 +229,7 @@ class Course extends Component
             }
             $course->causal_id = $cp->id;
 
-            $causal = "Pagamento iscrizione " . $this->name . " - " . $lev . " - " . $freq . " - " . $this->year;
+            $causal = "PAGAMENTO ISCRIZIONE " . $this->name . " - " . $lev . " - " . $freq . " - " . $this->year . " - " . $mFrom . "/" . $mTo;
             $ci = \App\Models\Causal::where('name', $causal)->first();
             if (!$ci)
             {

+ 2 - 1
app/Http/Livewire/RecordIN.php

@@ -386,7 +386,8 @@ class RecordIN extends Component
                 $desc = "Pagamento";
                 $months = explode("|", $_GET["months"]);
                 $this->months = $months;
-                $this->rows[0]["amount"] = formatPrice($price * sizeof($months));
+                //$this->rows[0]["amount"] = formatPrice($price * sizeof($months));
+                $this->rows[0]["amount"] = formatPrice($price);
                 foreach($months as $idx => $m)
                 {
                     $this->rows[0]["when"][$idx]["month"] = $m;

+ 45 - 36
resources/views/livewire/course.blade.php

@@ -261,6 +261,7 @@
                                 <div class="form--item">
                                     <label for="inputName" class="form-label">Anno</label>
                                     <select class="form-control" wire:model="year">
+                                        <option value=""></option>
                                         @for($i=2024; $i<=date("Y") + 1; $i++)
                                             <option value="{{$i . "-" . $i + 1}}">{{$i . "/" . $i + 1}}
                                         @endfor
@@ -271,50 +272,48 @@
                                 </div>
                             </div>
 
-                            
-
-                            <div class="col">
+                            <div class="col-6 mt-2">
                                 <div class="form--item">
-                                    <label for="enabled" class="form-label">Abilitato</label>
-                                    <input class="form-check-input form-control" style="width:22px; height:22px;" type="checkbox" id="enabled" wire:model="enabled">
+                                    <label for="inputName" class="form-label">Prezzo iscrizione</label>
+                                    <input class="form-control js-keyupTitle @error('subscription_price') is-invalid @enderror" type="text" id="subscription_price" onkeyup="onlyNumberAmount(this)" placeholder="€ 0,00" wire:model="subscription_price">
+                                    @error('subscription_price')
+                                        <div class="invalid-feedback">{{ $message }}</div>
+                                    @enderror
                                 </div>
                             </div>
-
-                            <div class="row">
-                                <div class="col-1">
-                                    <br><button class="btn--ui primary add--daye" wire:click.prevent="addPrice()"><i class="fa-solid fa-plus"></i></button>
-                                </div>
-                                <div class="col-6">
-                                    @foreach($prices as $idP => $p)
-                                        <div class="row mt-2">
-                                            <div class="col-6">
-                                                <label for="abb" class="form-label">Abbonamento</label>
-                                                <select class="form-control" wire:model="prices.{{$idP}}.course_subscription_id">
-                                                    <option value=""></option>
-                                                    @foreach($course_subscriptions as $s)
-                                                        <option value="{{$s["id"]}}">{{$s["name"]}}
-                                                    @endforeach
-                                                </select>
-                                            </div>
-                                            <div class="col-5">
-                                                <label for="price" class="form-label">Prezzo</label>
-                                                <input class="form-control " type="text" onkeyup="onlyNumberAmount(this)" placeholder="€ 0,00" wire:model="prices.{{$idP}}.price">
-                                            </div>
-                                            <div class="col-1">
-                                                @if($idP > 0)
-                                                    <br><button class="btn--ui primary add--daye" wire:click.prevent="delPrice({{$idP}})"><i class="fa-solid fa-minus"></i></button>
-                                                @endif
-                                            </div>
+                            <div class="col-6">
+                                @foreach($prices as $idP => $p)
+                                    <div class="row mt-2">
+                                        <div class="col-6">
+                                            <label for="abb" class="form-label">Abbonamento</label>
+                                            <select class="form-control" wire:model="prices.{{$idP}}.course_subscription_id">
+                                                <option value=""></option>
+                                                @foreach($course_subscriptions as $s)
+                                                    <option value="{{$s["id"]}}">{{$s["name"]}}
+                                                @endforeach
+                                            </select>
                                         </div>
-                                    @endforeach
-                                </div>
+                                        <div class="col-4">
+                                            <label for="price" class="form-label">Prezzo</label>
+                                            <input class="form-control " type="text" onkeyup="onlyNumberAmount(this)" placeholder="€ 0,00" wire:model="prices.{{$idP}}.price">
+                                        </div>
+                                        <div class="col-1">
+                                            @if($idP == 0)
+                                                <br><button class="btn--ui primary add--daye" wire:click.prevent="addPrice()"><i class="fa-solid fa-plus"></i></button>
+                                            @endif
+                                            @if($idP > 0)
+                                                <br><button class="btn--ui primary add--daye" wire:click.prevent="delPrice({{$idP}})"><i class="fa-solid fa-minus"></i></button>
+                                            @endif
+                                        </div>
+                                    </div>
+                                @endforeach
                             </div>
-
+                            
                             @if($type == 'standard')
 
                                 @foreach($when as $idW => $w)
 
-                                    <div class="col-12">
+                                    <div class="col-6 mt-4">
                                         <div class="day durata--corso d-flex">
                                             <label for="" class="form-label">Giorno</label>
                                             <div class="durata--corso_days mb-3">
@@ -359,9 +358,19 @@
                             
                             @endif
 
+                            
+
+                        </div>
+                        <div class="row">
+                            <div class="col-6">
+                                <div class="form--item">
+                                    <label for="enabled" class="form-label">Abilitato</label>
+                                    <input class="form-check-input form-control" style="width:22px; height:22px;" type="checkbox" id="enabled" wire:model="enabled">
+                                </div>
+                            </div>
                         </div>
 
-                        <div class="form--item">
+                        <div class="form--item mt-4">
                             <button type="button" class="btn--ui lightGrey" onclick="annulla()">Annulla</button>
                             @if($add)
                                 <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>

+ 6 - 2
resources/views/livewire/course_member_two.blade.php

@@ -21,7 +21,9 @@
                     <th scope="col">Frequenza</th>
                     <th scope="col">Livello</th>
                     <th scope="col">Durata</th>                        
-                    <th scope="col">Giorni</th>                        
+                    @if($_GET["type"] != "custom")
+                        <th scope="col">Giorni</th>                        
+                    @endif
                     <th scope="col">Istruttore</th>                        
                     <th scope="col">...</th>
                 </tr>
@@ -33,6 +35,7 @@
                         <td>{{$record->frequency->name ?? ""}}</td>
                         <td>{{$record->level->name ?? ""}}</td>
                         <td>{{date("d/m/Y", strtotime($record->date_from))}} - {{date("d/m/Y", strtotime($record->date_to))}}                                                                </td>                            
+                        @if($_GET["type"] != "custom")
                         <td>
                             @foreach(json_decode($record->when) as $xx => $x)
                                 @if($xx > 0)
@@ -43,7 +46,8 @@
                                 @endforeach
                                 h {{$x->from}} - {{$x->to}}
                             @endforeach
-                        </td>                            
+                        </td>       
+                        @endif                     
                         <td>{{$record->getins->name ?? ""}}</td>
                         <td>
                             <a href="/course_member?id={{$record->id}}" type="button" class="btn" ><b>></b></button>

+ 51 - 29
resources/views/livewire/member.blade.php

@@ -1139,22 +1139,44 @@
                                                 <tbody id="checkall-target">
                                                     @foreach($member_courses as $member_course)
                                                         <tr>
-                                                            <td style="width:10%">
+                                                            <td style="width:70%;border:0px;" colspan="3">
                                                                 <b>{{$member_course->course->name}}</b><br>
                                                             </td>
-                                                            <td style="width:10%">
+                                                            
+                                                            <td style="text-align:right;width:15%;border:0px;">
+                                                                @php
+                                                                $status = $member_course->getStatus();
+                                                                @endphp
+                                                                <a href="/rates?member_id={{$member_course->member_id}}&member_course_id={{$member_course->id}}"><span class="badge tessera-badge {{$status == 0 ? 'due' : ($status == 1 ? 'active' : 'suspended')}}">{{$status == 0 ? 'Da pagare' : ($status == 1 ? 'Pagato' : 'Sospeso')}}</span></a>
+                                                                @if($member_course->notes != '')
+                                                                    <button type="button" class="btn" wire:click="showHideCourse({{ $member_course->id }})"><i class="fa-solid fa-chevron-down"></i></button>&nbsp;
+                                                                @endif
+                                                            </td>
+                                                            <td style="text-align:right;width:15%;border:0px;">
+                                                                <div class="row">
+                                                                    <div class="col-6">
+                                                                        <button style="float:left;" type="button" class="btn" wire:click="editCourse({{ $member_course->id }})" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
+                                                                    </div>
+                                                                    <div class="col-6">
+                                                                        <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCourse({{ $member_course->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Elimina"><i class="fa-regular fa-trash-can"></i></button>
+                                                                    </div>
+                                                                </div>
+                                                            </td>
+                                                            
+                                                            
+                                                        </tr>
+                                                        <tr>
+                                                            <td style="width:20%">
                                                                 {{$member_course->course->frequency->name ?? ""}}<br>
                                                             </td>
-                                                            <td style="width:10%">
+                                                            <td style="width:20%">
                                                                 {{$member_course->course->level->name ?? ""}}<br>
                                                             </td>
                                                             <td style="width:30%">
                                                                 @php
-                                                                $when = $member_course->when;
-                                                                if ($when == '[{"to": "", "day": [], "from": ""}]')
-                                                                    $when = $member_course->course->when;
+                                                                $ok = false;
                                                                 @endphp
-                                                                @foreach(json_decode($when) as $xx => $x)
+                                                                @foreach(json_decode($member_course->when) as $xx => $x)
                                                                     @if($xx > 0)
                                                                         <br>
                                                                     @endif
@@ -1162,30 +1184,30 @@
                                                                         {{$zz > 0 ? '-' : ''}}{{$d}}
                                                                     @endforeach
                                                                     h {{$x->from}} - {{$x->to}}
+                                                                    @php
+                                                                    $ok = $x->from != '';
+                                                                    @endphp
                                                                 @endforeach
-                                                            </td>
-                                                            <td style="width:15%">
-                                                                {{date("d/m/Y", strtotime($member_course->date_from))}} <br> {{date("d/m/Y", strtotime($member_course->date_to))}}                                                                
-                                                            </td>
-                                                            <td style="text-align:right;width:10%">
-                                                                <div class="row">
-                                                                    <div class="col-6">
-                                                                        <button style="float:left;" type="button" class="btn" wire:click="editCourse({{ $member_course->id }})" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
-                                                                    </div>
-                                                                    <div class="col-6">
-                                                                        <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCourse({{ $member_course->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Elimina"><i class="fa-regular fa-trash-can"></i></button>
-                                                                    </div>
-                                                                </div>
-                                                            </td>
-                                                            <td style="text-align:right;width:5%">
-                                                                @php
-                                                                $status = $member_course->getStatus();
-                                                                @endphp
-                                                                <a href="/rates?member_id={{$member_course->member_id}}&member_course_id={{$member_course->id}}"><span class="badge tessera-badge {{$status == 0 ? 'due' : ($status == 1 ? 'active' : 'suspended')}}">{{$status == 0 ? 'Da pagare' : ($status == 1 ? 'Pagato' : 'Sospeso')}}</span></a>
-                                                                @if($member_course->notes != '')
-                                                                    <button type="button" class="btn" wire:click="showHideCourse({{ $member_course->id }})"><i class="fa-solid fa-chevron-down"></i></button>&nbsp;
+                                                                @if(!$ok)
+                                                                    @foreach(json_decode($member_course->course->when) as $xx => $x)
+                                                                        @php
+                                                                        $ok = true;
+                                                                        @endphp
+                                                                        @if($xx > 0)
+                                                                            <br>
+                                                                        @endif
+                                                                        @foreach($x->day as $zz => $d)
+                                                                            {{$zz > 0 ? '-' : ''}}{{$d}}
+                                                                        @endforeach
+                                                                        @if($x->from != '')
+                                                                            h {{$x->from}} - {{$x->to}}
+                                                                        @endif
+                                                                    @endforeach
                                                                 @endif
                                                             </td>
+                                                            <td style="width:30%" colspan="2">
+                                                                {{date("d/m/Y", strtotime($member_course->date_from))}} - {{date("d/m/Y", strtotime($member_course->date_to))}}                                                                
+                                                            </td>
                                                             
                                                         </tr>
                                                         @if(in_array($member_course->id, $showCourse))
@@ -1248,7 +1270,7 @@
                                                             &nbsp;&nbsp;&nbsp;
                                                             <input type="radio" name="chkType" value="custom" wire:model="course_course_type">&nbsp;Personalizzato
                                                         </div>
-                                                        <div class="row">
+                                                        <div class="row mt-3">
 
                                                             <div class="col-md-4">
                                                                 <label for="course_name" class="form-label">Corso</label>

+ 3 - 3
resources/views/livewire/rate.blade.php

@@ -87,7 +87,7 @@
                     <th scope="col">Rata</th>
                     <th scope="col">Competenza</th>
                     <th scope="col">Prezzo</th>
-                    <th scope="col">Stato pagamento</th>
+                    <th scope="col" style="text-align:center">Stato pagamento</th>
                     <th scope="col">...</th>
                 </tr>
             </thead>
@@ -107,8 +107,8 @@
                             @endif
                         </td>
                         <td>{{formatPrice($record->price)}}</td>
-                        <td>
-                            <span class="tablesaw-cell-content">
+                        <td  style="text-align:center">
+                            <span class="tablesaw-cell-content" >
                                 <span class="badge tessera-badge {{$record->status == 0 ? 'due' : ($record->status == 1 ? 'active' : 'suspended')}}">{{$record->status == 0 ? 'Da pagare' : ($record->status == 1 ? 'Pagato' : 'Sospeso')}}</span>
                             </span>
                         </td>