ecom_core 1.2.20 → 1.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/ecom/core/attendance_sheet.rb +18 -2
- data/app/models/ecom/core/crew.rb +1 -0
- data/app/models/ecom/core/overtime_sheet.rb +16 -0
- data/app/models/ecom/core/payment.rb +2 -0
- data/app/models/ecom/core/payroll.rb +10 -0
- data/app/models/ecom/core/task.rb +0 -1
- data/app/models/ecom/core/work_package.rb +1 -1
- data/app/models/ecom/core/work_product.rb +1 -0
- data/app/uploaders/ecom/core/photo_uploader.rb +15 -0
- data/db/migrate/20191202235434_create_ecom_core_work_products.rb +4 -0
- data/db/migrate/20191207103735_create_ecom_core_tasks.rb +0 -4
- data/db/migrate/20191225100054_create_ecom_core_crews.rb +1 -0
- data/db/migrate/20191225140433_create_ecom_core_attendance_sheets.rb +3 -2
- data/db/migrate/20200410090701_create_ecom_core_overtime_sheets.rb +3 -2
- data/lib/ecom/core/version.rb +1 -1
- data/lib/ecom_core.rb +2 -0
- data/spec/factories/ecom/core/application_modules.rb +3 -1
- data/spec/factories/ecom/core/attendance_sheets.rb +3 -2
- data/spec/factories/ecom/core/companies.rb +3 -1
- data/spec/factories/ecom/core/crews.rb +1 -0
- data/spec/factories/ecom/core/currencies.rb +6 -2
- data/spec/factories/ecom/core/equipment.rb +3 -1
- data/spec/factories/ecom/core/equipment_categories.rb +3 -1
- data/spec/factories/ecom/core/equipment_locations.rb +3 -1
- data/spec/factories/ecom/core/lookups.rb +3 -1
- data/spec/factories/ecom/core/overtime_sheets.rb +3 -2
- data/spec/factories/ecom/core/overtime_types.rb +3 -1
- data/spec/factories/ecom/core/product_groups.rb +3 -1
- data/spec/factories/ecom/core/product_types.rb +3 -1
- data/spec/factories/ecom/core/resource_types.rb +3 -1
- data/spec/factories/ecom/core/stakeholder_types.rb +3 -1
- data/spec/factories/ecom/core/stakeholders.rb +3 -1
- data/spec/factories/ecom/core/tasks.rb +0 -1
- data/spec/factories/ecom/core/work_products.rb +1 -0
- metadata +51 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55981c8967b5bc6d73d2ee78c31f2b0cdab1fbe48a43151ac23364b4b49c3a2e
|
4
|
+
data.tar.gz: c92cf858178d5225c806b0f65faf21bb67d819d2397fe564c0306866a950a34b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f79dd43c005604fed22a80bf4b071f1e07f5cddc8c6de368f96b7e0d06413d15edad31a73792ba353c31b8d7e9dc7c0553fe0a414bf9c065bcdb127f60dba7a
|
7
|
+
data.tar.gz: 4c4944902306db1e7317deb45cbcd5cdb91c0aa8ef9b12184ef2c9f25fcf1814fbebe6c1b6db6a63c48977e7484ae67fb6b73b2d2a503f30f2cfcaefcf26c1b7
|
@@ -61,7 +61,7 @@ module Ecom
|
|
61
61
|
|
62
62
|
raise 'There is no open attendance sheet to submit.' if sheet.nil?
|
63
63
|
|
64
|
-
sheet.
|
64
|
+
sheet.submitted_at = DateTime.now
|
65
65
|
sheet.status = StatusConstants::SUBMITTED
|
66
66
|
sheet.save
|
67
67
|
sheet
|
@@ -75,11 +75,27 @@ module Ecom
|
|
75
75
|
sheet = AttendanceSheet.open_for_date(date, project_id)
|
76
76
|
raise 'There is no open attendance sheet to submit for the selected day.' unless sheet
|
77
77
|
|
78
|
-
sheet.
|
78
|
+
sheet.submitted_at = DateTime.now
|
79
79
|
sheet.status = StatusConstants::SUBMITTED
|
80
80
|
sheet.save
|
81
81
|
sheet
|
82
82
|
end
|
83
|
+
|
84
|
+
def submit
|
85
|
+
raise 'Attendance sheet is not open and cannot be submitted' if status != StatusConstants::OPEN
|
86
|
+
|
87
|
+
self.submitted_at = DateTime.now
|
88
|
+
self.status = StatusConstants::SUBMITTED
|
89
|
+
save
|
90
|
+
end
|
91
|
+
|
92
|
+
def approve
|
93
|
+
raise 'Attendance sheet is not submitted and cannot be approved' unless status == StatusConstants::SUBMITTED
|
94
|
+
|
95
|
+
self.status = StatusConstants::APPROVED
|
96
|
+
self.approved_at = DateTime.now
|
97
|
+
save
|
98
|
+
end
|
83
99
|
end
|
84
100
|
end
|
85
101
|
end
|
@@ -44,6 +44,22 @@ module Ecom
|
|
44
44
|
|
45
45
|
OvertimeSheet.create(date: date, opened_at: Time.now, status: StatusConstants::OPEN, project_id: project_id)
|
46
46
|
end
|
47
|
+
|
48
|
+
def submit
|
49
|
+
raise 'Overtime sheet is not open and cannot be submitted' if status != StatusConstants::OPEN
|
50
|
+
|
51
|
+
self.submitted_at = DateTime.now
|
52
|
+
self.status = StatusConstants::SUBMITTED
|
53
|
+
save
|
54
|
+
end
|
55
|
+
|
56
|
+
def approve
|
57
|
+
raise 'Overtime sheet is not submitted and cannot be approved' unless status == StatusConstants::SUBMITTED
|
58
|
+
|
59
|
+
self.status = StatusConstants::APPROVED
|
60
|
+
self.approved_at = DateTime.now
|
61
|
+
save
|
62
|
+
end
|
47
63
|
end
|
48
64
|
end
|
49
65
|
end
|
@@ -9,6 +9,16 @@ module Ecom
|
|
9
9
|
scope :by_project, ->(id) { where(project_id: id) }
|
10
10
|
scope :by_month, ->(month) { where(month: month) }
|
11
11
|
scope :by_year, ->(year) { where(year: year) }
|
12
|
+
|
13
|
+
def create_next
|
14
|
+
m = month + 1
|
15
|
+
y = year
|
16
|
+
if m > 12
|
17
|
+
m = 1
|
18
|
+
y += 1
|
19
|
+
end
|
20
|
+
Payroll.create(month: m, year: y, project_id: project_id)
|
21
|
+
end
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
@@ -7,7 +7,6 @@ module Ecom
|
|
7
7
|
|
8
8
|
belongs_to :work_product
|
9
9
|
belongs_to :task_template
|
10
|
-
belongs_to :work_package, optional: true
|
11
10
|
belongs_to :performer, class_name: 'Ecom::Core::User', optional: true
|
12
11
|
belongs_to :approver, class_name: 'Ecom::Core::User', optional: true
|
13
12
|
belongs_to :supervisor, class_name: 'Ecom::Core::User', optional: true
|
@@ -26,6 +26,7 @@ module Ecom
|
|
26
26
|
belongs_to :work_product_template
|
27
27
|
belongs_to :project
|
28
28
|
belongs_to :product_group, optional: true
|
29
|
+
belongs_to :work_package, optional: true
|
29
30
|
belongs_to :approver, class_name: 'Ecom::Core::User', optional: true
|
30
31
|
belongs_to :supervisor, class_name: 'Ecom::Core::User', optional: true
|
31
32
|
belongs_to :quality_controller, class_name: 'Ecom::Core::User', optional: true
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Ecom
|
2
|
+
module Core
|
3
|
+
class PhotoUploader < CarrierWave::Uploader::Base
|
4
|
+
storage :file
|
5
|
+
|
6
|
+
def store_dir
|
7
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
8
|
+
end
|
9
|
+
|
10
|
+
def extension_whitelist
|
11
|
+
%w[jpg jpeg gif png]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -9,6 +9,10 @@ class CreateEcomCoreWorkProducts < ActiveRecord::Migration[6.0]
|
|
9
9
|
null: true,
|
10
10
|
index: { name: 'wp_on_pg_indx' },
|
11
11
|
foreign_key: { to_table: :ecom_core_product_groups }
|
12
|
+
t.references :work_package,
|
13
|
+
null: true,
|
14
|
+
index: { name: 'wp_on_wp_indx' },
|
15
|
+
foreign_key: { to_table: :ecom_core_work_packages }
|
12
16
|
t.references :work_product_template,
|
13
17
|
null: false,
|
14
18
|
index: { name: 'wpt_on_wp_indx' },
|
@@ -10,10 +10,6 @@ class CreateEcomCoreTasks < ActiveRecord::Migration[6.0]
|
|
10
10
|
t.string :status, null: false, default: :new
|
11
11
|
t.integer :percent_completed, null: false, default: 0
|
12
12
|
t.string :remark
|
13
|
-
t.references :work_package,
|
14
|
-
null: true,
|
15
|
-
index: { name: 'wp_on_wp_indx' },
|
16
|
-
foreign_key: { to_table: :ecom_core_work_packages }
|
17
13
|
t.references :performer,
|
18
14
|
null: true,
|
19
15
|
index: { name: 'tasks_on_performer_indx' },
|
@@ -12,6 +12,7 @@ class CreateEcomCoreCrews < ActiveRecord::Migration[6.0]
|
|
12
12
|
t.string :wage_in_words, null: false
|
13
13
|
t.date :employment_date
|
14
14
|
t.boolean :sub_contracted, null: false, default: false
|
15
|
+
t.string :photo
|
15
16
|
t.string :guarantor_name
|
16
17
|
t.string :guarantor_phone
|
17
18
|
t.boolean :active, null: false, default: true
|
@@ -2,8 +2,9 @@ class CreateEcomCoreAttendanceSheets < ActiveRecord::Migration[6.0]
|
|
2
2
|
def change
|
3
3
|
create_table :ecom_core_attendance_sheets do |t|
|
4
4
|
t.date :date, null: false
|
5
|
-
t.
|
6
|
-
t.
|
5
|
+
t.datetime :opened_at, null: false
|
6
|
+
t.datetime :submitted_at
|
7
|
+
t.datetime :approved_at
|
7
8
|
t.string :remark
|
8
9
|
t.string :status, null: false, default: 'Open'
|
9
10
|
t.references :project,
|
@@ -2,8 +2,9 @@ class CreateEcomCoreOvertimeSheets < ActiveRecord::Migration[6.0]
|
|
2
2
|
def change
|
3
3
|
create_table :ecom_core_overtime_sheets do |t|
|
4
4
|
t.date :date, null: false
|
5
|
-
t.
|
6
|
-
t.
|
5
|
+
t.datetime :opened_at, null: false
|
6
|
+
t.datetime :submitted_at
|
7
|
+
t.datetime :approved_at
|
7
8
|
t.string :remark
|
8
9
|
t.string :status, null: false, default: 'Open'
|
9
10
|
t.references :project,
|
data/lib/ecom/core/version.rb
CHANGED
data/lib/ecom_core.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :attendance_sheet, class: Ecom::Core::AttendanceSheet do
|
3
3
|
date { Date.today }
|
4
|
-
opened_at {
|
5
|
-
|
4
|
+
opened_at { DateTime.now }
|
5
|
+
submitted_at { nil }
|
6
|
+
approved_at { nil }
|
6
7
|
remark { FFaker::Name.name }
|
7
8
|
status { Ecom::Core::StatusConstants::OPEN }
|
8
9
|
association :project
|
@@ -3,7 +3,9 @@ FactoryBot.define do
|
|
3
3
|
sequence :code do |n|
|
4
4
|
"CCode#{n}"
|
5
5
|
end
|
6
|
-
name
|
6
|
+
sequence :name do |n|
|
7
|
+
"CName#{n}"
|
8
|
+
end
|
7
9
|
address { FFaker::Address.street_address }
|
8
10
|
telephone { FFaker::PhoneNumber.phone_number }
|
9
11
|
email { FFaker::Internet.email }
|
@@ -1,6 +1,8 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :equipment, class: Ecom::Core::Equipment do
|
3
|
-
name
|
3
|
+
sequence :name do |n|
|
4
|
+
"EQName#{n}"
|
5
|
+
end
|
4
6
|
description { FFaker::Name.name }
|
5
7
|
minimum_acquisition_time { 10 }
|
6
8
|
brands { ['Brand I', 'Brand II', 'Brand III'] }
|
@@ -1,8 +1,9 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :overtime_sheet, class: Ecom::Core::OvertimeSheet do
|
3
3
|
date { Date.today }
|
4
|
-
opened_at {
|
5
|
-
submitted_at {
|
4
|
+
opened_at { DateTime.now }
|
5
|
+
submitted_at { nil }
|
6
|
+
approved_at { nil }
|
6
7
|
status { Ecom::Core::StatusConstants::OPEN }
|
7
8
|
association :project
|
8
9
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :product_type, class: Ecom::Core::ProductType do
|
3
|
-
name
|
3
|
+
sequence :name do |n|
|
4
|
+
"PTname#{n}"
|
5
|
+
end
|
4
6
|
association :work_product_template
|
5
7
|
dimension { [{ name: 'length', label: 'length' }, { name: 'width', label: 'width' }] }
|
6
8
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :stakeholder, class: Ecom::Core::Stakeholder do
|
3
|
-
name
|
3
|
+
sequence :name do |n|
|
4
|
+
"Stakeholder #{n}"
|
5
|
+
end
|
4
6
|
type_of_business { FFaker::Name.name }
|
5
7
|
address { FFaker::Name.name }
|
6
8
|
license_no { FFaker::Name.name }
|
@@ -5,6 +5,7 @@ FactoryBot.define do
|
|
5
5
|
design_reference_no { FFaker::Guid.guid }
|
6
6
|
dimension { [{ label: 'Length', name: 'length', value: 12 }] }
|
7
7
|
association :product_group
|
8
|
+
association :work_package
|
8
9
|
association :work_product_template
|
9
10
|
association :project
|
10
11
|
status { Ecom::Core::WorkProduct::NEW }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecom_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07
|
11
|
+
date: 2020-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|
@@ -38,6 +38,26 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.10.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: after_commit_everywhere
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.1'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.1.5
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0.1'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.1.5
|
41
61
|
- !ruby/object:Gem::Dependency
|
42
62
|
name: ancestry
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +86,34 @@ dependencies:
|
|
66
86
|
- - ">="
|
67
87
|
- !ruby/object:Gem::Version
|
68
88
|
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: carrierwave
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: carrierwave-base64
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
69
117
|
- !ruby/object:Gem::Dependency
|
70
118
|
name: jwt
|
71
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -258,6 +306,7 @@ files:
|
|
258
306
|
- app/serializers/ecom/core/user_serializer.rb
|
259
307
|
- app/services/ecom/core/menu_service.rb
|
260
308
|
- app/services/ecom/core/token_auth_service.rb
|
309
|
+
- app/uploaders/ecom/core/photo_uploader.rb
|
261
310
|
- app/validators/ecom/core/date_range_validator.rb
|
262
311
|
- config/database.ci.yml
|
263
312
|
- config/routes.rb
|