Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

templateDetail.vue 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div style="padding:10px;">
  3. <div
  4. class="container"
  5. style="border:silver solid thin;border-radius:10px;background-color:rgba(235,235,235,0.75);padding:20px;"
  6. >
  7. <div class="row">
  8. <div class="col-md-12">
  9. <div class="d-flex">
  10. <div class="p-2 mr-auto">
  11. <h2>Template - Detail</h2>
  12. </div>
  13. <div class="p-2">
  14. <div class="btn btn-primary myBackground" v-if="!editable" @click="onEdit()">Edit</div>
  15. </div>
  16. <div class="p-2">
  17. <div class="btn btn-primary myBackground" @click="onClose()">Save/Close</div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="col-md-12">
  22. <hr />
  23. </div>
  24. <div class="col-md-4 text-left">
  25. <label>Id</label>
  26. <div class="input-group mb-3">
  27. <div class="input-group-prepend">
  28. <span class="input-group-text" style="color: #60CBEB">
  29. <b>I</b>
  30. </span>
  31. </div>
  32. <input
  33. class="form-control"
  34. type="number"
  35. step="any"
  36. name="levy"
  37. v-model="item.id"
  38. disabled
  39. />
  40. </div>
  41. </div>
  42. <div class="col-md-8 text-left">
  43. <label for="Sleeps maximum">Name</label>
  44. <div class="input-group mb-3">
  45. <div class="input-group-prepend">
  46. <span class="input-group-text" style="color: #60CBEB">
  47. <b>N</b>
  48. </span>
  49. </div>
  50. <input
  51. class="form-control"
  52. type="text"
  53. step="any"
  54. name="levy"
  55. v-model="item.name"
  56. :disabled="!CanEdit"
  57. />
  58. </div>
  59. </div>
  60. <div class="col-md-12">
  61. <hr />
  62. </div>
  63. <div class="col-md-12 text-left">
  64. <label for="Sleeps maximum">Subject</label>
  65. <div class="input-group mb-3">
  66. <div class="input-group-prepend">
  67. <span class="input-group-text" style="color: #60CBEB">
  68. <b>S</b>
  69. </span>
  70. </div>
  71. <input
  72. class="form-control"
  73. type="text"
  74. step="any"
  75. name="levy"
  76. v-model="item.subject"
  77. :disabled="!CanEdit"
  78. />
  79. </div>
  80. </div>
  81. <div class="col-md-12">
  82. <ul class="nav nav-tabs" id="myTab" role="tablist">
  83. <li class="nav-item">
  84. <a
  85. class="nav-link active"
  86. id="directions-tab"
  87. data-toggle="tab"
  88. href="#directions"
  89. role="tab"
  90. aria-controls="directions"
  91. aria-selected="false"
  92. >Html</a>
  93. </li>
  94. <li class="nav-item">
  95. <a
  96. class="nav-link"
  97. id="resort-layout-tab"
  98. data-toggle="tab"
  99. href="#resort-layout"
  100. role="tab"
  101. aria-controls="resort-layout"
  102. aria-selected="true"
  103. >Preview</a>
  104. </li>
  105. </ul>
  106. <div
  107. class="tab-content"
  108. id="myTabContent"
  109. style="background-color:rgba(255,255,255,0.75);padding:10px;border:silver solid thin;border-radius:10px;"
  110. >
  111. <div
  112. class="tab-pane fade show active"
  113. style="background-color:rgba(255,255,255,0.75);padding:10px;"
  114. id="directions"
  115. role="tabpanel"
  116. aria-labelledby="directions-tab"
  117. >
  118. <div class="text-left">
  119. <label for="Sleeps maximum">Body</label>
  120. <div class="input-group mb-3">
  121. <div class="input-group-prepend">
  122. <span class="input-group-text" style="color: #60CBEB">
  123. <b>B</b>
  124. </span>
  125. </div>
  126. <textarea
  127. class="form-control"
  128. type="text"
  129. rows="10"
  130. step="any"
  131. name="levy"
  132. v-model="item.body"
  133. :disabled="!CanEdit"
  134. />
  135. </div>
  136. </div>
  137. </div>
  138. <div
  139. class="tab-pane fade"
  140. id="resort-layout"
  141. role="tabpanel"
  142. aria-labelledby="resort-layout-tab"
  143. >
  144. <div class="no-style" v-html="item.body"></div>
  145. </div>
  146. </div>
  147. </div>
  148. <div class="col-md-12">
  149. <hr />
  150. </div>
  151. <div class="col-md-12">
  152. <div class="d-flex">
  153. <div class="p-2 mr-auto">
  154. <h2>Coded Fields</h2>
  155. </div>
  156. <div class="p-2">
  157. <div
  158. class="btn btn-primary myBackground"
  159. @click="addClose()"
  160. v-if="CanEdit"
  161. >{{btnCaption}}</div>
  162. </div>
  163. </div>
  164. </div>
  165. <div class="col-md-12" v-if="showNew">
  166. <TemplateInnerItem @onItemAdd="onItemAdd" />
  167. </div>
  168. <div class="col-md-12">
  169. <hr />
  170. </div>
  171. <div class="col-md-12">
  172. <ListView
  173. :items="PlaceHolders"
  174. :hideSearch="true"
  175. :showNew="false"
  176. :deleteable="CanEdit"
  177. :allowMultipleSelect="true"
  178. @onDelete="onItemDelete"
  179. />
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </template>
  185. <script>
  186. import { mapActions } from 'vuex';
  187. import ListView from '../shared/listView.vue';
  188. import TemplateInnerItem from './templateInnerItem.vue';
  189. export default {
  190. data() {
  191. return {
  192. showNew: false,
  193. openFields: false,
  194. };
  195. },
  196. components: {
  197. ListView,
  198. TemplateInnerItem,
  199. },
  200. props: {
  201. item: {},
  202. placeHolders: [],
  203. editable: {
  204. default: false,
  205. },
  206. },
  207. computed: {
  208. CanEdit() {
  209. return this.editable || this.item.id === 0 || this.openFields;
  210. },
  211. btnCaption() {
  212. return this.showNew ? 'Close' : 'New';
  213. },
  214. ItemList() {
  215. return this.item.placeHolders;
  216. },
  217. PlaceHolders(){
  218. return this.placeHolders;
  219. }
  220. },
  221. methods: {
  222. ...mapActions('template', ['addItem', 'editItem']),
  223. addClose() {
  224. if (this.showNew) {
  225. this.showNew = false;
  226. } else this.showNew = true;
  227. },
  228. onClose() {
  229. if (this.item.id > 0) {
  230. // edit
  231. this.editItem(this.item);
  232. } else {
  233. // add.
  234. this.addItem(this.item);
  235. }
  236. this.$emit('onClose');
  237. },
  238. onItemDelete(item) {
  239. this.item.placeHolders = _.remove(
  240. this.item.placeHolders,
  241. x => x !== item,
  242. );
  243. },
  244. onEdit() {
  245. this.openFields = true;
  246. },
  247. onItemAdd(item) {
  248. const myList = this.item.placeHolders ? this.item.placeHolders : [];
  249. myList.push({
  250. name: item.name,
  251. boundTo: item.property,
  252. boundToClassDisplay: item.class.name,
  253. boundToClass: item.class.fullName,
  254. });
  255. this.placeHolders = myList;
  256. this.item.placeHolders = this.placeHolders;
  257. },
  258. },
  259. };
  260. </script>
  261. <style>
  262. .no-style {
  263. background: #fff;
  264. border: none;
  265. color: #000;
  266. display: block;
  267. font: initial;
  268. height: auto;
  269. letter-spacing: normal;
  270. line-height: normal;
  271. margin: 0;
  272. padding: 0;
  273. text-transform: none;
  274. visibility: visible;
  275. width: auto;
  276. word-spacing: normal;
  277. z-index: auto;
  278. text-align: left;
  279. }
  280. </style>