-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved template from shopping cart to the theme for customizations
- Loading branch information
1 parent
a643f41
commit ff76103
Showing
1 changed file
with
161 additions
and
0 deletions.
There are no files selected for viewing
161 changes: 161 additions & 0 deletions
161
templates/local_shopping_cart/shopping_cart_popover.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
{{! | ||
This file is part of Moodle - http://moodle.org/ | ||
Moodle is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Moodle is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
}} | ||
{{! | ||
@template local_shopping_cart/shopping_cart_popover | ||
This template will render the shopping_cart popover for the navigation bar. | ||
Classes required for JS: | ||
* none | ||
Data attributes required for JS: | ||
* All data attributes are required | ||
Context variables required for this template: | ||
* userid the logged in user id | ||
* urls The URLs for the popover | ||
Example context (json): | ||
{ | ||
"count":1, | ||
"maxitems":"10", | ||
"items":[ | ||
{ | ||
"id":"2", | ||
"userid":"2309", | ||
"itemid":"1", | ||
"itemname":"my test item 1", | ||
"price":"10.00", | ||
"discount":"0.00", | ||
"currency":"EUR", | ||
"componentname":"local_shopping_cart", | ||
"area": "main", | ||
"identifier":"1668028796", | ||
"payment":"3", | ||
"paymentstatus":"2", | ||
"usermodified":"2", | ||
"timecreated":"1668028796", | ||
"timemodified":"1668028796", | ||
"canceluntil":"1669238377", | ||
"serviceperiodstart":"0", | ||
"serviceperiodend":"0", | ||
"gateway":null, | ||
"date":"2022-11-09", | ||
"canceled":false, | ||
"canceluntilstring":"2022-11-23", | ||
"canceluntilalert":"Stornieren ist nicht m\u00f6glich.", | ||
"buttonclass":"disabled hidden", | ||
"paymentstring":"in bar an der Kassa" | ||
} | ||
], | ||
"price":0, | ||
"initialtotal":0, | ||
"deductible":0, | ||
"checkboxid":"af7a6b", | ||
"usecredit":1, | ||
"expirationtime":1667988637, | ||
"nowdate":1667988637, | ||
"checkouturl":"http:\/\/localhost\/400_moodle\/local\/shopping_cart\/checkout.php", | ||
"currency":"EUR", | ||
"credit":0, | ||
"remainingcredit":0, | ||
"buyforuserid":3588, | ||
"userid":3588, | ||
"userlastname":"Faulkner", | ||
"userfirstname":"Graiden", | ||
"useremail":"Graiden.Faulkner@mailinator.com", | ||
"historyitems":[ | ||
{ | ||
"id":"2", | ||
"userid":"2309", | ||
"itemid":"1", | ||
"itemname":"my test item 1", | ||
"price":"10.00", | ||
"discount":"0.00", | ||
"currency":"EUR", | ||
"componentname":"local_shopping_cart", | ||
"area": "main", | ||
"identifier":"1668028796", | ||
"payment":"3", | ||
"paymentstatus":"2", | ||
"usermodified":"2", | ||
"timecreated":"1668028796", | ||
"timemodified":"1668028796", | ||
"canceluntil":"1669238377", | ||
"serviceperiodstart":"0", | ||
"serviceperiodend":"0", | ||
"gateway":null, | ||
"date":"2022-11-09", | ||
"canceled":false, | ||
"canceluntilstring":"2022-11-23", | ||
"canceluntilalert":"Stornieren ist nicht m\u00f6glich.", | ||
"buttonclass":"disabled hidden", | ||
"paymentstring":"in bar an der Kassa" | ||
} | ||
], | ||
"canpayback":true, | ||
"additonalcashiersection":"<div class=\"text_to_html\">..<\/div>", | ||
"wwwroot":"http:\/\/localhost\/400_moodle", | ||
"users":"[\"Caldwell Illana (Illana.Caldwell@mailinator.com) vatnr:512\",\"Ferguson Desirae (Desirae.Ferguson@mailinator.com) vatnr:768\",\"Lindsey Rose (Rose.Lindsey@example.com) vatnr:1024\",\"Oneil Octavius (Octavius.Oneil@example.com) vatnr:1280\",\"Franklin Francis (Francis.Franklin@example.com) vatnr:1536\"]", | ||
"mail":"Graiden.Faulkner@mailinator.com", | ||
"name":"Graiden Faulkner" | ||
} | ||
|
||
}} | ||
|
||
{{< core/popover_region }} | ||
{{$classes}}popover-region-shopping_carts{{/classes}} | ||
{{$attributes}}id="nav-shopping_cart-popover-container" data-userid="{{userid}}"{{/attributes}} | ||
|
||
{{$togglelabel}}{{/togglelabel}} | ||
{{$togglecontent}} | ||
<i class="fa fa-shopping-cart" title="Shopping cart menu" aria-name="Shopping cart menu"></i> | ||
<div id="itemcount" class="count-container {{^count}}hidden{{/count}}" data-region="count-container" | ||
aria-label="Count: {{count}}">{{count}}</div> | ||
{{/togglecontent}} | ||
|
||
{{$containerlabel}}{{/containerlabel}} | ||
|
||
{{$headertext}} | ||
<i class="fa fa-3x fa-shopping-cart" aria-name="Shopping cart"></i> | ||
<span class="expirationtime" data-expirationtime = '{{expirationtime}}'>[{{expirationtime}}]</span> | ||
{{/headertext}} | ||
{{$content}} | ||
<h4 class="p-2 shopping-cart-items-title text-dark">{{#str}} mycart, local_shopping_cart {{/str}} </h4> | ||
<div class="shopping-cart-items-container text-dark"> | ||
{{> local_shopping_cart/shopping_cart_items }} | ||
</div> | ||
{{> local_shopping_cart/checkout_button }} | ||
{{/content}} | ||
{{/ core/popover_region }} | ||
|
||
{{#showcashier}} | ||
<div class="nav-area-cashier"> | ||
<a id="nav-link-cashier" class="nav-link position-relative icon-no-margin" href="{{{cashierurl}}}" role="button"> | ||
<i class="icon fa fa-money fa-2x fa-fw" title="Cashier" role="img" aria-label="Go to cashiers desk"></i> | ||
</a> | ||
</div> | ||
{{/showcashier}} | ||
|
||
{{#js}} | ||
require(['core/popover_region_controller', 'core/ajax', 'local_shopping_cart/cart'], function(Сontroller, Ajax, cart) { | ||
cart.init({{expirationtime}}, {{nowdate}}); | ||
let sccontainer = document.querySelector('#nav-shopping_cart-popover-container'); | ||
let sccontroller = new Сontroller(sccontainer); | ||
sccontroller.registerListNavigationEventListeners(); | ||
}); | ||
{{/js}} |