Advertisement
vitareinforce

original ledger

Feb 3rd, 2020
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.58 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;">Buku Besar</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-3"></div>
  10. <div class="col-lg-3">
  11. <select class="select-dropdown" name="" id="">
  12. <option value="" disabled selected>Pilih bendera...</option>
  13. <option value="Semua cabang">Semua bendera</option>
  14. <option value="Cabang A">Bendera A</option>
  15. <option value="Cabang B">Bendera B</option>
  16. </select>
  17. </div>
  18. <div class="col-lg-3">
  19. <select class="select-dropdown" name="" id="">
  20. <option value="" disabled selected>Pilih cabang...</option>
  21. <option value="Semua cabang">Semua cabang</option>
  22. <option value="Cabang A">Cabang A</option>
  23. <option value="Cabang B">Cabang B</option>
  24. </select>
  25. </div>
  26. <div class="col-lg-3">
  27. <download-excel class="btn waves-effect waves-circle waves-float pull-right button-export"
  28. worksheet = "Daftar Kehadiran"
  29. name = "data_kehadiran.xls"
  30. :data = "exportData">
  31. <img src="@/assets/images/file-text.png" alt="Alternate Text" /> Export
  32. </download-excel>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37.  
  38. <div class="row">
  39. <div class="col-lg-12 second-row">
  40. <div class="row">
  41. <div class="col-lg-10"></div>
  42. <div class="col-lg-2 search-div">
  43. <input type="text" name="permission" placeholder="Cari..." 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;" />
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48.  
  49. <div class="row">
  50. <div class="col-lg-12">
  51. <div class="table-div">
  52. <b-table striped hover
  53. id="Ledgers"
  54. :items="ledger"
  55. :fields="fields"
  56. style="margin-top: 10px;">
  57. <template v-slot:cell(Debit)="data">
  58. {{ data.item.Debit | currency }}
  59. </template>
  60. <template v-slot:cell(Credit)="data">
  61. {{ data.item.Credit | currency }}
  62. </template>
  63. <template v-slot:cell(Total)="data">
  64. {{ data.item.Total | currency }}
  65. </template>
  66. </b-table>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </template>
  72.  
  73. <script>
  74. import moment from 'moment'
  75. import $ from 'jquery'
  76. import DownloadExcel from 'vue-json-excel'
  77.  
  78. import Ledgers from '@/services/Accounting/Ledger'
  79. import LegalEntities from '@/services/Companies/LegalEntities'
  80. import Branches from '@/services/Companies/Branches'
  81.  
  82. export default {
  83. name: 'LedgerManagement.index',
  84. components: {
  85. DownloadExcel
  86. },
  87. data () {
  88. return {
  89. fields: [
  90. { key: 'created_at', label: 'Tanggal' },
  91. { key: 'DebitAccountSettingId', label: 'Kode Akun' },
  92. { key: 'DebitDescription', label: 'Deskripsi' },
  93. { key: 'Debit', label: 'Debit' },
  94. { key: 'CreditAccountSettingId', label: 'Kode Akun' },
  95. { key: 'CreditDescription', label: 'Deskripsi' },
  96. { key: 'Credit', label: 'Kredit' },
  97. ],
  98. exportData: [],
  99. userData: {},
  100. bill: [],
  101. roles: [],
  102. legalEntity: [],
  103. branch: [],
  104. ledger: []
  105. }
  106. },
  107. created: function () {
  108. this.init()
  109. },
  110. mounted: function () {
  111. window.$ = $
  112. if(localStorage.userData !== undefined) {
  113. this.userData = JSON.parse(localStorage.userData)
  114. } else {
  115. this.$router.push({ name: 'home' })
  116. location.reload()
  117. }
  118. },
  119. methods: {
  120. init: async function () {
  121. let legalEntity = await LegalEntities.index()
  122. let branch = await Branches.index()
  123. let result = await Ledgers.index()
  124.  
  125. this.ledger = result.data
  126. this.exportData = result.data
  127. this.legalEntity = this.itemLookup(legalEntity.data)
  128. this.branch = this.itemLookup(branch.data)
  129. },
  130. itemLookup: function (json) {
  131. let data = []
  132. for(var i = 0; i< json.length; i++) {
  133. data[json[i].Id] = json[i]
  134. }
  135. return data
  136. },
  137. formatDate(time) {
  138. var formattedTime = moment(time).format('DD MMMM YYYY HH:mm')
  139. if(formattedTime == 'Invalid date') {
  140. formattedTime = '-'
  141. }
  142. return formattedTime
  143. },
  144. detail: function (id) {
  145. this.$router.push({ name: 'LedgerManagement.detail', params: { id: id } })
  146. },
  147. edit: function (id) {
  148. this.$router.push({ name: 'LedgerManagement.edit', params: { id: id } })
  149. },
  150. del: async function (id) {
  151. let result = await Ledgers.delete(id)
  152. if(result.status == 200) {
  153. alert(result.data.message)
  154. this.$router.push({ name: 'LedgerManagement.index' })
  155. location.reload()
  156. } else {
  157. alert("Delete Gagal")
  158. location.reload()
  159. }
  160. }
  161. }
  162. }
  163. </script>
  164.  
  165. <style>
  166. .table-div {
  167. padding-left: 30px;
  168. margin-left: 0px !important;
  169. overflow-x: auto;
  170. overflow-y: auto;
  171. }
  172.  
  173. .second-row {
  174. margin-top: 30px;
  175. padding-left: 30px;
  176. }
  177.  
  178. .select-dropdown {
  179. width: 100%;
  180. height: 45px;
  181. border-color: #0059aa;
  182. border-radius: 5px;
  183. }
  184.  
  185. .button-export {
  186. width: 100%;
  187. height: 45px;
  188. background-color: #0059aa;
  189. color:white;
  190. border-radius: 5px;
  191. }
  192.  
  193. .button-create {
  194. width: 100%;
  195. height: 45px;
  196. background-color: #20c197;
  197. color:white;
  198. border-radius: 5px;
  199. }
  200. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement