Luca Parisio пре 10 месеци
родитељ
комит
439f2b42cd

+ 0 - 75
app/Http/Livewire/Course.php

@@ -23,9 +23,6 @@ class Course extends Component
         $price,
         $subscription_price,
         $months,
-        $when,
-        $prices,
-        $type,
         $date_from, $date_to;
 
     public $categories = array();
@@ -84,11 +81,6 @@ class Course extends Component
         $this->date_to = null;
         $this->months = array();
         $this->enabled = true;
-        $this->type = 'standard';
-        $this->when = array();
-        $this->when[] = array('day' => array(), 'from' => '', 'to' => '');
-        $this->prices = [];
-        $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
         $this->emit('load-data-table');
     }
 
@@ -190,9 +182,6 @@ class Course extends Component
                 'price' => currencyToDouble($this->price),
                 'subscription_price' => currencyToDouble($this->subscription_price),
                 'months' => json_encode($this->months),
-                'type' => $this->type,
-                'when' => json_encode($this->when),
-                'prices' => json_encode($this->prices),
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Corso creato');
@@ -229,32 +218,6 @@ class Course extends Component
                 $this->price = formatPrice($course->price);
                 $this->subscription_price = formatPrice($course->subscription_price);
                 $this->months = json_decode($course->months);
-                $this->when = array();
-                if ($course->when != null)
-                {
-                    foreach(json_decode($course->when) as $z)
-                    {
-                        $this->when[] = array("day" => $z->day, "from" => $z->from, "to" => $z->to);
-                    }
-                }
-                else
-                {
-                    $this->when[] = array('day' => array(), 'from' => '', 'to' => '');
-                }
-        
-                $this->prices = array();
-                if ($course->prices != null)
-                {
-                    foreach(json_decode($course->prices) as $z)
-                    {
-                        $this->prices[] = array("course_subscription_id" => $z->course_subscription_id, "price" => $z->price);
-                    }
-                }
-                else
-                {
-                    $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
-                }
-                $this->type = $course->type;
                 $this->dataId = $course->id;
                 $this->update = true;
                 $this->add = false;
@@ -287,9 +250,6 @@ class Course extends Component
                 'price' => currencyToDouble($this->price),
                 'subscription_price' => currencyToDouble($this->subscription_price),
                 'months' => json_encode($this->months),
-                'type' => $this->type,
-                'when' => json_encode($this->when),
-                'prices' => json_encode($this->prices),
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Corso aggiornato');
@@ -358,40 +318,5 @@ class Course extends Component
         return redirect()->to('/courses');
     }
 
-    public function setDay($idx, $d)
-    {
-
-        if (in_array($d, $this->when[$idx]["day"]))
-        {
-            $i = array_search($d, $this->when[$idx]["day"]);
-            array_splice($this->when[$idx]["day"], $i, 1);
-
-        }
-        else
-        {
-            $this->when[$idx]["day"][] = $d;
-        }
-
-    }
-
-    public function addRow()
-    {
-        $this->when[] = array('day' => array(), 'from' => '', 'to' => '');
-    }
-
-    public function delRow($idx)
-    {
-        unset($this->when[$idx]);
-    }
-
-    public function addPrice()
-    {
-        $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
-    }
-
-    public function delPrice($idx)
-    {
-        unset($this->prices[$idx]);
-    }
 
 }

+ 0 - 3
app/Models/Course.php

@@ -29,9 +29,6 @@ class Course extends Model
         'sub_causal_id',
         'category_id',
         'active',
-        'type',
-        'when',
-        'prices',
         'instructor_id'
     ];
 

+ 0 - 36
database/migrations/2025_03_07_173000_add_fields_to_courses_table.php

@@ -1,36 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-return new class extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::table('courses', function (Blueprint $table) {
-            $table->json('when')->nullable();
-            $table->json('prices')->nullable();
-            $table->enum('type', ['standard', 'custom']);
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::table('courses', function (Blueprint $table) {
-            $table->dropColumn('when');
-            $table->dropColumn('prices');
-            $table->dropColumn('type');
-        });
-    }
-};

+ 0 - 36
database/migrations/2025_03_07_173000_ass_fields_to_create_course_table.php

@@ -1,36 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-return new class extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::table('courses', function (Blueprint $table) {
-            $table->json('when')->nullable();
-            $table->json('prices')->nullable();
-            $table->enum('type', ['standard', 'custom']);
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::table('courses', function (Blueprint $table) {
-            $table->dropColumn('when');
-            $table->dropColumn('prices');
-            $table->dropColumn('type');
-        });
-    }
-};

+ 4 - 4
resources/views/layouts/app.blade.php

@@ -305,15 +305,15 @@
                     </div>
                     <div class="accordion-item">
                         <h2 class="accordion-header linkMenu" id="headingThree">
-                            <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="{{Request::is('course_member_one') || Request::is('course_member_two') || Request::is('course_list') || Request::is('course_member') ? 'true' : 'false'}}" aria-controls="collapseThree">
+                            <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="{{Request::is('course_list') || Request::is('course_member') ? 'true' : 'false'}}" aria-controls="collapseThree">
                                 Corsi
                             </button>
                         </h2>
