Project initialize

This commit is contained in:
Zin Bo Thit
2026-01-28 09:53:14 +06:30
commit e8380c6e23
139 changed files with 4599 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
<h1>Departments#create</h1>
<p>Find me in app/views/departments/create.html.erb</p>

View File

@@ -0,0 +1,2 @@
<h1>Departments#destroy</h1>
<p>Find me in app/views/departments/destroy.html.erb</p>

View File

@@ -0,0 +1,31 @@
<h1>Edit Department</h1>
<%= form_with(model: @department, local: true) do |form| %>
<% if @department.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@department.errors.count, "error") %> prohibited this department from being saved:</h2>
<ul>
<% @department.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="form-group">
<div class="field">
<%= form.label :name %>
<%= form.text_field :name, placeholder: "Department name..." %>
</div>
<div class="field">
<%= form.label :description %>
<%= form.text_area :description, placeholder: "Department description...", rows: 4 %>
</div>
</div>
<div class="actions">
<%= form.submit "Update Department", class: "submit-btn" %>
<%= link_to "Cancel", @department, class: "cancel-btn" %>
</div>
<% end %>

View File

@@ -0,0 +1,36 @@
<h1>Departments</h1>
<% if flash[:notice] %>
<div class="notice"><%= flash[:notice] %></div>
<% end %>
<div class="departments-grid">
<% if @departments.empty? %>
<p class="empty-state">No departments found.</p>
<% else %>
<% @departments.each do |department| %>
<div class="department-card">
<h3><%= link_to department.name, department_path(department) %></h3>
<p><%= department.description %></p>
<div class="department-stats">
<div class="stat">
<strong>Users:</strong> <%= department.user_count %>
</div>
<div class="stat">
<strong>Tasks:</strong> <%= department.task_count %>
</div>
<div class="stat">
<strong>Open:</strong> <%= department.incomplete_task_count %>
</div>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="actions-section">
<% if current_user&.admin? %>
<%= link_to 'New Department', new_department_path, class: 'action-btn primary' %>
<% end %>
</div>

View File

@@ -0,0 +1,31 @@
<h1>New Department</h1>
<%= form_with(model: @department, local: true) do |form| %>
<% if @department.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@department.errors.count, "error") %> prohibited this department from being saved:</h2>
<ul>
<% @department.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="form-group">
<div class="field">
<%= form.label :name %>
<%= form.text_field :name, placeholder: "Department name..." %>
</div>
<div class="field">
<%= form.label :description %>
<%= form.text_area :description, placeholder: "Department description...", rows: 4 %>
</div>
</div>
<div class="actions">
<%= form.submit "Create Department", class: "submit-btn" %>
<%= link_to "Cancel", departments_path, class: "cancel-btn" %>
</div>
<% end %>

View File

@@ -0,0 +1,40 @@
<h1><%= @department.name %></h1>
<div class="department-info">
<p><%= @department.description %></p>
<div class="department-stats">
<h3>Department Statistics</h3>
<div class="stats-grid">
<div class="stat-item">
<strong>Total Users:</strong> <%= @department.user_count %>
</div>
<div class="stat-item">
<strong>Total Tasks:</strong> <%= @department.task_count %>
</div>
<div class="stat-item">
<strong>Open Tasks:</strong> <%= @department.incomplete_task_count %>
</div>
</div>
</div>
</div>
<div class="tasks-section">
<h2>Department Tasks</h2>
<% if @tasks.empty? %>
<p class="empty-state">No tasks in this department yet.</p>
<% else %>
<div class="tasks-list">
<% @tasks.each do |task| %>
<%= render 'tasks/task', task: task %>
<% end %>
</div>
<% end %>
</div>
<div class="department-actions">
<%= link_to 'Back to All Departments', departments_path, class: 'action-btn secondary' %>
<% if current_user&.can_manage_department?(@department) %>
<%= link_to 'Edit Department', edit_department_path(@department), class: 'action-btn primary' %>
<% end %>
</div>

View File

@@ -0,0 +1,2 @@
<h1>Departments#update</h1>
<p>Find me in app/views/departments/update.html.erb</p>