Basic fullcalendar integration
This commit is contained in:
@@ -24,7 +24,7 @@ class SupplierEmployeesSettings
|
||||
end
|
||||
end
|
||||
|
||||
def persist
|
||||
def to_store!
|
||||
supplier.employee_settings_storage = dictionary
|
||||
end
|
||||
|
||||
@@ -42,7 +42,7 @@ class SupplierEmployeesSettings
|
||||
alias_method :orig_setter, :[]=
|
||||
def []=(*args)
|
||||
orig_setter(*args)
|
||||
all_employees_settings.persist
|
||||
all_employees_settings.to_store!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -74,7 +74,7 @@ class SupplierEmployeesSettings
|
||||
if employee = all_employees_settings.supplier.employees.find{|e| e.id == id}
|
||||
employee.public_send("#{attribute}=", value)
|
||||
end
|
||||
all_employees_settings.supplier.save if persist
|
||||
persist! if persist
|
||||
self
|
||||
end
|
||||
|
||||
@@ -86,6 +86,27 @@ class SupplierEmployeesSettings
|
||||
set attribute, value, persist: true
|
||||
end
|
||||
|
||||
def update(params)
|
||||
Employee::DEFAULT_SETTINGS.keys.each do |attribute|
|
||||
if params.has_key?(attribute)
|
||||
new_value = params.delete(attribute)
|
||||
set attribute, new_value
|
||||
end
|
||||
end
|
||||
params
|
||||
end
|
||||
|
||||
def update!(params)
|
||||
update params
|
||||
persist!
|
||||
params
|
||||
end
|
||||
|
||||
def persist!
|
||||
all_employees_settings.supplier.is_dirty
|
||||
all_employees_settings.supplier.save
|
||||
end
|
||||
|
||||
# Parse a method name to its underlying operations
|
||||
# settings.is_manager?
|
||||
# is a getter for the attribute manager
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Suppliers::EmployeeSerializer < Qwaiter::Serializer
|
||||
self.root = :employee
|
||||
embed :ids, include: true
|
||||
attributes :name, :email, :manager, :active
|
||||
attributes :name, :email, :manager, :active, :color
|
||||
end
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Suppliers::EmployeeShiftSerializer < Qwaiter::Serializer
|
||||
self.root = :employee_shift
|
||||
#embed :ids, include: true
|
||||
attributes :start_on, :end_on, :employee_id
|
||||
end
|
||||
@@ -9,4 +9,5 @@ class Suppliers::SupplierSerializer < Qwaiter::Serializer
|
||||
end
|
||||
has_many :sections, serializer: Suppliers::ExtendedSectionSerializer
|
||||
has_many :product_categories
|
||||
has_many :employees, serializer: Suppliers::EmployeeSerializer
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user