/
home
/
sjslayjy
/
public_html
/
assets
/
resources
/
views
/
master
/
Upload File
HOME
@extends('layout.master') @section('title','Gst Slabs') @push('plugin-styles') {!! Html::style('//cdn.datatables.net/1.10.23/css/jquery.dataTables.min.css') !!} {!! Html::style('//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.css') !!} <style type="text/css"> .table th, .table td { white-space: break-spaces !important; } </style> @endpush @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">/Gst Slabs</li> </ul> </div> <div class="page-content"> <div class="row"> <div class="col-12"> <h3 class="header smaller lighter blue">GST Slabs</h3> <div class="clearfix"> <div class="pull-right tableTools-container"> </div> </div> <div class="table-header"> Results for "Latest Registered GST Slabs" <div class="widget-toolbar no-border"> <a class="btn btn-xs bigger btn-warning dropdown-toggle" data-toggle="modal" href='#addGSTModal'> Add <i class="ace-icon fa fa-plus icon-on-right"></i> </a> </div> </div> <div class="card"> <div class="card-body"> <div class="table-responsive"> <table id="module_table" class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Id</th> <th>Rate</th> <th>Value</th> <th>Is Active</th> <th></th> </tr> </thead> <tbody> @foreach($gst_slabs as $gst_slab) <tr> <td>{{ $gst_slab->id }}</td> <td>{{$gst_slab->rate}}</td> <td>{{ $gst_slab->value }}</td> <td>{{ ($gst_slab->is_active == 1)?'Active':'In-Active' }}</td> <td> <div class="hidden-sm hidden-xs btn-group"> <a class="btn btn-xs btn-primary" onclick="getEdit({{$gst_slab->id}})" > <i class="ace-icon fa fa-pencil bigger-120"></i> </a> <button class="btn btn-xs btn-warning" onclick="deleteGstSlab({{$gst_slab->id}})" > <i class="ace-icon fa fa-trash-o bigger-120"></i> </button> </div> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> </div> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <!-- Add Module Modal --> <div class="modal fade" id="addGSTModal"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Add New Gst Slab</h4> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body"> <form action="" role="form" id="addGSTForm"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="rate">Rate</label> <input type="text" class="form-control" name="rate" id="rate" placeholder="rate"> <span class="text text-danger" id="add_rate_error" style="display: none;"></span> </div> </div> <div class="col-md-12"> <div class="form-group"> <label for="value">Value</label> <input type="text" class="form-control" name="value" id="value" placeholder="value"> <span class="text text-danger" id="add_value_error" style="display: none;"></span> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" id="addGSTBtn" class="btn btn-primary">Submit</button> </div> </form> </div> </div> </div> </div> <!-- Add Module Modal --> <!-- Edit Role Modal --> <div class="modal fade" id="editGstSlabModal"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Update Gst Slab</h4> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body" id="EditBody"> </div> </div> </div> </div> @endsection @push('custom-scripts') {!! Html::script('/assets/js/dashboard.js') !!} {!! Html::script('js/app.js') !!} {!! Html::script('//cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js') !!} <script type="text/javascript"> jQuery(function($) { var myTable = $('#gst_table').DataTable( { bAutoWidth: false, "aaSorting": [], }); }) </script> <script> $(document).ready(function(){ $('#addGSTBtn').click(function(e){ e.preventDefault(); $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }); var data = {}; data.rate = $('#rate').val()+'%'; data.value = $('#value').val(); $.ajax({ url: $('#addGSTForm').attr('action'), method: 'POST', data: data, success: function(data){ if(!data.flag && data.status == 1){ showError('add_rate_error',data.errors.rate); showError('add_value_error',data.errors.value); }else{ if(data.flag) { swal({ title: "Success!", text: data.message, type: "success" }).then(function() { window.location.reload(); }); } else { swal({ title: "Error!", text: data.message, type: "error" }); } } } }); }); }); function getEdit(id){ if(id == ""){ swal('Error','Gst Slab id is missing','warning'); }else{ $.ajax({ url: "{{url('/admin/edit-gst-slab/')}}"+"/"+id, type: 'GET', success:function(data){ $('#EditBody').html(data); $('#editGstSlabModal').modal('toggle'); } }); } } function updateGstSlab(){ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }); $.ajax({ url: $('#editGstSlabForm').attr('action'), method: 'POST', data: $('#editGstSlabForm').serialize(), success: function(data){ if(!data.flag){ if(data.status == 1) { showError('add_gst_slab_rate_error',data.errors.gst_slab_rate); showError('add_gst_slab_value_error',data.errors.gst_slab_value); } else { swal({ title: "Error!", text: data.error, type: "error" }).then(function() { window.location.reload(); }); } }else{ swal({ title: "Success!", text: data.msg, type: "success" }).then(function() { window.location.reload(); }); } } }); } function deleteGstSlab(id){ if(id == ""){ swal('Error','Gst Slab id is missing','warning'); }else{ swal({ title: "Are you sure?", text: "You will not be able to recover this Gst Slab!", type: "warning", showCancelButton: true, confirmButtonColor: '#DD6B55', cancelButtonColor: '#DD6B55', confirmButtonText: 'Yes, I am sure!', cancelButtonText: "No, cancel it!", closeOnConfirm: false, closeOnCancel: false }).then(function(isConfirm){ if (isConfirm){ $.ajax({ url: "{{url('/admin/delete-gst-slab/')}}"+"/"+id, type: 'GET', success:function(data){ if(data.flag){ $('#tr_'+id).remove(); swal("Success", "Gst Slab Deleted Successfully", "success"); }else{ swal("Error", data.message, "error"); } } }); } else { swal("Cancelled", "Your Gst Slab is safe :)", "error"); } }); } } function showError(id,error){ if(typeof(error) === "undefined"){ $('#'+id).hide(); }else{ $('#'+id).show(); $('#'+id).text(error); } } </script> @endpush