From 82223e41de1b0aca64d84c73368e109f4ee8c1ab Mon Sep 17 00:00:00 2001 From: MHB Date: Mon, 21 Dec 2020 16:26:55 +0330 Subject: [PATCH 1/8] feat: craete tooltipButton, AutoCompleteWrapper and add v-model to Code-editor --- .../components/Inputs/AutoCompleteWrapper.vue | 36 ++++++ .../Global/components/Inputs/Code-Editor.vue | 99 +++++++++------- .../components/Inputs/TooltipButton.vue | 106 ++++++++++++++++++ .../js/Global/plugins/globalComponent.js | 19 ++-- 4 files changed, 209 insertions(+), 51 deletions(-) create mode 100644 resources/js/Global/components/Inputs/AutoCompleteWrapper.vue create mode 100644 resources/js/Global/components/Inputs/TooltipButton.vue diff --git a/resources/js/Global/components/Inputs/AutoCompleteWrapper.vue b/resources/js/Global/components/Inputs/AutoCompleteWrapper.vue new file mode 100644 index 0000000..c2a685f --- /dev/null +++ b/resources/js/Global/components/Inputs/AutoCompleteWrapper.vue @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/resources/js/Global/components/Inputs/Code-Editor.vue b/resources/js/Global/components/Inputs/Code-Editor.vue index b7fad66..f650d89 100644 --- a/resources/js/Global/components/Inputs/Code-Editor.vue +++ b/resources/js/Global/components/Inputs/Code-Editor.vue @@ -1,53 +1,70 @@ diff --git a/resources/js/Global/components/Inputs/TooltipButton.vue b/resources/js/Global/components/Inputs/TooltipButton.vue new file mode 100644 index 0000000..e373c08 --- /dev/null +++ b/resources/js/Global/components/Inputs/TooltipButton.vue @@ -0,0 +1,106 @@ + + + + + \ No newline at end of file diff --git a/resources/js/Global/plugins/globalComponent.js b/resources/js/Global/plugins/globalComponent.js index 898fc05..2ca4e14 100644 --- a/resources/js/Global/plugins/globalComponent.js +++ b/resources/js/Global/plugins/globalComponent.js @@ -1,8 +1,8 @@ -import Vue from 'vue'; +import Vue from "vue"; // global Styles -import "@riophae/vue-treeselect/dist/vue-treeselect.css";//for tree select +import "@riophae/vue-treeselect/dist/vue-treeselect.css"; //for tree select import "@Global/scss/style.scss"; // global Components @@ -86,11 +86,11 @@ Vue.component("we-hint-text", HintText); import HintBlock from "@Global/components/Blocks/Hint.vue"; Vue.component("hint-block", HintBlock); -import PersianDate from '@Global/components/Inputs/PersianDate' +import PersianDate from "@Global/components/Inputs/PersianDate"; Vue.component("we-persian-date", PersianDate); - - +import TooltipButton from "@Global/components/Inputs/TooltipButton"; +Vue.component("tooltip-button", TooltipButton); Vue.component("wm-breadcrumbs", Breadcrumbs); Vue.component("wm-dialog", Dialog); @@ -99,14 +99,13 @@ Vue.component("wm-helper", Helper); Vue.component("we-no-items", NoItems); Vue.component("we-loading", Loading); - //setTime import store from "@Global/store/index"; -store.dispatch('common/setCurrentTime'); +store.dispatch("common/setCurrentTime"); //jalali => 0.6MB -import jalaliMoment from "vue-jalali-moment" -import momment from "moment" +import jalaliMoment from "vue-jalali-moment"; +import momment from "moment"; import Wireframe from "@Global/components/Blocks/Wireframe"; -momment.locale('fa'); +momment.locale("fa"); Vue.use(jalaliMoment); From bf14dee28feb4667966586d63c006080c9e05dd5 Mon Sep 17 00:00:00 2001 From: Saeid Date: Tue, 22 Dec 2020 19:07:22 +0330 Subject: [PATCH 2/8] fix: filesystem url path --- config/filesystems.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/filesystems.php b/config/filesystems.php index 45a038f..f8839a7 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -73,12 +73,13 @@ return [ ], 'media' => [ - 'driver' => 'minio', + 'driver' => 's3', 'key' => env('MINIO_KEY', 'your minio server key'), 'secret' => env('MINIO_SECRET', 'your minio server secret'), 'region' => 'us-east-1', 'bucket' => env('MINIO_BUCKET','your minio bucket name'), - 'endpoint' => env('MINIO_ENDPOINT','http://localhost:8000') + 'endpoint' => env('MINIO_ENDPOINT','http://localhost:8000'), + 'url' => 'https://cdn.willaspace.com/'. env('MINIO_BUCKET') ], ], From 7413c75af375dad0a848df84522d4f23d2c9c0ac Mon Sep 17 00:00:00 2001 From: Saeid Date: Tue, 22 Dec 2020 19:13:46 +0330 Subject: [PATCH 3/8] fix: database error --- config/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.php b/config/database.php index b42d9b3..aeabec6 100644 --- a/config/database.php +++ b/config/database.php @@ -56,7 +56,7 @@ return [ 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, - 'strict' => true, + 'strict' => false, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), From 7cc65dea0fa9fbb339a5f91da8f611234dad5bcc Mon Sep 17 00:00:00 2001 From: farid saravi Date: Thu, 24 Dec 2020 20:13:36 +0330 Subject: [PATCH 4/8] feat: add global validator for phone number --- resources/js/Global/plugins/veeValidate.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/js/Global/plugins/veeValidate.js b/resources/js/Global/plugins/veeValidate.js index 4c0f9cf..c09e85a 100644 --- a/resources/js/Global/plugins/veeValidate.js +++ b/resources/js/Global/plugins/veeValidate.js @@ -5,4 +5,16 @@ import fa from "@Global/utils/vee-validate/locale/fa"; import "@Global/utils/vee-validate/newRules"; Vue.use(VeeValidate); +const phoneRule = { + getMessage(field, args) { + return `The ${field} must be either a valid phone number`; + }, + validate(value, args) { + const PHONE_REG = /^0\d{2,3}\d{8}$/; + return PHONE_REG.test(value); + } +}; + +VeeValidate.Validator.extend('phone', phoneRule); + Validator.localize("fa", fa); From 3d06f841b1458a58ea1073166874ec40c122ae44 Mon Sep 17 00:00:00 2001 From: aliqasemi Date: Sat, 26 Dec 2020 17:54:20 +0330 Subject: [PATCH 5/8] set disable in persian date --- .../Global/components/Inputs/PersianDate.vue | 213 ++++++++++-------- 1 file changed, 114 insertions(+), 99 deletions(-) diff --git a/resources/js/Global/components/Inputs/PersianDate.vue b/resources/js/Global/components/Inputs/PersianDate.vue index c55ac51..4179c50 100644 --- a/resources/js/Global/components/Inputs/PersianDate.vue +++ b/resources/js/Global/components/Inputs/PersianDate.vue @@ -1,5 +1,5 @@ From 3fb66d8331e3a997cae130e3b2156a53ed71717f Mon Sep 17 00:00:00 2001 From: Saeid Date: Sun, 27 Dec 2020 20:44:37 +0330 Subject: [PATCH 6/8] feat: add emit in auto compelete --- .../components/Inputs/AutoCompleteWrapper.vue | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/resources/js/Global/components/Inputs/AutoCompleteWrapper.vue b/resources/js/Global/components/Inputs/AutoCompleteWrapper.vue index c2a685f..249541d 100644 --- a/resources/js/Global/components/Inputs/AutoCompleteWrapper.vue +++ b/resources/js/Global/components/Inputs/AutoCompleteWrapper.vue @@ -1,36 +1,37 @@ \ No newline at end of file + From 5b9efa42914516b54dc82e825a0a7fbec69584f4 Mon Sep 17 00:00:00 2001 From: fateme Date: Thu, 31 Dec 2020 14:58:43 +0330 Subject: [PATCH 7/8] add filterByLevel --- resources/js/Global/mixins/commingSoon.js | 3 +- .../js/Global/plugins/globalComponent.js | 2 + resources/js/Global/utils/common/Object.js | 42 +++++++++++++++++++ .../Global/utils/common/ProcessTreeArray.js | 22 +++++++++- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 resources/js/Global/utils/common/Object.js diff --git a/resources/js/Global/mixins/commingSoon.js b/resources/js/Global/mixins/commingSoon.js index e91a81b..ea810f9 100644 --- a/resources/js/Global/mixins/commingSoon.js +++ b/resources/js/Global/mixins/commingSoon.js @@ -10,7 +10,8 @@ var CommingSoonArray = [ "blog-post", "blog-setting", "client_export", - "blog-videos" + "blog-videos", + "service-specialInfo" ]; const commingSoon = { methods: { diff --git a/resources/js/Global/plugins/globalComponent.js b/resources/js/Global/plugins/globalComponent.js index 898fc05..f97c087 100644 --- a/resources/js/Global/plugins/globalComponent.js +++ b/resources/js/Global/plugins/globalComponent.js @@ -1,5 +1,7 @@ import Vue from 'vue'; +import '@Global/utils/common/Object'; + // global Styles import "@riophae/vue-treeselect/dist/vue-treeselect.css";//for tree select diff --git a/resources/js/Global/utils/common/Object.js b/resources/js/Global/utils/common/Object.js new file mode 100644 index 0000000..73d94b5 --- /dev/null +++ b/resources/js/Global/utils/common/Object.js @@ -0,0 +1,42 @@ +// Warn if overriding existing method +if(Array.prototype.equals) + console.warn("Overriding existing Array.prototype.equals. Possible causes: New API defines the method, there's a framework conflict or you've got double inclusions in your code."); +// attach the .equals method to Array's prototype to call it on any array +Array.prototype.equals = function (array) { + // if the other array is a falsy value, return + if (!array) + return false; + + // compare lengths - can save a lot of time + if (this.length != array.length) + return false; + + for (var i = 0, l=this.length; i < l; i++) { + // Check if we have nested arrays + if (this[i] instanceof Array && array[i] instanceof Array) { + // recurse into the nested arrays + if (!this[i].equals(array[i])) + return false; + } + else if (this[i] != array[i]) { + // Warning - two different object instances will never be equal: {x:20} != {x:20} + return false; + } + } + return true; +} +// Hide method from for-in loops +Object.defineProperty(Array.prototype, "equals", {enumerable: false}); + + + + +Array.prototype.matchItems = function (array) { + // if the other array is a falsy value, return + if (!array) + return []; + + return this.filter(item => array.includes(item)); +} +// Hide method from for-in loops +Object.defineProperty(Array.prototype, "matchItems", {enumerable: false}); diff --git a/resources/js/Global/utils/common/ProcessTreeArray.js b/resources/js/Global/utils/common/ProcessTreeArray.js index 428d60e..d17728e 100644 --- a/resources/js/Global/utils/common/ProcessTreeArray.js +++ b/resources/js/Global/utils/common/ProcessTreeArray.js @@ -287,6 +287,25 @@ const insertTreeArray = ( // }; +const filterByLevel = (list, level1) => { + + let filteredList = []; + let level = parseInt(level1); + checkLevel(list); + + function checkLevel(list, parentId = null, levelCounter = 1) { + list.map(item => { + if(item.parent_id == parentId) { + if(levelCounter == level) { + filteredList.push(item); + } else { + checkLevel(list, item.id, levelCounter + 1); + } + } + }) + } + return filteredList; +} export { convertTreeToList, insertTreeArray, @@ -295,5 +314,6 @@ export { listSearchSelect, convertListToTree, addIndexTreeToList, - addHierarchyToList + addHierarchyToList, + filterByLevel }; From 504cb6cabf91d3ff7d196fae88eb3d339ddb2197 Mon Sep 17 00:00:00 2001 From: saeid Date: Sat, 2 Jan 2021 12:46:57 +0330 Subject: [PATCH 8/8] feat: add jalali date --- resources/js/Global/utils/date/jalali-date.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/js/Global/utils/date/jalali-date.js b/resources/js/Global/utils/date/jalali-date.js index b4e74a4..25afc05 100644 --- a/resources/js/Global/utils/date/jalali-date.js +++ b/resources/js/Global/utils/date/jalali-date.js @@ -6,4 +6,8 @@ const convertToJalali = function (date = null, format = "jYYYY/jMM/jDD", default const convertNowToJalali = function (date = null, format = "jYYYY/jMM/jDD" ) { return date ? moment(date).locale('fa').format(format) : moment(new Date()).locale('fa').format(format) ; }; -export { convertToJalali, convertNowToJalali }; + +const convertToRelativedDateJalali = function (date = null, defaultDate = 'مشخص نشده است.' ) { + return date ? moment(date).locale('fa').fromNow() : defaultDate; +}; +export { convertToJalali, convertNowToJalali, convertToRelativedDateJalali };