forked from bagisto/bagisto
-
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.
Merge remote-tracking branch 'upstream/2.x' into pr/amit-webkul/7679
- Loading branch information
Showing
38 changed files
with
674 additions
and
486 deletions.
There are no files selected for viewing
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
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
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
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
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
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
16 changes: 16 additions & 0 deletions
16
packages/Webkul/Shop/src/Resources/assets/js/plugins/axios.js
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,16 @@ | ||
/** | ||
* We'll load the axios HTTP library which allows us to easily issue requests | ||
* to our Laravel back-end. This library automatically handles sending the | ||
* CSRF token as a header based on the value of the "XSRF" token cookie. | ||
*/ | ||
import axios from "axios"; | ||
window.axios = axios; | ||
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; | ||
|
||
const Axios = { | ||
install(app) { | ||
app.config.globalProperties.$axios = axios; | ||
}, | ||
}; | ||
|
||
export default Axios; |
27 changes: 27 additions & 0 deletions
27
packages/Webkul/Shop/src/Resources/assets/js/plugins/shop.js
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,27 @@ | ||
const Shop = { | ||
install(app) { | ||
app.config.globalProperties.$shop = { | ||
/** | ||
* Generates a formatted price string using the provided price, localeCode, and currencyCode. | ||
* | ||
* @param {number} price - The price value to be formatted. | ||
* @param {string} localeCode - The locale code specifying the desired formatting rules. | ||
* @param {string} currencyCode - The currency code specifying the desired currency symbol. | ||
* @returns {string} - The formatted price string. | ||
*/ | ||
formatPrice: (price, localeCode = null, currencyCode = null) => { | ||
if (! localeCode) { | ||
localeCode = document.querySelector('meta[http-equiv="content-language"]').content ?? 'en'; | ||
} | ||
|
||
if (! currencyCode) { | ||
currencyCode = document.querySelector('meta[name="currency-code"]').content ?? 'USD'; | ||
} | ||
|
||
return new Intl.NumberFormat(localeCode, { style: 'currency', currency: currencyCode }).format(price); | ||
}, | ||
}; | ||
}, | ||
}; | ||
|
||
export default Shop; |
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
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
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
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
Oops, something went wrong.