Viewing file: index.blade.php (6.91 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
@extends('layouts.admin')
@section('title', trans('admin.numbers.number'))
@section('extra-css') <link rel="stylesheet" href="{{asset('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css')}}"> <link rel="stylesheet" href="{{asset('plugins/datatables-responsive/css/responsive.bootstrap4.min.css')}}"> @endsection
@section('content') <!-- Main content --> <section class="content"> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-header"> <h2 class="card-title">@lang('admin.numbers.list') <i data-toggle="tooltip" data-placement="right" class="fa fa-question-circle alert-tooltip" title="Admin can create unlimited number for their customer. Also admin can sell them and can make a number free for his customer."></i> </h2> <div class="float-right"> <a class="btn btn-primary" href="{{route('admin.numbers.create')}}">@lang('admin.form.button.new')</a> <a class="btn btn-info" href="{{route('admin.number.requests')}}">@lang('admin.form.button.request') <span class="diff-counter numberreq_counter_2">0</span> </a> </div> </div> <!-- /.card-header --> <div class="card-body"> <table id="numbers" class="table table-striped table-bordered dt-responsive nowrap"> <thead> <tr> <th>@lang('admin.table.number')</th> <th>@lang('admin.form.platform')</th> <th>@lang('Capabilities')</th> <th>@lang('admin.form.purchase_price')</th> <th>@lang('admin.form.sell_price')</th> <th>@lang('admin.form.status')</th> <th>@lang('admin.table.created_at')</th> <th>@lang('admin.table.action')</th> </tr> </thead>
</table> </div> <!-- /.card-body --> </div> <!-- /.card --> </div> <!-- /.col --> </div>
<div class="modal fade" id="addSubstrack" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-md" role="document"> <div class="modal-content"> <form action="{{route('admin.customer.number.assign')}}" method="post"> @csrf <input type="hidden" name="id"> <input type="hidden" name="old_customer_id" id="oldId"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">{{trans('admin.assign')}}</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="form-group mt-2"> <label for="">{{trans('admin.select_customer')}}</label> <select name="customer_id" class="form-control customer-select" id="customer_id"> @if (isset($customers) && $customers) @foreach ($customers as $customer) <option value="{{$customer->id}}">{{$customer->full_name}} ( {{$customer->email}} )</option> @endforeach @endif </select> </div> <div> <span id="error" class="text-danger"></span> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">{{trans('admin.close')}}</button> <button type="submit" id="assignBtn" class="btn btn-primary" disabled>{{trans('admin.assign')}}</button> </div> </form> </div> </div> </div> <!-- /.row --> </section> <!-- /.content --> @endsection
@section('extra-scripts') <script src="{{asset('plugins/datatables/jquery.dataTables.min.js')}}"></script> <script src="{{asset('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js')}}"></script> <script src="{{asset('plugins/datatables-responsive/js/dataTables.responsive.min.js')}}"></script> <script src="{{asset('plugins/datatables-responsive/js/responsive.bootstrap4.min.js')}}"></script>
<script> "use strict"; $('#numbers').DataTable({ processing: true, serverSide: true, responsive:true, ajax:'{{route('admin.number.get.all')}}', columns: [ { "data": "number" }, { "data": "from" }, { "data": "capabilities" }, { "data": "purch_price" }, { "data": "sell_price" }, { "data": "status" }, { "data": "created_at" }, { "data": "action" }, ] }); </script>
<script> $(document).on('click', '.addSubstract', function (e) { e.preventDefault(); const number_id = $(this).attr('data-number_id'); const customer_id = $(this).attr('data-customer_id'); $('input[name=id]').val(number_id); $('#oldId').val(customer_id); $('#addSubstrack').modal('show'); }); $(document).on('change','#customer_id',function(){ let value = $(this).val(); let customer_id = $('#oldId').val();
let error = '' if (value == customer_id) { error = "This number is already assigned to the selected customer." }else{ error = '' }
if (value && value !== customer_id) { $('#assignBtn').prop('disabled', false); } else { $('#assignBtn').prop('disabled', true); }
$('#error').text(error); }) $(document).ready(function() { $('#customer_id').select2({ placeholder: "Select a customer", allowClear: true, width: '100%', }); }); </script> @endsection
|