Commit 51a38d3a authored by steven robert's avatar steven robert

Mise en forme du module de gestion des tickets (en cour)

parent 3c3ff9ec
......@@ -34,6 +34,7 @@
@import "ihover";
@import "pads";
@import 'hover';
@import 'tickets';
/*******************************************************************/
/* Polices de caractères */
......
// Place all the styles related to the Tickets controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.Message_ticket{
background-color: #80808038;
}
.Info_ticket{
border :solid 1px;
padding-bottom: 200px;
}
\ No newline at end of file
# frozen_string_literal: true
class TicketsController < ApplicationController
before_action :set_ticket, only: [:show, :edit, :update, :destroy, :new_message]
before_action :set_ticket, only: %i[show edit update destroy new_message]
before_action :super_admin_only
# GET /tickets
......@@ -11,7 +13,7 @@ class TicketsController < ApplicationController
# GET /tickets/1
# GET /tickets/1.json
def show
@ticket_messages = TicketMessage.where( ticket_id: @ticket.id)
@ticket_messages = TicketMessage.where(ticket_id: @ticket.id)
@message = TicketMessage.new
end
......@@ -21,8 +23,7 @@ class TicketsController < ApplicationController
end
# GET /tickets/1/edit
def edit
end
def edit; end
# POST /tickets
# POST /tickets.json
......@@ -34,7 +35,7 @@ class TicketsController < ApplicationController
if @ticket.save
format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }
format.json { render :show, status: :created, location: @ticket }
@message = TicketMessage.new({ user_id: @ticket.user_id, ticket_id: @ticket.id, message: params[:message] } )
@message = TicketMessage.new(user_id: @ticket.user_id, ticket_id: @ticket.id, message: params[:message])
@message.save
else
format.html { render :new }
......@@ -45,7 +46,9 @@ class TicketsController < ApplicationController
# POST /tickets/1/new_message
def new_message
TicketMessage.create(user_id: current_user.id, ticket_id: @ticket.id, message: params[:message]) if params[:message]
if params[:message]
TicketMessage.create(user_id: current_user.id, ticket_id: @ticket.id, message: params[:message])
end
redirect_to @ticket
end
......@@ -74,13 +77,14 @@ class TicketsController < ApplicationController
end
private
# Use callbacks to share common setup or constraints between actions.
def set_ticket
@ticket = Ticket.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def ticket_params
params.require(:ticket).permit(:user_id, :ticket_status_id, :ticket_category_id, :config_module_id)
end
# Use callbacks to share common setup or constraints between actions.
def set_ticket
@ticket = Ticket.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def ticket_params
params.require(:ticket).permit(:user_id, :ticket_status_id, :ticket_category_id, :config_module_id)
end
end
<div class="z-index-page">
<div class="container">
<div class="panel panel-warning shadow">
<div class="panel-heading clearfix">
<h1>
<%="Information sur le ticket"%>
</h1>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-3 col-md-4 col-md-offset-2 text-left">
<h3 class="border-bottom border-gray pb-2 mb-0">Information</h3>
<div class="field">
<div class="row">
<p class="lead">
<strong>User:</strong>
<%= @ticket.user.name %>
</p>
<p class="lead">
<strong>Ticket status:</strong>
<%= @ticket.ticket_status.libelle %>
</p>
<p class="lead">
<strong>Ticket category:</strong>
<%= @ticket.ticket_category.libelle %>
</p>
<p class="lead">
<strong>Config module:</strong>
<%= @ticket.config_module.title %>
<%= button_to "Edition du ticket", edit_ticket_path(@ticket) %> |
<%= link_to 'Back', tickets_path %>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6 text-left " >
<h3> Champs Nouveau message</h3>
<%= form_for(@message, url: "/tickets/#{@ticket.id}/new_message", method: "post") do |f| %>
<%= f.text_area_tag(:message, "", :size => "80x20" ) %>
<%= button_tag(class: "btn btn-primary") do %>
Valider
<% end %>
<% end %>
<div class="container">
<div class="panel panel-warning shadow">
<div class="panel-heading clearfix">
<h1>
Le ticket n° <%= @ticket.id%>
</h1>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-3 col-md-4 col-md-offset-2 text-left ">
<h3 class="border-bottom border-gray pb-2 mb-0">Information</h3>
<div class="field Info_ticket">
<p class="">
<strong>Createur du ticket:</strong>
<%= @ticket.user.name %>
</p>
<p class="">
<strong>Status du ticket:</strong>
<%= @ticket.ticket_status.libelle %>
</p>
<p class="">
<strong>Catergorie du ticket:</strong>
<%= @ticket.ticket_category.libelle %>
</p>
<p class="">
<strong>Module de Zourit conserné:</strong>
<%= @ticket.config_module.title %>
</div>
</div>
<div class="col-sm-6 col-md-6 text-left ">
<h3> Champs Nouveau message</h3>
<%= form_for(@message, url: "/tickets/#{@ticket.id}/new_message", method: "post") do |f| %>
<%= f.text_area_tag(:message, "", :size => "80x17" ) %>
<%= button_tag(class: "btn btn-primary") do %>
Valider
<% end %>
<% end %>
</div>
<div>
<h3> Liste des messages</h3>
<% @ticket_messages.each do |message| %>
<div class="col-md-6 col-sm-6 col-xs-8 col-md-offset-3 col-sm-offset-3 text-left">
<div class="container">
<p class=""><%= "#{message.created_at.strftime("Le %d/%m/%Y ")} par #{message.user.name}" %></p>
<div class="jumbotron">
<p class="lead"><%=raw message.message %></p>
<div class="clearfix"></div>
</div>
</div>
<h2> Historique des messages</h2>
<% @ticket_messages.each do |message| %>
<div class="col-md-6 col-sm-6 col-xs-8 col-md-offset-3 col-sm-offset-3 text-left ">
<div class="card mb-3" style="max-width: 540px;"></div>
<div class="row no-gutters">
<div class="col-md-12">
<div class="card-body jumbotron jumbotron-fluid Message_ticket">
<h3 class="card-title">Message de <%= message.user.name %> </h3>
<p class="card-text"><%= message.message %></p>
<p class="card-text"><small ><%= " Créer #{message.created_at.strftime("Le %d/%m/%Y ")}"%></small></p>
</div>
</div>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
\ No newline at end of file
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment