diff --git a/plugins/tps/birzha/components/ContactForm.php b/plugins/tps/birzha/components/ContactForm.php index 2bade8a..e5d98e2 100644 --- a/plugins/tps/birzha/components/ContactForm.php +++ b/plugins/tps/birzha/components/ContactForm.php @@ -3,6 +3,7 @@ use Cms\Classes\ComponentBase; use TPS\Birzha\Models\Contactmessage; use TPS\Birzha\Models\Settings; +use Flash; class ContactForm extends ComponentBase { @@ -15,7 +16,6 @@ class ContactForm extends ComponentBase public function onSend() { $data = post(); - $rules = [ 'name' => 'required|max:100', 'surname' => 'required|max:100', @@ -23,22 +23,15 @@ class ContactForm extends ComponentBase 'email' => 'required|email|max:100', 'content' => 'required' ]; - $validator = \Validator::make($data, $rules); - if($validator->fails()) { + Flash::error("Doldurmaly ýerleri dolduryň"); throw new \ValidationException($validator); } else { - - // todo save message - $contactMessage = new Contactmessage(); $contactMessage->fill($data); $contactMessage->save(); - - return [ - '#form-steps' => $this->renderPartial('@message_sent') - ]; + Flash::success('Hatyňyz ugradyldy'); } } } \ No newline at end of file diff --git a/plugins/tps/birzha/components/FilteredProducts.php b/plugins/tps/birzha/components/FilteredProducts.php new file mode 100644 index 0000000..9b23342 --- /dev/null +++ b/plugins/tps/birzha/components/FilteredProducts.php @@ -0,0 +1,157 @@ + 'Filtered Producs', + 'description' => 'Getting Filtered products' + ]; + } + + 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' + ], + 'sortOrder' => [ + 'title' => 'Sort offers', + 'description' => 'How to sort offers', + 'type' => 'dropdown', + 'default' => 'desc' + ] + ]; + } + + public function getSortOrderOptions() + { + return [ + 'asc' => 'Created date (ascending)', + 'desc' => 'Created date (descending)' + ]; + } + + public function onRun() + { + $allParams = \Input::all(); + + $params = ''; + + foreach ($allParams as $key => $item) { + if($key != 'page'){ + $params .= '&'.$key.'='.$item; + } + } + + $this->params = $params; + $this->products = $this->loadFiltered(); + $this->category = $this->getSubCategory(); + $this->categories = $this->getCategories(); + $this->cities = $this->getCities(); + } + + protected function getSubCategory() + { + $cSlug = \Input::get('subcategory'); + $category = Category::transWhere('slug', $cSlug, Session::get('rainlab.translate.locale'))->first(); + return $category; + } + + protected function getCategories() + { + $categories = Category::all(); + return $categories; + } + + protected function getCities() + { + $cities = City::all(); + return $cities; + } + + protected function loadFiltered() + { + $sortOrderParam = strtolower(\Input::get('sort_order')); + // protect from sql injection + if ($sortOrderParam != 'asc' && $sortOrderParam != 'desc') { + $sortOrder = $this->property('sortOrder'); + } else { + $sortOrder = $sortOrderParam; + $this->sortParam = $sortOrderParam; + } + + $perPage = $this->property('perPage'); + $products = Product::query(); + + $cSlug = \Input::get('subcategory'); + $city = \Input::get('city'); + $minPrice = \Input::get('min_price'); + $maxPrice = \Input::get('max_price'); + $sort = \Input::get('sort'); + + if (isset($cSlug) && $cSlug != '') { + $category = Category::transWhere('slug', $cSlug, Session::get('rainlab.translate.locale'))->first(); + if ($category) { + $products = $category->products(); + // $products->withPath("filter?category=".$category->slug); + } else { + $products = null; + } + } + if (isset($city) && $city != '') { + $products = $products->where('place_id', $city); + } + if (isset($minPrice) && $minPrice != '') { + $products = $products->where('price', '>=', $minPrice); + } + if (isset($maxPrice) && $maxPrice != '') { + $products = $products->where('price', '<=', $maxPrice); + } + + if (isset($sort) && $sort != '') { + $sort = self::getSort($sort); + $products = $products->orderBy( $sort[0], $sort[1]); + } + + $products = $products->where('status', 'approved')->orderBy('updated_at', $sortOrder); + + return $products ? $products->paginate($perPage) : null; + } + + private static function getSort($sort): array + { + $sort_key = trim($sort, '-'); + + if (str_contains($sort, '-') && strpos($sort, '-') == 0) { + $sort_direction = 'desc'; + } + + return [ + $sort_key, + $sort_direction ?? 'asc' + ]; + } +} diff --git a/plugins/tps/birzha/components/MyOffers.php b/plugins/tps/birzha/components/MyOffers.php index eed9fa2..6abec79 100644 --- a/plugins/tps/birzha/components/MyOffers.php +++ b/plugins/tps/birzha/components/MyOffers.php @@ -3,6 +3,7 @@ use Cms\Classes\ComponentBase; use TPS\Birzha\Models\Product; use Input; +use Flash; class MyOffers extends ComponentBase { @@ -36,31 +37,18 @@ class MyOffers extends ComponentBase 'perPage' => [ 'title' => 'Number of offers', 'description' => 'How many offers do you want to display', - 'default' => 0, + 'default' => 12, 'validationPattern' => '^[0-9]+$', 'validationMessage' => 'Only numbers allowed' ], - // 'productSlug' => [ - // 'title' => 'Product Slug', - // 'description' => 'Similar offers (the same product)', - // 'type' => 'string', - // 'default' => '' - // ], - // 'offerId' => [ - // 'title' => 'Offer id', - // 'description' => 'Offer id', - // 'type' => 'string', - // 'default' => '' - // ] ]; } public function onDeleteOffer() { - $product = Product::find(Input::get('deleting_product_id')); + $product = Product::find(Input::get('id')); $product->images()->delete(); $product->translations()->delete(); $product->delete(); - return \Redirect::back(); } @@ -72,7 +60,6 @@ class MyOffers extends ComponentBase protected function loadOffers() { $perPage = $this->property('perPage'); - return \Auth::user()->products() ->orderBy('updated_at', 'desc') ->paginate($perPage); diff --git a/plugins/tps/birzha/components/OfferForm.php b/plugins/tps/birzha/components/OfferForm.php index d0f4e28..b4c1364 100644 --- a/plugins/tps/birzha/components/OfferForm.php +++ b/plugins/tps/birzha/components/OfferForm.php @@ -10,11 +10,13 @@ use Tps\Birzha\Models\Currency; use Tps\Birzha\Models\Product; use Tps\Birzha\Models\Category; use Tps\Birzha\Models\Country; +use Tps\Birzha\Models\City; use TPS\Birzha\Models\Settings; use Flash; use Str; use ValidationException; use Carbon\Carbon; +use RainLab\User\Facades\Auth; class OfferForm extends ComponentBase { @@ -22,11 +24,13 @@ class OfferForm extends ComponentBase * @var string A collection of categories in dropdown */ public $categories; + public $subcategories; /** * @var string A collection of countries in dropdown */ - public $countries; + public $states; + public $cities; /** * @var string A string with product id @@ -56,79 +60,94 @@ class OfferForm extends ComponentBase ]; } - // step1 - public function onSave() { + + public function onSave(){ $data = post(); - $rules = [ - 'name_ru' => 'required', - 'name_en' => 'required', - 'name_tm' => 'required', - 'category_id' => 'exists:tps_birzha_categories,id', - 'mark' => 'required', - 'manufacturer' => 'required', - 'country' => 'required', - 'market_type' => 'required|in:in,out' + 'name' => 'required', + 'price' => 'required|numeric', + 'state_id' => 'required', + 'description' => 'required', + 'new_img' => 'array|required', + // 'is_file' => 'required', + 'new_img.*' => 'mimes:jpg,png|max:1024', + 'category_id' => [ + 'required', + 'exists:tps_birzha_categories,id', + function ($attribute, $value, $fail) { + $c = Category::find($value); + if($c) { + if($c->status != 1) $fail(":attribute is non-active!"); + } + } + ], ]; $this->validateForm($data, $rules); + + + if(!$data['new_img']) { + Flash::error('Required at least one new'); + } - $category = Category::find($data['category_id']); + $category = null; + if($data["subcategory_id"] != 'null'){ + $category = Category::find($data['subcategory_id']); + }else{ + $category = Category::find($data['category_id']); + } - if(isset($data['productForEditing'])) { - $product = Product::find($data['productForEditing']); - //approved edilen produkty prodlenie uchin drafta tayinlamak, bagly transacsiasyny goparmak, - if($product && $product->status == 'approved' && $product->transaction) - { - $product->transaction()->update(['description'=>"Lot #{$product->id} {$product->name} harydyn onki publikasia tolegidir.(bu haryt prodlenia uchin taze transaksia doredilyar)"]); - $product->transaction = null; + $product = new Product; + $product->name = $data['name']; + $product->description = $data['description']; + $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->price = $data['price']; + $product->phone = $data['phone']; + $product->is_file_product = $data['is_file']; + + if($data['is_file'] == 1){ + if(!$data['new_file']) { + return Flash::error('Required at least one new'); } - } else { - $product = new Product; + if($data['new_file']) { + $rules = [ + 'new_file' => 'required' + ]; + } + try { + + foreach($data['new_file'] ?? [] as $key => $fileq) { + $product->files = $fileq; + $product->save(); + } + } catch(\Throwable $e) { + return Flash::error('Something went'); + } + } - $product->translateContext('tm'); - - $product->name = $data['name_tm']; - // Sets a single translated attribute for a language - $product->setAttributeTranslated('name', $data['name_ru'], 'ru'); - $product->setAttributeTranslated('name', $data['name_en'], 'en'); - // Sets a single translated attribute for a language - $product->setAttributeTranslated('slug', Str::slug($data['name_ru'],'-'), 'ru'); - $product->setAttributeTranslated('slug', Str::slug($data['name_en'],'-'), 'en'); - - $product->slug = Str::slug($data['name_tm'],'-'); - $product->status = 'draft'; - $product->mark = $data['mark']; - $product->manufacturer = $data['manufacturer']; - $product->country = $data['country']; - $product->market_type = $data['market_type']; - - $product->vendor_id = \Auth::user()->id; - $product->ends_at = null; // if approved but date was expired - - + $user = Auth::user(); + $product->vendor_id = $user->id; + $product->ends_at = null; + try { + foreach($data['new_img'] ?? [] as $key => $img) { + $product->images = $img; + $product->save(); + } + } catch(\Throwable $e) { + Flash::error('something went wrong'); + } if(!isset($data['productForEditing'])) { - $product->created_at = Carbon::now('Asia/Ashgabat'); $category->products()->save($product); } else { - // detach from all other categories $product->categories()->detach(); - // attach to a new category $category->products()->save($product); } - - // go to next step - next form - $this->page['measures'] = Measure::all(); - $this->page['paymentTerms'] = Term::where('type','payment')->get(); - $this->page['deliveryTerms'] = Term::where('type','delivery')->get(); - $this->page['currencies'] = Currency::all(); - $this->page['product'] = $product; - - return [ - '#form-steps' => $this->renderPartial('@second_step_form') - ]; - + $product->save(); + Flash::success('Haryt goşuldy'); } // step 2 @@ -273,12 +292,10 @@ class OfferForm extends ComponentBase protected function fillProduct($data,$attachedProduct) { $attachedProduct->translateContext('tm'); - $attachedProduct->description = $data['description_tm']; // Sets a single translated attribute for a language $attachedProduct->setAttributeTranslated('description', $data['description_ru'], 'ru'); $attachedProduct->setAttributeTranslated('description', $data['description_en'], 'en'); - $attachedProduct->quantity = $data['quantity']; $attachedProduct->price = $data['price']; $attachedProduct->measure_id = $data['measure_id']; @@ -289,17 +306,16 @@ class OfferForm extends ComponentBase $attachedProduct->currency_id = $data['currency_id']; // $attachedProduct->ends_at = $data['ends_at']; $attachedProduct->save(); - return $attachedProduct; } public function onRun() { - $this->countries = Country::all(); - $this->categories = Category::select('id','name','status')->where('status',1)->get(); - + $this->categories = Category::where('status',1)->where('primary_key', '=', 0)->get(); + $this->subcategories = Category::where('primary_key','>', 0)->get(); + $this->states = City::where('primary_key','=', 0)->get(); + $this->cities = City::where('primary_key','>', 0)->get(); $this->productIdOption = $this->property('productId'); - // form will be filled with product's info if we have productIdOption if($this->productIdOption) { $this->productForEditing = Product::find($this->productIdOption); if($this->productForEditing->status == 'new' || ($this->productForEditing->status == 'approved' && $this->productForEditing->ends_at >= \Carbon\Carbon::now())) { diff --git a/plugins/tps/birzha/components/Offers.php b/plugins/tps/birzha/components/Offers.php index aba3324..189aff6 100644 --- a/plugins/tps/birzha/components/Offers.php +++ b/plugins/tps/birzha/components/Offers.php @@ -1,9 +1,9 @@ 'string', 'default' => '' ], + 'vendor_id' => [ + 'title' => 'Select by vendor :id', + 'description' => 'Select by vendor', + 'type' => 'string', + 'default' => '' + ], 'perPage' => [ 'title' => 'Number of offers', 'description' => 'How many offers do you want to display', - 'default' => 0, + 'default' => 1, 'validationPattern' => '^[0-9]+$', 'validationMessage' => 'Only numbers allowed' ], @@ -68,11 +78,33 @@ class Offers extends ComponentBase public function onRun() { $this->offers = $this->loadOffers(); + $this->category = $this->getCategory(); + $this->categories = $this->getCategories(); + $this->cities = $this->getCities(); + } + + protected function getCategory(){ + $cSlug = $this->property('categorySlug'); + $category = Category::transWhere('slug', $cSlug, Session::get('rainlab.translate.locale'))->first(); + return $category; + } + + protected function getCategories(){ + $categories = Category::all(); + return $categories; + } + + protected function getCities(){ + $cities = City::all(); + return $cities; + } + + protected function filterOffers(){ + return "filterOffers"; } protected function loadOffers() { $sortOrderParam = strtolower(\Input::get('sort_order')); - // protect from sql injection if($sortOrderParam != 'asc' && $sortOrderParam != 'desc') { $sortOrder = $this->property('sortOrder'); @@ -82,52 +114,40 @@ class Offers extends ComponentBase } $cSlug = $this->property('categorySlug'); + $vendorId = $this->property('vendor_id'); $perPage = $this->property('perPage'); $productSlug = $this->property('productSlug'); $offerId = $this->property('offerId'); $query = Product::where('status', 'approved') - // ->where('ends_at','>=',\Carbon\Carbon::now()) ->orderBy('ends_at', $sortOrder); - if($cSlug != '') { //fetch offers by the category of the product + if($cSlug != '') { $category = Category::transWhere('slug', $cSlug, Session::get('rainlab.translate.locale'))->first(); if($category) { - // $offersIds = array(); - $query = $category->products() ->where('status','approved') - // ->where('ends_at','>=',\Carbon\Carbon::now()) - ->orderBy('updated_at', $sortOrder); //categories have many products - - // foreach($productsOfOneCategory as $p) { - // foreach($p->offers as $of) { //but only one product can have many offers and one offer can have just one product - // $offersIds[] = $of->id; - // } - // } - // $query = Offer::whereIn('id',$offersIds)->where('status','approved')->where('ends_at','>=',\Carbon\Carbon::now())->orderBy('created_at', $sortOrder)->paginate($perPage); - } else { - $query = null; - } - } - - if($productSlug != '' && $offerId != '') { // fetch offers with similar products - $product = Product::transWhere('slug', $productSlug, Session::get('rainlab.translate.locale'))->first(); - if($product) { - $category = $product->categories->first(); - - $query = $category->products() - ->where('id','!=',$offerId) - ->where('status','approved') - // ->where('ends_at','>=',\Carbon\Carbon::now()) ->orderBy('updated_at', $sortOrder); } else { $query = null; } } + if($productSlug != '' && $offerId != '') { // fetch offers with similar products + $product = Product::transWhere('slug', $productSlug, Session::get('rainlab.translate.locale'))->first(); + if($product) { + $category = $product->categories->first(); + $query = $category->products() + ->where('id','!=',$offerId) + ->where('status','approved') + ->orderBy('updated_at', $sortOrder); + } else { + $query = null; + } + } + if($vendorId != '') { + $query = Product::where('vendor_id', $vendorId)->where('status', 'approved')->orderBy('updated_at', $sortOrder); + } return $query ? $query->paginate($perPage) : null; } - - public $offers; } diff --git a/plugins/tps/birzha/components/SearchOffers.php b/plugins/tps/birzha/components/SearchOffers.php new file mode 100644 index 0000000..5e03cb9 --- /dev/null +++ b/plugins/tps/birzha/components/SearchOffers.php @@ -0,0 +1,92 @@ + 'Search offers List', + 'description' => 'List of searched offers' + ]; + } + + 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() { + $allParams = \Input::all(); + + $params = ''; + + foreach ($allParams as $key => $item) { + if($key != 'page'){ + $params .= '&'.$key.'='.$item; + } + } + + $this->keyword = \Input::get('name'); + $this->params = $params; + $this->products = $this->loadProducts(); + } + + protected function loadProducts() { + $perPage = $this->property('perPage'); + $sort = \Input::get('sort'); + $products = Product::query(); + $title = \Input::get('name'); + + if (isset($sort) && $sort != '') { + $sort = self::getSort($sort); + $products = $products->where('name', 'like', '%'.$title.'%')->withCount("images")->orderBy( $sort[0], $sort[1]); + }else{ + $products = $products->where('name', 'like', '%'.$title.'%')->withCount("images"); + } + + $products = $products->paginate($perPage); + return $products; + } + + private static function getSort($sort): array + { + $sort_key = trim($sort, '-'); + + if (str_contains($sort, '-') && strpos($sort, '-') == 0) { + $sort_direction = 'desc'; + } + + return [ + $sort_key, + $sort_direction ?? 'asc' + ]; + } + + + + + +} diff --git a/plugins/tps/birzha/components/Singleoffer.php b/plugins/tps/birzha/components/Singleoffer.php index faa21fd..d5fda57 100644 --- a/plugins/tps/birzha/components/Singleoffer.php +++ b/plugins/tps/birzha/components/Singleoffer.php @@ -35,20 +35,16 @@ class Singleoffer extends ComponentBase $this->offer = $this->loadOffer(); } + + protected function loadOffer() { - - $product = Product::find($this->property('offerId')); - - if($product && $product->status == 'approved' /*&& $product->ends_at >= \Carbon\Carbon::now()*/) { - - // todo increment number of views + $product = Product::withCount("comments")->find($this->property('offerId')); + if($product && $product->status == 'approved') { $product->number_of_views = $product->number_of_views + 1; $product->save(); - return $product; } return null; } - public $offer; } \ No newline at end of file diff --git a/plugins/tps/birzha/components/UserOffers.php b/plugins/tps/birzha/components/UserOffers.php new file mode 100644 index 0000000..0c84658 --- /dev/null +++ b/plugins/tps/birzha/components/UserOffers.php @@ -0,0 +1,128 @@ + 'User offers List', + 'description' => 'List of users offers' + ]; + } + + 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' + ], + 'slug' => [ + 'title' => 'Select by category :slug', + 'description' => 'Select by category', + 'type' => 'string', + 'default' => '' + ], + 'id' => [ + 'title' => 'Select by vendor :id', + 'description' => 'Select by vendor', + 'type' => 'string', + 'default' => '' + ], + ]; + } + + + + public function onRun() { + $allParams = \Input::all(); + + $params = ''; + + foreach ($allParams as $key => $item) { + if($key != 'page'){ + $params .= '&'.$key.'='.$item; + } + } + + $this->params = $params; + $this->userCategories = $this->loadCategories(); + $this->user = $this->loadUser(); + $this->userProducts = $this->loadProducts(); + } + + protected function loadProducts() { + + $perPage = $this->property('perPage'); + $sort = \Input::get('sort'); + $vendor_id = $this->property('id'); + $categorySlug = $this->property('slug'); + + $category = Category::where('slug', $categorySlug)->first(); + $products = Product::query(); + + if($category){ + if (isset($sort) && $sort != '') { + $sort = self::getSort($sort); + $products = $category->products()->where('vendor_id', $vendor_id)->withCount("images")->orderBy( $sort[0], $sort[1]); + }else{ + $products = $category->products()->where('vendor_id', $vendor_id)->withCount("images"); + } + }else{ + if (isset($sort) && $sort != '') { + $sort = self::getSort($sort); + $products = $products->where("vendor_id", $vendor_id)->withCount("images")->orderBy( $sort[0], $sort[1]); + } + } + $products = $products->paginate($perPage); + return $products; + } + + private static function getSort($sort): array + { + // dd($sort); + $sort_key = trim($sort, '-'); + + if (str_contains($sort, '-') && strpos($sort, '-') == 0) { + $sort_direction = 'desc'; + } + + return [ + $sort_key, + $sort_direction ?? 'asc' + ]; + } + + protected function loadCategories(){ + $user = User::find($this->property('id')); + $categories = $user->categories()->get(); + return $categories; + } + + protected function loadUser(){ + $user = User::find($this->property('id')); + return $user; + } + + + + +} diff --git a/plugins/tps/birzha/components/contactform/default.htm b/plugins/tps/birzha/components/contactform/default.htm index 4c05c28..7e88cce 100644 --- a/plugins/tps/birzha/components/contactform/default.htm +++ b/plugins/tps/birzha/components/contactform/default.htm @@ -1,108 +1,58 @@ - -
-
-
-
-
-
- {{'page.contact_us'|_}} -
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
- -
-
-
-
- {{'footer.contacts'|_}} -
-
-
-
- -
-
-
- {{'footer.tel'|_}}: -
-
- {{ phone }} -
-
- {{ phone_2 }} -
-
- {{ phone_3 }} -
-
-
-
-
- -
- -
-
-
- -
-
-
- {{'footer.address'|_}}: -
-
- {{ address|raw }} -
-
-
-
-
-
-
- + +
+
+
+
+
Habarlaşmak
+
-
- \ No newline at end of file + + + + +
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/plugins/tps/birzha/components/contactform/default_old.htm b/plugins/tps/birzha/components/contactform/default_old.htm new file mode 100644 index 0000000..17eee64 --- /dev/null +++ b/plugins/tps/birzha/components/contactform/default_old.htm @@ -0,0 +1,105 @@ + +
+
+
+
+
+
+ {{'page.contact_us'|_}} +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ +
+
+
+
+ {{'footer.contacts'|_}} +
+
+
+
+ +
+
+
+ {{'footer.tel'|_}}: +
+
+ {{ phone }} +
+
+ {{ phone_2 }} +
+
+ {{ phone_3 }} +
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+ {{'footer.address'|_}}: +
+
+ {{ address|raw }} +
+
+
+
+
+
+
+ +
+
+
+
+ \ No newline at end of file diff --git a/plugins/tps/birzha/components/contactform/message_sent.htm b/plugins/tps/birzha/components/contactform/message_sent.htm index 147cb83..b568318 100644 --- a/plugins/tps/birzha/components/contactform/message_sent.htm +++ b/plugins/tps/birzha/components/contactform/message_sent.htm @@ -1,17 +1,3 @@ -
-
-
- -
- {{'page.message_sent'|_}} -
- - - -
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/plugins/tps/birzha/components/filteredProducts/default.htm b/plugins/tps/birzha/components/filteredProducts/default.htm new file mode 100644 index 0000000..467a419 --- /dev/null +++ b/plugins/tps/birzha/components/filteredProducts/default.htm @@ -0,0 +1,256 @@ +{% set products = __SELF__.products %} +{% set category = __SELF__.category %} +{% set categories = __SELF__.categories %} +{% set cities = __SELF__.cities %} +{% set params = __SELF__.params %} + + +
+
+
+
+
Harytlar
+ +
+
+
+
+ + +
+
+
+
+
+
+ {% if category.subs|length > 0 %} +
+
Sub kategoriýalar
+
+ +
+
+ {% endif %} + +
+
Şäherler
+
+ +
+
+ + +
+
Baha
+
+
+ +
+
+ +
+
+ + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+
+
+
+
+ +
+
+ +
+ {% for product in products %} + + + + {% endfor %} +
+
+ {% for product in products %} + +
+
+
+ + {{ product.name }} + {{ product.name }} + +
+ +
+
+ + +
+ + + + +

+ {{ product.name }} +
{{ product.price }} TMT
+
+
+
+ {% endfor %} + +
+
+ + {% if products.hasPages %} +
+ +
+ {% endif %} +
+
+
+
+ +{% put scripts %} + +{% endput %} diff --git a/plugins/tps/birzha/components/myoffers/default.htm b/plugins/tps/birzha/components/myoffers/default.htm index 3c2af32..ba538b5 100644 --- a/plugins/tps/birzha/components/myoffers/default.htm +++ b/plugins/tps/birzha/components/myoffers/default.htm @@ -1,234 +1,59 @@ -{% set offers = __SELF__.offers %} -{% set deleteConfirm = __SELF__.wantToDelete %} - - -{% flash success %} -

- {{ message }} -

-{% endflash %} - - -
-
-
-
-
- {{'auth.my_announces'|_}} -
- +{% set products = __SELF__.offers %} + +
+
+
+
+
Harytlarym
+
- - {% if offers is empty %} -
-
-
- logo -
-
- {{'auth.no_my_announces'|_}} -
-
-
- - {% endif %} - - -
- {% for offer in offers %} -
4 %} - {% if loop.index - 3 < 10 %} - data-wow-delay=".{{ loop.index - 3 }}s" - {% else %} - data-wow-delay="{{ (loop.index - 3) / 10 }}s" - {% endif %} - {% else %} - {% if loop.index < 10 %} - data-wow-delay=".{{ loop.index }}s" - {% else %} - data-wow-delay="{{ loop.index / 10 }}s" - {% endif %} - {% endif %} - > -
-
- {{ 'page.prod_id'|_ }} №: -
-
- № {{offer.id}} -
-
-
- № {{offer.id}} -
-
- {% if offer.images[0] %} - - {% else %} - - {% endif %} -
-
-
- {{ offer.name }} -
-
- {{ offer.description }} -
-
-
-
- {{ 'page.prod_amount'|_ }}: -
-
- {{ offer.quantity }} {{ offer.measure.code }}. -
-
-
-
- {{ 'page.prod_price'|_ }}: -
-
- {{ offer.price }} {{offer.currency.code}} / 1 {{ offer.measure.code }}. -
-
-
-
- {{ 'page.prod_finishdate'|_ }}: -
-
- {{ offer.ends_at ? offer.ends_at|date('d.m.Y') : '' }} -
-
- - - {% if offer.status == "approved" and offer.ends_at >= __SELF__.today %} - {{ 'status_approved'|_ }} - - {% elseif offer.status == "approved" and offer.ends_at < __SELF__.today %} - {{ 'status_expired'|_ }} - - - {% elseif offer.status == "denied" %} - {{ 'status_denied'|_ }}
- {{ offer.status_note }} - - {% elseif offer.status == "draft" %} - {{ 'status_draft'|_ }} - - {% elseif offer.status == "new" %} - {{ 'status_new'|_ }} - - {{'account.admin_checking'|_}} - - {% endif %} -
- {% endfor %} -
- - {% if offers.total > offers.perPage %} - -
- - - -
- -
- - - -
- {{ (offers.total / offers.perPage)|round(0,'ceil') }} {{ 'page.pages'|_ }} -
-
- - {% endif %} -
-
- + + - + {% for product in products %} + + + Product + + + {{ product.name }} + + {{ product.price }} TMT + + + {% endfor %} + + + + + + + + \ No newline at end of file diff --git a/plugins/tps/birzha/components/myoffers/default2.htm b/plugins/tps/birzha/components/myoffers/default2.htm new file mode 100644 index 0000000..a46f4dd --- /dev/null +++ b/plugins/tps/birzha/components/myoffers/default2.htm @@ -0,0 +1,230 @@ +{% set offers = __SELF__.offers %} +{% set deleteConfirm = __SELF__.wantToDelete %} + + +{% flash success %} +

+ {{ message }} +

+{% endflash %} + + +
+
+
+
+
+ {{'auth.my_announces'|_}} +
+ +
+ + {% if offers is empty %} +
+
+
+ logo +
+
+ {{'auth.no_my_announces'|_}} +
+
+
+ + {% endif %} + + +
+ {% for offer in offers %} +
4 %} + {% if loop.index - 3 < 10 %} + data-wow-delay=".{{ loop.index - 3 }}s" + {% else %} + data-wow-delay="{{ (loop.index - 3) / 10 }}s" + {% endif %} + {% else %} + {% if loop.index < 10 %} + data-wow-delay=".{{ loop.index }}s" + {% else %} + data-wow-delay="{{ loop.index / 10 }}s" + {% endif %} + {% endif %} + > +
+
+ {{ 'page.prod_id'|_ }} №: +
+
+ № {{offer.id}} +
+
+
+ № {{offer.id}} +
+
+ {% if offer.images[0] %} + + {% else %} + + {% endif %} +
+
+
+ {{ offer.name }} +
+
+ {{ offer.description }} +
+
+
+
+ {{ 'page.prod_amount'|_ }}: +
+
+ {{ offer.quantity }} {{ offer.measure.code }}. +
+
+
+
+ {{ 'page.prod_price'|_ }}: +
+
+ {{ offer.price }} {{offer.currency.code}} / 1 {{ offer.measure.code }}. +
+
+
+
+ {{ 'page.prod_finishdate'|_ }}: +
+
+ {{ offer.ends_at ? offer.ends_at|date('d.m.Y') : '' }} +
+
+ + + {% if offer.status == "approved" and offer.ends_at >= __SELF__.today %} + {{ 'status_approved'|_ }} + + {% elseif offer.status == "approved" and offer.ends_at < __SELF__.today %} + {{ 'status_expired'|_ }} + + + {% elseif offer.status == "denied" %} + {{ 'status_denied'|_ }}
+ {{ offer.status_note }} + + {% elseif offer.status == "draft" %} + {{ 'status_draft'|_ }} + + {% elseif offer.status == "new" %} + {{ 'status_new'|_ }} + + {{'account.admin_checking'|_}} + + {% endif %} +
+ {% endfor %} +
+ + {% if offers.total > offers.perPage %} + +
+ + + +
+ +
+ + + +
+ {{ (offers.total / offers.perPage)|round(0,'ceil') }} {{ 'page.pages'|_ }} +
+
+ + {% endif %} + +
+
+
+ + + diff --git a/plugins/tps/birzha/components/offerform/default.htm b/plugins/tps/birzha/components/offerform/default.htm index 038a2a9..f711bfe 100644 --- a/plugins/tps/birzha/components/offerform/default.htm +++ b/plugins/tps/birzha/components/offerform/default.htm @@ -1,147 +1,135 @@ {% set categories = __SELF__.categories %} -{% set countries = __SELF__.countries %} -{% set productForEditing = __SELF__.productForEditing %} +{% set subcategories = __SELF__.subcategories %} +{% set states = __SELF__.states %} +{% set cities = __SELF__.cities %} +{% set productIdOption = __SELF__.productIdOption %} - -
-
- {% if user.is_activated %} -
-
- {{'account.add_post'|_({ step_number: 1 })}} {{productForEditing.name}} -
-
- {% if productForEditing %} - - {% endif %} - - -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- -
- - -
-
- -
- - - -
- -
- -
- - -
-
- -
- -
- -
- {{'account.required_fields'|_}} -
- -
- -
- {% else %} -
-
- {{'account.activation_required'|_}} + +
+
+
+
+
Haryt goşmak üýtgetmek
+
- {% endif %}
-
- + + + +
+
+
+
+ +
+
+
+
+{% put scripts %} + +{% endput %} \ No newline at end of file diff --git a/plugins/tps/birzha/components/offerform/default2.htm b/plugins/tps/birzha/components/offerform/default2.htm new file mode 100644 index 0000000..b86cdab --- /dev/null +++ b/plugins/tps/birzha/components/offerform/default2.htm @@ -0,0 +1,149 @@ + +{% set categories = __SELF__.categories %} +{% set subcategories = __SELF__.subcategories %} +{% set states = __SELF__.states %} +{% set cities = __SELF__.cities %} +{% set productIdOption = __SELF__.productIdOption %} + + +
+
+ {% if user.is_activated %} +
+
+ {{'account.add_post'|_({ step_number: 1 })}} {{productForEditing.name}} +
+ +
+ + {% if productForEditing %} + + {% endif %} + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ +
+ + +
+
+ +
+ + + +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ {{'account.required_fields'|_}} +
+ +
+ +
+ {% else %} +
+
+ {{'account.activation_required'|_}} +
+
+ {% endif %} +
+
+ + + diff --git a/plugins/tps/birzha/components/offers/default.htm b/plugins/tps/birzha/components/offers/default.htm index e0c590b..092af65 100644 --- a/plugins/tps/birzha/components/offers/default.htm +++ b/plugins/tps/birzha/components/offers/default.htm @@ -1,109 +1,249 @@ -{% set offers = __SELF__.offers %} +{% set products = __SELF__.offers %} +{% set category = __SELF__.category %} +{% set categories = __SELF__.categories %} +{% set cities = __SELF__.cities %} -
- {% for offer in offers %} -
+