ldc-mesbr-app/resources/views/campagne/edit.blade.php
2019-02-25 10:19:24 +01:00

117 lines
4.8 KiB
PHP

@extends('layouts.main')
@section('content')
<h2><i class="fa fa-folder"><i class="fas fa-ticket-alt"></i></i> Editer la campagne</h2>
<div class="form-wrapper">
{!! Form::model($campagne, ['route' => ['campagne.update', $campagne]]) !!}
@method('PUT')
<div class="form-split">
<div class="form-field">
{!! Form::label('camp_name', 'Nom') !!}
{!! Form::input('text', 'camp_name', null, ['required']) !!}
</div>
<div class="form-field">
{!! Form::label('camp_type', 'Type') !!}
{!! Form::select('camp_type', ['Mur', 'Panier', 'Mur sans sélection', 'Panier Sélectionnable']) !!}
</div>
</div>
<div class="form-split">
<div class="form-field">
{!! Form::label('camp_published', 'Publier') !!}
{!! Form::select('camp_published', ['Non', 'Oui']) !!}
</div>
<div class="form-field limitPrinting">
{!! Form::label('camp_limitedPrinting', 'Limiter les impressions à 1 BR à la fois') !!}
{!! Form::checkbox('camp_limitedPrinting', 1, ($campagne->camp_limitedPrinting ==1?true:null), array('id'=>'camp_limitedPrinting')) !!}
{!! Form::label('camp_limitedPrinting', '') !!}
</div>
</div>
<div class="form-field submit">
{!! Form::submit('Mettre à jour') !!}
</div>
{!! Form::close() !!}
</div>
<div class="coupons-wrapper">
<h2><i class="fas fa-ticket-alt"></i> Coupons de la campagne</h2>
<table>
<thead>
<th>Code</th>
<th>Nom</th>
<th></th>
</thead>
@foreach($couponsLinked as $coupon)
<tr class="@if($coupon->coupon_published == 0) notPublished @endif">
<td>{{ $coupon->coupon_code }}</td>
<td>{{ $coupon->coupon_name }}</td>
<td><i class="fas fa-times delete-coupon" data-campid={{$campagne->camp_id}} data-couponid={{$coupon->coupon_id}}></i></td>
</tr>
@endforeach
</table>
@if(count($couponsLinked) == 0)
<p class="no-result">Pas de coupons liés</p>
@endif
<input type="hidden" name="csrf" id="csrf" value="<?php echo csrf_token(); ?>">
<button data-fancybox data-src="#coupons-list" href="javascript:;">
Ajouter des coupons a cette campagne
</button>
</div>
<div class="notifs-wrapper">
<h2><i class="fas fa-bell"></i> Notifications par mail</h2>
<div class="form-wrapper">
{!! Form::open(['action' => 'CampagneController@saveNotification']) !!}
<div class="form-split">
<div class="form-field">
{!! Form::label('notif_name', 'Nom') !!}
{!! Form::input('text', 'notif_name', null, ['required']) !!}
{{ Form::hidden('notif_campId', $campagne->camp_id) }}
</div>
<div class="form-field"></div>
<div class="form-field">
{!! Form::label('notif_email', 'Email') !!}
{!! Form::input('text', 'notif_email', null, ['required']) !!}
</div>
<div class="form-field">
<span></span>
{!! Form::submit('Ajouter') !!}
</div>
</div>
{!! Form::close() !!}
</div>
<table>
<thead>
<tr>
<th>{{__('No') }}</th>
<th>{{__('Nom') }}</th>
<th>{{__('Email') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($campagne->notifications as $n)
<tr>
<td>{{ $n->notif_id }}</td>
<td>{{ $n->notif_name }}</td>
<td>{{ $n->notif_email }}</td>
<td><a href="{{ route('campagne.deleteNotif', $n) }}"><i class="fas fa-times delete-icon"></i></a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div id="coupons-list" style="display:none;">
<h2><i class="fas fa-ticket-alt"></i> Ajouter des Coupons</h2>
@foreach($coupons as $coupon)
<div class="inputGroup @if($coupon->coupon_published == 0) notPublished @endif">
<input id="coupon[{{$coupon->coupon_id}}]" name="coupon[{{$coupon->coupon_id}}]" type="checkbox" value="{{$coupon->coupon_id}}"/>
<label for="coupon[{{$coupon->coupon_id}}]">{{$coupon->coupon_name}}</label>
</div>
@endforeach
<input type="hidden" name="camp_id" id="camp_id" value="{{ $campagne->camp_id }}">
<input type="hidden" name="csrf" id="csrf" value="<?php echo csrf_token(); ?>">
<input type="submit" id="addCoupons" value="Ajouter">
</div>
{!! Form::open(['id' => 'delete-hidden']) !!}
@method('DELETE')
{!! Form::close() !!}
@endsection