Files
2025-11-04 16:23:40 +05:00

659 lines
42 KiB
PHP

@extends('layouts/contentLayoutMaster')
@section('title', 'Edit Student')
@section('vendor-style')
<!-- vendor css files -->
<link rel="stylesheet" href="{{ asset(mix('vendors/css/extensions/toastr.min.css')) }}">
<link rel="stylesheet" href="{{ asset(mix('vendors/css/forms/select/select2.min.css')) }}">
@endsection
@section('page-style')
<!-- Page css files -->
<link rel="stylesheet" href="{{ asset(mix('css/base/plugins/extensions/ext-component-toastr.css')) }}">
@endsection
@section('content')
<section id="dropzone-examples">
<form action="{{ route('students.update',$user) }}" name="usersForm" method="post"
enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="row">
<div class="col-12">
<div class="card">
<div class="profile-image-wrapper text-center mt-2">
<div class="profile-image">
<div class="avatar">
<img width="150px" height="150px" src="{{ @$user->picture ? App::make('url')->to('/') . '/storage' . @$user->picture : asset('images/profile/user-uploads/user-01.jpg')}}" alt="Profile Picture">
</div>
</div>
</div>
<div class="card-header">
<h4 class="card-title">User Details</h4>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="first-name-icon">Full Name</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="text"
id="fullName"
class="form-control @error('fullName') is-invalid @enderror"
name="fullName"
placeholder="e.g. John Doe"
value="{{ $user->name }}"
required
/>
@error('fullName')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="father-name-icon">Father Name</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="text"
id="fatherName"
class="form-control @error('fatherName') is-invalid @enderror"
name="fatherName"
placeholder="e.g. John Doe"
value="{{ $user->father_name }}"
/>
@error('fatherName')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="first-name-icon">Email</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="email"
id="email"
class="form-control @error('email') is-invalid @enderror"
name="email"
placeholder="john@example.com"
value="{{ $user->email }}"
required
/>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="first-name-icon">Phone</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="number"
id="phone"
class="form-control @error('phone') is-invalid @enderror"
name="phone"
placeholder="+1 123 1234567"
value="{{ $user->phone }}"
required
/>
@error('phone')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="first-name-icon">Password</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="password"
id="password"
class="form-control country-phone-code-mask @error('password') is-invalid @enderror"
name="password"
placeholder="Enter Password"
/>
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="first-name-icon">Confirm Password</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="password"
id="password_confirmation"
class="form-control @error('password_confirmation') is-invalid @enderror"
name="password_confirmation"
placeholder="Enter Confirm Password"
/>
@error('password_confirmation')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Profile Details</h4>
</div>
<div class="card-body">
<div class="row mb-1">
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="cnic-icon">Cinc</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="text"
id="cnic-icon"
class="form-control @error('cnic') is-invalid @enderror"
name="cnic"
placeholder="26502784522"
value="{{ $user->cnic}}"
maxlength="13"
/>
@error('cnic')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<label for="gender" class="form-label">Gender</label>
<select name="gender"
class="form-select select2 @error('gender') is-invalid @enderror"
id="gender">
<option {{ $user->gender=== 'MALE' ? 'selected' : '' }} value="MALE">Male
</option>
<option {{ $user->gender === 'FEMALE' ? 'selected' : '' }} value="FEMALE">
Female
</option>
<option {{ $user->gender === 'OTHER' ? 'selected' : '' }} value="OTHER">Not
Specified
</option>
</select>
@error('gender')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="first-name-icon">Picture</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="file"
id="profileImage"
class="form-control @error('profileImage') is-invalid @enderror"
name="profileImage"
/>
@error('profileImage')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="father-name-icon">Date Of Birth</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="date"
id="dob"
class="form-control @error('dob') is-invalid @enderror"
name="dob"
placeholder="12-12-2022"
value="{{ $user->dob }}"
/>
@error('dob')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="father-name-icon">Address</label>
<div class="input-group input-group-merge">
<textarea
id="address"
class="form-control @error('address') is-invalid @enderror"
name="address"
placeholder="Student Address">{{ $user->address}}</textarea>
@error('address')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="father-name-icon">Notes</label>
<div class="input-group input-group-merge">
<textarea
id="notes"
class="form-control @error('notes') is-invalid @enderror"
name="notes"
placeholder="Student Notes"
value="{{ $user->note }}"></textarea>
@error('notes')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="row mb-1">
<div class="col-lg-6 col-sm-6">
<label for="status" class="form-label">Status</label>
<select name="status"
class="form-select select2 @error('status') is-invalid @enderror"
id="status">
<option {{ $user->status=== 1 ? 'selected' : '' }} value="1">Active
</option>
<option {{ $user->status === 0 ? 'selected' : '' }} value="0">
Inactive
</option>
</select>
@error('status')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<button type="submit" class="btn btn-primary me-1"
onclick="this.disabled=true;this.form.submit();">Update
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<section id="responsive-datatable">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Student Courses</h4>
<div class="content-header-right text-md-end col-lg-3 col-sm-6 d-md-block">
<div class="mb-1 breadcrumb-right text-right-bred">
<a class="btn-icon btn btn-primary btn-round btn-sm" type="button"
href="{{route('student-course.create',$user)}}">
<i data-feather="plus"></i>
</a>
</div>
</div>
</div>
@if(@$courses->count() > 0)
<div class="card-datatable table-responsive ">
<table class="table" style="background-color: #ffff">
<thead>
<tr>
<th class="text-center">#</th>
<th class="text-center">Category</th>
<th class="text-center">Start Date</th>
<th class="text-center">End Date</th>
<th class="text-center">Total Fee</th>
<th class="text-center">Remaining Fee</th>
<th class="text-center">Certificate Issued At</th>
<th class="text-center">Created At</th>
<th style="width: 95px">
Actions
</th>
</tr>
</thead>
<tbody>
@php
$i = 1;
@endphp
@foreach(@$courses as $course)
<tr>
<td class="text-center">{{ @$i}}</td>
<td class="text-center">{{ @$course->category->name}}</td>
<td class="text-center"> {{@$course->start_date}}</td>
<td class="text-center">{{ @$course->end_date }}</td>
<td class="text-center">{{ @$course->total_fee }}</td>
<td class="text-center"> {{@$course->total_fee - $course->paidAmount}}</td>
<td class="text-center">{{ @$course->certificate_issued_at ?? 'N/A' }}</td>
<td class="text-center">{{ date('Y-m-d h:i a',strtotime($course->created_at)) }}</td>
<td>
<div class="btn-group">
<a class="btn btn-sm dropdown-toggle hide-arrow"
data-bs-toggle="dropdown"
aria-expanded="false">
<i class="fa-solid fa-ellipsis-vertical"
style="margin-right:5px;"></i>
</a>
<div class="dropdown-menu dropdown-menu-end" style="">
<a href="{{route('course.edit',$course)}}"
class="dropdown-item">
<i class="fa-solid fa-file-lines"
style="margin-right:5px;"></i>
Edit</a>
<a href="{{route('course-print',$course)}}"
class="dropdown-item">
<i class="fa fa-print fa-file-lines"
style="margin-right:5px;"></i>
Print</a>
<form action="{{route('course.destroy', $course)}}" method="POST" class="delete-course-form">
@method('delete')
@csrf
<button class="dropdown-item delete-course" type="submit"><i
class="fa-solid fa-square-pen"
></i> Delete
</button>
</form>
</div>
</div>
</td>
</tr>
<tr>
<td colspan="12">
<div id="accordionOne{{$course->id}}"
class="accordion-collapse collapse show "
aria-labelledby="headingOne"
data-bs-parent="#accordionExample">
<div class="accordion-body">
<section id="responsive-datatable">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Course
Transactions</h4>
<div
class="content-header-right text-md-end col-lg-3 col-sm-6 d-md-block">
<div
class="mb-1 breadcrumb-right text-right-bred">
<a href="{{route('course-print',$course)}}" class="btn btn-success" >Print</a>
{{-- @if($course->total_fee - $course->paidAmount > 0 )--}}
<a class="btn-icon btn btn-primary btn-round btn-sm"
type="button"
href="{{route('transaction.create',['course'=>$course])}}">
<i data-feather="plus"></i>
</a>
{{-- @endif--}}
</div>
</div>
</div>
@if(@$course->allTransactions->count() > 0)
<div class="card-datatable table-responsive ">
<table class="table"
style="background-color: #ffff">
<thead>
<tr>
<th class="text-center">
#
</th>
<th class="text-center">
Type
</th>
<th class="text-center">
Amount
</th>
<th class="text-center">
Created At
</th>
<th class="text-center">
Actions
</th>
</tr>
</thead>
<tbody>
@php
$y = 1;
@endphp
@foreach(@$course->allTransactions as $transaction)
<tr>
<td class="text-center">{{ @$y}}</td>
<td class="text-center">{{ @$transaction->type}}</td>
<td class="text-center"> {{@$transaction->amount}}</td>
<td class="text-center"> {{@$transaction->created_at->format('Y-m-d h:i a')}}</td>
<td class="text-center">
<form action="{{ URL::route('transaction.destroy', $transaction)}}"
method="POST" id="delete-form" class="delete-form">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<button class="btn btn-link btn-danger delete-btn" type="submit"> Delete
</button>
</form>
</td>
</tr>
@php
$y++
@endphp
@endforeach
</tbody>
</table>
</div>
@else
<div class="card-datatable py-2 px-2">
<div class="d-flex justify-content-center">
<span class="alert alert-danger">
No Record Found
</span>
</div>
</div>
@endif
</div>
</div>
</div>
</section>
</div>
</div>
</td>
</tr>
@php
$i++
@endphp
@endforeach
</tbody>
</table>
</div>
@else
<div class="card-datatable py-2 px-2">
<div class="d-flex justify-content-center">
<span class="alert alert-danger">
No Record Found
</span>
</div>
</div>
@endif
</div>
</div>
</div>
</section>
</section>
<div class="modal fade" id="confirmDeleteModal" tabindex="-1" role="dialog"
aria-labelledby="confirmDeleteModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmDeleteModalLabel">Confirm Delete</h5>
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Are you sure you want to delete this record?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" id="confirmDeleteBtn">Delete</button>
</div>
</div>
</div>
</div>
@endsection
@section('vendor-script')
<script src="{{ asset(mix('vendors/js/forms/cleave/cleave.min.js'))}}"></script>
<script src="{{ asset(mix('vendors/js/extensions/toastr.min.js')) }}"></script>
<script src="{{ asset(mix('vendors/js/forms/select/select2.full.min.js')) }}"></script>
@endsection
@section('page-script')
<script src="{{ asset(mix('js/scripts/forms/form-input-mask.js')) }}"></script>
<script src="{{ asset(mix('js/scripts/forms/form-select2.js')) }}"></script>
<script>
$(document).ready(function () {
toastr.options.timeOut = 10000;
@if(session()->has('error'))
toastr.error('{{ session('error') }}');
@elseif(session()->has('success'))
toastr.success('{{ session('success') }}');
@endif
$('.delete-course').click(function (e) {
// Prevent the default form submission
e.preventDefault();
// Get the corresponding delete form for this button
var deleteForm = $(this).closest('.delete-course-form');
// Display the Bootstrap modal dialog
$('#confirmDeleteModal').modal('show');
// Attach a click event listener to the confirm button
$('#confirmDeleteBtn').click(function () {
// Hide the Bootstrap modal dialog
$('#confirmDeleteModal').modal('hide');
// Submit the delete form
deleteForm.submit();
});
// Attach a click event listener to the cancel button
$('.modal-footer .btn-secondary').off('click').on('click', function () {
// Hide the Bootstrap modal dialog
$('#confirmDeleteModal').modal('hide');
});
$('.btn-close').off('click').on('click', function () {
// Hide the Bootstrap modal dialog
$('#confirmDeleteModal').modal('hide');
});
});
$('.delete-btn').click(function (e) {
// Prevent the default form submission
e.preventDefault();
// Get the corresponding delete form for this button
var deleteForm = $(this).closest('.delete-form');
// Display the Bootstrap modal dialog
$('#confirmDeleteModal').modal('show');
// Attach a click event listener to the confirm button
$('#confirmDeleteBtn').click(function () {
// Hide the Bootstrap modal dialog
$('#confirmDeleteModal').modal('hide');
// Submit the delete form
deleteForm.submit();
});
// Attach a click event listener to the cancel button
$('.modal-footer .btn-secondary').off('click').on('click', function () {
// Hide the Bootstrap modal dialog
$('#confirmDeleteModal').modal('hide');
});
$('.btn-close').off('click').on('click', function () {
// Hide the Bootstrap modal dialog
$('#confirmDeleteModal').modal('hide');
});
});
});
</script>
@endsection