Skip to content

Commit

Permalink
crud for TrstHrEmployee
Browse files Browse the repository at this point in the history
  • Loading branch information
kfl62 committed Mar 23, 2009
1 parent 5f0c5c5 commit 6fabe40
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 51 deletions.
1 change: 1 addition & 0 deletions app/models/trst_hr.rb
Expand Up @@ -24,6 +24,7 @@
#Descriere ....
class TrstHr < ActiveRecord::Base
has_one :trst_hr_pdt
has_one :trst_hr_employee

def self.per_page
20
Expand Down
10 changes: 10 additions & 0 deletions app/models/trst_hr_employee.rb
Expand Up @@ -55,6 +55,8 @@
#Descriere ....
class TrstHrEmployee < ActiveRecord::Base
belongs_to :trst_hr
belongs_to :trst_firm
belongs_to :trst_payroll_job

def self.per_page
20
Expand All @@ -63,5 +65,13 @@ def self.per_page
def hr_name
"( " + self.trst_hr_id.to_s + " ) " + self.trst_hr.full_name
end

def firm_name
"( " + self.trst_firm_id.to_s + " ) " + self.trst_firm.full_name
end

def job_name
"( " + self.trst_payroll_job.jobID + " ) " + self.trst_payroll_job.descript
end

end
35 changes: 29 additions & 6 deletions app/views/trst_sys/hr/employee/_edit.html.erb
@@ -1,10 +1,10 @@
<div style="width : 380px; height : 240px;">
<div style="width : 380px; height : 320px;">
<% if params[:obj_id] == "new"
obj = TrstReplaceMe new
obj = TrstHrEmployee.new
else
obj = find_obj(TrstReplaceMe,params[:obj_id])
obj = find_obj(TrstHrEmployee,params[:obj_id])
end -%>
<% remote_form_for :replace_me_with_form_for, obj,
<% remote_form_for :employee, obj,
:url => {:action => 'task', :id => params[:id], :type => 'save', :obj_id => params[:obj_id]} do |f| %>
<table style="width:80%; margin:auto;">
<thead>
Expand All @@ -15,8 +15,31 @@
</thead>
<tbody>
<tr>
<%= f.td_label_tag :ReplaceMe %>
<%= f.td_text_field :ReplaceMe %>
<%= f.td_label_tag :trst_hr_id %>
<%= f.td_auto_complete_search :trst_hr_id, :size => 24,
:search_object => 'TrstHr',
:search_method => 'lst_name',
:hidden_field_value => 'id',
:informal => 'full_name'
%>
</tr>
<tr>
<%= f.td_label_tag :trst_firm_id %>
<%= f.td_auto_complete_search :trst_firm_id, :size => 24,
:search_object => 'TrstFirm',
:search_method => 'name',
:hidden_field_value => 'id',
:informal => 'full_name'
%>
</tr>
<tr>
<%= f.td_label_tag :trst_payroll_job_id %>
<%= f.td_auto_complete_search :trst_payroll_job_id, :size => 24,
:search_object => 'TrstPayrollJob',
:search_method => 'descript',
:hidden_field_value => 'id',
:informal => 'jobID'
%>
</tr>
<%= f.hidden_fields :updated_by => current_trst_user.id %>
<%= f.last_row_for :edit %>
Expand Down
12 changes: 5 additions & 7 deletions app/views/trst_sys/hr/employee/_list.html.erb
@@ -1,4 +1,4 @@
<% obj = trst_find_all(TrstReplaceMe) ; i = obj.offset %>
<% obj = trst_find_all(TrstHrEmployee) ; i = obj.offset %>
<% if obj.length == 0 %>
<script type="text/javascript"> alert("<%= t('activerecord.attributes.no_record') %>")</script>
<script type="text/javascript"> TrstWindow.edit(<%= params[:id] %>,"new");</script>
Expand All @@ -7,20 +7,18 @@
<table class="full">
<thead>
<th>&nbsp;</th>
<%= th_label_tag obj, :ReplaceMe %>
...
<%= th_label_tag obj, :id %>
<th>&nbsp;</th>
</thead>
<tbody>
<% for o in obj %>
<tr class="<%= cycle("even","odd")%>" >
<td align="right"><%= i += 1 %>.</td>
<%= td_value_tag o, :ReplaceMe %>
...
<%= td_value_tag o, :id %>
<%= link_to_task o, :last_column %>
<% end %>
<%= last_row_for obj, :row20, {:colspan => .., :offset => i } %>
<%= last_row_for obj, :list, {:colspan => .. } %>
<%= last_row_for obj, :row20, {:colspan => 12, :offset => i } %>
<%= last_row_for obj, :list, {:colspan => 11 } %>
</tbody>
</table>
</div>
Expand Down
20 changes: 10 additions & 10 deletions app/views/trst_sys/hr/employee/_save.html.erb
@@ -1,17 +1,17 @@
<% if params[:obj_id] == "new"
params[:replace_me_with_form_for][:created_by] = current_trst_user.id
save_obj(Trst.ReplaceMe,params[:obj_id],params[:replace_me_with_form_for])
o = find_obj(Trst.ReplaceMe,'last')
params[:employee][:created_by] = current_trst_user.id
save_obj(TrstHrEmployee,params[:obj_id],params[:employee])
o = find_obj(TrstHrEmployee,'last')
params[:obj_id] = o.id
obs = t('tasks.replace_me_with_trans.save.create')
obs = t('tasks.db_trst_hr_employee.save.create')
elsif params[:remove]
o = find_obj(Trst.ReplaceMe,params[:obj_id])
obs = t('tasks.replace_me_with_trans.save.remove', :TransParam => o.Value)
Trst.ReplaceMe.delete(params[:obj_id])
o = find_obj(TrstHrEmployee,params[:obj_id])
obs = t('tasks.db_trst_hr_employee.save.remove', :employee_name => o.trst_hr.full_name)
TrstHrEmployee.delete(params[:obj_id])
else
save_obj(Trst.ReplaceMe,params[:obj_id],params[:replace_me_with_form_for])
o = find_obj(Trst.ReplaceMe,params[:obj_id])
obs = t('tasks.replace_me_with_trans.save.update')
save_obj(TrstHrEmployee,params[:obj_id],params[:employee])
o = find_obj(TrstHrEmployee,params[:obj_id])
obs = t('tasks.db_trst_hr_employee.save.update')
end -%>
<% if params[:remove] %>
<div align="center" style="width:400px;height:3em">
Expand Down
6 changes: 3 additions & 3 deletions app/views/trst_sys/hr/employee/_show.html.erb
@@ -1,5 +1,5 @@
<div style="width:460px;height:310px">
<% o = find_obj(TrstReplaceMe,params[:obj_id]) %>
<% o = find_obj(TrstHrEmployee,params[:obj_id]) %>
<table style="width:80%; margin:auto;">
<thead>
<tr>
Expand All @@ -9,8 +9,8 @@
</thead>
<tbody align="left">
<tr>
<%= td_label_tag o, :ReplaceMe %>
<%= td_value_tag o, :ReplaceMe %>
<%= td_label_tag o, :id %>
<%= td_value_tag o, :id %>
</tr>
<tr>
<td colspan="2"><hr/></td>
Expand Down
50 changes: 25 additions & 25 deletions config/locales/trst_hr_employee.yml
Expand Up @@ -88,28 +88,28 @@ ro:
tasks:
db_hr_employee:
list:
id: ""
trst_hr_id: ""
trst_firm_id: ""
trst_payroll_job_id: ""
CIM_id: ""
CIM_date: ""
ITM_id: ""
ITM_date: ""
PM_sr: ""
PM_nr: ""
PM_date: ""
CIM_object: ""
CIM_durata: ""
CIM_start: ""
CIM_end: ""
wrkh_day: ""
wrkh_week: ""
id: "Id."
trst_hr_id: "Nume angajat"
trst_firm_id: "Firma/Angajator"
trst_payroll_job_id: "Ocupaţia"
CIM_id: "Marca"
CIM_date: "Data angajării"
ITM_id: "Nr. ITM"
ITM_date: "Data înregistrării"
PM_sr: "Permis de muncă seria"
PM_nr: "Permis de muncă nr."
PM_date: "Permis de muncă dată"
CIM_object: "Obiectul contractului"
CIM_durata: "Durata"
CIM_start: "De la"
CIM_end: "Pâna la"
wrkh_day: "Ore/Zi"
wrkh_week: "Ore/Săptămână"
wrkh_day_1: ""
wrkh_week_1: ""
CO_days: ""
CO_dayss: ""
slry_month: ""
CO_days: "Zile CO"
CO_dayss: "Zile CO supl."
slry_month: "Salar lunar"
slry_2a: ""
slry_2b: ""
slry_2c: ""
Expand All @@ -126,15 +126,15 @@ ro:
create: "Detaliile ptr. angajat au fost create ..."
update: "Modificările au fost salvate..."
remove: "Detaliile ptr. angajatul <strong>{{employee_name}}</strong> a fost şterse..."
link_to_show: "Detalii firmă"
link_to_list: "Lista firmelor"
link_to_show: "Detalii angajat"
link_to_list: "Lista angajaţilor"
show:
link_to_edit: "Editare firmă"
link_to_list: "Lista firmelor"
link_to_edit: "Editare angajat"
link_to_list: "Lista angajaţilor"
activerecord:
attributes:
trst_hr_employee:
id: "ID"
id: "Id"
trst_hr_id: "Nume"
trst_firm_id: "Firma"
trst_payroll_job_id: "Ocupaţia"
Expand Down

0 comments on commit 6fabe40

Please sign in to comment.