diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100755 index 0000000..c2f9d19 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Change Log +All notable changes to this project will be documented in this file. + +## 1.0.0 - 2017-03-21 +### Added +- This CHANGELOG file to hopefully serve as an evolving example of a standardized open source project CHANGELOG. +- Added initial Artbox Order extension. \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100755 index 0000000..e98f03d --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,32 @@ +The Yii framework is free software. It is released under the terms of +the following BSD License. + +Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Yii Software LLC nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md old mode 100644 new mode 100755 index e69de29..e69de29 --- a/README.md +++ b/README.md diff --git a/assets/StockAsset.php b/assets/StockAsset.php new file mode 100644 index 0000000..1273982 --- /dev/null +++ b/assets/StockAsset.php @@ -0,0 +1,28 @@ + 'Города', + 'Shops' => 'Магазины/склады', + 'Title' => 'Название', + 'Sort' => 'Сортировка', + 'Status' => 'Статус', + 'Description' => 'Описание', + 'Create City' => 'Добавить город', + 'Alias' => 'Алиас', + 'Update' => 'Обновить', + 'Address' => 'Адрес', + 'Create Shop' => 'Добавить магазин', + 'Mode' => "Расписание работы", + 'Delete' => 'Удалить', + 'Create' => "Добавить", +] +?> \ No newline at end of file diff --git a/migrations/m170721_133313_create_city_table.php b/migrations/m170721_133313_create_city_table.php new file mode 100755 index 0000000..84685c0 --- /dev/null +++ b/migrations/m170721_133313_create_city_table.php @@ -0,0 +1,30 @@ +createTable('city', [ + 'id' => $this->primaryKey(), + 'sort' => $this->integer(), + 'status' => $this->boolean() + ->defaultValue(true), + ]); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('city'); + } +} diff --git a/migrations/m170721_135629_create_table_shops.php b/migrations/m170721_135629_create_table_shops.php new file mode 100755 index 0000000..9305589 --- /dev/null +++ b/migrations/m170721_135629_create_table_shops.php @@ -0,0 +1,46 @@ +createTable('shop', [ + 'id' => $this->primaryKey(), + 'mode' => $this->text(), + 'city_id' => $this->integer(), + 'sort' => $this->integer(), + 'status' => $this->boolean() + ->defaultValue(true), + 'coords' => $this->string(), + ]); + + $this->addForeignKey( + 'city_city_id_fkey', + 'shop', + 'city_id', + 'city', + 'id', + 'CASCADE', + 'CASCADE' + ); + } + + public function safeDown() + { + $this->dropForeignKey('city_city_id_fkey', 'shop'); + $this->dropTable('shop'); + } + + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + */ + + +} diff --git a/migrations/m170724_123453_city_lang.php b/migrations/m170724_123453_city_lang.php new file mode 100644 index 0000000..0e6e556 --- /dev/null +++ b/migrations/m170724_123453_city_lang.php @@ -0,0 +1,85 @@ +createTable( + 'city_lang', + [ + 'city_id' => $this->integer(32) + ->notNull(), + 'language_id' => $this->integer(32) + ->notNull(), + 'title' => $this->string(255) + ->notNull(), + 'alias_id' => $this->integer(), + 'description' => $this->text(), + ] + ); + + + $this->createIndex('city_lang_alias_id', 'city_lang', 'alias_id', true); + $this->addPrimaryKey( + 'city_lang_pk', + 'city_lang', + [ + 'city_id', + 'language_id', + ] + ); + + + $this->addForeignKey( + 'city_lang_city_id_to_city_fk', + 'city_lang', + 'city_id', + 'city', + 'id', + 'CASCADE', + 'CASCADE' + ); + + $this->addForeignKey( + 'city_lang_language_id_to_language_fk', + 'city_lang', + 'language_id', + 'language', + 'id', + 'RESTRICT', + 'CASCADE' + ); + + $this->addForeignKey( + 'city_lang_alias_id_to_alias_fk', + 'city_lang', + 'alias_id', + 'alias', + 'id', + 'SET NULL', + 'CASCADE' + ); + } + + public function safeDown() + { + $this->dropForeignKey( + 'city_lang_alias_id_to_alias_fk', + 'city_lang' + ); + $this->dropForeignKey( + 'city_lang_language_id_to_language_fk', + 'city_lang' + ); + $this->dropForeignKey( + 'city_lang_city_id_to_city_fk', + 'city_lang' + ); + $this->dropIndex('city_lang_alias_id', 'city_lang'); + $this->dropTable('city_lang'); + } + + +} diff --git a/migrations/m170724_124809_shop_lang.php b/migrations/m170724_124809_shop_lang.php new file mode 100644 index 0000000..c850545 --- /dev/null +++ b/migrations/m170724_124809_shop_lang.php @@ -0,0 +1,96 @@ +createTable( + 'shop_lang', + [ + 'shop_id' => $this->integer(32) + ->notNull(), + 'language_id' => $this->integer(32) + ->notNull(), + 'title' => $this->string(255) + ->notNull(), + 'alias_id' => $this->integer(), + 'description' => $this->text(), + ] + ); + + $this->createIndex('shop_lang_alias_id', 'shop_lang', 'alias_id', true); + $this->addPrimaryKey( + 'shop_lang_pk', + 'shop_lang', + [ + 'shop_id', + 'language_id', + ] + ); + + $this->addForeignKey( + 'shop_lang_shop_id_to_shop_fk', + 'shop_lang', + 'shop_id', + 'shop', + 'id', + 'CASCADE', + 'CASCADE' + ); + + $this->addForeignKey( + 'shop_lang_language_id_to_language_fk', + 'shop_lang', + 'language_id', + 'language', + 'id', + 'RESTRICT', + 'CASCADE' + ); + + $this->addForeignKey( + 'shop_lang_alias_id_to_alias_fk', + 'shop_lang', + 'alias_id', + 'alias', + 'id', + 'SET NULL', + 'CASCADE' + ); + } + + public function safeDown() + { + $this->dropForeignKey( + 'shop_lang_alias_id_to_alias_fk', + 'shop_lang' + ); + $this->dropForeignKey( + 'shop_lang_language_id_to_language_fk', + 'shop_lang' + ); + $this->dropForeignKey( + 'shop_lang_city_id_to_shop_fk', + 'shop_lang' + ); + $this->dropIndex('shop_lang_alias_id', 'shop_lang'); + $this->dropTable('shop_lang'); + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m170724_124809_shop_lang cannot be reverted.\n"; + + return false; + } + */ +} diff --git a/migrations/m170725_131257_add_address_to.php b/migrations/m170725_131257_add_address_to.php new file mode 100644 index 0000000..cdfd17b --- /dev/null +++ b/migrations/m170725_131257_add_address_to.php @@ -0,0 +1,31 @@ +addColumn('shop_lang', 'address', $this->string()); + } + + public function safeDown() + { + $this->dropColumn('shop_lang', 'address'); + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m170725_131257_add_address_to cannot be reverted.\n"; + + return false; + } + */ +} diff --git a/views/city/_form_language.php b/views/city/_form_language.php new file mode 100755 index 0000000..3e159e2 --- /dev/null +++ b/views/city/_form_language.php @@ -0,0 +1,59 @@ + +field($model_lang, '[' . $language->id . ']title') + ->textInput([ 'maxlength' => true ]); + echo $attributeField; +?> + += SlugifyDecorator::decorate( + $form->field($model_lang, '[' . $language->id . ']aliasValue'), + [ '/alias/slugify' ], + $attributeField, + false, + $language->id +) + ->textInput([ 'maxlength' => true ]); ?> + +field($model_lang, '[' . $language->id . ']description') + ->widget( + TinyMce::className(), + [ + 'options' => [ 'rows' => 6 ], + 'language' => 'ru', + 'clientOptions' => [ + 'file_browser_callback' => new yii\web\JsExpression( + "function(field_name, url, type, win) { +window.open('" . yii\helpers\Url::to( + [ + 'imagemanager/manager', + 'view-mode' => 'iframe', + 'select-type' => 'tinymce', + ] + ) . "&tag_name='+field_name,'','width=800,height=540 ,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no'); +}" + ), + 'plugins' => [ + "advlist autolink lists link charmap print preview anchor", + "searchreplace visualblocks code fullscreen", + "insertdatetime media table contextmenu paste image", + ], + 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code", + ], + ] + ); +?> \ No newline at end of file diff --git a/views/shop/_form_language.php b/views/shop/_form_language.php new file mode 100755 index 0000000..f276f50 --- /dev/null +++ b/views/shop/_form_language.php @@ -0,0 +1,79 @@ +shop->coordsArr); die(); +?> +field($model_lang, '[' . $language->id . ']title') + ->textInput([ 'maxlength' => true ]); + echo $attributeField; +?> + +field($model_lang, '[' . $language->id . ']address') + ->textInput([ 'maxlength' => true ]); +echo $attributeField; +?> += Html::label('Координаты');?> += Html::textInput("Shop[coordsArr][lat]", (isset($model_lang->shop->coordsArr['lat'])) ? $model_lang->shop->coordsArr['lat'] : '', [ + 'size' => 20, + 'type'=> 'text', + 'id' => 'lat', + +])?> += Html::textInput("Shop[coordsArr][lng]", (isset($model_lang->shop->coordsArr['lng'])) ? $model_lang->shop->coordsArr['lng'] : '', [ + 'size' => 20, + 'type'=> 'text', + 'id' => 'lng' +])?> +
+ += SlugifyDecorator::decorate( + $form->field($model_lang, '[' . $language->id . ']aliasValue'), + [ '/alias/slugify' ], + $attributeField, + false, + $language->id +) + ->textInput([ 'maxlength' => true ]); ?> + +field($model_lang, '[' . $language->id . ']description') + ->widget( + TinyMce::className(), + [ + 'options' => [ 'rows' => 6 ], + 'language' => 'ru', + 'clientOptions' => [ + 'file_browser_callback' => new yii\web\JsExpression( + "function(field_name, url, type, win) { +window.open('" . yii\helpers\Url::to( + [ + 'imagemanager/manager', + 'view-mode' => 'iframe', + 'select-type' => 'tinymce', + ] + ) . "&tag_name='+field_name,'','width=800,height=540 ,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no'); +}" + ), + 'plugins' => [ + "advlist autolink lists link charmap print preview anchor", + "searchreplace visualblocks code fullscreen", + "insertdatetime media table contextmenu paste image", + ], + 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code", + ], + ] + ); +?> \ No newline at end of file diff --git a/web/js/stock.js b/web/js/stock.js new file mode 100644 index 0000000..8b0569b --- /dev/null +++ b/web/js/stock.js @@ -0,0 +1,78 @@ +$(function() { + + + $(document) + .on("click","#add-data",function () { + var count = $(this).data('count'); + $("").insertBefore($(this)) + count+=1; + $(this).data('count', count); + }); + $(document) + .on( + 'click', '.delete-day-item', function() { + var count = $("#add-data").data('count'); + $(this) + .parent() + .remove(); + count-=1; + $("#add-data").data('count', count); + } + ); + $(document).on( '#shoplang-2-address','blur', function () { + var address = $("#shoplang-2-address").val() + " "+$("#select2-w2-container").text(); + console.log(address); + geocoder.geocode( { 'address': address}, function(results, status) { + console.log(status); + if (status == google.maps.GeocoderStatus.OK) { + //console.log(results[0].geometry.location.lat()+" "+results[0].geometry.location.lng()); + $("#lat").val(results[0].geometry.location.lat()); + $("#lng").val(results[0].geometry.location.lng()); + var marker = AddMarker(); + marker.setMap(map); + } else { + alert("Geocode was not successful for the following reason: " + status); + } + }); + }); + + var start_position = new google.maps.LatLng('50.435', '30.60'); + var styles = [ + { + stylers: [ + {saturation: -100} + ] + } + ]; + var settings = { + styles: styles, + zoom: 12, + scrollwheel: false, + center: start_position, + mapTypeControl: true, + mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, + navigationControl: false, + navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, + scaleControl: true, + streetViewControl: true, + rotateControl: true, + zoomControl: true, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + + var map = new google.maps.Map(document.getElementById("map_canvas"), settings); + if ($("#lat").val() !== "" && $("#lng").val() !== ""){ + var marker = AddMarker(); + marker.setMap(map); + } + var geocoder = new google.maps.Geocoder(); + function AddMarker(){ + var newLat = $("#lat").val(); + var newLng = $("#lng").val(); + var coords = new google.maps.LatLng(newLat, newLng); + var marker = new google.maps.Marker({ + position: coords + }); + return marker; + } +}); -- libgit2 0.21.4