bulk.blade.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. @extends('admin.layout.index')
  2. @push('css-head')
  3. @endpush
  4. @section('content')
  5. <!-- Page header -->
  6. <div class="page-header page-header-light">
  7. <div class="breadcrumb-line breadcrumb-line-light header-elements-md-inline">
  8. <div class="d-flex">
  9. <div class="breadcrumb">
  10. <a href="{{url('/admin')}}" class="breadcrumb-item"><i class="icon-home2 mr-2"></i> Dashboard</a>
  11. <a href="{{url('/admin/courses')}}" class="breadcrumb-item"> Courses</a>
  12. <span class="breadcrumb-item">Bulk Entry [ <a href="{{ url('/admin/courses/bulk-template/download') }}"><i class="icon-file-excel" style="margin-right: 3px;"></i>Template</a> ]</span>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. <!-- /page header -->
  18. <!-- Content area -->
  19. <div class="content">
  20. <div class="card">
  21. <div class="card-body">
  22. @if (count($errors) > 0)
  23. <div class="alert alert-danger alert-no-border alert-txt-colored alert-close alert-dismissible fade show" role="alert">
  24. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  25. <span aria-hidden="true">×</span>
  26. </button>
  27. <strong>Whoops!</strong> There were some problems with your input.
  28. <ul>
  29. @foreach ($errors->all() as $error)
  30. <li>{{ $error }}</li>
  31. @endforeach
  32. </ul>
  33. </div>
  34. @endif
  35. {!!Form::open(array('url'=>'admin/courses/bulk-entry/store','method'=>'POST','enctype'=>'multipart/form-data'))!!}
  36. <div class="row">
  37. <div class="col-md-12">
  38. <div class="form-group">
  39. <label>Excel File:</label>
  40. <input type="file" class="form-control" name="file" required>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="text-right">
  45. <a href="{{ url('admin/courses/bulk-entry') }}" class="btn btn-secondary pull-left">
  46. Refresh
  47. <i class="icon-reload-alt ml-2"></i>
  48. </a>
  49. <button type="submit" class="btn btn-primary">Submit <i class="icon-paperplane ml-2"></i></button>
  50. </div>
  51. {!! Form::close() !!}
  52. </div>
  53. </div>
  54. </div>
  55. <!-- /content area -->
  56. @endsection
  57. @push('scripts')
  58. <script type="text/javascript" src="{{ asset('assets/global/js/plugins/forms/selects/select2.min.js')}}"></script>
  59. <script type="text/javascript" src="{{ asset('assets/global/js/plugins/forms/tags/tagsinput.min.js')}}"></script>
  60. <script type="text/javascript" src="{{ asset('assets/global/js/plugins/forms/tags/tokenfield.min.js')}}"></script>
  61. <script type="text/javascript" src="{{ asset('assets/global/js/plugins/editors/summernote/summernote.min.js')}}"></script>
  62. <script type="text/javascript">
  63. $(document).ready(function(){
  64. $('.select2').select2();
  65. $('.tokenfield').tokenfield();
  66. $('.summernote').summernote();
  67. });
  68. $('.destination').on('change', function(){
  69. var destination = $('.destination option:selected').val();
  70. var select_tag = $('.institute');
  71. $.get("{{ route('admin.ajax-get', ['name'=>'sams_institutes']) }}", {
  72. destination : destination, type : 'all'
  73. }).done(function(res){
  74. select_tag.empty().append('<option disabled="" selected="" value="">Choose One..</option>');
  75. res.forEach(function(row){
  76. select_tag.append(
  77. $('<option></option>').val(row.institute_id+'::'+row.institute_name).html(row.institute_name)
  78. );
  79. });
  80. });
  81. $('.institute').empty().append('<option disabled="" selected="" value="">Choose One..</option>');
  82. $('.level').empty().append('<option disabled="" selected="" value="">Choose One..</option>');
  83. $('.campus').empty().append('<option disabled="">Choose One..</option>');
  84. $('.intake').empty().append('<option disabled="">Choose One..</option>');
  85. });
  86. $('.institute').on('change', function(){
  87. var institute = $('.institute option:selected').val();
  88. var select_tag = $('.level');
  89. $.get("{{ route('admin.ajax-get', ['name'=>'sams_levels']) }}", {
  90. institute : institute, group : 0
  91. }).done(function(res){
  92. select_tag.empty().append('<option disabled="" selected="" value="">Choose One..</option>');
  93. res.forEach(function(row){
  94. select_tag.append(
  95. $('<option></option>').val(row.id+'::'+row.name).html(row.name)
  96. );
  97. });
  98. });
  99. $.get("{{ route('admin.ajax-get', ['name'=>'sams_campuses']) }}", {
  100. institute : institute
  101. }).done(function(campuses){
  102. var select_tag = $('.campus');
  103. select_tag.empty().append('<option disabled="">Choose One..</option>');
  104. if(campuses.length > 0){
  105. campuses.forEach(function(row){
  106. select_tag.append(
  107. $('<option></option>').val(row.id+'::'+row.name).html(row.name)
  108. );
  109. });
  110. $('#instituteDiv').removeClass('col-md-8');
  111. $('#instituteDiv').addClass('col-md-4');
  112. $('#campusDiv').removeClass('d-none');
  113. }else{
  114. $('#instituteDiv').addClass('col-md-8');
  115. $('#instituteDiv').removeClass('col-md-4');
  116. $('#campusDiv').addClass('d-none');
  117. }
  118. });
  119. $.get("{{ route('admin.ajax-get', ['name'=>'sams_intakes']) }}", {
  120. institute : institute
  121. }).done(function(intakes){
  122. var select_tag = $('.intake');
  123. select_tag.empty().append('<option disabled="">Choose One..</option>');
  124. if(intakes.length > 0){
  125. intakes.forEach(function(row){
  126. select_tag.append(
  127. $('<option></option>').val(row.intake).html(getMonthName(row.intake))
  128. );
  129. });
  130. }else{
  131. select_tag.empty().append('<option disabled="">Choose One..</option>');
  132. }
  133. });
  134. });
  135. $('.level').on('change', function(){
  136. var institute = $('.institute option:selected').val();
  137. var level = $('.level option:selected').val();
  138. var select_tag = $('.intake');
  139. $.get("{{ route('admin.ajax-get', ['name'=>'sams_intakes']) }}", {
  140. institute : institute, level : level
  141. }).done(function(intakes){
  142. select_tag.empty().append('<option disabled="">Choose One..</option>');
  143. if(intakes.length > 0){
  144. intakes.forEach(function(row){
  145. select_tag.append(
  146. $('<option></option>').val(row.intake).html(getMonthName(row.intake))
  147. );
  148. });
  149. }else{
  150. select_tag.empty().append('<option disabled="">Choose One..</option>');
  151. }
  152. });
  153. });
  154. function getMonthName(monthNumber) {
  155. var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
  156. return months[monthNumber - 1];
  157. }
  158. </script>
  159. @endpush