From c3c48bfd136e76b55f3f58f30d2fb21b6d826948 Mon Sep 17 00:00:00 2001 From: Shohrat Date: Sun, 15 Oct 2023 20:26:14 +0000 Subject: [PATCH] from server repaired --- .../api/BlogPostsApiController.php | 49 ++++- .../api/CategoriesAPIController.php | 5 + .../controllers/api/ProductsApiController.php | 168 +++++++++------ plugins/ahmadfatoni/apigenerator/routes.php | 5 +- plugins/rainlab/user/models/user/fields.yaml | 12 ++ plugins/tps/birzha/Plugin.php | 15 +- plugins/tps/birzha/classes/Product.php | 20 ++ .../birzha/components/FilteredProducts.php | 5 +- plugins/tps/birzha/components/MyOrders.php | 51 +++++ plugins/tps/birzha/components/OfferForm.php | 11 +- plugins/tps/birzha/components/Offers.php | 2 +- plugins/tps/birzha/components/OrderDetail.php | 46 +++++ .../tps/birzha/components/SearchOffers.php | 2 +- plugins/tps/birzha/components/UserOffers.php | 50 ++++- .../components/categories/with_images.htm | 2 +- .../components/categoryprofile/default.htm | 176 ++++++++++++++-- .../birzha/components/checkout/default.htm | 6 +- .../birzha/components/contactform/default.htm | 18 +- .../default.htm | 58 +++--- .../components/myfavourites/default.htm | 2 +- .../birzha/components/myoffers/default.htm | 2 +- .../birzha/components/myorders/default.htm | 53 +++++ .../birzha/components/offerform/default.htm | 123 +++++++++-- .../tps/birzha/components/offers/default.htm | 65 +++--- .../birzha/components/orderdetail/default.htm | 58 ++++++ .../components/searchoffers/default.htm | 64 +++--- .../components/shopsettings/default.htm | 2 +- .../birzha/components/singleoffer/default.htm | 48 +++-- .../birzha/components/singlesale/default.htm | 2 +- .../birzha/components/sliders/img_slider.htm | 6 +- .../birzha/components/useroffers/default.htm | 161 +++------------ plugins/tps/birzha/models/product/fields.yaml | 6 + ...er_table_update_tps_birzha_products_38.php | 23 +++ plugins/tps/birzha/updates/version.yaml | 3 + themes/gurlushyk/assets/js/script.js | 15 +- themes/gurlushyk/meta/menus/top-menu.yaml | 158 ++++++++++++-- themes/gurlushyk/pages/contact-us.htm | 2 +- themes/gurlushyk/pages/filter-products.htm | 10 +- themes/gurlushyk/pages/index.htm | 35 ++-- themes/gurlushyk/pages/my-orders.htm | 9 + themes/gurlushyk/pages/order-cancel.htm | 27 +++ themes/gurlushyk/pages/order-detail.htm | 9 + themes/gurlushyk/pages/privacy.htm | 4 +- themes/gurlushyk/pages/return.htm | 27 +++ themes/gurlushyk/pages/user-profile.htm | 25 ++- themes/gurlushyk/partials/customStyle.htm | 88 ++++++++ themes/gurlushyk/partials/footer.htm | 91 ++------- themes/gurlushyk/partials/header.htm | 14 +- .../gurlushyk/partials/home/vip-section.htm | 2 +- .../gurlushyk/partials/product/card-item.htm | 53 ++--- themes/gurlushyk/partials/profile/modal.htm | 71 +++++++ .../gurlushyk/partials/profile/parallax.htm | 15 ++ themes/gurlushyk/partials/profile/style1.htm | 193 ++++++++++++++++++ themes/gurlushyk/partials/profile/style2.htm | 134 ++++++++++++ themes/gurlushyk/partials/profile/style3.htm | 41 ++++ themes/gurlushyk/partials/profile/style4.htm | 36 ++++ 56 files changed, 1879 insertions(+), 499 deletions(-) create mode 100644 plugins/tps/birzha/classes/Product.php create mode 100644 plugins/tps/birzha/components/MyOrders.php create mode 100644 plugins/tps/birzha/components/OrderDetail.php rename plugins/tps/birzha/components/{filteredProducts => filteredproducts}/default.htm (79%) create mode 100644 plugins/tps/birzha/components/myorders/default.htm create mode 100644 plugins/tps/birzha/components/orderdetail/default.htm create mode 100644 plugins/tps/birzha/updates/builder_table_update_tps_birzha_products_38.php create mode 100644 themes/gurlushyk/pages/my-orders.htm create mode 100644 themes/gurlushyk/pages/order-cancel.htm create mode 100644 themes/gurlushyk/pages/order-detail.htm create mode 100644 themes/gurlushyk/pages/return.htm create mode 100644 themes/gurlushyk/partials/profile/modal.htm create mode 100644 themes/gurlushyk/partials/profile/parallax.htm create mode 100644 themes/gurlushyk/partials/profile/style1.htm create mode 100644 themes/gurlushyk/partials/profile/style2.htm create mode 100644 themes/gurlushyk/partials/profile/style3.htm create mode 100644 themes/gurlushyk/partials/profile/style4.htm diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php index b4f1057..60de2c9 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php @@ -18,6 +18,7 @@ use TPS\Birzha\Models\Favourites; use TPS\Birzha\Models\Notification; use TPS\Birzha\Models\Comment; use TPS\Birzha\Models\Sections; +use TPS\Birzha\Models\Category; use RainLab\User\Models\User; class BlogPostsApiController extends Controller @@ -35,6 +36,33 @@ class BlogPostsApiController extends Controller $this->helpers = $helpers; } + + public function getCategoryDatas(Request $request) + { + $path = 'https://gurlushyk.com.tm' . Config::get('cms.storage.media.path'); + + $data = $request->all(); + + + + $accounts = Category::select("id","name", "icon", "is_file_category", "primary_key")->where('id', $data["category"])->with("users:id,name,email,username,type,logo,shop_title,slogan,work_time,short_description,is_instagram")->get(); + + $banners = Category::select("id","name", "icon", "is_file_category", "primary_key")->where('id', $data["category"])->with(["users" => function($q){ + $q->where("is_category", 1)->select("category_id", "user_id", "logo", "banner", "is_instagram"); + }])->get(); + + + $data = array( + "path" => $path, + "accounts" => $accounts, + "banners" => $banners + ); + + + + return response()->json(array("data"=>$data), 200); + } + public function home(){ $path = 'https://gurlushyk.com.tm' . Config::get('cms.storage.media.path'); @@ -69,7 +97,7 @@ class BlogPostsApiController extends Controller }else if ($dataq->sections[$i]->section_type == "TPS\Birzha\Models\Product") { - $modified = $dataq->sections[$i]->section_type::where('type', $dataq->sections[$i]->product_type)->select('id', 'name', 'price', 'description', 'place_id', 'vendor_id', 'number_of_views', 'is_home', 'short_description')->with("place")->with([ + $modified = $dataq->sections[$i]->section_type::where('type', $dataq->sections[$i]->product_type)->select('id', 'name', 'price', 'description', 'place_id', 'vendor_id', 'number_of_views', 'is_home', 'short_description', 'type')->with("place")->with([ 'translations:locale,model_id,attribute_data', 'images:attachment_id,attachment_type,disk_name,file_name', 'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram', @@ -287,6 +315,19 @@ class BlogPostsApiController extends Controller return response()->json($data, 200); } + public function getSubPlaces($id) + { + $data = City::where('primary_key', $id)->get()->toArray(); + + + array_unshift($data, array( + "id" => (0).$id, + "name" => "Ählisi", + "order" => 0, + )); + return $data; + } + public function getAccountDatas($id) { @@ -300,7 +341,11 @@ class BlogPostsApiController extends Controller ->with('sliders') ->first(); - $data->pathUrl = 'https://gurlushyk.com.tm' . \Config::get('cms.storage.media.path'); + $data->pathUrl = 'https://gurlushyk.com.tm' . \Config::get('cms.storage.media.path'); + $data->categories[0] = array( + "id" => 0, + "name"=> "Hemmesi", + ); return response()->json($data, 200); } diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/CategoriesAPIController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/CategoriesAPIController.php index 9ad1d12..88e4284 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/CategoriesAPIController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/CategoriesAPIController.php @@ -86,6 +86,11 @@ class CategoriesAPIController extends Controller } } + + public function subs($id){ + $subs = Category::where('primary_key', $id)->get(); + return $subs; + } // public function store(Request $request){ diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php index 7875ef8..c8209b7 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php @@ -77,8 +77,10 @@ class ProductsAPIController extends Controller $queryString = input('q'); $locale = input('locale'); + $type = input('type'); + $sortPrice = input('price'); - $place = intval(input('place')); + $place = input('place'); $seller = input('seller_id'); @@ -94,81 +96,89 @@ class ProductsAPIController extends Controller ->withCount(['comments as rating_avg' => function($query) { $query->select(DB::raw('avg(rating)')); }]) - ->approved() - ->orderBy('ends_at', $sortOrder); + ->approved(); + + + if($type){ + $query = $query->where("type", $type)->orderBy('ends_at', $sortOrder); + } + if($sortPrice) { // fetch offers by the category of the product - $query = $this->Product::with([ - 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name', - 'place', - 'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram' - ]) - ->withCount(['comments as rating_avg' => function($query) { - $query->select(DB::raw('avg(rating)')); - }]) - ->where('is_home', 1) - ->approved() - ->orderBy('price', $sortPrice) - ->orderBy('ends_at', $sortOrder); + $query = $query->orderBy('price', $sortPrice)->orderBy('ends_at', $sortOrder); } if($place) { // fetch offers by the category of the product - - $query = $this->Product::with([ - 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name', - 'place', - 'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram' - ]) - ->withCount(['comments as rating_avg' => function($query) { - $query->select(DB::raw('avg(rating)')); - }]) - ->where('is_home', 1) - ->approved() - ->where('place_id', $place) - ->orderBy('ends_at', $sortOrder); + + + if($place == (0).$place){ + + $allCity = City::where('primary_key', $place)->select("id")->get()->pluck('id')->toArray(); + + $query = $query->where("place_id", $allCity)->orderBy('ends_at', $sortOrder); + + }else{ + + $query = $query->where('place_id', $place)->orderBy('ends_at', $sortOrder); + + } + + } - if($sortPrice && $place) { - - $query = $this->Product::with([ + if($seller){ + + $query = Product::with([ 'translations:locale,model_id,attribute_data', 'images:attachment_id,attachment_type,disk_name,file_name', + 'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram', 'place', - 'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram' - ]) - ->withCount(['comments as rating_avg' => function($query) { - $query->select(DB::raw('avg(rating)')); - }]) - ->where('is_home', 1) - ->approved() - ->where('place_id', $place) - ->orderBy('price', $sortPrice) - ->orderBy('ends_at', $sortOrder); - - } + ]) + ->withCount(['comments as rating_avg' => function($query) { + $query->select(DB::raw('avg(rating)')); + }]) + ->where('vendor_id', $seller) + ->approved(); + } + if($seller && $categorySeller) { $category = Category::find($categorySeller); + $sellerProducts = Product::where("vendor_id", $seller); + if($category) { - $query = $category->products() - ->with('categories:id,name') - ->with([ - 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name', - ]) - ->withCount(['comments as rating_avg' => function($query) { - $query->select(DB::raw('avg(rating)')); - }]) - ->where('vendor_id', $seller) - ->approved() - ->orderBy('ends_at', $sortOrder); + + if($categorySeller == 0){ + + $query = $sellerProducts->where('vendor_id', $seller)->with('categories:id,name') + ->with([ + 'translations:locale,model_id,attribute_data', + 'images:attachment_id,attachment_type,disk_name,file_name', + ])->approved()->orderBy('id', $sortOrder); + + }else{ + + $query = $category->products() + ->with('categories:id,name') + ->with([ + 'translations:locale,model_id,attribute_data', + 'images:attachment_id,attachment_type,disk_name,file_name', + ]) + ->withCount(['comments as rating_avg' => function($query) { + $query->select(DB::raw('avg(rating)')); + }]) + ->where('vendor_id', $seller) + ->approved() + ->orderBy('ends_at', $sortOrder); + + } + + } else { $query = null; } @@ -179,18 +189,40 @@ class ProductsAPIController extends Controller if($categoryId) { // fetch offers by the category of the product $category = Category::find($categoryId); if($category) { + $query = $category->products() - ->with('categories:id,name') - ->with([ - 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name', - 'place' - ]) - ->withCount(['comments as rating_avg' => function($query) { - $query->select(DB::raw('avg(rating)')); - }]) - ->approved() - ->orderBy('ends_at', $sortOrder); + ->with('categories:id,name') + ->with([ + 'translations:locale,model_id,attribute_data', + 'images:attachment_id,attachment_type,disk_name,file_name', + 'place' + ]) + ->withCount(['comments as rating_avg' => function($query) { + $query->select(DB::raw('avg(rating)')); + }]) + ->approved(); + + if($place) { // fetch offers by the category of the product + + if($place == (0).$place){ + + $allCity = City::where('primary_key', $place)->select("id")->get()->pluck('id')->toArray(); + + $query = $query->where("place_id", $allCity)->orderBy('ends_at', $sortOrder); + + }else{ + + $query = $query->where('place_id', $place)->orderBy('ends_at', $sortOrder); + + } + } + + if($sortPrice){ + + $query = $query->orderBy('price', $sortPrice)->orderBy('ends_at', $sortOrder); + } + + } else { $query = null; } diff --git a/plugins/ahmadfatoni/apigenerator/routes.php b/plugins/ahmadfatoni/apigenerator/routes.php index 91bc3c7..3bce04f 100644 --- a/plugins/ahmadfatoni/apigenerator/routes.php +++ b/plugins/ahmadfatoni/apigenerator/routes.php @@ -8,7 +8,7 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro Route::resource('categories', 'CategoriesAPIController', ['except' => ['destroy', 'create', 'edit']]); - // Route::get('categories/{id}/delete', ['as' => 'categories.delete', 'uses' => 'CategoriesAPIController@destroy']); + Route::get('category/{id}/subs', ['as' => 'category.subs', 'uses' => 'CategoriesAPIController@subs']); Route::get('products', ['as' => 'products.index', 'uses' => 'ProductsApiController@index']); @@ -35,6 +35,7 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro Route::get('sliders', 'BlogPostsApiController@getSliders'); Route::get('places', 'BlogPostsApiController@getPlaces'); + Route::get('places/{id}/subs', ['as' => 'place.subs', 'uses' => 'BlogPostsApiController@getSubPlaces']); Route::get('accounts', 'BlogPostsApiController@getAccounts'); @@ -46,7 +47,7 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro Route::get('account/{id}/products', 'BlogPostsApiController@getAccountProducts')->where(['id' => '[0-9]+']); Route::get('account/{id}/datas', 'BlogPostsApiController@getAccountDatas'); - + Route::get('get/category/datas', 'BlogPostsApiController@getCategoryDatas'); Route::middleware(['\Tymon\JWTAuth\Middleware\GetUserFromToken'])->group(function () { Route::delete('delete/account', 'VendorApiController@deleteVendor'); diff --git a/plugins/rainlab/user/models/user/fields.yaml b/plugins/rainlab/user/models/user/fields.yaml index a0613de..d570365 100644 --- a/plugins/rainlab/user/models/user/fields.yaml +++ b/plugins/rainlab/user/models/user/fields.yaml @@ -183,6 +183,18 @@ tabs: imageWidth: '220' type: mediafinder tab: 'Sosial Mediýalar' + web1: + label: 'Web-de sahypa gornushleri' + span: auto + options: + variant1: '1-nji Versia' + variant2: '2-nji Versia' + variant3: '3-nji Versia' + variant4: '4-nji Versia' + variant5: '5-nji Versia' + variant6: '6-nji Versia' + type: balloon-selector + tab: 'Web Wariantlar' secondaryTabs: fields: avatar: diff --git a/plugins/tps/birzha/Plugin.php b/plugins/tps/birzha/Plugin.php index 67d6cd0..4de8e48 100644 --- a/plugins/tps/birzha/Plugin.php +++ b/plugins/tps/birzha/Plugin.php @@ -59,6 +59,17 @@ class Plugin extends PluginBase ]; } + + + public function registerMarkupTags() + { + return [ + 'functions' => [ + 'getProductName' => ['TPS\Birzha\Classes\Product', 'getName'], + 'getProductImage' => ['TPS\Birzha\Classes\Product', 'getImage'], + ] + ]; + } public function moneyColumn($value, $column, $record){ return ''.number_format($value,2).' tmt'; @@ -341,13 +352,14 @@ class Plugin extends PluginBase 'TPS\Birzha\Components\Categories' => 'categories', 'TPS\Birzha\Components\Sliders' => 'sliders', 'TPS\Birzha\Components\Offers' => 'offers', - 'TPS\Birzha\Components\FilteredProducts' => 'filteredProducts', + 'TPS\Birzha\Components\FilteredProducts' => 'filteredproducts', 'TPS\Birzha\Components\Singleoffer' => 'singleoffer', 'TPS\Birzha\Components\ShopSettings' => 'shopsettings', 'TPS\Birzha\Components\OfferForm' => 'offerform', 'TPS\Birzha\Components\Messages' => 'messages', 'TPS\Birzha\Components\PaymentApi' => 'paymentapi', 'TPS\Birzha\Components\MyOffers' => 'myOffers', + 'TPS\Birzha\Components\MyOrders' => 'myorders', 'TPS\Birzha\Components\MyComments' => 'mycomments', 'TPS\Birzha\Components\MyFavourites' => 'myfavourites', 'TPS\Birzha\Components\UserOffers' => 'userOffers', @@ -360,6 +372,7 @@ class Plugin extends PluginBase 'TPS\Birzha\Components\Birzhadocs' => 'birzhadocs', 'TPS\Birzha\Components\CategoryProfile' => 'categoryprofile', 'TPS\Birzha\Components\Checkout' => 'checkout', + 'TPS\Birzha\Components\OrderDetail' => 'orderdetail', ]; } diff --git a/plugins/tps/birzha/classes/Product.php b/plugins/tps/birzha/classes/Product.php new file mode 100644 index 0000000..17ddbed --- /dev/null +++ b/plugins/tps/birzha/classes/Product.php @@ -0,0 +1,20 @@ +name; + } + + public static function getImage($id) + { + $product = ProductItem::find($id); + return $product->images[0]->path; + } +} \ No newline at end of file diff --git a/plugins/tps/birzha/components/FilteredProducts.php b/plugins/tps/birzha/components/FilteredProducts.php index 931ebcb..79776d9 100644 --- a/plugins/tps/birzha/components/FilteredProducts.php +++ b/plugins/tps/birzha/components/FilteredProducts.php @@ -58,6 +58,7 @@ class FilteredProducts extends ComponentBase { $allParams = \Input::all(); + $params = ''; foreach ($allParams as $key => $item) { @@ -102,6 +103,7 @@ class FilteredProducts extends ComponentBase $sortOrder = $sortOrderParam; $this->sortParam = $sortOrderParam; } + $perPage = $this->property('perPage'); $products = Product::query(); @@ -136,8 +138,7 @@ class FilteredProducts extends ComponentBase $products = $products->orderBy( $sort[0], $sort[1]); } - $products = $products->where('status', 'approved')->withCount("images")->orderBy('updated_at', $sortOrder); - + $products = $products->where('status', 'approved')->withCount("images"); return $products ? $products->paginate($perPage) : null; } diff --git a/plugins/tps/birzha/components/MyOrders.php b/plugins/tps/birzha/components/MyOrders.php new file mode 100644 index 0000000..d21c339 --- /dev/null +++ b/plugins/tps/birzha/components/MyOrders.php @@ -0,0 +1,51 @@ + 'MyOrders List', + 'description' => 'List of my orders' + ]; + } + + public function defineProperties() + { + return [ + 'perPage' => [ + 'title' => 'Number of offers', + 'description' => 'How many offers do you want to display', + 'default' => 12, + 'validationPattern' => '^[0-9]+$', + 'validationMessage' => 'Only numbers allowed' + ], + ]; + } + + + public function onRun() { + $this->orders = $this->loadOrders(); + } + + protected function loadOrders() { + $perPage = $this->property('perPage'); + return \Auth::user()->orders() + ->orderBy('updated_at', 'desc') + ->paginate($perPage); + } + + +} diff --git a/plugins/tps/birzha/components/OfferForm.php b/plugins/tps/birzha/components/OfferForm.php index 7cb4a91..1a98f0d 100644 --- a/plugins/tps/birzha/components/OfferForm.php +++ b/plugins/tps/birzha/components/OfferForm.php @@ -91,11 +91,18 @@ class OfferForm extends ComponentBase } $category = null; - if($data["subcategory_id"] != 'null'){ + if(isset($data["subcategory_id"]) && $data["subcategory_id"] != 'null'){ $category = Category::find($data['subcategory_id']); }else{ $category = Category::find($data['category_id']); } + + $place = null; + if(isset($data["city_id"]) && $data["city_id"] != 'null'){ + $place = $data['city_id']; + }else{ + $place = $data['state_id']; + } $product = new Product; $product->name = $data['name']; @@ -103,7 +110,7 @@ class OfferForm extends ComponentBase $product->short_description = $data['short_description']; $product->slug = \Str::slug($data['name'],'-'); $product->status = 'new'; - $product->place_id = $data['city_id'] == 'null' ? $data['state_id'] : $data['city_id']; + $product->place_id = $place; $product->price = $data['price']; $product->phone = $data['phone']; $product->is_file_product = $data['is_file']; diff --git a/plugins/tps/birzha/components/Offers.php b/plugins/tps/birzha/components/Offers.php index 97f17e0..05ed43a 100644 --- a/plugins/tps/birzha/components/Offers.php +++ b/plugins/tps/birzha/components/Offers.php @@ -119,7 +119,7 @@ class Offers extends ComponentBase $productSlug = $this->property('productSlug'); $offerId = $this->property('offerId'); - $query = Product::where('status', 'approved')->withCount("images") + $query = Product::where('status', 'approved')->with("vendor")->withCount("images") ->orderBy('ends_at', $sortOrder); if($cSlug != '') { diff --git a/plugins/tps/birzha/components/OrderDetail.php b/plugins/tps/birzha/components/OrderDetail.php new file mode 100644 index 0000000..4d7d830 --- /dev/null +++ b/plugins/tps/birzha/components/OrderDetail.php @@ -0,0 +1,46 @@ + 'Single order', + 'description' => 'Selected order' + ]; + } + + public function defineProperties() + { + return [ + 'id' => [ + 'title' => 'Order id', + 'description' => 'Order id', + 'type' => 'string', + 'default' => '{{ :id }}' + ] + ]; + } + + + public function onRun() { + $this->order = $this->loadOrder(); + } + + + + + protected function loadOrder() { + $order = OrderItems::where('order_id', $this->property('id'))->first(); + return $order; + } +} \ No newline at end of file diff --git a/plugins/tps/birzha/components/SearchOffers.php b/plugins/tps/birzha/components/SearchOffers.php index 5e03cb9..c92c86e 100644 --- a/plugins/tps/birzha/components/SearchOffers.php +++ b/plugins/tps/birzha/components/SearchOffers.php @@ -67,7 +67,7 @@ class SearchOffers extends ComponentBase $products = $products->where('name', 'like', '%'.$title.'%')->withCount("images"); } - $products = $products->paginate($perPage); + $products = $products->with("vendor")->paginate($perPage); return $products; } diff --git a/plugins/tps/birzha/components/UserOffers.php b/plugins/tps/birzha/components/UserOffers.php index 0c84658..19b60ab 100644 --- a/plugins/tps/birzha/components/UserOffers.php +++ b/plugins/tps/birzha/components/UserOffers.php @@ -14,8 +14,10 @@ class UserOffers extends ComponentBase */ public $userProducts; public $userCategories; - public $user; + public $userProfile; public $params; + public $sliders; + public $currentCat; public function componentDetails() { @@ -65,8 +67,10 @@ class UserOffers extends ComponentBase $this->params = $params; $this->userCategories = $this->loadCategories(); - $this->user = $this->loadUser(); + $this->userProfile = $this->loadUser(); $this->userProducts = $this->loadProducts(); + $this->sliders = $this->loadSliders(); + $this->currentCat = $this->loadCurrentCategory(); } protected function loadProducts() { @@ -75,10 +79,14 @@ class UserOffers extends ComponentBase $sort = \Input::get('sort'); $vendor_id = $this->property('id'); $categorySlug = $this->property('slug'); + $category = null; - $category = Category::where('slug', $categorySlug)->first(); + if($categorySlug){ + $category = Category::where('slug', $categorySlug)->first(); + } $products = Product::query(); + if($category){ if (isset($sort) && $sort != '') { $sort = self::getSort($sort); @@ -90,9 +98,14 @@ class UserOffers extends ComponentBase if (isset($sort) && $sort != '') { $sort = self::getSort($sort); $products = $products->where("vendor_id", $vendor_id)->withCount("images")->orderBy( $sort[0], $sort[1]); - } + }else{ + + $products = $products->where("vendor_id", $vendor_id)->withCount("images")->orderBy( "id", "DESC"); + + } } $products = $products->paginate($perPage); + return $products; } @@ -113,14 +126,33 @@ class UserOffers extends ComponentBase protected function loadCategories(){ $user = User::find($this->property('id')); - $categories = $user->categories()->get(); - return $categories; + if($user){ + $categories = $user->categories()->get(); + return $categories; + } + + return null; } - - protected function loadUser(){ - $user = User::find($this->property('id')); + + protected function loadCurrentCategory(){ + $currentCat = Category::where("slug", $this->property('slug'))->first(); + if($currentCat){ + return $currentCat; + } + + return null; + } + + public function loadUser(){ + $user = User::with("sliders")->find($this->property('id')); return $user; } + + protected function loadSliders(){ + $user = User::find($this->property('id')); + return $user->sliders()->get(); + } + diff --git a/plugins/tps/birzha/components/categories/with_images.htm b/plugins/tps/birzha/components/categories/with_images.htm index 6a93369..238c079 100644 --- a/plugins/tps/birzha/components/categories/with_images.htm +++ b/plugins/tps/birzha/components/categories/with_images.htm @@ -21,7 +21,7 @@ >
- + Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ category.name }}
{{ category.name }} diff --git a/plugins/tps/birzha/components/categoryprofile/default.htm b/plugins/tps/birzha/components/categoryprofile/default.htm index 9dda760..45150d1 100644 --- a/plugins/tps/birzha/components/categoryprofile/default.htm +++ b/plugins/tps/birzha/components/categoryprofile/default.htm @@ -20,14 +20,7 @@
-
-
-
- -
-
-
- +
@@ -88,6 +89,7 @@ localStorage.removeItem("cartForForm"); localStorage.removeItem("products"); localStorage.removeItem("productsForForm"); + location.reload() } function resetFormFailed() { document.getElementById('checkoutForm').reset(); // Reset the form @@ -119,7 +121,7 @@ cartBody.append(` - `+item.name+` + Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi `+item.name+` `+item.name+` `+item.price+` diff --git a/plugins/tps/birzha/components/contactform/default.htm b/plugins/tps/birzha/components/contactform/default.htm index 7e88cce..7da3146 100644 --- a/plugins/tps/birzha/components/contactform/default.htm +++ b/plugins/tps/birzha/components/contactform/default.htm @@ -22,7 +22,12 @@ \ No newline at end of file +
+ +{% put scripts %} + +{% endput %} \ No newline at end of file diff --git a/plugins/tps/birzha/components/filteredProducts/default.htm b/plugins/tps/birzha/components/filteredproducts/default.htm similarity index 79% rename from plugins/tps/birzha/components/filteredProducts/default.htm rename to plugins/tps/birzha/components/filteredproducts/default.htm index 5a5aa6c..6915cd4 100644 --- a/plugins/tps/birzha/components/filteredProducts/default.htm +++ b/plugins/tps/birzha/components/filteredproducts/default.htm @@ -65,16 +65,6 @@ placeholder="1350" value="{{input('max_price') ? input('max_price') : null}}">
- - - - - - - - - -
@@ -114,9 +104,9 @@
- + Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ product.name }} {% if product.images_count > 1 %} - + Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ product.name }} {% endif %}
@@ -137,9 +127,17 @@
- +
- + {% if user %} + + {% else %} + + {% endif %}
@@ -156,14 +164,17 @@
- + + + + +
+ + @@ -174,26 +185,28 @@
+ +
{% if user %} -
+ @@ -206,8 +219,8 @@ -

