EVOLUTION-MANAGER
Edit File: index.blade.php
@extends('layouts.backend') @section('titulo') PREGUNTAS Y RESPUESTAS @stop @section('style') <link rel="stylesheet" href="{{ asset('admin/plugins/sweetalert/sweetalert.css') }}"> @endsection @section('contenido') @include('alerts.success') @include('alerts.errors') <a class="btn btn-primary" href="{{ URL::route('preguntas.create') }}">NUEVAS PREGUNTAS Y RESPUESTAS</a> @if (count($preguntas)) <div class="table-responsive"> <table id="tbbuzon1" class="table table-striped table-bordered table-hover display" > <thead> <tr> <th>PREGUNTA:</th> <th>RESPUESTA:</th> <th width="10%">ACCIONES</th> </tr> </thead> <tbody> @foreach ($preguntas as $chatbot) <tr> <td>{{$chatbot->pregunta}}</td> <?php $respuestas=App\pregunta_respuestaModel::join('chatbot_respuestas','pregunta_respuesta.chatbot_respuestas_id','=','chatbot_respuestas.id') ->where('chatbot_preguntas_id',$chatbot->id) ->get(['chatbot_respuestas.respuesta','chatbot_respuestas.id']); ?> <td> @if(count($respuestas)) <ul> @foreach($respuestas as $res) <li>{{ $res->respuesta }} <a href="{{ url("administracion/editar_respuesta/$res->id") }}"><i class="fa fa-edit"></i></a></li> @endforeach </ul> @endif </td> <td style="display: inline-flex; float: right;"> {!! Form::open(array('method' => 'GET', 'route' => array('preguntas.edit', $chatbot->id))) !!} <button type="submit" class="btn btn-success bnt-lg" data-toggle="tooltip" title="Editar Respuestas"> <i class="fa fa-pencil-square-o"></i></button> {!! Form::close() !!} <button type="submit" class="btn btn-danger bnt-lg" onclick="SeguroEliminar({{$chatbot->id}})" data-toggle="tooltip" title="Eliminar"><i class="fa fa-trash"></i></button> </td> </tr> @endforeach </tbody> </table> </div> @else <br> Aún no hay pregunta y respuesta sistema @endif @stop @section('script') <script src="{{ asset('admin/plugins/sweetalert/sweetalert.min.js') }}"></script> <script> function SeguroEliminar(id){ swal({ title: "Eliminar pregunta", text: "Seguro de eliminar la pregunta?", type: "info", showCancelButton: true, closeOnConfirm: false, showLoaderOnConfirm: true, confirmButtonText: 'Si, Eliminar!', cancelButtonText: 'No, Cancelar!', }, function () { $.ajax({ type: "DELETE", url: "{{url('/')}}/administracion/preguntas/"+id, data: { "_token": "{{ csrf_token() }}" }, success: function (data) { location.reload(); } }); }); } </script> @stop