@extends($templatePathAdmin.'layout')
@section('main')
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header with-border">
<h2 class="card-title">{{ $title_description??'' }}</h2>
<div class="card-tools">
<div class="btn-group float-right mr-5">
<a target=_new href="{{ sc_route_admin('admin_stone.index') }}" class="btn btn-flat btn-default" title="List">
<i class="fa fa-list"></i><span class="hidden-xs"> {{ sc_language_render('admin.back_list') }}</span>
</a>
</div>
</div>
</div>
<!-- /.card-header -->
<!-- form start -->
<form action="{{ sc_route_admin('admin_stone.create') }}" method="post" name="form_name" accept-charset="UTF-8"
class="form-horizontal" id="form-main" enctype="multipart/form-data">
<input type="hidden" name="kind" value="{{ SC_PRODUCT_SINGLE }}">
<div id="main-add" class="card-body">
{{-- descriptions --}}
@foreach ($languages as $code => $language)
<div
class="form-group row {{ $errors->has('descriptions.'.$code.'.name') ? ' text-red' : '' }}">
<label for="{{ $code }}__name"
class="col-sm-2 col-form-label">Stone Name<span class="seo"></span>
</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pencil-alt"></i></span>
</div>
<input type="text" id="name" name="descriptions[{{ $code }}][name]"
value="{{ old('descriptions.'.$code.'.name') }}"
class="form-control input-sm {{ $code.'__name' }}" placeholder="" />
</div>
@if ($errors->has('descriptions.'.$code.'.name'))
<span class="form-text">
<i class="fa fa-info-circle"></i>
{{ $errors->first('descriptions.'.$code.'.name') }}
</span>
@else
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ sc_language_render('admin.max_c',['max'=>200]) }}
</span>
@endif
</div>
</div>
@endforeach
<input type="hidden" name="name" id="stone_name" value="{!! old('name') ?? '' !!}"/>
{{-- //descriptions --}}
{{-- select category --}}
<div class="form-group row kind {{ $errors->has('category') ? ' text-red' : '' }}">
<label for="category" class="col-sm-2 col-form-label">
{{ sc_language_render('product.admin.select_category') }}
</label>
<div class="col-sm-8">
<select class="form-control input-sm category select2"
style="width: 100%;"
name="category">
<option value=""></option>
@foreach ($categories as $k => $v)
<option value="{{ $v }}"> {{ $v }}
</option>
@endforeach
</select>
@if ($errors->has('category'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('category') }}
</span>
@endif
</div>
</div>
{{-- //select category --}}
{{-- images --}}
<div class="form-group row kind {{ $errors->has('image') ? ' text-red' : '' }}">
<label for="image" class="col-sm-2 col-form-label">
{{ sc_language_render('product.image') }}
</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" id="image" name="image" value="{!! old('image') !!}"
class="form-control input-sm image" placeholder="" />
<div class="input-group-append">
<span class="btn btn-primary lfm" data-input="image" data-preview="preview_image" data-type="stone">
<i class="fas fa-image"></i> {{sc_language_render('product.admin.choose_image')}}
</span>
</div>
</div>
@if ($errors->has('image'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('image') }}
</span>
@endif
<div id="preview_image" class="img_holder">
@if (old('image'))
<img src="{{ sc_file(old('image')) }}">
@endif
</div>
</div>
</div>
{{-- //images --}}
{{-- videos --}}
<div class="form-group row kind {{ $errors->has('video') ? ' text-red' : '' }}">
<label for="video" class="col-sm-2 col-form-label">
Video
</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" id="video" name="video" value="{!! old('video') !!}"
class="form-control input-sm video" placeholder="" />
<div class="input-group-append">
<span class="btn btn-primary lfm" data-input="video" data-preview="preview_video" data-type="video">
<i class="fas fa-video"></i> Choose
</span>
</div>
</div>
@if ($errors->has('video'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('video') }}
</span>
@endif
<div id="preview_video" class="video_holder">
@if (old('video'))
<img src="{{ sc_file(old('video')) }}">
@endif
</div>
</div>
</div>
{{-- //videos --}}
{{-- origin --}}
<div class="form-group row kind {{ $errors->has('origin') ? ' text-red' : '' }}">
<label for="origin" class="col-sm-2 col-form-label"> Origin </label>
<div class="col-sm-8">
<div class="input-group">
<select class="form-control" name="origin" aria-required="true" aria-invalid="false">
<option selected disabled>Please Select Origin</option>
<option value="Burma">Burma</option>
<option value="Ceylon">Ceylon</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="African">African</option>
<option value="Australian">Australian</option>
<option value="Italian">Italian</option>
<option value="Sulemani">Sulemani</option>
<option value="Zambina">Zambina</option>
</select>
</div>
@if ($errors->has('origin'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('origin') }}
</span>
@endif
</div>
</div>
{{-- //origin --}}
{{-- color --}}
<div class="form-group row ">
<label for="color" class="col-sm-2 col-form-label">Stone Color</label>
<div class="col-sm-8">
<select class="form-control" name="color" aria-required="true" aria-invalid="false">
<option selected disabled>Please Select Color</option>
<option value="Blue">Blue</option>
<option value="Green">Green</option>
<option value="Yellow">Yellow</option>
<option value="Red">Red</option>
<option value="Orange">Orange</option>
<option value="Pink">Pink</option>
<option value="White">White</option>
<option value="Brown">Brown</option>
<option value="Purple">Purple</option>
<option value="Indigo">Indigo</option>
</select>
</div>
@if ($errors->has('color'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('color') }}
</span>
@endif
</div>
{{-- color --}}
{{-- shape --}}
<div class="form-group row ">
<label for="shape" class="col-sm-2 col-form-label"> Stone Shape</label>
<div class="col-sm-8">
<select class="form-control" name="shape" aria-required="true" aria-invalid="false">
<option selected disabled>Please Select Shape</option>
<option value="Triangular">Triangular</option>
<option value="Oval">Oval</option>
<option value="Round">Round</option>
<option value="Diamond">Diamond</option>
<option value="Octagon">Octagon</option>
<option value="Square">Square</option>
</select>
</div>
@if ($errors->has('shape'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('shape') }}
</span>
@endif
</div>
{{-- //shape --}}
{{-- cut --}}
<div class="form-group row ">
<label for="cut" class="col-sm-2 col-form-label">Stone Cut</label>
<div class="col-sm-8">
<select class="form-control" name="cut" aria-required="true" aria-invalid="false">
<option selected disabled>Please Select Cut</option>
<option value="None">None</option>
<option value="Mix">Mix</option>
</select>
</div>
@if ($errors->has('cut'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('cut') }}
</span>
@endif
</div>
{{-- //cut --}}
{{-- quality --}}
<div class="form-group row ">
<label for="quality" class="col-sm-2 col-form-label">Quality</label>
<div class="col-sm-8">
<select class="form-control" id="gem-quality" name="quality" aria-required="true" aria-invalid="false">
<option selected disabled>Please select quality</option>
<option value="Normal">Normal</option>
<option value="Fine">Fine</option>
<option value="Premium">Premium</option>
<option value="Unique">Unique</option></select>
</div>
@if ($errors->has('quality'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('quality') }}
</span>
@endif
</div>
{{-- //quality --}}
{{-- treatment --}}
<div class="form-group row ">
<label for="treatment" class="col-sm-2 col-form-label">Treatment</label>
<div class="col-sm-8">
<select class="form-control" id="treatment" name="treatment" aria-required="true" aria-invalid="false">
<option selected disabled>Please select treatment</option>
<option value="Unheated and Untreated (Oiling Only)">Unheated and Untreated (Oiling Only)</option>
<option value="Minor Oil - (Certified)">Minor Oil - (Certified)</option>
</select>
</div>
@if ($errors->has('treatment'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('treatment') }}
</span>
@endif
</div>
{{-- //treatment --}}
{{-- sku --}}
<div class="form-group row kind {{ $errors->has('sku') ? ' text-red' : '' }}">
<label for="sku" class="col-sm-2 col-form-label">{{ sc_language_render('product.sku') }}</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pencil-alt"></i></span>
</div>
<input type="text" style="width: 100px;" id="sku" name="sku"
value="{!! old('sku')??'' !!}" class="form-control input-sm sku"
placeholder="" />
</div>
@if ($errors->has('sku'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('sku') }}
</span>
@else
<span class="form-text">
{{ sc_language_render('product.sku_validate') }}
</span>
@endif
</div>
</div>
{{-- //sku --}}
{{-- alias --}}
<input type="hidden" id="alias" name="alias"
value="{!! old('alias')??'' !!}" class="form-control input-sm alias"
placeholder="" />
{{-- //alias --}}
{{-- certification --}}
<input type="hidden" id="certification" name="certification"
value="Drishti Gems Lab" class="form-control input-sm certification"
placeholder="" />
{{-- //certification --}}
@if (sc_config_admin('product_price'))
{{-- price --}}
<div class="form-group row kind {{ $errors->has('price') ? ' text-red' : '' }}">
<label for="price" class="col-sm-2 col-form-label">{{ sc_language_render('product.price') }}</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pencil-alt"></i></span>
</div>
<input type="number" step="0.01" style="width: 100px;" id="price" name="price"
value="{!! old('price')?? '' !!}" class="form-control input-sm price"
placeholder="Price" />
</div>
@if ($errors->has('price'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('price') }}
</span>
@endif
</div>
</div>
{{-- //price --}}
@endif
@if (sc_config_admin('product_weight'))
{{-- weight --}}
<div class="form-group row kind {{ $errors->has('weight') ? ' text-red' : '' }}">
<label for="weight" class="col-sm-2 col-form-label">{{ sc_language_render('product.weight') }}</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pencil-alt"></i></span>
</div>
<input type="number" step="0.01" style="width: 100px;" id="weight" name="weight"
value="{!! old('weight') !!}" class="form-control input-sm weight"
placeholder="Weight" />
</div>
@if ($errors->has('weight'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('weight') }}
</span>
@endif
</div>
</div>
{{-- //weight --}}
@endif
@if (sc_config_admin('product_length'))
{{-- length, height, width --}}
<div class="form-group row kind ">
<label for="length" class="col-sm-2 col-form-label">Measurement</label>
<div class="col-sm-3">
<div class="input-group">
<input type="text" style="width: 100px;" id="length" name="length" value="{!! old('length') !!}" class="form-control input-sm length" placeholder="Length">
</div>
@if ($errors->has('length'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('length') }}
</span>
@endif
</div>
<div class="col-sm-2">
<div class="input-group">
<input type="text" style="width: 100px;" id="height" name="height" value="{!! old('height') !!}" class="form-control input-sm height" placeholder="Height">
</div>
@if ($errors->has('height'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('height') }}
</span>
@endif
</div>
<div class="col-sm-3">
<div class="input-group">
<input type="text" style="width: 100px;" id="width" name="width" value="{!! old('width') !!}" class="form-control input-sm width" placeholder="Width">
</div>
@if ($errors->has('width'))
<span class="form-text">
<i class="fa fa-info-circle"></i> {{ $errors->first('width') }}
</span>
@endif
</div>
</div>
{{-- //length, height, width --}}
@endif
{{-- status --}}
<div class="form-group row ">
<div class="col-sm-8">
<input class="checkbox" type="hidden" name="status" value="1">
</div>
</div>
{{-- //status --}}
{{-- approve --}}
<div class="form-group row ">
<div class="col-sm-8">
<input class="checkbox" type="hidden" name="approve" value="1"/>
</div>
</div>
{{-- //approve --}}
</div>
<!-- /.card-body -->
<div class="card-footer kind row" id="card-footer">
@csrf
<div class="col-md-2">
</div>
<div class="col-md-8">
<div class="btn-group float-right">
<button type="submit" id="submit" class="btn btn-primary">{{ sc_language_render('action.submit') }}</button>
</div>
<div class="btn-group float-left">
<button type="reset" class="btn btn-warning">{{ sc_language_render('action.reset') }}</button>
</div>
</div>
</div>
<!-- /.card-footer -->
</form>
</div>
</div>
</div>
@endsection
@push('styles')
<style>
#start-add {
margin: 20px;
}
.video_holder{
margin-top:15px;
}
</style>
@endpush
@push('scripts')
@include($templatePathAdmin.'component.ckeditor_js')
<script type="text/javascript">
$("[name='property']").change(function() {
if($(this).val() == '{{ SC_PROPERTY_DOWNLOAD }}') {
$('#download_path').show();
} else {
$('#download_path').hide();
}
});
// Promotion
$('#add_product_promotion').click(function(event) {
$(this).before(
'<div class="price_promotion">'
+'<div class="input-group"><div class="input-group-prepend"><span class="input-group-text"><i class="fas fa-pencil-alt"></i></span></div>'
+' <input type="number" step="0.01" id="price_promotion" name="price_promotion" value="0" class="form-control input-sm price" placeholder="" />'
+' <span title="Remove" class="btn btn-flat btn-danger removePromotion"><i class="fa fa-times"></i></span>'
+'</div>'
+'<div class="form-group">'
+' <label>{{ sc_language_render('product.price_promotion_start') }}</label>'
+' <div class="input-group">'
+' <div class="input-group-prepend"><span class="input-group-text"><i class="fa fa-calendar fa-fw"></i></span></div>'
+' <input type="text" style="width: 150px;" id="price_promotion_start" name="price_promotion_start" value="" class="form-control input-sm price_promotion_start date_time" data-date-format="yyyy-mm-dd" placeholder="yyyy-mm-dd" />'
+' </div>'
+' <label>{{ sc_language_render('product.price_promotion_end') }}</label>'
+' <div class="input-group">'
+' <div class="input-group-prepend"><span class="input-group-text"><i class="fa fa-calendar fa-fw"></i></span></div>'
+' <input type="text" style="width: 150px;" id="price_promotion_end" name="price_promotion_end" value="" class="form-control input-sm price_promotion_end date_time" data-date-format="yyyy-mm-dd" placeholder="yyyy-mm-dd" />'
+' </div>'
+' </div>'
+'</div>');
$(this).hide();
$('.removePromotion').click(function(event) {
$(this).closest('.price_promotion').remove();
$('#add_product_promotion').show();
});
$('.date_time').datepicker({
format: 'yy-mm-dd'
})
});
$('.removePromotion').click(function(event) {
$('#add_product_promotion').show();
$(this).closest('.price_promotion').remove();
});
//End promotion
// Add sub images
var id_sub_image = {{ old('sub_image')?count(old('sub_image')):0 }};
$('#add_sub_image').click(function(event) {
id_sub_image +=1;
$(this).before(
'<div class="group-image">'
+'<div class="input-group">'
+' <input type="text" id="sub_image_'+id_sub_image+'" name="sub_image[]" value="" class="form-control input-sm sub_image" placeholder="" />'
+' <div class="input-group-append">'
+' <span data-input="sub_image_'+id_sub_image+'" data-preview="preview_sub_image_'+id_sub_image+'" data-type="stone" class="btn btn-flat btn-primary lfm">'
+' <i class="fa fa-image"></i> {{sc_language_render('product.admin.choose_image')}}'
+' </span>'
+' </div>'
+'<span title="Remove" class="btn btn-flat btn-danger removeImage"><i class="fa fa-times"></i></span>'
+'</div>'
+'<div id="preview_sub_image_'+id_sub_image+'" class="img_holder"></div>'
+'</div>');
$('.removeImage').click(function(event) {
$(this).closest('div').remove();
});
$('.lfm').filemanager();
});
$('.removeImage').click(function(event) {
$(this).closest('.group-image').remove();
});
//end sub images
// Add sub videos
var id_sub_video = {{ old('sub_video')?count(old('sub_video')):0 }};
$('#add_sub_video').click(function(event) {
id_sub_video +=1;
$(this).before(
'<div class="group-video">'
+'<div class="input-group">'
+' <input type="text" id="sub_video_'+id_sub_video+'" name="sub_video[]" value="" class="form-control input-sm sub_video" placeholder="" />'
+' <div class="input-group-append">'
+' <span data-input="sub_video_'+id_sub_video+'" data-preview="preview_sub_video_'+id_sub_video+'" data-type="video" class="btn btn-flat btn-primary lfm">'
+' <i class="fa fa-video"></i> Choose'
+' </span>'
+' </div>'
+'<span title="Remove" class="btn btn-flat btn-danger removeVideo"><i class="fa fa-times"></i></span>'
+'</div>'
+'<div id="preview_sub_video_'+id_sub_video+'" class="video_holder"></div>'
+'</div>');
$('.removeVideo').click(function(event) {
$(this).closest('div').remove();
});
$('.lfm').filemanager();
});
$('.removeVideo').click(function(event) {
$(this).closest('.group-video').remove();
});
//end sub videos
// Select product attributes
$('.add_attribute').click(function(event) {
var htmlProductAtrribute = '{!! $htmlProductAtrribute ??'' !!}';
var attGroup = $(this).attr("data-id");
htmlProductAtrribute = htmlProductAtrribute.replace(/attribute_group/gi, attGroup);
htmlProductAtrribute = htmlProductAtrribute.replace("attribute_value", "");
htmlProductAtrribute = htmlProductAtrribute.replace("add_price_value", "0");
$(this).closest('tr').before(htmlProductAtrribute);
$('.removeAttribute').click(function(event) {
$(this).closest('tr').remove();
});
});
$('.removeAttribute').click(function(event) {
$(this).closest('tr').remove();
});
//end select attributes
// image
// with plugin options
// $("input.image").fileinput({"browseLabel":"Browse","cancelLabel":"Cancel","showRemove":true,"showUpload":false,"dropZoneEnabled":false});
/* process_form(); */
$('textarea.editor').ckeditor(
{
filebrowserImageBrowseUrl: '{{ sc_route_admin('admin.home').'/'.config('lfm.url_prefix') }}?type=stone',
filebrowserImageUploadUrl: '{{ sc_route_admin('admin.home').'/'.config('lfm.url_prefix') }}/upload?type=stone&_token={{csrf_token()}}',
filebrowserBrowseUrl: '{{ sc_route_admin('admin.home').'/'.config('lfm.url_prefix') }}?type=Files',
filebrowserUploadUrl: '{{ sc_route_admin('admin.home').'/'.config('lfm.url_prefix') }}/upload?type=file&_token={{csrf_token()}}',
filebrowserWindowWidth: '900',
filebrowserWindowHeight: '500'
}
);
// var getName = $("#en__name").val(); // this gives textbox value
var getSku = $("#sku").val(); // this gives textbox value
$("#alias").val(getSku); // this will set hidden field value
var getName = $("#name").val(); // this gives textbox value
$("#stone_name").val(getName);
// jQuery(document).ready(UserInfoCtrl);
// function UserInfoCtrl($) {
// var self = this;
// var name = $('#name');
// var sku = $('#sku');
// var alias = $('#alias');
// self.updateName = function(name) {
// var _sku = sku.val() || (alias.val() || '').trim().split(' ').pop();
// alias.val(name + ' ' + _sku);
// };
// self.updateSku = function(sku) {
// var _name = name.val() || (alias.val() || '').trim().split(' ').shift();
// alias.val(_name + ' ' + sku);
// };
// self.updateAlias = function(alias) {
// var _alias = (alias || '').trim().split(' ');
// name.val((_alias[0] || ''));
// sku.val((_alias[1] || ''));
// };
// self.onFieldChange = function(e) {
// switch(this.id) {
// case 'name':
// self.updateName(this.value);
// break;
// case 'sku':
// self.updateSku(this.value);
// break;
// case 'alias':
// self.updateAlias(this.value);
// break;
// }
// };
// name.add(sku).add(alias).change(self.onFieldChange);
// form.submit(function(e) {
// e.preventDefault();
// return false;
// });
// }
</script>
@endpush |