index.blade.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. @extends('admin.layouts.app')
  2. @section('content')
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-title">
  7. <h5>我的线索</h5>
  8. <div class="ibox-tools">
  9. <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
  10. </a>
  11. </div>
  12. </div>
  13. <div class="ibox-content">
  14. <div class="form-group">
  15. <div class="row">
  16. <div class="col-sm-4">
  17. <form method="GET" action="" accept-charset="UTF-8">
  18. <div class="input-group">
  19. <input type="text" class="form-control" value="{{Request::get('keyword')}}"
  20. placeholder="请输入关键词"
  21. name="keyword">
  22. <span class="input-group-append">
  23. <button type="submit" class="btn btn-primary"
  24. style="height: 100%">搜索</button>
  25. </span>
  26. </div>
  27. </form>
  28. </div>
  29. @if(role('User/Threads/addCallList'))
  30. <div class="col-sm-8 pull-right">
  31. <span id="addCallList" class="btn btn-primary pull-right fa fa-phone"
  32. style="display: none">添加到电话列表</span>
  33. </div>
  34. @endif
  35. </div>
  36. </div>
  37. <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
  38. <thead>
  39. <tr>
  40. <th><label><input type="checkbox" id="checkAll"> 全选</label>
  41. </th>
  42. <th class="sorting" data-sort="id"> ID</th>
  43. <th class="sorting"> 联系方式</th>
  44. <th class="sorting" data-sort="ower_id"> 线索拥有者</th>
  45. <th class="sorting">企业名称</th>
  46. <th class="sorting">企业网址</th>
  47. <th class="sorting">注册资本</th>
  48. <th class="sorting"> 最新跟进</th>
  49. <th class="sorting" data-sort="created_at"> 领取时间</th>
  50. <th width="22%">相关操作</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. @if(isset($list))
  55. @foreach($list as $key => $item)
  56. <tr>
  57. <td>
  58. <label><input class="contacts" name='contact_id[]' type="checkbox"
  59. value="{{ $item->id }}"></label>
  60. </td>
  61. <td>{{ $item->id }}</td>
  62. <td>{{ $item->contact?$item->contact->phone:'暂无联系人信息' }}</td>
  63. <td>{{ $item->ower->real_name }}</td>
  64. <td>
  65. <a href="{{ U('Company/Info/view',['id'=> $item->company->id]) }}"> {{ $item->company->companyName }} </a>
  66. </td>
  67. <td><a href="http://{{ $item->company->website }}"
  68. target="_blank">{{ $item->company->website }}</a></td>
  69. <td>{{ $item->company->regCapital }}</td>
  70. <td>{{ $item->latestProgress() }}</td>
  71. <td>{{ $item->created_at }}</td>
  72. <td>
  73. @if(role('User/Threads/update'))
  74. <button onclick="layer.open({type: 2,area: ['25%', '60%'],content: '{{ U('User/Threads/update',['id'=>$item->id])}}'});"
  75. class="btn btn-sm btn-primary ">跟进
  76. </button>
  77. @endif
  78. @if(role('User/Threads/destroy'))
  79. <a class="btn btn-sm btn-danger"
  80. href="{{ U('User/Threads/destroy',['id'=>$item->id])}}"
  81. onclick="return confirm('你确定放弃该线索?');">放弃</a>
  82. @endif
  83. @if(role('User/Threads/view'))
  84. @endif
  85. </td>
  86. </tr>
  87. @endforeach
  88. @endif
  89. </tbody>
  90. </table>
  91. <div class="row">
  92. <div class="col-sm-6">
  93. <div class="dataTables_info" id="DataTables_Table_0_info"
  94. role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}
  95. 条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。
  96. </div>
  97. </div>
  98. <div class="col-sm-6">
  99. <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
  100. {!! $list->setPath('')->appends(Request::all())->render() !!}
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. @endsection
  109. @section('js')
  110. <script type="text/javascript">
  111. /*电话全选功能*/
  112. var items = $('.contacts')
  113. $('#checkAll').click(function () {
  114. isChecked = $(this).prop('checked')
  115. items.prop('checked', isChecked)
  116. if (isChecked == true) {
  117. $('#addCallList').show()
  118. } else {
  119. $('#addCallList').hide()
  120. }
  121. })
  122. items.click(function () {
  123. checkedLength = $('.contacts:checked').length
  124. if (checkedLength) {
  125. $('#addCallList').show()
  126. } else {
  127. $('#addCallList').hide()
  128. }
  129. if (items.length == checkedLength) {
  130. $('#addCallList').show()
  131. } else {
  132. $('#checkAll').prop('checked', false)
  133. }
  134. })
  135. /*添加选择的电话到拨打列表*/
  136. $('#addCallList').click(function () {
  137. contact_ids = []
  138. csrf_token = "{{ csrf_token() }}"
  139. $('.contacts:checked').each(function () {
  140. contact_ids.push($(this).val())
  141. })
  142. $.ajax({
  143. type:'post',
  144. url:'{{ U('User/Threads/addCallList') }}',
  145. data:{contact_ids:contact_ids,_token:csrf_token},
  146. success:function (data) {
  147. if(data == 200){
  148. window.location.href =window.location.href
  149. }
  150. }
  151. })
  152. console.log(contact_ids)
  153. })
  154. </script>
  155. @endsection