Skip to content

Commit

Permalink
Merge branch 'release/1.2.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
devAsadNur committed Dec 30, 2022
2 parents 66cd558 + 3efaef0 commit b3ef194
Show file tree
Hide file tree
Showing 23 changed files with 1,809 additions and 98 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
**Contributors:** [tareq1988](https://profiles.wordpress.org/tareq1988), [wedevs](https://profiles.wordpress.org/wedevs), [nizamuddinbabu](https://profiles.wordpress.org/nizamuddinbabu)
**Donate Link:** http://tareq.co/donate/
**Tags:** WooCommerce POS, point of sale, free pos, pos plugin, woocommerce point of sale
**Requires at least:** 4.4
**Tested up to:** 6.0.3
**WC requires at least:** 3.0
**WC tested up to:** 7.0.0
**Requires PHP:** 5.6
**Stable tag:** 1.2.5
**Requires at least:** 5.4
**Tested up to:** 6.1.1
**WC requires at least:** 5.0.0
**WC tested up to:** 7.2.2
**Requires PHP:** 7.2
**Stable tag:** 1.2.6
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -60,6 +60,12 @@ No FAQ

## Changelog ##

### v1.2.6 -> 30 December, 2022 ###
- **New:** Integrated Vue date range picker, select2 and Vue chart JS packages
- **New:** Added helper methods for getting day JS and date range picker date formats
- **New:** Added helper method for getting custom date ranges
- **Refactor:** Order created via wePOS setter

### v1.2.5 -> 02 November, 2022 ###
- **Feature:** "View POS" menu on "My Account" page
- **Enhancement:** Added all decimal separator support as per wooCommerce settings to put a discount or adding a fee from POS frontend
Expand Down
6 changes: 5 additions & 1 deletion assets/css/bootstrap.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/bootstrap.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/css/select2.min.css

Large diffs are not rendered by default.

444 changes: 438 additions & 6 deletions assets/js/bootstrap.js

Large diffs are not rendered by default.

289 changes: 284 additions & 5 deletions assets/js/bootstrap.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/js/select2.min.js

Large diffs are not rendered by default.

441 changes: 432 additions & 9 deletions assets/js/vendor.js

Large diffs are not rendered by default.

289 changes: 284 additions & 5 deletions assets/js/vendor.min.js

Large diffs are not rendered by default.

29 changes: 19 additions & 10 deletions assets/src/utils/Bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import Multiselect from 'vue-multiselect'
import Modal from './components/Modal.vue'
import Switches from './components/Switches.vue'
import "vue-multiselect/dist/vue-multiselect.min.css"
import * as VueChartJS from 'vue-chartjs'

import * as Date_Helper from './date-helper';
window.Date_Helper = Date_Helper;

import dayjs from 'dayjs';
window.dayjs = dayjs;
Expand All @@ -28,6 +32,9 @@ Vue.use(VueDatePicker, {
lang: 'en'
});

import DateRangePicker from 'vue2-daterange-picker';
import 'vue2-daterange-picker/dist/vue2-daterange-picker.css';

Vue.directive( 'tooltip', VTooltip )
Vue.directive( 'close-popover', VClosePopover )
Vue.component( 'v-popover', VPopover )
Expand Down Expand Up @@ -73,16 +80,18 @@ window.wepos_get_lib = function( lib ) {

export const EventBus = new Vue();

window.weLo_ = _;
window.wepos._ = _;
window.wepos.api = new API_Helper();
window.wepos.libs['Vue'] = Vue;
window.wepos.libs['Router'] = Router;
window.wepos.libs['Vuex'] = Vuex;
window.wepos.libs['TextEditor'] = TextEditor;
window.wepos.libs['EventBus'] = EventBus;
window.wepos.libs['Modal'] = Modal;
window.wepos.libs['Switches'] = Switches;
window.weLo_ = _;
window.wepos._ = _;
window.wepos.api = new API_Helper();
window.wepos.libs['Vue'] = Vue;
window.wepos.libs['Router'] = Router;
window.wepos.libs['Vuex'] = Vuex;
window.wepos.libs['TextEditor'] = TextEditor;
window.wepos.libs['EventBus'] = EventBus;
window.wepos.libs['Modal'] = Modal;
window.wepos.libs['Switches'] = Switches;
window.wepos.libs['DateRangePicker'] = DateRangePicker;
window.wepos.libs['VueChartJS'] = VueChartJS;

// WordPress Hooks
import { createHooks } from '@wordpress/hooks';
Expand Down
123 changes: 123 additions & 0 deletions assets/src/utils/date-helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/**
* Get DayJS supported date format.
*
* @since WEPOS_LITE_SINCE
*
* @param {string} dateFormat The date format to convert
*
* @return {string} DayJS supported date format
*/
export function wepos_get_dayjs_date_format( dateFormat = wepos.wp_date_format ) {
let formatMap = {
// Day
d: 'DD',
D: 'ddd',
j: 'D',
// Month
F: 'MMM',
m: 'MM',
M: 'MMM',
n: 'M',
// Year
Y: 'YYYY',
y: 'YY'
}

let dayJsDateFormat = '';

for ( let i = 0; i < dateFormat.length; i++ ) {
const char = dateFormat[i];

dayJsDateFormat += formatMap[char] ? formatMap[char] : char;
}

return dayJsDateFormat;
}

/**
* Get date range picker supported date format.
*
* @since WEPOS_LITE_SINCE
*
* @param {string} dateFormat The date format to convert
*
* @return {string} Date range picker supported date format
*/
export function wepos_get_daterange_picker_date_format( dateFormat = wepos.wp_date_format ) {
let formatMap = {
// Day
d: 'dd',
D: 'ddd',
j: 'd',
// Month
F: 'mmmm',
m: 'mm',
M: 'mmm',
n: 'm',
// Year
Y: 'yyyy',
y: 'yy'
}

let dateRangePickerFormat = '';

for ( let i = 0; i < dateFormat.length; i++ ) {
const char = dateFormat[i];

dateRangePickerFormat += formatMap[char] ? formatMap[char] : char;
}

return dateRangePickerFormat;
}

/**
* Get custom date ranges.
*
* @since WEPOS_LITE_SINCE
*
* @param {string} dateContext The date context
*
* @return {array} Date range
*/
export function wepos_get_custom_date_ranges( dateContext = "this year" ) {
let dateRange = [];

switch ( dateContext ) {
case "today":
dateRange["start"] = dayjs().startOf('day').toDate();
dateRange["end"] = dayjs().endOf('day').toDate();
break;

case "yesterday":
dateRange["start"] = dayjs().subtract( 1, 'days' ).startOf( 'day' ).toDate();
dateRange["end"] = dayjs().subtract( 1, 'days' ).endOf( 'day' ).toDate();
break;

case "this week":
dateRange["start"] = dayjs().startOf( 'week' ).toDate();
dateRange["end"] = dayjs().endOf( 'week' ).toDate();
break;

case "this month":
dateRange["start"] = dayjs().startOf( 'month' ).toDate();
dateRange["end"] = dayjs().endOf( 'month' ).toDate();
break;

case "this quarter":
dateRange["start"] = dayjs().startOf( 'quarter' ).toDate();
dateRange["end"] = dayjs().endOf( 'quarter' ).toDate();
break;

case "last month":
dateRange["start"] = dayjs().subtract( 1, 'months' ).startOf( 'month' ).toDate();
dateRange["end"] = dayjs().subtract( 1, 'months' ).endOf( 'month' ).toDate();
break;

case "this year":
default:
dateRange["start"] = dayjs().startOf( 'year' ).toDate();
dateRange["end"] = dayjs().endOf( 'year' ).toDate();
}

return dateRange;
}
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
],
"minimum-stability": "dev",
"require": {
"appsero/client": "dev-master",
"php": ">=7.2",
"appsero/client": "dev-develop",
"ext-json": "*"
},
"require-dev": {
Expand All @@ -30,5 +31,13 @@
"phpcbf": [
"phpcbf -p"
]
},
"config": {
"platform": {
"php": "7.2"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
57 changes: 35 additions & 22 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions includes/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ public function enqueue_scripts() {
wp_enqueue_style( 'wepos-style' );
wp_enqueue_style( 'wepos-bootstrap' );
wp_enqueue_style( 'wepos-admin' );
wp_enqueue_style( 'wepos-select2' );

wp_enqueue_script( 'wepos-tinymce-plugin' );
wp_enqueue_script( 'wepos-vendor' );
wp_enqueue_script( 'wepos-blockui' );
wp_enqueue_script( 'wepos-select2' );

wp_enqueue_script( 'wepos-bootstrap' );
do_action( 'wepos_load_admin_scripts' );
Expand Down
Loading

0 comments on commit b3ef194

Please sign in to comment.