@extends('layouts.app') @section('content')

@lang('lang_v1.edit_smart_discounts')

{!! Form::open(['url' => action([\App\Http\Controllers\DiscountController::class, 'update_smart_discount'], [$discount->id]), 'method' => 'PUT', 'id' => 'update_discount_form']) !!}
{!! Form::label('name', __('sale.discount_name') . ':') !!} {!! Form::text('name', $discount->name, ['class' => 'form-control', 'required', 'placeholder' => __('sale.discount_name')]); !!}
{!! Form::label('start_date', __('sale.discount_start_date') . ':*') !!}
{!! Form::text('start_date', $start_date, ['class' => 'form-control datetimepicker', 'required']); !!}
{!! Form::label('end_date', __('sale.discount_end_date') . ':*') !!}
{!! Form::text('end_date', $end_date, ['class' => 'form-control datetimepicker', 'required']); !!}
{!! Form::label('business_id', __('sale.business_location') . ':') !!} {!! Form::select('business_id[]', $locations, $businessLocations->pluck('id'), [ 'class' => 'form-control select2', 'multiple' => 'multiple', 'required' => true, 'style' => 'width: 100%;' ]) !!}
{!! Form::label('user_id', __('sale.user') . ':') !!} {!! Form::select('user_id[]', $usersCollection->mapWithKeys(function ($user) { return [ $user->id => $user->id == 0 ? __('lang_v1.all_users') : ($user->first_name . ' ' . $user->last_name) ]; }), $selectedUserModels->pluck('id'), [ 'class' => 'form-control select2', 'required', 'multiple', 'id' => 'user_id_select' ]) !!}
{!! Form::label('contact_id', __('sale.contact') . ':') !!} {!! Form::select('contact_id[]', $contacts, $conactsModels->pluck('id'), [ 'class' => 'form-control select2', 'multiple' => 'multiple', 'style' => 'width: 100%;' ]) !!}
{!! Form::label('type_smart_root_discount_id', __('sale.discount_type') . ':') !!} {!! Form::select('type_smart_root_discount_id', $discountTypes, $discount->type_smart_root_discount_id, ['class' => 'form-control', 'required', 'placeholder' => __('sale.discount_type'), 'disabled']); !!}
@if($discount->type_smart_root_discount_id == 1) @foreach($statusDiscount as $smartDiscount)
{!! Form::label('', __('sale.invoice_amount')) !!} {!! Form::text("invoice_amount[]", @num_format($smartDiscount->invoice_amount), [ 'class' => 'form-control invoice-amount input_number', 'required', ]) !!}
{!! Form::label('', __('sale.discount_amount')) !!} {!! Form::text("discount_amount[]", @num_format($smartDiscount->discount_amount), [ 'class' => 'form-control discount-amount input_number', 'required', ]) !!}

@lang('messages.Any_invoice_will_reach_total_amount_of') {{ @num_format($smartDiscount->invoice_amount) }} @lang('messages.The_smart_discount_will_be') {{ @num_format($smartDiscount->discount_amount) }}

@endforeach @endif
{!! Form::close() !!}
@endsection @section('javascript') @endsection