Current File : /home/tradevaly/www/resources/views/user/pages/product/price.blade.php |
@extends('user.ayaan.master')
@push('title','Add New Product')
@push('style')
<link href="{{ asset('/assets/libs/select2/select2.min.css') }}" rel="stylesheet" type="text/css" />
<style>
.price-hide {
display: none;
}
.price-table tr td {
padding-right: 30px;
}
</style>
@endpush
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-icon card-header-info">
<h4 class="card-title">Add Price for{{$product->title}}
</h4>
</div>
<div class="card-body">
<form action="{{route("user.savePrice",$product->id)}}" method="POST">
@csrf
<div class="form-ew form-sm type-form">
<label> Set price </label>
<div class="next-form-item-control">
<div class="form-check mb-3">
<input type="radio" id="negotiable" class="form-check-input" {{$product->price_type=="negotiable"?'checked':''}} name="price_type" value="negotiable" onclick="show1();" />
<label class="form-check-label" for="formCheck1">
Negotiable price
</label>
</div>
<div class="form-check mb-3">
<input type="radio" id="qbp" class="form-check-input"{{$product->price_type=="qbp"?'checked':''}} name="price_type"value="qbp" id="qbp" onclick="show2();" />
<label class="form-check-label" for="formCheck1">
Set quantity based on price
</label>
</div>
<div class="form-check mb-3">
<input type="radio" id="pbq" class="form-check-input"{{$product->price_type=="pbq"?'checked':''}} name="price_type"value="pbq" id="pbq" onclick="show3();" />
<label class="form-check-label" for="formCheck1">
Set price based on quantity
</label>
</div>
</div>
</div>
<div id="div1" class="{{$product->price_type=="negotiable"?'':'price-hide'}}">
</div>
<div id="div2" class="{{$product->price_type=="qbp"?'':'price-hide'}}">
<div id="main">
<table id="qbp" class="data-table data-table-horizontal data-table-highlight">
<tbody class="price-table">
<tr>
<td >
<input type="text" name="qty_min" class="inner form-control" placeholder="Qty From" />
@if ($errors->has('qty_min'))
<span class="text-danger">{{ $errors->first('qty_min') }} *</span>
@endif
</td>
<td>
<input type="text" name="qty_max" class="inner form-control" placeholder="Qty To"/>
@if ($errors->has('qty_max'))
<span class="text-danger">{{ $errors->first('qty_max') }} *</span>
@endif
</td>
<td>
<input type="text" name="qty_total" class="inner form-control" placeholder="Price"/>
@if ($errors->has('qty_total'))
<span class="text-danger">{{ $errors->first('qty_total') }} *</span>
@endif
</td>
<td>
<select class="form-control select2" name="qty_unit">
<option value="">Select Unit</option>
<option value="" selected="selected">-- Select Unit --</option>
<option value="Acre">Acre</option>
<option value="Ampere">Ampere</option>
<option value="Bag">Bag</option>
<option value="Barrel">Barrel</option>
<option value="Box">Box</option>
<option value="Bushel">Bushel</option>
<option value="Carton">Carton</option>
<option value="Case">Case</option>
<option value="Centimeter">Centimeter</option>
<option value="Chain">Chain</option>
<option value="Cubic Centimeter">Cubic Centimeter</option>
<option value="Cubic Foot">Cubic Foot</option>
<option value="Cubic Inch">Cubic Inch</option>
<option value="Cubic Meter">Cubic Meter</option>
<option value="Cubic Yard">Cubic Yard</option>
<option value="DEGREES Celsius">DEGREES Celsius</option>
<option value="Degrees Fahrenheit">Degrees Fahrenheit</option>
<option value="Dozen">Dozen</option>
<option value="Dram">Dram</option>
<option value="Fluid Ounce">Fluid Ounce</option>
<option value="Foot">Foot</option>
<option value="Forty-Foot Container ">Forty-Foot Container </option>
<option value="Furlong">Furlong</option>
<option value="Gallon">Gallon</option>
<option value="Gill">Gill</option>
<option value="Grain">Grain</option>
<option value="Gram">Gram</option>
<option value="Gross">Gross</option>
<option value="Hectare">Hectare</option>
<option value="Hertz">Hertz</option>
<option value="Inch">Inch</option>
<option value="Kiloampere">Kiloampere</option>
<option value="Kilogram">Kilogram</option>
<option value="Kilohertz">Kilohertz</option>
<option value="Kilometer">Kilometer</option>
<option value="Kiloohm">Kiloohm</option>
<option value="Kilovolt">Kilovolt</option>
<option value="Kilowatt">Kilowatt</option>
<option value="Liter">Liter</option>
<option value="Long Ton">Long Ton</option>
<option value="Megahertz">Megahertz</option>
<option value="Meter">Meter</option>
<option value="Metric Ton">Metric Ton</option>
<option value="Mile">Mile</option>
<option value="Milliampere">Milliampere</option>
<option value="Milligram">Milligram</option>
<option value="Millihertz">Millihertz</option>
<option value="Milliliter">Milliliter</option>
<option value="Millimeter">Millimeter</option>
<option value="Milliohm">Milliohm</option>
<option value="Millivolt">Millivolt</option>
<option value="Milliwatt">Milliwatt</option>
<option value="Nautical Mile">Nautical Mile</option>
<option value="Ohm">Ohm</option>
<option value="Ounce">Ounce</option>
<option value="Pack">Pack</option>
<option value="Pallet">Pallet</option>
<option value="Pair">Pair</option>
<option value="Parcel">Parcel</option>
<option value="Perch">Perch</option>
<option value="Piece">Piece</option>
<option value="Pint">Pint</option>
<option value="Plant">Plant</option>
<option value="Pole">Pole</option>
<option value="Pound">Pound</option>
<option value="Quart">Quart</option>
<option value="Quarter">Quarter</option>
<option value="Rod">Rod</option>
<option value="Roll">Roll</option>
<option value="Set">Set</option>
<option value="Sheet">Sheet</option>
<option value="Short Ton">Short Ton</option>
<option value="Square Centimeter">Square Centimeter</option>
<option value="Square Foot">Square Foot</option>
<option value="Square Inch">Square Inch</option>
<option value="Square Meter">Square Meter</option>
<option value="Square Mile">Square Mile</option>
<option value="Square Yard">Square Yard</option>
<option value="Stone">Stone</option>
<option value="Strand">Strand</option>
<option value="Ton">Ton</option>
<option value="Tonne">Tonne</option>
<option value="Tray">Tray</option>
<option value="Twenty-Foot Container">Twenty-Foot Container</option>
<option value="Unit">Unit</option>
<option value="Volt">Volt</option>
<option value="Watt">Watt</option>
<option value="Wp">Wp</option>
<option value="Yard">Yard</option>
</select>
</td>
<!--<td>-->
<!-- <a type="button" class="btn btn-primary inner" value="Delete" onclick="deleteRow(this)">delete</a>-->
<!--</td>-->
</tr>
</tbody>
</table>
<!--<div class="pull-right">-->
<!-- <input type="button" value="Add" class="btn btn-success mt-3" onclick="addRow('qbp')" />-->
<!--</div>-->
</div>
<div class="my-3">
<label for="singlePrice" class="form-label">Single unit Price</label>
<input type="number" class="form-control" name="single_price" value="{{$product->price}}" id="singlePrice" placeholder="Enter Price">
@error('single_price')
<div class="alert alert-danger" role="alert">
<strong>Error - </strong>{{ $message }}
</div>
@enderror
</div>
</div>
<div id="div3" class="{{$product->price_type=="pbq"?'':'price-hide'}}">
<div id="main">
<table id="pbq" class="data-table data-table-horizontal data-table-highlight">
<tbody class="price-table">
<tr>
<td >
<input type="text" name="price_min" class="inner form-control" placeholder="Price From" />
@if ($errors->has('price_min'))
<span class="text-danger">{{ $errors->first('price_min') }} *</span>
@endif
</td>
<td>
<input type="text" name="price_max" class="inner form-control" placeholder="Price To"/>
@if ($errors->has('price_max'))
<span class="text-danger">{{ $errors->first('price_max') }} *</span>
@endif
</td>
<td>
<input type="text" name="price_total" class="inner form-control" placeholder="Quantity"/>
@if ($errors->has('price_total'))
<span class="text-danger">{{ $errors->first('price_total') }} *</span>
@endif
</td>
<td>
<select class="form-control select2" name="price_unit">
<option value="">Select Unit</option>
<option value="" selected="selected">-- Select Unit --</option>
<option value="Acre">Acre</option>
<option value="Ampere">Ampere</option>
<option value="Bag">Bag</option>
<option value="Barrel">Barrel</option>
<option value="Box">Box</option>
<option value="Bushel">Bushel</option>
<option value="Carton">Carton</option>
<option value="Case">Case</option>
<option value="Centimeter">Centimeter</option>
<option value="Chain">Chain</option>
<option value="Cubic Centimeter">Cubic Centimeter</option>
<option value="Cubic Foot">Cubic Foot</option>
<option value="Cubic Inch">Cubic Inch</option>
<option value="Cubic Meter">Cubic Meter</option>
<option value="Cubic Yard">Cubic Yard</option>
<option value="DEGREES Celsius">DEGREES Celsius</option>
<option value="Degrees Fahrenheit">Degrees Fahrenheit</option>
<option value="Dozen">Dozen</option>
<option value="Dram">Dram</option>
<option value="Fluid Ounce">Fluid Ounce</option>
<option value="Foot">Foot</option>
<option value="Forty-Foot Container ">Forty-Foot Container </option>
<option value="Furlong">Furlong</option>
<option value="Gallon">Gallon</option>
<option value="Gill">Gill</option>
<option value="Grain">Grain</option>
<option value="Gram">Gram</option>
<option value="Gross">Gross</option>
<option value="Hectare">Hectare</option>
<option value="Hertz">Hertz</option>
<option value="Inch">Inch</option>
<option value="Kiloampere">Kiloampere</option>
<option value="Kilogram">Kilogram</option>
<option value="Kilohertz">Kilohertz</option>
<option value="Kilometer">Kilometer</option>
<option value="Kiloohm">Kiloohm</option>
<option value="Kilovolt">Kilovolt</option>
<option value="Kilowatt">Kilowatt</option>
<option value="Liter">Liter</option>
<option value="Long Ton">Long Ton</option>
<option value="Megahertz">Megahertz</option>
<option value="Meter">Meter</option>
<option value="Metric Ton">Metric Ton</option>
<option value="Mile">Mile</option>
<option value="Milliampere">Milliampere</option>
<option value="Milligram">Milligram</option>
<option value="Millihertz">Millihertz</option>
<option value="Milliliter">Milliliter</option>
<option value="Millimeter">Millimeter</option>
<option value="Milliohm">Milliohm</option>
<option value="Millivolt">Millivolt</option>
<option value="Milliwatt">Milliwatt</option>
<option value="Nautical Mile">Nautical Mile</option>
<option value="Ohm">Ohm</option>
<option value="Ounce">Ounce</option>
<option value="Pack">Pack</option>
<option value="Pallet">Pallet</option>
<option value="Pair">Pair</option>
<option value="Parcel">Parcel</option>
<option value="Perch">Perch</option>
<option value="Piece">Piece</option>
<option value="Pint">Pint</option>
<option value="Plant">Plant</option>
<option value="Pole">Pole</option>
<option value="Pound">Pound</option>
<option value="Quart">Quart</option>
<option value="Quarter">Quarter</option>
<option value="Rod">Rod</option>
<option value="Roll">Roll</option>
<option value="Set">Set</option>
<option value="Sheet">Sheet</option>
<option value="Short Ton">Short Ton</option>
<option value="Square Centimeter">Square Centimeter</option>
<option value="Square Foot">Square Foot</option>
<option value="Square Inch">Square Inch</option>
<option value="Square Meter">Square Meter</option>
<option value="Square Mile">Square Mile</option>
<option value="Square Yard">Square Yard</option>
<option value="Stone">Stone</option>
<option value="Strand">Strand</option>
<option value="Ton">Ton</option>
<option value="Tonne">Tonne</option>
<option value="Tray">Tray</option>
<option value="Twenty-Foot Container">Twenty-Foot Container</option>
<option value="Unit">Unit</option>
<option value="Volt">Volt</option>
<option value="Watt">Watt</option>
<option value="Wp">Wp</option>
<option value="Yard">Yard</option>
</select>
</td>
<!--<td>-->
<!-- <a type="button" class="btn btn-primary inner" value="Delete" onclick="deleteRow2(this)">delete</a>-->
<!--</td>-->
</tr>
</tbody>
</table>
<!--<div class="pull-right">-->
<!-- <input type="button" value="Add" class="btn btn-success mt-3" onclick="addRow('pbq')" />-->
<!--</div>-->
</div>
<div class="my-3">
<label for="singlePrice" class="form-label">Single unit Price</label>
<input type="number" class="form-control" name="single_price" value="{{$product->price}}" id="singlePrice" placeholder="Enter Price">
@error('single_price')
<div class="alert alert-danger" role="alert">
<strong>Error - </strong>{{ $message }}
</div>
@enderror
</div>
</div>
<input type="submit" class="btn btn-success mt-4" value="submit">
</form>
</div>
</div>
<div class='card'>
<div class="card-header"
<h4 class="card-title">All Prices</h4>
</div>
<div class="card-body">
<div id="div3">
<div id="main">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Type</th>
<th scope="col">Min</th>
<th scope="col">max</th>
<th scope="col">Total</th>
<th scope="col">Unit</th>
<th scope="col">action</th>
</tr>
</thead>
<tbody>
@foreach($ProductPrices as $ProductPrice)
<tr>
<th scope="row">{{$loop->iteration}}</th>
<td>
@if($ProductPrice->type=="negotiable")
Negotiable price
@elseif($ProductPrice->type=="qbp")
Quantity based on price
@elseIf($ProductPrice->type=="pbq")
Price based on quantity
@endif
</td>
<td>{{$ProductPrice->min}}</td>
<td>{{$ProductPrice->max}}</td>
<td>{{$ProductPrice->total}}</td>
<td>{{$ProductPrice->unit}}</td>
<td>
<a href="{{route('user.delete.price',$ProductPrice->id)}}" class="btn btn-warning" onclick="return confirm('Are you sure to delete this?')">
Delete
</a>
</td>
@endforeach
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('script')
<script>
function show1(){
document.getElementById('div1').style.display ='block';
document.getElementById('div2').style.display = 'none';
document.getElementById('div3').style.display = 'none';
}
function show2(){
document.getElementById('div1').style.display ='none';
document.getElementById('div2').style.display ='block';
document.getElementById('div3').style.display = 'none';
}
function show3(){
document.getElementById('div1').style.display ='none';
document.getElementById('div2').style.display ='none';
document.getElementById('div3').style.display = 'block';
}
</script>
@endpush