274 lines
14 KiB
PHP
274 lines
14 KiB
PHP
@extends('layouts.main')
|
|
|
|
@section('content')
|
|
@if ($errors->any())
|
|
<div class="alert alert-danger">
|
|
<ul>
|
|
@foreach ($errors->all() as $error)
|
|
<li>{{ $error }}</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
<div class="form-wrapper">
|
|
<h2><i class="fas fa-ticket-alt"></i> Editer le Coupon</h2>
|
|
{!! Form::model($coupon, ['route' => ['coupon.update', $coupon], 'enctype' => 'multipart/form-data']) !!}
|
|
@method('PUT')
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_code', 'Code de traitement *') !!}
|
|
{!! Form::input('text', 'coupon_code', $coupon->coupon_code, ['required']) !!}
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_name', 'Nom interne *') !!}
|
|
{!! Form::input('text', 'coupon_name', $coupon->coupon_name, ['required']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_value', 'Valeur faciale *') !!}
|
|
{!! Form::number('coupon_value', null, ['step' => '0.05', 'required']) !!}
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_norme', 'Activer la Norme GS1') !!}
|
|
{!! Form::checkbox('coupon_norme', 1, ($coupon->coupon_norme ==1?true:null), array('id'=>'coupon_norme')) !!}
|
|
{!! Form::label('coupon_norme', 'Activer') !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_seuil_alert', 'Seuil d\'alerte *') !!}
|
|
{!! Form::number('coupon_seuil_alert', $coupon->coupon_seuil_alert, ['required']) !!}
|
|
</div>
|
|
<div class="form-field">
|
|
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_enablelimitquantity', 'Activer La limite de quantité') !!}
|
|
{!! Form::checkbox('coupon_enablelimitquantity', 1, ($coupon->coupon_enablelimitquantity ==1?true:null), array('id'=>'coupon_enablelimitquantity')) !!}
|
|
{!! Form::label('coupon_enablelimitquantity', 'Activer') !!}
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_enablelimitperiod', 'Activer la limite sur une période') !!}
|
|
{!! Form::checkbox('coupon_enablelimitperiod', 1, ($coupon->coupon_enablelimitperiod ==1?true:null), array('id'=>'coupon_enablelimitperiod')) !!}
|
|
{!! Form::label('coupon_enablelimitperiod', 'Activer') !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field enablelimitquantity">
|
|
{!! Form::label('coupon_limitquantity', 'Limiter la diffusion à') !!}
|
|
<span>
|
|
{!! Form::number('coupon_limitquantity', null, ['class'=>'small']) !!} coupons
|
|
</span>
|
|
</div>
|
|
<div class="form-field enablelimitperiod">
|
|
{!! Form::label('coupon_limitperiod', 'Limiter la diffusion à une offre tous les') !!}
|
|
<span>
|
|
{!! Form::number('coupon_limitperiod', null, ['class'=>'small']) !!} jours
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<h4>Validité</h4>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_mindatediffusion', 'Date de début de diffusion') !!}
|
|
{!! Form::date('coupon_mindatediffusion') !!}
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_maxdatediffusion', 'Date de fin de diffusion') !!}
|
|
{!! Form::date('coupon_maxdatediffusion') !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_validity', 'Durée de validité à l\'impression') !!}
|
|
<span>
|
|
{!! Form::number('coupon_validity', null, ['class'=>'small', 'required']) !!} jours
|
|
</span>
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_maxdatevalidity', 'Date de fin de validité') !!}
|
|
{!! Form::date('coupon_maxdatevalidity') !!}
|
|
</div>
|
|
</div>
|
|
<div class="calendar">
|
|
<h4><i class="fas fa-plus-square addcalendar"></i> Calendrier de diffusion</h4>
|
|
@foreach ($coupon->calendriers()->get() as $calendrier)
|
|
<div class="form-field-calendar">
|
|
<input type="date" name="startdate[]" value="{{ $calendrier->calendrier_startdate->format('Y-m-d') }}">
|
|
<input type="date" name="enddate[]" value="{{ $calendrier->calendrier_enddate->format('Y-m-d') }}">
|
|
<i class="fas fa-minus-square removecalendar"></i>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
<h4>Mouvements</h4>
|
|
<div class="form-field">
|
|
<table>
|
|
<thead>
|
|
<th>Date</th>
|
|
<th class="center">Quantité</th>
|
|
<th></th>
|
|
</thead>
|
|
@foreach ($coupon->mouvements()->get() as $mouvement)
|
|
<tr>
|
|
<th>{{ $mouvement->mouvement_created_at->format('d/m/Y') }}</th>
|
|
<th>{{ $mouvement->mouvement_nombre }}</th>
|
|
<th></th>
|
|
</tr>
|
|
@endforeach
|
|
<tr class="add-mouvement">
|
|
<th class="th-date"><input type="date" name="add-mouvement-date" id="add-mouvement-date" value="<?php echo date('Y-m-d') ?>"></th>
|
|
<th class="th-nbre"><input type="number" name="add-mouvement-nbre" id="add-mouvement-nbre"></th>
|
|
<th><i class="fas fa-plus-square add-mouvement-btn"></i></th>
|
|
</tr>
|
|
</table>
|
|
|
|
</div>
|
|
<h4>Vignettes</h4>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_thumbnail1', 'Vignette Desktop active') !!}
|
|
{!! Form::file('coupon_thumbnail1', ['class' => 'input-file']) !!}
|
|
@if($coupon->coupon_thumbnail1 != "")
|
|
<figure class="figure-desktop">
|
|
<img src="{{ asset($coupon->coupon_thumbnail1) }}" alt="{{ $coupon->coupon_name }}">
|
|
</figure>
|
|
@endif
|
|
{!! Form::input('hidden', 'coupon_thumbnail1_hidden', $coupon->coupon_thumbnail1) !!}
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_thumbnail2', 'Vignette Desktop grise') !!}
|
|
{!! Form::file('coupon_thumbnail2', ['class' => 'input-file']) !!}
|
|
@if($coupon->coupon_thumbnail2 != "")
|
|
<figure class="figure-desktop">
|
|
<img src="{{ asset($coupon->coupon_thumbnail2) }}" alt="{{ $coupon->coupon_name }}">
|
|
</figure>
|
|
@endif
|
|
{!! Form::input('hidden', 'coupon_thumbnail2_hidden', $coupon->coupon_thumbnail2) !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split align-start">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_thumbnail3', 'Vignette Mobile active') !!}
|
|
{!! Form::file('coupon_thumbnail3', ['class' => 'input-file']) !!}
|
|
@if($coupon->coupon_thumbnail3 != "")
|
|
<figure class="figure-mobile">
|
|
<img src="{{ asset($coupon->coupon_thumbnail3) }}" alt="{{ $coupon->coupon_name }}">
|
|
</figure>
|
|
@endif
|
|
{!! Form::input('hidden', 'coupon_thumbnail3_hidden', $coupon->coupon_thumbnail3) !!}
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_thumbnail4', 'Vignette Mobile grise') !!}
|
|
{!! Form::file('coupon_thumbnail4', ['class' => 'input-file']) !!}
|
|
@if($coupon->coupon_thumbnail4 != "")
|
|
<figure class="figure-mobile">
|
|
<img src="{{ asset($coupon->coupon_thumbnail4) }}" alt="{{ $coupon->coupon_name }}">
|
|
</figure>
|
|
@endif
|
|
{!! Form::input('hidden', 'coupon_thumbnail4_hidden', $coupon->coupon_thumbnail4) !!}
|
|
</div>
|
|
</div>
|
|
<h4>Informations pour génération</h4>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_treatment_center', 'Centre de traitement *') !!}
|
|
{!! Form::select('coupon_treatment_center', ['HighCo', 'Sogec']) !!}
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_legal_mentions_splitted', 'Activer les mentions internationnales') !!}
|
|
{!! Form::checkbox('coupon_legal_mentions_splitted', 1, ($coupon->coupon_legal_mentions_splitted ==1?true:null)) !!}
|
|
{!! Form::label('coupon_legal_mentions_splitted', 'Activer') !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field-textarea">
|
|
{!! Form::label('coupon_validity_text', 'Texte de validité *') !!}
|
|
{!! Form::textarea('coupon_validity_text', null, ['required']) !!}
|
|
</div>
|
|
<div class="form-field-textarea">
|
|
{!! Form::label('coupon_legal_mentions', 'Mentions légales *') !!}
|
|
{!! Form::textarea('coupon_legal_mentions', null, ['required']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split align-start">
|
|
<div class="form-field">
|
|
<div class="title">
|
|
{!! Form::label('coupon_decoration_image', 'Image de décoration *') !!}
|
|
<span>280x260px ou 280x160px si GS1</span>
|
|
<span>Formats : JPG ou PNG</span>
|
|
</div>
|
|
|
|
{!! Form::file('coupon_decoration_image', ['class' => 'input-file', 'accept' => '.jpg,.jpeg,.png']) !!}
|
|
@if($coupon->coupon_decoration_image != "")
|
|
<figure class="figure-desktop">
|
|
<img src="{{ asset($coupon->coupon_decoration_image) }}" alt="{{ $coupon->coupon_name }}">
|
|
</figure>
|
|
@endif
|
|
{!! Form::input('hidden', 'coupon_decoration_image_hidden', $coupon->coupon_decoration_image) !!}
|
|
</div>
|
|
<div class="form-field">
|
|
<div class="title">
|
|
{!! Form::label('coupon_logo_image', 'Logo à afficher *') !!}
|
|
<span>135x70px</span>
|
|
<span>Formats : JPG ou PNG</span>
|
|
</div>
|
|
{!! Form::file('coupon_logo_image', ['class' => 'input-file']) !!}
|
|
@if($coupon->coupon_logo_image != "")
|
|
<figure class="figure-desktop">
|
|
<img src="{{ asset($coupon->coupon_logo_image) }}" alt="{{ $coupon->coupon_name }}">
|
|
</figure>
|
|
@endif
|
|
{!! Form::input('hidden', 'coupon_logo_image_hidden', $coupon->coupon_logo_image) !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_rcs', 'RCS du site *') !!}
|
|
{!! Form::text('coupon_rcs', null, ['required']) !!}
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_site_contact', 'Contact mail *') !!}
|
|
{!! Form::text('coupon_site_contact', null, ['required']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field gs1code">
|
|
<div class="title">
|
|
{!! Form::label('coupon_gs1code', 'Image du code barre GS1 *') !!}
|
|
<span>Formats : JPG</span>
|
|
</div>
|
|
{!! Form::file('coupon_gs1code', ['class' => 'input-file']) !!}
|
|
@if($coupon->coupon_gs1code != "")
|
|
<figure class="figure-mobile">
|
|
<img src="{{ asset($coupon->coupon_gs1code) }}" alt="{{ $coupon->coupon_name }}">
|
|
</figure>
|
|
{!! Form::input('hidden', 'coupon_gs1code_image_hidden', $coupon->coupon_gs1code, array('id'=>'coupon_gs1code_image_hidden')) !!}
|
|
@endif
|
|
|
|
</div>
|
|
<div class="form-field">
|
|
{!! Form::label('coupon_published', 'Publié ?') !!}
|
|
{!! Form::checkbox('coupon_published', 1, ($coupon->coupon_published ==1?true:null), array('id'=>'coupon_published')) !!}
|
|
{!! Form::label('coupon_published', 'Activer') !!}
|
|
</div>
|
|
</div>
|
|
<h4>Bon généré :</h4>
|
|
<div class="form-split" style="justify-content:center;">
|
|
@if($coupon->coupon_image != "")
|
|
<figure class="figure-mobile">
|
|
<img src="{{ asset($coupon->coupon_image) }}?<?php echo time(); ?>" alt="{{ $coupon->coupon_name }}">
|
|
</figure>
|
|
@endif
|
|
</div>
|
|
{!! Form::hidden('site_id', session()->get('site')->id) !!}
|
|
|
|
<div class="form-field submit">
|
|
{!! Form::submit('Mettre à jour') !!}
|
|
</div>
|
|
|
|
{!! Form::close() !!}
|
|
</div>
|
|
@endsection
|