ok

Mini Shell

Direktori : /home2/selectio/www/a1tex.in/storage/framework/views/
Upload File :
Current File : /home2/selectio/www/a1tex.in/storage/framework/views/b87a8feda253b0462d13e3c42051cf40186f1c1e.php

<?php $__env->startSection('title', \App\CPU\translate('Product Add')); ?>

<?php $__env->startPush('css_or_js'); ?>
    <link href="<?php echo e(asset('public/assets/back-end/css/tags-input.min.css')); ?>" rel="stylesheet">
    <link href="<?php echo e(asset('public/assets/select2/css/select2.min.css')); ?>" rel="stylesheet">
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="content container-fluid">
        <!-- Page Title -->
        <div class="d-flex flex-wrap gap-2 align-items-center mb-3">
            <h2 class="h1 mb-0 d-flex gap-2">
                <img src="<?php echo e(asset('/public/assets/back-end/img/inhouse-product-list.png')); ?>" alt="">
                <?php echo e(\App\CPU\translate('Add')); ?> <?php echo e(\App\CPU\translate('New')); ?> <?php echo e(\App\CPU\translate('Product')); ?>

            </h2>
        </div>
        <!-- End Page Title -->

        <!-- Content Row -->
        <div class="row">
            <div class="col-md-12">
                <form class="product-form" action="<?php echo e(route('admin.product.store')); ?>" method="POST"
                      style="text-align: <?php echo e(Session::get('direction') === 'rtl' ? 'right' : 'left'); ?>;"
                      enctype="multipart/form-data" id="product_form">
                    <?php echo csrf_field(); ?>
                    <div class="card">
                        <div class="px-4 pt-3">
                            <?php ($language = \App\Model\BusinessSetting::where('type', 'pnc_language')->first()); ?>
                            <?php ($language = $language->value ?? null); ?>
                            <?php ($default_lang = 'en'); ?>

                            <?php ($default_lang = json_decode($language)[0]); ?>
                            <ul class="nav nav-tabs w-fit-content mb-4">
                                <?php $__currentLoopData = json_decode($language); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lang): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <li class="nav-item">
                                        <a class="nav-link text-capitalize lang_link <?php echo e($lang == $default_lang ? 'active' : ''); ?>"
                                           href="#"
                                           id="<?php echo e($lang); ?>-link"><?php echo e(\App\CPU\Helpers::get_language_name($lang) . '(' . strtoupper($lang) . ')'); ?></a>
                                    </li>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </div>

                        <div class="card-body">
                            <?php $__currentLoopData = json_decode($language); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lang): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="<?php echo e($lang != $default_lang ? 'd-none' : ''); ?> lang_form"
                                     id="<?php echo e($lang); ?>-form">
                                    <div class="form-group">
                                        <label class="title-color"
                                               for="<?php echo e($lang); ?>_name"><?php echo e(\App\CPU\translate('name')); ?>

                                            (<?php echo e(strtoupper($lang)); ?>)
                                        </label>
                                        <input type="text" <?php echo e($lang == $default_lang ? 'required' : ''); ?> name="name[]"
                                               id="<?php echo e($lang); ?>_name" class="form-control" placeholder="New Product">
                                    </div>
                                    <input type="hidden" name="lang[]" value="<?php echo e($lang); ?>">
                                    <div class="form-group pt-4">
                                        <label class="title-color"
                                               for="<?php echo e($lang); ?>_description"><?php echo e(\App\CPU\translate('description')); ?>

                                            (<?php echo e(strtoupper($lang)); ?>)</label>
                                        <textarea name="description[]" class="textarea editor-textarea"><?php echo e(old('details')); ?></textarea>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    </div>

                    <div class="card mt-2 rest-part">
                        <div class="card-header">
                            <h4 class="mb-0"><?php echo e(\App\CPU\translate('General Info')); ?></h4>
                        </div>
                        <div class="card-body">
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-4">

                                        <label for="name" class="title-color"><?php echo e(\App\CPU\translate('product_type')); ?></label>
                                        <select name="product_type" id="product_type" class="form-control" required>
                                            <option value="physical" selected><?php echo e(\App\CPU\translate('physical')); ?></option>
                                            <?php if($digital_product_setting): ?>
                                                <option value="digital"><?php echo e(\App\CPU\translate('digital')); ?></option>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                    <div class="col-md-4" id="digital_product_type_show">
                                        <label for="digital_product_type" class="title-color"><?php echo e(\App\CPU\translate("digital_product_type")); ?></label>
                                        <select name="digital_product_type" id="digital_product_type" class="form-control" required>
                                            <option value="<?php echo e(old('category_id')); ?>" selected disabled>---<?php echo e(\App\CPU\translate('Select')); ?>---</option>
                                            <option value="ready_after_sell"><?php echo e(\App\CPU\translate("Ready After Sell")); ?></option>
                                            <option value="ready_product"><?php echo e(\App\CPU\translate("Ready Product")); ?></option>
                                        </select>
                                    </div>
                                    <div class="col-md-4" id="digital_file_ready_show">
                                        <label for="digital_file_ready" class="title-color"><?php echo e(\App\CPU\translate("ready_product_upload")); ?></label>
                                        <input type="file" name="digital_file_ready" id="digital_file_ready" class="form-control">
                                        <div class="mt-1 text-info">File type: jpg, jpeg, png, gif, zip, pdf</div>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-4">
                                        <label for="name" class="title-color"><?php echo e(\App\CPU\translate('Category')); ?></label>
                                        <select class="js-example-basic-multiple form-control" name="category_id"
                                                onchange="getRequest('<?php echo e(url('/')); ?>/admin/product/get-categories?parent_id='+this.value,'sub-category-select','select')"
                                                required>
                                            <option value="<?php echo e(old('category_id')); ?>" selected disabled>---<?php echo e(\App\CPU\translate('Select')); ?>---</option>
                                            <?php $__currentLoopData = $cat; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($c['id']); ?>"
                                                    <?php echo e(old('name') == $c['id'] ? 'selected' : ''); ?>>
                                                    <?php echo e($c['name']); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <div class="col-md-4">
                                        <label for="name" class="title-color"><?php echo e(\App\CPU\translate('Sub Category')); ?></label>
                                        <select class="js-example-basic-multiple form-control" name="sub_category_id"
                                                id="sub-category-select"
                                                onchange="getRequest('<?php echo e(url('/')); ?>/admin/product/get-categories?parent_id='+this.value,'sub-sub-category-select','select')">
                                        </select>
                                    </div>
                                    <div class="col-md-4">
                                        <label for="name" class="title-color"><?php echo e(\App\CPU\translate('Sub Sub Category')); ?></label>
                                        <select class="js-example-basic-multiple form-control" name="sub_sub_category_id"
                                                id="sub-sub-category-select">

                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label class="title-color"
                                                   for="exampleFormControlInput1"><?php echo e(\App\CPU\translate('product_code_sku')); ?>

                                                <span class="text-danger">*</span>
                                                <a class="style-one-pro cursor-pointer" onclick="document.getElementById('generate_number').value = getRndInteger()"><?php echo e(\App\CPU\translate('generate')); ?>

                                                    <?php echo e(\App\CPU\translate('code')); ?></a></label>
                                            <input type="text" minlength="6" id="generate_number" name="code"
                                                   class="form-control" value="<?php echo e(old('code')); ?>"
                                                   placeholder="<?php echo e(\App\CPU\translate('code')); ?>" required>
                                        </div>
                                    </div>
                                    <?php if($brand_setting): ?>
                                        <div class="col-md-4">
                                            <label for="name" class="title-color"><?php echo e(\App\CPU\translate('Brand')); ?></label>
                                            <select
                                                class="js-example-basic-multiple js-states js-example-responsive form-control"
                                                name="brand_id" required>
                                                <option value="<?php echo e(null); ?>" selected disabled>
                                                    ---<?php echo e(\App\CPU\translate('Select')); ?>---</option>
                                                <?php $__currentLoopData = $br; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($b['id']); ?>"><?php echo e($b['name']); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                    <?php endif; ?>

                                    <div class="col-md-4 physical_product_show">
                                        <label for="name" class="title-color"><?php echo e(\App\CPU\translate('Unit')); ?></label>
                                        <select class="js-example-basic-multiple form-control" name="unit">
                                            <?php $__currentLoopData = \App\CPU\Helpers::units(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $x): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($x); ?>" <?php echo e(old('unit') == $x ? 'selected' : ''); ?>>
                                                    <?php echo e($x); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="card mt-2 rest-part physical_product_show">
                                <div class="card-header">
                                    <h4 class="mb-0"><?php echo e(\App\CPU\translate('Variations')); ?></h4>
                                </div>
                                <div class="card-body">
                                    <div class="row align-items-end">
                                        <div class="col-md-6">
                                            <div class="mb-3 d-flex align-items-center gap-2">
                                                <label for="colors" class="title-color mb-0">
                                                    <?php echo e(\App\CPU\translate('Colors')); ?> :
                                                </label>
                                                <label class="switcher">
                                                    <input type="checkbox" class="switcher_input" id="color_switcher" value="<?php echo e(old('colors_active')); ?>"
                                                           name="colors_active">
                                                    <span class="switcher_control"></span>
                                                </label>
                                            </div>
                                            <select
                                                class="js-example-basic-multiple js-states js-example-responsive form-control color-var-select"
                                                name="colors[]" multiple="multiple" id="colors-selector" disabled>
                                                <?php $__currentLoopData = \App\Model\Color::orderBy('name', 'asc')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $color): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($color->code); ?>">
                                                        <?php echo e($color['name']); ?>

                                                    </option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>

                                        <div class="col-md-6">
                                            <label for="attributes" class="title-color">
                                                <?php echo e(\App\CPU\translate('Attributes')); ?> :
                                            </label>
                                            <select
                                                class="js-example-basic-multiple js-states js-example-responsive form-control"
                                                name="choice_attributes[]" id="choice_attributes" multiple="multiple">
                                                <?php $__currentLoopData = \App\Model\Attribute::orderBy('name', 'asc')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($a['id']); ?>">
                                                        <?php echo e($a['name']); ?>

                                                    </option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>

                                        <div class="col-md-12 mt-2 mb-2">
                                            <div class="customer_choice_options" id="customer_choice_options"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="card mt-2 rest-part">
                                <div class="card-header">
                                    <h4 class="mb-0"><?php echo e(\App\CPU\translate('Product price & stock')); ?></h4>
                                </div>
                                <div class="card-body">
                                    <div class="row align-items-end">
                                        <div class="col-md-6 form-group">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('Unit price')); ?></label>
                                            <input type="number" min="0" step="0.01"
                                                   placeholder="<?php echo e(\App\CPU\translate('Unit price')); ?>" name="unit_price"
                                                   value="<?php echo e(old('unit_price')); ?>" class="form-control" required>
                                        </div>
                                        <div class="col-md-6 form-group">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('Purchase price')); ?></label>
                                            <input type="number" min="0" step="0.01"
                                                   placeholder="<?php echo e(\App\CPU\translate('Purchase price')); ?>"
                                                   value="<?php echo e(old('purchase_price')); ?>" name="purchase_price"
                                                   class="form-control" required>
                                        </div>
                                        <div class="col-md-4 form-group">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('Tax')); ?></label>
                                            <label class="text-info"><?php echo e(\App\CPU\translate('Percent')); ?> ( % )</label>
                                            <input type="number" min="0" value="0" step="0.01"
                                                   placeholder="<?php echo e(\App\CPU\translate('Tax')); ?>" name="tax"
                                                   value="<?php echo e(old('tax')); ?>" class="form-control">
                                            <input name="tax_type" value="percent" class="d-none">
                                        </div>

                                        <div class="col-md-2 form-group">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('Tax_Model')); ?></label>
                                            <select name="tax_model" class="form-control" required>
                                                <option value="include"><?php echo e(\App\CPU\translate("include")); ?></option>
                                                <option value="exclude"><?php echo e(\App\CPU\translate("exclude")); ?></option>
                                            </select>
                                        </div>

                                        <div class="col-md-4 form-group">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('Discount')); ?></label>
                                            <input type="number" min="0" value="0"
                                                   step="0.01" placeholder="<?php echo e(\App\CPU\translate('Discount')); ?>"
                                                   name="discount" class="form-control" required>
                                        </div>
                                        <div class="col-md-2 form-group">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('Discount_Type')); ?></label>
                                            <select class="form-control"
                                                    name="discount_type">
                                                <option value="flat"><?php echo e(\App\CPU\translate('Flat')); ?></option>
                                                <option value="percent"><?php echo e(\App\CPU\translate('Percent')); ?></option>
                                            </select>
                                        </div>

                                        <div class="col-12 form-group sku_combination" id="sku_combination"></div>

                                        <div class="col-md-3 form-group physical_product_show" id="quantity">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('total')); ?>

                                                <?php echo e(\App\CPU\translate('Quantity')); ?></label>
                                            <input type="number" min="0" value="0" step="1"
                                                   placeholder="<?php echo e(\App\CPU\translate('Quantity')); ?>" name="current_stock"
                                                   class="form-control" required>
                                        </div>
                                        <div class="col-md-3 form-group" id="minimum_order_qty">
                                            <label class="title-color">
                                                <?php echo e(\App\CPU\translate('minimum_order_quantity')); ?></label>
                                            <input type="number" min="1" value="1" step="1"
                                                   placeholder="<?php echo e(\App\CPU\translate('minimum_order_quantity')); ?>" name="minimum_order_qty"
                                                   class="form-control" required>
                                        </div>
                                        <div class="col-md-3 form-group physical_product_show" id="shipping_cost">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('shipping_cost')); ?> </label>
                                            <input type="number" min="0" value="0" step="1"
                                                   placeholder="<?php echo e(\App\CPU\translate('shipping_cost')); ?>" name="shipping_cost"
                                                   class="form-control" required>
                                        </div>
                                        <div class="col-md-3 form-group physical_product_show" id="shipping_cost_multy">
                                            <div>
                                                <label
                                                    class="title-color"><?php echo e(\App\CPU\translate('shipping_cost_multiply_with_quantity')); ?>

                                                </label>
                                            </div>
                                            <div>
                                                <label class="switcher">
                                                    <input type="checkbox" class="switcher_input" name="multiplyQTY">
                                                    <span class="switcher_control"></span>
                                                </label>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="card mt-2 mb-2 rest-part">
                                <div class="card-header">
                                    <h5 class="card-title">
                                        <span><?php echo e(\App\CPU\translate('tags')); ?></span>
                                    </h5>
                                </div>
                                <div class="card-body pb-0">
                                    <div class="row g-2">
                                        <div class="col-12">
                                            <div class="form-group">
                                                <label class="title-color"><?php echo e(\App\CPU\translate('search_tags')); ?></label>
                                                <input type="text" class="form-control" name="tags" data-role="tagsinput">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="card mt-2 mb-2 rest-part">
                                <div class="card-header">
                                    <h4 class="mb-0"><?php echo e(\App\CPU\translate('seo_section')); ?></h4>
                                </div>
                                <div class="card-body">
                                    <div class="row">
                                        <div class="col-md-12 form-group">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('Meta Title')); ?></label>
                                            <input type="text" name="meta_title" placeholder="" class="form-control">
                                        </div>

                                        <div class="col-md-8 form-group">
                                            <label class="title-color"><?php echo e(\App\CPU\translate('Meta Description')); ?></label>
                                            <textarea rows="10" type="text" name="meta_description" class="form-control"></textarea>
                                        </div>

                                        <div class="col-md-4 form-group">
                                            <div class="">
                                                <label class="title-color"><?php echo e(\App\CPU\translate('Meta Image')); ?></label>
                                            </div>
                                            <div class="border border-dashed">
                                                <div class="row" id="meta_img"></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="card mt-2 rest-part">
                                <div class="card-body">
                                    <div class="row">
                                        <div class="col-md-12 mb-4">
                                            <div class="mb-2">
                                                <label class="title-color"><?php echo e(\App\CPU\translate('Youtube video link')); ?></label>
                                                <span class="text-info"> (
                                            <?php echo e(\App\CPU\translate('optional, please provide embed link not direct link')); ?>.
                                            )</span>
                                            </div>
                                            <input type="text" name="video_link"
                                                   placeholder="<?php echo e(\App\CPU\translate('EX')); ?> : https://www.youtube.com/embed/5R06LRdUCSE"
                                                   class="form-control" required>
                                        </div>

                                        <div class="col-md-8 form-group">
                                            <div class="mb-2">
                                                <label class="title-color"><?php echo e(\App\CPU\translate('Upload product images')); ?></label>
                                                <span class="text-info">* ( <?php echo e(\App\CPU\translate('ratio')); ?> 1:1 )</span>
                                            </div>
                                            <div id="color_wise_image" class="row g-2 mb-4">
                                            </div>

                                            <div class="p-2 border border-dashed coba-area">
                                                <div class="row" id="coba"></div>
                                            </div>
                                        </div>

                                        <div class="col-md-4 form-group">
                                            <div class="mb-2">
                                                <label for="name" class="title-color text-capitalize"><?php echo e(\App\CPU\translate('Upload thumbnail')); ?></label>
                                                <span class="text-info">* ( <?php echo e(\App\CPU\translate('ratio')); ?> 1:1 )</span>
                                            </div>
                                            <div>
                                                <div class="row" id="thumbnail"></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row justify-content-end gap-3 mt-3">
                                <button type="reset" class="btn btn-secondary"><?php echo e(\App\CPU\translate('reset')); ?></button>
                                <button type="button" onclick="check()" class="btn btn--primary"><?php echo e(\App\CPU\translate('Submit')); ?></button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('script'); ?>
    <script src="<?php echo e(asset('public/assets/back-end')); ?>/js/tags-input.min.js"></script>
    <script src="<?php echo e(asset('public/assets/back-end/js/spartan-multi-image-picker.js')); ?>"></script>
    <script>
        $(function() {
            $('#color_switcher').click(function(){
                var checkBoxes = $("#color_switcher");
                if ($('#color_switcher').prop('checked')) {
                    $('#color_wise_image').show();
                } else {
                    $('#color_wise_image').hide();
                }
            });

            $("#coba").spartanMultiImagePicker({
                fieldName: 'images[]',
                maxCount: 10,
                rowHeight: 'auto',
                groupClassName: 'col-6',
                maxFileSize: '',
                placeholderImage: {
                    image: '<?php echo e(asset('public/assets/back-end/img/400x400/img2.jpg')); ?>',
                    width: '100%',
                },
                dropFileLabel: "Drop Here",
                onAddRow: function(index, file) {

                },
                onRenderedPreview: function(index) {

                },
                onRemoveRow: function(index) {

                },
                onExtensionErr: function(index, file) {
                    toastr.error(
                        '<?php echo e(\App\CPU\translate('Please only input png or jpg type file')); ?>', {
                            CloseButton: true,
                            ProgressBar: true
                        });
                },
                onSizeErr: function(index, file) {
                    toastr.error('<?php echo e(\App\CPU\translate('File size too big')); ?>', {
                        CloseButton: true,
                        ProgressBar: true
                    });
                }
            });

            $("#thumbnail").spartanMultiImagePicker({
                fieldName: 'image',
                maxCount: 1,
                rowHeight: 'auto',
                groupClassName: 'col-12',
                maxFileSize: '',
                placeholderImage: {
                    image: '<?php echo e(asset('public/assets/back-end/img/400x400/img2.jpg')); ?>',
                    width: '100%',
                },
                dropFileLabel: "Drop Here",
                onAddRow: function(index, file) {

                },
                onRenderedPreview: function(index) {

                },
                onRemoveRow: function(index) {

                },
                onExtensionErr: function(index, file) {
                    toastr.error(
                        '<?php echo e(\App\CPU\translate('Please only input png or jpg type file')); ?>', {
                            CloseButton: true,
                            ProgressBar: true
                        });
                },
                onSizeErr: function(index, file) {
                    toastr.error('<?php echo e(\App\CPU\translate('File size too big')); ?>', {
                        CloseButton: true,
                        ProgressBar: true
                    });
                }
            });

            $("#meta_img").spartanMultiImagePicker({
                fieldName: 'meta_image',
                maxCount: 1,
                rowHeight: '280px',
                groupClassName: 'col-12',
                maxFileSize: '',
                placeholderImage: {
                    image: '<?php echo e(asset('public/assets/back-end/img/400x400/img2.jpg')); ?>',
                    width: '90%',
                },
                dropFileLabel: "Drop Here",
                onAddRow: function(index, file) {

                },
                onRenderedPreview: function(index) {

                },
                onRemoveRow: function(index) {

                },
                onExtensionErr: function(index, file) {
                    toastr.error(
                        '<?php echo e(\App\CPU\translate('Please only input png or jpg type file')); ?>', {
                            CloseButton: true,
                            ProgressBar: true
                        });
                },
                onSizeErr: function(index, file) {
                    toastr.error('<?php echo e(\App\CPU\translate('File size too big')); ?>', {
                        CloseButton: true,
                        ProgressBar: true
                    });
                }
            });
        });

        function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function(e) {
                    $('#viewer').attr('src', e.target.result);
                }

                reader.readAsDataURL(input.files[0]);
            }
        }

        $("#customFileUpload").change(function() {
            readURL(this);
        });


        $(".js-example-theme-single").select2({
            theme: "classic"
        });

        $(".js-example-responsive").select2({
            // dir: "rtl",
            width: 'resolve'
        });
    </script>

    <script>
        function getRequest(route, id, type) {
            $.get({
                url: route,
                dataType: 'json',
                success: function(data) {
                    if (type == 'select') {
                        $('#' + id).empty().append(data.select_tag);
                    }
                },
            });
        }

        $('input[name="colors_active"]').on('change', function() {
            if (!$('input[name="colors_active"]').is(':checked')) {
                $('#colors-selector').prop('disabled', true);
            } else {
                $('#colors-selector').prop('disabled', false);
            }
        });

        $('#choice_attributes').on('change', function() {
            $('#customer_choice_options').html(null);
            $.each($("#choice_attributes option:selected"), function() {
                //console.log($(this).val());
                add_more_customer_choice_option($(this).val(), $(this).text());
            });
        });

        function add_more_customer_choice_option(i, name) {
            let n = name.split(' ').join('');
            $('#customer_choice_options').append(
                '<div class="row"><div class="col-md-3"><input type="hidden" name="choice_no[]" value="' + i +
                '"><input type="text" class="form-control" name="choice[]" value="' + n +
                '" placeholder="<?php echo e(trans('Choice Title')); ?>" readonly></div><div class="col-lg-9"><input type="text" class="form-control" name="choice_options_' +
                i +
                '[]" placeholder="<?php echo e(trans('Enter choice values')); ?>" data-role="tagsinput" onchange="update_sku()"></div></div>'
            );

            $("input[data-role=tagsinput], select[multiple][data-role=tagsinput]").tagsinput();
        }

        $('#colors-selector').on('change', function() {
            update_sku();
            $('#color_switcher').prop('checked')
            {
                color_wise_image($('#colors-selector'));
            }
        });

        function color_wise_image(t){
            let colors = t.val();
            $('#color_wise_image').html('')
            $.each(colors, function(key, value){
                let value_id = value.replace('#','');
                let color= "color_image_"+value_id;

                let html = ` <div class='col-6 col-md-6 col-lg-4'> <label style='border: 2px dashed #ddd; border-radius: 3px; cursor: pointer; text-align: center; overflow: hidden; padding: 5px; margin-top: 5px; margin-bottom : 5px; position : relative; display: flex; align-items: center; margin: auto; justify-content: center; flex-direction: column;'>
                                <span class="upload--icon" style="background: ${value}">
                                <i class="tio-edit"></i>
                                    <input type="file" name="`+color+`" id="`+value_id+`" class="d-none" accept=".jpg, .png, .jpeg, .gif, .bmp, .tif, .tiff|image/*" required="">
                                </span>
                                <img src="<?php echo e(asset('public/assets/back-end/img/400x400/img2.jpg')); ?>" style="object-fit: cover;aspect-ratio:1"  alt="public/img">
                              </label> </div>`;
                $('#color_wise_image').append(html)

                $("#color_wise_image input[type='file']").each(function () {

                    var $this = $(this).closest('label');

                    function proPicURL(input) {
                        if (input.files && input.files[0]) {
                            var uploadedFile = new FileReader();
                            uploadedFile.onload = function (e) {
                                $this.find('img').attr('src', e.target.result);
                                $this.fadeIn(300);
                            };
                            uploadedFile.readAsDataURL(input.files[0]);
                        }
                    }
                    $(this)
                        .on("change", function () {
                            proPicURL(this);
                        });
                });
            });
        }

        function color_image_package(color){
            $("#"+color).spartanMultiImagePicker({
                fieldName: 'color_images',
                maxCount: 1,
                rowHeight: 'auto',
                groupClassName: 'col-12',
                maxFileSize: '',
                placeholderImage: {
                    image: '<?php echo e(asset('public/assets/back-end/img/400x400/img2.jpg')); ?>',
                    width: '100%',
                },
                dropFileLabel: "Drop Here",
                onAddRow: function(index, file) {

                },
                onRenderedPreview: function(index) {

                },
                onRemoveRow: function(index) {

                },
                onExtensionErr: function(index, file) {
                    toastr.error(
                        '<?php echo e(\App\CPU\translate('Please only input png or jpg type file')); ?>', {
                            CloseButton: true,
                            ProgressBar: true
                        });
                },
                onSizeErr: function(index, file) {
                    toastr.error('<?php echo e(\App\CPU\translate('File size too big')); ?>', {
                        CloseButton: true,
                        ProgressBar: true
                    });
                }
            });
        }

        $('input[name="unit_price"]').on('keyup', function() {
            let product_type = $('#product_type').val();
            if(product_type === 'physical') {
                update_sku();
            }
        });

        function update_sku() {
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            $.ajax({
                type: "POST",
                url: '<?php echo e(route('admin.product.sku-combination')); ?>',
                data: $('#product_form').serialize(),
                success: function(data) {
                    $('#sku_combination').html(data.view);
                    if (data.length > 1) {
                        $('#quantity').hide();
                    } else {
                        $('#quantity').show();
                    }
                }
            });
        }

        $(document).ready(function() {
            // color select select2
            $('.color-var-select').select2({
                templateResult: colorCodeSelect,
                templateSelection: colorCodeSelect,
                escapeMarkup: function(m) {
                    return m;
                }
            });

            function colorCodeSelect(state) {
                var colorCode = $(state.element).val();
                if (!colorCode) return state.text;
                return "<span class='color-preview' style='background-color:" + colorCode + ";'></span>" + state
                    .text;
            }
        });
    </script>

    <script>
        function check() {
            Swal.fire({
                title: '<?php echo e(\App\CPU\translate('Are you sure')); ?>?',
                text: '<?php echo e(\App\CPU\translate('Want to add this product')); ?>',
                type: 'warning',
                showCancelButton: true,
                cancelButtonColor: 'default',
                confirmButtonColor: '#377dff',
                cancelButtonText: 'No',
                confirmButtonText: 'Yes',
                reverseButtons: true
            }).then((result) => {
                if (result.value) {
                    for (instance in CKEDITOR.instances) {
                        CKEDITOR.instances[instance].updateElement();
                    }
                    var formData = new FormData(document.getElementById('product_form'));
                    $.ajaxSetup({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        }
                    });
                    $.post({
                        url: '<?php echo e(route('admin.product.store')); ?>',
                        data: formData,
                        contentType: false,
                        processData: false,
                        success: function (data) {
                            // console.log(data.errors);
                            // return false;
                            if (data.errors) {
                                for (var i = 0; i < data.errors.length; i++) {
                                    toastr.error(data.errors[i].message, {
                                        CloseButton: true,
                                        ProgressBar: true
                                    });
                                }
                            } else {
                                toastr.success(
                                    '<?php echo e(\App\CPU\translate('product added successfully')); ?>!', {
                                        CloseButton: true,
                                        ProgressBar: true
                                    });
                                $('#product_form').submit();
                            }
                        }
                    });
                }
            })
        };
    </script>

    <script>
        $(".lang_link").click(function(e) {
            e.preventDefault();
            $(".lang_link").removeClass('active');
            $(".lang_form").addClass('d-none');
            $(this).addClass('active');

            let form_id = this.id;
            let lang = form_id.split("-")[0];
            console.log(lang);
            $("#" + lang + "-form").removeClass('d-none');
            if (lang == '<?php echo e($default_lang); ?>') {
                $(".rest-part").removeClass('d-none');
            } else {
                $(".rest-part").addClass('d-none');
            }
        })

        $(document).ready(function(){
            product_type();
            digital_product_type();

            $('#product_type').change(function(){
                product_type();
            });

            $('#digital_product_type').change(function(){
                digital_product_type();
            });

            $('#color_wise_image').hide();
        });

        function product_type(){
            let product_type = $('#product_type').val();

            if(product_type === 'physical'){
                $('#digital_product_type_show').hide();
                $('#digital_file_ready_show').hide();
                $('.physical_product_show').show();
                $('#digital_product_type').val($('#digital_product_type option:first').val());
                $('#digital_file_ready').val('');
            }else if(product_type === 'digital'){
                $('#digital_product_type_show').show();
                $('.physical_product_show').hide();

            }
        }

        function digital_product_type(){
            let digital_product_type = $('#digital_product_type').val();
            if (digital_product_type === 'ready_product') {
                $('#digital_file_ready_show').show();
            } else if (digital_product_type === 'ready_after_sell') {
                $('#digital_file_ready_show').hide();
                $("#digital_file_ready").val('');
            }
        }
    </script>

    
    <script src="<?php echo e(asset('/')); ?>vendor/ckeditor/ckeditor/ckeditor.js"></script>
    <script src="<?php echo e(asset('/')); ?>vendor/ckeditor/ckeditor/adapters/jquery.js"></script>
    <script>
        $('.textarea').ckeditor({
            contentsLangDirection: '<?php echo e(Session::get('direction')); ?>',
        });
    </script>

    
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.back-end.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home2/selectio/public_html/myclassicfit.com/resources/views/admin-views/product/add-new.blade.php ENDPATH**/ ?>

Zerion Mini Shell 1.0