indi_company.blade.php 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. @extends('layouts.master')
  2. @section('style')
  3. <link href='{{ asset('assets\dropzone\dropzone.css') }}' type='text/css' rel='stylesheet'>
  4. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/css/bootstrap-datepicker3.css"/>
  5. <link rel="stylesheet" href="{{ URL::asset('assets/css/jquery.datetimepicker.css') }}">
  6. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/pnotify.css">
  7. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/sweetalert.css">
  8. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/sweet-alert-animations.css">
  9. <style>
  10. .dz-message{
  11. text-align: center;
  12. font-size: 28px;
  13. }
  14. .activity-btn:hover{
  15. color: #48C2A9;
  16. border-color: #48C2A9;
  17. }
  18. .remarks-div {
  19. height: 250px;
  20. /*background-color: #eee;*/
  21. overflow-y: auto;
  22. }
  23. .activity-div {
  24. height: 250px;
  25. overflow-y: auto;
  26. }
  27. .panel-service .panel-body{
  28. height:350px;
  29. overflow-y: auto;
  30. }
  31. .bg-grey{background: #ddd;}
  32. .table{font-size: 12px;}
  33. .table-company tr th,.table-company tr td{font-size: 12px;}
  34. .table-company tr th{ width: 25% !important; }
  35. .table-company tr td{ width:auto !important; }
  36. .table-service tr th,.table-service tr td{font-size: 12px;vertical-align: middle !important;}
  37. @media screen and (min-width: 768px){
  38. #modalUpload .modal-content{ top:10%;width: 30%;margin: 0 auto; }
  39. }
  40. .remarks-footer{
  41. padding-top: 8px;
  42. font-size: 11px;
  43. color: #616A75;
  44. }
  45. #modalCompanyEdit .modal-content{width: 50%;margin: 0 auto;}
  46. .panel-default>.panel-heading {
  47. background-color: #ddd !important;
  48. }
  49. </style>
  50. @endsection
  51. @section('content')
  52. <!-- Main content -->
  53. <section class="content">
  54. <!-- Main row -->
  55. <div class="row">
  56. <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
  57. <div class="panel panel-default">
  58. <div class="panel-heading">
  59. Company Info
  60. <a href="{{ route('edit_company',['id'=>$all->id]) }}" data-toggle='modal' data-target='#modalCompanyEdit' class='btn btn-xs btn-primary pull-right'><i style="padding-left: 2px;" class="fa fa-edit"></i></a>
  61. </div>
  62. <table class="table table-company">
  63. <tr>
  64. <th>
  65. Company Name
  66. </th>
  67. <td>
  68. {{$all->name}}
  69. <input type="hidden" value="{{$all->id}}" id="company_id">
  70. </td>
  71. </tr>
  72. <?php
  73. $ary_industry = [
  74. 1=>"Recreation",2=>"Food",3=>"Training",
  75. 4=>"Professionals",5=>"Industry",6=>"Agriculture",7=>"Germents",8=>"Health",9=>"Apperal",10=>"E-Commerce"
  76. ];
  77. ?>
  78. <tr>
  79. <th>Industry</th>
  80. <td>
  81. @foreach($ary_industry as $key=>$indus)
  82. @if($key == $all->industry)
  83. {{$indus}}
  84. @endif
  85. @endforeach
  86. </td>
  87. </tr>
  88. <tr>
  89. <th>Mobile</th>
  90. <td>{{$all->mob1}}, {{$all->mob2}}</td>
  91. </tr>
  92. <tr>
  93. <th>Email</th>
  94. <td>{{$all->email1}}, {{$all->email2}}</td>
  95. <input type="hidden" class="hdn-email1" value="{{$all->email1}}">
  96. <input type="hidden" class="hdn-email2" value="{{$all->email2}}">
  97. </tr>
  98. <tr>
  99. <th>Website</th>
  100. <td>{{$all->web}}</td>
  101. </tr>
  102. <tr>
  103. <th>Address</th>
  104. <td>{{$all->address}}</td>
  105. </tr>
  106. <tr>
  107. <th>Remarks</th>
  108. <td>{{$all->remarks}}</td>
  109. </tr>
  110. </table>
  111. </div>
  112. <div class="panel panel-default">
  113. <!-- Default panel contents -->
  114. <div class="panel-heading">Address Book <button class="btn btn-success btn-xs pull-right" data-toggle="modal" data-target=".add-modal">Add Contract Person</button></div>
  115. <table class="table table-bordered">
  116. <tr>
  117. <th width="20%">Name</th>
  118. <th width="20%">Designation</th>
  119. <th width="20%">Mobile</th>
  120. <th width="20%">Email</th>
  121. <th width="20%">Action</th>
  122. </tr>
  123. @foreach($all->contact_persons as $cp)
  124. <tr>
  125. <td>
  126. {{$cp->name}}
  127. </td>
  128. <td>
  129. {{$cp->designation}}
  130. </td>
  131. <td>
  132. {{$cp->mob1}}<br>{{$cp->mob2}}
  133. </td>
  134. <td>
  135. {{$cp->email1}}<br>{{$cp->email2}}
  136. </td>
  137. <td>
  138. @if($cp->system_user==0)
  139. <?php
  140. $add1=$all->address?$all->address:'N/A';
  141. $web1=$all->web?$all->web:'N/A';
  142. ?>
  143. {{-- <span class="btn btn-sm btn-primary sub_btn" data-name="{{$cp->name}}" data-cp_id="{{$cp->id}}" data-phone="{{$cp->mob1}}" data-email="{{$cp->email1}}" data-address="{{$add1}}" data-web="{{$web1}}" data-company="{{$cp->company_id}}" data-designation="{{$cp->designation}}">Add As User</span> --}}
  144. <a href="{{url('admin/company/add_user/'.$cp->id)}}" class="btn btn-sm btn-primary sub_btn">Add As User</a>
  145. @else
  146. {{ "N/A" }}
  147. @endif
  148. </td>
  149. </tr>
  150. @endforeach
  151. </table>
  152. </div>
  153. <div class="panel panel-default">
  154. <!-- Default panel contents -->
  155. <div class="panel-heading">Account Manager</div>
  156. @if($manager)
  157. <table class="table table-bordered" id="table_div">
  158. <tr>
  159. <th>Name</th>
  160. <th>Designation</th>
  161. <th>Mobile</th>
  162. <th>Email</th>
  163. <th>Action</th>
  164. </tr>
  165. <tr>
  166. <td>
  167. {{$manager->name}}
  168. </td>
  169. <td>
  170. {{$manager->designation}}
  171. </td>
  172. <td>
  173. {{$manager->mob}}
  174. </td>
  175. <td>
  176. {{$manager->email}}
  177. </td>
  178. <td>
  179. <span class="btn btn-success btn-xs pull-right" id="change_manager">Change Manager</span>
  180. </td>
  181. </tr>
  182. </table>
  183. @endif
  184. <div class="row" @if($manager) style="display: none;" @endif id="select_div">
  185. <div class="col-md-8">
  186. <div class="form-group" style="margin-top: 15px;">
  187. <select class="form-control" name="manager" placeholder="manager" id="manager">
  188. <option>Select Account Manager</option>
  189. @foreach($managers_all as $m_all)
  190. <option value="{{ $m_all->id }}">{{ $m_all->name }}</option>
  191. @endforeach
  192. </select>
  193. </div>
  194. </div>
  195. <div class="col-md-4">
  196. <span class="btn btn-success btn-block pull-right" style="margin-top: 15px;" id="add_manager">Add Manager</span>
  197. </div>
  198. </div>
  199. </div>
  200. <div class="panel panel-default">
  201. <div class="panel-heading">Remarks</div>
  202. <div class="panel-body">
  203. <textarea class="form-control" name="" id="remarkss" placeholder="Write down remarks"></textarea>
  204. <button class="btn btn-success btn-xs remarks-btn" style="margin-top:10px;margin-bottom: 20px;"><i class="fa fa-comment-o"></i> Remark</button>
  205. <div class="remarks-div"></div>
  206. </div>
  207. </div>
  208. <div class="panel panel-default">
  209. <div class="panel-heading">Invoice <a href="{{url('invoice/new')}}" class="btn btn-success btn-xs pull-right">New Invoice</a></div>
  210. <div class="panel-body">
  211. @if(!empty($invoice))
  212. <table class="table table-bordered" id="table_div">
  213. <tr>
  214. <th>Company Name</th>
  215. <th>Service</th>
  216. <th>Date</th>
  217. <th>Amount</th>
  218. <th>Status</th>
  219. </tr>
  220. @foreach($invoice as $row)
  221. <tr>
  222. <td>{{$row->company->name}}</td>
  223. <td>
  224. @foreach($row->items as $item)
  225. {{ $item->service?$item->service->name:'' }} <br>
  226. @endforeach
  227. </td>
  228. <td>{{ date('d-m-Y',strtotime($row->invoice_date)) }}</td>
  229. <td>
  230. <?php
  231. $total=$row->items?$row->items->sum('payable_amount'):0;;
  232. $total1=$row->items?$row->items->sum('payable_amount'):0;
  233. $total2=$row->items?$row->items->sum('payable_amount'):0;
  234. $total_vat=($total1*$row->vat)/100;
  235. $total_tax=($total2*$row->tax)/100;
  236. $payable=$total+$total_vat+$total_tax;;
  237. $paid=$row->items?$row->items->sum('paid_amount'):0;
  238. $due=$payable-$paid;
  239. ?>
  240. {{ $payable }}
  241. </td>
  242. <td>
  243. @if($row->status==0)
  244. <span class='label label-danger'>Due</span>
  245. @elseif($row->status==1)
  246. <span class='label label-success'>Paid</span>
  247. @endif
  248. </td>
  249. </tr>
  250. @endforeach
  251. </table>
  252. @else
  253. <p class="text-center"> Invoice Not Found! </p>
  254. @endif
  255. </div>
  256. </div>
  257. </div>
  258. <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
  259. <div class="panel panel-default panel-service">
  260. <!-- Default panel contents -->
  261. <div class="panel-heading">
  262. Sevices Of {{$all->name}}
  263. <a href="#" id="lnkAssignService" data-company_id='{{ $all->id }}' data-company_name='{{ $all->name }}' class='btn btn-info btn-xs pull-right'>
  264. <i class="fa fa-plus"></i> Add New Service
  265. </a>
  266. </div>
  267. <!-- Table -->
  268. <div class="panel-body">
  269. <table class="table table-bordered table-service">
  270. <thead>
  271. <tr>
  272. <th>Name Of Service</th>
  273. <th>Deployment Unit</th>
  274. <th>Start Date</th>
  275. <th style='width:30% !important'>Contact Info</th>
  276. <th>Upload</th>
  277. </tr>
  278. </thead>
  279. <tbody>
  280. @if($company_services)
  281. @foreach($company_services as $service)
  282. <tr>
  283. <td><a target="_blank" href="{{ url('admin/company/service/details') }}/{{ $service->id }}">{{ $service->services?$service->services->name:'--' }}</a></td>
  284. <td>{{ $service->deployment_unit_details }}</td>
  285. <td>{{ date('d M, Y',strtotime($service->start_date)) }}</td>
  286. <td>
  287. <strong>Name : </strong> {{ $service->contact_person }} <br>
  288. <strong>Phone : </strong> {{ $service->contact_number }}
  289. </td>
  290. <td align="center">
  291. <a class='btn btn-info btn-xs' data-toggle='modal' data-target='#modalUpload' href="{{ url('admin/company/service/upload') }}/{{ $service->id }}">
  292. <i class="fa fa-cloud-upload"></i>
  293. </a>
  294. </td>
  295. </tr>
  296. @endforeach
  297. @else
  298. <tr>
  299. <td colspan="4">No Service Found !!</td>
  300. </tr>
  301. @endif
  302. </tbody>
  303. </table>
  304. </div>
  305. </div>
  306. <div class="panel panel-default">
  307. <div class="panel-heading">
  308. <h3 class="panel-title">Add Task</h3>
  309. </div>
  310. <div class="panel-body">
  311. <div class="nav-tabs-custom">
  312. <ul class="nav nav-tabs">
  313. <li class="active">
  314. <a href="#new_task" data-toggle="tab">
  315. <i class="fa fa-list" style="margin-right: 5px;"></i>
  316. New Task
  317. </a>
  318. </li>
  319. <li>
  320. <a href="#appointment" data-toggle="tab">
  321. <i class="fa fa-calendar" style="margin-right: 5px;"></i>
  322. Appointment
  323. </a>
  324. </li>
  325. <li>
  326. <a href="#phone" data-toggle="tab">
  327. <i class="fa fa-phone" style="margin-right: 5px;"></i>
  328. Phone
  329. </a>
  330. </li>
  331. <li>
  332. <a href="#email" data-toggle="tab">
  333. <i class="fa fa-envelope" style="margin-right: 5px;"></i>
  334. Email
  335. </a>
  336. </li>
  337. </ul>
  338. <div class="tab-content">
  339. <div class="active tab-pane" id="new_task">
  340. <form role="form" action="{{url('admin/company_task/manager_task')}}" method="POST">
  341. {!! csrf_field() !!}
  342. <input type="hidden" name="company_id" value="{{$all->id}}">
  343. <div class="form-group">
  344. <label>
  345. Title
  346. </label>
  347. <input name="name" class="form-control" placeholder="Title" required="">
  348. </input>
  349. </div>
  350. <div class="form-group">
  351. <label>
  352. Description
  353. </label>
  354. <textarea name="description" class="form-control" id="task_editor" placeholder="Description" rows="5"></textarea>
  355. </div>
  356. <div class="form-group">
  357. <label>
  358. Priority
  359. </label>
  360. <select name="priority" class="form-control">
  361. <option value="1">Low</option>
  362. <option value="2">Mid</option>
  363. <option value="3">High</option>
  364. </select>
  365. </div>
  366. <div class="form-group">
  367. <label>
  368. Dead Line
  369. </label>
  370. <input name="date" type="text" class="form-control date" placeholder="Select Date and Time" required="">
  371. </input>
  372. </div>
  373. <button type="submit" class="btn btn-primary">Add</button>
  374. </form>
  375. </div>
  376. <div class="tab-pane" id="appointment">
  377. <form role="form" action="{{url('admin/company_task/manager_appointment')}}" method="POST">
  378. {!! csrf_field() !!}
  379. <input type="hidden" name="company_id" value="{{$all->id}}">
  380. <div class="form-group">
  381. <label>
  382. Title
  383. </label>
  384. <input name="name" class="form-control" placeholder="Title" required="">
  385. </input>
  386. </div>
  387. <div class="form-group">
  388. <label>
  389. Description
  390. </label>
  391. <textarea name="description" class="form-control" id="task_editor" placeholder="Description" rows="5"></textarea>
  392. </div>
  393. <div class="form-group">
  394. <label>
  395. Priority
  396. </label>
  397. <select name="priority" class="form-control">
  398. <option value="1">Low</option>
  399. <option value="2">Mid</option>
  400. <option value="3">High</option>
  401. </select>
  402. </div>
  403. <div class="form-group">
  404. <label>
  405. Appointment Date
  406. </label>
  407. <input name="date" type="text" class="form-control date" placeholder="Select Date and Time" required="">
  408. </input>
  409. </div>
  410. <button type="submit" class="btn btn-primary">Add</button>
  411. </form>
  412. </div>
  413. <div class="tab-pane" id="phone">
  414. <form role="form" action="{{url('admin/company_task/manager_phone')}}" method="POST">
  415. {!! csrf_field() !!}
  416. <input type="hidden" name="company_id" value="{{$all->id}}">
  417. <div class="form-group">
  418. <label>
  419. Title
  420. </label>
  421. <input name="name" class="form-control" placeholder="Title" required="">
  422. </input>
  423. </div>
  424. <div class="form-group">
  425. <label>
  426. Description
  427. </label>
  428. <textarea name="description" class="form-control" id="task_editor" placeholder="Description" rows="5"></textarea>
  429. </div>
  430. <div class="form-group">
  431. <label>
  432. Priority
  433. </label>
  434. <select name="priority" class="form-control">
  435. <option value="1">Low</option>
  436. <option value="2">Mid</option>
  437. <option value="3">High</option>
  438. </select>
  439. </div>
  440. <div class="form-group">
  441. <label>
  442. Call Date
  443. </label>
  444. <input name="date" type="text" class="form-control date" placeholder="Select Date and Time" required="">
  445. </input>
  446. </div>
  447. <button type="submit" class="btn btn-primary">Add</button>
  448. </form>
  449. </div>
  450. <div class="tab-pane" id="email">
  451. <form role="form" action="{{url('admin/company_task/send_email')}}" method="POST">
  452. {!! csrf_field() !!}
  453. <input type="hidden" name="company_id" value="{{$all->id}}">
  454. <div class="form-group">
  455. <label>
  456. To
  457. </label>
  458. <select name="mail_to" class="form-control">
  459. @if(count($all->contact_persons))
  460. <option disabled="" selected="">Select One..</option>
  461. @foreach($cilents as $clnt)
  462. <option value="{{ $clnt->id }}">{{ $clnt->name }}</option>
  463. @endforeach
  464. @else
  465. <option disabled="" selected="">No Contact Person Added Yet.</option>
  466. @endif
  467. </select>
  468. </div>
  469. <div class="form-group">
  470. <label>
  471. Subject
  472. </label>
  473. <input name="subject" class="form-control" placeholder="Subject" required="">
  474. </input>
  475. </div>
  476. <div class="form-group">
  477. <label>
  478. Message
  479. </label>
  480. <textarea name="message" class="form-control" id="task_editor" placeholder="Message" rows="5"></textarea>
  481. </div>
  482. <button type="submit" class="btn btn-primary">Send</button>
  483. </form>
  484. </div>
  485. </div>
  486. <!-- /.tab-content -->
  487. </div>
  488. </div>
  489. </div>
  490. <div class="panel panel-default">
  491. <div class="panel-heading">
  492. <h3 class="panel-title">Activity</h3>
  493. </div>
  494. <div class="panel-body">
  495. <div style="min-height: 250px;" class="activity-div"></div>
  496. </div>
  497. <div class="panel-footer">
  498. <button class="btn btn-xs activity-btn" data-fullText="Already called.">
  499. Mobile
  500. <i class="fa fa-mobile" aria-hidden="true"></i>
  501. </button>
  502. <button class="btn btn-xs activity-btn" data-toggle="modal" data-target=".modal-email" data-fullText="mail">
  503. Email
  504. <i class="fa fa-envelope-o" aria-hidden="true"></i>
  505. </button>
  506. <button class="btn btn-xs activity-btn" data-fullText="Already send a sms.">
  507. SMS
  508. <i class="fa fa-comments-o" aria-hidden="true"></i>
  509. </button>
  510. </div>
  511. </div>
  512. </div>
  513. </div>
  514. </section>
  515. <!-- Modal to add services -->
  516. @include('admin.company_info.service_modal')
  517. <!-- end modal to add services -->
  518. <!-- Modal Add Contract person -->
  519. @include('admin.company_info.add_contact_info')
  520. <!-- /.modal -->
  521. <!-- Modal Email -->
  522. @include('admin.company_info.modal_email')
  523. <!-- /.modal -->
  524. <!-- Modal File Upload -->
  525. <div class="modal fade" id="modalUpload">
  526. <div class="modal-dialog modal-md">
  527. </div>
  528. </div>
  529. <!-- /.modal -->
  530. <!--Edit Company Modal File Upload -->
  531. <div class="modal fade" id="modalCompanyEdit">
  532. <div class="modal-dialog modal-md">
  533. </div>
  534. </div>
  535. <!-- /.modal -->
  536. @endsection
  537. @section('script')
  538. <script src="{{URL::asset('assets/ckeditor/ckeditor.js')}}"></script>
  539. <script type="text/javascript" src="{{ URL::asset('assets/js/jquery.datetimepicker.full.min.js') }}"></script>
  540. <script src="{{URL::asset('assets/front_end/js/plugins/timepicker/bootstrap-timepicker.js')}}"></script>
  541. <script src="{{ asset('/assets/') }}/alert/sweetalert.min.js"></script>
  542. <script src="{{ asset('/assets/') }}/alert/pnotify.js"></script>
  543. <script src="{{ asset('/assets/') }}/alert/notify.js"></script>
  544. <script type="text/javascript">
  545. $(document).ready(function(){
  546. $( ".date" ).datetimepicker({
  547. dateFormat: 'dd/mm/yy',
  548. timeFormat: 'HH:mm',
  549. });
  550. /*$('.date').timepicker({
  551. timeFormat: 'H:i',
  552. template: false,
  553. //showInputs: true,
  554. });*/
  555. CKEDITOR.replace( 'task_editor' );
  556. /*$( ".date" ).datepicker({
  557. changeMonth: true,
  558. changeYear: true,
  559. dateFormat:"dd-mm-yy",
  560. timeFormat: 'hh:mm'
  561. });*/
  562. $('body').on('click','.sub_btn',function(){
  563. var user_name=$(this).data('name');
  564. var phone=$(this).data('phone');
  565. var email=$(this).data('email');
  566. var address=$(this).data('address');
  567. var web=$(this).data('web');
  568. var company=$(this).data('company');
  569. var designation=$(this).data('designation');
  570. var cp_id=$(this).data('cp_id')
  571. $.ajax({
  572. url: "{{url('admin/company/add_user')}}",
  573. type: 'POST',
  574. data: {user_name: user_name, mob: phone, email: email, address: address, website: web, company: company, designation:designation, cp_id:cp_id},
  575. })
  576. console.log(data)
  577. .done(function(data) {
  578. alert(data);
  579. location.reload();
  580. });
  581. });
  582. $('body').on('click','#add_manager',function(){
  583. var user_id = $( "#manager option:selected" ).val();;
  584. var company = $('#company_id').val();
  585. $.ajax({
  586. url: "{{url('admin/company/add_manager')}}",
  587. type: 'POST',
  588. data: {user_id: user_id,company: company},
  589. })
  590. .done(function(data) {
  591. alert(data);
  592. location.reload();
  593. });
  594. });
  595. $('body').on('click','#change_manager',function(){
  596. $('#table_div').hide('fast');
  597. $('#select_div').show('slow');
  598. });
  599. $('body').on('hidden.bs.modal', '.modal', function () {
  600. $(this).removeData('bs.modal');
  601. });
  602. $('#lnkAssignService').click(function(e){
  603. e.preventDefault();
  604. var com_id=$(this).data('company_id');
  605. var com_name=$(this).data('company_name');
  606. $('span#company_name').text(com_name);
  607. $('input[name="hdn_com_id"]').val(com_id);
  608. $('#modalService').modal('show');
  609. });
  610. $('#btn_assign_service').click(function(){
  611. var com_id=$('input[name="hdn_com_id"]').val();
  612. var service=$('#ddlService').val();
  613. var contact_person=$('#contact_person').val();
  614. var contact_number=$('#contact_number').val();
  615. var deployement_unit=$('#deployement_unit').val();
  616. var po_details=$('#po_details').val();
  617. var renewal_cycle=$('#renewal_cycle').val();
  618. var free_session=$('#free_session').val();
  619. var start_date=$('#start_date').val();
  620. var token='{{ csrf_token() }}';
  621. if(com_id.length==0 || service.length==0){
  622. $('#spn_msg').text('Service name must be selected !');
  623. return false;
  624. }
  625. $.ajax({
  626. url: '{{ url('admin/company/service/assign') }}',
  627. type: 'POST',
  628. dataType: 'json',
  629. 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}
  630. })
  631. .done(function(res) {
  632. if(res.ok)
  633. {
  634. alert(res.msg);
  635. $('#modalService').modal('hide');
  636. }
  637. });
  638. });
  639. var company_id = $('#company_id').val();
  640. //fetch remarks
  641. $.ajax({
  642. url: "{{url('admin/save_remarks')}}",
  643. type: 'POST',
  644. data: {remarks: '0', company_id: company_id},
  645. })
  646. .done(function(data) {
  647. $('.remarks-div').html(data);
  648. });
  649. //fetch activity
  650. $.ajax({
  651. url: "{{url('admin/save_activity')}}",
  652. type: 'POST',
  653. data: {val: '0', company_id: company_id},
  654. })
  655. .done(function(data) {
  656. $('.activity-div').html(data);
  657. });
  658. //ck editor
  659. CKEDITOR.replace( 'editor1' );
  660. CKEDITOR.replace( 'comment_txt' );
  661. });
  662. $('.activity-btn').click(function(event) {
  663. var email1 = $('.hdn-email1').val();
  664. var email2 = $('.hdn-email2').val();
  665. $('.to-email').val(email1+', '+email2);
  666. var val = $(this).attr("data-fullText");
  667. if(val != 'mail'){
  668. if(confirm('Want to add in activity list ?')){
  669. var company_id = $('#company_id').val();
  670. $.ajax({
  671. url: "{{url('admin/save_activity')}}",
  672. type: 'POST',
  673. data: {val: val, company_id: company_id},
  674. })
  675. .done(function(data) {
  676. $('.activity-div').html(data);
  677. });
  678. }
  679. }
  680. });
  681. $('.email-send').click(function(event){
  682. var val = "An email sent.";
  683. var company_id = $('#company_id').val();
  684. var email1 = $('.hdn-email1').val();
  685. var email2 = $('.hdn-email2').val();
  686. var email_subj = $('.email_subj').val();
  687. var attachment_id = $('.attachment_id').val();
  688. var email_body = CKEDITOR.instances.editor1.getData();
  689. if(email1.length > 0){
  690. $.ajax({
  691. url: "{{url('admin/send_email_to_company')}}",
  692. type: 'POST',
  693. data: {email1: email1,email2: email2, subj: email_subj, email_body:email_body,attachment_id: attachment_id},
  694. })
  695. .done(function(data){
  696. if(data == 'success'){
  697. $.ajax({
  698. url: "{{url('admin/save_activity')}}",
  699. type: 'POST',
  700. data: {val: val, company_id: company_id},
  701. })
  702. .done(function(data) {
  703. $('.activity-div').html(data);
  704. });
  705. alert('Email Send successfully!!');
  706. }
  707. else{
  708. alert('Sorry! email not send ...');
  709. }
  710. });
  711. }
  712. else{
  713. alert('Email 01 filed is mendatory. Email address not available!');
  714. }
  715. });
  716. $( ".activity-div" ).on( "click",".remove-activity",function() {
  717. var id = $(this).attr("data-id");
  718. var company_id = $('#company_id').val();
  719. if(confirm('Want to delete?'))
  720. {
  721. $.ajax({
  722. url: "{{url('admin/remove_activity')}}",
  723. type: 'POST',
  724. data: {id: id,company_id: company_id},
  725. })
  726. .done(function(data) {
  727. $('.activity-div').html(data);
  728. alert('Data removed successfully!');
  729. });
  730. }
  731. });
  732. $('.remarks-btn').click(function(event) {
  733. var remarks = $('#remarkss').val();
  734. var company_id = $('#company_id').val();
  735. if(remarks.length > 0){
  736. $.ajax({
  737. url: "{{url('admin/save_remarks')}}",
  738. type: 'POST',
  739. data: {remarks: remarks, company_id: company_id},
  740. })
  741. .done(function(data) {
  742. $('.remarks-div').html(data);
  743. $('#remarkss').val('');
  744. });
  745. }
  746. else{
  747. alert('Please fill up remarks field');
  748. }
  749. });
  750. $( ".remarks-div" ).on( "click",".remove-remarks",function() {
  751. var id = $(this).attr("data-id");
  752. var company_id = $('#company_id').val();
  753. if(confirm('Want to delete?'))
  754. {
  755. $.ajax({
  756. url: "{{url('admin/remove_remarks')}}",
  757. type: 'POST',
  758. data: {id: id,company_id: company_id},
  759. })
  760. .done(function(data) {
  761. $('.remarks-div').html(data);
  762. alert('Data removed successfully!');
  763. });
  764. }
  765. });
  766. </script>
  767. @endsection
  768. @if(Session::has('msg'))
  769. <div class="alert alert-success center-block msg_alt" >
  770. <a class="close" data-dismiss="alert" href="#">&times;</a>
  771. <strong><i class="fa fa-check"></i></strong>&nbsp;
  772. {{Session::get('msg')}}
  773. </div>
  774. @endif