PageRenderTime 59ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/resources/views/user/profile.blade.php

https://bitbucket.org/inets_company/erb_payment
PHP | 604 lines | 534 code | 65 blank | 5 comment | 56 complexity | fd2fbe629a7bc80619ab9f3329218903 MD5 | raw file
Possible License(s): Apache-2.0
  1. @extends('layouts.app')
  2. @section('content')
  3. <div class="row">
  4. <div class="col-md-12">
  5. <section class="panel">
  6. <div class="panel-body profile-information">
  7. <div class="col-md-3">
  8. <div class="profile-pic text-center">
  9. <img src="{{ asset('public/images/icon.png')}}" alt="">
  10. </div>
  11. </div>
  12. <div class="col-md-6">
  13. <div class="profile-desk">
  14. <h1><?= $user->name ?></h1>
  15. <h3><span class="text-muted">Type: <?= $user->userType->name ?></span></h3>
  16. <p>
  17. Employer: <?= $user->employer->name ?>
  18. </p>
  19. <br/>
  20. <p>
  21. Phone: <?= $user->phone ?>
  22. </p>
  23. </div>
  24. </div>
  25. <div class="col-md-3">
  26. <div class="profile-statistics">
  27. <h1><?= $user->userType->name ?></h1>
  28. <p>User Type</p>
  29. <h1><?= $user->role->name ?></h1>
  30. <p>User Role</p>
  31. </div>
  32. </div>
  33. </div>
  34. </section>
  35. </div>
  36. <div class="col-md-12">
  37. <section class="panel">
  38. <header class="panel-heading tab-bg-dark-navy-blue">
  39. <ul class="nav nav-tabs nav-justified ">
  40. <?php
  41. if ($user->is_employer == 1) {
  42. ?>
  43. <li class="active">
  44. <a data-toggle="tab" href="#members">
  45. Members Information
  46. </a>
  47. </li>
  48. <?php } else { ?>
  49. <li class="active">
  50. <a data-toggle="tab" href="#overview">
  51. Invoice Information
  52. </a>
  53. </li>
  54. <?php } ?>
  55. <li class="">
  56. <a data-toggle="tab" href="#job-history">
  57. User Activity
  58. </a>
  59. </li>
  60. <!-- <li class="">
  61. <a data-toggle="tab" href="#settings">
  62. Settings
  63. </a>
  64. </li>-->
  65. </ul>
  66. </header>
  67. <div class="panel-body">
  68. <div class="tab-content tasi-tab">
  69. <?php
  70. if ($user->is_employer == 1) {
  71. ?>
  72. <div id="members" class="tab-pane active">
  73. <div class="row">
  74. <div class="col-md-12">
  75. <h1>Members</h1>
  76. <div class="panel-body">
  77. <div class="row" id="search_checked_table" style="display:none">
  78. <a type="button" target="_blank" tags='' id="nametag_link" href="" value="" name="" class="btn btn-sm btn-danger"><i class="fa fa-cloud"></i> Print NameTag</a>
  79. <table class="table table-striped">
  80. <thead>
  81. <tr>
  82. <th>#</th>
  83. <th>Number</th>
  84. <th>Name</th>
  85. <th>Email</th>
  86. <th>Phone</th>
  87. <th>Action</th>
  88. </tr>
  89. </thead>
  90. <tbody>
  91. <tr id="search_checked"></tr>
  92. </tbody>
  93. </table>
  94. </div>
  95. <section id="unseen">
  96. <table class="table table-bordered table-striped table-condensed dataTable">
  97. <thead>
  98. <tr>
  99. <th>#</th>
  100. <th>Name</th>
  101. <th class="numeric">Phone</th>
  102. <th class="numeric">Email</th>
  103. <th class="numeric">Type</th>
  104. <th class="numeric">Employer</th>
  105. <th class="numeric">Specialization</th>
  106. <th class="numeric col-sm-4">Action</th>
  107. <th><input type="checkbox" name="all" id="toggle_all"/></th>
  108. </tr>
  109. </thead>
  110. <tbody>
  111. <?php
  112. $i = 1;
  113. // $applicants = \App\Model\User::where('employer_id', $user->employer_id)->get();
  114. $invoice = \App\Model\Invoice::where('user_id', $user->id)->first();
  115. //$applicants = $user->invoice->invoiceFee()->get();
  116. if (count($invoice) > 0) {
  117. $applicants = $invoice->invoiceFee()->get();
  118. } else {
  119. $applicants = [];
  120. }
  121. $user_ids = [];
  122. if (count($applicants) > 0) {
  123. ?>
  124. @foreach($applicants as $applicant)
  125. <tr id="row<?= $applicant->user->id ?>">
  126. <td>{{$i}}</td>
  127. <td>{{$applicant->user->name}}</td>
  128. <td class="numeric">{{$applicant->user->phone}}</td>
  129. <td class="numeric">{{$applicant->user->email}}</td>
  130. <td>{{$applicant->user->userType->name}}</td>
  131. <td>{{$applicant->user->employer->name}}</td>
  132. <td>{{$applicant->user->profession->name}}</td>
  133. <td>
  134. <?= btn_delete('user/' . $applicant->user->id, 'user') ?>
  135. <a href="<?= url('user/profile/' . $applicant->user->id) ?>" class="btn btn-xs btn-primary">View</a> &nbsp; &nbsp;<a data-toggle="modal" href="#myModal" onmousedown="open_edit_model('<?= $applicant->user->id ?>', '<?= url('setting/' . $applicant->user->id . '/edit') ?>')" class="btn btn-xs btn-info">Edit</a>
  136. <a href="<?= url('user/ticket/' . $applicant->user->id) ?>" class="btn btn-xs btn-warning">Barcode</a> &nbsp; &nbsp;
  137. <a href="<?= url('user/nametag/' . $applicant->user->id) ?>" class="btn btn-xs btn-default">Tag</a>
  138. </td>
  139. <td><input type="checkbox" class="check" name="select[]" value="<?= $applicant->user->id ?>"/></td>
  140. </tr>
  141. <?php
  142. $i++;
  143. array_push($user_ids, $applicant->user->id);
  144. ?>
  145. @endforeach
  146. <?php
  147. }
  148. if (isset($user->employer_id) && $user->employer_id != null) {
  149. $other_applicants = \App\Model\User::where('employer_id', $user->employer_id)->where('is_employer', 0)->whereNotIn('id', $user_ids)->get();
  150. } else {
  151. $other_applicants = array();
  152. }
  153. if (count($other_applicants) > 0) {
  154. ?>
  155. @foreach($other_applicants as $user)
  156. <tr id="row<?= $user->id ?>">
  157. <td>{{$i}}</td>
  158. <td>{{$user->name}}</td>
  159. <td class="numeric">{{$user->phone}}</td>
  160. <td class="numeric">{{$user->email}}</td>
  161. <td>{{$user->userType->name}}</td>
  162. <td>{{$user->employer->name}}</td>
  163. <td>{{$user->profession->name}}</td>
  164. <td>
  165. <?= btn_delete('user/' . $user->id, 'user') ?>
  166. <a href="<?= url('user/profile/' . $user->id) ?>" class="btn btn-xs btn-primary">View</a> &nbsp; &nbsp;<a data-toggle="modal" href="#myModal" onmousedown="open_edit_model('<?= $user->id ?>', '<?= url('setting/' . $user->id . '/edit') ?>')" class="btn btn-xs btn-info">Edit</a>
  167. <a href="<?= url('user/ticket/' . $user->id) ?>" class="btn btn-xs btn-warning">Barcode</a> &nbsp; &nbsp;
  168. <a href="<?= url('user/nametag/' . $user->id) ?>" class="btn btn-xs btn-default">Tag</a>
  169. </td>
  170. <td><input type="checkbox" class="check" name="select[]" value="<?= $user->id ?>"/></td>
  171. </tr>
  172. <?php $i++; ?>
  173. @endforeach
  174. <?php } ?>
  175. </tbody>
  176. </table>
  177. </section>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. <?php } else { ?>
  183. <div id="overview" class="tab-pane active">
  184. <div class="row">
  185. <div class="col-md-12">
  186. <h1>Invoice Records</h1>
  187. <div class="panel-body">
  188. <section id="unseen">
  189. <table class="table table-bordered table-striped table-condensed">
  190. <thead>
  191. <tr>
  192. <th>#</th>
  193. <th>Payer Name</th>
  194. <th class="numeric">Invoice Number</th>
  195. <th class="numeric">Date</th>
  196. <th class="numeric">Amount</th>
  197. <th class="numeric">Payment For</th>
  198. <th class="numeric">Paid Amount</th>
  199. <th class="numeric">UnPaid Amount</th>
  200. <th class="numeric">Payment Status</th>
  201. <th class="numeric">Action</th>
  202. </tr>
  203. </thead>
  204. <tbody>
  205. <?php
  206. $i = 1;
  207. $invoices = $user->invoice()->get();
  208. if (count($invoices) > 0) {
  209. ?>
  210. @foreach($invoices as $invoice)
  211. <tr>
  212. <td>{{$i}}</td>
  213. <td>{{$invoice->user->name}}</td>
  214. <td class="numeric">{{$invoice->number}}</td>
  215. <td class="numeric">{{$invoice->date}}</td>
  216. <td data-title="">
  217. <?php
  218. $am = $invoice->invoiceFee()->sum('amount');
  219. echo money($am);
  220. ?>
  221. </td>
  222. <td class="numeric">{{$invoice->title}}</td>
  223. <td data-title="">
  224. <?php
  225. $paid = $invoice->invoiceFeesPayment()->sum('paid_amount');
  226. echo money($paid);
  227. ?>
  228. </td>
  229. <td data-title="">
  230. <?php
  231. $unpaid = $am - $paid;
  232. echo money($unpaid);
  233. ?>
  234. </td>
  235. <td class="numeric"><?php
  236. if ($invoice->status == 1) {
  237. echo '<span class="label label-success">Paid</span>';
  238. } else if ($invoice->status == 2) {
  239. echo '<span class="label label-warning">Partially Paid</span>';
  240. } else {
  241. echo '<span class="label label-danger">Not Paid</span>';
  242. }
  243. $i++;
  244. ?></td>
  245. <td class="numeric">
  246. <a href="<?= url('invoice/' . $invoice->id) ?>" class="btn btn-xs btn-success">View</a>
  247. <?= btn_delete('invoice/' . $invoice->id, '') ?>
  248. </td>
  249. </tr>
  250. @endforeach
  251. <?php
  252. } else {
  253. if (count($user) == 0) {
  254. $invoices = [];
  255. } else {
  256. $invoices = $user->invoiceFee()->get();
  257. }
  258. if (count($invoices) > 0) {
  259. ?>
  260. @foreach($invoices as $invoice_fee)
  261. <tr>
  262. <td>{{$i}}</td>
  263. <td>{{$user->name.', Sponsored Organization: '.$invoice_fee->invoice->user->name}}</td>
  264. <td class="numeric">{{$invoice_fee->invoice->number}}</td>
  265. <td class="numeric">{{$invoice_fee->invoice->date}}</td>
  266. <td data-title="">
  267. <?php
  268. $am = $invoice_fee->invoice->invoiceFee->sum('amount');
  269. echo money($am);
  270. ?>
  271. </td>
  272. <td class="numeric">{{$invoice_fee->invoice->title}}</td>
  273. <td data-title="">
  274. <?php
  275. $paid = $invoice_fee->invoice->invoiceFeesPayment()->sum('paid_amount');
  276. echo money($paid);
  277. ?>
  278. </td>
  279. <td data-title="">
  280. <?php
  281. $unpaid = $am - $paid;
  282. echo money($unpaid);
  283. ?>
  284. </td>
  285. <td class="numeric"><?php
  286. if ($invoice_fee->invoice->status == 1) {
  287. echo '<span class="label label-success">Paid</span>';
  288. } else if ($invoice_fee->invoice->status == 2) {
  289. echo '<span class="label label-warning">Partially Paid</span>';
  290. } else {
  291. echo '<span class="label label-danger">Not Paid</span>';
  292. }
  293. $i++;
  294. ?></td>
  295. <td class="numeric">
  296. <a href="<?= url('invoice/' . $invoice_fee->invoice->id) ?>" class="btn btn-xs btn-success">View</a>
  297. <?= btn_delete('invoice/' . $invoice_fee->invoice->id, '') ?>
  298. </td>
  299. </tr>
  300. @endforeach
  301. <?php
  302. }
  303. }
  304. ?>
  305. </tbody>
  306. </table>
  307. </section>
  308. </div>
  309. </div>
  310. </div>
  311. </div>
  312. <?php } ?>
  313. <div id="job-history" class="tab-pane">
  314. <div class="row">
  315. <div class="col-md-12">
  316. <div class="timeline-messages">
  317. <h3>Take a Tour</h3>
  318. <div class="recent-act">
  319. <h4>User Activity</h4>
  320. <div class="x_content">
  321. <div class="flex">
  322. <table class="data table table-striped no-margin">
  323. <thead>
  324. <tr>
  325. <th>On Date</th>
  326. <th>Page visit action</th>
  327. <th>Device</th>
  328. <th class="hidden-phone">Browser</th>
  329. <th>Location</th>
  330. </tr>
  331. </thead>
  332. <tbody>
  333. <?php
  334. $logs = \App\Model\Log::where('user_id', $user->id)->paginate(30);
  335. if (isset($logs)) {
  336. foreach ($logs as $log) {
  337. //check to identify action
  338. $ar = explode('/', $log->url);
  339. $controller = isset($ar[1]) ? $ar[1] : '';
  340. $method = isset($ar[2]) ? $ar[2] : '';
  341. ?>
  342. <tr>
  343. <td><?= date('d M Y', strtotime($log->created_at)) . ' at ' . date('h:i A', strtotime($log->created_at)) ?></td>
  344. <td><?php
  345. if (preg_match('/index/', $method) || preg_match('/view/', $method) || preg_match('/show/', $method)) {
  346. $action = 'View';
  347. } else if (preg_match('/add/', $method)) {
  348. $action = 'Add ';
  349. } else if (preg_match('/edit/', $method)) {
  350. $action = 'Edit';
  351. } else if (preg_match('/delete/', $method)) {
  352. $action = 'Delete';
  353. } else {
  354. $action = 'View';
  355. }
  356. echo $action . ' ' . $controller;
  357. ?></td>
  358. <td><?= $log->platform ?></td>
  359. <td class="hidden-phone"><?= $log->user_agent ?></td>
  360. <td class="vertical-align-mid">
  361. <?= $log->city ?>
  362. </td>
  363. </tr>
  364. <?php
  365. }
  366. }
  367. ?>
  368. </tbody>
  369. </table>
  370. </div>
  371. </div>
  372. <div><?php if (isset($logs)) { ?>
  373. <?php } ?>
  374. </div>
  375. </div>
  376. <!-- /comment -->
  377. </div>
  378. </div>
  379. </div>
  380. </div>
  381. <div id="settings" class="tab-pane ">
  382. <div class="position-center">
  383. <div class="prf-contacts sttng">
  384. <h2> User Information</h2>
  385. </div>
  386. <form role="form" class="form-horizontal" id="commentForm" method="POST" action="<?= url('user/' . $user->id) ?>">
  387. <div class="form-group">
  388. <label class="col-lg-2 control-label">Name</label>
  389. <div class="col-lg-6">
  390. <input type="text" placeholder=" " id="c-name" value="<?= $user->name ?>" name="name" class="form-control">
  391. </div>
  392. </div>
  393. <div class="form-group">
  394. <label class="col-lg-2 control-label">Reg Number</label>
  395. <div class="col-lg-6">
  396. <input type="text" value="<?= $user->number ?>" placeholder=" " name="number" id="location" class="form-control">
  397. </div>
  398. </div>
  399. <div class="prf-contacts sttng">
  400. <h2>Contact</h2>
  401. </div>
  402. <div class="form-group">
  403. <label class="col-lg-2 control-label">Phone</label>
  404. <div class="col-lg-6">
  405. <input type="text" placeholder=" " value="<?= $user->phone ?>" name="phone" id="phone" class="form-control">
  406. </div>
  407. </div>
  408. <div class="form-group">
  409. <label class="col-lg-2 control-label">Email</label>
  410. <div class="col-lg-6">
  411. <input type="text" placeholder=" " value="<?= $user->email ?>" name="email" id="email" class="form-control">
  412. </div>
  413. </div>
  414. <div class="form-group ">
  415. <label for="role_id" class="control-label col-lg-2">Role(required)</label>
  416. <div class="col-lg-6">
  417. <select name="role_id" class="form-control m-bot15">
  418. <?php
  419. $roles = \App\Model\Role::all();
  420. foreach ($roles as $role) {
  421. ?>
  422. <option value="<?= $role->id ?>" <?php
  423. if ($user->role_id == $role->id) {
  424. echo 'selected';
  425. }
  426. ?>><?= $role->name ?></option>
  427. <?php } ?>
  428. </select>
  429. </div>
  430. </div>
  431. <div class="form-group ">
  432. <label for="user_type_id" class="control-label col-lg-2">User Type (required)</label>
  433. <div class="col-lg-6">
  434. <select name="user_type_id" class="form-control m-bot15">
  435. <?php
  436. $user_types = \App\Model\User_type::all();
  437. foreach ($user_types as $user_type) {
  438. ?>
  439. <option value="<?= $user_type->id ?>" <?php
  440. if ($user->user_type_id == $user_type->id) {
  441. echo 'selected';
  442. }
  443. ?>><?= $user_type->name ?></option>
  444. <?php } ?>
  445. </select>
  446. </div>
  447. </div>
  448. <div class="form-group">
  449. <div class="col-lg-offset-2 col-lg-10">
  450. <?= csrf_field() ?>
  451. {{ Form::open(array('url' => 'user/' . $user->id, 'class' => '')) }}
  452. {{ Form::hidden('_method', 'PUT') }}
  453. {{ Form::close() }}
  454. <button class="btn btn-primary" type="submit">Save</button>
  455. <button class="btn btn-default" type="button">Cancel</button>
  456. </div>
  457. </div>
  458. </form>
  459. </div>
  460. </div>
  461. </div>
  462. </div>
  463. </section>
  464. </div>
  465. </div>
  466. <script type="text/javascript">
  467. search_checked = function () {
  468. $('.check').click(function () {
  469. var value = $(this).val();
  470. var status = $(this).is(':checked');
  471. if (status === true) {
  472. var text = $('#row' + value).html();
  473. $('#search_checked_table').show();
  474. $('#search_checked').after('<tr id="s_table' + value + '">' + text + '</tr>');
  475. var ex = $('#nametag_link').attr('tags');
  476. var url = '<?= url('user/bulknametag?ids=') ?>';
  477. var param = ex.split(",");
  478. param.push(value);
  479. $('#nametag_link').attr('tags', param.join(","));
  480. $('#nametag_link').attr('href', url + param.join(","));
  481. console.log(param);
  482. } else {
  483. var ex = $('#nametag_link').attr('tags');
  484. var url = '<?= url('user/bulknametag?ids=') ?>';
  485. var param = ex.split(",");
  486. param = jQuery.grep(param, function (val) {
  487. return val != value;
  488. });
  489. var arr = param;
  490. var result = arr.filter(function (elem) {
  491. return elem != value;
  492. });
  493. console.log(result);
  494. $('#nametag_link').attr('tags', result.join(","));
  495. $('#nametag_link').attr('href', url + result.join(","));
  496. $('#s_table' + value).remove();
  497. }
  498. });
  499. }
  500. toggle_all = function () {
  501. $('#toggle_all').click(function () {
  502. var status = $(this).is(':checked');
  503. if ($("#toggle_all").prop('checked')) {
  504. $('.check').prop("checked", true);
  505. } else {
  506. $('.check').prop("checked", false);
  507. }
  508. if (status === true) {
  509. //select all
  510. $.ajax({
  511. type: 'GET',
  512. url: "<?= url('user/getApplicants') ?>",
  513. data: {
  514. "type": '<?= request('type') ?>',
  515. employer_id:<?= $user->employer_id ?>,
  516. 'user_id':<?= $user->id ?>
  517. },
  518. dataType: "html",
  519. success: function (data) {
  520. console.log(data);
  521. $('#search_checked_table').show();
  522. var ex = data;
  523. var url = '<?= url('user/bulknametag?ids=') ?>';
  524. var param = ex.split(",");
  525. $('#nametag_link').attr('tags', param.join(","));
  526. $('#nametag_link').attr('href', url + param.join(","));
  527. console.log(param);
  528. }
  529. });
  530. } else {
  531. //diselect all
  532. $('#search_checked_table').hide();
  533. }
  534. });
  535. };
  536. $(document).ready(toggle_all);
  537. $(document).ready(search_checked);
  538. </script>
  539. @endsection