This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(document).ready(function() { | |
$("select#ema").select2(); | |
}); | |
</script> | |
<br> | |
<div class="field" id="recipients_selection"> | |
<%= f.label "Or send to select emails from employee database" %><br> | |
<%= select_tag :bulk_mail_recipients, options_from_collection_for_select(@employees, :id, :email), id: :ema, :multiple => :multiple, :multiple => true, :style => "width:800px;", data: {placeholder: "Choose an email"} %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# controller code | |
def allContacts | |
@locations_hash = {} | |
@contacts_name_hash = {} | |
@contacts_email_hash = {} | |
Location.all.each do |location| | |
@locations_hash[location.id] = location.name | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# controller code | |
def index | |
@paginatable_employees = Kaminari.paginate_array(Employee.all).page(params[:page]).per(10) | |
end | |
# view code. filename : index.html.erb | |
<table> | |
<thead> | |
<tr> | |
<th>Emp No</th> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Offer model code | |
has_and_belongs_to_many :offer_attachments, join_table: "oa_join" | |
has_many :offer_random_attachments, :dependent => :destroy | |
class OfferAttachment < ActiveRecord::Base | |
has_and_belongs_to_many :offers, join_table: "oa_join" | |
end | |
class OfferRandomAttachment < ActiveRecord::Base | |
belongs_to :offer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# controller code | |
@offers_grid = initialize_grid(Offer.where(employee_id: myself.id), include: [:customer, :employee]) | |
# view code | |
<h1>Listing Offers</h1> | |
<%= grid(@offers_grid) do |g| | |
g.column name: 'Offer Id', attribute: 'offer_id', filter: false | |
if @cmd == true | |
g.column name: 'Sent By', attribute: 'name', assoc: :employee, custom_filter: @offer_senders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Travel < ActiveRecord::Base | |
belongs_to :expenses_claim | |
has_many :travel_expenses | |
accepts_nested_attributes_for :travel_expenses, allow_destroy: true | |
validates :end_date, presence: true, date: { :after_or_equal_to => :start_date, message: "must be after or equal to start date."} | |
validates :end_date, presence: true, date: { :before_or_equal_to => Proc.new { Time.now }, message: "must be today #{(Date.today).to_s} or before." }, on: :create | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From date is start of financial year if not input | |
if params[:from_date] == '' | |
from_date = DateTime.now.beginning_of_day.beginning_of_financial_year.to_date | |
else | |
from_date = params[:from_date] | |
end | |
# To date is today if not input | |
if params[:to_date] == '' | |
to_date = Date.today.to_date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.fiscal_zone = :india | |
Time.fiscal_zone = :india | |
DateTime.fiscal_zone = :india |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'prawn/table' | |
def instruments_table_data | |
@instruments_table_data = [["Equipment", "Qty", "Scope"]] | |
@offers_instruments.each do |instr| | |
@instruments_table_data << [instr['name'], instr['qty'], instr['scope']] | |
end | |
return @instruments_table_data | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if current_user.has_role? :cxo or | |
Bulk_email_team.include? current_user.email %> | |
<li class="dropdown "> | |
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Bulk Mail</a> | |
<ul class="dropdown-menu to-right"> | |
<li><a href="/bulk_mails/new">To Customers</a></li> | |
<li><a href="/bulk_mails/toEmployees">To Employees</a></li> | |
<li><a href="/bulk_mails">View All</a></li> | |
</ul> | |
</li> |