/
home
/
sjslayjy
/
public_html
/
devlok
/
resources
/
views
/
dashboard
/
master
/
Upload File
HOME
@extends('dashboard.layouts.app') @section('title','Invoice Types') @section('content') <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs ace-save-state" id="breadcrumbs"> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a href="#">Home</a> </li> <li class="active">Invoice Types</li> </ul> </div> <div class="page-content"> <div class="row"> <div class="col-xs-12"> <h3 class="header smaller lighter blue">Invoice Types</h3> <div class="clearfix"> <div class="pull-right tableTools-container"> </div> </div> <div class="table-header"> Results for "Latest Registered Invoice Types" <div class="widget-toolbar no-border"> <a class="btn btn-xs bigger btn-danger dropdown-toggle" data-toggle="modal" href='#addInvoiceTypeModal'> Add <i class="ace-icon fa fa-plus icon-on-right"></i> </a> </div> </div> <div class="table-responsive"> <div class="dataTables_borderWrap"> <table id="dynamic-table" class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Invoice Type</th> <th>Action</th> </tr> </thead> <tbody> @foreach($invoice_types as $invoice_type) <tr id="tr_{{$invoice_type->id}}"> <td>{{$invoice_type->invoice_type}}</td> <td> <div class="btn-group"> <a class="btn btn-xs btn-info" onclick="getEdit({{$invoice_type->id}})" > <i class="ace-icon fa fa-pencil bigger-120"></i> </a> <button class="btn btn-xs btn-danger" onclick="deleteInvoiceType({{$invoice_type->id}})" > <i class="ace-icon fa fa-trash-o bigger-120"></i> </button> </div> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <!-- Add invoice_type Modal --> <div class="modal fade" id="addInvoiceTypeModal"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Add New Invoice Type</h4> </div> <div class="modal-body"> <form action="" role="form" id="addInvoiceTypeForm"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="name">Invoice Type</label> <input type="text" class="form-control" name="invoice_type" id="invoice_type" placeholder="Invoice Type"> <span class="label label-danger" id="add_invoice_type_error" style="display: none;"></span> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" id="addInvoiceTypeBtn" class="btn btn-primary">Submit</button> </div> </form> </div> </div> </div> <!-- Add invoice_type Modal --> <!-- Edit invoice_type Modal --> <div class="modal fade" id="editInvoiceTypeModal"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Update Role</h4> </div> <div class="modal-body" id="EditBody"> </div> </div> </div> </div> <!-- Edit invoice_type Modal --> @section('script') {{ Html::script("assets/js/jquery.dataTables.min.js")}} {{ Html::script("assets/js/jquery.dataTables.bootstrap.min.js")}} {{ Html::script("assets/js/dataTables.buttons.min.js")}} {{ Html::script("assets/js/buttons.flash.min.js")}} {{ Html::script("assets/js/buttons.html5.min.js")}} {{ Html::script("assets/js/buttons.print.min.js")}} {{ Html::script("assets/js/buttons.colVis.min.js")}} {{ Html::script("assets/js/dataTables.select.min.js")}} {{ Html::script("assets/js/ace-elements.min.js")}} {{ Html::script("assets/js/ace.min.js")}} <script type="text/javascript"> jQuery(function($) { //initiate dataTables plugin var myTable = $('#dynamic-table').DataTable( { bAutoWidth: false, "aaSorting": [], } ); $.fn.dataTable.Buttons.defaults.dom.container.className = 'dt-buttons btn-overlap btn-group btn-overlap'; new $.fn.dataTable.Buttons( myTable, { buttons: [ { "extend": "colvis", "text": "<i class='fa fa-search bigger-110 blue'></i> <span class='hidden'>Show/hide columns</span>", "className": "btn btn-white btn-primary btn-bold", columns: ':not(:first):not(:last)' }, { "extend": "copy", "text": "<i class='fa fa-copy bigger-110 pink'></i> <span class='hidden'>Copy to clipboard</span>", "className": "btn btn-white btn-primary btn-bold" }, { "extend": "csv", "text": "<i class='fa fa-database bigger-110 orange'></i> <span class='hidden'>Export to CSV</span>", "className": "btn btn-white btn-primary btn-bold" }, { "extend": "excel", "text": "<i class='fa fa-file-excel-o bigger-110 green'></i> <span class='hidden'>Export to Excel</span>", "className": "btn btn-white btn-primary btn-bold" }, { "extend": "pdf", "text": "<i class='fa fa-file-pdf-o bigger-110 red'></i> <span class='hidden'>Export to PDF</span>", "className": "btn btn-white btn-primary btn-bold" }, { "extend": "print", "text": "<i class='fa fa-print bigger-110 grey'></i> <span class='hidden'>Print</span>", "className": "btn btn-white btn-primary btn-bold", autoPrint: false, message: 'This print was produced using the Print button for DataTables' } ] } ); myTable.buttons().container().appendTo( $('.tableTools-container') ); //style the message box var defaultCopyAction = myTable.button(1).action(); myTable.button(1).action(function (e, dt, button, config) { defaultCopyAction(e, dt, button, config); $('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white'); }); var defaultColvisAction = myTable.button(0).action(); myTable.button(0).action(function (e, dt, button, config) { defaultColvisAction(e, dt, button, config); if($('.dt-button-collection > .dropdown-menu').length == 0) { $('.dt-button-collection') .wrapInner('<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />') .find('a').attr('href', '#').wrap("<li />") } $('.dt-button-collection').appendTo('.tableTools-container .dt-buttons') }); }) </script> <script> $(document).ready(function(){ $('#addInvoiceTypeBtn').click(function(e){ e.preventDefault(); $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }); $.ajax({ url: $('#addInvoiceTypeForm').attr('action'), method: 'POST', data: $('#addInvoiceTypeForm').serialize(), success: function(data){ if(!data.flag){ showError('add_invoice_type_error',data.errors.invoice_type); }else{ swal({ title: "Success!", text: data.message, type: "success" }, function() { window.location.reload(); }); } } }); }); }); function getEdit(id){ if(id == ""){ swal('Error','Invoice Type id is missing','warning'); }else{ $.ajax({ url: "{{url('/user/edit-invoice-type/')}}"+"/"+id, type: 'GET', success:function(data){ $('#EditBody').html(data); $('#editInvoiceTypeModal').modal('toggle'); } }); } } function updateInvoiceType(){ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }); $.ajax({ url: $('#editInvoiceTypeForm').attr('action'), method: 'POST', data: $('#editInvoiceTypeForm').serialize(), success: function(data){ console.log(data); if(!data.flag){ showError('edit_invoice_type_error',data.errors.invoice_type); }else{ swal({ title: "Success!", text: data.message, type: "success" }, function() { window.location.reload(); }); } } }); } function deleteInvoiceType(id){ if(id == ""){ swal('Error','Invoice Type id is missing','warning'); }else{ swal({ title: "Are you sure?", text: "You will not be able to recover this Invoice Type!", type: "warning", showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: 'Yes, I am sure!', cancelButtonText: "No, cancel it!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm){ $.ajax({ url: "{{url('/user/delete-invoice-type/')}}"+"/"+id, type: 'GET', success:function(data){ if(data.flag){ $('#tr_'+id).remove(); swal("Success", "Invoice Type Deleted Successfully", "success"); }else{ swal("Error", data.message, "error"); } } }); } else { swal("Cancelled", "Your Invoice Type is safe :)", "error"); } }); } } function showError(id,error){ if(typeof(error) === "undefined"){ $('#'+id).hide(); }else{ $('#'+id).show(); $('#'+id).text(error); } } </script> @endsection @endsection