handle file input dan fix nidn checking
This commit is contained in:
parent
1c9c74432d
commit
d2ac14a48f
@ -169,56 +169,6 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// public function signup(Request $request)
|
||||
// {
|
||||
// $response = [];
|
||||
|
||||
// $rules = [
|
||||
// 'name' => ['required', 'string', 'max:255'],
|
||||
// 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
// 'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||
// ];
|
||||
|
||||
// $validator = Validator::make($request->all(), $rules);
|
||||
// if ($validator->fails()) {
|
||||
// return response()->json(['validationError' => $validator->errors()], 422);
|
||||
// }
|
||||
|
||||
// $user_data = [
|
||||
// 'name' => $request->name,
|
||||
// 'email' => $request->email,
|
||||
// 'role' => 'student',
|
||||
// 'status' => 1,
|
||||
// 'password' => Hash::make($request->password),
|
||||
// ];
|
||||
|
||||
// if (get_settings('student_email_verification') != 1) {
|
||||
// $user_data['email_verified_at'] = now();
|
||||
// }
|
||||
|
||||
// $user = User::create($user_data);
|
||||
|
||||
// if (get_settings('student_email_verification') == 1) {
|
||||
// $user->sendEmailVerificationNotification();
|
||||
// }
|
||||
|
||||
// if ($user) {
|
||||
// $response = [
|
||||
// 'success' => true,
|
||||
// 'message' => 'User created successfully',
|
||||
// ];
|
||||
// } else {
|
||||
// $response = [
|
||||
// 'success' => false,
|
||||
// 'message' => 'User creation failed',
|
||||
// ];
|
||||
// }
|
||||
|
||||
// event(new Registered($user));
|
||||
|
||||
// return response()->json($response);
|
||||
// }
|
||||
|
||||
//student logout function
|
||||
public function logout(Request $request)
|
||||
{
|
||||
@ -229,30 +179,6 @@ class ApiController extends Controller
|
||||
], 201);
|
||||
}
|
||||
|
||||
// forgot password
|
||||
// public function forgot_password(Request $request): RedirectResponse
|
||||
// {
|
||||
// $request->validate([
|
||||
// 'email' => 'required|email',
|
||||
// ]);
|
||||
|
||||
// // We will send the password reset link to this user. Once we have attempted
|
||||
// // to send the link, we will examine the response then see the message we
|
||||
// // need to show to the user. Finally, we'll send out a proper response.
|
||||
// $status = Password::sendResetLink(
|
||||
// $request->only('email')
|
||||
// );
|
||||
|
||||
// if ($status == Password::RESET_LINK_SENT) {
|
||||
// return back()->with('status', __($status));
|
||||
// }
|
||||
|
||||
// throw ValidationException::withMessages([
|
||||
// 'email' => [trans($status)],
|
||||
// ]);
|
||||
// }
|
||||
|
||||
|
||||
public function forgot_password(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
@ -274,7 +200,6 @@ class ApiController extends Controller
|
||||
return response()->json($response, 400);
|
||||
}
|
||||
|
||||
|
||||
// update user data
|
||||
public function update_userdata(Request $request)
|
||||
{
|
||||
@ -331,7 +256,6 @@ class ApiController extends Controller
|
||||
return $response;
|
||||
}
|
||||
|
||||
//
|
||||
public function top_courses($top_course_id = "")
|
||||
{
|
||||
$query = Course::orderBy('id', 'desc')->where('status', 'active')->limit(10)->get();
|
||||
@ -386,23 +310,13 @@ class ApiController extends Controller
|
||||
$categories = array();
|
||||
$categories = sub_categories($request->category_id);
|
||||
|
||||
// $response['sub_categories'] = $categories;
|
||||
|
||||
$response[0]['sub_categories'] = $categories;
|
||||
|
||||
$courses = get_category_wise_courses($request->category_id);
|
||||
|
||||
$response[0]['courses'] = course_data($courses);
|
||||
|
||||
// foreach ($response as $key => $resp) {
|
||||
// $response[$key]['sub_categories'] = $categories;
|
||||
// }
|
||||
|
||||
return $response;
|
||||
|
||||
// $response['courses'] = $result;
|
||||
|
||||
// return $response;
|
||||
}
|
||||
|
||||
// Fetch all the categories
|
||||
@ -440,9 +354,6 @@ class ApiController extends Controller
|
||||
// Filter course
|
||||
public function filter_course(Request $request)
|
||||
{
|
||||
// $courses = $this->api_model->filter_course();
|
||||
// $this->set_response($courses, REST_Controller::HTTP_OK);
|
||||
|
||||
$selected_category = $request->selected_category;
|
||||
$selected_price = $request->selected_price;
|
||||
$selected_level = $request->selected_level;
|
||||
@ -450,8 +361,6 @@ class ApiController extends Controller
|
||||
$selected_rating = $request->selected_rating;
|
||||
$selected_search_string = ltrim(rtrim($request->selected_search_string));
|
||||
|
||||
// $course_ids = array();
|
||||
|
||||
$query = Course::query();
|
||||
|
||||
if ($selected_search_string != "" && $selected_search_string != "null") {
|
||||
@ -481,21 +390,6 @@ class ApiController extends Controller
|
||||
$query->where('status', 'active');
|
||||
$courses = $query->get();
|
||||
|
||||
// foreach ($courses as $course) {
|
||||
// if ($selected_rating != "all") {
|
||||
// $total_rating = $this->crud_model->get_ratings('course', $course['id'], true)->row()->rating;
|
||||
// $number_of_ratings = $this->crud_model->get_ratings('course', $course['id'])->num_rows();
|
||||
// if ($number_of_ratings > 0) {
|
||||
// $average_ceil_rating = ceil($total_rating / $number_of_ratings);
|
||||
// if ($average_ceil_rating == $selected_rating) {
|
||||
// array_push($course_ids, $course['id']);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// array_push($course_ids, $course['id']);
|
||||
// }
|
||||
// }
|
||||
|
||||
// This block of codes return the required data of courses
|
||||
$result = array();
|
||||
$result = course_data($courses);
|
||||
@ -601,8 +495,6 @@ class ApiController extends Controller
|
||||
} else {
|
||||
$response = array();
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return $response;
|
||||
@ -893,11 +785,4 @@ class ApiController extends Controller
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -86,30 +86,52 @@ class RegisteredUserController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$user_data = [
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'role' => 'student',
|
||||
'status' => 1,
|
||||
'password' => Hash::make($request->password),
|
||||
];
|
||||
// Start database transaction for the entire registration process
|
||||
$user = null;
|
||||
|
||||
if (get_settings('student_email_verification') != 1) {
|
||||
$user_data['email_verified_at'] = Carbon::now();
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$user_data = [
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'role' => 'student',
|
||||
'status' => 1,
|
||||
'password' => Hash::make($request->password),
|
||||
];
|
||||
|
||||
if (get_settings('student_email_verification') != 1) {
|
||||
$user_data['email_verified_at'] = Carbon::now();
|
||||
}
|
||||
|
||||
$user = User::create($user_data);
|
||||
event(new Registered($user));
|
||||
|
||||
// If applying as an instructor, process the application
|
||||
if ($request->has('instructor')) {
|
||||
$result = $this->processInstructorApplication($request, $user);
|
||||
if ($result instanceof RedirectResponse && $result->getSession()->get('error')) {
|
||||
// If there was an error in instructor application, rollback
|
||||
DB::rollBack();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
// Log the user in after successful registration
|
||||
Auth::login($user);
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
if (DB::transactionLevel() > 0) {
|
||||
DB::rollBack();
|
||||
}
|
||||
|
||||
Log::error('Registration error:', ['error' => $e->getMessage()]);
|
||||
Session::flash('error', get_phrase('Error during registration. Please try again.'));
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
$user = User::create($user_data);
|
||||
event(new Registered($user));
|
||||
|
||||
// If applying as an instructor, process the application
|
||||
if ($request->has('instructor')) {
|
||||
return $this->processInstructorApplication($request, $user);
|
||||
}
|
||||
|
||||
// Log the user in after successful registration
|
||||
Auth::login($user);
|
||||
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
|
||||
private function processInstructorApplication(Request $request, User $user): RedirectResponse
|
||||
@ -120,79 +142,73 @@ class RegisteredUserController extends Controller
|
||||
return redirect()->route('become.instructor');
|
||||
}
|
||||
|
||||
try {
|
||||
// Check NIDN with the API
|
||||
$nidn = $request->nidn;
|
||||
$api_url = "https://sindig.unesa.ac.id/apipddikti/api?nidn={$nidn}&auto=1";
|
||||
// Check if NIDN already exists in Instructors table with status = 1 (active)
|
||||
$nidn = $request->nidn;
|
||||
$existingInstructor = Instructors::where('nidn', $nidn)
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
$response = Http::timeout(30)->get($api_url);
|
||||
$data = $response->json();
|
||||
|
||||
Log::info('API Response for NIDN: ' . $nidn, ['response' => $data]);
|
||||
|
||||
// Extract matched dosen data
|
||||
$matched_dosen = $data['matched_dosen'][0];
|
||||
Log::info('Instructor data to be saved:', $matched_dosen);
|
||||
|
||||
if (!isset($data['ok']) || !isset($data['matched_dosen']) || count($data['matched_dosen']) == 0) {
|
||||
Session::flash('error', get_phrase('NIDN not found in the system. Please check your NIDN.'));
|
||||
return redirect()->back()->withInput();
|
||||
}else if ($matched_dosen['nama'] != $user->name){
|
||||
Session::flash('error', get_phrase('Name does not match PDDikti records. Please check your name.'));
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
Log::info('API Response for Nama: ' . $matched_dosen['nama'], ' || nama :',$user->name);
|
||||
|
||||
// Prepare instructor data - adjust fields according to your database
|
||||
$instructor = [
|
||||
'user_id' => $user->id,
|
||||
'nidn' => $nidn,
|
||||
'name' => $matched_dosen['nama'] ?? $user->name,
|
||||
'id_sdm' => $matched_dosen['id'] ?? null,
|
||||
'id_sms' => $matched_dosen['nama_prodi'] ?? null,
|
||||
'id_pt' => $matched_dosen['nama_pt'] ?? null
|
||||
];
|
||||
|
||||
Log::info('Instructor data to be saved:', $instructor);
|
||||
|
||||
// Upload document
|
||||
if ($request->hasFile('document') && $request->file('document')->isValid()) {
|
||||
$doc = $request->file('document');
|
||||
$fileName = 'uploads/applications/' . $user->id . Str::random(20) . '.' . $doc->extension();
|
||||
|
||||
FileUploader::upload($doc, $fileName, null, null, 300);
|
||||
} else {
|
||||
Session::flash('error', 'Document upload failed or no document selected.');
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
// Prepare application data
|
||||
$application = [
|
||||
'user_id' => $user->id,
|
||||
'phone' => $request->phone,
|
||||
'description' => $request->description
|
||||
];
|
||||
|
||||
// Start database transaction to ensure both records are saved
|
||||
DB::transaction(function () use ($application, $instructor) {
|
||||
Application::create($application);
|
||||
Instructors::create($instructor);
|
||||
});
|
||||
|
||||
Session::flash('success', get_phrase('Your application has been submitted successfully.'));
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Instructor registration error:', [
|
||||
'user_id' => $user->id,
|
||||
'error' => $e->getMessage(),
|
||||
'trace' => $e->getTraceAsString()
|
||||
]);
|
||||
|
||||
Session::flash('error', get_phrase('Error while processing your application. Please try again later!'));
|
||||
if ($existingInstructor) {
|
||||
Session::flash('error', get_phrase('This NIDN is already registered as an active instructor.'));
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
// Check NIDN with the API
|
||||
$api_url = "https://sindig.unesa.ac.id/apipddikti/api?nidn={$nidn}&auto=1";
|
||||
|
||||
$response = Http::timeout(30)->get($api_url);
|
||||
$data = $response->json();
|
||||
|
||||
Log::info('API Response for NIDN: ' . $nidn, ['response' => $data]);
|
||||
|
||||
// Extract matched dosen data
|
||||
$matched_dosen = $data['matched_dosen'][0];
|
||||
Log::info('Instructor data to be saved:', $matched_dosen);
|
||||
|
||||
if (!isset($data['ok']) || !isset($data['matched_dosen']) || count($data['matched_dosen']) == 0) {
|
||||
Session::flash('error', get_phrase('NIDN not found in the system. Please check your NIDN.'));
|
||||
return redirect()->back()->withInput();
|
||||
} else if (strtolower($matched_dosen['nama']) != strtolower($user->name)) {
|
||||
Session::flash('error', get_phrase('Name does not match PDDikti records. Please check your name.'));
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
// Prepare instructor data - adjust fields according to your database
|
||||
$instructor = [
|
||||
'user_id' => $user->id,
|
||||
'nidn' => $nidn,
|
||||
'name' => $matched_dosen['nama'] ?? $user->name,
|
||||
'id_sdm' => $matched_dosen['id'] ?? null,
|
||||
'id_sms' => $matched_dosen['nama_prodi'] ?? null,
|
||||
'id_pt' => $matched_dosen['nama_pt'] ?? null,
|
||||
'status' => 0
|
||||
];
|
||||
|
||||
Log::info('Instructor data to be saved:', $instructor);
|
||||
|
||||
// Upload document
|
||||
if ($request->hasFile('document') && $request->file('document')->isValid()) {
|
||||
$doc = $request->file('document');
|
||||
$fileName = 'uploads/applications/' . $user->id . Str::random(20) . '.' . $doc->extension();
|
||||
|
||||
FileUploader::upload($doc, $fileName, null, null, 300);
|
||||
} else {
|
||||
Session::flash('error', 'Document upload failed or no document selected.');
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
// Prepare application data
|
||||
$application = [
|
||||
'user_id' => $user->id,
|
||||
'phone' => $request->phone,
|
||||
'description' => $request->description
|
||||
];
|
||||
|
||||
// Create both application and instructor records
|
||||
Application::create($application);
|
||||
Instructors::create($instructor);
|
||||
|
||||
Session::flash('success', get_phrase('Your application has been submitted successfully.'));
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Application;
|
||||
use App\Models\Course;
|
||||
use App\Models\Enrollment;
|
||||
use App\Models\Instructors;
|
||||
use App\Models\FileUploader;
|
||||
use App\Models\Payout;
|
||||
use App\Models\Permission;
|
||||
@ -16,10 +17,11 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
@ -42,12 +44,28 @@ class UsersController extends Controller
|
||||
public function admin_store(Request $request)
|
||||
{
|
||||
|
||||
$validated = $request->validate([
|
||||
'name' => "required",
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => "required|max:255",
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => "required|min:8",
|
||||
], [
|
||||
'name.required' => get_phrase('Name is required'),
|
||||
'name.string' => get_phrase('Name must be a valid text'),
|
||||
'name.max' => get_phrase('Name may not be greater than 255 characters'),
|
||||
'email.required' => get_phrase('Email is required'),
|
||||
'email.string' => get_phrase('Email must be a valid text'),
|
||||
'email.email' => get_phrase('Please enter a valid email address'),
|
||||
'email.unique' => get_phrase('This email is already registered. Please use a different email.'),
|
||||
'password.required' => get_phrase('Password is required'),
|
||||
'password.min' => get_phrase('Password must be at least 8 characters'),
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$firstError = $validator->errors()->first();
|
||||
Session::flash('error', $firstError);
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$data['name'] = $request->name;
|
||||
$data['about'] = $request->about;
|
||||
$data['phone'] = $request->phone;
|
||||
@ -90,6 +108,8 @@ class UsersController extends Controller
|
||||
'email' => "required|email|unique:users,email,$id",
|
||||
]);
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['name'] = $request->name;
|
||||
$data['about'] = $request->about;
|
||||
$data['phone'] = $request->phone;
|
||||
@ -176,21 +196,49 @@ class UsersController extends Controller
|
||||
}
|
||||
public function instructor_edit($id = '')
|
||||
{
|
||||
$page_data['instructor'] = User::where('id', $id)->first();
|
||||
$page_data['instructor'] = User::where('users.id', $id)
|
||||
->leftJoin('instructors', 'users.id', '=', 'instructors.user_id')
|
||||
->select('users.*', 'instructors.nidn', 'instructors.status', 'instructors.id_sdm', 'instructors.id_sms', 'instructors.id_pt')
|
||||
->first();
|
||||
|
||||
if (!$page_data['instructor']) {
|
||||
Session::flash('error', get_phrase('Instructor not found'));
|
||||
return redirect()->route('admin.instructor.index');
|
||||
}
|
||||
|
||||
return view('admin.instructor.edit_instructor', $page_data);
|
||||
}
|
||||
public function instructor_store(Request $request, $id = '')
|
||||
{
|
||||
$validated = $request->validate([
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => "required|max:255",
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => "required|min:8",
|
||||
'nidn' => "required"
|
||||
], [
|
||||
'name.required' => get_phrase('Name is required'),
|
||||
'name.string' => get_phrase('Name must be a valid text'),
|
||||
'name.max' => get_phrase('Name may not be greater than 255 characters'),
|
||||
'email.required' => get_phrase('Email is required'),
|
||||
'email.string' => get_phrase('Email must be a valid text'),
|
||||
'email.email' => get_phrase('Please enter a valid email address'),
|
||||
'email.unique' => get_phrase('This email is already registered. Please use a different email.'),
|
||||
'password.required' => get_phrase('Password is required'),
|
||||
'password.min' => get_phrase('Password must be at least 8 characters'),
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$firstError = $validator->errors()->first();
|
||||
Session::flash('error', $firstError);
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
if(get_settings('student_email_verification') != 1){
|
||||
$data['email_verified_at'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['name'] = $request->name;
|
||||
$data['about'] = $request->about;
|
||||
$data['phone'] = $request->phone;
|
||||
@ -213,7 +261,56 @@ class UsersController extends Controller
|
||||
FileUploader::upload($request->photo, $path, 400, null, 200, 200);
|
||||
$data['photo'] = $path;
|
||||
}
|
||||
$user = User::create($data);
|
||||
|
||||
// Check if NIDN already exists in Instructors table with status = 1 (active)
|
||||
$nidn = $request->nidn;
|
||||
$existingInstructor = Instructors::where('nidn', $nidn)
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
if ($existingInstructor) {
|
||||
Session::flash('error', get_phrase('This NIDN is already registered as an active instructor.'));
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
try {
|
||||
$api_url = "https://sindig.unesa.ac.id/apipddikti/api?nidn={$nidn}&auto=1";
|
||||
|
||||
$response = Http::timeout(30)->get($api_url);
|
||||
$apiResponse = $response->json();
|
||||
|
||||
Log::info('API Response for NIDN: ' . $nidn, ['response' => $apiResponse]);
|
||||
|
||||
// Extract matched dosen data
|
||||
$matched_dosen = $apiResponse['matched_dosen'][0];
|
||||
Log::info('Instructor data to be saved:', $matched_dosen);
|
||||
|
||||
if (!isset($apiResponse['ok']) || !isset($apiResponse['matched_dosen']) || count($apiResponse['matched_dosen']) == 0) {
|
||||
Session::flash('error', get_phrase('NIDN not found in the system. Please check your NIDN.'));
|
||||
return redirect()->back()->withInput();
|
||||
}else if (strtolower($matched_dosen['nama']) != strtolower($request->name)) {
|
||||
Session::flash('error', get_phrase('Name does not match PDDikti records. Please check your name.'));
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
$user = User::create($data);
|
||||
// Prepare instructor data - adjust fields according to your database
|
||||
$instructor = [
|
||||
'user_id' => $user->id,
|
||||
'nidn' => $nidn,
|
||||
'name' => $matched_dosen['nama'] ?? null,
|
||||
'id_sdm' => $matched_dosen['id'] ?? null,
|
||||
'id_sms' => $matched_dosen['nama_prodi'] ?? null,
|
||||
'id_pt' => $matched_dosen['nama_pt'] ?? null
|
||||
];
|
||||
|
||||
Log::info('Instructor data to be saved:', $instructor);
|
||||
|
||||
Instructors::create($instructor);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error storing NIDN for admin: ' . $e->getMessage());
|
||||
Session::flash('error', get_phrase('There was an error processing the NIDN. Please try again.'));
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
if(get_settings('student_email_verification') == 1) {
|
||||
$user->sendEmailVerificationNotification();
|
||||
@ -232,6 +329,9 @@ class UsersController extends Controller
|
||||
'email' => "required|email|unique:users,email,$id",
|
||||
]);
|
||||
|
||||
$data = [];
|
||||
$data_instructor = [];
|
||||
|
||||
$data['name'] = $request->name;
|
||||
$data['about'] = $request->about;
|
||||
$data['phone'] = $request->phone;
|
||||
@ -243,6 +343,12 @@ class UsersController extends Controller
|
||||
$data['linkedin'] = $request->linkedin;
|
||||
$data['paymentkeys'] = json_encode($request->paymentkeys);
|
||||
|
||||
$data_instructor['nidn'] = $request->nidn;
|
||||
$data_instructor['status'] = $request->status ?? 0;
|
||||
$data_instructor['id_sdm'] = $request->id_sdm;
|
||||
$data_instructor['id_sms'] = $request->id_sms;
|
||||
$data_instructor['id_pt'] = $request->id_pt;
|
||||
|
||||
if (isset($request->photo) && $request->hasFile('photo')) {
|
||||
remove_file(User::where('id', $id)->first()->photo);
|
||||
$path = "uploads/users/instructor/" . nice_file_name($request->name, $request->photo->extension());
|
||||
@ -251,6 +357,7 @@ class UsersController extends Controller
|
||||
}
|
||||
|
||||
User::where('id', $id)->update($data);
|
||||
Instructors::where('user_id', $id)->update($data_instructor);
|
||||
Session::flash('success', get_phrase('Instructor update successfully'));
|
||||
return redirect()->route('admin.instructor.index');
|
||||
}
|
||||
@ -415,15 +522,40 @@ class UsersController extends Controller
|
||||
{
|
||||
return view('admin.instructor.application');
|
||||
}
|
||||
|
||||
public function instructor_application_approve($id)
|
||||
{
|
||||
$query = Application::where('id', $id);
|
||||
$update_status = $query->update(['status' => 1]);
|
||||
if ($update_status) {
|
||||
$user_id = $query->first();
|
||||
User::where('id', $user_id->user_id)->update(['role' => 'instructor']);
|
||||
Session::flash('success', get_phrase('Application approve successfully'));
|
||||
$application = Application::find($id);
|
||||
|
||||
if (!$application) {
|
||||
Session::flash('error', get_phrase('Application not found'));
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
// Update application status
|
||||
$application->status = 1;
|
||||
$application->save();
|
||||
|
||||
$user_id = $application->user_id;
|
||||
|
||||
// Update user role to instructor
|
||||
User::where('id', $user_id)->update(['role' => 'instructor']);
|
||||
|
||||
// Update instructor status to 1 (active)
|
||||
Instructors::where('user_id', $user_id)->update(['status' => 1]);
|
||||
|
||||
DB::commit();
|
||||
Session::flash('success', get_phrase('Application approved successfully'));
|
||||
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error('Application approval error:', ['error' => $e->getMessage()]);
|
||||
Session::flash('error', get_phrase('Failed to approve application'));
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
public function instructor_application_delete($id)
|
||||
@ -482,12 +614,28 @@ class UsersController extends Controller
|
||||
}
|
||||
public function student_store(Request $request, $id = '')
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|max:255',
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => "required|max:255",
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => 'required',
|
||||
'password' => "required|min:8",
|
||||
], [
|
||||
'name.required' => get_phrase('Name is required'),
|
||||
'name.string' => get_phrase('Name must be a valid text'),
|
||||
'name.max' => get_phrase('Name may not be greater than 255 characters'),
|
||||
'email.required' => get_phrase('Email is required'),
|
||||
'email.string' => get_phrase('Email must be a valid text'),
|
||||
'email.email' => get_phrase('Please enter a valid email address'),
|
||||
'email.unique' => get_phrase('This email is already registered. Please use a different email.'),
|
||||
'password.required' => get_phrase('Password is required'),
|
||||
'password.min' => get_phrase('Password must be at least 8 characters'),
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$firstError = $validator->errors()->first();
|
||||
Session::flash('error', $firstError);
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
if(get_settings('student_email_verification') != 1){
|
||||
$data['email_verified_at'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
@ -655,7 +803,6 @@ class UsersController extends Controller
|
||||
{
|
||||
if ($request->type == 'general') {
|
||||
$profile['name'] = $request->name;
|
||||
$profile['email'] = $request->email;
|
||||
$profile['facebook'] = $request->facebook;
|
||||
$profile['linkedin'] = $request->linkedin;
|
||||
$profile['twitter'] = $request->twitter;
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Http\Controllers\instructor;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FileUploader;
|
||||
use App\Models\User;
|
||||
use App\Models\Instructors;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
@ -17,13 +18,29 @@ class MyProfileController extends Controller
|
||||
{
|
||||
public function manage_profile()
|
||||
{
|
||||
return view('instructor.profile.index');
|
||||
// Get current authenticated user
|
||||
$user = Auth::user();
|
||||
|
||||
// Get instructor data based on user_id
|
||||
$instructor = Instructors::where('user_id', $user->id)->first();
|
||||
|
||||
// Merge instructor data into user object
|
||||
if ($instructor) {
|
||||
$user->nidn = $instructor->nidn;
|
||||
$user->id_sdm = $instructor->id_sdm;
|
||||
$user->id_sms = $instructor->id_sms;
|
||||
$user->id_pt = $instructor->id_pt;
|
||||
}
|
||||
|
||||
return view('instructor.profile.index', [
|
||||
'auth' => $user
|
||||
]);
|
||||
}
|
||||
|
||||
public function manage_profile_update(Request $request)
|
||||
{
|
||||
if ($request->type == 'general') {
|
||||
$profile['name'] = $request->name;
|
||||
$profile['email'] = $request->email;
|
||||
$profile['facebook'] = $request->facebook;
|
||||
$profile['twitter'] = $request->twitter;
|
||||
$profile['linkedin'] = $request->linkedin;
|
||||
|
||||
@ -5,19 +5,37 @@ namespace App\Http\Controllers\student;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FileUploader;
|
||||
use App\Models\User;
|
||||
use App\Models\Instructors;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class MyProfileController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$page_data['user_details'] = User::find(auth()->user()->id);
|
||||
$user = User::find(auth()->user()->id);
|
||||
// Check if the role is 'instructor'
|
||||
if ($user->role === 'instructor') {
|
||||
// Retrieve the instructor details associated with the user
|
||||
$instructor = Instructors::where('user_id', $user->id)->first();
|
||||
|
||||
// Check if the instructor exists to avoid errors when accessing properties
|
||||
if ($instructor) {
|
||||
$user->nidn = $instructor->nidn;
|
||||
$user->id_sdm = $instructor->id_sdm;
|
||||
$user->id_sms = $instructor->id_sms;
|
||||
$user->id_pt = $instructor->id_pt;
|
||||
}
|
||||
}
|
||||
$page_data['user_details'] = $user;
|
||||
$view_path = 'frontend.' . get_frontend_settings('theme') . '.student.my_profile.index';
|
||||
|
||||
return view($view_path, $page_data);
|
||||
}
|
||||
|
||||
@ -34,7 +52,6 @@ class MyProfileController extends Controller
|
||||
}
|
||||
|
||||
$data['name'] = $request->name;
|
||||
$data['email'] = $request->email;
|
||||
$data['phone'] = $request->phone;
|
||||
$data['website'] = $request->website;
|
||||
$data['facebook'] = $request->facebook;
|
||||
|
||||
@ -10,6 +10,6 @@ class Instructors extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id', 'nidn', 'id_sdm', 'id_sms', 'id_pt'
|
||||
'user_id', 'nidn', 'id_sdm', 'id_sms', 'id_pt', 'status'
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="row mb-3">
|
||||
<label for="user-name" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Name') }}<span class="text-danger ms-1">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="name" class="form-control ol-form-control" id="user-name" @isset($instructor->name) value="{{ $instructor->name }}" @endisset required>
|
||||
<input type="text" name="name" class="form-control ol-form-control" id="user-name" @isset($instructor->name) value="{{ $instructor->name }}" @else value="{{ old('name') }}" @endisset required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -9,10 +9,7 @@
|
||||
<div class="row mb-3">
|
||||
<label for="short_description" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Biography') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="about" rows="3" class="form-control ol-form-control" id="short_description">
|
||||
@isset($instructor->about)
|
||||
{{ $instructor->about }}
|
||||
@endisset
|
||||
<textarea name="about" rows="3" class="form-control ol-form-control" id="short_description"> @isset($instructor->about){{ $instructor->about }}@else{{ old('about') }}@endisset</textarea>
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
@ -20,14 +17,14 @@
|
||||
<div class="row mb-3">
|
||||
<label for="user-phone" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Phone') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="phone" class="form-control ol-form-control" id="user-phone" @isset($instructor->phone) value="{{ $instructor->phone }}" @endisset>
|
||||
<input type="number" name="phone" class="form-control ol-form-control" id="user-phone" @isset($instructor->phone) value="{{ $instructor->phone }}" @else value="{{ old('phone') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="user-address" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Address') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="address" class="form-control ol-form-control" id="user-address" @isset($instructor->address) value="{{ $instructor->address }}" @endisset>
|
||||
<input type="text" name="address" class="form-control ol-form-control" id="user-address" @isset($instructor->address) value="{{ $instructor->address }}" @else value="{{ old('address') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<label for="email" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Email') }}<span
|
||||
class="text-danger ms-1">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input type="email" name="email" class="form-control ol-form-control" id="email" @isset($instructor->email) value="{{ $instructor->email }}" @endisset required>
|
||||
<input type="email" name="email" class="form-control ol-form-control" id="email" @isset($instructor->email) value="{{ $instructor->email }}" @else value="{{ old('email') }}" @endisset required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Facebook') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="facebook" class="form-control ol-form-control" id="title"
|
||||
@isset($instructor->facebook) value="{{ $instructor->facebook }}" @endisset>
|
||||
@isset($instructor->facebook) value="{{ $instructor->facebook }}" @else value="{{ old('facebook') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -10,13 +10,13 @@
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Twitter') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="twitter" class="form-control ol-form-control" id="title"
|
||||
@isset($instructor->twitter) value="{{ $instructor->twitter }}" @endisset>
|
||||
@isset($instructor->twitter) value="{{ $instructor->twitter }}" @else value="{{ old('twitter') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Linkedin') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="linkedin" class="form-control ol-form-control" id="title"
|
||||
@isset($instructor->linkedin) value="{{ $instructor->linkedin }}" @endisset>
|
||||
@isset($instructor->linkedin) value="{{ $instructor->linkedin }}" @else value="{{ old('linkedin') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -128,5 +128,33 @@
|
||||
$('#preview_' + img_type).attr('src', x);
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('banner').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -178,5 +178,44 @@
|
||||
$('#preview_' + img_type).attr('src', x);
|
||||
});
|
||||
});
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
document.getElementById('banner').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
document.getElementById('og_image').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -171,5 +171,19 @@
|
||||
}
|
||||
});
|
||||
//End progress
|
||||
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -38,5 +38,19 @@
|
||||
$('#preview_' + img_type).attr('src', x);
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -30,11 +30,11 @@
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="thumbnail" class="form-label ol-form-label">{{ get_phrase('Thumbnail') }} <small class="text-muted">({{ get_phrase('optional') }})</small></label>
|
||||
<label for="thumbnail" class="form-label ol-form-label">{{ get_phrase('Choose category thumbnail') }} <small class="text-muted">({{ get_phrase('optional') }})</small></label>
|
||||
<input type="file" name="thumbnail" class="form-control ol-form-control" id="thumbnail" accept="image/*" />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="category_logo" class="form-label ol-form-label">{{ get_phrase('Category logo') }} <small class="text-muted">({{ get_phrase('optional') }})</small></label>
|
||||
<label for="category_logo" class="form-label ol-form-label">{{ get_phrase('Choose category Logo') }} <small class="text-muted">({{ get_phrase('optional') }})</small></label>
|
||||
<input type="file" name="category_logo" class="form-control ol-form-control" id="category_logo" accept="image/*" />
|
||||
</div>
|
||||
|
||||
@ -54,4 +54,31 @@
|
||||
$('.icon-picker').iconpicker();
|
||||
}
|
||||
});
|
||||
// Define the file size limit in bytes (2 MB)
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get translated phrases from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
// Validate thumbnail file size
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage);
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
|
||||
// Validate category logo file size
|
||||
document.getElementById('category_logo').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage);
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -65,4 +65,32 @@
|
||||
$('.ol-select2').select2({
|
||||
dropdownParent: $("#ajaxModal")
|
||||
});
|
||||
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('category_logo').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -240,5 +240,18 @@
|
||||
$('#number_of_month').slideDown();
|
||||
}
|
||||
}
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -18,3 +18,34 @@
|
||||
<input type="file" name="preview" class="form-control ol-form-control" id="preview" accept="video/*" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
document.getElementById('banner').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -43,3 +43,34 @@
|
||||
<small class="text-muted">{{get_phrase('Supported Video file')}}: <b>.{{get_phrase('mp4')}}</b> {{get_phrase('or')}} <b>.{{get_phrase('webm')}}</b> {{get_phrase('or')}} <b>.{{get_phrase('ogg')}}</b></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
document.getElementById('banner').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -35,4 +35,17 @@
|
||||
<script>
|
||||
"use strict";
|
||||
initializeDurationPickers([".duration_picker"]);
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -33,8 +33,20 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
"use strict";
|
||||
initializeDurationPickers([".duration_picker"]);
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="row mb-3">
|
||||
<label for="user-name" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Name') }}<span class="text-danger ms-1">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="name" class="form-control ol-form-control" id="user-name" @isset($instructor->name) value="{{ $instructor->name }}" @endisset required>
|
||||
<input type="text" name="name" class="form-control ol-form-control" id="user-name" @isset($instructor->name) value="{{ $instructor->name }}" @else value="{{ old('name') }}" @endisset required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<div class="row mb-3">
|
||||
<label for="short_description" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Biography') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="about" rows="3" class="form-control ol-form-control" id="short_description">@isset($instructor->about){{ $instructor->about }}@endisset</textarea>
|
||||
<textarea name="about" rows="3" class="form-control ol-form-control" id="short_description"> @isset($instructor->about){{ $instructor->about }}@else{{ old('about') }}@endisset</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -17,14 +17,14 @@
|
||||
<div class="row mb-3">
|
||||
<label for="user-phone" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Phone') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="phone" class="form-control ol-form-control" id="user-phone" @isset($instructor->phone) value="{{ $instructor->phone }}" @endisset>
|
||||
<input type="number" name="phone" class="form-control ol-form-control" id="user-phone" @isset($instructor->phone) value="{{ $instructor->phone }}" @else value="{{ old('phone') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="user-address" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Address') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="address" class="form-control ol-form-control" id="user-address" @isset($instructor->address) value="{{ $instructor->address }}" @endisset>
|
||||
<input type="text" name="address" class="form-control ol-form-control" id="user-address" @isset($instructor->address) value="{{ $instructor->address }}" @else value="{{ old('address') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
@ -33,3 +33,10 @@
|
||||
<input type="file" name="photo" class="form-control ol-form-control" id="photo">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="user-nidn" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('NIDN') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" name="nidn" class="form-control ol-form-control" id="user-nidn" @isset($instructor->nidn) value="{{ $instructor->nidn }}" @else value="{{ old('nidn') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
<label for="email" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Email') }}<span
|
||||
class="text-danger ms-1">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input type="email" name="email" class="form-control ol-form-control" id="email" @isset($instructor->email) value="{{ $instructor->email }}" @endisset required>
|
||||
<input type="email" name="email" class="form-control ol-form-control" id="email" @isset($instructor->email) value="{{ $instructor->email }}" @else value="{{ old('email') }}" @endisset required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-8 offset-sm-2">
|
||||
<input type="hidden" name="email_verified" value="0">
|
||||
<input type="hidden" name="email_verified" value="1" id="email_verified_value">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="email_verified" name="email_verified" value="1">
|
||||
<label class="form-check-label" for="email_verified">{{ get_phrase('Mark email as verified') }}</label>
|
||||
<input type="checkbox" class="form-check-input" id="email_verified_checkbox" name="email_verified" value="1" {{ old('email_verified', isset($instructor->email) ? ($instructor->email_verified_at ? 'checked' : '') : 'checked') ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="email_verified_checkbox">{{ get_phrase('Mark email as verified') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -24,3 +24,18 @@
|
||||
</div>
|
||||
</div>
|
||||
@endisset
|
||||
|
||||
<script>
|
||||
// Get the checkbox and the hidden input
|
||||
const checkbox = document.getElementById('email_verified_checkbox');
|
||||
const hiddenInput = document.getElementById('email_verified_value');
|
||||
|
||||
// Update hidden input value when the checkbox is toggled
|
||||
checkbox.addEventListener('change', function() {
|
||||
if (checkbox.checked) {
|
||||
hiddenInput.value = '1'; // Checked, set value to 1
|
||||
} else {
|
||||
hiddenInput.value = '0'; // Unchecked, set value to 0
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Facebook') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="facebook" class="form-control ol-form-control" id="title"
|
||||
@isset($instructor->facebook) value="{{ $instructor->facebook }}" @endisset>
|
||||
@isset($instructor->facebook) value="{{ $instructor->facebook }}" @else value="{{ old('facebook') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -10,13 +10,13 @@
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Twitter') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="twitter" class="form-control ol-form-control" id="title"
|
||||
@isset($instructor->twitter) value="{{ $instructor->twitter }}" @endisset>
|
||||
@isset($instructor->twitter) value="{{ $instructor->twitter }}" @else value="{{ old('twitter') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Linkedin') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="linkedin" class="form-control ol-form-control" id="title"
|
||||
@isset($instructor->linkedin) value="{{ $instructor->linkedin }}" @endisset>
|
||||
@isset($instructor->linkedin) value="{{ $instructor->linkedin }}" @else value="{{ old('linkedin') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -33,3 +33,39 @@
|
||||
<input type="file" name="photo" class="form-control ol-form-control" id="photo">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="user-nidn" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('NIDN') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" name="nidn" class="form-control ol-form-control" id="user-nidn" @isset($instructor->nidn) value="{{ $instructor->nidn }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="user-id_sdm" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('ID_SDM') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="id_sdm" class="form-control ol-form-control" id="user-id_sdm" @isset($instructor->id_sdm) value="{{ $instructor->id_sdm }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="user-id_sms" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('ID_SMS') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="id_sms" class="form-control ol-form-control" id="user-id_sms" @isset($instructor->id_sms) value="{{ $instructor->id_sms }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="user-id_pt" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('ID_PT') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="id_pt" class="form-control ol-form-control" id="user-id_pt" @isset($instructor->id_pt) value="{{ $instructor->id_pt }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="user-status" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Status') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="hidden" name="status" value="0">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="status_checkbox" name="status" value="1"
|
||||
{{ isset($instructor) && $instructor->status == 1 ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="status_checkbox">{{ get_phrase('Checked if the instructor is active') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
<div class="fpb7 mb-2">
|
||||
<label class="form-label ol-form-label">{{ get_phrase('Email') }}</label>
|
||||
<input type="email" class="form-control ol-form-control" name="email" value="{{ $auth->email }}" required />
|
||||
<input type="email" class="form-control ol-form-control" name="email" value="{{ $auth->email }}" disabled readonly />
|
||||
</div>
|
||||
|
||||
<div class="fpb7 mb-2">
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<div class="row mb-3">
|
||||
<label for="email" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Email') }}<span class="text-danger ms-1">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input type="email" name="email" class="form-control ol-form-control" id="email" @isset($student->email) value="{{ $instructor->email }}" @endisset required>
|
||||
<input type="email" name="email" class="form-control ol-form-control" id="email" @isset($student->email) value="{{ $student->email }}" @else value="{{ old('email') }}" @endisset required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-8 offset-sm-2">
|
||||
<input type="hidden" name="email_verified" value="0">
|
||||
<input type="hidden" name="email_verified" value="1" id="email_verified_value">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="email_verified" name="email_verified" value="1">
|
||||
<label class="form-check-label" for="email_verified">{{ get_phrase('Mark email as verified') }}</label>
|
||||
<input type="checkbox" class="form-check-input" id="email_verified_checkbox" name="email_verified" value="1" checked>
|
||||
<label class="form-check-label" for="email_verified_checkbox">{{ get_phrase('Mark email as verified') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -22,3 +22,19 @@
|
||||
</div>
|
||||
</div>
|
||||
@endisset
|
||||
|
||||
|
||||
<script>
|
||||
// Get the checkbox and the hidden input
|
||||
const checkbox = document.getElementById('email_verified_checkbox');
|
||||
const hiddenInput = document.getElementById('email_verified_value');
|
||||
|
||||
// Update hidden input value when the checkbox is toggled
|
||||
checkbox.addEventListener('change', function() {
|
||||
if (checkbox.checked) {
|
||||
hiddenInput.value = '1'; // Checked, set value to 1
|
||||
} else {
|
||||
hiddenInput.value = '0'; // Unchecked, set value to 0
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
<div class="row mb-3">
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Facebook') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="facebook" class="form-control ol-form-control" id="title" @isset($student->facebook) value="{{ $student->facebook }}" @endisset>
|
||||
<input type="text" name="facebook" class="form-control ol-form-control" id="title" @isset($student->facebook) value="{{ $student->facebook }}" @else value="{{ old('facebook') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Twitter') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="twitter" class="form-control ol-form-control" id="title" @isset($student->twitter) value="{{ $student->twitter }}" @endisset>
|
||||
<input type="text" name="twitter" class="form-control ol-form-control" id="title" @isset($student->twitter) value="{{ $student->twitter }}" @else value="{{ old('twitter') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="title" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Linkedin') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="linkedin" class="form-control ol-form-control" id="title" @isset($student->linkedin) value="{{ $student->linkedin }}" @endisset>
|
||||
<input type="text" name="linkedin" class="form-control ol-form-control" id="title" @isset($student->linkedin) value="{{ $student->linkedin }}" @else value="{{ old('linkedin') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="row mb-3">
|
||||
<label for="user-name" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Name') }}<span class="text-danger ms-1">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="name" class="form-control ol-form-control" id="user-name" @isset($student->name) value="{{ $student->name }}" @endisset required>
|
||||
<input type="text" name="name" class="form-control ol-form-control" id="user-name" @isset($student->name) value="{{ $student->name }}" @else value="{{ old('name') }}" @endisset required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<div class="row mb-3">
|
||||
<label for="short_description" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Biography') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="about" rows="3" class="form-control ol-form-control" id="short_description">@isset($student->about){{ $student->about }}@endisset</textarea>
|
||||
<textarea name="about" rows="3" class="form-control ol-form-control" id="short_description">@isset($student->about){{ $student->about }}@else{{ old('about') }}@endisset</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -17,14 +17,14 @@
|
||||
<div class="row mb-3">
|
||||
<label for="user-phone" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Phone') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="phone" class="form-control ol-form-control" id="user-phone" @isset($student->phone) value="{{ $student->phone }}" @endisset>
|
||||
<input type="number" name="phone" class="form-control ol-form-control" id="user-phone" @isset($student->phone ) value="{{ $student->phone }}" @else value="{{ old('phone') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="user-address" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Address') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="address" class="form-control ol-form-control" id="user-address" @isset($student->address) value="{{ $student->address }}" @endisset>
|
||||
<input type="text" name="address" class="form-control ol-form-control" id="user-address" @isset($student->address) value="{{ $student->address }}" @else value="{{ old('address') }}" @endisset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
|
||||
@ -295,4 +295,22 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
// Validate category logo file size
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -354,4 +354,21 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
// Validate category logo file size
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -69,46 +69,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!------------------- Login Area End ------>
|
||||
@endif
|
||||
@endsection
|
||||
@push('js')
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
function onLoginSubmit(token) {
|
||||
document.getElementById("login-form").submit();
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.custom-btn').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var role = $(this).attr('id');
|
||||
if (role == 'admin') {
|
||||
$('#email').val('admin@example.com');
|
||||
$('#password').val('12345678');
|
||||
} else if (role == 'student') {
|
||||
$('#email').val('student@example.com');
|
||||
$('#password').val('12345678');
|
||||
} else {
|
||||
$('#email').val('instructor@example.com');
|
||||
$('#password').val('12345678');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#showpassword').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
const type = $('#password').attr('type');
|
||||
|
||||
if (type == 'password') {
|
||||
$('#password').attr('type', 'text');
|
||||
} else {
|
||||
$('#password').attr('type', 'password');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -10,6 +10,37 @@
|
||||
<div class="row">
|
||||
@include('frontend.default.student.left_sidebar')
|
||||
<div class="col-lg-9">
|
||||
@if($user_details->role === 'instructor')
|
||||
<div class="my-panel message-panel edit_profile mb-4">
|
||||
<h4 class="g-title mb-5">{{ get_phrase('PDDikti Information') }}</h4>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 mb-20">
|
||||
<div class="form-group">
|
||||
<label for="nidn" class="form-label">{{ get_phrase('NIDN') }}</label>
|
||||
<input type="text" class="form-control" name="nidn" value="{{ $user_details->nidn }}" id="nidn" disabled readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 mb-20">
|
||||
<div class="form-group">
|
||||
<label for="id_sdm" class="form-label">{{ get_phrase('ID PDDikti') }}</label>
|
||||
<input type="text" class="form-control" name="id_sdm" value="{{ $user_details->id_sdm }}" id="id_sdm" disabled readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 mb-20">
|
||||
<div class="form-group">
|
||||
<label for="id_sms" class="form-label">{{ get_phrase('Study Program') }}</label>
|
||||
<input type="text" class="form-control" name="id_sms" value="{{ $user_details->id_sms }}" id="id_sms" disabled readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 mb-20">
|
||||
<div class="form-group">
|
||||
<label for="id_pt" class="form-label">{{ get_phrase('University') }}</label>
|
||||
<input type="text" class="form-control" name="id_pt" value="{{ $user_details->id_pt }}" id="id_pt" disabled readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="my-panel message-panel edit_profile mb-4">
|
||||
<h4 class="g-title mb-5">{{ get_phrase('Personal Information') }}</h4>
|
||||
@ -24,7 +55,7 @@
|
||||
<div class="col-lg-6 mb-20">
|
||||
<div class="form-group">
|
||||
<label for="email" class="form-label">{{ get_phrase('Email Address') }}</label>
|
||||
<input type="email" class="form-control" name="email" value="{{ $user_details->email }}" id="email">
|
||||
<input type="email" class="form-control" name="email" value="{{ $user_details->email }}" id="email" disabled readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 mb-20">
|
||||
|
||||
@ -133,4 +133,33 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
document.getElementById('banner').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -184,4 +184,46 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
document.getElementById('banner').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
document.getElementById('og_image').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -172,4 +172,20 @@
|
||||
});
|
||||
//End progress
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -39,4 +39,20 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -204,5 +204,19 @@
|
||||
$('#number_of_month').slideDown();
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -18,3 +18,20 @@
|
||||
<input type="file" name="preview" class="form-control ol-form-control" id="preview" accept="video/*" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -43,3 +43,20 @@
|
||||
<small class="text-muted">{{ get_phrase('Supported Video file') }}: <b>.{{ get_phrase('mp4') }}</b> {{ get_phrase('or') }} <b>.{{ get_phrase('webm') }}</b> {{ get_phrase('or') }} <b>.{{ get_phrase('ogg') }}</b></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -33,3 +33,19 @@
|
||||
"use strict";
|
||||
initializeDurationPickers([".duration_picker"]);
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -33,3 +33,20 @@
|
||||
"use strict";
|
||||
initializeDurationPickers([".duration_picker"]);
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
<div class="fpb7 mb-2">
|
||||
<label class="form-label ol-form-label">{{ get_phrase('Email') }}</label>
|
||||
<input type="email" class="form-control ol-form-control" name="email" value="{{ $auth->email }}" required />
|
||||
<input type="email" class="form-control ol-form-control" name="email" value="{{ $auth->email }}" disabled readonly />
|
||||
</div>
|
||||
|
||||
<div class="fpb7 mb-2">
|
||||
@ -70,7 +70,6 @@
|
||||
<textarea rows="5" class="form-control ol-form-control text_editor" name="biography" placeholder="">{!! removeScripts($auth->biography) !!}</textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fpb7 mb-2">
|
||||
<label class="form-label ol-form-label">{{ get_phrase('Photo') }}
|
||||
<small>({{ get_phrase('The image size should be any square image') }})</small>
|
||||
@ -90,10 +89,31 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-5">
|
||||
<div class="ol-card p-4 mb-4">
|
||||
<div class="ol-card-body">
|
||||
<input type="hidden" name="type" value="general">
|
||||
<div class="fpb7 mb-2">
|
||||
<label class="form-label ol-form-label">{{ get_phrase('NIDN') }}</label>
|
||||
<input type="text" class="form-control ol-form-control" name="nidn" value="{{ $auth->nidn }}" disabled readonly />
|
||||
</div>
|
||||
<div class="fpb7 mb-2">
|
||||
<label class="form-label ol-form-label">{{ get_phrase('ID PDDikti') }}</label>
|
||||
<input type="text" class="form-control ol-form-control" name="id_sdm" value="{{ $auth->id_sdm }}" disabled readonly />
|
||||
</div>
|
||||
<div class="fpb7 mb-2">
|
||||
<label class="form-label ol-form-label">{{ get_phrase('Study Program') }}</label>
|
||||
<input type="text" class="form-control ol-form-control" name="id_sms" value="{{ $auth->id_sms }}" disabled readonly />
|
||||
</div>
|
||||
<div class="fpb7 mb-2">
|
||||
<label class="form-label ol-form-label">{{ get_phrase('University') }}</label>
|
||||
<input type="text" class="form-control ol-form-control" name="id_pt" value="{{ $auth->id_pt }}" disabled readonly />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ol-card p-4">
|
||||
<div class="ol-card-body">
|
||||
<form action="{{ route('instructor.manage.profile.update') }}" method="post"> @csrf
|
||||
|
||||
@ -249,4 +249,20 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -298,4 +298,21 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@ -55,5 +55,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@include('instructor.init')
|
||||
|
||||
@ -55,4 +55,21 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
||||
const file = event.target.files[0]; // Get the selected file
|
||||
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
||||
|
||||
// Get the message from Laravel's get_phrase function
|
||||
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
||||
|
||||
if (file && file.size > maxSize) {
|
||||
// If the file is larger than 2 MB, show an alert and reset the input
|
||||
alert(maxFileSizeMessage); // Use the translated message
|
||||
event.target.value = ''; // Clear the selected file
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@include('instructor.init')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user