@extends($_layout.'master') @section('title', $page_title??($style?'Cập nhật':'Tạo') . ' style cá nhân') @include($_lib.'register-meta') @php $setData = crazy_arr($style?$style->set_data:[]); $body_shape_id = old('body_shape_id', $setData->body_shape_id); $body_weight = old('weight', $setData->weight(70)); $body_height = old('height', $setData->height(165)); $is_mobile = is_mobile(); $is_update = $action == 'update'; $cond = $is_update && $style && !$errors->first() && count($products = $helper->getSetComboProducts($style)); @endphp @section('content')
@csrf @if ($style) @endif

{{$style?'Cập nhật':'Tạo'}} style cá nhân

@if ($errors->first())
Có vẻ như bạn chưa điền đầy đủ thông tin. Vui lòng kiểm tra lại thông tin của mỗi loại item
@endif
@if ($errors->has('thumbnail'))
{{$errors->first('thumbnail')}}
@endif
@if (count($templateDetail->itemConfigs)) @php $frameWidth = $templateDetail->width; $frameHeight = $templateDetail->height; @endphp @foreach ($templateDetail->itemConfigs as $item) @php $previewConfig = $item->preview_config; $width = $previewConfig['width'] && $previewConfig['width'] > 0?$previewConfig['width']:1; $height = $previewConfig['height'] && $previewConfig['height'] > 0?$previewConfig['height']:1; $oldItemId = old('items.'.$item->id, 0); @endphp
@endforeach @endif
@if (!$is_mobile)
{{$body_height}}cm
{{$body_weight}}kg
@if (count($shapes = get_body_shapes())) @foreach ($shapes as $shape)
@endforeach @endif
End
@endif
@if ($errors->has('name'))
{{$errors->first('name')}}
@endif
@if ($is_mobile)
@if (count($shapes = get_body_shapes())) @foreach ($shapes as $shape)
@endforeach @endif
End
{{$body_height}}cm
{{$body_weight}}kg
@endif @if (count($templateDetail->itemConfigs)) @foreach ($templateDetail->itemConfigs as $item) @php $previewConfig = $item->preview_config; $width = $previewConfig['width'] && $previewConfig['width'] > 0?$previewConfig['width']:1; $height = $previewConfig['height'] && $previewConfig['height'] > 0?$previewConfig['height']:1; $ratio = $height/$width * 100; @endphp
@php $oldItemId = old('items.'.$item->id, 0); @endphp @if (is_mobile())
@if (count($item->templateItems)) @foreach ($item->templateItems as $tempItem)
id==$oldItemId || in_array($tempItem->id, $styleItems)) checked @endif>
@endforeach @endif
End
@else
@if (count($item->templateItems)) @foreach ($item->templateItems as $tempItem)
id==$oldItemId || in_array($tempItem->id, $styleItems)) checked @endif>
@endforeach @endif
@endif @if ($errors->has('items.'.$item->id))
{{$errors->first('items.'.$item->id)}}
@endif @php $attr_values = $style && is_array($style->set_data) && ($set_data = $style->set_data) && array_key_exists('attr_values', $set_data) && is_array($set_data['attr_values']) && array_key_exists($item->id, $set_data['attr_values']) ? array_values($set_data['attr_values'][$item->id]) : []; @endphp @include($_current.'attributes', [ 'attributes' => $item->attributes, 'item_id' => $item->id, 'attr_values' => $attr_values ])
@endforeach @if ($errors->has('items'))
{{$errors->first('items')}}
@endif @endif
@if ($cond)
@include($_template.'products.style-list', [ 'products' => $products, 'use_header' => true, 'use_thubnail_slide' => true, 'title' => 'Combo đề xuất cho bạn', 'list_class' => '', 'use_thubnail_slide' => true, 'use_container' => true, 'seemore' => route('client.style-sets.suggest-products', ['id' => $style->id]), 'seemore_text' => 'Xem thêm sản phẩm đề xuất' ])
@endif @endsection {{-- thêm js mà layout chua co --}} @php add_css_link(theme_asset('css/style-form.min.css')); add_js_src(theme_asset('js/style-form.js')); add_js_data('style_template_data', $templateDetail->toArray()); add_css_link(theme_asset('css/vendors/ion.rangeSlider.min.css')); add_js_src(theme_asset('js/ion.rangeSlider.min.js')); add_js_src(theme_asset('components/common/script.js')); @endphp @section('css') @endsection @section('js') {{-- --}} @endsection