-                        <div id="collapseThree" class="accordion-collapse collapse {{Request::is('course_member_one') || Request::is('course_member_two') || Request::is('course_list') || Request::is('course_member') ? 'show' : ''}}" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
+                        <div id="collapseThree" class="accordion-collapse collapse {{Request::is('course_list') || Request::is('course_member') ? 'show' : ''}}" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
                             <div class="accordion-body">
                                 <ul class="nav nav-pills flex-column align-items-center align-items-sm-start w-100" id="menu-contabilita" style="margin-top:0px;">
-                                    <li class="nav-item" style="{{Request::is('course_member_one') || Request::is('course_member_two') || Request::is('course_member') ? 'background-color: #c5d9e6;' : ''}}">
-                                        <a href="/{{env('MANAGE_COURSE', false) ? 'course_member_one' : 'course_member'}}" class="nav-link d-flex align-items-center linkMenu">
+                                    <li class="nav-item" style="{{Request::is('course_member') ? 'background-color: #c5d9e6;' : ''}}">
+                                        <a href="/course_member" class="nav-link d-flex align-items-center linkMenu">
                                             <span class="ms-3 d-md-inline">Iscritti</span>
                                         </a>
                                     </li>

+ 0 - 116
resources/views/livewire/course.blade.php

@@ -114,13 +114,6 @@
                     <form action="">
 
                         <div class="row mb-3 ">
-                            @if(env('MANAGE_COURSE', false))
-                                <div class="col-12 mt-2">
-                                    <input type="radio" name="chkType" value="standard" wire:model="type">&nbsp;Standard
-                                    &nbsp;&nbsp;&nbsp;
-                                    <input type="radio" name="chkType" value="custom" wire:model="type">&nbsp;Personalizzato
-                                </div>
-                            @endif
                             <div class="col-6 mt-2">
                                 <div class="form--item">
                                     <label for="inputName" class="form-label">Nome</label>
@@ -276,118 +269,9 @@
                                 </div>
                             </div>
 
-                            @if(env('MANAGE_COURSE', false))
-
-                                <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">
-                                                        @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>
-                                        @endforeach
-                                    </div>
-                                </div>
-
-                                @if($type == 'standard')
-
-                                    @foreach($when as $idW => $w)
-
-                                        <div class="col-12">
-                                            <div class="day durata--corso d-flex">
-                                                <label for="" class="form-label">Giorno</label>
-                                                <div class="durata--corso_days mb-3">
-                                                    <a class="{{in_array('lun', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'lun')">Lun</a>
-                                                    <a class="{{in_array('mar', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mar')">Mar</a>
-                                                    <a class="{{in_array('mer', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mer')">Mer</a>
-                                                    <a class="{{in_array('gio', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'gio')">Gio</a>
-                                                    <a class="{{in_array('ven', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'ven')">Ven</a>
-                                                    <a class="{{in_array('sab', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'sab')">Sab</a>
-                                                    <a class="{{in_array('dom', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'dom')">Dom</a>
-                                                </div>
-
-                                                <div class="durata--corso_select">
-                                                    <div class="from--h me-3">
-                                                        <label for="" class="form-label">Dalle</label>
-                                                        <select class="form-select" wire:model="when.{{$idW}}.from">
-                                                            <option value="">--Seleziona--
-                                                            @for($c=6;$c<=23;$c++)
-                                                                <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
-                                                                <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
-                                                            @endfor
-                                                        </select>
-                                                    </div>
-                                                    <div class="to--h">
-                                                        <label for="" class="form-label">Alle</label>
-                                                        <select class="form-select" wire:model="when.{{$idW}}.to">
-                                                            <option value="">--Seleziona--
-                                                            @for($c=6;$c<=23;$c++)
-                                                                <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
-                                                                <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
-                                                            @endfor
-                                                        </select>
-                                                    </div>
-                                                </div>
-
-                                                <button class="btn--ui primary remove--day position-absolute" wire:click.prevent="delRow({{$idW}})"><i class="fa-solid fa-minus"></i></button>
-                                                <button class="btn--ui primary add--day position-absolute" wire:click.prevent="addRow()"><i class="fa-solid fa-plus"></i></button>
-                                            </div>
-                                        </div>
-
-                                    @endforeach
-                                
-                                @endif
-
-                                <!--<div class="col-6">
-                                    <div class="form--item">
-                                        <label for="inputName" class="form-label">Durata</label>
-                                        <input class="form-control js-keyupTitle " type="text" id="duration" placeholder="Durata" wire:model="duration">
-
-                                    </div>
-                                </div>-->
-                                @if(false)
-                                    <div class="col-12">
-                                        <div class="form--item">
-                                            <label for="inputName" class="form-label">Seleziona mesi</label>
-                                            @foreach($monthList as $idx => $y)
-                                                <div class="row">
-                                                    <div class="col-12">
-                                                        <b>{{$idx}}</b>
-                                                    </div>
-                                                    @foreach($y as $m)
-                                                        <div class="col-3">{{$m}}</div>
-                                                    @endforeach
-                                                </div>
-                                                <div class="row"><br></div>
-                                            @endforeach
-                                        </div>
-                                    </div>
-                                @endif
-                            
-                            @endif
                             
                         </div>
 
-
-
                         <div class="form--item">
                             <button type="button" class="btn--ui lightGrey" onclick="annulla()">Annulla</button>
                             @if($add)