- {{ product.name }} +

{{product.vendor.shop_title}}

+ {{ product.name }}
{{ product.price }} TMT
@@ -221,15 +234,21 @@ diff --git a/plugins/tps/birzha/components/orderdetail/default.htm b/plugins/tps/birzha/components/orderdetail/default.htm new file mode 100644 index 0000000..f976b81 --- /dev/null +++ b/plugins/tps/birzha/components/orderdetail/default.htm @@ -0,0 +1,58 @@ +{% set order = __SELF__.order %} + +
+
+
+
+
Zakaz
+ +
+
+
+
+ + + +
+
+
+
+
+
+ + + + + + + + + + + + + {% for item in order.items %} + + + + + + + + {% endfor %} + + +
SuratHaryt adyMukdaryBahasyJemi
+ {{ getProductName(item.item) }} + + {{ getProductName(item.item) }}{{ item.qty }}{{ item.price }} TMT{{ item.qty * item.price }} TMT
+
+
+
+
+
+
+ diff --git a/plugins/tps/birzha/components/searchoffers/default.htm b/plugins/tps/birzha/components/searchoffers/default.htm index ac6f9d6..1fa4d5f 100644 --- a/plugins/tps/birzha/components/searchoffers/default.htm +++ b/plugins/tps/birzha/components/searchoffers/default.htm @@ -17,9 +17,9 @@
- + Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ product.name }} {% if product.images_count > 1 %} - + Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ product.name }} {% endif %}
@@ -40,13 +40,21 @@
- +
- + {% if user %} + + {% else %} + + {% endif %}