from server 17.11

This commit is contained in:
Shohrat 2023-11-17 19:15:34 +00:00
parent 2f8aff3430
commit 74772a818c
17 changed files with 284 additions and 65 deletions

View File

@ -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"]);
$cats = Category::whereIn("id", $catIds)->with("subs")->get();
$accounts = Category::select("id","name", "icon", "is_file_category", "primary_key")->where('id', $data["category"])
->with(["users" => function($q){
$q->where("type", "!=", "simple");
}])
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();
$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();
$userAccounts = User::where('type', '!=', 'simple')
->whereHas('categories', function($q) use($catIds){
$q->whereIn('category_id', $catIds);
})
->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);

View File

@ -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)){
@ -346,6 +347,9 @@ class OrderApiController extends Controller
}
$order->status = "completed";
$order->save();
}

View File

@ -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();

View File

@ -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],
];

View File

@ -127,6 +127,7 @@ tabs:
label: Kategoriýalar
nameFrom: name
descriptionFrom: description
scope: userCategory
span: auto
type: relation
tab: Kategoriyalar

View File

@ -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;
}

View File

@ -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 @@
<!-- Breadcumb Area -->
<!-- Shop Catagory Area -->
<div class="shop_by_catagory_area section_padding_0">
<div class="container">
<div class="row">
<div class="col-12">
{% if categoryUsers.count > 0 %}
<div class="col-12">
<div class="shop_by_catagory_slides owl-carousel">
{% for categoryUser in categoryUsers %}
<div class="single_catagory_slide">
<a href="{{ 'user-profile'|page({id: categoryUser.id}) }}">
<img src="{{ categoryUser.logo|media|resize(127, 127, { mode: 'crop' }) }}" alt="Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ categoryUser.name }}" style="border-radius: 75px !important">
</a>
<p>{{ categoryUser.name }}</p>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<div class="col-12 {{ categoryUsers.count > 0 ? 'mt-5' : '' }}">
<div class="shop_by_catagory_slides owl-carousel">
<!-- Single Slide -->
{% if category.primary_key > 0 %}
{% if category.parent.primary_key > 0 %}
<div class="single_catagory_slide">
<a href="{{ 'category-profile'|page({categorySlug: category.parent.parent.slug}) }}">
@ -83,7 +109,6 @@
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>

View File

@ -52,4 +52,16 @@ class Products extends Controller
//return $smsSender;
}
}
public function listExtendQuery($query)
{
$query->withTrashed();
}
public function formExtendQuery($query)
{
$query->withTrashed();
}
}

View File

@ -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
],
];
@ -65,6 +64,11 @@ 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);

View File

@ -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

View File

@ -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?'

View File

@ -83,6 +83,9 @@ redirect = "login"
autoplayTimeout:1000,
})
$(".owl-stage:nth-child(1)").addClass('w-20900');
$(".owl-stage:nth-child(2)").addClass('w-11826');
});
</script>

View File

@ -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:

View File

@ -116,7 +116,7 @@ productId = "{{ :productId }}"
<textarea class="form-control" id="description" cols="30" rows="20" name="description" style="height: 160px;" placeholder="{{ 'productAdd.GinsileyinBeyany'|_ }}" required></textarea>
</div>
<div class="col-md-6 mb-3">
<label for="phone">{{ 'productAdd.TelefonBelgisi'|_ }}</label>
<label for="phone">{{ 'productAdd.TelefonBelgisi2'|_ }}</label>
<input type="tel" class="form-control" id="phone" name="phone" value="+993" required>
</div>
<div class="col-md-6 mb-3">

View File

@ -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;
}

View File

@ -35,22 +35,28 @@
</div>
</div>
</div>
<div class="col-md-3 col-6" style="align-self: center;">
<div class="row" style="border-left: 1px solid gray;border-right: 1px solid gray;">
<div class="col-md-12" style="text-align:center;">
<img src="{{userProfile.qr|media}}" style="width: 150px;border: 1px solid;">
{% if userProfile.qr %}
<div class="col-md-3 col-6" style="align-self: center;">
<div class="row" style="border-left: 1px solid gray;border-right: 1px solid gray;">
<div class="col-md-12" style="text-align:center;">
<img src="{{userProfile.qr|media}}" style="width: 150px;border: 1px solid;">
</div>
</div>
</div>
</div>
<div class="col-md-5 mt-2" style="align-self: center;">
<div class="row">
{% endif %}
{% if userProfile.banner %}
<div class="col-md-5 mt-2" style="align-self: center;">
<div class="row">
<div class="col-md-12">
<a><img src="{{userProfile.banner|media}}" style="width: 550px;"></a>
</div>
<div class="col-md-12">
<a><img src="{{userProfile.banner|media}}" style="width: 550px;"></a>
</div>
</div>
</div>
{% endif %}
</div>

View File

@ -8,7 +8,7 @@
<div class="widget catagory mb-30">
<div style="text-align: center">
<img src="{{ user.logo|media|resize(200, 200, { mode: 'crop' }) }}" alt="Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ userProfile.name }}" style="width: 60%;border: 5px solid white;border-radius: 10px;box-shadow: 0px 2px 5px #00000038;">
<img src="{{ userProfile.logo|media|resize(200, 200, { mode: 'crop' }) }}" alt="Gurluşyk, Gurluşyk platform, bezeg gurluşyk, gipsler merkezi, {{ userProfile.name }}" style="width: 60%;border: 5px solid white;border-radius: 10px;box-shadow: 0px 2px 5px #00000038;">
</div>
<h6 class="widget-title" style="margin-top: 25px;text-align: center;font-weight: bold;font-size: 18px;margin-bottom: 2px;">{{ userProfile.shop_title }}</h6>
<p style="text-align: center;font-size: 14px;">{{ userProfile.slogan }}</p>