diff --git a/addons/default/visiosoft/profile-module/migrations/2018_11_15_125011_visiosoft.module.profile__create_profile_fields.php b/addons/default/visiosoft/profile-module/migrations/2018_11_15_125011_visiosoft.module.profile__create_profile_fields.php index 802125b83..0abcbdd7c 100644 --- a/addons/default/visiosoft/profile-module/migrations/2018_11_15_125011_visiosoft.module.profile__create_profile_fields.php +++ b/addons/default/visiosoft/profile-module/migrations/2018_11_15_125011_visiosoft.module.profile__create_profile_fields.php @@ -139,7 +139,15 @@ class VisiosoftModuleProfileCreateProfileFields extends Migration 'mode' => 'select', ] ], - 'deleted_at' => 'anomaly.field_type.datetime' + 'company' => 'anomaly.field_type.text', + 'tax_number' => 'anomaly.field_type.text', + 'tax_office' => 'anomaly.field_type.text', + 'is_company' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => false, + ], + ], ]; } diff --git a/addons/default/visiosoft/profile-module/migrations/2018_11_17_112645_visiosoft.module.profile__create_adress_stream.php b/addons/default/visiosoft/profile-module/migrations/2018_11_17_112645_visiosoft.module.profile__create_adress_stream.php index acb72a223..2966ab2d9 100644 --- a/addons/default/visiosoft/profile-module/migrations/2018_11_17_112645_visiosoft.module.profile__create_adress_stream.php +++ b/addons/default/visiosoft/profile-module/migrations/2018_11_17_112645_visiosoft.module.profile__create_adress_stream.php @@ -12,11 +12,11 @@ class VisiosoftModuleProfileCreateAdressStream extends Migration */ protected $stream = [ 'slug' => 'adress', - 'title_column' => 'id', - 'translatable' => false, - 'trashable' => false, - 'searchable' => false, - 'sortable' => false, + 'title_column' => 'id', + 'translatable' => false, + 'trashable' => true, + 'searchable' => false, + 'sortable' => false, ]; /** @@ -41,16 +41,17 @@ class VisiosoftModuleProfileCreateAdressStream extends Migration 'city' => [ 'required' => true, ], - 'district' => [ - 'required' => true, - ], + 'district', 'adress_content' => [ 'required' => true, ], 'adress_gsm_phone' => [ 'required' => true, ], - 'deleted_at' + 'company', + 'tax_number', + 'tax_office', + 'is_company', ]; } diff --git a/addons/default/visiosoft/profile-module/resources/assets/js/address.js b/addons/default/visiosoft/profile-module/resources/assets/js/address.js index ef5f9dcde..e69de29bb 100644 --- a/addons/default/visiosoft/profile-module/resources/assets/js/address.js +++ b/addons/default/visiosoft/profile-module/resources/assets/js/address.js @@ -1 +0,0 @@ -phoneMask("input[name='adress_gsm_phone']") \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/resources/assets/js/create.js b/addons/default/visiosoft/profile-module/resources/assets/js/create.js new file mode 100644 index 000000000..89d6d600a --- /dev/null +++ b/addons/default/visiosoft/profile-module/resources/assets/js/create.js @@ -0,0 +1,51 @@ +$(document).on('change', 'select[name="country"]', function () { + Locations($(this).val(), 1, "city"); +}); +$(document).on('change', 'select[name="city"]', function () { + Locations($(this).val(), 2, "district") +}); + +function Locations(cat, level, name) { + $.ajax({ + type: "GET", + async: false, + data: "cat=" + cat + "&level=" + level, + url: "/class/ajax", + success: function (msg) { + $('select[name="' + name + '"]').find('option').remove(); + $('select[name="' + name + '"]').append(''); + $.each(msg, function (key, value) { + $('select[name="' + name + '"]').append(''); + }); + } + }); +} + +if (country != "") { + //For Request + Locations(country, 1, "city"); + + if (city != "") { + $('select[name="city"]').val(city); + Locations(city, 2, "district"); + + if (district != "") { + $('select[name="district"]').val(district); + } + } +} else { + //Set Default + $('select[name="country"]').val(default_country); + Locations(default_country, 1, "city"); + + if (default_city != "") { + $('select[name="city"]').val(default_city); + Locations(default_city, 2, "district"); + + if (default_district != "") { + $('select[name="district"]').val(default_district); + } + } +} + +phoneMask("input[name='adress_gsm_phone']"); \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/resources/config/settings/sections.php b/addons/default/visiosoft/profile-module/resources/config/settings/sections.php index c99cd34c0..85d63e090 100644 --- a/addons/default/visiosoft/profile-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/profile-module/resources/config/settings/sections.php @@ -8,7 +8,7 @@ return [ 'general_setting' => [ 'title' => 'visiosoft.module.profile::section.general_setting', 'fields' => [ - 'show_my_ads', 'upload_avatar' + 'show_my_ads', 'upload_avatar', 'show_tax_office' ], ], ], diff --git a/addons/default/visiosoft/profile-module/resources/config/settings/settings.php b/addons/default/visiosoft/profile-module/resources/config/settings/settings.php index f9ea8a35b..6308c2cbd 100644 --- a/addons/default/visiosoft/profile-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/profile-module/resources/config/settings/settings.php @@ -13,4 +13,11 @@ return [ 'default_value' => 1 ], ], + + 'show_tax_office' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => true, + ], + ], ]; \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/button.php b/addons/default/visiosoft/profile-module/resources/lang/en/button.php index 5e27a3d0b..24f21b7a2 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/button.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/button.php @@ -12,4 +12,6 @@ return [ 'edit' => 'Edit', 'go_profile' => 'Go to Profile Detail', 'go_user' => 'Go to User Detail', + 'personal' => 'Personal', + 'corporate' => 'Corporate', ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/field.php b/addons/default/visiosoft/profile-module/resources/lang/en/field.php index b9dfb1529..3e696c26b 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/field.php @@ -431,5 +431,15 @@ return [ 'choose' => [ 'name' => 'Choose' ], - 'my_address' => 'My Address' + 'my_address' => 'My Address', + + 'company' => [ + 'name' => 'Company Name' + ], + 'tax_office' => [ + 'name' => 'Tax Office' + ], + 'tax_number' => [ + 'name' => 'Tax Number' + ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/setting.php b/addons/default/visiosoft/profile-module/resources/lang/en/setting.php index 7dfd5b0a8..d97d7cb1d 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/setting.php @@ -7,4 +7,8 @@ return [ 'upload_avatar' => [ 'name' => 'Avatar Upload', ], + + 'show_tax_office' => [ + 'name' => 'Show Tax Office Field', + ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/views/address/create.twig b/addons/default/visiosoft/profile-module/resources/views/address/create.twig index b7d4acabb..1aea1f279 100644 --- a/addons/default/visiosoft/profile-module/resources/views/address/create.twig +++ b/addons/default/visiosoft/profile-module/resources/views/address/create.twig @@ -5,78 +5,99 @@ {% block detail %}