Файловый менеджер - Редактировать - /home/clickysoft/public_html/securebeans.clickysoft.net/resources/views/admin/license/edit.blade.php
Назад
@php $license_products = $license->productLicense; $count_rows = count($license_products); @endphp @extends('layouts.admin') @section('content') <div class="content"> @if (\Session::has('success')) <p class="alert alert-danger"> {!! \Session::get('success') !!} </p> @endif @if (\Session::has('error')) <p class="alert alert-danger"> {!! \Session::get('error') !!} </p> @endif <form method="POST" action="{{ route('admin.license.update', [$license->id]) }}" enctype="multipart/form-data" class="from-prevent-multiple-submits"> @method('PUT') @csrf <div class="card"> <div class="card-header ui-sortable-handle"> <div class="row"> <h5 class="ml-2">Edit License</h5> <ul class="nav nav-pills ml-auto"> <li class="nav-item"> <button class="btn btn-success from-prevent-multiple-submits" type="submit">Submit</button> </li> <li class="nav-item ml-2"> <button type="button" onclick="window.location.href='{{ route('admin.license.index') }}'" class="btn btn-warning text-white">Cancel</button> </li> </ul> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-body"> <div class="row"> <div class="col-sm-12"> <div class="card"> <div class="card-body"> <div class="row"> <div class="col-sm-3"> <div class="form-group {{ $errors->has('customer_id') ? 'has-error' : '' }}"> <label class="required" for="customer_id">Customer Name</label> <div style="padding-bottom: 4px"> </div> <select class="form-control select2" name="customer_id" id="customer_id"> <option value="{{ $license->customer_id }}"> {{ $license->customer->name }}</option> @foreach ($customers as $id => $customer) @if (!($customer->id == $license->customer->id)) <option value="{{ $customer->id }}" {{ old('customer_id') == $customer->id ? 'selected' : '' }}> {{ $customer->name }}</option> @else @endif @endforeach </select> @if ($errors->has('customer_id')) <span class="help-block" role="alert">{{ $errors->first('customer_id') }}</span> @endif <span class="help-block">{{ trans('cruds.user.fields.roles_helper') }}</span> </div> </div> <div class="col-sm-3"> <div class="form-group {{ $errors->has('contract_number') ? 'has-error' : '' }}"> <label class="required" for="contract_number">Contract Number</label> <input class="form-control" type="text" name="contract_number" id="contract_number" value="{{ old('contract_number', $license->contract_number) }}"> @if ($errors->has('contract_number')) <span class="help-block" role="alert">{{ $errors->first('contract_number') }}</span> @endif <span class="help-block">{{ trans('cruds.user.fields.name_helper') }}</span> </div> </div> <div class="col-sm-3"> <div class="form-group {{ $errors->has('support_site_id') ? 'has-error' : '' }}"> <label class="required" for="support_site_id">Support Site Id</label> <input class="form-control" type="text" name="support_site_id" id="support_site_id" value="{{ old('support_site_id', $license->support_site_id) }}"> @if ($errors->has('support_site_id')) <span class="help-block" role="alert">{{ $errors->first('support_site_id') }}</span> @endif <span class="help-block">{{ trans('cruds.user.fields.name_helper') }}</span> </div> </div> <div class="col-sm-3"> <div class="form-group {{ $errors->has('file') ? 'has-error' : '' }}"> <label class="" for="file">Uploaded Image/File</label> @if ($license->file == null) <input type="file" name="file" id=""> @elseif (pathinfo($license->file, PATHINFO_EXTENSION) == 'pdf') <input type="hidden" name="old_file" value="{{ $license->file }}" id="old_file"> <div id="parent"> @php $filename=substr($license->file,19); @endphp <button class="close" id="file-edit-btn"> <span>×</span> </button> <a href="/{{ $license->file }}" id="file-edit" download>{{ $filename }}</a> </div> @else <div id="parent"> <button class="close" id="edit-btn"> <span>×</span> </button> <img src="{{asset($license->file) }}" alt="" width="80" height="80" id="edit-img"> </div> @endif @if ($errors->has('file')) <span class="help-block" role="alert">{{ $errors->first('file') }}</span> @endif <span class="help-block">{{ trans('cruds.user.fields.name_helper') }}</span> </div> </div> </div> <div class="row"> <div class="col-sm-6 col-md-6 form-group {{ $errors->has('reseller2') ? 'has-error' : '' }}"> <label for="reseller2">Reseller 2</label> <select class="form-control select2 product" name="reseller2" id="reseller2"> <option value="">Select</option> @foreach ($resellers as $reseller) <option value="{{ $reseller->id }}" {{ old('reseller2') == $reseller->id ? 'selected' : '' }} {{ $reseller->id == $license->reseller2->id ? 'selected' : '' }}> {{ $reseller->name }}</option> @endforeach </select> @if ($errors->has('reseller2')) <span class="help-block" role="alert">{{ $errors->first('reseller2') }}</span> @endif </div> <div class="col-sm-6 col-md-6 form-group {{ $errors->has('reseller1') ? 'has-error' : '' }}"> <label for="reseller1">Reseller 1</label> <select class="form-control select2 product" name="reseller1" id="reseller1"> <option value="">Select</option> @foreach ($resellers as $reseller) <option value="{{ $reseller->id }}" {{ old('reseller1') == $reseller->id ? 'selected' : '' }} @if (old('reseller1') == null) {{ $reseller->id == $license->reseller1->id ? 'selected' : '' }} @endif> {{ $reseller->name }}</option> @endforeach </select> @if ($errors->has('reseller1')) <span class="help-block" role="alert">{{ $errors->first('reseller1') }}</span> @endif </div> </div> </div> </div> </div> </div> </div> </div> </div> <div class="col-sm-12"> <div class="card"> <div class="card-body" id="parent-div"> <div class="row"> <div class="col-sm-12 mt-2 mb-2"> <a class="btn btn-primary float-right ml-2" href="" id="add-more">Add More</a> {{-- <a class="btn btn-primary float-right" href="" id="save-product">Save</a> --}} </div> </div> {{-- {!! '<pre>'.print_r($license_products, true).'</pre>' !!} --}} @for ($i = 0; $i < count(old('product_id', $license_products)); $i++) <div class="row" id="child-div{{ $i }}"> <div class="col-sm-3"> <div class="form-group {{ $errors->has('product_id.' . $i) ? 'has-error' : '' }}"> <label class="required" for="product_id{{ $i }}">Product SKU</label> <select class="form-control select2 product" name="product_id[]" id="product_id{{ $i }}"> @foreach ($products as $product) <option value="{{ $product['id'] }}" {{ old('product_id.' . $i, isset($license_products[$i]) ? $license_products[$i]->product_id : '') == $product['id'] ? 'selected' : '' }}> {{ $product['product_sku'] }}</option> @endforeach </select> @if ($errors->has('product_id.' . $i)) <span class="help-block" role="alert">The Product Sku.{{ $i }} field is reuired.</span> @endif <span class="help-block">{{ trans('cruds.user.fields.roles_helper') }}</span> </div> </div> <div class="col-sm-2"> <div class="form-group {{ $errors->has('start_date.' . $i) ? 'has-error' : '' }}"> <label class="required" for="start_date">Start Date</label> <input class="form-control dat" id="start_date" type="text" autocomplete="off" name="start_date[]" placeholder="dd-mm-yyyy" value="{{ old('start_date.' . $i, isset($license_products[$i]) ? \Carbon\Carbon::parse($license_products[$i]->start_date)->format('d-M-Y') : '') }}"> @if ($errors->has('start_date.' . $i)) <span class="help-block" role="alert">{{ $errors->first('start_date.' . $i) }}</span> @endif <span class="help-block">{{ trans('cruds.user.fields.name_helper') }}</span> </div> </div> <div class="col-sm-2"> <div class="form-group {{ $errors->has('end_date.' . $i) ? 'has-error' : '' }}"> <label class="required" for="end_date">End Date</label> <input class="form-control dat" id="end_date" type="text" autocomplete="off" name="end_date[]" placeholder="dd-mm-yyyy" value="{{ old('end_date.' . $i, isset($license_products[$i]) ? \Carbon\Carbon::parse($license_products[$i]->end_date)->format('d-M-Y') : '') }}"> @if ($errors->has('end_date.' . $i)) <span class="help-block" role="alert">{{ $errors->first('end_date.' . $i) }}</span> @endif <span class="help-block">{{ trans('cruds.user.fields.name_helper') }}</span> </div> </div> <div class="col-sm-3 form-group {{ $errors->has('quantity.' . $i) ? 'has-error' : '' }}"> {{-- <div class="row"> --}} {{-- <div class="col-sm-2 form-group {{ $errors->has('quantity.'.$i) ? 'has-error' : '' }}"> --}} <label class="required" for="quantity{{ $i }}">Quantity</label><br> <input type="button" class="inc-dec" onclick="decrementValue('quantity{{ $i }}')" value="-" /> <input type="text" name="quantity[]" value="{{ old('quantity.' . $i, isset($license_products[$i]) ? $license_products[$i]->quantity : '') }}" maxlength="5" max="10000" id="quantity{{ $i }}" class="quantity" /> <input type="button" class="inc-dec" onclick="incrementValue('quantity{{ $i }}')" value="+" /> @if ($errors->has('quantity.' . $i)) <span class="help-block" role="alert">{{ $errors->first('quantity.' . $i) }}</span> @endif {{-- </div> --}} {{-- </div> --}} </div> <div class="col-sm-2"> @if ($i != 0) <a href="" class="btn btn-danger btn-sm mt-4 remove-btn" id="{{ $i }}"><i class="fa fa-trash"></i></a> @endif </div> </div> @endfor </div> </div> </div> </div> <input type="hidden" name="license_id" value="{{ $license->id }}"> <input type="hidden" name="previous_rows" id="previous-rows" value="{{ $count_rows }}"> </form> </div> @endsection @section('scripts') <script> $(document).ready(function(){ $('.from-prevent-multiple-submits').on('submit', function() { $('.from-prevent-multiple-submits').attr('disabled', 'true'); }); }); $('.dat').datepicker({ format: "d-M-yyyy", }); function incrementValue(elementId) { var value = parseInt(document.getElementById(elementId).value); value = isNaN(value) ? 0 : value; ++value; document.getElementById(elementId).value = value; } function decrementValue(elementId) { var value = parseInt(document.getElementById(elementId).value); value = isNaN(value) ? 0 : value; --value; document.getElementById(elementId).value = value; } var products = {!! json_encode($products) !!}; var count = products.length; $(document).on('click', '#add-more', function(e) { count++; e.preventDefault(); var newRow = '<div class="row selector" id="child-div' + count + '" data-attr="1"><div class="col-sm-3"><div class="form-group"><label class="required" for="product_id' + count + '">Product SKU</label><select class="form-control select2 product" name="product_id[]" id="product_id' + count + '"><option value="">Select</option>'; for (i = 0; i < products.length; i++) { newRow += '<option value="' + products[i].id + '">' + products[i].product_sku + '</option>'; } newRow += '</select></div></div><div class="col-sm-2"><label class="required" for="start_date' + count + '">Start Date</label><input class="dat form-control" id="start-date" autocomplete="off" type="text" name="start_date[]" placeholder="dd-mm-yyyy" id="start_date" value=""></div><div class="col-sm-2"><label class="required" for="end_date' + count + '">End Date</label><input class="dat form-control" type="text" name="end_date[]" placeholder="dd-mm-yyyy"id="end_date" autocomplete="off" value=""></div><div class="col-sm-3"><label class="required" for="quantity' + count + '">Quantity</label><br><input type="button" class="inc-dec" onclick="decrementValue(\'quantity' + count + '\')" value="-" /><input type="text" name="quantity[]" value="0" maxlength="5" max="10000" id="quantity' + count + '" class="quantity"/><input type="button" class="inc-dec" onclick="incrementValue(\'quantity' + count + '\')" value="+" /></div><div class="col-sm-2"><a href="" class="btn btn-danger btn-sm mt-4 remove-btn" id=' + count + '><i class="fa fa-trash"></i></a></div></div></div>'; $('#parent-div').append(newRow); $('.select2').select2(); $(".dat").datepicker({ format: "d-M-yyyy", }); }); $(document).on('click', '.remove-btn', function(e) { e.preventDefault(); var id = $(this).attr("id"); $('#child-div' + id).remove(); }); $('#edit-btn').on('click', function() { $('#parent').html(''); $('#parent').append( '<input type="file" name="file" value="" id="file" accept=".jpg, .jpeg, .png,.pdf">') }) $('#file-edit-btn').on('click', function() { $('#parent').html('') $('#old_file').val(''); $('#parent').append( '<input type="file" name="file" value="" id="file" accept=".jpg, .jpeg, .png,.pdf">') }) </script> @endsection
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка