<!-- Edit discount Modal -->
<div class="modal fade" tabindex="-1" role="dialog" id="posEditDiscountModal">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">
					@if($is_discount_enabled)
						@lang('sale.discount')
					@endif
					@if($is_rp_enabled)
						{{session('business.rp_name')}}
					@endif
				</h4>
			</div>
			<div class="modal-body">
				<div class="row @if(!$is_discount_enabled) hide @endif">
					<div class="col-md-12">
						<h4 class="modal-title">@lang('sale.edit_discount'):</h4>
					</div>
					<div class="col-md-6">
				        <div class="form-group">
				            {!! Form::label('discount_type_modal', __('sale.discount_type') . ':*' ) !!}
				            <div class="input-group">
				                <span class="input-group-addon">
				                    <i class="fa fa-info"></i>
				                </span>
				                {!! Form::select('discount_type_modal', ['fixed' => __('lang_v1.fixed'), 'percentage' => __('lang_v1.percentage')], $discount_type , ['class' => 'form-control','placeholder' => __('messages.please_select'), 'required']); !!}
				            </div>
				        </div>
				    </div>
				    @php
				    	$max_discount = !is_null(auth()->user()->max_sales_discount_percent) ? auth()->user()->max_sales_discount_percent : '';

				    	//if sale discount is more than user max discount change it to max discount
				    	if($discount_type == 'percentage' && $max_discount != '' && $sales_discount > $max_discount) $sales_discount = $max_discount;
				    @endphp
				    <div class="col-md-6">
				        <div class="form-group">
				            {!! Form::label('discount_amount_modal', __('sale.discount_amount') . ':*' ) !!}
				            <div class="input-group">
				                <span class="input-group-addon">
				                    <i class="fa fa-info"></i>
				                </span>
				                {!! Form::text('discount_amount_modal', @num_format($sales_discount), ['class' => 'form-control input_number', 'data-max-discount' => $max_discount, 'data-max-discount-error_msg' => __('lang_v1.max_discount_error_msg', ['discount' => $max_discount != '' ? @num_format($max_discount) : '']) ]); !!}
				            </div>
				        </div>						
				    </div>
					<div class="numpad_div col-xs-12" id="discount_modal_div" data-type="discount" style="
						display: flex;
						align-items: center;
						justify-content: center;
						padding-right: 25px;">							
						<div class="form-group">									
							<div class="easy-numpad-number-container">
								<table id="discount_modal">
									<thead>
										{{-- <tr>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="top"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">5</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="top"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">10</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="top"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">20</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="top"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">50</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="top"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">100</a></td>
										</tr> --}}
										<tr>
											
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">1</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">2</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">3</a></td>
										</tr>
										<tr>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">4</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">5</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">6</a></td>
										</tr>
										<tr>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">7</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">8</a></td>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">9</a></td>
										</tr>
										<tr>
											<td class="numPadCashDiscountModal" style="padding: 10px;" data-type="middle"><a href="#"  style="padding: 10px ; width: 90px !important; height: 70px !important; ">0</a></td>										
											<!-- <td><a href="."  style="padding: 10px ;">.</a></td> -->
											{{-- <td colspan="2"><a href="#" class="numPadCashDiscountModal" style="padding: 10px ; width: calc(95% + -10px); margin-top:2px; margin-left: 10px;">00</a></td> --}}
											<td style="padding: 10px;" ><a href="#" class="numPadCashDiscountModalClear" id="numPadCashDiscountModalClear" style="padding: 10px ; width: 90px !important; height: 70px !important; ">Clear</a></td>
											<td style="padding: 10px;" ><a href="#" class="numPadCashDiscountModalDel" id="numPadCashDiscountModalDel" style="padding: 10px ; width: 90px !important; height: 70px !important;">DEL</a></td>									
										</tr>
									</thead>
								</table>
							</div>									
						</div>
					</div>
				</div>
				<br>
				<div class="row @if(!$is_rp_enabled) hide @endif">
					<div class="well well-sm bg-light-gray col-md-12">
					<div class="col-md-12">
						<h4 class="modal-title">{{session('business.rp_name')}}:</h4>
					</div>
					<div class="col-md-6">
				        <div class="form-group">
				            {!! Form::label('rp_redeemed_modal', __('lang_v1.redeemed') . ':' ) !!}
				            <div class="input-group">
				                <span class="input-group-addon">
				                    <i class="fa fa-gift"></i>
				                </span>
				                {!! Form::number('rp_redeemed_modal', $rp_redeemed, ['class' => 'form-control', 'data-amount_per_unit_point' => session('business.redeem_amount_per_unit_rp'), 'data-max_points' => $max_available, 'min' => 0, 'data-min_order_total' => session('business.min_order_total_for_redeem') ]); !!}
				                <input type="hidden" id="rp_name" value="{{session('business.rp_name')}}">
				            </div>
				        </div>
				    </div>
				    <div class="col-md-6">
				    	<p><strong>@lang('lang_v1.available'):</strong> <span id="available_rp">{{$max_available}}</span></p>
				    	<h5><strong>@lang('lang_v1.redeemed_amount'):</strong> <span id="rp_redeemed_amount_text">{{@num_format($rp_redeemed_amount)}}</span></h5>
				    </div>
				    </div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-primary" id="posEditDiscountModalUpdate">@lang('messages.update')</button>
			    <button type="button" class="btn btn-default" data-dismiss="modal">@lang('messages.cancel')</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->