@php use App\Http\Controllers\ActivityController; use Carbon\Carbon; @endphp @extends('layouts.master') @section('title', 'Activity Import') @php if (empty($activity)) { $activity_id = ''; $activity_code = ''; $activity_academic_year = ''; $activity_name_en = ''; $activity_name_th = ''; $activity_name = ''; $activity_type1 = ''; $activity_type_code = ''; // $activity_organized = ''; $activity_club = ''; $activity_date_begin = ''; $activity_date_end = ''; $activity_time = ''; $activity_place = ''; $activity_detail_en = ''; $activity_detail_th = ''; $activity_participants = ''; // $activity_academic_gen = ''; } else { $activity_id = $activity->activity_id; $activity_code = $activity->activity_code; $activity_academic_year = $activity->activity_academic_year; $activity_name_en = $activity->activity_name_en; $activity_name_th = $activity->activity_name_th; $activity_name = $activity->activity_name; $activity_type1 = $activity->activity_type1; $activity_type_code = $activity->activity_type_code; // $activity_organized = $activity->activity_organized; $activity_club = $activity->activity_club; $activity_date_begin = $activity->activity_date_begin; $activity_date_end = $activity->activity_date_end; $activity_time = $activity->activity_time; $activity_place = $activity->activity_place; $activity_detail_en = $activity->activity_detail_en; $activity_detail_th = $activity->activity_detail_th; $activity_participants = $activity->activity_participants; // $activity_academic_gen = $activity->activity_academic_gen; } $academicyear_cut = DB::table('academic_year')->where('academic_year_id', $activity_academic_year)->first(); $cut_str = ''; if ($academicyear_cut && isset($academicyear_cut->academic_year)) { $cut_str = substr($academicyear_cut->academic_year, 2); } // echo $cut_str; $activity_count = DB::table('report_activity')->get(); $count_activity = count($activity_count); // echo $count_activity; $number = str_pad($count_activity, 3, '0', STR_PAD_LEFT); $number1 = str_pad((int) $number + 1, 3, '0', STR_PAD_LEFT); $number = 0; $gencode = 'AP45'; function get_type($name) { $type = DB::table('type')->where('type_code', $name)->first(); if ($type == '') { return 0; } else { return $type->type_id; } } function get_tu_greats($tu_greats) { $tugreats = DB::table('tu_greats')->where('tugreats_code', $tu_greats)->first(); if ($tugreats == '') { return 0; } else { return $tugreats->tu_greats_id; } } @endphp @section('style') @endsection @section('script') @endsection @section('content') @include('layouts.header')
| No. | {{--Code | --}}Academic Year | Activity Name(EN) | Activity Name(TH) | Type | Tu Greats | Club | Date of Activity | Time | Place | Detail(EN) | Detail(Th) | {{--Status | --}}
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ ++$key }} | {{--{{ $gencode }}{{ $cut_str2 }} | --}}{{ $new_data->activity_year }} | {{ $new_data->activity_name_en }} | {{ $new_data->activity_name_th }} |
@php
$check_type = explode(',', $new_data->type);
@endphp
@foreach ($check_type as $i => $check_type1)
@if (get_type($check_type1) == '0')
{{ $check_type1 }}
@else
{{ $check_type1 }}
@endif
@endforeach |
@php
$check_tu_greats = explode(',', $new_data->activity_tu_greats);
@endphp
@foreach ($check_tu_greats as $i => $tugreats)
@if (get_tu_greats($tugreats) == '0')
{{ $tugreats }}
@else
{{ $tugreats }}
@endif
@endforeach |
@if (ActivityController::check_club(trim($new_data->club)) == 0) {{ $new_data->club }} @else {{ $new_data->club }} @endif | @php $date_start = $new_data->date_start ?? null; $date_end = $new_data->date_end ?? null; // แก้ไขให้ใช้ date_end ด้วย if ($date_start && Carbon::hasFormat($date_start, 'd/m/Y')) { $date_start = Carbon::createFromFormat( 'd/m/Y', $date_start, )->format('Y-m-d'); } else { $date_start = 'Invalid Date'; } if ($date_end && Carbon::hasFormat($date_end, 'd/m/Y')) { $date_end = Carbon::createFromFormat( 'd/m/Y', $date_end, )->format('Y-m-d'); } else { $date_end = 'Invalid Date'; } @endphp {{ $date_start }} - {{ $date_end }} | {{ $new_data->activity_time_start }} - {{ $new_data->activity_time_end }} | {{ $new_data->activity_place }} | {{ $new_data->activity_detail_en }} | {{ $new_data->activity_detail_th }} |