edit.blade.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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 active">Update</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::model($course,['method'=>'PETCH','url'=>['admin/courses/update',$course->id]])!!}
  36. <div class="row">
  37. <div class="col-md-4">
  38. <div class="form-group">
  39. <label>Destination:</label>
  40. <select class="form-control destination" name="destination_id" required="">
  41. <option disabled="" selected="" value="">Choose One..</option>
  42. @foreach($destinations as $row)
  43. <option value="{{$row['id']}}::{{$row['name']}}" @if($row['id'] == $course->destination->sams_id) selected @endif>{{$row['name']}}</option>
  44. @endforeach
  45. </select>
  46. </div>
  47. </div>
  48. <div class="@if(count($campuses) > 0) col-md-4 @else col-md-8 @endif" id="instituteDiv">
  49. <div class="form-group">
  50. <label>Institute:</label>
  51. <select class="form-control select2 institute" name="institute_id" required="">
  52. <option disabled="" selected="" value="">Choose One..</option>
  53. @foreach($institutes as $row)
  54. <option value="{{$row['institute_id']}}::{{$row['institute_name']}}" @if($row['institute_id'] == $course->institute->sams_id) selected @endif>{{$row['institute_name']}}</option>
  55. @endforeach
  56. </select>
  57. </div>
  58. </div>
  59. <div class="col-md-4 @if(count($campuses) == 0) d-none @endif" id="campusDiv">
  60. <div class="form-group">
  61. <label>Campus:</label>
  62. <select class="form-control campus select2" multiple name="campuses[]">
  63. <option disabled="">Choose One..</option>
  64. @if(count($campuses) > 0)
  65. @foreach($campuses as $row)
  66. <option value="{{$row['id']}}::{{$row['name']}}" @if(in_array($row['id'], $selected_campuses)) selected @endif>{{$row['name']}}</option>
  67. @endforeach
  68. @endif
  69. </select>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="row">
  74. <div class="col-md-4">
  75. <div class="form-group">
  76. <label>Course Level:</label>
  77. <select class="form-control level" name="level_id" required="">
  78. <option disabled="" selected="" value="">Choose One..</option>
  79. @if(count($levels) > 0)
  80. @foreach($levels as $row)
  81. <option value="{{$row['id']}}::{{$row['name']}}" @if($row['id'] == $course->level->sams_id) selected @endif>{{$row['name']}}</option>
  82. @endforeach
  83. @endif
  84. </select>
  85. </div>
  86. </div>
  87. <div class="col-md-4">
  88. <div class="form-group">
  89. <label>Department:</label>
  90. <input type="text" class="form-control" name="department" id="department" value="{{$course->department}}" required="">
  91. </div>
  92. </div>
  93. <div class="col-md-4">
  94. <div class="form-group">
  95. <label>Intake:</label>
  96. <select class="form-control select2 intake" multiple name="intakes[]" >
  97. <option disabled="">Choose One..</option>
  98. @if(count($intakes) > 0)
  99. @foreach($intakes as $row)
  100. <option value="{{$row['intake']}}" @if(in_array($row['intake'], $selected_intakes)) selected @endif>{{date("F", strtotime(date("Y") ."-". $row['intake'] ."-01"))}}</option>
  101. @endforeach
  102. @endif
  103. </select>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="row">
  108. <div class="col-md-4">
  109. <div class="form-group">
  110. <label>Course Name:</label>
  111. <input type="text" class="form-control" name="courseName" value="{{$course->name}}" id="courseName" required="">
  112. </div>
  113. </div>
  114. <div class="col-md-4">
  115. <div class="form-group">
  116. <label>Course Length (month):</label>
  117. <input type="number" class="form-control" min="0" name="courseLength" value="{{$course->length}}" id="courseLength" required="">
  118. </div>
  119. </div>
  120. <div class="col-md-4">
  121. <div class="form-group">
  122. <label>Tution Fee:</label>
  123. <input type="number" class="form-control" name="tutionFee" value="{{$course->tution_fee}}" id="tutionFee" required="">
  124. </div>
  125. </div>
  126. </div>
  127. <div class="row">
  128. <div class="col-md-3">
  129. <div class="form-group">
  130. <label>IELTS:</label>
  131. <input type="text" class="form-control" name="ielts" value="{{$course->ielts}}" id="ielts">
  132. </div>
  133. </div>
  134. <div class="col-md-3">
  135. <div class="form-group">
  136. <label>TOEFL:</label>
  137. <input type="text" class="form-control" name="toefl" value="{{$course->toefl}}" id="toefl">
  138. </div>
  139. </div>
  140. <div class="col-md-3">
  141. <div class="form-group">
  142. <label>Duolingo:</label>
  143. <input type="text" class="form-control" name="duolingo" value="{{$course->duolingo}}" id="duolingo">
  144. </div>
  145. </div>
  146. <div class="col-md-3">
  147. <div class="form-group">
  148. <label>PTE:</label>
  149. <input type="text" class="form-control" name="pte" value="{{$course->pte}}" id="pte">
  150. </div>
  151. </div>
  152. </div>
  153. <div class="row">
  154. <div class="col-md-3">
  155. <div class="form-group">
  156. <label>Scolarship:</label>
  157. <input type="text" class="form-control" name="scholarship" value="{{$course->scholarship}}" id="scholarship">
  158. </div>
  159. </div>
  160. <div class="col-md-3">
  161. <div class="form-group">
  162. <label>Deposit Required:</label>
  163. <input type="text" class="form-control" name="depositRequired" value="{{$course->deposit_required}}" id="depositRequired" >
  164. {{-- <div class="input-group">
  165. <input type="number" min="0" max="100" class="form-control" name="depositRequired" value="{{$course->deposit_required}}" id="depositRequired" >
  166. <span class="input-group-addon mt-2">%</span>
  167. </div> --}}
  168. </div>
  169. </div>
  170. <div class="col-md-3">
  171. <div class="form-group">
  172. <label>SOP:</label>
  173. <select class="form-control" name="sop" required="">
  174. <option value="0" @if($course->sop == 0) selected @endif>No</option>
  175. <option value="1" @if($course->sop == 1) selected @endif>Yes</option>
  176. </select>
  177. </div>
  178. </div>
  179. <div class="col-md-3">
  180. <div class="form-group">
  181. <label>CV:</label>
  182. <select class="form-control" name="cv" required="">
  183. <option value="0" @if($course->cv == 0) selected @endif>No</option>
  184. <option value="1" @if($course->cv == 1) selected @endif>Yes</option>
  185. </select>
  186. </div>
  187. </div>
  188. {{-- <div class="col-md-4">
  189. <div class="form-group">
  190. <label>UCAS Fee:</label>
  191. <select class="form-control" name="ucasFee" required="">
  192. <option @if($course->ucas_fee == 0) selected @endif value="0">No</option>
  193. <option @if($course->ucas_fee == 1) selected @endif value="1">Yes</option>
  194. </select>
  195. </div>
  196. </div> --}}
  197. </div>
  198. <div class="row">
  199. {{-- <div class="col-md-3">
  200. <div class="form-group">
  201. <label>Minimum GPA:</label>
  202. <input type="number" step=".1" min="0" max="9" class="form-control" name="minGpa" value="{{$course->min_gpa}}" id="minGpa" >
  203. </div>
  204. </div> --}}
  205. <div class="col-md-9">
  206. <div class="form-group">
  207. <label>Keywords</label>
  208. <input type="text" class="form-control tokenfield" name="tags" value="@foreach($selected_tags as $tag){{$tag}}@if(!$loop->last) , @endif @endforeach">
  209. </div>
  210. </div>
  211. <div class="col-md-3">
  212. <div class="form-group">
  213. <label>Reference:</label>
  214. <select class="form-control" name="reference" required="">
  215. <option value="0" @if($course->reference == 0) selected @endif>N/A</option>
  216. <option value="1" @if($course->reference == 1) selected @endif>1</option>
  217. <option value="2" @if($course->reference == 2) selected @endif>2</option>
  218. </select>
  219. </div>
  220. </div>
  221. </div>
  222. <div class="row">
  223. <div class="col-md-12">
  224. <div class="form-group">
  225. <label>Entry Requirements</label>
  226. <textarea class="form-control summernote" name="entry_requirement">{!! $course->entry_requirement !!}</textarea>
  227. </div>
  228. </div>
  229. </div>
  230. <div class="text-right">
  231. <a href="{{ url()->current() }}" class="btn btn-secondary pull-left">
  232. Refresh
  233. <i class="icon-reload-alt ml-2"></i>
  234. </a>
  235. <button type="submit" class="btn btn-primary">Submit <i class="icon-paperplane ml-2"></i></button>
  236. </div>
  237. {!! Form::close() !!}
  238. </div>
  239. </div>
  240. </div>
  241. <!-- /content area -->
  242. @endsection
  243. @push('scripts')
  244. <script type="text/javascript" src="{{ asset('assets//global/js/plugins/forms/selects/select2.min.js')}}"></script>
  245. <script type="text/javascript" src="{{ asset('assets/global/js/plugins/forms/tags/tagsinput.min.js')}}"></script>
  246. <script type="text/javascript" src="{{ asset('assets/global/js/plugins/forms/tags/tokenfield.min.js')}}"></script>
  247. <script type="text/javascript" src="{{ asset('assets/global/js/plugins/editors/summernote/summernote.min.js')}}"></script>
  248. <script type="text/javascript">
  249. $(document).ready(function(){
  250. $('.select2').select2();
  251. $('.tokenfield').tokenfield();
  252. $('.summernote').summernote();
  253. });
  254. $('.destination').on('change', function(){
  255. var destination = $('.destination option:selected').val();
  256. var select_tag = $('.institute');
  257. $.get("{{ route('admin.ajax-get', ['name'=>'sams_institutes']) }}", {
  258. destination : destination, type : 'all'
  259. }).done(function(res){
  260. select_tag.empty().append('<option disabled="" selected="" value="">Choose One..</option>');
  261. res.forEach(function(row){
  262. select_tag.append(
  263. $('<option></option>').val(row.institute_id+'::'+row.institute_name).html(row.institute_name)
  264. );
  265. });
  266. });
  267. $('.institute').empty().append('<option disabled="" selected="" value="">Choose One..</option>');
  268. $('.level').empty().append('<option disabled="" selected="" value="">Choose One..</option>');
  269. $('.campus').empty().append('<option disabled="">Choose One..</option>');
  270. $('.intake').empty().append('<option disabled="">Choose One..</option>');
  271. });
  272. $('.institute').on('change', function(){
  273. var institute = $('.institute option:selected').val();
  274. var select_tag = $('.level');
  275. $.get("{{ route('admin.ajax-get', ['name'=>'sams_levels']) }}", {
  276. institute : institute, group : 0
  277. }).done(function(res){
  278. select_tag.empty().append('<option disabled="" selected="" value="">Choose One..</option>');
  279. res.forEach(function(row){
  280. select_tag.append(
  281. $('<option></option>').val(row.id+'::'+row.name).html(row.name)
  282. );
  283. });
  284. });
  285. $.get("{{ route('admin.ajax-get', ['name'=>'sams_campuses']) }}", {
  286. institute : institute
  287. }).done(function(campuses){
  288. var select_tag = $('.campus');
  289. select_tag.empty().append('<option disabled="">Choose One..</option>');
  290. if(campuses.length > 0){
  291. campuses.forEach(function(row){
  292. select_tag.append(
  293. $('<option></option>').val(row.id+'::'+row.name).html(row.name)
  294. );
  295. });
  296. $('#instituteDiv').removeClass('col-md-8');
  297. $('#instituteDiv').addClass('col-md-4');
  298. $('#campusDiv').removeClass('d-none');
  299. }else{
  300. $('#instituteDiv').addClass('col-md-8');
  301. $('#instituteDiv').removeClass('col-md-4');
  302. $('#campusDiv').addClass('d-none');
  303. }
  304. });
  305. $.get("{{ route('admin.ajax-get', ['name'=>'sams_intakes']) }}", {
  306. institute : institute
  307. }).done(function(intakes){
  308. var select_tag = $('.intake');
  309. select_tag.empty().append('<option disabled="">Choose One..</option>');
  310. if(intakes.length > 0){
  311. intakes.forEach(function(row){
  312. select_tag.append(
  313. $('<option></option>').val(row.intake).html(getMonthName(row.intake))
  314. );
  315. });
  316. }else{
  317. select_tag.empty().append('<option disabled="">Choose One..</option>');
  318. }
  319. });
  320. });
  321. $('.level').on('change', function(){
  322. var institute = $('.institute option:selected').val();
  323. var level = $('.level option:selected').val();
  324. var select_tag = $('.intake');
  325. $.get("{{ route('admin.ajax-get', ['name'=>'sams_intakes']) }}", {
  326. institute : institute, level : level
  327. }).done(function(intakes){
  328. select_tag.empty().append('<option disabled="">Choose One..</option>');
  329. if(intakes.length > 0){
  330. intakes.forEach(function(row){
  331. select_tag.append(
  332. $('<option></option>').val(row.intake).html(getMonthName(row.intake))
  333. );
  334. });
  335. }else{
  336. select_tag.empty().append('<option disabled="">Choose One..</option>');
  337. }
  338. });
  339. });
  340. function getMonthName(monthNumber) {
  341. var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
  342. return months[monthNumber - 1];
  343. }
  344. </script>
  345. @endpush