@iankibetsh/shframework 1.4.7 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,4 @@
1
1
 
2
- .colored-toast.swal2-icon-success {
3
- background-color: #a5dc86 !important;
4
- }
5
-
6
- .colored-toast.swal2-icon-error {
7
- background-color: #f27474 !important;
8
- }
9
-
10
- .colored-toast.swal2-icon-warning {
11
- background-color: #f8bb86 !important;
12
- }
13
-
14
- .colored-toast.swal2-icon-info {
15
- background-color: #3fc3ee !important;
16
- }
17
-
18
- .colored-toast.swal2-icon-question {
19
- background-color: #87adbd !important;
20
- }
21
-
22
- .colored-toast .swal2-title {
23
- color: white;
24
- }
25
-
26
- .colored-toast .swal2-close {
27
- color: white;
28
- }
29
-
30
- .colored-toast .swal2-html-container {
31
- color: white;
32
- }
33
-
34
2
  .sh-phone{
35
3
  display: flex;
36
4
  width: 100%;
@@ -63,6 +31,38 @@
63
31
  opacity: 0.5;
64
32
  }
65
33
 
34
+ .colored-toast.swal2-icon-success {
35
+ background-color: #a5dc86 !important;
36
+ }
37
+
38
+ .colored-toast.swal2-icon-error {
39
+ background-color: #f27474 !important;
40
+ }
41
+
42
+ .colored-toast.swal2-icon-warning {
43
+ background-color: #f8bb86 !important;
44
+ }
45
+
46
+ .colored-toast.swal2-icon-info {
47
+ background-color: #3fc3ee !important;
48
+ }
49
+
50
+ .colored-toast.swal2-icon-question {
51
+ background-color: #87adbd !important;
52
+ }
53
+
54
+ .colored-toast .swal2-title {
55
+ color: white;
56
+ }
57
+
58
+ .colored-toast .swal2-close {
59
+ color: white;
60
+ }
61
+
62
+ .colored-toast .swal2-html-container {
63
+ color: white;
64
+ }
65
+
66
66
  .permissions-main {
67
67
  background: #edeff2;
68
68
  }
