@php $idDb = isset($promotion->id) ? $promotion->id : 0; $action = $idDb > 0 ? 'edit' : 'add'; if(!empty($translate ?? '')) { $action = $translate; } else { $action = trans('admin::action.' . $action); } $guid = $promotion->guid ?? null; $nameMin = config('constant.name.min'); $nameMax = config('constant.name.max'); $headers = [ (object)['name'=>trans('admin::promotion.title.header'),'url'=>route('promotion.v2.index')], (object)['name'=>$action], ]; $backURL = old('back_url',redirect()->back()->getTargetUrl()); if($backURL == url()->current()) { $backURL = null; } $requireField = trans('admin::message.required'); if($idDb > 0) { $detailURL = route('promotion.v2.detail.guid',['guid'=>$guid]); $deleteURL = route('promotion.v2.delete',['guid'=>$guid]); } // for translate $locale = old('locale', $promotion->locale ?? $locale ?? app()->getLocale()); $addURL = route('promotion.v2.add',['id'=>$promotion->id ?? 0]); $editURL = route('promotion.v2.edit',['id'=>$promotion->id ?? 0]); // check slug $slugType = config('constant.slug_type.promotion'); // date $localeDate = $locale != 'vi' ? 'en' : $locale; $dateFormat = config('datetime.' . $localeDate . '.format'); $dateFormatUpperCase = strtoupper($dateFormat); $types = trans('admin::promotion.type.opts'); $dayOfWeek = old('dayofweek') ? \App\Module\Utils\Strings::arr2Int(old('dayofweek')) : ($promotion->dayofweek ?? 0); @endphp @extends('shared.admin') @section('breadcrumb') @include('components.elements.breadcrumb',[ 'header' => $headers, 'action' => 'form', 'perms' => [ 'rAdd' => true, 'rEdit' => true, 'rDelete' => false, 'rHistory' => false, ], ]) @endsection @section('content')
@if($idDb > 0)@method('PUT')@endif @csrf
@foreach($types as $k=>$v)
type ?? 1) == $k){{'checked'}}@endif>
@endforeach
@include('promotions.elements.rangedate',[ 'startsAt' => old('starts_at', $promotion->starts_at ?? ''), 'endsAt' => old('ends_at', $promotion->ends_at ?? '') ])
@include('promotions.elements.rangehours')
@foreach(trans('admin::promotion.dayofweek.opts') as $k=>$v)
0){{'checked'}}@endif>
@endforeach
@include('promotions.elements.dayofmonth')
@include('components.forms.status',[ 'status' => $promotion->status ?? new stdClass() ])
@foreach(trans('admin::promotion.frequency.opts') as $k=>$v)
frequency ?? 0) == $k){{'checked'}}@endif>
@endforeach
@foreach(trans('admin::promotion.only_once.opts') as $k=>$v)
only_once ?? 1) == $k){{'checked'}}@endif>
@endforeach
@include('admin.promotions.elements.location')
@include('admin.promotions.components.products')
@include('admin.promotions.components.contents') @include('components.forms.seo', [ 'seoSlug' => $promotion->seo_slug ?? '', 'seoTitle' => $promotion->seo_title ?? '', 'seoKeyword' => $promotion->seo_keyword ?? '', 'seoDescription' => $promotion->seo_description ?? '', 'seoImage' => $promotion->seo_image ?? '', 'slugType' => $slugType, ])
@include('components.forms.locale', [ 'id' => $id ?? 0, 'idDb' => $idDb, 'localeBW' => $dept->locale_bw ?? 0, ]) @include('components.forms.image',[ 'fieldName' => 'image', 'image'=>$promotion->image ?? '', 'isRequired' => false ]) @include('components.forms.image',[ 'fieldName' => 'image_thumb', 'image' => $promotion->image_thumb ?? '', 'isRequired' => false, 'fieldTitle' => trans('admin::file.image.title_thumb') ]) @include('components.forms.image',[ 'fieldName' => 'image_xs', 'image' => $promotion->image_xs ?? '', 'isRequired' => false, 'fieldTitle' => trans('admin::file.image.title_xs') ])
@endsection @section('style') @parent @endsection @section('script') @parent @endsection @section('js-ext') @parent @endsection