Viewing file: plan_table.blade.php (18.85 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
@extends('layouts.dashboard')
@section('title',trans('layout.plan_title'))
@section('css')
@endsection
@section('main-content') <div class="row page-titles mx-0"> <div class="col-sm-6 p-md-0"> <div class="welcome-text"> <h4>{{trans('layout.plan')}}</h4> <p class="mb-0"></p> </div> </div> <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="#">{{trans('layout.home')}}</a></li> <li class="breadcrumb-item active"><a href="javascript:void(0)">{{trans('layout.plan')}}</a></li> </ol> </div> </div> <!-- row -->
<div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-header"> <h4 class="card-title">{{trans('layout.list')}}</h4> <div class="pull-right"> <button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#planCreateModal"> {{trans('layout.create')}} </button> </div> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-responsive-md"> <thead class="text-center"> <tr> <th><strong>{{trans('layout.title')}}</strong></th> <th><strong>{{trans('layout.cost')}}</strong></th> <th><strong>{{trans('layout.recurring_type')}}</strong></th> <th><strong>{{trans('layout.pos_system')}}</strong></th> <th><strong>{{trans('layout.table_limit')}}</strong></th> <th><strong>{{trans('layout.restaurant_limit')}}</strong></th> <th><strong>{{trans('layout.item_limit')}}</strong></th> <th><strong>{{trans('layout.status')}}</strong></th> <th><strong>{{trans('layout.action')}}</strong></th> </tr> </thead> <tbody class="text-center"> @if($plans) @foreach($plans as $plan) <tr> <td>{{$plan->title}}</td> <td>{{formatNumberWithCurrSymbol($plan->cost)}}</td> @if($plan->recurring_type == 'onetime') <td>{{trans('layout.onetime')}}</td> @elseif($plan->recurring_type == 'monthly') <td>{{trans('layout.monthly')}}</td> @elseif($plan->recurring_type == 'weekly') <td>{{trans('layout.weekly')}}</td> @elseif($plan->recurring_type == 'yearly') <td>{{trans('layout.yearly')}}</td> @endif
<td>{{ucfirst(isset($plan->pos_system)?$plan->pos_system:'')}}</td> <td>{{$plan->table_unlimited=='yes'?trans('layout.unlimited'):$plan->table_limit}}</td> <td>{{$plan->restaurant_unlimited=='yes'?trans('layout.unlimited'):$plan->restaurant_limit}}</td> <td>{{$plan->item_unlimited=='yes'?trans('layout.unlimited'):$plan->item_limit}}</td> <td> @if($plan->status=='active') <span class="badge light badge-success">{{trans('layout.active')}}</span> @elseif($plan->status=='inactive') <span class="badge light badge-warning">{{trans('layout.inactive')}}</span> @endif </td> <td> <div class="dropdown"> <button type="button" class="btn btn-success light sharp" data-toggle="dropdown"> <svg width="20px" height="20px" viewBox="0 0 24 24" version="1.1"> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <rect x="0" y="0" width="24" height="24"/> <circle fill="#000000" cx="5" cy="12" r="2"/> <circle fill="#000000" cx="12" cy="12" r="2"/> <circle fill="#000000" cx="19" cy="12" r="2"/> </g> </svg> </button> <div class="dropdown-menu"> <button class="dropdown-item edit_Plan" type="button" {{-- data-action="{{ route('plan.update', [$plan]) }}" --}} data-action="{{ route('plan.update', [$plan->id]) }}" data-toggle="modal" data-target="#planEditModal" data-title="{{ $plan->title }}" data-recurring_type="{{ $plan->recurring_type }}" data-pos_system="{{ $plan->pos_system }}" data-status="{{ $plan->status }}" data-cost="{{ $plan->cost }}" data-table_limit="{{ $plan->table_limit }}" data-table_unlimited="{{ $plan->table_unlimited }}" data-restaurant_limit="{{ $plan->restaurant_limit }}" data-restaurant_unlimited="{{ $plan->restaurant_unlimited }}" data-item_limit="{{ $plan->item_limit }}" data-item_unlimited="{{ $plan->item_unlimited }}" data-id="{{ $plan->id }}"> {{ trans('layout.edit') }} </button> <button class="dropdown-item" type="button" data-message="{{trans('layout.message.plan_delete_warning')}}" data-action='{{route('plan.destroy',[$plan])}}' data-input={"_method":"delete"} data-toggle="modal" data-target="#modal-confirm">{{trans('layout.delete')}}</button> </div> </div> </td> </tr> @endforeach @endif </tbody> </table> </div> </div> </div> </div> </div>
@endsection <!-- Modal Create --> @section('create-modal-id', 'planCreateModal') @section('create-modal-title', 'Plan Create') @section('create-modal-content-wapper') <form method="POST" action="{{route('plan.store')}}"> <div class="modal-body"> @include('plans.form') </div> <div class="modal-footer"> <button type="button" aria-label="Close" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Submit</button> </div> </form> @endsection
@section('edit-modal-id', 'planEditModal') @section('edit-modal-title', 'Plan Edit') @section('edit-modal-content-wapper') <form method="post" role="form" id="editPlanForm"> @csrf @method('PUT') <input type="hidden" value="" name="id" id="edit_plan_id"> <div class="modal-body"> <section> <div class="row"> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label">{{trans('layout.title')}}*</label> <input type="text" name="title" id="edit_plan_title" class="form-control" placeholder="Ex: Basic" required> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label">{{trans('layout.recurring_type')}}*</label> <select name="recurring_type" id="edit_plan_recurring_type" class="form-control"> <option value="onetime">{{trans('layout.onetime')}}</option> <option value="weekly">{{trans('layout.weekly')}}</option> <option value="monthly">{{trans('layout.monthly')}}</option> <option value="yearly">{{trans('layout.yearly')}}</option> </select> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label">{{trans('layout.pos_system')}}*</label> <select name="pos_system" id="edit_plan_pos_system" class="form-control"> <option value="no">{{trans('layout.no')}}</option> <option value="yes">{{trans('layout.yes')}}</option> </select> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label">{{trans('layout.status')}}*</label> <select name="status" id="edit_plan_status" class="form-control"> <option value="active">{{trans('layout.active')}}</option> <option value="inactive">{{trans('layout.inactive')}}</option> </select> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label">{{trans('layout.cost')}}*</label> <input min="0" step="0.001" type="number" name="cost" id="edit_plan_cost" class="form-control" placeholder="Ex: 200" required> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label">{{trans('layout.table_limit')}}*</label> <div class="form-check form-check-inline"> <label class="form-check-label"> {{trans('layout.is_unlimited')}} <input data-name="table_limit" name="is_table_unlimited" type="checkbox" class="form-check-input isUnlimited" value="yes" id="edit_plan_is_table_unlimited"> </label> </div> <input type="number" name="table_limit" id="edit_plan_table_limit" class="form-control" placeholder="Ex: 5" required min="0" step="0.001"> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label">{{trans('layout.restaurant_limit')}}*</label> <div class="form-check form-check-inline"> <label class="form-check-label"> {{trans('layout.is_unlimited')}} <input data-name="restaurant_limit" name="is_restaurant_unlimited" type="checkbox" class="form-check-input isUnlimited" value="yes" id="edit_plan_is_restaurant_unlimited"> </label> </div> <input type="number" name="restaurant_limit" id="edit_plan_restaurant_limit" class="form-control" placeholder="Ex: 5" required min="0" step="0.001"> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label">{{trans('layout.item_limit')}}*</label> <div class="form-check form-check-inline"> <label class="form-check-label"> {{trans('layout.is_unlimited')}} <input data-name="item_limit" name="is_item_unlimited" type="checkbox" class="form-check-input isUnlimited" value="yes" id="edit_plan_is_item_unlimited"> </label> </div> <input type="number" name="item_limit" id="edit_plan_item_limit" class="form-control" placeholder="Ex: 5" required min="0" step="0.001"> </div> </div> </div> </section> </div> <div class="modal-footer"> <button type="button" aria-label="Close" class="btn btn-secondary" data-dismiss="modal"> {{ trans('layout.close') }} </button> <button type="submit" class="btn btn-primary"> {{ trans('layout.submit') }} </button> </div> </form> @endsection @section('js') <script > $(document).on('click','.isUnlimited',function (e) { let inputFieldName=$(this).attr('data-name'); if($(this).is(':checked')){ $('[name='+inputFieldName+']').hide(); }else{ $('[name='+inputFieldName+']').show(); } }) </script>
<script> $(document).on("click", ".edit_Plan", function(e) { e.preventDefault();
const id = $(this).data('id'); const title = $(this).data('title'); const recurring_type = $(this).data('recurring_type'); const pos_system = $(this).data('pos_system'); const status = $(this).data('status'); const cost = $(this).data('cost'); const table_limit = $(this).data('table_limit'); const table_unlimited = $(this).data('table_unlimited'); const restaurant_limit = $(this).data('restaurant_limit'); const restaurant_unlimited = $(this).data('restaurant_unlimited'); const item_limit = $(this).data('item_limit'); const item_unlimited = $(this).data('item_unlimited'); const actionUrl = $(this).data('action');
$('#edit_plan_id').val(id); $('#edit_plan_title').val(title); $('#edit_plan_recurring_type').val(recurring_type).trigger('change'); $('#edit_plan_pos_system').val(pos_system).trigger('change'); $('#edit_plan_status').val(status).trigger('change'); $('#edit_plan_cost').val(cost);
$('#edit_plan_is_table_unlimited').prop('checked', table_unlimited === 'yes'); $('#edit_plan_is_restaurant_unlimited').prop('checked', restaurant_unlimited === 'yes'); $('#edit_plan_is_item_unlimited').prop('checked', item_unlimited === 'yes');
if (table_unlimited === 'yes') { $('#edit_plan_table_limit').hide(); } else { $('#edit_plan_table_limit').val(table_limit).show(); }
if (restaurant_unlimited === 'yes') { $('#edit_plan_restaurant_limit').hide(); } else { $('#edit_plan_restaurant_limit').val(restaurant_limit).show(); }
if (item_unlimited === 'yes') { $('#edit_plan_item_limit').hide(); } else { $('#edit_plan_item_limit').val(item_limit).show(); }
$('#editPlanForm').attr('action', actionUrl); $('#planEditModal').modal('show'); }); </script>
@endsection
|