package/dist/library.js CHANGED
@@ -4984,6 +4984,102 @@ return (_ctx, _cache) => {
4984
4984
 
4985
4985
  script$4.__file = "src/lib/components/ShDynamicTabs.vue";
4986
4986
 
4987
+ const useUserStore = pinia.defineStore('user-store', {
4988
+ state: () => ({
4989
+ user: null,
4990
+ role: null,
4991
+ permissions: null,
4992
+ menus: [],
4993
+ loggedOut: false
4994
+ }),
4995
+ actions: {
4996
+ setUser (){
4997
+ let user = null;
4998
+ try {
4999
+ user = ShStorage.getItem('user') ? ShStorage.getItem('user') : null;
5000
+ } catch (error) {
5001
+ user= null;
5002
+ }
5003
+ if (user) {
5004
+ user.isAllowedTo = function (slug) {
5005
+ if (this.permissions) {
5006
+ let permissions = [];
5007
+ if (typeof this.permissions === 'string') {
5008
+ permissions = this.permissions;
5009
+ } else {
5010
+ permissions = this.permissions;
5011
+ }
5012
+ return permissions.includes(slug)
5013
+ }
5014
+ return false
5015
+ };
5016
+ }
5017
+ this.user = user;
5018
+ shApis.doGet('auth/user').then(res => {
5019
+ let user = res.data.user;
5020
+ if (typeof(user) === 'undefined') {
5021
+ user = res.data;
5022
+ }
5023
+ ShStorage.setItem('user',user);
5024
+ user.signOut = this.signOut;
5025
+ user.logout = this.signOut;
5026
+ user.logOut = this.signOut;
5027
+ user.isAllowedTo = function (slug) {
5028
+ if(!slug){
5029
+ return true
5030
+ }
5031
+ if (this.permissions) {
5032
+ let permissions = [];
5033
+ if (typeof this.permissions === 'string') {
5034
+ permissions = this.permissions;
5035
+ } else {
5036
+ permissions = this.permissions;
5037
+ }
5038
+ return permissions.includes(slug)
5039
+ }
5040
+ return false
5041
+ };
5042
+ this.user = user;
5043
+ }).catch((reason) => {
5044
+ if (reason.response && reason.response.status) {
5045
+ if(reason.response.status === 401) {
5046
+ ShStorage.setItem('user',null);
5047
+ this.user = null;
5048
+ }
5049
+ this.loggedOut = true;
5050
+ }
5051
+ });
5052
+ if (this.user) {
5053
+ if (typeof this.user.permissions === 'string') {
5054
+ this.permissions = this.user.permissions;
5055
+ } else {
5056
+ this.permissions = this.user.permissions;
5057
+ }
5058
+ }
5059
+ const timeNow = moment__default["default"]().toISOString();
5060
+ ShStorage.setItem('session_start',timeNow);
5061
+ },
5062
+ signOut () {
5063
+ shRepo.signOutUser();
5064
+ },
5065
+ logOut () {
5066
+ this.signOut();
5067
+ },
5068
+ getUser () {
5069
+ this.setUser();
5070
+ },
5071
+ setAccessToken (accessToken) {
5072
+ ShStorage.setItem('access_token', accessToken);
5073
+ this.setUser();
5074
+ }
5075
+ },
5076
+ getters: {
5077
+ userId (state) {
5078
+ return state.user === null ? null:state.user.id
5079
+ }
5080
+ }
5081
+ });
5082
+
4987
5083
  const _withScopeId$1 = n => (vue.pushScopeId("data-v-0d4fa0ac"),n=n(),vue.popScopeId(),n);
4988
5084
  const _hoisted_1$3 = { class: "row permissions-main d-flex" };
4989
5085
  const _hoisted_2$3 = {
@@ -5013,10 +5109,13 @@ const _hoisted_13 = {
5013
5109
  const _hoisted_14 = { class: "col-md-3" };
5014
5110
  const _hoisted_15 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5015
5111
 
5112
+
5016
5113
  var script$3 = {
5017
5114
  __name: 'ManagePermissions',
5018
5115
  setup(__props) {
5019
5116
 
5117
+ const userStore =useUserStore();
5118
+
5020
5119
  const route = vueRouter.useRoute();
5021
5120
  const modules = vue.ref([]);
5022
5121
  const selectedModule = vue.ref('tasks');
@@ -5054,6 +5153,7 @@ const getModulePermissions = () => {
5054
5153
  });
5055
5154
  };
5056
5155
  const permissionsUpdated = (res)=>{
5156
+ userStore.setUser();
5057
5157
  departmentModules.value = res.data.departmentModules;
5058
5158
  };
5059
5159
  function reformatModulePermissions(mPs){
@@ -5177,102 +5277,6 @@ return (_ctx, _cache) => {
5177
5277
  script$3.__scopeId = "data-v-0d4fa0ac";
5178
5278
  script$3.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
5179
5279
 
5180
- const useUserStore = pinia.defineStore('user-store', {
5181
- state: () => ({
5182
- user: null,
5183
- role: null,
5184
- permissions: null,
5185
- menus: [],
5186
- loggedOut: false
5187
- }),
5188
- actions: {
5189
- setUser (){
5190
- let user = null;
5191
- try {
5192
- user = ShStorage.getItem('user') ? ShStorage.getItem('user') : null;
5193
- } catch (error) {
5194
- user= null;
5195
- }
5196
- if (user) {
5197
- user.isAllowedTo = function (slug) {
5198
- if (this.permissions) {
5199
- let permissions = [];
5200
- if (typeof this.permissions === 'string') {
5201
- permissions = this.permissions;
5202
- } else {
5203
- permissions = this.permissions;
5204
- }
5205
- return permissions.includes(slug)
5206
- }
5207
- return false
5208
- };
5209
- }
5210
- this.user = user;
5211
- shApis.doGet('auth/user').then(res => {
5212
- let user = res.data.user;
5213
- if (typeof(user) === 'undefined') {
5214
- user = res.data;
5215
- }
5216
- ShStorage.setItem('user',user);
5217
- user.signOut = this.signOut;
5218
- user.logout = this.signOut;
5219
- user.logOut = this.signOut;
5220
- user.isAllowedTo = function (slug) {
5221
- if(!slug){
5222
- return true
5223
- }
5224
- if (this.permissions) {
5225
- let permissions = [];
5226
- if (typeof this.permissions === 'string') {
5227
- permissions = this.permissions;
5228
- } else {
5229
- permissions = this.permissions;
5230
- }
5231
- return permissions.includes(slug)
5232
- }
5233
- return false
5234
- };
5235
- this.user = user;
5236
- }).catch((reason) => {
5237
- if (reason.response && reason.response.status) {
5238
- if(reason.response.status === 401) {
5239
- ShStorage.setItem('user',null);
5240
- this.user = null;
5241
- }
5242
- this.loggedOut = true;
5243
- }
5244
- });
5245
- if (this.user) {
5246
- if (typeof this.user.permissions === 'string') {
5247
- this.permissions = this.user.permissions;
5248
- } else {
5249
- this.permissions = this.user.permissions;
5250
- }
5251
- }
5252
- const timeNow = moment__default["default"]().toISOString();
5253
- ShStorage.setItem('session_start',timeNow);
5254
- },
5255
- signOut () {
5256
- shRepo.signOutUser();
5257
- },
5258
- logOut () {
5259
- this.signOut();
5260
- },
5261
- getUser () {
5262
- this.setUser();
5263
- },
5264
- setAccessToken (accessToken) {
5265
- ShStorage.setItem('access_token', accessToken);
5266
- this.setUser();
5267
- }
5268
- },
5269
- getters: {
5270
- userId (state) {
5271
- return state.user === null ? null:state.user.id
5272
- }
5273
- }
5274
- });
5275
-
5276
5280
  const _hoisted_1$2 = /*#__PURE__*/vue.createElementVNode("h5", null, "Departments", -1 /* HOISTED */);
5277
5281
  const _hoisted_2$2 = { class: "card sh-departments-card shadow" };
5278
5282
  const _hoisted_3$2 = { class: "card-body" };
package/dist/library.mjs CHANGED
@@ -4971,6 +4971,102 @@ return (_ctx, _cache) => {
4971
4971
 
4972
4972
  script$4.__file = "src/lib/components/ShDynamicTabs.vue";
4973
4973
 
4974
+ const useUserStore = defineStore('user-store', {
4975
+ state: () => ({
4976
+ user: null,
4977
+ role: null,
4978
+ permissions: null,
4979
+ menus: [],
4980
+ loggedOut: false
4981
+ }),
4982
+ actions: {
4983
+ setUser (){
4984
+ let user = null;
4985
+ try {
4986
+ user = ShStorage.getItem('user') ? ShStorage.getItem('user') : null;
4987
+ } catch (error) {
4988
+ user= null;
4989
+ }
4990
+ if (user) {
4991
+ user.isAllowedTo = function (slug) {
4992
+ if (this.permissions) {
4993
+ let permissions = [];
4994
+ if (typeof this.permissions === 'string') {
4995
+ permissions = this.permissions;
4996
+ } else {
4997
+ permissions = this.permissions;
4998
+ }
4999
+ return permissions.includes(slug)
5000
+ }
5001
+ return false
5002
+ };
5003
+ }
5004
+ this.user = user;
5005
+ shApis.doGet('auth/user').then(res => {
5006
+ let user = res.data.user;
5007
+ if (typeof(user) === 'undefined') {
5008
+ user = res.data;
5009
+ }
5010
+ ShStorage.setItem('user',user);
5011
+ user.signOut = this.signOut;
5012
+ user.logout = this.signOut;
5013
+ user.logOut = this.signOut;
5014
+ user.isAllowedTo = function (slug) {
5015
+ if(!slug){
5016
+ return true
5017
+ }
5018
+ if (this.permissions) {
5019
+ let permissions = [];
5020
+ if (typeof this.permissions === 'string') {
5021
+ permissions = this.permissions;
5022
+ } else {
5023
+ permissions = this.permissions;
5024
+ }
5025
+ return permissions.includes(slug)
5026
+ }
5027
+ return false
5028
+ };
5029
+ this.user = user;
5030
+ }).catch((reason) => {
5031
+ if (reason.response && reason.response.status) {
5032
+ if(reason.response.status === 401) {
5033
+ ShStorage.setItem('user',null);
5034
+ this.user = null;
5035
+ }
5036
+ this.loggedOut = true;
5037
+ }
5038
+ });
5039
+ if (this.user) {
5040
+ if (typeof this.user.permissions === 'string') {
5041
+ this.permissions = this.user.permissions;
5042
+ } else {
5043
+ this.permissions = this.user.permissions;
5044
+ }
5045
+ }
5046
+ const timeNow = moment().toISOString();
5047
+ ShStorage.setItem('session_start',timeNow);
5048
+ },
5049
+ signOut () {
5050
+ shRepo.signOutUser();
5051
+ },
5052
+ logOut () {
5053
+ this.signOut();
5054
+ },
5055
+ getUser () {
5056
+ this.setUser();
5057
+ },
5058
+ setAccessToken (accessToken) {
5059
+ ShStorage.setItem('access_token', accessToken);
5060
+ this.setUser();
5061
+ }
5062
+ },
5063
+ getters: {
5064
+ userId (state) {
5065
+ return state.user === null ? null:state.user.id
5066
+ }
5067
+ }
5068
+ });
5069
+
4974
5070
  const _withScopeId$1 = n => (pushScopeId("data-v-0d4fa0ac"),n=n(),popScopeId(),n);
4975
5071
  const _hoisted_1$3 = { class: "row permissions-main d-flex" };
4976
5072
  const _hoisted_2$3 = {
@@ -5000,10 +5096,13 @@ const _hoisted_13 = {
5000
5096
  const _hoisted_14 = { class: "col-md-3" };
5001
5097
  const _hoisted_15 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5002
5098
 
5099
+
5003
5100
  var script$3 = {
5004
5101
  __name: 'ManagePermissions',
5005
5102
  setup(__props) {
5006
5103
 
5104
+ const userStore =useUserStore();
5105
+
5007
5106
  const route = useRoute();
5008
5107
  const modules = ref([]);
5009
5108
  const selectedModule = ref('tasks');
@@ -5041,6 +5140,7 @@ const getModulePermissions = () => {
5041
5140
  });
5042
5141
  };
5043
5142
  const permissionsUpdated = (res)=>{
5143
+ userStore.setUser();
5044
5144
  departmentModules.value = res.data.departmentModules;
5045
5145
  };
5046
5146
  function reformatModulePermissions(mPs){
@@ -5164,102 +5264,6 @@ return (_ctx, _cache) => {
5164
5264
  script$3.__scopeId = "data-v-0d4fa0ac";
5165
5265
  script$3.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
5166
5266
 
5167
- const useUserStore = defineStore('user-store', {
5168
- state: () => ({
5169
- user: null,
5170
- role: null,
5171
- permissions: null,
5172
- menus: [],
5173
- loggedOut: false
5174
- }),
5175
- actions: {
5176
- setUser (){
5177
- let user = null;
5178
- try {
5179
- user = ShStorage.getItem('user') ? ShStorage.getItem('user') : null;
5180
- } catch (error) {
5181
- user= null;
5182
- }
5183
- if (user) {
5184
- user.isAllowedTo = function (slug) {
5185
- if (this.permissions) {
5186
- let permissions = [];
5187
- if (typeof this.permissions === 'string') {
5188
- permissions = this.permissions;
5189
- } else {
5190
- permissions = this.permissions;
5191
- }
5192
- return permissions.includes(slug)
5193
- }
5194
- return false
5195
- };
5196
- }
5197
- this.user = user;
5198
- shApis.doGet('auth/user').then(res => {
5199
- let user = res.data.user;
5200
- if (typeof(user) === 'undefined') {
5201
- user = res.data;
5202
- }
5203
- ShStorage.setItem('user',user);
5204
- user.signOut = this.signOut;
5205
- user.logout = this.signOut;
5206
- user.logOut = this.signOut;
5207
- user.isAllowedTo = function (slug) {
5208
- if(!slug){
5209
- return true
5210
- }
5211
- if (this.permissions) {
5212
- let permissions = [];
5213
- if (typeof this.permissions === 'string') {
5214
- permissions = this.permissions;
5215
- } else {
5216
- permissions = this.permissions;
5217
- }
5218
- return permissions.includes(slug)
5219
- }
5220
- return false
5221
- };
5222
- this.user = user;
5223
- }).catch((reason) => {
5224
- if (reason.response && reason.response.status) {
5225
- if(reason.response.status === 401) {
5226
- ShStorage.setItem('user',null);
5227
- this.user = null;
5228
- }
5229
- this.loggedOut = true;
5230
- }
5231
- });
5232
- if (this.user) {
5233
- if (typeof this.user.permissions === 'string') {
5234
- this.permissions = this.user.permissions;
5235
- } else {
5236
- this.permissions = this.user.permissions;
5237
- }
5238
- }
5239
- const timeNow = moment().toISOString();
5240
- ShStorage.setItem('session_start',timeNow);
5241
- },
5242
- signOut () {
5243
- shRepo.signOutUser();
5244
- },
5245
- logOut () {
5246
- this.signOut();
5247
- },
5248
- getUser () {
5249
- this.setUser();
5250
- },
5251
- setAccessToken (accessToken) {
5252
- ShStorage.setItem('access_token', accessToken);
5253
- this.setUser();
5254
- }
5255
- },
5256
- getters: {
5257
- userId (state) {
5258
- return state.user === null ? null:state.user.id
5259
- }
5260
- }
5261
- });
5262
-
5263
5267
  const _hoisted_1$2 = /*#__PURE__*/createElementVNode("h5", null, "Departments", -1 /* HOISTED */);
5264
5268
  const _hoisted_2$2 = { class: "card sh-departments-card shadow" };
5265
5269
  const _hoisted_3$2 = { class: "card-body" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",