diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php index fd1d087..668482d 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php @@ -115,7 +115,7 @@ class BlogPostsApiController extends Controller $products->map(function ($product) { $image = new Image($product->images[0]->path); - $product->images[0]->compressed_image = $image->resize([ 'quality' => 50])->getCachedImagePath(true); + $product->images[0]->compressed_image = $image->resize(510)->getCachedImagePath(true); return $product; //foreach($product->images as $compressImage){ @@ -136,17 +136,49 @@ class BlogPostsApiController extends Controller $data = $request->all(); - + $catIds = $this->onGetCategorySubs($data["category"]); - $accounts = Category::select("id","name", "icon", "is_file_category", "primary_key")->where('id', $data["category"]) - ->with(["users" => function($q){ - $q->where("type", "!=", "simple"); - }]) + $cats = Category::whereIn("id", $catIds)->with("subs")->get(); + + + + foreach($cats as $cat) { + foreach($cat->subs as $sub) { + array_unshift($catIds, $sub->id); + } + } + + $accounts = Category::select("id","name", "icon", "is_file_category", "primary_key") + ->where('id', $data["category"]) + //->whereIn('id', $cats) + ->with('users') + //->whereHas('users.categories', function($q) use($cats){ + // $q->whereIn('id', $cats); + //}) + + //->with(["users" => function($q) use($cats){ + // $q->where("type", "!=", "simple") + // ->with('categories') + // ->whereHas('categories', function($qq) use($cats){ + // $qq->whereIn('id', $cats); + // }); + //}]) ->get(); + + $userAccounts = User::where('type', '!=', 'simple') + ->whereHas('categories', function($q) use($catIds){ + $q->whereIn('category_id', $catIds); + }) + ->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(); + $accounts[0]->users = $userAccounts; + + $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, @@ -196,7 +228,7 @@ class BlogPostsApiController extends Controller '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,web2', - ])->limit(10)->get(); + ])->orderBy('ends_at', 'DESC')->limit(20)->get(); // $modified->makeHidden(['created_at', 'updated_at', 'deleted_at']); $product_section = array( "type"=> "product_section", @@ -371,7 +403,7 @@ class BlogPostsApiController extends Controller $favourite->map(function ($fav) { $image = new Image($fav->product->images[0]->path); - $fav->product->images[0]->compressed_image = $image->resize([ 'quality' => 50])->getCachedImagePath(true); + $fav->product->images[0]->compressed_image = $image->resize(510)->getCachedImagePath(true); return $fav; }); @@ -405,7 +437,7 @@ class BlogPostsApiController extends Controller $data->map(function ($product) { $image = new Image($product->images[0]->path); - $product->images[0]->compressed_image = $image->resize([ 'quality' => 50])->getCachedImagePath(true); + $product->images[0]->compressed_image = $image->resize(510)->getCachedImagePath(true); return $product; //foreach($product->images as $compressImage){ @@ -471,6 +503,7 @@ class BlogPostsApiController extends Controller $all = array( "id" => 0, "name"=> "Hemmesi", + "icon" => "/not_found_img/placeholder.png" ); //array_unshift($data->categories, $all); diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/OrderApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/OrderApiController.php index a1b90d8..63cef68 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/OrderApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/OrderApiController.php @@ -306,7 +306,7 @@ class OrderApiController extends Controller $currentUser = \JWTAuth::parseToken()->authenticate(); $counter = 0; - $sales = VendorSales::where('vendor_id', $currentUser->id)->where('status', 'new')->get(); + $sales = VendorSales::where('vendor_id', $currentUser->id)->where('status', 'new')->groupBy('order_id')->get(); @@ -336,6 +336,7 @@ class OrderApiController extends Controller //dd($data); $currentUser = \JWTAuth::parseToken()->authenticate(); $vendorOrders = VendorSales::where('order_id', $data["order_id"])->get(); + $order = Orders::where('id', $data["order_id"])->first(); if((count($vendorOrders) != 0) && ($vendorOrders[0]->vendor_id == $currentUser->id)){ @@ -345,6 +346,9 @@ class OrderApiController extends Controller $vendorOrders[$i]->save(); } + + $order->status = "completed"; + $order->save(); } diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php index 6b9ee33..5f1d069 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php @@ -55,7 +55,7 @@ class ProductsAPIController extends Controller $products->map(function ($product) { $image = new Image($product->images[0]->path); - $product->images[0]->compressed_image = $image->resize([ 'quality' => 50])->getCachedImagePath(true); + $product->images[0]->compressed_image = $image->resize(510)->getCachedImagePath(true); return $product; }); @@ -304,12 +304,12 @@ class ProductsAPIController extends Controller } - $data = $query ? $query->orderBy('id', "DESC")->orderBy('ends_at', $sortOrder)->paginate($perPage) : null; + $data = $query ? $query->orderBy('created_at', "DESC")->orderBy('id', "DESC")->paginate($perPage) : null; $data->map(function ($product) { $image = new Image($product->images[0]->path); - $product->images[0]->compressed_image = $image->resize(500)->getCachedImagePath(true); + $product->images[0]->compressed_image = $image->resize(510)->getCachedImagePath(true); return $product; @@ -681,7 +681,7 @@ class ProductsAPIController extends Controller if($product){ - $product->ends_at = $currentDateFormat; + $product->created_at = $currentDateFormat; $product->save(); diff --git a/plugins/rainlab/user/models/User.php b/plugins/rainlab/user/models/User.php index 380b440..ed21fa3 100644 --- a/plugins/rainlab/user/models/User.php +++ b/plugins/rainlab/user/models/User.php @@ -45,8 +45,6 @@ class User extends UserBase 'categories' => [ 'TPS\Birzha\Models\Category', 'table'=>'tps_birzha_users_categories', - 'delete' => true, - 'softDelete' => true ], ]; @@ -58,14 +56,14 @@ class User extends UserBase ]; public $hasMany = [ - 'products' => ['TPS\Birzha\Models\Product', 'key' => 'vendor_id', 'softDelete' => true], + 'products' => ['TPS\Birzha\Models\Product', 'key' => 'vendor_id'], 'transactions' => ['TPS\Birzha\Models\Transaction', 'softDelete' => true], 'exchangerequests' => ['TPS\Birzha\Models\Exchangerequest', 'softDelete' => true], - 'sliders' => ['TPS\Birzha\Models\UserSliders', 'softDelete' => true], - 'favourites' => ['TPS\Birzha\Models\Favourites', 'softDelete' => true, 'table' => 'tps_birzha_favourites'], + 'sliders' => ['TPS\Birzha\Models\UserSliders'], + 'favourites' => ['TPS\Birzha\Models\Favourites', 'table' => 'tps_birzha_favourites'], 'comments' => ['TPS\Birzha\Models\Comment','table' => 'tps_birzha_comments'], 'orders' => ['TPS\Birzha\Models\Orders','table' => 'tps_birzha_orders'], - 'vendor_sales' => ['TPS\Birzha\Models\VendorSales', 'key' => 'vendor_id', 'softDelete' => true], + 'vendor_sales' => ['TPS\Birzha\Models\VendorSales', 'key' => 'vendor_id'], 'messages' => ['TPS\Birzha\Models\Message', 'key' => 'reciver_id', 'softDelete' => true], ]; diff --git a/plugins/rainlab/user/models/user/fields.yaml b/plugins/rainlab/user/models/user/fields.yaml index 2445de0..ccc3aca 100644 --- a/plugins/rainlab/user/models/user/fields.yaml +++ b/plugins/rainlab/user/models/user/fields.yaml @@ -127,6 +127,7 @@ tabs: label: Kategoriýalar nameFrom: name descriptionFrom: description + scope: userCategory span: auto type: relation tab: Kategoriyalar diff --git a/plugins/tps/birzha/components/CategoryProfile.php b/plugins/tps/birzha/components/CategoryProfile.php index 93cfcb3..05ff56c 100644 --- a/plugins/tps/birzha/components/CategoryProfile.php +++ b/plugins/tps/birzha/components/CategoryProfile.php @@ -22,6 +22,7 @@ class CategoryProfile extends ComponentBase public $subcategories; public $categories; public $cities; + public $categoryUsers; public function componentDetails() { return [ @@ -49,6 +50,7 @@ class CategoryProfile extends ComponentBase public function onRun() { $this->users = $this->getCategoryUsers(); $this->category = $this->getCategory(); + $this->categoryUsers = $this->category->users; $this->subcategories = $this->getSubs(); $this->categories = $this->getCategories(); $this->cities = $this->getCities(); @@ -88,7 +90,7 @@ class CategoryProfile extends ComponentBase protected function getCategoryUsers(){ $cSlug = $this->property('categorySlug'); $category = Category::where('slug', $cSlug)->first(); - $users = $category ? $category->users()->get() : null; + $users = $category ? $category->users()->where('is_category', 1)->get() : null; return $users; } diff --git a/plugins/tps/birzha/components/categoryprofile/default.htm b/plugins/tps/birzha/components/categoryprofile/default.htm index fb2e5b9..9455590 100644 --- a/plugins/tps/birzha/components/categoryprofile/default.htm +++ b/plugins/tps/birzha/components/categoryprofile/default.htm @@ -1,6 +1,7 @@ {% set category = __SELF__.category %} {% set categories = __SELF__.categories %} {% set users = __SELF__.users %} +{% set categoryUsers = __SELF__.categoryUsers %} {% set subs = __SELF__.subcategories %} {% set cities = __SELF__.cities %} {% set counter = 0 %} @@ -24,16 +25,41 @@ + + + + + +
-
+ + + {% if categoryUsers.count > 0 %} +
+ +
+ {% endif %} + + + +
diff --git a/plugins/tps/birzha/controllers/Products.php b/plugins/tps/birzha/controllers/Products.php index 9c28b40..8e3652c 100644 --- a/plugins/tps/birzha/controllers/Products.php +++ b/plugins/tps/birzha/controllers/Products.php @@ -52,4 +52,16 @@ class Products extends Controller //return $smsSender; } } + + + + public function listExtendQuery($query) + { + $query->withTrashed(); + } + + public function formExtendQuery($query) + { + $query->withTrashed(); + } } diff --git a/plugins/tps/birzha/models/Category.php b/plugins/tps/birzha/models/Category.php index 3d676ec..4fd9ba0 100644 --- a/plugins/tps/birzha/models/Category.php +++ b/plugins/tps/birzha/models/Category.php @@ -3,6 +3,7 @@ use Cms\Classes\Page as CmsPage; use Cms\Classes\Theme; use Model; +use DB; /** * Model @@ -55,8 +56,6 @@ class Category extends Model 'users' => [ 'RainLab\User\Models\User', 'table'=>'tps_birzha_users_categories', - 'delete' => true, - 'softDelete' => true ], ]; @@ -64,12 +63,17 @@ class Category extends Model { return $query->where('status', 1); } + + public function scopeUserCategory($query) + { + return $query->where('status', 1)->orderBy('id', 'DESC')->select(DB::raw("CONCAT(id, '. ', name, ' --- ', slug, ' / ', primary_key) AS name"),'id', 'primary_key'); + } public function scopeActiveAndParent($query) { return $query->where('status', 1)->where('primary_key',0); } - + public function scopeActiveAndParentFirstFour($query) { diff --git a/plugins/tps/birzha/models/product/columns.yaml b/plugins/tps/birzha/models/product/columns.yaml index bd2a4a3..5f14ea5 100644 --- a/plugins/tps/birzha/models/product/columns.yaml +++ b/plugins/tps/birzha/models/product/columns.yaml @@ -10,6 +10,7 @@ columns: user_id: label: User type: vendor + searchable: true relation: vendor valueFrom: username status: @@ -35,3 +36,7 @@ columns: is_file: label: IsFile type: switch + deleted_at: + label: 'POZULAN SENE' + type: datetime + sortable: true diff --git a/plugins/tps/birzha/models/product/fields.yaml b/plugins/tps/birzha/models/product/fields.yaml index cf77ef3..00c23f9 100644 --- a/plugins/tps/birzha/models/product/fields.yaml +++ b/plugins/tps/birzha/models/product/fields.yaml @@ -82,7 +82,7 @@ tabs: label: Kategoriýalar nameFrom: name descriptionFrom: description - scope: active + scope: userCategory span: auto required: 1 type: relation @@ -134,3 +134,10 @@ tabs: type: text comment: 'name diyip gozledende shu harydyn chykmaly bolsa shu yerde giriz otur goyup bgidiwermeli' tab: Status + deleted_at: + label: 'POZULANMY?' + mode: date + span: auto + type: datepicker + comment: 'Pozulan bolsa icindaki chislony poz' + tab: 'POZULANMY?' diff --git a/themes/gurlushyk/layouts/default.htm b/themes/gurlushyk/layouts/default.htm index d4e97a0..3b376c8 100644 --- a/themes/gurlushyk/layouts/default.htm +++ b/themes/gurlushyk/layouts/default.htm @@ -83,6 +83,9 @@ redirect = "login" autoplayTimeout:1000, }) + + $(".owl-stage:nth-child(1)").addClass('w-20900'); + $(".owl-stage:nth-child(2)").addClass('w-11826'); }); diff --git a/themes/gurlushyk/meta/menus/top-menu.yaml b/themes/gurlushyk/meta/menus/top-menu.yaml index 3bf8b30..07403df 100644 --- a/themes/gurlushyk/meta/menus/top-menu.yaml +++ b/themes/gurlushyk/meta/menus/top-menu.yaml @@ -20,7 +20,7 @@ items: title: 'Gips önümleri' nesting: null type: url - url: /category-profile/sdfsdfsdf + url: /category-profile/gips-onumleri code: '' reference: null cmsPage: null @@ -90,7 +90,7 @@ items: title: 'Agaç önümleri' nesting: null type: url - url: /category-profile/testq + url: /category-profile/agac-onumleri code: '' reference: null cmsPage: null @@ -121,6 +121,23 @@ items: isHidden: '0' cssClass: '1' isExternal: '0' + - + title: 'Nurly Gapylar' + nesting: null + type: url + url: /category-profile/nurly-gapylar + code: '' + reference: null + cmsPage: null + replace: null + viewBag: + locale: + ru: + title: '' + url: '' + isHidden: '0' + cssClass: '2' + isExternal: '0' - title: 'Aýna önümleri' nesting: null @@ -174,23 +191,6 @@ items: cssClass: '' isExternal: '0' items: - - - title: Wklýuçatel - nesting: null - type: url - url: /category/products/wklyucatel - code: '' - reference: null - cmsPage: null - replace: null - viewBag: - locale: - ru: - title: '' - url: '' - isHidden: '0' - cssClass: '3' - isExternal: '0' - title: 'Rother elektrik' nesting: null @@ -276,6 +276,24 @@ items: isHidden: '0' cssClass: '' isExternal: '0' + items: + - + title: BETEK + nesting: null + type: url + url: /category-profile/betek + code: '' + reference: null + cmsPage: null + replace: null + viewBag: + locale: + ru: + title: '' + url: '' + isHidden: '0' + cssClass: '1' + isExternal: '0' - title: 'Elektrik önümleri' nesting: null @@ -293,6 +311,41 @@ items: isHidden: '0' cssClass: '' isExternal: '0' + items: + - + title: BETEK + nesting: null + type: url + url: /category-profile/betek1 + code: '' + reference: null + cmsPage: null + replace: null + viewBag: + locale: + ru: + title: '' + url: '' + isHidden: '0' + cssClass: '1' + isExternal: '0' + - + title: 'Elektrik önümleri dükany' + nesting: null + type: url + url: /category-profile/elektrik-onumleri-dukany + code: '' + reference: null + cmsPage: null + replace: null + viewBag: + locale: + ru: + title: '' + url: '' + isHidden: '0' + cssClass: '2' + isExternal: '0' - title: Laminant nesting: null @@ -327,6 +380,24 @@ items: isHidden: '0' cssClass: '' isExternal: '0' + items: + - + title: BETEK + nesting: null + type: url + url: /category-profile/betek2 + code: '' + reference: null + cmsPage: null + replace: null + viewBag: + locale: + ru: + title: '' + url: '' + isHidden: '0' + cssClass: '1' + isExternal: '0' - title: 'Demir önümleri' nesting: null @@ -361,6 +432,24 @@ items: isHidden: '0' cssClass: '' isExternal: '0' + items: + - + title: BETEK + nesting: null + type: url + url: /category-profile/betek3 + code: '' + reference: null + cmsPage: null + replace: null + viewBag: + locale: + ru: + title: '' + url: '' + isHidden: '0' + cssClass: '1' + isExternal: '0' - title: 'Birikdiriji we berkidiji' nesting: null @@ -380,9 +469,13 @@ items: isExternal: '0' - title: 'Ownuk harytlar' + nesting: null type: url url: /category-profile/ownuk-harytlar code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: ru: @@ -393,9 +486,13 @@ items: isExternal: '0' - title: 'El gurallary' + nesting: null type: url url: /category-profile/el-gurallary code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: ru: @@ -406,9 +503,13 @@ items: isExternal: '0' - title: 'Elektro enjamlar' + nesting: null type: url url: /category-profile/elektro-enjamlar code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: ru: diff --git a/themes/gurlushyk/pages/addProduct.htm b/themes/gurlushyk/pages/addProduct.htm index ade75f7..8da006f 100644 --- a/themes/gurlushyk/pages/addProduct.htm +++ b/themes/gurlushyk/pages/addProduct.htm @@ -116,7 +116,7 @@ productId = "{{ :productId }}"
- +
diff --git a/themes/gurlushyk/partials/customStyle.htm b/themes/gurlushyk/partials/customStyle.htm index c0fb017..2d8fc7f 100644 --- a/themes/gurlushyk/partials/customStyle.htm +++ b/themes/gurlushyk/partials/customStyle.htm @@ -245,6 +245,16 @@ p { } @media (max-width: 1200px) { + + .w-11826{ + width: 11826px !important; + } + + .w-20900{ + width: 20900px !important; + } + + .chat_area2{ height: 448px; } @@ -338,6 +348,14 @@ p { } @media (max-width: 992px) { + .w-11826{ + width: 11826px !important; + } + + .w-20900{ + width: 20900px !important; + } + .chat_area2{ height: 448px; } diff --git a/themes/gurlushyk/partials/profile/modal.htm b/themes/gurlushyk/partials/profile/modal.htm index 0ccc359..ee7d0ce 100644 --- a/themes/gurlushyk/partials/profile/modal.htm +++ b/themes/gurlushyk/partials/profile/modal.htm @@ -35,22 +35,28 @@
-
-
-
- + + {% if userProfile.qr %} +
+
+
+ +
-
-
-
- -
- + {% endif %} + + {% if userProfile.banner %} +
+
+ +
+ +
+
-
-
+ {% endif %}
diff --git a/themes/gurlushyk/partials/profile/style1.htm b/themes/gurlushyk/partials/profile/style1.htm index a77e814..ff38372 100644 --- a/themes/gurlushyk/partials/profile/style1.htm +++ b/themes/gurlushyk/partials/profile/style1.htm @@ -8,7 +8,7 @@
- Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ userProfile.name }} + Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ userProfile.name }}
{{ userProfile.shop_title }}

{{ userProfile.slogan }}