stay_commerce 0.1.12 → 0.1.14

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/stay/admin/properties_controller.rb +1 -9
  3. data/app/controllers/stay/admin/rooms_controller.rb +2 -2
  4. data/app/controllers/stay/api/v1/amenities_controller.rb +38 -6
  5. data/app/controllers/stay/api/v1/features_controller.rb +32 -6
  6. data/app/controllers/stay/api/v1/property_categories_controller.rb +43 -5
  7. data/app/controllers/stay/api/v1/property_types_controller.rb +32 -9
  8. data/app/controllers/stay/users/registrations_controller.rb +7 -0
  9. data/app/controllers/stay/users/sessions_controller.rb +7 -0
  10. data/app/helpers/stay/application_helper.rb +44 -14
  11. data/app/models/stay/amenity.rb +0 -2
  12. data/app/models/stay/feature.rb +0 -1
  13. data/app/models/stay/property.rb +1 -1
  14. data/app/models/stay/room_type.rb +3 -2
  15. data/app/serializers/feature_serializer.rb +3 -0
  16. data/app/serializers/property_listing_serializer.rb +1 -1
  17. data/app/serializers/property_serializer.rb +1 -1
  18. data/app/serializers/room_serializer.rb +2 -2
  19. data/app/views/stay/admin/amenities/index.html.erb +2 -2
  20. data/app/views/stay/admin/features/index.html.erb +2 -2
  21. data/app/views/stay/admin/properties/_description.html.erb +12 -53
  22. data/app/views/stay/admin/properties/_details.html.erb +2 -26
  23. data/app/views/stay/admin/properties/_form.html.erb +2 -34
  24. data/app/views/stay/admin/properties/_location.html.erb +6 -6
  25. data/app/views/stay/admin/properties/_sidebar.html.erb +7 -7
  26. data/app/views/stay/admin/properties/index.html.erb +56 -60
  27. data/app/views/stay/admin/properties/show.html.erb +0 -78
  28. data/app/views/stay/admin/rooms/_form.html.erb +42 -34
  29. data/app/views/stay/admin/rooms/index.html.erb +59 -60
  30. data/app/views/stay/admin/rooms/show.html.erb +15 -5
  31. data/app/views/stay/admin/users/show.html.erb +6 -3
  32. data/lib/stay/version.rb +1 -2
  33. metadata +3 -3
  34. data/app/serializers/property_feature_serializer.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7666bce8280d873c254de1000f27e045c0de5fd8a3dec3bcae2ffbc3b5b0e321
4
- data.tar.gz: 0e217c0d0723fda01c66d307b3296b581a9e786ed333d279033668cbcda6889e
3
+ metadata.gz: 21d65148be51476482fe86e79472e2e0bf311f49f9def7ee1be0d94cc908484e
4
+ data.tar.gz: d930047ffebe22e514475ee2a965c840ec7961265d2e3dd48126ac27551b01ef
5
5
  SHA512:
6
- metadata.gz: cdd0be0c0dc98f8b3227f5f7636db735df93a329ce0e7ba604aa2c9a82c3dda5a36d36ab016e04ead29e3517030971357fd65f76861538cc10ffccaf7c108007
7
- data.tar.gz: ba03f68fdcb000c05c39904ccd94afea3732eeb8cb2f26667b31324259b31e8166ba4ed3088d4592a94dce0b1b723f9040226d59285b501e38356f7e2cd829f5
6
+ metadata.gz: f4edf72e5d17bd18491b58f3b84b945ea297c01c7a0eb85e309a6899ed69a99cd92f96f81b121d387f22082fed143fe08ccc505fd9210849293f43fde2b5a405
7
+ data.tar.gz: 5fa10e530142899cffc424179a44001aabd2eb4e6897c836a76537b1c3323540005ba646212c74f9867f6c10740329396eedfa389fa19da0689018f96599294f
@@ -93,26 +93,18 @@ module Stay
93
93
  def determine_next_step(current_step)
94
94
  case current_step
95
95
  when "description"
96
- "price"
97
- when "price"
98
96
  "images"
99
97
  when "images"
100
98
  "details"
101
99
  when "details"
102
100
  "location"
103
- when "location"
104
- "amenities"
105
- when "amenities"
106
- "features"
107
- when "features"
108
- "calendar"
109
101
  else
110
102
  "description"
111
103
  end
112
104
  end
113
105
 
114
106
  def valid_step?(step)
115
- %w[description price images details location amenities features calendar].include?(step)
107
+ %w[description images details location].include?(step)
116
108
  end
117
109
  end
118
110
  end
@@ -5,7 +5,7 @@ module Stay
5
5
  before_action :set_room, only: %i[show edit update destroy]
6
6
 
7
7
  def index
8
- @rooms = @property.rooms
8
+ @rooms = @property.rooms.page(params[:page]).per(10)
9
9
  end
10
10
 
11
11
  def show
@@ -51,7 +51,7 @@ module Stay
51
51
  end
52
52
 
53
53
  def room_params
54
- params.require(:room).permit(:property_id, :max_guests, :price_per_month, :room_type_id, :booking_start, :booking_end, :description,
54
+ params.require(:room).permit(:property_id, :max_guests, :price_per_month, :room_type_id, :booking_start, :booking_end, :description, :name,
55
55
  :size, :bed_type_id, :status, amenity_ids: [], feature_ids: [], room_images: [],
56
56
  room_amenities_attributes: [ :id, :amenity_id, :_destroy ],
57
57
  room_features_attributes: [ :id, :name, :feature_id, :_destroy ],
@@ -1,13 +1,45 @@
1
1
  class Stay::Api::V1::AmenitiesController < ApplicationController
2
- before_action :authenticate_devise_api_token!
3
-
4
2
  def property
5
- amenities = Stay::Amenity.where(amenity_type: "property").all
6
- render json: { data: ActiveModelSerializers::SerializableResource.new(amenities, each_serializer: AmenitySerializer) }
3
+ amenities = Stay::Amenity.property
4
+
5
+ if amenities.exists?
6
+ render json: {
7
+ success: true,
8
+ data: ActiveModelSerializers::SerializableResource.new(amenities, each_serializer: AmenitySerializer)
9
+ }, status: :ok
10
+ else
11
+ render json: {
12
+ success: false,
13
+ message: "No property amenities found"
14
+ }, status: :not_found
15
+ end
16
+ rescue => e
17
+ render json: {
18
+ success: false,
19
+ error: "Failed to fetch property amenities",
20
+ message: e.message
21
+ }, status: :internal_server_error
7
22
  end
8
23
 
9
24
  def room
10
- amenities = Stay::Amenity.where(amenity_type: "room").all
11
- render json: { data: ActiveModelSerializers::SerializableResource.new(amenities, each_serializer: AmenitySerializer) }
25
+ amenities = Stay::Amenity.room
26
+
27
+ if amenities.exists?
28
+ render json: {
29
+ success: true,
30
+ data: ActiveModelSerializers::SerializableResource.new(amenities, each_serializer: AmenitySerializer)
31
+ }, status: :ok
32
+ else
33
+ render json: {
34
+ success: false,
35
+ message: "No room amenities found"
36
+ }, status: :not_found
37
+ end
38
+ rescue => e
39
+ render json: {
40
+ success: false,
41
+ error: "Failed to fetch room amenities",
42
+ message: e.message
43
+ }, status: :internal_server_error
12
44
  end
13
45
  end
@@ -3,19 +3,45 @@ class Stay::Api::V1::FeaturesController < Stay::BaseApiController
3
3
 
4
4
  def property
5
5
  features = Stay::Feature.property
6
- if features.any?
7
- render json: { data:ActiveModelSerializers::SerializableResource.new(features, each_serializer: PropertyFeatureSerializer) ,success: true }, status: :ok
6
+
7
+ if features.exists?
8
+ render json: {
9
+ success: true,
10
+ data: ActiveModelSerializers::SerializableResource.new(features, each_serializer: FeatureSerializer)
11
+ }, status: :ok
8
12
  else
9
- render json: { error:"no feature found", success: false }, status: :unprocessable_entity
13
+ render json: {
14
+ success: false,
15
+ message: "No property features found"
16
+ }, status: :not_found
10
17
  end
18
+ rescue => e
19
+ render json: {
20
+ success: false,
21
+ error: "Failed to fetch property features",
22
+ message: e.message
23
+ }, status: :internal_server_error
11
24
  end
12
25
 
13
26
  def room
14
27
  features = Stay::Feature.room
15
- if features.any?
16
- render json: { data:ActiveModelSerializers::SerializableResource.new(features, each_serializer: PropertyFeatureSerializer) ,success: true }, status: :ok
28
+
29
+ if features.exists?
30
+ render json: {
31
+ success: true,
32
+ data: ActiveModelSerializers::SerializableResource.new(features, each_serializer: FeatureSerializer)
33
+ }, status: :ok
17
34
  else
18
- render json: { error:"no feature found", success: false }, status: :unprocessable_entity
35
+ render json: {
36
+ success: false,
37
+ message: "No room features found"
38
+ }, status: :not_found
19
39
  end
40
+ rescue => e
41
+ render json: {
42
+ success: false,
43
+ error: "Failed to fetch room features",
44
+ message: e.message
45
+ }, status: :internal_server_error
20
46
  end
21
47
  end
@@ -2,13 +2,51 @@ class Stay::Api::V1::PropertyCategoriesController < Stay::BaseApiController
2
2
  before_action :authenticate_devise_api_token!
3
3
 
4
4
  def index
5
- @type = Stay::PropertyCategory.all
6
- return render json: { error: "no data found", success: false }, status: :not_found unless @type.any?
7
- render json: { data: ActiveModelSerializers::SerializableResource.new(@type, each_serializer: PropertyCategorySerializer), message: "data found", success: true }, status: :ok
5
+ categories = Stay::PropertyCategory.all
6
+
7
+ if categories.exists?
8
+ serialized_data = ActiveModelSerializers::SerializableResource.new(categories, each_serializer: PropertyCategorySerializer)
9
+ render json: {
10
+ data: serialized_data,
11
+ message: "Property categories found",
12
+ success: true
13
+ }, status: :ok
14
+ else
15
+ render json: {
16
+ data: [],
17
+ message: "No property categories found",
18
+ success: false
19
+ }, status: :not_found
20
+ end
21
+ rescue => e
22
+ render json: {
23
+ error: "Failed to fetch property categories",
24
+ message: e.message,
25
+ success: false
26
+ }, status: :internal_server_error
8
27
  end
9
28
 
10
29
  def show
11
- @type = Stay::PropertyCategory.find_by(id: params[:id])
12
- render json: { data: PropertyCategorySerializer.new(@type), message: "data found", success: true }, status: :ok
30
+ category = Stay::PropertyCategory.find_by(id: params[:id])
31
+
32
+ if category.present?
33
+ render json: {
34
+ data: PropertyCategorySerializer.new(category),
35
+ message: "Property category found",
36
+ success: true
37
+ }, status: :ok
38
+ else
39
+ render json: {
40
+ data: {},
41
+ message: "Property category not found",
42
+ success: false
43
+ }, status: :not_found
44
+ end
45
+ rescue => e
46
+ render json: {
47
+ error: "Failed to fetch property category",
48
+ message: e.message,
49
+ success: false
50
+ }, status: :internal_server_error
13
51
  end
14
52
  end
@@ -3,13 +3,13 @@ class Stay::Api::V1::PropertyTypesController < Stay::BaseApiController
3
3
 
4
4
  def index
5
5
  property_types = Stay::PropertyType.all
6
-
7
- if property_types.any?
6
+
7
+ if property_types.exists?
8
8
  serialized_data = ActiveModelSerializers::SerializableResource.new(property_types, each_serializer: PropertyTypeSerializer)
9
-
9
+
10
10
  render json: {
11
11
  data: serialized_data,
12
- message: "Data found",
12
+ message: "Property types found",
13
13
  success: true
14
14
  }, status: :ok
15
15
  else
@@ -17,14 +17,37 @@ class Stay::Api::V1::PropertyTypesController < Stay::BaseApiController
17
17
  data: [],
18
18
  message: "No property types found",
19
19
  success: false
20
- }, status: :ok
20
+ }, status: :not_found
21
21
  end
22
+ rescue => e
23
+ render json: {
24
+ error: "Failed to fetch property types",
25
+ message: e.message,
26
+ success: false
27
+ }, status: :internal_server_error
22
28
  end
23
-
24
29
 
25
30
  def show
26
- @type = Stay::PropertyType.find_by(id: params[:id])
27
- return render json: { error: "no data found", success: false }, status: :unprocessable_entity if @type.nil?
28
- render json: { data: PropertyTypeSerializer.new(@type), message: "data found", success: true }, status: :ok
31
+ type = Stay::PropertyType.find_by(id: params[:id])
32
+
33
+ if type.present?
34
+ render json: {
35
+ data: PropertyTypeSerializer.new(type),
36
+ message: "Property type found",
37
+ success: true
38
+ }, status: :ok
39
+ else
40
+ render json: {
41
+ data: {},
42
+ message: "Property type not found",
43
+ success: false
44
+ }, status: :not_found
45
+ end
46
+ rescue => e
47
+ render json: {
48
+ error: "Failed to fetch property type",
49
+ message: e.message,
50
+ success: false
51
+ }, status: :internal_server_error
29
52
  end
30
53
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Stay::Users::RegistrationsController < Devise::RegistrationsController
4
+ before_action :redirects
5
+
4
6
  # before_action :configure_sign_up_params, only: [:create]
5
7
  # before_action :configure_account_update_params, only: [:update]
6
8
 
@@ -59,4 +61,9 @@ class Stay::Users::RegistrationsController < Devise::RegistrationsController
59
61
  # def after_inactive_sign_up_path_for(resource)
60
62
  # super(resource)
61
63
  # end
64
+ private
65
+
66
+ def redirects
67
+ redirect_to "/admin/login"
68
+ end
62
69
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Stay::Users::SessionsController < Devise::SessionsController
4
+ before_action :redirects
4
5
  # before_action :configure_sign_in_params, only: [:create]
5
6
 
6
7
  # GET /resource/sign_in
@@ -24,4 +25,10 @@ class Stay::Users::SessionsController < Devise::SessionsController
24
25
  # def configure_sign_in_params
25
26
  # devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
26
27
  # end
28
+
29
+ private
30
+
31
+ def redirects
32
+ redirect_to "/admin/login"
33
+ end
27
34
  end
@@ -3,8 +3,38 @@ module Stay
3
3
  include CurrencyHelper
4
4
  ICON_SIZE = 14
5
5
 
6
- def svg_icon(name:, classes: '', width:, height:)
7
- if name.ends_with?('.svg')
6
+ def badge_class(state)
7
+ case state
8
+ when "approved"
9
+ "green"
10
+ when "rejected"
11
+ "red"
12
+ when "accepted"
13
+ "orange"
14
+ when "confirmed"
15
+ "green"
16
+ when "booking_request"
17
+ "orange"
18
+ when "invoice_sent"
19
+ "orange"
20
+ when "canceled"
21
+ "red"
22
+ end
23
+ end
24
+
25
+ def icon_class(state)
26
+ case state
27
+ when "approved"
28
+ "icon-check-circle"
29
+ when "rejected"
30
+ "icon-times-circle"
31
+ else
32
+ "icon-exclamation-circle"
33
+ end
34
+ end
35
+
36
+ def svg_icon(name:, classes: "", width:, height:)
37
+ if name.ends_with?(".svg")
8
38
  icon_name = File.basename(name, File.extname(name))
9
39
  inline_svg_tag "#{icon_name}.svg", class: "icon-#{icon_name} #{classes}", size: "#{width}px*#{height}px"
10
40
  else
@@ -14,8 +44,8 @@ module Stay
14
44
 
15
45
  def active_badge(condition, options = {})
16
46
  label = options[:label]
17
- label ||= condition ? I18n.t('admin.say_yes') : I18n.t('admin.say_no')
18
- css_class = condition ? 'badge-active' : 'badge-inactive'
47
+ label ||= condition ? I18n.t("admin.say_yes") : I18n.t("admin.say_no")
48
+ css_class = condition ? "badge-active" : "badge-inactive"
19
49
 
20
50
  content_tag(:small, class: "badge badge-pill #{css_class}") do
21
51
  label
@@ -25,16 +55,16 @@ module Stay
25
55
  def link_to_with_icon(icon_name, text, url, options = {})
26
56
  options[:class] = (options[:class].to_s + " icon-link with-tip action-#{icon_name}").strip
27
57
  options[:title] = text if options[:no_text]
28
- text = options[:no_text] ? '' : content_tag(:span, text)
58
+ text = options[:no_text] ? "" : content_tag(:span, text)
29
59
  options.delete(:no_text)
30
60
  options[:width] ||= ICON_SIZE
31
61
  options[:height] ||= ICON_SIZE
32
62
  if icon_name
33
- icon = if icon_name.ends_with?('.svg')
63
+ icon = if icon_name.ends_with?(".svg")
34
64
  svg_icon(name: icon_name, classes: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}", width: options[:width], height: options[:height])
35
- else
36
- content_tag(:span, '', class: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}")
37
- end
65
+ else
66
+ content_tag(:span, "", class: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}")
67
+ end
38
68
  text = "#{icon} #{text}"
39
69
  end
40
70
  link_to(text.html_safe, url, options)
@@ -43,17 +73,17 @@ module Stay
43
73
  def button_to_with_icon(icon_name, text, url, options = {})
44
74
  options[:class] = (options[:class].to_s + " icon-link with-tip action-#{icon_name}").strip
45
75
  options[:title] = text if options[:no_text]
46
- text = options[:no_text] ? '' : content_tag(:span, text)
76
+ text = options[:no_text] ? "" : content_tag(:span, text)
47
77
  options.delete(:no_text)
48
78
  options[:width] ||= ICON_SIZE
49
79
  options[:height] ||= ICON_SIZE
50
80
 
51
81
  if icon_name
52
- icon = if icon_name.ends_with?('.svg')
82
+ icon = if icon_name.ends_with?(".svg")
53
83
  svg_icon(name: icon_name, classes: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}", width: options[:width], height: options[:height])
54
- else
55
- content_tag(:span, '', class: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}")
56
- end
84
+ else
85
+ content_tag(:span, "", class: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}")
86
+ end
57
87
  text = "#{icon} #{text}".html_safe
58
88
  end
59
89
 
@@ -7,7 +7,5 @@ module Stay
7
7
 
8
8
  has_many :room_amenities, class_name: "Stay::RoomAmenity"
9
9
  has_many :rooms, through: :room_amenities, class_name: "Stay::Room"
10
-
11
- validates :name, presence: true, uniqueness: { case_sensitive: false }
12
10
  end
13
11
  end
@@ -6,6 +6,5 @@ module Stay
6
6
  has_many :rooms, through: :room_features, class_name: "Stay::Room"
7
7
 
8
8
  enum :feature_type, { property: 0, room: 1 }
9
- validates :name, presence: true, uniqueness: { case_sensitive: false }
10
9
  end
11
10
  end
@@ -1,5 +1,6 @@
1
1
  module Stay
2
2
  class Property < ApplicationRecord
3
+ STATUSES = %w[active inactive].freeze
3
4
  ACTIVE_STATUS = "active".freeze
4
5
  APPROVED = "approved".freeze
5
6
  PROPERTY = "property".freeze
@@ -58,7 +59,6 @@ module Stay
58
59
 
59
60
  after_restore :restore_associated_rooms
60
61
  after_restore :restore_active_storage_files
61
- after_create :create_default_room
62
62
  after_update :update_prices
63
63
  after_create :create_store_property
64
64
  geocoded_by :combine_address
@@ -1,7 +1,8 @@
1
1
  module Stay
2
2
  class RoomType < ApplicationRecord
3
- has_many :rooms, class_name: "Stay::Room"
3
+ has_many :rooms, class_name: "Stay::Room", dependent: :destroy
4
4
 
5
- validates :name, presence: true, uniqueness: { case_sensitive: false }, format: { without: /\s/, message: "must contain no spaces" }
5
+ validates :name, presence: true, uniqueness: { case_sensitive: false },
6
+ format: { without: /_/, message: "must not contain underscores" }
6
7
  end
7
8
  end
@@ -0,0 +1,3 @@
1
+ class FeatureSerializer < ActiveModel::Serializer
2
+ attributes :id, :name, :feature_type
3
+ end
@@ -1,7 +1,7 @@
1
1
  class PropertyListingSerializer < ActiveModel::Serializer
2
2
  attributes :id, :title, :price_per_month, :place_images, :total_rooms,
3
3
  :availability_end, :availability_start, :extra_guest, :latitude,
4
- :longitude, :address, :city, :state, :country, :active, :property_state
4
+ :longitude, :address, :city, :state, :country, :active, :property_state, :slug
5
5
 
6
6
  belongs_to :property_category, Serializer: :PropertyCategorySerializer
