From 0a1bc04fd61ecf20f8f9ee45352653c7c9f6e746 Mon Sep 17 00:00:00 2001 From: gerchek Date: Tue, 9 Apr 2024 08:56:56 +0500 Subject: [PATCH] add column to table rentals_and_sales --- plugins/tps/shops/models/RentalsAndSales.php | 6 +++++ .../shops/models/rentalsandsales/columns.yaml | 4 ++++ .../shops/models/rentalsandsales/fields.yaml | 18 +++++++++++++++ ...ble_update_tps_shops_rentals_and_sales.php | 23 +++++++++++++++++++ plugins/tps/shops/updates/version.yaml | 3 +++ themes/berkarar/pages/rental_or_sale.htm | 8 +++++++ themes/berkarar/pages/rentals_and_sales.htm | 9 ++++++++ .../home/rentals_and_sales/rentals.htm | 19 +++++++++++++++ .../rentals_and_sales/rentals_and_sales.htm | 11 ++++++++- .../partials/home/rentals_and_sales/sales.htm | 19 +++++++++++++++ 10 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 plugins/tps/shops/updates/builder_table_update_tps_shops_rentals_and_sales.php diff --git a/plugins/tps/shops/models/RentalsAndSales.php b/plugins/tps/shops/models/RentalsAndSales.php index e854290..889454b 100644 --- a/plugins/tps/shops/models/RentalsAndSales.php +++ b/plugins/tps/shops/models/RentalsAndSales.php @@ -9,6 +9,7 @@ class RentalsAndSales extends Model { use \October\Rain\Database\Traits\Validation; + public $implement = ['RainLab.Translate.Behaviors.TranslatableModel']; /** * @var string The database table used by the model. @@ -24,4 +25,9 @@ class RentalsAndSales extends Model public $attachMany = [ 'images' => 'Tps\Shops\Classes\Attachment', ]; + + public $translatable = ['name', 'sector','description']; } + + + diff --git a/plugins/tps/shops/models/rentalsandsales/columns.yaml b/plugins/tps/shops/models/rentalsandsales/columns.yaml index 8e2018f..3b499e0 100644 --- a/plugins/tps/shops/models/rentalsandsales/columns.yaml +++ b/plugins/tps/shops/models/rentalsandsales/columns.yaml @@ -5,6 +5,9 @@ columns: type: label: type type: text + center_type: + label: center_type + type: text name: label: name type: text @@ -20,3 +23,4 @@ columns: updated_at: label: updated_at type: datetime + diff --git a/plugins/tps/shops/models/rentalsandsales/fields.yaml b/plugins/tps/shops/models/rentalsandsales/fields.yaml index da4debb..6a836fe 100644 --- a/plugins/tps/shops/models/rentalsandsales/fields.yaml +++ b/plugins/tps/shops/models/rentalsandsales/fields.yaml @@ -2,6 +2,7 @@ fields: type: label: Тип options: + not_selected: 'Не выбран' rental: Аренда sale: Продажа showSearch: true @@ -24,6 +25,14 @@ fields: - '3' - '4' - '5' + - '6' + - '7' + - '8' + - '9' + - '10' + - '11' + - '12' + - '13' showSearch: true span: auto type: dropdown @@ -45,3 +54,12 @@ fields: extension: auto span: auto type: fileupload + center_type: + label: 'Тип центра' + options: + not_selected: 'Не выбран' + business: 'Бизнес центр' + trade: 'Торговый центр' + showSearch: true + span: auto + type: dropdown diff --git a/plugins/tps/shops/updates/builder_table_update_tps_shops_rentals_and_sales.php b/plugins/tps/shops/updates/builder_table_update_tps_shops_rentals_and_sales.php new file mode 100644 index 0000000..52357ba --- /dev/null +++ b/plugins/tps/shops/updates/builder_table_update_tps_shops_rentals_and_sales.php @@ -0,0 +1,23 @@ +string('center_type'); + }); + } + + public function down() + { + Schema::table('tps_shops_rentals_and_sales', function($table) + { + $table->dropColumn('center_type'); + }); + } +} diff --git a/plugins/tps/shops/updates/version.yaml b/plugins/tps/shops/updates/version.yaml index c76f528..2983239 100644 --- a/plugins/tps/shops/updates/version.yaml +++ b/plugins/tps/shops/updates/version.yaml @@ -93,3 +93,6 @@ 1.0.32: - 'Created table tps_shops_rentals_and_sales' - builder_table_create_tps_shops_rentals_and_sales.php +1.0.33: + - 'Updated table tps_shops_rentals_and_sales' + - builder_table_update_tps_shops_rentals_and_sales.php diff --git a/themes/berkarar/pages/rental_or_sale.htm b/themes/berkarar/pages/rental_or_sale.htm index 90d3519..2dff5d7 100644 --- a/themes/berkarar/pages/rental_or_sale.htm +++ b/themes/berkarar/pages/rental_or_sale.htm @@ -74,6 +74,14 @@ function onStart(){ +993 {{sale.number}} +
+ {% if sale.center_type == 'business' %} + {{'Бизнес центр'|_}} + {% elseif sale.center_type == 'trade' %} + {{'Торговый центр'|_}} + {% endif %} + +
diff --git a/themes/berkarar/pages/rentals_and_sales.htm b/themes/berkarar/pages/rentals_and_sales.htm index 64387c9..9908609 100644 --- a/themes/berkarar/pages/rentals_and_sales.htm +++ b/themes/berkarar/pages/rentals_and_sales.htm @@ -101,6 +101,15 @@ function onStart(){ + + + + + + + + +
diff --git a/themes/berkarar/partials/home/rentals_and_sales/rentals.htm b/themes/berkarar/partials/home/rentals_and_sales/rentals.htm index 466a362..86f9dee 100644 --- a/themes/berkarar/partials/home/rentals_and_sales/rentals.htm +++ b/themes/berkarar/partials/home/rentals_and_sales/rentals.htm @@ -10,6 +10,25 @@ {{'Аренда'|_}} +
+
+ {% if sale.center_type == 'business' %} + {{'Бизнес центр'|_}} + {% elseif sale.center_type == 'trade' %} + {{'Торговый центр'|_}} + {% else %} + {{'Не выбран'|_}} + {% endif %} +
+ +
+ {{sale.floor}} + + {{'ЭТАЖ'|_}} + +
+
+

{{sale.name}} diff --git a/themes/berkarar/partials/home/rentals_and_sales/rentals_and_sales.htm b/themes/berkarar/partials/home/rentals_and_sales/rentals_and_sales.htm index f38b538..da13639 100644 --- a/themes/berkarar/partials/home/rentals_and_sales/rentals_and_sales.htm +++ b/themes/berkarar/partials/home/rentals_and_sales/rentals_and_sales.htm @@ -11,12 +11,20 @@ {{'Аренда'|_}} {% elseif sale.type == "sale"%} {{'Продажа'|_}} + {% else %} + {{'Не выбран'|_}} {% endif %}

- {{sale.name}} + {% if sale.center_type == 'business' %} + {{'Бизнес центр'|_}} + {% elseif sale.center_type == 'trade' %} + {{'Торговый центр'|_}} + {% else %} + {{'Не выбран'|_}} + {% endif %}
@@ -26,6 +34,7 @@
+

{{sale.name}} diff --git a/themes/berkarar/partials/home/rentals_and_sales/sales.htm b/themes/berkarar/partials/home/rentals_and_sales/sales.htm index 9179cb4..8110ef9 100644 --- a/themes/berkarar/partials/home/rentals_and_sales/sales.htm +++ b/themes/berkarar/partials/home/rentals_and_sales/sales.htm @@ -10,6 +10,25 @@ {{'Продажа'|_}}

+
+
+ {% if sale.center_type == 'business' %} + {{'Бизнес центр'|_}} + {% elseif sale.center_type == 'trade' %} + {{'Торговый центр'|_}} + {% else %} + {{'Не выбран'|_}} + {% endif %} +
+ +
+ {{sale.floor}} + + {{'ЭТАЖ'|_}} + +
+
+

{{sale.name}}