companies.blade.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  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 company</button>
  15. </div>
  16. </header>
  17. <div class="table-responsive project-list" style="padding: 10px;">
  18. @if(Session::has('msg'))
  19. {{Session::get('msg')}}
  20. @endif
  21. <table class="table table-bordered" id="example" style="border: 1px solid #dee2e6" >
  22. <caption class='text-left' style='padding-left:10px;'>
  23. <br>
  24. <form action="{{ url('admin/companies') }}" method="GET" class='form-inline'>
  25. <input type="text" style='width:200px;' name="cname" id="cname" placeholder="Company Name" class="form-control" value="{{ $cname }}">
  26. <button type="submit" class='btn btn-info'><i class="fa fa-search"></i></button>
  27. </form>
  28. <br>
  29. </caption>
  30. <thead>
  31. <tr style="background: #f8f9fa;height: 40px">
  32. <th width="15%">
  33. Company Name
  34. </th>
  35. <th width="25%">
  36. Contact Info
  37. </th>
  38. <th class="text-center" width="15%">
  39. To Do List
  40. </th>
  41. <th width="25%">
  42. Address &amp; Remarks
  43. </th>
  44. <th width="10%">
  45. Status
  46. </th>
  47. <th width="10%">
  48. Action
  49. </th>
  50. </tr>
  51. </thead>
  52. <tbody>
  53. @if (session('data'))
  54. <div class="alert alert-success">
  55. {{ session('data') }}
  56. </div>
  57. @endif
  58. @if($all)
  59. @foreach($all as $info)
  60. <tr>
  61. <td>{{$info->name}}</td>
  62. <td>
  63. @if(!empty($info->web)) <b>Website: </b>{{$info->web}}<br> @endif
  64. <b>Mob#01: </b>{{$info->mob1}}<br>
  65. <b>Email#01: </b>{{$info->email1}}<br>
  66. </td>
  67. <?php
  68. $ary_industry = [
  69. 1=>"Recreation",2=>"Food",3=>"Training",
  70. 4=>"Professionals",5=>"Industry",6=>"Agriculture",7=>"Germents",8=>"Health",9=>"Apperal",10=>"E-Commerce"
  71. ];
  72. $ary_service = [
  73. 1=>"All", 2=>"Mobile App", 3=>"Website", 4=>"Software"
  74. ];
  75. $ary_condition =[ 1=>"N/A", 2=>"Bad", 3=>"Excellent"];
  76. ?>
  77. <td class="text-center">
  78. @if(@$info->mtask['task_type']==1)
  79. <label class="label label-success text-center">New Task created</label>
  80. {{-- <b>{{$info->mtask['name']}} </b>-{!! $info->mtask['description'] !!} --}}
  81. @elseif(@$info->mtask['task_type']==2)
  82. <label class="label label-info text-center">Appointment created</label>
  83. @elseif(@$info->mtask['task_type']==3)
  84. <label class="label label-danger text-center">New Call</label>
  85. @elseif(@$info->mtask['task_type']==4)
  86. <label class="label label-primary text-center">email Sent</label>
  87. @endif
  88. </td>
  89. <td>
  90. <b>Details:</b>{{$info->details or 'NA'}}<br>
  91. <b>Address:</b>{{$info->address or 'NA'}}<br>
  92. <b>Remarks:</b>{{$info->remarks or 'NA'}}<br>
  93. </td>
  94. <td>
  95. <select name="status" data-company='{{ $info->id }}' class='ddl_status' id="status">
  96. <option {{ $info->status==0?'selected':'' }} value="0">Enlisted</option>
  97. <option {{ $info->status==1?'selected':'' }} value="1">Approached</option>
  98. <option {{ $info->status==2?'selected':'' }} value="2">Client</option>
  99. </select>
  100. </td>
  101. <td>
  102. <input type="hidden" id="proj_id" value="{{$info->id}}">
  103. <div class="btn-group">
  104. <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  105. Action <span class="caret"></span>
  106. </button>
  107. <ul class="dropdown-menu">
  108. <li>
  109. <a href='' title='Edit Company' data-toggle="modal" data-target=".edit-company">
  110. <i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit
  111. </a>
  112. </li>
  113. <li>
  114. <a href="{{url("admin/view_company/$info->id")}}" title='View Company' target="_blank">
  115. <i class="fa fa-eye" aria-hidden="true"></i> View
  116. </a>
  117. </li>
  118. <li>
  119. <a href="#" class='lnkAssignService' data-company_id='{{ $info->id }}' data-company_name='{{ $info->name }}' title='Add Service'>
  120. <i class="fa fa-plus-circle" aria-hidden="true"></i> Add Service
  121. </a>
  122. </li>
  123. <li role="separator" class="divider"></li>
  124. <li>
  125. <a onclick="return confirm ('want to delete?')" title='Delete Company' href="{{url("admin/companies/$info->id")}}">
  126. <i class="fa fa-times" aria-hidden="true"></i> Delete
  127. </a>
  128. </li>
  129. </ul>
  130. </div>
  131. </td>
  132. </tr>
  133. @endforeach
  134. @else
  135. <tr>
  136. <td colspan="6" class="text-center">No Data Found !!</td>
  137. </tr>
  138. @endif
  139. </tbody>
  140. </table>
  141. <hr>
  142. </hr>
  143. </div>
  144. <div class="panel-body">
  145. <div class=" add-task-row">
  146. </div>
  147. <div class="table-foot">
  148. {{ $all->appends(['cname'=>$cname])->links() }}
  149. </div>
  150. </div>
  151. </section>
  152. </div>
  153. </div>
  154. </section>
  155. <!-- row end -->
  156. <!-- /.content -->
  157. <!-- Modal Add Company -->
  158. <div class="modal fade add-modal" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  159. <div class="modal-dialog" role="document">
  160. <div class="modal-content">
  161. <div class="modal-header">
  162. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  163. <h4 class="modal-title" id="gridSystemModalLabel">Add Company Info</h4>
  164. </div>
  165. <div class="modal-body">
  166. <form action="{{url('admin/companies')}}" method="POST">
  167. {{ csrf_field() }}
  168. <div class="form-group in-group">
  169. <label for="">Company name<span class="field_mendatory">*</span></label>
  170. <input type="text" name="name" required="" class="form-control" id="" placeholder="Company name" >
  171. </div>
  172. <div class="form-group in-group">
  173. <label for="">Industry<span class="field_mendatory">*</span></label>
  174. <select class="form-control" name="industry" id="industry">
  175. <option value="1">Recreation</option>
  176. <option value="2">Food</option>
  177. <option value="3">Training</option>
  178. <option value="4">Professionals</option>
  179. <option value="5">Instutes</option>
  180. <option value="6">Agriculture</option>
  181. <option value="7">Germents</option>
  182. <option value="8">Health</option>
  183. <option value="9">Apperal</option>
  184. <option value="10">E-Commerce</option>
  185. </select>
  186. </div>
  187. <div class="form-group in-group">
  188. <label for="">Service Required<span class="field_mendatory">*</span></label>
  189. <select class="form-control" name="service_required" id="service_required">
  190. <option value="1">All</option>
  191. <option value="2">Mobile App</option>
  192. <option value="3">Website</option>
  193. <option value="4">Software</option>
  194. </select>
  195. </div>
  196. <div class="form-group in-group">
  197. <label for="">Current Condition<span class="field_mendatory">*</span></label>
  198. <select class="form-control" name="current_condition" id="current_condition">
  199. <option value="1">N\A</option>
  200. <option value="2">Bad</option>
  201. <option value="3">Excellent</option>
  202. </select>
  203. </div>
  204. <div class="form-group in-group">
  205. <label for="">Mobile no #01<span class="field_mendatory">*</span></label>
  206. <input type="text" name="mob1" required="" class="form-control" id="" placeholder="Mobile number" >
  207. </div>
  208. <div class="form-group in-group">
  209. <label for="">Mobile no #02</label>
  210. <input type="text" name="mob2" class="form-control" id="" placeholder="Optional mobile number" >
  211. </div>
  212. <div class="form-group in-group">
  213. <label for="">Email #01<span class="field_mendatory">*</span></label>
  214. <input type="email" name="email1" required="" class="form-control" id="" placeholder="Email address" >
  215. </div>
  216. <div class="form-group in-group">
  217. <label for="">Email #02</label>
  218. <input type="email" name="email2" class="form-control" id="" placeholder="Optional email address" >
  219. </div>
  220. <div class="form-group in-group">
  221. <label for="">Website</label>
  222. <input type="text" name="web" class="form-control" id="" placeholder="Company website" >
  223. </div>
  224. <div class="form-group in-group">
  225. <label for="">Details</label>
  226. <textarea type="text" name="details" class="form-control" id="" placeholder="Details" ></textarea>
  227. </div>
  228. <div class="form-group in-group">
  229. <label for="">Address</label>
  230. <textarea type="text" name="address" class="form-control" id="" placeholder="Company address" ></textarea>
  231. </div>
  232. <div class="form-group in-group">
  233. <label for="">Remarks</label>
  234. <textarea type="text" name="remarks" class="form-control" id="remarks" placeholder="Company remarks" ></textarea>
  235. </div>
  236. <div class="form-group in-group">
  237. <input type="checkbox" checked="checked" name="display" value="1"> Display company info.
  238. </div>
  239. </div>
  240. <div class="modal-footer">
  241. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  242. <button type="submit" class="btn btn-primary">Submit</button>
  243. </div>
  244. </form>
  245. </div><!-- /.modal-content -->
  246. </div><!-- /.modal-dialog -->
  247. </div><!-- /.modal -->
  248. <!-- Modal Edit Company -->
  249. <div class="modal fade edit-company" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  250. <div class="modal-dialog" role="document">
  251. <div class="modal-content">
  252. <div class="modal-header">
  253. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  254. <h4 class="modal-title" id="gridSystemModalLabel">Edit Company Info</h4>
  255. </div>
  256. <div class="modal-body">
  257. <form action="{{url('admin/update_company')}}" method="POST">
  258. {{ csrf_field() }}
  259. <input type="hidden" name="id" value="" id="id">
  260. <div class="form-group in-group">
  261. <label for="">Company name<span class="field_mendatory">*</span></label>
  262. <input type="text" name="name" required="" class="form-control" id="name" placeholder="Company name" >
  263. </div>
  264. <div class="form-group in-group">
  265. <label for="">Industry<span class="field_mendatory">*</span></label>
  266. <select class="form-control" name="industry" id="industry">
  267. <option value="0">Select industry</option>
  268. <option value="1">Recreation</option>
  269. <option value="2">Food</option>
  270. <option value="3">Training</option>
  271. <option value="4">Professionals</option>
  272. <option value="5">Instutes</option>
  273. <option value="6">Agriculture</option>
  274. <option value="7">Germents</option>
  275. <option value="8">Health</option>
  276. <option value="9">Apperal</option>
  277. <option value="10">E-Commerce</option>
  278. </select>
  279. </div>
  280. <div class="form-group in-group">
  281. <label for="">Service Required<span class="field_mendatory">*</span></label>
  282. <select class="form-control" name="service_required" id="service_required">
  283. <option value="1">All</option>
  284. <option value="2">Mobile App</option>
  285. <option value="3">Website</option>
  286. <option value="4">Software</option>
  287. </select>
  288. </div>
  289. <div class="form-group in-group">
  290. <label for="">Current Condition<span class="field_mendatory">*</span></label>
  291. <select class="form-control" name="current_condition" id="current_condition">
  292. <option value="1">N\A</option>
  293. <option value="2">Bad</option>
  294. <option value="3">Excellent</option>
  295. </select>
  296. </div>
  297. <div class="form-group in-group">
  298. <label for="">Mobile no #01<span class="field_mendatory">*</span></label>
  299. <input type="text" name="mob1" required="" class="form-control" id="mob1" placeholder="Mobile number" >
  300. </div>
  301. <div class="form-group in-group">
  302. <label for="">Mobile no #02</label>
  303. <input type="text" name="mob2" class="form-control" id="mob2" placeholder="Optional mobile number" >
  304. </div>
  305. <div class="form-group in-group">
  306. <label for="">Email #01<span class="field_mendatory">*</span></label>
  307. <input type="email" name="email1" required="" class="form-control" id="email1" placeholder="Email address" >
  308. </div>
  309. <div class="form-group in-group">
  310. <label for="">Email #02</label>
  311. <input type="email" name="email2" class="form-control" id="email2" placeholder="Optional email address" >
  312. </div>
  313. <div class="form-group in-group">
  314. <label for="">Website</label>
  315. <input type="text" name="web" class="form-control" id="web" placeholder="Company website" >
  316. </div>
  317. <div class="form-group in-group">
  318. <label for="">Details</label>
  319. <textarea type="text" name="details" class="form-control" id="details" placeholder="Details" ></textarea>
  320. </div>
  321. <div class="form-group in-group">
  322. <label for="">Address</label>
  323. <textarea type="text" name="address" class="form-control" id="address" placeholder="Company address" ></textarea>
  324. </div>
  325. <div class="form-group in-group">
  326. <label for="">Remarks</label>
  327. <textarea type="text" name="remarks" class="form-control" id="remarks" placeholder="Company remarks" ></textarea>
  328. </div>
  329. <div class="form-group in-group">
  330. <input type="checkbox" name="display" id="display" value="1"> Display company info.
  331. </div>
  332. </div>
  333. <div class="modal-footer">
  334. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  335. <button type="submit" class="btn btn-primary">Submit</button>
  336. </div>
  337. </form>
  338. </div><!-- /.modal-content -->
  339. </div><!-- /.modal-dialog -->
  340. </div><!-- /.modal -->
  341. <!-- service modal -->
  342. @include('admin.company_info.service_modal')
  343. <!-- end service modal -->
  344. @endsection
  345. @section('style')
  346. <style>
  347. .table thead tr th{
  348. border: 1px solid #dee2e6 !important;
  349. color: #3e5569;
  350. }
  351. .table tbody tr td{
  352. font-size:12px !important;
  353. font-family:sans-serif;
  354. font-weight: 400;
  355. line-height: 1.5;
  356. }
  357. </style>
  358. @stop
  359. @section('script')
  360. <script type="text/javascript">
  361. $(document).ready(function() {
  362. $( ".date" ).datepicker({
  363. changeMonth: true,
  364. changeYear: true,
  365. dateFormat:"yy-mm-dd"
  366. });
  367. $('.ddl_status').change(function(){
  368. var conf=confirm('Are you sure to change the company status ??');
  369. if(conf)
  370. {
  371. var company_id=$(this).data('company');
  372. var status=$(this).val();
  373. var token='{{ csrf_token() }}';
  374. $.ajax({
  375. url: '{{ url('admin/change_status') }}',
  376. type: 'POST',
  377. data: {id:company_id,status:status,_token:token}
  378. })
  379. .done(function(res) {
  380. alert('status changed successfully !!');
  381. });
  382. }
  383. });
  384. $('.edit-btn').click(function(event) {
  385. var id = $(this).prev('input').val();
  386. $.ajax({
  387. url: "{{url("admin/companies")}}/"+id+"/edit",
  388. type: 'GET',
  389. })
  390. .done(function(data) {
  391. $('#id').val(data['id']);
  392. $('#name').val(data['name']);
  393. var industry = data['industry'];
  394. $("#industry option[value='"+industry+"']").prop('selected', true);
  395. var service_req = data['service_required'];
  396. $("#service_required option[value='"+service_req+"']").prop('selected', true);
  397. var current_con = data['current_condition'];
  398. $("#current_condition option[value='"+current_con+"']").prop('selected', true);
  399. $('#mob1').val(data['mob1']);
  400. $('#mob2').val(data['mob2']);
  401. $('#email1').val(data['email1']);
  402. $('#email2').val(data['email2']);
  403. $('#web').val(data['web']);
  404. $('#details').val(data['details']);
  405. $('#address').val(data['address']);
  406. $('#remarks').val(data['remarks']);
  407. if(data['display']==1){
  408. $('#display').prop('checked', true);
  409. }
  410. else{
  411. $('#display').prop('checked', false);
  412. }
  413. });
  414. });
  415. $('body').on('hidden.bs.modal', '.modal', function () {
  416. $(this).removeData('bs.modal');
  417. });
  418. $('.lnkAssignService').click(function(e){
  419. e.preventDefault();
  420. var com_id=$(this).data('company_id');
  421. var com_name=$(this).data('company_name');
  422. $('span#company_name').text(com_name);
  423. $('input[name="hdn_com_id"]').val(com_id);
  424. $('#modalService').modal('show');
  425. });
  426. $('#btn_assign_service').click(function(){
  427. var com_id=$('input[name="hdn_com_id"]').val();
  428. var service=$('#ddlService').val();
  429. var contact_person=$('#contact_person').val();
  430. var contact_number=$('#contact_number').val();
  431. var deployement_unit=$('#deployement_unit').val();
  432. var po_details=$('#po_details').val();
  433. var renewal_cycle=$('#renewal_cycle').val();
  434. var free_session=$('#free_session').val();
  435. var start_date=$('#start_date').val();
  436. var token='{{ csrf_token() }}';
  437. if(com_id.length==0 || service.length==0){
  438. $('#spn_msg').text('Service name must be selected !');
  439. return false;
  440. }
  441. $.ajax({
  442. url: '{{ url('admin/company/service/assign') }}',
  443. type: 'POST',
  444. dataType: 'json',
  445. data: {com_id:com_id,service:service,contact_person:contact_person,contact_number:contact_number,deployement_unit:deployement_unit,po_details:po_details,renewal_cycle:renewal_cycle,free_session:free_session,start_date:start_date,_token:token}
  446. })
  447. .done(function(res) {
  448. if(res.ok)
  449. {
  450. alert(res.msg);
  451. $('#modalService').modal('hide');
  452. }
  453. });
  454. });
  455. });
  456. </script>
  457. @endsection