You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
5.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="group tw-mb-[20px]">
  3. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[166px_auto_auto] xl:tw-grid-cols-[166px_auto_auto] tw-gap-[10px]">
  4. <div class="tw-flex tw-items-center">
  5. <label class="tw-mb-[10px] tw-font-normal t14 md:t16">
  6. <span>{{ $t("Select an extension")}}</span>
  7. </label>
  8. </div>
  9. <elementSelectNew
  10. :select="{
  11. id: 'SelectYear',
  12. label: '',
  13. required: true,
  14. }"
  15. :isRow="true"
  16. :itemsCenter="true"
  17. :labelWidth="0"
  18. :selectWidth="200"
  19. :selectList="selectYearList"
  20. :default="formData.select_year"
  21. :validation="validation.select_year"
  22. @change="selectYear($event)"
  23. ></elementSelectNew>
  24. <elementSelectNew
  25. :select="{
  26. id: 'selectMonth',
  27. label: '',
  28. required: false,
  29. }"
  30. :isRow="true"
  31. :itemsCenter="true"
  32. :labelWidth="0"
  33. :selectWidth="200"
  34. :selectList="selectMonthList"
  35. :default="formData.select_month"
  36. :validation="validation.select_month"
  37. @change="selectMonth($event)"
  38. ></elementSelectNew>
  39. </div>
  40. <div class="element tw-mt-[20px] tw-grid tw-grid-cols-1 md:tw-grid-cols-[166px_auto] xl:tw-grid-cols-[166px_auto] tw-gap-[10px]">
  41. <div class="tw-flex tw-items-center">
  42. <label class="tw-mb-[10px] tw-font-normal t14 md:t16">
  43. <span>{{ $t("Exhibition Name")}}</span><span class="required t12 md:t14">*</span>
  44. </label>
  45. </div>
  46. <elementSelectNew
  47. :select="{
  48. id: 'ExhibitionName',
  49. label: 'Exhibition Name',
  50. required: true,
  51. }"
  52. :isRow="true"
  53. :itemsCenter="true"
  54. :labelWidth="0"
  55. :selectWidth="200"
  56. :selectList="selectExhibitionList"
  57. :default="formData.exhibition_name"
  58. :validation="validation.exhibition_name"
  59. @change="selectExhibition($event)"
  60. ></elementSelectNew>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import elementSelectNew from "@/components/newComponent/form/ElementSelectNew";
  66. import is from "is_js";
  67. export default {
  68. name: 'selectExhibition',
  69. components: {
  70. elementSelectNew,
  71. },
  72. props: {
  73. selectYearList: {
  74. type: Array,
  75. },
  76. selectMonthList: {
  77. type: Array,
  78. },
  79. selectExhibitionList: {
  80. type: Array,
  81. },
  82. },
  83. data() {
  84. return {
  85. // selectExhibitionList: [],
  86. formData: {
  87. select_year: "0",
  88. select_month: "0",
  89. exhibition_name: "0",
  90. exhibition: {id:'0',name: ''},
  91. },
  92. validation: {
  93. select_year: true,
  94. select_month: true,
  95. exhibition_name: true,
  96. },
  97. errors: null,
  98. };
  99. },
  100. methods: {
  101. reset() {
  102. this.formData = {
  103. select_year: "0",
  104. select_month: "0",
  105. exhibition_name: "0",
  106. exhibition: {id:'0',name: ''},
  107. };
  108. },
  109. validators() {
  110. // if (is.empty(this.formData.select_year) || this.formData.select_year =="0") {
  111. // this.validation.select_year = false;
  112. // } else {
  113. // this.validation.select_year = true;
  114. // }
  115. // if (is.empty(this.formData.select_month) || this.formData.select_month =="0") {
  116. // this.validation.select_month = false;
  117. // } else {
  118. // this.validation.select_month = true;
  119. // }
  120. if (is.empty(this.formData.exhibition_name) || this.formData.exhibition_name =="0") {
  121. this.validation.exhibition_name = false;
  122. } else {
  123. this.validation.exhibition_name = true;
  124. }
  125. this.errors = Object.entries(this.validation).filter(
  126. (e) => e[1] == false
  127. );
  128. if (this.errors.length > 0) {
  129. return false;
  130. } else {
  131. return true;
  132. }
  133. },
  134. selectYear(value){
  135. this.formData.select_year = value;
  136. this.getExhibitions();
  137. },
  138. selectMonth(value){
  139. this.formData.select_month = value;
  140. this.getExhibitions();
  141. },
  142. selectExhibition(value){
  143. if(this.selectExhibitionList.length>0){
  144. for(let i=0;i<this.selectExhibitionList.length;i++){
  145. if(this.selectExhibitionList[i].id == value){
  146. this.formData.selectPackape = this.selectExhibitionList[i];
  147. break;
  148. }
  149. }
  150. }
  151. this.formData.exhibition_name = value;
  152. },
  153. getExhibitions(){
  154. this.selectExhibitionList = [];
  155. let select_year = "";
  156. let select_month = "";
  157. if(this.formData.select_year!="0" && this.formData.select_year!=""){
  158. select_year = this.formData.select_year;
  159. }
  160. if(this.formData.select_month!="0" && this.formData.select_month!=""){
  161. select_month = this.formData.select_month;
  162. }
  163. this.$axios.get(`/trending/api/Onsite/Exhibitions?Lang=${this.$i18n.localeProperties["langQuery"]}&ServiceID=${this.$route.params.id}&Year=${select_year}&Month=${select_month}`)
  164. .then((response) => {
  165. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  166. let data = response.data.DATA.rel
  167. if(data.length>0){
  168. this.selectExhibitionList = data.map((item) => {
  169. return {
  170. id: item.ArgumentID,
  171. name: item.ArgumentValue,
  172. };
  173. });
  174. }
  175. }
  176. })
  177. .catch((error) => console.log(error));
  178. }
  179. },
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. select {
  184. -moz-appearance: none;
  185. /* Firefox */
  186. -webkit-appearance: none;
  187. /* Safari and Chrome */
  188. appearance: none;
  189. background-image: url("~/assets/svg/down-arrow.svg");
  190. background-size: 9px 6px;
  191. background-position: right 20px center;
  192. background-repeat: no-repeat;
  193. }
  194. </style>