address_book.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. @extends('layouts.master')
  2. @section('content')
  3. <!-- Main content -->
  4. <section class="content">
  5. <!-- Main row -->
  6. <div class="row">
  7. <div class="col-md-12">
  8. <section class="panel tasks-widget">
  9. <header class="panel-heading" style="height:40px;">
  10. <div class="pull-left">
  11. {{$title}}
  12. </div>
  13. <div>
  14. <button class="btn btn-success btn-xs pull-right" data-toggle="modal" data-target=".add-modal">Add Address Book Info</button>
  15. </div>
  16. </header>
  17. <div class="table-responsive project-list">
  18. @if(Session::has('msg'))
  19. {{Session::get('msg')}}
  20. {{"sdjflsdfjls"}}
  21. @endif
  22. <table class="table table-striped">
  23. <thead>
  24. <tr>
  25. <th>
  26. Name
  27. </th>
  28. <th>
  29. Company name
  30. </th>
  31. <th>
  32. Designation
  33. </th>
  34. <th>
  35. Mobile
  36. </th>
  37. <th>
  38. Email
  39. </th>
  40. <th>
  41. Action
  42. </th>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. @if (session('data'))
  47. <div class="alert alert-success">
  48. {{ session('data') }}
  49. </div>
  50. @endif
  51. @if($all)
  52. @foreach($all as $info)
  53. <tr>
  54. <td>{{$info->name}}</td>
  55. <td>
  56. {{$info->company->name or ''}}
  57. </td>
  58. <td>
  59. {{$info->designation}}
  60. </td>
  61. <td>
  62. Mobile 01 # {{$info->mob1}} <br>
  63. Mobile 02 # {{$info->mob2}}
  64. </td>
  65. <td>
  66. Email 01 # {{$info->email1}} <br>
  67. Email 02 # {{$info->email2}}
  68. </td>
  69. <td>
  70. <input type="hidden" id="proj_id" value="{{$info->id}}">
  71. <button class="btn btn-xs edit-btn" data-toggle="modal" data-target=".edit-company" style="color: #7dcc93;">
  72. <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
  73. </button>
  74. &nbsp; &nbsp;
  75. <a onclick="return confirm ('want to delete?')" href="{{url("admin/address_book/$info->id")}}">
  76. <button class="btn btn-xs" style="color:#FD4B39;">
  77. <i class="fa fa-times" aria-hidden="true"></i>
  78. </button>
  79. </a>
  80. </td>
  81. </tr>
  82. @endforeach
  83. @endif
  84. </tbody>
  85. </table>
  86. <hr>
  87. </hr>
  88. </div>
  89. <div class="panel-body">
  90. <div class=" add-task-row">
  91. </div>
  92. <div class="table-foot">
  93. <ul class="pagination pagination-sm no-margin ">
  94. <li>
  95. <a href="#">
  96. «
  97. </a>
  98. </li>
  99. <li>
  100. <a href="#">
  101. 1
  102. </a>
  103. </li>
  104. <li>
  105. <a href="#">
  106. 2
  107. </a>
  108. </li>
  109. <li>
  110. <a href="#">
  111. 3
  112. </a>
  113. </li>
  114. <li>
  115. <a href="#">
  116. »
  117. </a>
  118. </li>
  119. </ul>
  120. </div>
  121. </div>
  122. </section>
  123. </div>
  124. </div>
  125. </section>
  126. <!-- row end -->
  127. <!-- /.content -->
  128. <!-- Modal Add Contract person -->
  129. <div class="modal fade add-modal" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  130. <div class="modal-dialog" role="document">
  131. <div class="modal-content">
  132. <div class="modal-header">
  133. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  134. <h4 class="modal-title" id="gridSystemModalLabel">Add Address Book Info</h4>
  135. </div>
  136. <div class="modal-body">
  137. <form action="{{url('admin/address_book')}}" method="POST">
  138. {{ csrf_field() }}
  139. <div class="form-group in-group">
  140. <label for="">Name<span class="field_mendatory">*</span></label>
  141. <input type="text" name="name" required="" class="form-control" id="" placeholder="Contact Person Name" >
  142. </div>
  143. <div class="form-group in-group">
  144. <label for="">Company Name</label>
  145. <select class="form-control" name="company_name" id="company_name">
  146. <option value="0">Select Company Name</option>
  147. @if(count($company)>0)
  148. @foreach($company as $info)
  149. <option value="{{$info->id}}">{{$info->name}}</option>
  150. @endforeach
  151. @endif
  152. </select>
  153. </div>
  154. <div class="form-group in-group">
  155. <label for="">Designation</label>
  156. <input type="text" name="designation" class="form-control" id="" placeholder="Designation" >
  157. </div>
  158. <div class="form-group in-group">
  159. <label for="">Mobile no #01<span class="field_mendatory">*</span></label>
  160. <input type="text" name="mob1" required="" class="form-control" id="" placeholder="Mobile number" >
  161. </div>
  162. <div class="form-group in-group">
  163. <label for="">Mobile no #02</label>
  164. <input type="text" name="mob2" class="form-control" id="" placeholder="Optional mobile number" >
  165. </div>
  166. <div class="form-group in-group">
  167. <label for="">Email #01</label>
  168. <input type="email" name="email1" required="" class="form-control" id="" placeholder="Email address" >
  169. </div>
  170. <div class="form-group in-group">
  171. <label for="">Email #02</label>
  172. <input type="email" name="email2" class="form-control" id="" placeholder="Optional email address" >
  173. </div>
  174. </div>
  175. <div class="modal-footer">
  176. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  177. <button type="submit" class="btn btn-primary">Submit</button>
  178. </div>
  179. </form>
  180. </div><!-- /.modal-content -->
  181. </div><!-- /.modal-dialog -->
  182. </div><!-- /.modal -->
  183. <!-- Modal Edit Company -->
  184. <div class="modal fade edit-company" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  185. <div class="modal-dialog" role="document">
  186. <div class="modal-content">
  187. <div class="modal-header">
  188. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  189. <h4 class="modal-title" id="gridSystemModalLabel">Edit Address Book Info</h4>
  190. </div>
  191. <div class="modal-body">
  192. <form action="{{url('admin/update_address_book')}}" method="POST">
  193. {{ csrf_field() }}
  194. <input type="hidden" name="edit_id" value="" id="edit_id">
  195. <div class="form-group in-group">
  196. <label for="">Name<span class="field_mendatory">*</span></label>
  197. <input type="text" name="edit_name" required="" class="form-control" id="edit_name" placeholder="User name" >
  198. </div>
  199. <div class="form-group in-group">
  200. <label for="">Company Name</label>
  201. <select class="form-control" name="edit_company_name" id="edit_company_name">
  202. <option value="0">Select Company Name</option>
  203. @if(count($company)>0)
  204. @foreach($company as $info)
  205. <option value="{{$info->id}}">{{$info->name}}</option>
  206. @endforeach
  207. @endif
  208. </select>
  209. </div>
  210. <div class="form-group in-group">
  211. <label for="">Designation</label>
  212. <input type="text" name="edit_designation" class="form-control" id="edit_designation" placeholder="Designation" >
  213. </div>
  214. <div class="form-group in-group">
  215. <label for="">Mobile no #01<span class="field_mendatory">*</span></label>
  216. <input type="text" name="edit_mob1" required="" class="form-control" id="edit_mob1" placeholder="Mobile number" >
  217. </div>
  218. <div class="form-group in-group">
  219. <label for="">Mobile no #02</label>
  220. <input type="text" name="edit_mob2" class="form-control" id="edit_mob2" placeholder="Optional mobile number" >
  221. </div>
  222. <div class="form-group in-group">
  223. <label for="">Email #01<span class="field_mendatory">*</span></label>
  224. <input type="email" name="edit_email1" required="" class="form-control" id="edit_email1" placeholder="Email address" >
  225. </div>
  226. <div class="form-group in-group">
  227. <label for="">Email #02</label>
  228. <input type="email" name="edit_email2" class="form-control" id="edit_email2" placeholder="Optional email address" >
  229. </div>
  230. </div>
  231. <div class="modal-footer">
  232. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  233. <button type="submit" class="btn btn-primary">Submit</button>
  234. </div>
  235. </form>
  236. </div><!-- /.modal-content -->
  237. </div><!-- /.modal-dialog -->
  238. </div><!-- /.modal -->
  239. @endsection
  240. @section('script')
  241. <script type="text/javascript">
  242. $('.edit-btn').click(function(event) {
  243. var id = $(this).prev('input').val();
  244. $.ajax({
  245. url: "{{url("admin/address_book")}}/"+id+"/edit",
  246. type: 'GET',
  247. })
  248. .done(function(data){
  249. $('#edit_id').val(data['id']);
  250. $('#edit_name').val(data['name']);
  251. $('#edit_designation').val(data['designation']);
  252. var company_name = data['company_name'];
  253. $("#edit_company_name option[value='"+company_name+"']").prop('selected', true);
  254. $('#edit_mob1').val(data['mob1']);
  255. $('#edit_mob2').val(data['mob2']);
  256. $('#edit_email1').val(data['email1']);
  257. $('#edit_email2').val(data['email2']);
  258. });
  259. });
  260. </script>
  261. @endsection