7
7
  belongs_to :property_type, Serializer: :PropertyTypeSerializer
@@ -16,7 +16,7 @@ class PropertySerializer < ActiveModel::Serializer
16
16
  end
17
17
 
18
18
  def features
19
- ActiveModelSerializers::SerializableResource.new(object.property_type_features, each_serializer: PropertyFeatureSerializer)
19
+ ActiveModelSerializers::SerializableResource.new(object.property_type_features, each_serializer: FeatureSerializer)
20
20
  end
21
21
 
22
22
  def is_shared_property
@@ -1,5 +1,5 @@
1
1
  class RoomSerializer < ActiveModel::Serializer
2
- attributes :id, :max_guests, :price_per_month, :status, :booked_dates,
2
+ attributes :id, :name,:max_guests, :price_per_month, :status, :booked_dates,
3
3
  :booking_start, :booking_end, :description,
4
4
  :size, :bed_type, :room_type, :amenities, :features, :room_images
5
5
 
@@ -16,7 +16,7 @@ class RoomSerializer < ActiveModel::Serializer
16
16
  end
17
17
 
18
18
  def features
19
- ActiveModelSerializers::SerializableResource.new(object.features.distinct, each_serializer: PropertyFeatureSerializer)
19
+ ActiveModelSerializers::SerializableResource.new(object.features.distinct, each_serializer: FeatureSerializer)
20
20
  end
21
21
 
22
22
  def room_images
@@ -33,8 +33,8 @@
33
33
  <% @amenities.each_with_index do |amenity, index| %>
34
34
  <tr>
35
35
  <td><%= index + 1%></td>
36
- <td><%= amenity.name %></td>
37
- <th scope="col"><%= amenity.amenity_type%></th>
36
+ <td><%= amenity.name&.humanize %></td>
37
+ <th scope="col"><%= amenity.amenity_type&.humanize%></th>
38
38
  <td class="text-end d-flex justify-content-center">
39
39
  <%= link_to edit_admin_amenity_path(amenity), class: 'btn d-inline-flex btn-sm btn-neutral mx-1' do %>
40
40
  <i class="bi bi-pencil"></i>
@@ -33,8 +33,8 @@
33
33
  <% @features.each_with_index do |feature, index| %>
34
34
  <tr>
35
35
  <td><%= index + 1%></td>
36
- <td><%= feature.name %></td>
37
- <td><%= feature.feature_type %></td>
36
+ <td><%= feature.name&.humanize %></td>
37
+ <td><%= feature.feature_type&.humanize %></td>
38
38
  <td class="text-end d-flex justify-content-center">
39
39
  <%= link_to edit_admin_feature_path(feature), class: 'btn d-inline-flex btn-sm btn-neutral mx-1' do %>
40
40
  <i class="bi bi-pencil"></i>
@@ -13,15 +13,15 @@
13
13
  <div class="row">
14
14
  <div class="col-md-6">
15
15
  <div class="field">
16
- <%= f.label :title, '*Title (mandatory)', class: "form-label" %>
16
+ <%= f.label :title, '*Title', class: "form-label" %>
17
17
  <%= f.text_field :title, required: true, class: 'form-control' %>
18
18
  </div>
19
19
  </div>
20
20
 
21
21
  <div class="col-md-6">
22
22
  <div class="field">
23
- <%= f.label :description, 'Description', class: "form-label" %>
24
- <%= f.text_area :description, class: 'form-control' %>
23
+ <%= f.label :description, '*Description', class: "form-label" %>
24
+ <%= f.text_area :description,required: true, class: 'form-control' %>
25
25
  </div>
26
26
  </div>
27
27
  </div>
@@ -29,14 +29,14 @@
29
29
  <div class="row">
30
30
  <div class="col-md-6">
31
31
  <div class="field">
32
- <%= f.label :property_category, '*Category (mandatory)', class: "form-label" %>
32
+ <%= f.label :property_category, '*Category', class: "form-label" %>
33
33
  <%= f.select :property_category_id, Stay::PropertyCategory.all.collect { |pc| [pc.name, pc.id] }, { include_blank: 'None' }, required: true, class: 'form-control custom-select-box', selected: @property.property_category&.name %>
34
34
  </div>
35
35
  </div>
36
36
  <div class="col-md-6">
37
37
  <div class="field">
