| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <?php
- use Illuminate\Support\Facades\Route;
- /*
- |--------------------------------------------------------------------------
- | Web Routes
- |--------------------------------------------------------------------------
- |
- | Here is where you can register web routes for your application. These
- | routes are loaded by the RouteServiceProvider within a group which
- | contains the "web" middleware group. Now create something great!
- |
- */
- Route::get('/', function () {
- return view('login');
- // return Redirect::to('/dashboard');
- });
- //Route::get('/', \App\Http\Livewire\Login::class);
- Route::get('/dashboard', \App\Http\Livewire\Dashboard::class);
- Route::get('/settings', \App\Http\Livewire\Setting::class);
- Route::get('/courses', \App\Http\Livewire\Course::class);
- Route::get('/categories', \App\Http\Livewire\Category::class);
- Route::get('/nations_list', \App\Http\Livewire\Nation::class);
- Route::get('/provinces', \App\Http\Livewire\Province::class);
- Route::get('/cities', \App\Http\Livewire\City::class);
- Route::get('/banks', \App\Http\Livewire\Bank::class);
- Route::get('/vats', \App\Http\Livewire\Vat::class);
- Route::get('/cards', \App\Http\Livewire\Card::class);
- Route::get('/causals', \App\Http\Livewire\Causal::class);
- Route::get('/payment_methods', \App\Http\Livewire\PaymentMethod::class);
- Route::get('/members', \App\Http\Livewire\Member::class);
- Route::get('/suppliers', \App\Http\Livewire\Supplier::class);
- Route::get('/sponsors', \App\Http\Livewire\Sponsor::class);
- Route::get('/records', \App\Http\Livewire\Record::class);
- Route::get('/reminders', \App\Http\Livewire\Reminder::class);
- Route::get('/in', \App\Http\Livewire\RecordIN::class);
- Route::get('/out', \App\Http\Livewire\RecordOUT::class);
- Route::get('/records_in_out', \App\Http\Livewire\RecordINOUT::class);
- Route::get('/nations', function(){
- if (isset($_GET["q"]))
- $datas = \App\Models\Nation::where('name', 'like', $_GET["q"] . '%')->orderBy('name')->get();
- else
- $datas = \App\Models\Nation::orderBy('name')->get();
- $data = array();
- foreach($datas as $d)
- {
- $data[] = array("id" => $d->id, "text" => $d->name);
- }
- return array("results" => $data);
- });
- Route::get('/provinces/{nation_id}', function($nation_id){
- if (isset($_GET["q"]))
- $datas = \App\Models\Province::where('nation_id', $nation_id)->where('name', 'like', $_GET["q"] . '%')->orderBy('name')->get();
- else
- $datas = \App\Models\Province::where('nation_id', $nation_id)->orderBy('name')->get();
- $data = array();
- foreach($datas as $d)
- {
- $data[] = array("id" => $d->id, "text" => $d->name);
- }
- return array("results" => $data);
- });
- Route::get('/cities/{province_id}', function($province_id){
- if (isset($_GET["q"]))
- $datas = \App\Models\City::where('province_id', $province_id)->where('name', 'like', $_GET["q"] . '%')->orderBy('name')->get();
- else
- $datas = \App\Models\City::where('province_id', $province_id)->orderBy('name')->get();
- $data = array();
- foreach($datas as $d)
- {
- $data[] = array("id" => $d->id, "text" => $d->name);
- }
- return array("results" => $data);
- });
- Route::get('/get_members', function(){
- $datas = [];
- // $datas = \App\Models\Member::select('members.*')->where('id', '>', 0);
- $x = \App\Models\Member::select('id', 'first_name', 'last_name', 'phone')->where('id', '>', 0);
- if ($_GET["cards"] != "")
- {
- $card_ids = \App\Models\MemberCard::whereIn('card_id', explode(",", $_GET["cards"]))->pluck('member_id');
- $x = $x->whereIn('id', $card_ids);
- }
- if ($_GET["categories"] != "")
- {
- $cats_ids = \App\Models\MemberCategory::whereIn('category_id', explode(",", $_GET["categories"]))->pluck('member_id');
- $x = $x->whereIn('id', $cats_ids);
- }
- $certs = [];
- if ($_GET["chkCertificateNormal"] != "")
- {
- $normal = \App\Models\MemberCertificate::where('type', 'N')->pluck('member_id');
- $x = $x->whereIn('id', $normal);;
- }
- if ($_GET["chkCertificateAgonistico"] != "")
- {
- $agonistic = \App\Models\MemberCertificate::where('type', 'A')->pluck('member_id');
- $x = $x->whereIn('id', $agonistic);
- }
- if ($_GET["chkCertificateScaduti"] != "")
- {
- $scaduto = \App\Models\MemberCertificate::where('expire_date', '<', date("Y-m-d"))->pluck('member_id');
- $x = $x->whereIn('id', $scaduto);
- }
- if ($_GET["chkCertificateScadenza"] != "")
- {
- $scadenza = \App\Models\MemberCertificate::whereBetween('expire_date', [date("Y-m-d"), date("Y-m-d", strtotime("+1 month"))])->pluck('member_id');
- $x = $x->whereIn('id', $scadenza);
- }
- if (sizeof($certs) > 0)
- {
- $x = $x->whereIn('id', $certs);
- }
- $x = $x->get();
- foreach($x as $idx => $r)
- {
- $status = $r->getStatus();
- $status = $status["status"];
- $class = $status > 0 ? ($status == 2 ? 'active' : 'suspended') : 'due';
- $text = $status > 0 ? ($status == 2 ? 'Tesserato' : 'Sospeso') : 'Non tesserato';
- $state = $r->isActive();
- $x = $state["status"] > 0 ? ($state["status"] == 2 ? 'active' : 'suspended') : '';
- $x .= "|";
- $x .= $state["status"] > 0 ? ($state["status"] == 2 ? 'Attivo' : 'Sospesa') : '';
- $x .= "|";
- $x .= $state["status"] ? 'Scadenza : ' : ($state["date"] != '' ? 'Scaduto : ' : '');
- $x .= "|";
- $x .= $state["date"] != '' ? date("d/m/Y", strtotime($state["date"])) : '';
- $has_certificate = $r->hasCertificate();
- $y = '';
- if($has_certificate["date"] != '')
- {
- if($has_certificate["date"] < date("Y-m-d"))
- $y .= '0';
- if($has_certificate["date"] >= date("Y-m-d") && $has_certificate["date"] < date("Y-m-d", strtotime("+1 month")))
- $y .= '1';
- if($has_certificate["date"] >= date("Y-m-d", strtotime("+1 month")))
- $y .= '2';
- $y .= '|';
- $y .= $has_certificate["date"] != '' ? date("d/m/Y", strtotime($has_certificate["date"])) : '';
- }
- $datas[] = array(
- 'id' => $r->id,
- 'first_name' => $r->first_name,
- 'last_name' => $r->last_name,
- 'phone' => $r->phone,
- 'age' => $r->getAge(),
- 'status' => $class . "|" . $text,
- 'state' => $x,
- 'certificate' => $y,
- 'action' => $r->id
- );
- /*
- $r->age = $r->getAge();
- $active = $r->isActive();
- $r->status = $active["status"];
- $r->date = $active["date"] . "|" . $r->hasCertificate()["date"];
- $r->state = $r->getStatus()["status"];
- $r->action = '';*/
- }
- /*
- if ($this->sortAsc)
- $this->records = $this->records->sortBy($this->sortField);
- else
- $this->records = $this->records->sortByDesc($this->sortField);
- */
- // $datas = $x; // ->orderBy($this->sortField, $this->sortAsc ? 'ASC' : 'DESC')->paginate(10);
- return json_encode(array("data" => $datas));
- });
|