Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

no comment

  • Loading branch information...
commit 2875f050ae270d50fed9960398c2fbd62291ba47 1 parent fab9d1f
@larcara larcara authored
View
2  .idea/SRM.iml
@@ -28,7 +28,7 @@
<orderEntry type="library" scope="PROVIDED" name="bcrypt-ruby (v3.0.1, ruby-1.9.3-p125) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap-wysihtml5-rails (v0.3.1.11, ruby-1.9.3-p125) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.0.4, ruby-1.9.3-p125) [gem]" level="application" />
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.0.22, ruby-1.9.3-p125) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.2.3, ruby-1.9.3-p125) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-rails (v3.2.2, ruby-1.9.3-p125) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script (v2.2.0, ruby-1.9.3-p125) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script-source (v1.4.0, ruby-1.9.3-p125) [gem]" level="application" />
View
16 app/controllers/attachments_controller.rb
@@ -7,8 +7,24 @@ def attach
end
def show
+ @attachment=Attachment.find(params[:id])
+ if @attachment.sottotipo=="visura"
+ redirect_to supplier_path(@attachment.attachable_id)
+ end
#render :text=>"ok"
end
+ def destroy
+ @attachment=Attachment.find(params[:id])
+ if @attachment.sottotipo=="visura"
+ id=@attachment.attachable_id
+ end
+ @attachment.destroy
+
+ respond_to do |format|
+ format.html { redirect_to (id.blank? ? root_path : supplier_path(id) )}
+ format.json { head :no_content }
+ end
+ end
end
View
21 app/controllers/contracts_controller.rb
@@ -39,5 +39,26 @@ def update
end
end
end
+ def valuta
+ @contract = Contract.find(params[:id])
+ @score=@contract.scores.build(:year => Date.today.year)
+ @score.supplier=@contract.supplier
+ @score.save
+ redirect_to edit_score_path(@score)
+ end
+ def elimina_valutazione
+ @contract = Contract.find(params[:id])
+ @score=@contract.scores.find(params[:score_id])
+ respond_to do |format|
+ if @score.destroy
+ format.html { redirect_to contract_path(@contract) , notice: "Valutazione eliminata!"}
+ format.json { head :no_content }
+ else
+ @contract.errors << @score.errors
+ format.html { render action: "edit" }
+ format.json { render json: @contract.errors, status: :unprocessable_entity }
+ end
+ end
+ end
end
View
6 app/controllers/proposals_controller.rb
@@ -1,5 +1,5 @@
class ProposalsController < InheritedResources::Base
- before_filter :authenticate_supplier_user!, :only=>[:index, :edit]
+ before_filter :authenticate_supplier_user!, :only=>[:index]
before_filter :authenticate_admin_user! , :only=>[]
def forniture_da_valutare
@@ -16,6 +16,10 @@ def index
end
def edit
+ if current_user
+ redirect_to proposal_path(params[:id])
+ return false
+ end
begin
@proposal = @supplier.proposals.find(params[:id])
rescue ActiveRecord::RecordNotFound
View
3  app/controllers/request_for_proposals_controller.rb
@@ -1,4 +1,7 @@
class RequestForProposalsController < ApplicationController
+ before_filter :authenticate_user!, :except => [:rifiuta,:rispondi]
+
+
# GET /request_for_proposals
# GET /request_for_proposals.json
def index
View
13 app/controllers/scores_controller.rb
@@ -14,5 +14,18 @@ def update
end
end
+ # DELETE /scores/1
+ # DELETE /scores/1.json
+ def destroy
+ @score = Score.find(params[:id])
+ supplier=@score.supplier
+ @score.destroy
+
+ respond_to do |format|
+ format.html { redirect_to supplier_path(supplier) }
+ format.json { head :no_content }
+ end
+ end
+
end
View
24 app/controllers/suppliers_controller.rb
@@ -79,7 +79,7 @@ def index
invito_dal=params[:invito_dal]
invito_al=params[:invito_al]
- s1=Supplier
+ s1=Supplier.where("1=1")
s1=Supplier.where(suppliers[:state].eq(state)) unless state.blank?
s1=s1.where(suppliers[:ragsociale].matches("%#{q}%").or(suppliers[:codice].eq(q))) unless q.blank?
s1=s1.where(suppliers[:partita_iva].matches("%#{piva_cf}%").or(suppliers[:codice_fiscale].matches("%#{piva_cf}%")).or(suppliers[:partita_iva_cee].matches("%#{piva_cf}%"))) unless piva_cf.blank?
@@ -105,12 +105,12 @@ def index
s1=s1.joins(:supplier_categories).where(["supplier_categories.category_id in (?)", cat_ids]) unless cat_ids.blank?
- result=s1 || Supplier
+ result=s1 || Supplier.where("1=1")
@suppliers=result.order(:ragsociale).page(params[:page]).per(20)
if params[:commit] == "XLS"
- export_xls(result)
+ export_xls(Supplier.where(:id=>result.select("distinct suppliers.id").map(&:id)))
end
end
@@ -366,16 +366,30 @@ def nuova_visura
@supplier = Supplier.find(params[:id])
@supplier.inizializza_fornitore_su_wr!
@visura=@supplier.visure.build(:id_padre=>@supplier.attachment.id_wr)
+ end
+ def modifica_visura
+ @supplier = Supplier.find(params[:id])
+ @visura=@supplier.visure.find(params[:visura_id])
+ render :nuova_visura
end
def monitoraggio
- @anno=params[:year] || Date.today.year
+ @anno=params[:year] || params[:consolida] || Date.today.year
@anno=@anno.to_i
- ids=Score.where(:year=>[@anno, @anno-1]).select("distinct supplier_id")
+ ids=Score.where(:year=>[@anno]).select("distinct supplier_id")
@suppliers=Supplier.where(:id=>ids).order("id").page(params[:page]).per(20)
+ if params[:consolida]
+ @suppliers.each do |s|
+ if s.gsq_scores.where(:year=>@anno+1, :score_type=>"base", :supplier_id=>s.id).count ==0
+ s.gsq_scores.create(:year=>@anno+1, :score_type=>"base", :gsq=>s.gsq(@anno), :supplier_id=>s.id)
+ end
+ end
+
+ end
+
end
def nuova_valutazione
View
2  app/helpers/suppliers_helper.rb
@@ -140,7 +140,7 @@ def categorie_supplier(s)
content_tag :ul do
s.supplier_categories.with_state(:abilitata).map do |sc|
- content_tag :li, (content_tag :abbr, sc.category.name, :title=>sc.category.breadcumb)
+ content_tag :li, (content_tag :abbr, sc.category.to_string, :title=>sc.category.breadcumb)
end.join.html_safe
end
View
14 app/models/admin_mailer.rb
@@ -131,7 +131,7 @@ def riapri_offerta(proposal)
Setting["mailer|#{__method__}#to"].update_attribute(:kind, "Proc")
Setting.default_for "mailer|#{__method__}#subject", '"Variazione stato Offerta"'
Setting["mailer|#{__method__}#subject"].update_attribute(:kind, "Proc")
- Setting.default_for "mailer|#{__method__}#body", ' "Testo del messaggio realtivo alla riapertura del documento di offerta notificato come definitivo'
+ Setting.default_for "mailer|#{__method__}#body", ' "Testo del messaggio realtivo alla riapertura del documento di offerta notificato come definitivo"'
Setting["mailer|#{__method__}#body"].update_attribute(:kind, "Proc")
mail_from_setting(__method__, proposal.supplier, proposal, proposal.request_for_proposal)
end
@@ -146,13 +146,21 @@ def accetta_offerta(proposal)
mail_from_setting(__method__, proposal.supplier, proposal, proposal.request_for_proposal)
end
-
+ def scarta_offerta(proposal)
+ Setting.default_for "mailer|#{__method__}#to", ""
+ Setting["mailer|#{__method__}#to"].update_attribute(:kind, "Proc")
+ Setting.default_for "mailer|#{__method__}#subject", '"Offerta Scartata"'
+ Setting["mailer|#{__method__}#subject"].update_attribute(:kind, "Proc")
+ Setting.default_for "mailer|#{__method__}#body", ' "L\' offerta presentata non è stata accettata. per ulteriori informazioni contattare gli uffici HDI"'
+ Setting["mailer|#{__method__}#body"].update_attribute(:kind, "Proc")
+ mail_from_setting(__method__, proposal.supplier, proposal, proposal.request_for_proposal)
+ end
def offerta_persa(proposal)
Setting.default_for "mailer|#{__method__}#to", ""
Setting["mailer|#{__method__}#to"].update_attribute(:kind, "Proc")
Setting.default_for "mailer|#{__method__}#subject", '"Offerta persa"'
Setting["mailer|#{__method__}#subject"].update_attribute(:kind, "Proc")
- Setting.default_for "mailer|#{__method__}#body", ' "L\' offerta presentata non è stta selezionata per aggiudicarsi la #{@object.rfp.to_label}"'
+ Setting.default_for "mailer|#{__method__}#body", ' "L\' offerta presentata non è stata selezionata per aggiudicarsi la #{@object.rfp.to_label}"'
Setting["mailer|#{__method__}#body"].update_attribute(:kind, "Proc")
mail_from_setting(__method__, proposal.supplier, proposal, proposal.request_for_proposal)
end
View
27 app/models/attachment.rb
@@ -1,9 +1,9 @@
#encoding: utf-8
class Attachment < ActiveRecord::Base
belongs_to :attachable
- attr_accessible :description, :id_wr, :name, :attach , :filename, :sottotipo, :attachable_id, :attachable_type, :id_padre, :fields
+ attr_accessible :description, :id_wr, :name, :attach , :filename, :sottotipo, :attachable_id, :attachable_type, :id_padre, :fields , :data_validita, :data_emissione
- attr_accessor :docWR , :attach, :id_padre, :fields
+ attr_accessor :docWR , :attach, :id_padre, :fields,:data_validita, :data_emissione
before_save :save_wr_resource
@@ -178,4 +178,27 @@ def getFile(_id)
end
+
+ def data_validita=(value)
+ self.description=YAML.load(self.description) if self.description.is_a?(String)
+ self.description||={}
+ self.description[:data_validita]=value
+ end
+ def data_emissione=(value)
+
+ self.description=YAML.load(self.description) if self.description.is_a?(String)
+ self.description||={}
+ self.description[:data_emissione]=value
+ end
+ def data_validita
+ self.description=YAML.load(self.description) if self.description.is_a?(String)
+ self.description||={}
+ self.description[:data_validita]
+ end
+ def data_emissione
+ self.description=YAML.load(self.description) if self.description.is_a?(String)
+ self.description||={}
+ self.description[:data_emissione]
+ end
+
end
View
3  app/models/contract.rb
@@ -1,7 +1,8 @@
class Contract < ActiveRecord::Base
attr_accessible :protocol, :protocol_date, :supplier_id, :valid_from, :valid_to , :allegati_attributes, :note
- has_many :contract_categories
+ #has_many :contract_categories
has_many :proposals
+ has_many :scores, :as=>:scorable
belongs_to :supplier
has_many :allegati, :as=>:attachable, :class_name => Attachment, :conditions => {:sottotipo=>""}
View
20 app/models/score.rb
@@ -1,11 +1,29 @@
class Score < ActiveRecord::Base
belongs_to :scorable
+ belongs_to :supplier
attr_accessible :gsq, :psc, :score1, :score2, :score3, :score4, :score_type, :supplier_id, :year , :note
- belongs_to :supplier
+ validates_presence_of :supplier_id
+
+ #se scorable_type è una proposal è lo score di una proposal
+ #se scorable_type è un contratto è lo score di un contratto
+ #se scorable_type è un fornitore e lo score_type è "extra" è lo score aggiuntivo
+ #se scorable_type è un fornitore e lo score_type è "base" è lo score di partenza per quell'anno
+
+ state_machine :state, :initial => :corrente do
+ state :corrente, :archiviato
+ event :archivia do
+ transition [:corrente] =>:archiviato
+ end
+ end
+
+
+
+ belongs_to :supplier
##Setting.default_for "valutazione|tipo_forniture", %w"1 FornituraBeni 2 FornituraServizi".in_groups_of(2)
before_update :calcola_psc
+
def calcola_psc
return if proposal.blank?
score_1_peso=Setting["valutazione|score1_peso_Proposal_#{proposal.tipo_fornitura}"].values
View
27 app/models/supplier.rb
@@ -116,7 +116,7 @@ class Supplier < ActiveRecord::Base
end
after_transition :on=>:accetta do |supplier, transition|
AdminMailer.conferma_iscrizione(supplier).deliver
- supplier.gsq_scores.build(:year=>Date.today.year-1, :score_type=>"", :gsq=>30, :supplier_id=>supplier.id)
+ supplier.gsq_scores.build(:year=>Date.today.year-1, :score_type=>"base", :gsq=>Setting["valutazione|score_iniziale"].values, :supplier_id=>supplier.id)
supplier.save
end
after_transition :on=>:annulla_iscrizione do |supplier, transition|
@@ -302,22 +302,31 @@ def to_string
to_label
end
- def gsq(anno)
- if gsq_scores.where(:year=>anno, :score_type=>"").count == 0
- gsq_live(anno)
+ def gsq_base(anno)
+ if x=gsq_scores.where(:year=>anno, :score_type=>"base").first
+ x.gsq
else
- gsq_scores.where(:year=>anno, :score_type=>"").sum(:gsq).to_f
+ 30
end
-
-
end
+ def gsq(anno)
+ gsq_live(anno)
+ end
+
def extra(anno)
extra_scores.where(:year=>anno).sum(:gsq).to_f
end
def gsq_live(anno)
- x=gsq_scores.where(:year=>anno-1, :score_type=>"").sum(:gsq).to_f
- ((x + pmc(anno)) / 2) + extra(anno.to_i)
+ x=gsq_base(anno)
+ p=pmc(anno)
+ tot=0
+ if p > 0
+ tot=((x + pmc(anno)) / 2) + extra(anno.to_i)
+ else
+ tot= x + extra(anno.to_i)
+ end
+ tot > 30 ? 30 : tot
end
def pmc(anno)
scores.where(:year=>anno, :scorable_type=>"Proposal" ).average("coalesce (psc,0)").to_f
View
32 app/views/contracts/_form.html.erb
@@ -11,16 +11,36 @@
<%=attach.input :sottotipo, :label=>false, :as=>:hidden%>
<span class="row">
<span class="span2"><%=attach_link attach.object%></span>
- <span class="span4"><%=attach.input :attach, :as =>:file, :label=>false,
- :hint=>"caricare un nuovo file per sostituire quello esistente" %></span>
-
+ <span class="span4"><%=attach.input :attach, :as =>:file, :label=>false, :hint=>"caricare un nuovo file per sostituire quello esistente" %></span>
<span class="span1"><%=attach.input :_destroy, :as =>:boolean, :label=>" "%> </span>
</span>
<% end %>
-
-
-
<% end %>
+<%= link_to 'Valuta', valuta_contract_path(@contract), :class=>"btn btn-success " %>
+<table class="table table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th>Data Valutazione</th>
+ <th>Punteggio Sintentico</th>
+ <th>Note</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%@contract.scores.each do |s|%>
+ <tr>
+ <td>Valutazione del <%=s.created_at.strftime("%d-%m-%Y")%></td>
+ <td><%=s.psc%></td>
+ <td><%=s.note%></td>
+ <td>
+ <%=link_to("Modifica", score_path(s) , :class=>"btn btn-info" ) %>
+ <%=link_to("Elimina", elimina_valutazione_contract_path(@contract,:score_id=>s.id), :method => :delete, data: { confirm:t(:generic_confirm_message) } , :class=>"btn btn-danger " ) %>
+ </td>
+ </tr>
+ <%end%>
+ </tbody>
+</table>
+</div>
<script>
$(function() {
View
11 app/views/proposals/_form.html.erb
@@ -18,8 +18,7 @@
<div class="span3"><%= f.input :protocol,:label=>"Protocollo Documento in ingresso" ,:as=>:string , :input_html=>{:disabled=>true}%></div>
<div class="span3"><%= f.input :protocol_date,:label=>"Data protocollo" , :as=>:string , :input_html=>{ :disabled=>true, :value=>print_date(f.object.protocol_date)} %></div>
<div class="span3">
- <%= f.input :contract , :as=>:select, :collection=>@proposal.supplier.contracts , :label=>"Contratto #{link_to "(nuovo)", new_contract_path(:supplier_id=>@proposal.supplier_id), :target=>"_blank"}".html_safe %>
-
+ <%= f.input :contract , :as=>:select, :collection=>@proposal.supplier.contracts , :label=>"Contratto " if @proposal.definitiva? %>
</div>
</div>
<div class="row">
@@ -32,7 +31,7 @@
</div>
<div class="span4">
<%= button_tag "salva", :class=>"btn btn-success" %>
- <%=link_to "<i class='icon-envelope'></i> Richiesta Variazioni".html_safe, prepara_mail_supplier_path(@proposal.supplier, :subject=>"rif VS Offerta per la #{@proposal.request_for_proposal.to_label}", :body=>@proposal.note), :target => "_blank", :class=>"btn" if (@proposal.inviata? || @proposal.definitiva?)%>
+ <%=link_to "<i class='icon-envelope'></i> Richiesta Variazioni".html_safe, prepara_mail_supplier_path(@proposal.supplier, :subject=>"rif VS Offerta per la #{@proposal.request_for_proposal.to_label}", :body=>@proposal.note), :class=>"btn" if (@proposal.inviata? || @proposal.definitiva?)%>
<%= button_tag "riapri", :class=>"btn btn-info" , :id=>"btn_salva_def",:name=>"gest[riapri]" if @proposal.can_riapri?%>
<%= button_tag "accetta", :class=>"btn btn-success" , :id=>"btn_salva_def",:name=>"gest[accetta]" , :data=>{:confirm=> "Attenzione. Accettando questa offerta tutte le altre saranno rifiutate e l'Ufficio Acquisti sarà notificato per l'inserimento del relativo OF."}if @proposal.can_accetta?%>
<%= button_tag "scarta", :class=>"btn btn-danger" , :id=>"btn_sottoponi_def", :name=>"gest[scarta]" if @proposal.can_scarta?%>
@@ -42,13 +41,13 @@
</div>
<%end%>
<div class="row">
- <div class="span3"><%= f.input :valid_from, :as=>:string, :input_html=>{:disabled=>!@proposal.can_conferma? , :value=>print_date(f.object.valid_from)} %></div>
- <div class="span3"><%= f.input :valid_to , :as=>:string , :input_html=>{:disabled=>!@proposal.can_conferma?, :value=>print_date(f.object.valid_to)} %></div>
+ <div class="span3"><%= f.input :valid_from, :as=>:string, :input_html=>{:disabled=>(!supplier_user_signed_in? && !@proposal.can_conferma?) , :value=>print_date(f.object.valid_from)} %></div>
+ <div class="span3"><%= f.input :valid_to , :as=>:string , :input_html=>{:disabled=>(!supplier_user_signed_in? && !@proposal.can_conferma?), :value=>print_date(f.object.valid_to)} %></div>
<div class="span3"><%= f.input :tipo_fornitura, :label=>"Tipo Fornitura", :as=>:select, :collection=>setting_for("valutazione","tipo_forniture"), :input_html=>{:disabled=>true} %></div>
</div>
<div class="row">
<div class="span9">
- <% if @proposal.can_conferma? || @proposal.can_invia_bozza? %>
+ <% if supplier_user_signed_in? && (@proposal.can_conferma? || @proposal.can_invia_bozza? ) %>
<%= f.input :note, :input_html=>{:rows=>10, :class=>"span9"}%>
<% else %>
<%= @proposal.note.html_safe %>
View
4 app/views/proposals/proposals_da_valutare.html.haml
@@ -11,7 +11,9 @@
%th= "Azioni"
-@proposals.each do |proposal|
%tr
- %td= link_to(proposal.request_for_proposal.to_label, edit_request_for_proposal_path(proposal.request_for_proposal), :target=>"_blank")
+ %td
+ = link_to(proposal.request_for_proposal.to_label, edit_request_for_proposal_path(proposal.request_for_proposal), :title=>proposal.note)
+ = link_to(proposal.request_for_proposal.oggetto, edit_request_for_proposal_path(proposal.request_for_proposal), :title=>proposal.category.breadcumb)
%td= link_to(proposal.contract.to_label, contract_path(proposal.contract), :target=>"_blank") if proposal.contract
%td= link_to(proposal.supplier.to_label, supplier_path(proposal.supplier), :target=>"_blank")
!!!%td= proposal.accepted_by
View
25 app/views/request_for_proposals/seleziona_destinatari.erb
@@ -52,14 +52,14 @@
<div class="row">
- <%=form_tag url_for(:action=>:invia, :id=>@request_for_proposal.id), :class=>"form form-inline" do%>
+ <%=form_tag url_for(:action=>:invia, :id=>@request_for_proposal.id), :class=>"form form-inline", :id=>"form_invito" do%>
<%@request_for_proposal.avaiables_suppliers.each do |s|%>
<%d=s.request_for_proposal_dispatches.where(:request_for_proposal_id=>@request_for_proposal.id).order("updated_at desc").first%>
<div class="row">
<div class="span1">
<%dispacth_selezionato=true %>
<%dispacth_selezionato=false if d #&& (d.annullato? || d.rifiutato?)%>
- <%=check_box_tag "dispatch_to[]", s.id, dispacth_selezionato %>
+ <%=check_box_tag "dispatch_to[]", s.id, dispacth_selezionato, :id=>"invito_per_#{s.id}" %>
</div>
<%=content_tag :label , "#{s.to_label} (#{s.email})" , :class=>"label span5 #{"label-info" if d }"%>
@@ -74,4 +74,23 @@
<%=submit_tag "Invia Inviti"%>
<%end%>
<%= content_tag :h3, "Nessun fornitore Idoneo per la categoria selezionata!!!" , :class=>"well well-small" if @request_for_proposal.avaiables_suppliers.blank?%>
-</div>
+</div>
+<script>
+
+ $("#form_invito").submit(function(event){
+
+
+ var selezionati=0;
+ var ids=$("input[name='dispatch_to[]']:checked ");
+ if (ids.length > 0)
+ {}
+ else
+ { alert("selezionare almeno un fornitore");
+ event.preventDefault();
+ }
+
+ });
+ //$('#elenco_inviti').dataTable();
+
+
+</script>
View
5 app/views/scores/_form.html.erb
@@ -27,7 +27,10 @@
</div>
<div class="span2">
- <p><%= submit_tag "salva",:type=>:submit, :disable_with => "wait..." , :class=>"btn btn-info "%></p>
+ <p>
+ <%= submit_tag "Salva",:type=>:submit, :disable_with => "wait..." , :class=>"btn btn-success "%></p>
+ <%=link_to( "Offerta", proposal_path(@score.proposal) , :confirm=>"Tornare all'offerta senza salvare?", :class=>"btn btn-info") if @score.proposal%></h4>
+
</div>
</div>
<% if @score.proposal %>
View
6 app/views/suppliers/_invito.html.erb
@@ -2,10 +2,12 @@
<%unless invito.modificabile?%>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">chiudi scheda</button>
- <h5>Invito per la <%=rfp.to_label%> del <%=print_date(invito.dispatch_on)%></h5>
+ <h5>Invito del <%=print_date(invito.dispatch_on)%></h5>
<div class="row">
<div class="span4">
<dl class="dl-horizontal">
+ <dt><strong><%=rfp.to_label%>:</strong> </dt>
+ <dd><strong><%=rfp.oggetto%></strong></dd>
<dt><strong> Emessa il:</strong> </dt>
<dd><strong><%=print_date(rfp.emitted_on)%></strong></dd>
<dt><strong> Scade il:</strong> </dt>
@@ -34,6 +36,8 @@
<div class="row">
<div class="span5">
<dl class="dl-horizontal">
+ <dt><strong><%=rfp.to_label%>:</strong> </dt>
+ <dd><strong><%=rfp.oggetto%></strong></dd>
<dt><strong> Emessa il:</strong> </dt>
<dd><strong><%=print_date(rfp.emitted_on)%></strong></dd>
<dt><strong> Scade il:</strong> </dt>
View
17 app/views/suppliers/monitoraggio.html.haml
@@ -2,9 +2,12 @@
= form_tag monitoraggio_suppliers_path, :method => :get, class: "form-inline" do
%p
%label="Monitoraggio fornitori anno:"
- = select_tag :year, options_for_select([2011,2012],@anno)
+ = select_tag :year, options_for_select((Score.minimum(:year)..Score.maximum(:year)).to_a,@anno)
= submit_tag :cerca, class: "btn"
- !!!= submit_tag :chiudi_esercizio, class: "btn btn-success pull-right"
+ - Score.where("scorable_type <> 'Supplier'").with_state(:corrente).select("distinct year").each do |x|
+ = button_tag type: :submit, :name=>"consolida", :value=>x.year , class: "btn btn-success pull-right" do
+ =content_tag :span, "Consolida GSQ anno #{x.year}"
+
.row
.span7=paginate @suppliers
.row
@@ -14,21 +17,21 @@
%th="Ragione Sociale"
%th="Stato"
%th
- %abbr{:title=>"Giudizio Sintetico di Qualificazione"}="GSQ #{@anno-1}"
+ %abbr{:title=>"Giudizio Sintetico di Qualificazione iniziale"}="GSQ Iniziale #{@anno}"
%th
- %abbr{:title=>"Punteggi extra per ISO9001, ISO14000 e Audit 2° liv"}="Extra #{@anno}"
+ %abbr{:title=>"Punteggi extra per ISO9001, ISO14000 e Audit 2° liv"}="Punti Extra #{@anno}"
%th
%abbr{:title=>"Punteggio Medio di esecuzione dei Contratti"}="PMC #{@anno}"
%th
- %abbr{:title=>"Giudizio Sintetico di Qualificazione"}="GSQ #{@anno} calcolato"
- %th="Classe #{@anno-1}"
+ %abbr{:title=>"Giudizio Sintetico di Qualificazione"}="GSQ calcolato per #{@anno+1}"
%th="Classe #{@anno}"
+ %th="Classe #{@anno+1}"
%tbody
- @suppliers.each do |s|
%tr
%td= link_to(s.ragsociale,supplier_path(s))
%td= Supplier.state_name(s.state)
- %td= s.gsq(@anno-1)
+ %td= s.gsq_base(@anno)
%td= s.extra(@anno)
%td= s.pmc(@anno)
%td= s.gsq(@anno)
View
10 app/views/suppliers/nuova_visura.html.haml
@@ -8,9 +8,11 @@
%li= msg
=semantic_form_for @visura , class: "form" do |f|
.pull-right=submit_tag "Salva" , :class=>"btn btn-success"
+ .pull-right=link_to "Elimina" , attachment_path(@visura),:method => :delete, :data => { :confirm => "Confermi la cancelazione della visura"}, :class => 'btn btn-danger'
.row
- .span4=f.input :description, :label=>"Data Validità"
- .span4=f.input :name , :label=>"Tipo" , :as=>:select , :collection => ["Report su Impresa/Persona", "Visura Centrale Rischi"] #TODO sostituirli con setting
+ .span3=f.input :data_emissione, :label=>"Data Emissione"
+ .span3=f.input :data_validita, :label=>"Data Validità"
+ .span3=f.input :name , :label=>"Tipo" , :as=>:select , :collection => ["Report su Impresa/Persona", "Visura Centrale Rischi"] #TODO sostituirli con setting
.row
.span6=f.input :attach, :as=>:file
=f.input :id_padre , :as=>:hidden, :label=>false
@@ -19,5 +21,7 @@
=f.input :sottotipo , :as=>:hidden, :label=>false
-
+%script
+ ="$('#attachment_data_emissione').datepicker({ format: 'dd-mm-yyyy'});"
+ ="$('#attachment_data_validita').datepicker({ format: 'dd-mm-yyyy'});"
View
20 app/views/suppliers/show.html.haml
@@ -160,7 +160,7 @@
- c.current_role=:hdi
%tr{:class=>{:abilitata=>:success, :non_abilitata=>:error, :new=>:info, :richiesta=>:info}[c.state.to_sym]}
%td=c.state
- %td=c.category.breadcumb if c.category
+ %td=content_tag :abbr, c.category.to_string, :title=>c.category.breadcumb if c.category
%td=print_date c.validated_on
%td=@supplier.pmc_category(Date.today.year, c)
%td
@@ -171,23 +171,25 @@
%div.row
%h4#visure_header
= "Business Information e Rating"
- .pull-right=link_to '+',{:controller=>:suppliers, :action=>:nuova_visura, :id=>@supplier.id}, :title=>"Nuova" , :target=>"_blank"
+ .pull-right=link_to '+',{:controller=>:suppliers, :action=>:nuova_visura, :id=>@supplier.id}, :title=>"Nuova"
%table{:class=>"table table-bordered table-condensed"}
%tr
%th="Data"
%th="Tipo di documento"
%th="Data Validità"
+ %th="Data emissione"
- @supplier.visure.each do |v|
%tr
- %td=print_date v.created_at
+ %td=link_to (print_date v.created_at), modifica_visura_supplier_path(@supplier.id, :visura_id=>v.id)
%td=v.name
- %td=v.description
+ %td=v.data_validita
+ %td=v.data_emissione
%td=attach_link(v)
%div.row
%h4#contratti_header
= "Contratti "
- .pull-right=link_to '+',new_contract_path(:supplier_id=>@supplier.id), :title=>"Nuovo Contratto" , :target=>"_blank"
+ .pull-right=link_to '+',new_contract_path(:supplier_id=>@supplier.id), :title=>"Nuovo Contratto"
%table{:class=>"table table-bordered table-condensed"}
%tr
%th="Numero"
@@ -217,7 +219,7 @@
%tr
%td=p.state
%td=p.request_for_proposal.to_label
- %td=p.request_for_proposal.category.breadcumb
+ %td=content_tag :abbr, p.request_for_proposal.category.to_string, :title=>p.request_for_proposal.category.breadcumb
%td=link_to("Visualizza", proposal_path(p))
%div.row
@@ -236,8 +238,12 @@
%td=s.year
%td=link_to s.to_label, edit_score_path(s)
%td=s.proposal ? s.psc : s.gsq
- %td=s.proposal.request_for_proposal.category.breadcumb if s.proposal
+ %td=content_tag :abbr, s.proposal.request_for_proposal.category.to_string , :title=>s.proposal.request_for_proposal.category.breadcumb if s.proposal
%td=s.note
+ %td
+ =link_to("Modifica", score_path(s) , :class=>"btn btn-info" )
+ =link_to("Elimina", score_path(s), :method => :delete, data: { confirm: "Confermi la cancellazione di questa valutazione?" } , :class=>"btn btn-danger " ) unless s.proposal
+
View
3  config/initializers/aa_srm.rb
@@ -26,6 +26,9 @@
+
+
+Setting.default_for "valutazione|score_iniziale", 30
Setting.default_for "valutazione|tipo_forniture", %w"1 FornituraBeni 2 FornituraServizi".in_groups_of(2)
Setting.default_for "valutazione|score1_label_Proposal_1","Conformità della merce consegnata rispetto al CDF"
View
6 config/routes.rb
@@ -9,7 +9,10 @@
get "area_interna/setting"
resources :attachments
- resources :contracts
+ resources :contracts do
+ delete "elimina_valutazione" , :on=>:member
+ get "valuta" , :on=>:member
+ end
resources :settings do
get :list_autorizzazioni, :on=>:collection
post :update_autorizzazioni, :on=>:collection
@@ -62,6 +65,7 @@
get :monitoraggio, :on=>:collection
post :spedisci_inviti_accesso, :on=>:collection
get :nuova_valutazione, :on=>:member
+ get :modifica_visura, :on=>:member
get :prepara_mail, :on=>:member
get :stampa, :on=>:member
post :invia_mail, :on=>:member
Please sign in to comment.
Something went wrong with that request. Please try again.