38
- <%= f.label :property_type, class:"form-label" %>
39
- <%= f.select :property_type_id, Stay::PropertyType.all.collect { |rt| [rt.name, rt.id] }, { include_blank: 'Select Property Type' }, class: 'form-control custom-select-box', selected: @property.property_category&.name %>
38
+ <%= f.label :property_type, '*Type', class:"form-label" %>
39
+ <%= f.select :property_type_id, Stay::PropertyType.all.collect { |rt| [rt.name, rt.id] }, { include_blank: 'Select Property Type' },required: true, class: 'form-control custom-select-box', selected: @property.property_category&.name %>
40
40
  </div>
41
41
  </div>
42
42
  </div>
@@ -44,15 +44,15 @@
44
44
  <div class="row">
45
45
  <div class="col-md-6">
46
46
  <div class="field">
47
- <%= f.label :city, '*City (mandatory)', class: "form-label" %>
47
+ <%= f.label :city, '*City', class: "form-label" %>
48
48
  <%= f.text_field :city, value: property.city, required: true, class: "form-control" %>
49
49
  </div>
50
50
  </div>
51
51
 
52
52
  <div class="col-md-6">
53
53
  <div class="field">
54
- <%= f.label :address, 'Address', class: "form-label" %>
55
- <%= f.text_field :address, value: property.address, class: 'form-control' %>
54
+ <%= f.label :address, '*Address', class: "form-label" %>
55
+ <%= f.text_field :address, value: property.address, required: true, class: 'form-control' %>
56
56
  </div>
57
57
  </div>
58
58
  </div>
@@ -60,60 +60,19 @@
60
60
  <div class="row">
61
61
  <div class="col-md-6">
62
62
  <div class="field">
63
- <%= f.label :guest_number, '*Guest No (mandatory)', class: "form-label" %>
64
- <%= f.number_field :guest_number, value: property.guest_number, required: true, min: 0, class: "form-control" %>
65
- </div>
66
- </div>
67
-
68
- <div class="col-md-6">
69
- <div class="field">
70
- <%= f.label :country, class: "form-label" %>
63
+ <%= f.label :country, '*Country',class: "form-label" %>
71
64
  <%= f.text_field :country, value: property.country, required: true, class: "form-control" %>
72
65
  <%#= f.select :country_id, options_from_collection_for_select(Stay::Country.all, :id, :name, property.country_id), { include_blank: 'Select Country' }, id: 'country_select', class: 'form-control custom-select-box' %>
73
66
  </div>
74
67
  </div>
75
- </div>
76
-
77
- <div class="row">
78
- <div class="col-md-6">
79
- <div class="field">
80
- <%= f.label :bedroom_description, class: "form-label" %>
81
- <%= f.text_field :bedroom_description, value: property.bedroom_description, class: "form-control" %>
82
- </div>
83
- </div>
84
-
85
68
  <div class="col-md-6">
86
69
  <div class="field">
87
- <%= f.label :university_nearby, class: "form-label" %>
88
- <%= f.text_field :university_nearby, value: property.university_nearby, class: "form-control" %>
70
+ <%= f.label :status, class: "form-label" %>
71
+ <%= f.select :status, Stay::Property::STATUSES.map { |status| [status.humanize, status] }, {}, class: 'form-control custom-select-box' %>
89
72
  </div>
90
73
  </div>
91
74
  </div>
92
- <div class="row">
93
- <div class="col-md-6">
94
- <div class="field">
95
- <%= f.label :about_neighbourhoods, class: "form-label" %>
96
- <%= f.text_field :about_neighbourhoods, value: property.about_neighbourhoods, class: "form-control" %>
97
- </div>
98
- </div>
99
-
100
- <div class="col-md-6">
101
- <div class="field">
102
- <%= f.check_box :active %>
103
- <%= f.label :active, class:"form-label mt-8" %>
104
- </div>
105
- </div>
106
75
 
107
- </div>
108
-
109
- <div class="row">
110
- <div class="col-md-6">
111
- <div class="field">
112
- <%= f.check_box :instant_booking %>
113
- <%= f.label :instant_booking, "Allow instant booking", class:"form-label" %>
114
- </div>
115
- </div>
116
- </div>
117
76
 
118
77
  <div class="row">
119
78
  <div class="col-md-12">