My pagination works correctly, but when use search component it display only first page of result.
My page URL without search looks like:
http://localhost:8000/dictionary-management/postcode?page=2
And it's work correctly.
My first page URL with search:
http://localhost:8000/dictionary-management/postcode/search
and it's work correctly.
My second page URL with search:
http://localhost:8000/dictionary-management/postcode/search?page=2
and the is nothing to show, only blank page.
This is my Controller Search method:
public function search(Request $request) {
$constraints = [
'postcode' => $request['postcode'],
'address' => $request['address']
];
$postcodes = $this->doSearchingQuery($constraints);
return view('dictionary-mgmt/postcode/index', ['postcodes' => $postcodes, 'searchingVals' => $constraints]);
}
private function doSearchingQuery($constraints) {
$query = Postcode::query();
$fields = array_keys($constraints);
$index = 0;
foreach ($constraints as $constraint) {
if ($constraint != null) {
$query = $query->where( $fields[$index], 'like', '%'.$constraint.'%');
}
$index++;
}
return $query->Paginate(5);
}
This is my route :
Route::resource('dictionary-management/postcode', 'PostCodeController');
Route::post('dictionary-management/postcode/search', PosstCodeController#search')->name('postcode.search');
This is my index view :
#extends('dictionary-mgmt.postcode.base')
#section('action-content')
<!-- Main content -->
<section class="content">
<div class="box">
<div class="box-header">
<div class="row">
<div class="col-sm-8">
<h3 class="box-title">List kodów pocztowych</h3>
</div>
<div class="col-sm-4">
<a class="btn btn-primary pull-right" href="{{ route('postcode.create') }}">Dodaj nowy kod pocztowy</a>
</div>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-sm-6"></div>
<div class="col-sm-6"></div>
</div>
<form method="POST" action="{{ route('postcode.search') }}">
{{ csrf_field() }}
#component('layouts.search', ['title' => 'Szukaj'])
#component('layouts.two-cols-search-row', ['items' => ['postcode', 'address'], 'title' => ['Kod','Adres'],
'oldVals' => [isset($searchingVals) ? $searchingVals['postcode'] : '', isset($searchingVals) ? $searchingVals['address'] : '']])
#endcomponent
#endcomponent
</form>
<div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
<div class="row">
<div class="col-sm-12">
<table id="example2" class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info">
<thead>
<tr role="row">
<th width="5%">Kod pocztowy</th>
<th width="40%">Adres</th>
<th width="10%">Miejscowość</th>
<th width="10%">Województwo</th>
<th width="10%">Powiat</th>
<th>Akcja</th>
</tr>
</thead>
<tbody>
#foreach ($postcodes as $postcode)
<tr role="row" class="odd">
<td>{{ $postcode->postcode }}</td>
<td>{{ $postcode->address }}</td>
<td>{{ $postcode->city }}</td>
<td>{{ $postcode->voivodeship }}</td>
<td>{{ $postcode->county }}</td>
<td>
<form class="row" method="POST" action="{{ route('postcode.destroy', ['id' => $postcode->id]) }}" onsubmit = "return confirm('Czy napewno usunąć?')">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<a href="{{ route('postcode.edit', ['id' => $postcode->id]) }}" class="btn btn-warning col-sm-3 col-xs-5 btn-margin">
Edytuj
</a>
<button type="submit" class="btn btn-danger col-sm-3 col-xs-5 btn-margin">
Usuń
</button>
</form>
</td>
</tr>
#endforeach
</tbody>
<tfoot>
<tr>
<th width="5%">Kod pocztowy</th>
<th width="40%">Adres</th>
<th width="10%">Miejscowość</th>
<th width="10%">Województwo</th>
<th width="10%">Powiat</th>
<th>Akcja</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="row">
<div class="col-sm-5">
</div>
<div class="col-sm-7">
<div class="dataTables_paginate paging_simple_numbers" id="example2_paginate">
{{ $postcodes->links() }}
</div>
</div>
</div>
</div>
</div>
<!-- /.box-body -->
</div>
</section>
<!-- /.content -->
</div>
#endsection
And this is my search component:
<div class="row">
#php
$index = 0;
#endphp
#foreach ($items as $item)
<div class="col-md-6">
<div class="form-group">
#php
$stringFormat = strtolower(str_replace(' ', '', $item));
#endphp
<label for="input<?=$stringFormat?>" class="col-sm-3 control-label">{{$title[$index]}}</label>
<div class="col-sm-9">
<input value="{{isset($oldVals) ? $oldVals[$index] : ''}}" type="text" class="form-control" name="<?=$stringFormat?>" id="input<?=$stringFormat?>" placeholder="{{$title[$index]}}">
</div>
</div>
</div>
#php
$index++;
#endphp
#endforeach
</div>
Please help, I don't know where is my mistake...
Try this
{{ $postcodes->appends(request()->input())->links()}}
instead of {{ $postcodes->links() }}
Related
I'm using Laravel 9 and trying to use CRUD with my model Project which has the following DB table.
When I try to edit a project using the button "edit" on this view:
"projets.index":
#extends('header')
#section('content')
<div class="col-sm-8" style="background: rgba(204, 204, 204,0.5);padding:5%;width:100%">
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2 style="text-align: center">Les projets</h2>
</div>
<div class="pull-right">
<a class="btn btn-success" href="{{ route('projets.create') }}"> Créée un nouveau projet</a>
</div>
</div>
</div>
#if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
#endif
<table class="table table-bordered">
<tr>
<th>id du projet</th>
<th>description</th>
<th width="280px">Action</th>
</tr>
#foreach ($projects as $project)
<tr>
<td>{{ $project->id_project }}</td>
<td>{{ $project->description }}</td>
<td>
<form action="{{ route('projets.destroy',$project->id_project) }}" method="Post">
<a class="btn btn-primary" href="{{ route('galleries.index',$project->id_project,'id_project') }}">ajouter</a>
<a class="btn btn-primary" href="{{ route('projets.edit',[$project->id_project]) }}">Edit</a>
#csrf
#method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
#endforeach
</table>
{!! $projects->links() !!}
</div>
#endsection
I have the following error:
"Missing required parameter for [Route: projets.update] [URI: projets/{projet}] [Missing parameter: projet]."
"projets.edit":
#extends('header')
#section('content')
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Edit projet</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{{ route('projets.index') }}"> Back</a>
</div>
</div>
</div>
#if ($errors->any())
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
#foreach ($errors->all() as $error)
<li>{{ $error }}</li>
#endforeach
</ul>
</div>
#endif
<form action="{{ route('projets.update',$project->id_project) }}" method="POST" enctype="multipart/form-data">
#csrf
#method('PUT')
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Company Address:</strong>
<input type="text" name="address" value="{{ $project->description }}" class="form-control" placeholder="Company Address">
#error('address')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
#enderror
</div>
</div>
<button type="submit" class="btn btn-primary ml-3">Submit</button>
</div>
</form>
#endsection
Update function inside the controller (ProjectController):
public function update(Request $request, $id_project)
{
$request->validate([
'description' => 'required',
]);
User::create($request->all());
$project->description = $request->description;
$project->save();
return redirect()->route('projets.index')
->with('success','project Has Been updated successfully');
}
public function edit(Project $project)
{
return view('projets.edit',compact('project'));
}
Project model
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Project extends Model
{
protected $fillable = [
'id_project', 'description'
];
}
Sorry if my questions seems strange English is not my first language
My Livewire Component
public $productId;
public $allTariff = [];
public $rowProducts = [];
public function mount()
{
$this->rowProducts = Products::all();
$this->allTariff = [
['productId' => '', 'basicCharge' => '', 'additionalCharge' => '']
];
}
public function addProduct()
{
$this->allTariff[] = ['productId' => '', 'basicCharge' => '', 'additionalCharge' => ''];
}
public function render()
{
$rowProducts = Products::all();
return view('livewire.admin.admin-add-tariffs-component', ['rowProducts'=>$rowProducts)->layout('layouts.admin.base');
}
My View File
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-8">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Add Tariff</h6>
</div>
<div class="card-body">
<form wire:submit.prevent="storeTariff">
#csrf
<div class="form-row">
<!-- Default input -->
<div class="form-group col-md-8">
<input type="text" class="form-control" placeholder="Enter Tariff Name" wire:model="tariffName" >
</div>
</div><hr>
<div class="card">
<div class="card-header">
<h6 class="text-primary">Products, Basic and Weight Charges</h6>
</div>
<div class="card-body">
<table class="table" id="products_table">
<thead>
<tr>
<th>Product</th>
<th>Basic Charge</th>
<th>Weight Charge</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach ($allTariff as $index => $value)
<tr>
<td>
<select name="allTariff[{{$index}}][productId]"
wire:model="allTariff.{{ $index }}.productId"
class="custom-select custom-select-sm form-control form-control-sm">
#foreach ($rowProducts as $product)
<option value="{{ $product->id }}">
{{ $product->product_name }}
</option>
#endforeach
</select>
</td>
<td>
<input type="text" class="form-control form-control-user" name="allTariff[{{$index}}][basicCharge]" placeholder="Basic Charge" wire:model="allTariff.{{ $index }}.basicCharge" required>
</td>
<td>
<input type="text" class="form-control form-control-user" name="allTariff[{{$index}}][additionalCharge]" placeholder="Weight Charge" wire:model="allTariff.{{ $index }}.additionalCharge" required>
</td>
</tr>
#endforeach
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-secondary"
wire:click.prevent="addProduct">+ Add Another Product</button>
</div>
</div>
</div>
</div>
<hr>
{{-- <div class="form-row">
<div class="form-group col-md-3"> --}}
<button type="submit" class="form-control btn btn-small btn-primary">Add
Tariff</button>
{{-- </div>
</div> --}}
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
Every time I click on the add tariff button this photo it give the blank page on this photo, but on console an html response is given.
I have tried a couple methods and tricks still no way out, just stuck for days
I have already include the livewire #livewireStyles and #livewireScripts, and i can't find an answer anywhere else cause i don't see any question that match my problem, and i'm kinda new to livewire
When using Livewire, there are a few things you need to be aware of. Due to the nature of how Livewire updates the page, there are some structural rules you need to follow.
The first and probably most important thing here, is that every Livewire-component view should only consist of one root element. And this includes comments!
If we count the root elements in your view, there are three - a comment, a div, and then another comment. So the first thing I did here, was to move the comments inside that div.
<div class="container-fluid">
<!-- Begin Page Content -->
<!-- Page Heading -->
<div class="row">
<div class="col-lg-8">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Add Tariff</h6>
</div>
<div class="card-body">
<form wire:submit.prevent="storeTariff">
#csrf
<div class="form-row">
<!-- Default input -->
<div class="form-group col-md-8">
<input type="text" class="form-control" placeholder="Enter Tariff Name"
wire:model="tariffName">
</div>
</div>
<hr>
<div class="card">
<div class="card-header">
<h6 class="text-primary">Products, Basic and Weight Charges</h6>
</div>
<div class="card-body">
<table class="table" id="products_table">
<thead>
<tr>
<th>Product</th>
<th>Basic Charge</th>
<th>Weight Charge</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach ($allTariff as $index => $value)
<tr>
<td>
<select name="allTariff[{{ $index }}][productId]"
wire:model="allTariff.{{ $index }}.productId"
class="custom-select custom-select-sm form-control form-control-sm">
#foreach ($rowProducts as $product)
<option value="{{ $product->id }}">
{{ $product->product_name }}
</option>
#endforeach
</select>
</td>
<td>
<input type="text" class="form-control form-control-user"
name="allTariff[{{ $index }}][basicCharge]"
placeholder="Basic Charge"
wire:model="allTariff.{{ $index }}.basicCharge" required>
</td>
<td>
<input type="text" class="form-control form-control-user"
name="allTariff[{{ $index }}][additionalCharge]"
placeholder="Weight Charge"
wire:model="allTariff.{{ $index }}.additionalCharge"
required>
</td>
</tr>
#endforeach
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-secondary" wire:click.prevent="addProduct">+ Add Another Product</button>
</div>
</div>
</div>
</div>
<hr>
{{-- <div class="form-row">
<div class="form-group col-md-3"> --}}
<button type="submit" class="form-control btn btn-small btn-primary">Add
Tariff</button>
{{-- </div>
</div> --}}
</form>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
Then another thing I would recommend that you look into is using wire:key on the tr element inside your table-loop, and on the option element inside your inner loop. The value to wire:key should always be unique to that particular row, so using $loop->index is not generally advised. You can generate a dummy-ID for each record that you add to your array, which sole purpose is to track the individual row. Here's how, see the wire:key I added in the template,
<div class="container-fluid">
<!-- Begin Page Content -->
<!-- Page Heading -->
<div class="row">
<div class="col-lg-8">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Add Tariff</h6>
</div>
<div class="card-body">
<form wire:submit.prevent="storeTariff">
#csrf
<div class="form-row">
<!-- Default input -->
<div class="form-group col-md-8">
<input type="text" class="form-control" placeholder="Enter Tariff Name"
wire:model="tariffName">
</div>
</div>
<hr>
<div class="card">
<div class="card-header">
<h6 class="text-primary">Products, Basic and Weight Charges</h6>
</div>
<div class="card-body">
<table class="table" id="products_table">
<thead>
<tr>
<th>Product</th>
<th>Basic Charge</th>
<th>Weight Charge</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach ($allTariff as $index => $value)
<tr wire:key="tariff-{{ $value->wireKey }}">
<td>
<select name="allTariff[{{ $index }}][productId]"
wire:model="allTariff.{{ $index }}.productId"
class="custom-select custom-select-sm form-control form-control-sm">
#foreach ($rowProducts as $product)
<option value="{{ $product->id }}" wire:key="product-{{ $product->id }}">
{{ $product->product_name }}
</option>
#endforeach
</select>
</td>
<td>
<input type="text" class="form-control form-control-user"
name="allTariff[{{ $index }}][basicCharge]"
placeholder="Basic Charge"
wire:model="allTariff.{{ $index }}.basicCharge" required>
</td>
<td>
<input type="text" class="form-control form-control-user"
name="allTariff[{{ $index }}][additionalCharge]"
placeholder="Weight Charge"
wire:model="allTariff.{{ $index }}.additionalCharge"
required>
</td>
</tr>
#endforeach
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-secondary" wire:click.prevent="addProduct">+ Add Another Product</button>
</div>
</div>
</div>
</div>
<hr>
{{-- <div class="form-row">
<div class="form-group col-md-3"> --}}
<button type="submit" class="form-control btn btn-small btn-primary">Add
Tariff</button>
{{-- </div>
</div> --}}
</form>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
And then in your component, just generate a unique string
class AdminAddTariffsComponent
{
public $productId;
public $allTariff = [];
public $rowProducts = [];
public function mount()
{
$this->rowProducts = Products::all();
$this->addProduct();
}
public function addProduct()
{
$this->allTariff[] = [
'productId' => '',
'basicCharge' => '',
'additionalCharge' => '',
'wireKey' => \Str::uuid(),
];
}
public function render()
{
return view('livewire.admin.admin-add-tariffs-component')
->layout('layouts.admin.base');
}
}
So, I get the problem when I try to make the code for take the store_id from foreach
View
{{-- Cart --}}
<div class="row">
<div class="col-lg-9 my-3">
<div class="table-responsive mb-4">
#foreach ($carts as $cart => $items)
<h3>{{ $cart }}</h3>
{{-- TABLE --}}
<table class="table">
{{-- HEAD --}}
<thead>
<tr>
<th class="border-0 p-3 h6 title" scope="col">
Product
</th>
<th class="border-0 p-3 h6 title" scope="col">
Price
</th>
<th class="border-0 p-3 h6 title ps-5" scope="col">
Quantity
</th>
<th class="border-0 p-3 ps-4 h6 title" scope="col">
Total
</th>
</tr>
</thead>
{{-- CONTENT --}}
<tbody class="border-0">
#foreach ($items as $cart)
<tr>
<td class="p-3 border-0">
<div class="d-flex align-items-center">
<a class="reset-anchor d-block animsition-link" href="/products/{{ $cart->product->slug }}">
#if($cart->product->image)
<img src="img/admin_store/{{ $cart->product->image }}" width="70" />
#else
<img src="{{ asset('img/customer/img-1.png') }}" width="70" />
#endif
</a>
<div class="ms-3">
<a class="reset-anchor animsition-link title text-decoration-none" href="/products/{{ $cart->product->slug }}">{{ $cart->product->name }}</a>
</div>
</div>
</td>
<td class="p-3 align-middle border-0">
<p class="mb-0 small">Rp{{ number_format(($cart->product->price * ((100 - $cart->product->discount)/100)), 0,",",".") }}</p>
</td>
<td class="p-3 align-middle border-0">
<form action="/update_cart" method="POST">
#csrf
<div class="row">
<div class="col-5">
<input type="hidden" name="cart" value="{{ $cart->id }}">
<input type="number" name="quantity" value="{{ $cart->qty }}" class="w-100 ms-5" min="0" max="{{ $cart->product->stock }}">
</div>
</div>
<button type="submit" class="btn btn-sm btn-dark ms-5 mt-2" style="margin-right:20px">Update</button>
</form>
</td>
<td class="p-3 align-middle border-0">
<p class="mb-0 small">Rp{{ number_format($cart->total_product, 0,",",".") }}</p>
</td>
<td class="p-3 align-middle border-0">
<form action="/delete_cart" method="post">
#csrf
<input type="hidden" name="id" id="id" value="{{ $cart->id }}">
<a class="reset-anchor">
<button type="submit" class="btn btn-link">
<img src="{{ asset('img/customer/bx-trash.svg') }}" width="20">
</button>
</a>
</form>
</td>
</tr>
#endforeach
</tbody>
</table>
<hr>
{{-- TOTAL --}}
<div>
<h6 class="text-md-end">Total : Rp{{ $items->sum('total_product') }}</h6>
</div>
{{-- SHIPPING --}}
<div class="text-md-end">
<a class="btn btn-dark" href="/shipping/{{ $items->store_id }}"> checkout <i class='bx bx-basket'> </i> </a>
</div>
#endforeach
</div>
</div>
so in <a class="btn btn-dark" href="/shipping/{{ $items->store_id }}"> checkout <i class='bx bx-basket'> </i> </a> this is error
The Controller
public function index(Request $request)
{
$itemuser = $request->user();
$cartdetail = CartDetail::where('user_id', $itemuser->id)->get();
$cart = Cart::where('user_id', $itemuser->id)->get();
return view('customer.cart', [
'title' => 'Cart',
'carts' => $cart,
'cartdetail' => $cartdetail
]);
}
this result when using dd($carts)
This is my view
*note : store name, product and pictures are for study only, and the url before I add $items->store_id
So the story is, I'm only going to checkout for carts with the same store_id, but I'm confused about how to pull the store_id. How to solve it?
its laravel 8 course im getting this error while using query builder but with ORM its perfectly run well. when i comment this code and use another method for getting data with query builder in AllCat() method DB::table is running perfectly
Category Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Category;
use Auth;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class CategoryController extends Controller
{
public function AllCat(){
$categories = DB::tabel('categories')
->join('users','categories.user_id','users.id')
->select('categories.*','users.name')
->latest()->paginate(5);
// $categories = Category::latest()->paginate(5);
//$categories = DB::table('categories')->latest()->paginate(5);
return view('admin.category.index',compact('categories'));
}
public function AddCat(Request $request){
$validated = $request->validate([
'category_name' => 'required|unique:categories|max:255',
],
[
'category_name.required' => 'Please Input Category Name',
'category_name.max' => 'Category Less Then 255Chars',
]);
Category::insert([
'category_name' => $request->category_name,
'user_id' => Auth::user()->id,
'created_at' => Carbon::now()
]);
// $category = new Category;
// $category->category_name = $request->category_name;
// $category->user_id = Auth::user()->id;
// $category->save();
// $data = array();
// $data['category_name'] = $request->category_name;
// $data['user_id'] = Auth::user()->id;
// DB::table('categories')->insert($data);
return redirect()->back()->with('success','Category Inserted Successfull');
}
}
Index.blade.php
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
All Category<b> </b>
</b>
</h2>
</x-slot>
<div class="py-12">
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="card">
#if(session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong>{{ session('success') }}</strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
#endif
<div class="card-header"> All Category
</div>
<table class="table">
<thead>
<tr>
<th scope="col">SL No</th>
<th scope="col">Category Name</th>
<th scope="col">User</th>
<th scope="col">Created At</th>
</tr>
</thead>
<tbody>
<!-- #php($i = 1) -->
#foreach($categories as $category)
<tr>
<th scope="row">{{ $categories->firstItem()+$loop->index }}</th>
<td>{{ $category->category_name }}</td>
<td>{{ $category->name }}</td>
<td>
#if($category->created_at == NULL)
<span class="text-danger">No Date Set</span>
#else
{{ Carbon\Carbon::parse($category->created_at)->diffforHumans() }}</td>
#endif
</tr>
#endforeach
</tbody>
</table>
{{ $categories->links() }}
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header">Add Category</div>
<div class="card-body">
<form action="{{ route('store.category') }}" method="POST">
#csrf
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">Category Name</label>
<input type="text" name="category_name" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
#error('category_name')
<span class="text-danger">{{ $message }}</span>
#enderror
</div>
<button type="submit" class="btn btn-primary">Add Category</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Can you tell me what is wrong here
are you sure it is DB::tabel and not DB::table ?? It surely has to be DB::table
I'm kinda new here, just need help with small code.
I need to print specific area with a Print Payment Record that I've already added, I've added a new button, tried with another tutorial but I couldn't do it, with my other code print the entire page.
I know I can highlight the table and hit print but having a button is easier mostly when the record is like 50 payments.
Start in Deposit Fee in Details.
Help with these please!
This is my code:
#extends('branch.layout.main')
#section('title') Manage Fee #endsection
#section('content')
<div class="container">
<div class="section">
#section('button')
Deposit Fee
#endsection
<div class="row">
<div class="col s12 m12 l12">
<div class="card-panel">
<div class="row">
<h4 class="header2" style="color:#00bcd4"><i class="mdi-social-person" style="font-size:20px"></i> Fee Detail of {{ $student->first_name." ".$student->last_name }}</h4>
<table class="striped" >
<thead>
<tr>
<th>Current Course</th>
<th>Course Fee</th>
<th>Discount</th>
<th>Any Extra</th>
<th>Total Payable</th>
<th>Deposited Fee</th>
<th>Balance</th>
</tr>
<tr>
<td width="20%">{{ $course->courseName }}</td>
<td width="13%">{{ IMS::currency().$course->course_fee }}</td>
<td width="13%">{{ IMS::currency().$course->discount }}</td>
<td width="13%">{{ IMS::currency().$extra }}</td>
<td width="13%">{{ IMS::currency().$payable }}</td>
<td width="13%">{{ IMS::currency().$deposited }}</td>
<td width="13%"><span style="color:red">{{ IMS::currency().$balance }}</span></td>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<!--Deposited Fee in Detail-->
#if(count($fees) > 0)
<div class="row">
<div class="col s12 m12 l12">
<div class="card-panel">
<div class="row">
<h4 class="header2" style="color:#00bcd4"><i class="mdi-content-add" style="font-size:20px"></i> Deposited Fee of {{ $student->first_name." ".$student->last_name }}</h4>
<button onclick="printContent('row')">Print Payment Record </button>
<table class="striped" >
<thead>
<tr>
<th>Date Added</th>
<th>Amount</th>
<th>Course</th>
<th>Due Date</th>
<th>Option</th>
</tr>
#foreach($fees as $fee)
<tr>
<td width="20%">{{ date('d-M-Y',strtotime($fee->date_added)) }}</td>
<td width="20%">{{ IMS::currency().$fee->amount }}</td>
<td width="20%">{{ $fee->courseName }}</td>
<td width="20%">#if($fee->due_date) {{ date('d-M-Y',strtotime($fee->due_date)) }} #else --- #endif</td>
<td width="20%">
<i class="mdi-maps-local-print-shop"></i>
<i class="mdi-maps-local-print-shop"></i>
#if($delete)
<i class="mdi-content-clear"></i>
#endif
</td>
</tr>
#endforeach
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
#endif
<!--End Deposited Fee in Detail-->
<!--Add New Fee-->
<div id="AddNew" class="modal modal-fixed-footer">
<div class="modal-content">
<h4 class="header2">Deposit Fee For {{ $student->first_name }} {{ $student->last_name }}</h4>
<form action="{{ Asset('fee/'.$student->id) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="row">
<div class="input-field col s6">
<i class="mdi-editor-insert-invitation prefix"></i>
{!! Form::date('date_added',date('Y-m-d'),['id' => 'date_added','class' => 'datepicker']) !!}
<label for="date_added">Date Added *</label>
</div>
<div class="input-field col s6">
<i class="mdi-editor-attach-money prefix"></i>
{!! Form::number('amount',null,['id' => 'amount','required' => 'required','pattern' => '[0-9]{10}']) !!}
<label for="amount">Amount *</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<select name="payment_mode">
<option>Please select Payment Type</option>
<option>Cash</option>
<option>Cheque</option>
<option>Card</option>
<option>Credit or Discount</option>
</select>
</div>
<div class="input-field col s6">
{!! Form::text('cheque_Card_Number', null, ['id' => 'cheque_Card_Number']) !!}
</div>
</div>
<p style="color:red"><i class="fa fa-bell"></i> If you want fee due reminder then select fee due date,if not then leave empty</p>
<div class="row">
<div class="input-field col s12">
<i class="mdi-editor-insert-invitation prefix"></i>
{!! Form::date('due_date',null,['id' => 'due_date','class' => 'datepicker']) !!}
<label for="due_date">Due Date</label>
</div>
</div>
<div class="modal-footer">
Close
<button type="submit" class="btn blue modal-action modal-close">Save</button>
</div>
</form>
</div>
</div>
<!--End Add New Fee-->
#endsection