diff --git a/plugins/romanah/bagisto/components/Session.php b/plugins/romanah/bagisto/components/Session.php index c5295e5..92fea25 100644 --- a/plugins/romanah/bagisto/components/Session.php +++ b/plugins/romanah/bagisto/components/Session.php @@ -57,7 +57,7 @@ class Session extends ComponentBase $dataInput = post(); - $response = Http::post('http://nurgul.com.tm/app/api/customer/cart/add/'.$dataInput["product_id"], function ($http) use($getToken, $dataInput) { + $response = Http::post('https://nurgul.com.tm/app/api/customer/cart/add/'.$dataInput["product_id"], function ($http) use($getToken, $dataInput) { // $http->header('Content-Type', 'application/json'); $http->header('Authorization', 'Bearer '.$getToken); $http->header('Accept', 'application/json'); @@ -87,7 +87,7 @@ class Session extends ComponentBase { $getToken = SessionP::get('nurgulToken'); - $response = Http::get('http://nurgul.com.tm/app/api/customer/cart', function ($http) use($getToken) { + $response = Http::get('https://nurgul.com.tm/app/api/customer/cart', function ($http) use($getToken) { $http->header('Authorization', 'Bearer '.$getToken); }); @@ -102,7 +102,7 @@ class Session extends ComponentBase $getToken = SessionP::get('nurgulToken'); $dataInput = post(); - $response = Http::delete('http://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) { + $response = Http::delete('https://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) { $http->header('Authorization', 'Bearer '.$getToken); }); @@ -117,7 +117,7 @@ class Session extends ComponentBase $getToken = SessionP::get('nurgulToken'); $dataInput = post(); - $response = Http::delete('http://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) { + $response = Http::delete('https://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) { $http->header('Authorization', 'Bearer '.$getToken); }); @@ -129,6 +129,167 @@ class Session extends ComponentBase } } + function onGetAddress() + { + $getToken = SessionP::get('nurgulToken'); + + $response = Http::get('https://nurgul.com.tm/app/api/customer/addresses', function ($http) use($getToken) { + $http->header('Authorization', 'Bearer '.$getToken); + }); + + $dataqq = json_decode($response); + + return $dataqq; + } + + function onAddAddress() + { + $getToken = SessionP::get('nurgulToken'); + $dataInput = post(); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/addresses', function ($http) use($getToken, $dataInput) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + // $data = $dataProd; + $data = [ + $http->data("locale", 'tm'), + $http->data("address1", [$dataInput["new_addr"]]), + $http->data("city", 'Ashgabat'), + ]; + + $http->setOption(CURLOPT_POSTFIELDS, json_encode($data)); + }); + + $dataqq = json_decode($response); + + if (!empty($dataqq)) { + Flash::success("Üstünlikli Salgy Goşuldy"); + return redirect()->refresh(); + } elseif (empty($dataqq)) { + Flash::error('Ýalňyşlyk Ýüze Çykdy!!!'); + return redirect()->refresh(); + } + } + + + function onSaveShipping() + { + $getToken = SessionP::get('nurgulToken'); + $dataInput = post(); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/checkout/save-shipping', function ($http) use($getToken, $dataInput) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + // $data = $dataProd; + $data = [ + $http->data("billing", ["address1" => [$dataInput["selected_address"]]]), + $http->data("shipping", ["address1" => [$dataInput["selected_address"]]]), + $http->data("shipping_method", 'courier_courier'), + ]; + + + $http->setOption(CURLOPT_POSTFIELDS, json_encode($data)); + }); + + $dataqq = json_decode($response); + + return $dataqq; + } + + function onSavePayment() + { + $getToken = SessionP::get('nurgulToken'); + $dataInput = post(); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/checkout/save-payment', function ($http) use($getToken, $dataInput) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + // $data = $dataProd; + $data = [ + $http->data("payment", ["method" => $dataInput["payment"]]), + ]; + + $http->setOption(CURLOPT_POSTFIELDS, json_encode($data)); + }); + + $dataqq = json_decode($response); + + return $dataqq; + } + + + function onSaveOrder() + { + $getToken = SessionP::get('nurgulToken'); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/checkout/save-order', function ($http) use($getToken) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + + $http->setOption(CURLOPT_POSTFIELDS); + }); + + $dataqq = json_decode($response); + + if (!empty($dataqq)) { + Flash::success("Sargydyňyz Üstünlikli Amala Aşyryldy"); + return Redirect::to('/'); + } elseif (empty($dataqq)) { + Flash::error('Ýalňyşlyk Ýüze Çykdy!!!'); + return redirect()->refresh(); + } + } + + + function onSaveWishlist() + { + $getToken = SessionP::get('nurgulToken'); + $dataInput = post(); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/wishlist/'.$dataInput["product_id"], function ($http) use($getToken, $dataInput) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + $http->setOption(CURLOPT_POSTFIELDS); + }); + + $dataqq = json_decode($response); + + if (!empty($dataqq)) { + Flash::success("Halanlaryma Üstünlikli Goşuldy"); + return Redirect::to('/wishlist'); + } elseif (empty($dataqq)) { + Flash::error('Ýalňyşlyk Ýüze Çykdy!!!'); + return redirect()->refresh(); + } + } + + function onGetWish() + { + $getToken = SessionP::get('nurgulToken'); + + $response = Http::get('https://nurgul.com.tm/app/api/customer/wishlist', function ($http) use($getToken) { + $http->header('Authorization', 'Bearer '.$getToken); + }); + + $dataqq = json_decode($response); + + return $dataqq; + } } diff --git a/themes/nurgul/pages/cart.htm b/themes/nurgul/pages/cart.htm index 5fab831..6eb0428 100755 --- a/themes/nurgul/pages/cart.htm +++ b/themes/nurgul/pages/cart.htm @@ -1,6 +1,6 @@ -title = "Cart" url = "/cart" layout = "mainN" +title = "Cart" == {%partial "bread" title='cart.title'|_ %} @@ -51,7 +51,7 @@ layout = "mainN"
- {{'cart.checkout.title'|_}} + {{'cart.checkout.title'|_}}
@@ -59,4 +59,4 @@ layout = "mainN" - + \ No newline at end of file diff --git a/themes/nurgul/pages/category.htm b/themes/nurgul/pages/category.htm index af5dbf0..202e3a2 100755 --- a/themes/nurgul/pages/category.htm +++ b/themes/nurgul/pages/category.htm @@ -72,7 +72,7 @@ function onStart(){ - {% partial 'product/tab-pane' %} + {% partial 'product/tab-pane' id='cat' %} diff --git a/themes/nurgul/pages/checkout.htm b/themes/nurgul/pages/checkout.htm new file mode 100755 index 0000000..e061d07 --- /dev/null +++ b/themes/nurgul/pages/checkout.htm @@ -0,0 +1,179 @@ +title = "Checkout" +url = "/checkout" +layout = "mainN" +== +{%partial "bread" title='checkout.title'|_ %} +
+
+
+
+
+
+
{{'checkout.select.addr'|_}} {{'checkout.new.addr'|_}}
+ +
+
+ +
+ +
+ + +
+ +
+
+
{{'checkout.select.payment.type'|_}}
+
+ +
+
+
+
+

{{'checkout.cart.total'|_}}

+ + + + + + + + + + + + +
{{'checkout.order.total'|_}}0.00 TMT
+
+
+
+ + +
+ +
+ +
+
+
+
+
+ +{% if nurgulToken != "" %} +{% put scripts %} + +{% endput %} +{% endif %} diff --git a/themes/nurgul/pages/productdetail.htm b/themes/nurgul/pages/productdetail.htm index 87f588f..6f2ecf4 100755 --- a/themes/nurgul/pages/productdetail.htm +++ b/themes/nurgul/pages/productdetail.htm @@ -87,24 +87,15 @@ function onStart(){ diff --git a/themes/nurgul/pages/wishlist.htm b/themes/nurgul/pages/wishlist.htm new file mode 100755 index 0000000..49d4594 --- /dev/null +++ b/themes/nurgul/pages/wishlist.htm @@ -0,0 +1,61 @@ +title = "wishlist" +url = "/wishlist" +layout = "mainN" +== + +{%partial "bread" title='wishlist.title'|_ %} + +{% partial 'loader/loader' id='loader_wish' %} + +
+
+
+
+
+
+
    +
  • +
    + +
    +
  • +
  • + +
    + +
    +
  • +
+
+
+
+
+
+ +
+
+
+ + {% partial 'product/tab-pane' id='wish' %} +
+
+
+ + {% partial 'helper/pagination' %} + +
+
+
+{% partial 'scripts/getWishlist' add='add.cart'|_ id='wish' %} diff --git a/themes/nurgul/partials/cart.htm b/themes/nurgul/partials/cart.htm index 6907273..db2c8f6 100755 --- a/themes/nurgul/partials/cart.htm +++ b/themes/nurgul/partials/cart.htm @@ -16,11 +16,11 @@
{{'cart.view.title'|_}} - {{'cart.checkout.title'|_}} + {{'cart.checkout.title'|_}}
- + \ No newline at end of file diff --git a/themes/nurgul/partials/modals.htm b/themes/nurgul/partials/modals.htm index bfdef67..703dd7c 100755 --- a/themes/nurgul/partials/modals.htm +++ b/themes/nurgul/partials/modals.htm @@ -58,12 +58,8 @@ -
  • - - - +
  • diff --git a/themes/nurgul/partials/product/tab-pane.htm b/themes/nurgul/partials/product/tab-pane.htm index 476b2ca..5d8a653 100755 --- a/themes/nurgul/partials/product/tab-pane.htm +++ b/themes/nurgul/partials/product/tab-pane.htm @@ -1,6 +1,6 @@
    -
    +
    diff --git a/themes/nurgul/partials/scripts/getWishlist.htm b/themes/nurgul/partials/scripts/getWishlist.htm new file mode 100755 index 0000000..124948a --- /dev/null +++ b/themes/nurgul/partials/scripts/getWishlist.htm @@ -0,0 +1,48 @@ +{% put scripts %} + + +{% endput %} + +{%partial 'scripts/setModal' %} +{%partial 'scripts/prodCard' %} diff --git a/themes/nurgul/partials/scripts/prodCard.htm b/themes/nurgul/partials/scripts/prodCard.htm index 37c9299..6d6ca7d 100755 --- a/themes/nurgul/partials/scripts/prodCard.htm +++ b/themes/nurgul/partials/scripts/prodCard.htm @@ -48,9 +48,8 @@
  • - - + +
  • @@ -147,7 +146,7 @@
  • `+ - "" + + `` + `
  • diff --git a/themes/nurgul/partials/scripts/productDetail.htm b/themes/nurgul/partials/scripts/productDetail.htm index 6b09f7f..fc685da 100755 --- a/themes/nurgul/partials/scripts/productDetail.htm +++ b/themes/nurgul/partials/scripts/productDetail.htm @@ -69,6 +69,20 @@ $('#product_price').html(product.formatted_price); $('#product_desc_short').html(product.short_description); $('#product_desc').html(product.description); + $('#detail_add_cart').html( + ` + + ` + ); + $('#detail_wishlist').html( + ` + + ` + ); $('#product_add').html(`{{ 'add.cart'|_ }}`); if (product.hasOwnProperty('special_price')) { diff --git a/themes/nurgul/partials/scripts/setModal.htm b/themes/nurgul/partials/scripts/setModal.htm index 6465580..e72b3e5 100755 --- a/themes/nurgul/partials/scripts/setModal.htm +++ b/themes/nurgul/partials/scripts/setModal.htm @@ -10,13 +10,21 @@ $('#modal_desc').html(product.description); $('#modal_add_btn').html(` - {{add}} `); + + $('#modal_wish').html(` + + + + `); if (product.hasOwnProperty('special_price')) { $('#modal_discount').show(); $('#modal_discount').html(product.formatted_regular_price);