123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- @extends('backend.layouts.app')
- @section('content')
- <div class="col-sm-12">
- <div class="card">
- <div class="card-header">
- <h5 class="mb-0 h6">{{ translate('Affiliate Registration Form')}}</h5>
- </div>
- <div class="card-body">
- <form action="{{ route('affiliate.configs.store') }}" method="post" enctype="multipart/form-data">
- @csrf
- <div class="row">
- <div class="col-lg-8 form-horizontal" id="form">
- @foreach (json_decode(\App\Models\AffiliateConfig::where('type', 'verification_form')->first()->value) as $key => $element)
- @if ($element->type == 'text' || $element->type == 'file')
- <div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">
- <input type="hidden" name="type[]" value="{{ $element->type }}">
- <div class="col-lg-3">
- <label class="control-label">{{ ucfirst($element->type) }}</label>
- </div>
- <div class="col-lg-7">
- <input class="form-control" type="text" name="label[]" value="{{ $element->label }}" placeholder="Label">
- </div>
- <div class="col-lg-2"><span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span></div>
- </div>
- @elseif ($element->type == 'select' || $element->type == 'multi_select' || $element->type == 'radio')
- <div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">
- <input type="hidden" name="type[]" value="{{ $element->type }}">
- <input type="hidden" name="option[]" class="option" value="{{ $key }}">
- <div class="col-lg-3">
- <label class="control-label">{{ ucfirst(str_replace('_', ' ', $element->type)) }}</label>
- </div>
- <div class="col-lg-7">
- <input class="form-control" type="text" name="label[]" value="{{ $element->label }}" placeholder="Select Label" style="margin-bottom:10px">
- <div class="customer_choice_options_types_wrap_child">
- @if (is_array(json_decode($element->options)))
- @foreach (json_decode($element->options) as $value)
- <div class="form-group row">
- <div class="col-sm-6 col-sm-offset-4">
- <input class="form-control" type="text" name="options_{{ $key }}[]" value="{{ $value }}" required="">
- </div>
- <div class="col-sm-2"> <span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span></div>
- </div>
- @endforeach
- @endif
- </div>
- <button class="btn btn-success pull-right" type="button" onclick="add_customer_choice_options(this)"><i class="glyphicon glyphicon-plus"></i> Add option</button>
- </div>
- <div class="col-lg-2"><span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span></div>
- </div>
- @endif
- @endforeach
- </div>
- <div class="col-lg-4">
- <ul class="list-group">
- <li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('text')">{{translate('Text Input')}}</li>
- <li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('select')">{{translate('Select')}}</li>
- <li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('multi-select')">{{translate('Multiple Select')}}</li>
- <li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('radio')">{{translate('Radio')}}</li>
- <li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('file')">{{translate('File')}}</li>
- </ul>
- </div>
- </div>
- <div class="form-group mb-0 text-right">
- <button type="submit" class="btn btn-primary">{{translate('Save')}}</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- @endsection
- @section('script')
- <script type="text/javascript">
- var i = 0;
- function add_customer_choice_options(em){
- var j = $(em).closest('.form-group.row').find('.option').val();
- var str = '<div class="form-group row">'
- +'<div class="col-sm-6 col-sm-offset-4">'
- +'<input class="form-control" type="text" name="options_'+j+'[]" value="" required>'
- +'</div>'
- +'<div class="col-sm-2"> <span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
- +'</div>'
- +'</div>'
- $(em).parent().find('.customer_choice_options_types_wrap_child').append(str);
- }
- function delete_choice_clearfix(em){
- $(em).parent().parent().remove();
- }
- function appenddToForm(type){
- //$('#form').removeClass('seller_form_border');
- if(type == 'text'){
- var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
- +'<input type="hidden" name="type[]" value="text">'
- +'<div class="col-lg-3">'
- +'<label class="control-label">Text</label>'
- +'</div>'
- +'<div class="col-lg-7">'
- +'<input class="form-control" type="text" name="label[]" placeholder="Label">'
- +'</div>'
- +'<div class="col-lg-2">'
- +'<span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
- +'</div>'
- +'</div>';
- $('#form').append(str);
- }
- else if (type == 'select') {
- i++;
- var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
- +'<input type="hidden" name="type[]" value="select"><input type="hidden" name="option[]" class="option" value="'+i+'">'
- +'<div class="col-lg-3">'
- +'<label class="control-label">Select</label>'
- +'</div>'
- +'<div class="col-lg-7">'
- +'<input class="form-control" type="text" name="label[]" placeholder="Select Label" style="margin-bottom:10px">'
- +'<div class="customer_choice_options_types_wrap_child">'
- +'</div>'
- +'<button class="btn btn-success pull-right" type="button" onclick="add_customer_choice_options(this)"><i class="glyphicon glyphicon-plus"></i> Add option</button>'
- +'</div>'
- +'<div class="col-lg-2">'
- +'<span class="btn btn-icon btn-circle icon-lg fa fa-times" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
- +'</div>'
- +'</div>';
- $('#form').append(str);
- }
- else if (type == 'multi-select') {
- i++;
- var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
- +'<input type="hidden" name="type[]" value="multi_select"><input type="hidden" name="option[]" class="option" value="'+i+'">'
- +'<div class="col-lg-3">'
- +'<label class="control-label">Multiple select</label>'
- +'</div>'
- +'<div class="col-lg-7">'
- +'<input class="form-control" type="text" name="label[]" placeholder="Multiple Select Label" style="margin-bottom:10px">'
- +'<div class="customer_choice_options_types_wrap_child">'
- +'</div>'
- +'<button class="btn btn-success pull-right" type="button" onclick="add_customer_choice_options(this)"><i class="glyphicon glyphicon-plus"></i> Add option</button>'
- +'</div>'
- +'<div class="col-lg-2">'
- +'<span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
- +'</div>'
- +'</div>';
- $('#form').append(str);
- }
- else if (type == 'radio') {
- i++;
- var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
- +'<input type="hidden" name="type[]" value="radio"><input type="hidden" name="option[]" class="option" value="'+i+'">'
- +'<div class="col-lg-3">'
- +'<label class="control-label">Radio</label>'
- +'</div>'
- +'<div class="col-lg-7">'
- +'<input class="form-control" type="text" name="label[]" placeholder="Radio Label" style="margin-bottom:10px">'
- +'<div class="customer_choice_options_types_wrap_child">'
- +'</div>'
- +'<button class="btn btn-success pull-right" type="button" onclick="add_customer_choice_options(this)"><i class="glyphicon glyphicon-plus"></i> Add option</button>'
- +'</div>'
- +'<div class="col-lg-2">'
- +'<span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
- +'</div>'
- +'</div>';
- $('#form').append(str);
- }
- else if (type == 'file') {
- var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
- +'<input type="hidden" name="type[]" value="file">'
- +'<div class="col-lg-3">'
- +'<label class="control-label">File</label>'
- +'</div>'
- +'<div class="col-lg-7">'
- +'<input class="form-control" type="text" name="label[]" placeholder="Label">'
- +'</div>'
- +'<div class="col-lg-2">'
- +'<span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
- +'</div>'
- +'</div>';
- $('#form').append(str);
- }
- }
- </script>
- @endsection
|