@burh/nuxt-core 1.0.73 → 1.0.74

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.
@@ -17,15 +17,15 @@
17
17
  @change="addNumber(receiver)"
18
18
  />
19
19
 
20
- <div class="d-flex flex-wrap">
20
+ <div class="row">
21
21
  <badge
22
22
  v-for="(numbers, index) in allNumbers"
23
23
  :key="index"
24
24
  type="primary"
25
- class="col-3 mx-3"
25
+ class="col-3 mx-3 px-1"
26
26
  >{{ numbers
27
27
  }}<i
28
- class="fas fa-times px-2 cursor-pointer"
28
+ class="fas fa-times ml-1 cursor-pointer"
29
29
  @click="deleteNumber(index)"
30
30
  ></i
31
31
  ></badge>
@@ -37,22 +37,47 @@
37
37
  <label for="message" class="form-control-label"
38
38
  >Mensagem</label
39
39
  >
40
- <el-select
41
- filterable
42
- no-match-text="Nenhum modelo encontrado"
43
- no-data-text="Nenhum modelo encontrado"
44
- placeholder="Escolha o modelo"
45
- v-model="messageType"
46
- >
47
- <el-option
48
- v-for="models in models"
49
- class="select-danger"
50
- :value="models.text"
51
- :label="models.name"
52
- :key="models.id"
53
- :disabled="hasModel"
54
- ></el-option>
55
- </el-select>
40
+ <div class="d-flex align-items-center">
41
+ <el-select
42
+ filterable
43
+ no-match-text="Nenhum modelo encontrado"
44
+ no-data-text="Nenhum modelo encontrado"
45
+ placeholder="Escolha o modelo"
46
+ :class="'col-9 px-0'"
47
+ @change="changeMessage(messageTitle)"
48
+ v-model="messageTitle"
49
+ >
50
+ <el-option
51
+ v-for="(templates, index) in models"
52
+ class="select-danger"
53
+ :value="templates.title"
54
+ :key="index"
55
+ :disabled="hasModel"
56
+ ></el-option>
57
+ </el-select>
58
+
59
+ <el-tooltip
60
+ class="item"
61
+ effect="dark"
62
+ :content="'Remover Template'"
63
+ placement="top"
64
+ >
65
+ <i
66
+ v-if="messageTitle"
67
+ @click="
68
+ belongsToUser()
69
+ ? deleteTemplate(messageTitle)
70
+ : ''
71
+ "
72
+ class="fas fa-trash col-3 ml-5"
73
+ :class="
74
+ belongsToUser()
75
+ ? 'text-danger cursor-pointer'
76
+ : ''
77
+ "
78
+ ></i>
79
+ </el-tooltip>
80
+ </div>
56
81
  </div>
57
82
 
58
83
  <validation-provider
@@ -84,6 +109,7 @@
84
109
  <validation-provider
85
110
  tag="div"
86
111
  v-if="saveModel"
112
+ :class="'d-flex align-items-center'"
87
113
  name="Titulo para o modelo"
88
114
  rules="required"
89
115
  v-slot="{ errors }"
@@ -91,10 +117,15 @@
91
117
  <base-input
92
118
  v-model="modelName"
93
119
  placeholder="Titulo para o modelo"
94
- :class="'mt-4'"
120
+ :class="'mt-4 col-9 px-0'"
95
121
  :error="errors[0]"
96
122
  :valid="errors.length ? true : false"
97
123
  />
124
+
125
+ <i
126
+ class="text-primary fas fa-save cursor-pointer col-3 ml-5"
127
+ @click="saveTemplate()"
128
+ ></i>
98
129
  </validation-provider>
99
130
  </div>
100
131
  <div class="d-flex">
@@ -113,7 +144,7 @@
113
144
  </template>
114
145
 
115
146
  <script>
116
- import { Select, Option, Checkbox } from "element-ui";
147
+ import { Select, Option, Checkbox, Tooltip } from "element-ui";
117
148
  import { mask } from "vue-the-mask";
118
149
  import swal from "sweetalert2";
119
150
  export default {
@@ -122,7 +153,8 @@ export default {
122
153
  components: {
123
154
  [Select.name]: Select,
124
155
  [Option.name]: Option,
125
- [Checkbox.name]: Checkbox
156
+ [Checkbox.name]: Checkbox,
157
+ [Tooltip.name]: Tooltip
126
158
  },
127
159
  computed: {
128
160
  isModalOpen: {
@@ -138,23 +170,23 @@ export default {
138
170
  show: {
139
171
  type: Boolean,
140
172
  default: false
141
- }
173
+ },
174
+ templates: null
142
175
  },
143
176
  model: {
144
177
  prop: "show"
145
178
  },
179
+ watch: {
180
+ templates(newValue) {
181
+ this.models = newValue;
182
+ }
183
+ },
146
184
  data() {
147
185
  return {
148
- messageType: null,
186
+ models: this.templates,
187
+ messageTitle: null,
149
188
  receiver: null,
150
189
  message: "",
151
- models: [
152
- {
153
- id: 1,
154
- name: "Modelo Pronto",
155
- text: "Olá, somos a BURH"
156
- }
157
- ],
158
190
  hasModel: false,
159
191
  saveModel: false,
160
192
  modelName: null,
@@ -172,6 +204,17 @@ export default {
172
204
  title: `Aviso`,
173
205
  html: `Preecha todos os campos corretamente`,
174
206
  buttonsStyling: false,
207
+ type: "error",
208
+ confirmButtonClass: "btn btn-primary btn-fill"
209
+ });
210
+ return;
211
+ }
212
+ if (this.allNumbers.length == 0) {
213
+ swal.fire({
214
+ title: `Aviso`,
215
+ html: `Adicione pelo menos um número de telefone para continuar`,
216
+ buttonsStyling: false,
217
+ type: "error",
175
218
  confirmButtonClass: "btn btn-primary btn-fill"
176
219
  });
177
220
  return;
@@ -179,20 +222,49 @@ export default {
179
222
  this.$emit("send-sms", this.allNumbers, this.message);
180
223
  }
181
224
  },
225
+ saveTemplate() {
226
+ if (this.saveModel) {
227
+ this.$emit("save-model", this.modelName, this.message);
228
+ }
229
+ },
182
230
  addNumber(number) {
183
231
  this.allNumbers.push(number);
184
232
  this.receiver = "";
185
- console.log(this.allNumbers);
186
233
  },
187
234
  deleteNumber(index) {
188
- console.log(index);
189
235
  this.allNumbers.splice(index, 1);
236
+ },
237
+ changeMessage(messageName) {
238
+ let message = this.models.find(data => data.title == messageName);
239
+ this.message = message.message;
240
+ },
241
+ deleteTemplate(messageName) {
242
+ let template = this.models.find(data => data.title == messageName);
243
+ this.messageTitle = "";
244
+ this.$emit("remove-template", template.id);
245
+ },
246
+ belongsToUser() {
247
+ let template = this.models.find(
248
+ data => data.title == this.messageTitle
249
+ );
250
+ if (
251
+ parseInt(this.$store.state.user.currentUser.id) ==
252
+ template.user_id
253
+ ) {
254
+ return true;
255
+ } else {
256
+ return false;
257
+ }
190
258
  }
191
- }
259
+ },
260
+ mounted() {}
192
261
  };
193
262
  </script>
194
263
  <style lang="scss" scoped>
195
264
  .badge {
196
265
  margin-bottom: 1.5rem;
197
266
  }
267
+ .modal-body {
268
+ padding: 1.5rem !important;
269
+ }
198
270
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {