Advertisement
vitareinforce

original item asssembly

Feb 3rd, 2020
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.60 KB | None | 0 0
  1. <template>
  2. <div class="dashboard-contents">
  3. <div class="row">
  4. <div class="col-lg-6" style="margin-top: 20px;">
  5. <h2 style="padding:15px; margin-top: 10px;">Item Perakitan</h2>
  6. </div>
  7. <div class="col-lg-6" style="padding-top: 15px; margin-top: 20px;">
  8. <div class="row">
  9. <div class="col-lg-9"></div>
  10. <div class="col-lg-3">
  11. <download-excel class="btn waves-effect waves-circle waves-float pull-right button-export"
  12. worksheet = "Daftar Item Perakitan"
  13. name = "data_item_assembly.xls"
  14. :data = "exportData">
  15. <img src="@/assets/images/file-text.png" alt="Alternate Text" /> Export
  16. </download-excel>
  17. </div>
  18. <!-- <div class="col-lg-4">
  19. <router-link :to="{name: 'AssemblerManagement.create'}" type="button" class="btn waves-effect waves-circle waves-float pull-right" style="width: 132px; height: 45px; background-color: #20c197; color:white; border-radius: 5px;">
  20. <img src="@/assets/images/plus-circle.png" alt="Alternate Text" /> Tambah
  21. </router-link>
  22. </div> -->
  23. </div>
  24. </div>
  25. </div>
  26.  
  27. <div class="row">
  28. <div class="col-lg-12 second-row">
  29. <div class="row">
  30. <div class="col-lg-10"></div>
  31. <div class="col-lg-2 search-div">
  32. <input type="text" name="permission" placeholder="Cari item perakitan..." ng-model="query" value="" style="width: 100%; height: 34px; float: right; margin-bottom: 10px; border: 1px solid rgba(184, 55, 62, 0.5); background-color: white; border-radius: 5px; padding: 5px; margin-bottom: 24px;" />
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37.  
  38. <div class="row">
  39. <div class="col-lg-12">
  40. <div class="table-div">
  41. <table class="table table-hover table-striped">
  42. <thead style="text-align:center;">
  43. <tr>
  44. <!-- <th style="text-align:center; border-right: 1px solid rgba(240, 237, 237, 1); border-left: 1px solid rgba(240, 237, 237, 1);">
  45. <div style="margin-bottom: 10px;">
  46. Actions <img src="@/assets/images/Down arrow small.png" alt="Alternate Text" />
  47. </div>
  48. <div>
  49. <input readonly type="text" style="width: 90%; margin-bottom: 10px; border: none; background-color: white; border-radius: 5px; padding: 5px; cursor: default;" />
  50. </div>
  51. </th> -->
  52. <th style="text-align:center; border-right: 1px solid rgba(240, 237, 237, 1)">
  53. <div style="margin-bottom: 10px;">
  54. Nomor Perakitan <img src="@/assets/images/Down arrow small.png" alt="Alternate Text" />
  55. </div>
  56. <div>
  57. <input type="text" ng-model="query.createdDate" value="" style="width: 90%; margin-bottom: 10px; border: 1px solid rgba(184, 55, 62, 0.5); background-color: #F0eded; border-radius: 5px; padding: 5px;" />
  58. </div>
  59. </th>
  60. <th style="text-align:center; border-right: 1px solid rgba(240, 237, 237, 1)">
  61. <div style="margin-bottom: 10px;">
  62. Nama Barang <img src="@/assets/images/Down arrow small.png" alt="Alternate Text" />
  63. </div>
  64. <div>
  65. <input type="text" ng-model="query.createdDate" value="" style="width: 90%; margin-bottom: 10px; border: 1px solid rgba(184, 55, 62, 0.5); background-color: #F0eded; border-radius: 5px; padding: 5px;" />
  66. </div>
  67. </th>
  68. <th style="text-align:center; border-right: 1px solid rgba(240, 237, 237, 1)">
  69. <div style="margin-bottom: 10px;">
  70. Belum Dirakit <img src="@/assets/images/Down arrow small.png" alt="Alternate Text" />
  71. </div>
  72. <div>
  73. <input type="text" ng-model="query.createdDate" value="" style="width: 90%; margin-bottom: 10px; border: 1px solid rgba(184, 55, 62, 0.5); background-color: #F0eded; border-radius: 5px; padding: 5px;" />
  74. </div>
  75. </th>
  76. <th style="text-align:center; border-right: 1px solid rgba(240, 237, 237, 1)">
  77. <div style="margin-bottom: 10px;">
  78. Sudah Dirakit <img src="@/assets/images/Down arrow small.png" alt="Alternate Text" />
  79. </div>
  80. <div>
  81. <input type="text" ng-model="query.createdDate" value="" style="width: 90%; margin-bottom: 10px; border: 1px solid rgba(184, 55, 62, 0.5); background-color: #F0eded; border-radius: 5px; padding: 5px;" />
  82. </div>
  83. </th>
  84. </tr>
  85. </thead>
  86. <tbody>
  87. <tr v-for="item in itemAssembly" :key="item.Id">
  88. <!-- <td style="padding-top: 18px; text-align:center;">
  89. <div class="btn-group">
  90. <b-dropdown text="Action" variant="primary" style="width: 120px;">
  91. <b-dropdown-item><router-link :to="{ name: 'ItemAssemblyManagement.edit', params:{ id: item.Id } }">Edit</router-link></b-dropdown-item>
  92. <b-dropdown-item @click="del(item.Id)">Delete</b-dropdown-item>
  93. </b-dropdown>
  94. </div>
  95. </td> -->
  96. <td style="border-right: 1px solid rgba(240, 237, 237, 1); padding-top: 18px;">{{ item.Code }}</td>
  97. <td style="border-right: 1px solid rgba(240, 237, 237, 1); padding-top: 18px;">
  98. <!-- <router-link :to="{ name: 'ItemAssemblyManagement.detail', params:{ id: item.Id } }" style="cursor: pointer;">{{ item.Name }}</router-link> -->
  99. {{ item.Name }}
  100. </td>
  101. <td style="border-right: 1px solid rgba(240, 237, 237, 1); padding-top: 18px;">{{ item.UnasemblyQuantity }}</td>
  102. <td style="border-right: 1px solid rgba(240, 237, 237, 1); padding-top: 18px;">{{ item.AssemblyQuantity }}</td>
  103. </tr>
  104. </tbody>
  105. </table>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </template>
  111.  
  112. <script>
  113. import moment from 'moment'
  114. import $ from 'jquery'
  115. import DownloadExcel from 'vue-json-excel'
  116.  
  117. import LegalEntities from '@/services/Companies/LegalEntities'
  118. import Branches from '@/services/Companies/Branches'
  119. import Inventories from '@/services/Inventories/Inventory'
  120.  
  121. export default {
  122. name: 'ItemAssemblyManagement.index',
  123. components: {
  124. DownloadExcel
  125. },
  126. computed: {
  127. itemAssembly: function () {
  128. return this.inventory.filter(i => i.isAssembly == 1)
  129. }
  130. },
  131. data () {
  132. return {
  133. exportData: [],
  134. userData: {},
  135. legalEntity: [],
  136. branch: [],
  137. inventory: []
  138. }
  139. },
  140. created: function () {
  141. this.init()
  142. },
  143. mounted: function () {
  144. window.$ = $
  145. if(localStorage.userData !== undefined) {
  146. this.userData = JSON.parse(localStorage.userData)
  147. } else {
  148. this.$router.push({ name: 'home' })
  149. location.reload()
  150. }
  151. },
  152. methods: {
  153. init: async function () {
  154. let result = await Inventories.index()
  155. let legalEntity = await LegalEntities.index()
  156. let branch = await Branches.index()
  157.  
  158. this.inventory = result.data
  159. this.legalEntity = this.itemLookup(legalEntity.data)
  160. this.branch = this.itemLookup(branch.data)
  161. },
  162. itemLookup: function (json) {
  163. let data = []
  164. for(var i = 0; i< json.length; i++) {
  165. data[json[i].Id] = json[i]
  166. }
  167. return data
  168. },
  169. formatDate(time) {
  170. var formattedTime = moment(time).format('DD MMMM YYYY HH:mm')
  171. if(formattedTime == 'Invalid date') {
  172. formattedTime = '-'
  173. }
  174. return formattedTime
  175. },
  176. del: async function (id) {
  177. this.$fire({
  178. text: "Apakah anda yakin ingin menghapus item ini?",
  179. type: "warning",
  180. showCancelButton: true,
  181. confirmButtonText: 'Ya',
  182. cancelButtonText: 'Tidak',
  183. }).then(() => {
  184. if(result.status == 200) {
  185. // alert(result.data.message)
  186. this.$router.push({ name: 'ItemAssemblyManagement.index' })
  187. location.reload()
  188. } else {
  189. alert("Delete Gagal")
  190. location.reload()
  191. }
  192. })
  193. let result = await Inventories.delete(id)
  194. }
  195. }
  196. }
  197. </script>
  198.  
  199. <style>
  200. .table-div {
  201. padding-left: 30px;
  202. margin-left: 0px !important;
  203. overflow-x: auto;
  204. overflow-y: auto;
  205. }
  206.  
  207. .second-row {
  208. margin-top: 30px;
  209. padding-left: 30px;
  210. }
  211.  
  212. .select-dropdown {
  213. width: 100%;
  214. height: 45px;
  215. border-color: #0059aa;
  216. border-radius: 5px;
  217. }
  218.  
  219. .button-export {
  220. width: 100%;
  221. height: 45px;
  222. background-color: #0059aa;
  223. color:white;
  224. border-radius: 5px;
  225. }
  226.  
  227. .button-create {
  228. width: 100%;
  229. height: 45px;
  230. background-color: #20c197;
  231. color:white;
  232. border-radius: 5px;
  233. }
  234. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement