show.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. <template>
  2. <div class="flex justify-end">
  3. <q-btn flat
  4. color="grey"
  5. @click="$router.go(-1)">
  6. بازگشت
  7. >
  8. </q-btn>
  9. </div>
  10. <q-card>
  11. <q-tabs v-model="tab"
  12. dense
  13. class="text-grey"
  14. active-color="primary"
  15. indicator-color="primary"
  16. align="justify"
  17. narrow-indicator>
  18. <q-tab name="userInfo"
  19. label="اطلاعات کاربری" />
  20. <q-tab name="educations"
  21. label="سوابق آموزشی" />
  22. <q-tab name="financial"
  23. label="سوابق مالی" />
  24. <!-- <q-tab name="movies2"-->
  25. <!-- label="سوابق دوره های مباحثاتی" />-->
  26. <q-tab name="events"
  27. label="سوابق رویدادها" />
  28. <!-- <q-tab name="movies4"-->
  29. <!-- label="سوابق باشگاه اندیشه جویان" />-->
  30. <q-tab name="movies5"
  31. label="درخواست مدرک و گواهی" />
  32. </q-tabs>
  33. <q-separator />
  34. <q-tab-panels v-model="tab"
  35. animated>
  36. <q-tab-panel name="userInfo">
  37. <entity-edit v-if="mounted"
  38. ref="entityEdit"
  39. v-model:value="inputs"
  40. title="اطلاعات کاربری"
  41. :api="api"
  42. :after-load-input-data="afterLoadInputData"
  43. :entity-id-key="entityIdKey"
  44. :default-layout="false"
  45. :show-close-button="false"
  46. :show-edit-button="false"
  47. :show-expand-button="false"
  48. :show-save-button="false"
  49. :show-reload-button="false">
  50. <template #after-form-builder>
  51. <div class="flex justify-end">
  52. <q-btn color="primary"
  53. label="بروزرسانی اطلاعات"
  54. @click="editEntity" />
  55. </div>
  56. </template>
  57. </entity-edit>
  58. </q-tab-panel>
  59. <q-tab-panel name="educations">
  60. <entity-index v-if="mounted"
  61. ref="registrationsList"
  62. v-model:value="registrationsListInputs"
  63. title="لیست دوره ها"
  64. :api="registrationsListApi"
  65. :table="registrationsListTable"
  66. :table-keys="registrationsListTableKeys"
  67. :show-search-button="false"
  68. :show-reload-button="false"
  69. :show-expand-button="false">
  70. <template v-slot:entity-index-table-cell="{inputData}">
  71. <template v-if="inputData.col.name === 'number'">
  72. {{ inputData.rowNumber }}
  73. </template>
  74. <template v-else-if="inputData.col.name === 'action'">
  75. <div class="action-column-entity-index">
  76. <q-btn color="primary"
  77. :to="{name: 'Admin.Classroom.UserClass', params: {user_id: $route.params.id, classroom_id: inputData.props.row.classroom_info.id}}"
  78. label="جزییات" />
  79. </div>
  80. </template>
  81. <template v-else>
  82. {{ inputData.col.value }}
  83. </template>
  84. </template>
  85. </entity-index>
  86. <q-skeleton v-else
  87. type="rect"
  88. height="200px" />
  89. </q-tab-panel>
  90. <q-tab-panel name="financial"
  91. class="q-pa-none">
  92. <q-tabs v-model="financialTab"
  93. dense
  94. class="text-grey"
  95. active-color="primary"
  96. indicator-color="primary"
  97. align="justify"
  98. narrow-indicator>
  99. <q-tab name="invoiceList"
  100. label="صورتحساب ها" />
  101. <q-tab name="paymentList"
  102. label="پرداخت ها" />
  103. <q-tab name="transactionList"
  104. label="تراکنش ها" />
  105. </q-tabs>
  106. <q-separator />
  107. <q-tab-panels v-model="financialTab"
  108. animated>
  109. <q-tab-panel name="invoiceList"
  110. class="q-pa-none">
  111. <entity-index v-if="mounted"
  112. ref="invoiceList"
  113. v-model:value="invoiceListInputs"
  114. title="لیست صورتحساب ها"
  115. :api="invoiceListApi"
  116. :table="invoiceListTable"
  117. :table-keys="invoiceListTableKeys"
  118. :show-search-button="false"
  119. :show-reload-button="false"
  120. :show-expand-button="false">
  121. <template v-slot:entity-index-table-cell="{inputData}">
  122. <template v-if="inputData.col.name === 'number'">
  123. {{ inputData.rowNumber }}
  124. </template>
  125. <template v-else-if="inputData.col.name === 'action'">
  126. <div class="action-column-entity-index">
  127. <q-btn color="primary"
  128. label="جزییات"
  129. :to="{name: 'Admin.Invoice.Show', params: {id: inputData.props.row.id}}" />
  130. </div>
  131. </template>
  132. <template v-else>
  133. {{ inputData.col.value }}
  134. </template>
  135. </template>
  136. </entity-index>
  137. </q-tab-panel>
  138. <q-tab-panel name="paymentList"
  139. class="q-pa-none">
  140. <entity-index v-if="mounted"
  141. ref="paymentList"
  142. v-model:value="paymentListInputs"
  143. title="لیست پرداخت ها"
  144. :api="paymentListApi"
  145. :table="paymentListTable"
  146. :table-keys="paymentListTableKeys"
  147. :show-search-button="false"
  148. :show-reload-button="false"
  149. :show-expand-button="false">
  150. <template v-slot:entity-index-table-cell="{inputData}">
  151. <template v-if="inputData.col.name === 'number'">
  152. {{ inputData.rowNumber }}
  153. </template>
  154. <template v-else-if="inputData.col.name === 'action'">
  155. <div class="action-column-entity-index">
  156. <q-btn color="primary"
  157. :to="{ name: 'Admin.Payment.Show', params: { id: inputData.props.row.id } }"
  158. label="جزییات" />
  159. </div>
  160. </template>
  161. <template v-else>
  162. {{ inputData.col.value }}
  163. </template>
  164. </template>
  165. </entity-index>
  166. </q-tab-panel>
  167. <q-tab-panel name="transactionList"
  168. class="q-pa-none">
  169. <entity-index v-if="mounted"
  170. ref="transactionList"
  171. v-model:value="transactionListInputs"
  172. title="لیست تراکنش ها"
  173. :api="transactionListApi"
  174. :table="transactionListTable"
  175. :table-keys="transactionListTableKeys"
  176. :show-search-button="false"
  177. :show-reload-button="false"
  178. :show-expand-button="false">
  179. <template v-slot:entity-index-table-cell="{inputData}">
  180. <template v-if="inputData.col.name === 'number'">
  181. {{ inputData.rowNumber }}
  182. </template>
  183. <template v-else-if="inputData.col.name === 'action'">
  184. <div class="action-column-entity-index">
  185. <q-btn color="primary"
  186. :to="{ name: 'Admin.Transaction.Show', params: { id: inputData.props.row.id } }"
  187. label="جزییات" />
  188. </div>
  189. </template>
  190. <template v-else>
  191. {{ inputData.col.value }}
  192. </template>
  193. </template>
  194. </entity-index>
  195. </q-tab-panel>
  196. </q-tab-panels>
  197. </q-tab-panel>
  198. <!-- <q-tab-panel name="movies2">-->
  199. <!-- سوابق باشگاه اندیشه جویان-->
  200. <!-- </q-tab-panel>-->
  201. <q-tab-panel name="events">
  202. <entity-index v-if="mounted"
  203. ref="eventRegistrationsList"
  204. v-model:value="eventRegistrationsListInputs"
  205. title="لیست رویداد ها"
  206. :api="eventRegistrationsListApi"
  207. :table="eventRegistrationsListTable"
  208. :table-keys="eventRegistrationsListTableKeys"
  209. :show-search-button="false"
  210. :show-reload-button="false"
  211. :show-expand-button="false">
  212. <template v-slot:entity-index-table-cell="{inputData}">
  213. <template v-if="inputData.col.name === 'number'">
  214. {{ inputData.rowNumber }}
  215. </template>
  216. <template v-else-if="inputData.col.name === 'action'">
  217. <div class="action-column-entity-index">
  218. <q-btn color="primary"
  219. :to="{name: 'Admin.Classroom.UserClass', params: {user_id: $route.params.id, classroom_id: inputData.props.row.classroom_info.id}}"
  220. label="جزییات" />
  221. </div>
  222. </template>
  223. <template v-else>
  224. {{ inputData.col.value }}
  225. </template>
  226. </template>
  227. </entity-index>
  228. </q-tab-panel>
  229. <!-- <q-tab-panel name="movies4">-->
  230. <!-- سوابق باشگاه اندیشه جویان-->
  231. <!-- </q-tab-panel>-->
  232. <q-tab-panel name="movies5">
  233. درخواست مدرک و گواهی
  234. </q-tab-panel>
  235. </q-tab-panels>
  236. </q-card>
  237. </template>
  238. <script>
  239. import Assist from 'assets/js/Assist.js'
  240. import Enums from 'src/assets/Enums/Enums.js'
  241. import { Invoice } from 'src/models/Invoice.js'
  242. import { Payment } from 'src/models/Payment.js'
  243. import { APIGateway } from 'src/api/APIGateway.js'
  244. import { Classroom } from 'src/models/Classroom.js'
  245. import { EntityEdit, EntityIndex } from 'quasar-crud'
  246. import { Transaction } from 'src/models/Transaction.js'
  247. import { Registration } from 'src/models/Registration.js'
  248. import { Provinces, Cities, getCitiesOfProvince } from 'src/assets/js/IranianCities.js'
  249. import { FormBuilderAssist } from 'quasar-form-builder'
  250. export default {
  251. name: 'Admin.User.Show',
  252. components: { EntityEdit, EntityIndex },
  253. data () {
  254. const userId = this.$route.params.id
  255. return {
  256. tab: 'userInfo',
  257. financialTab: 'invoiceList',
  258. inputDataLoaded: false,
  259. api: APIGateway.user.APIAdresses.byId(userId),
  260. mounted: false,
  261. entityIdKey: 'id',
  262. inputs: [
  263. { type: 'separator', name: 'space', label: 'نقش و وضعیت ها', className: 'custom-separator', col: 'col-12' },
  264. {
  265. type: 'select',
  266. name: 'roles',
  267. responseKey: 'roles',
  268. options: Enums.groups,
  269. multiple: true,
  270. label: 'نقش',
  271. placeholder: ' ',
  272. col: 'col-md-3 col-12'
  273. },
  274. { type: 'separator', name: 'space', placeholder: ' ', label: 'اطلاعات ضروری', className: 'custom-separator', col: 'col-12' },
  275. { type: 'input', name: 'email', placeholder: ' ', label: 'ایمیل', responseKey: 'email', col: 'col-md-3 col-12' },
  276. { type: 'input', name: 'mobile_number', placeholder: ' ', label: 'تلفن همراه', responseKey: 'mobile_number', col: 'col-md-3 col-12' },
  277. { type: 'optionGroupRadio', name: 'is_valid_national_code', responseKey: 'is_valid_national_code', label: 'اتباع خارجی', options: [{ label: 'نیست', value: true }, { label: 'هست', value: false }], value: true, col: 'col-md-3 col-12' },
  278. { type: 'input', name: 'national_code', placeholder: ' ', label: 'کدملی/کد اتباع غیر ایرانی', responseKey: 'national_code', col: 'col-md-3 col-12' },
  279. { type: 'separator', name: 'space', label: 'اطلاعات پروفایل', className: 'custom-separator', col: 'col-12' },
  280. { type: 'file', name: 'picture', placeholder: ' ', label: 'عکس پروفایل', responseKey: 'picture', col: 'col-md-3 col-12' },
  281. { type: 'separator', name: 'space', size: '0', col: 'col-12' },
  282. { type: 'input', name: 'firstname', placeholder: ' ', label: 'نام', responseKey: 'firstname', col: 'col-md-3 col-12' },
  283. { type: 'input', name: 'lastname', placeholder: ' ', label: 'نام خانوادگی', responseKey: 'lastname', col: 'col-md-3 col-12' },
  284. {
  285. type: 'select',
  286. name: 'gender',
  287. responseKey: 'gender',
  288. options: Enums.genders,
  289. value: null,
  290. label: 'جنسیت',
  291. placeholder: ' ',
  292. col: 'col-md-3 col-12'
  293. },
  294. { type: 'date', name: 'birthdate', outsideLabel: 'تولد', responseKey: 'birthdate', col: 'col-md-3 col-12' },
  295. {
  296. type: 'select',
  297. name: 'marital_status',
  298. responseKey: 'marital_status',
  299. options: Enums.maritalStatuses,
  300. value: null,
  301. label: 'وضعیت تاهل',
  302. placeholder: ' ',
  303. col: 'col-md-3 col-12'
  304. },
  305. { type: 'input', name: 'on_call_mobile_number', placeholder: ' ', label: 'تلفن همراه جهت تماس', responseKey: 'on_call_mobile_number', col: 'col-md-3 col-12' },
  306. { type: 'input', name: 'on_social_network_mobile_number', placeholder: ' ', label: 'تلفن همراه جهت شبکه های اجتماعی', responseKey: 'on_social_network_mobile_number', col: 'col-md-3 col-12' },
  307. { type: 'input', name: 'phone_number', placeholder: ' ', label: 'تلفن منزل', responseKey: 'phone_number', col: 'col-md-3 col-12' },
  308. {
  309. type: 'select',
  310. name: 'last_academic_degree',
  311. responseKey: 'last_academic_degree',
  312. options: Enums.academicDegree,
  313. value: null,
  314. label: 'آخرین مقطع تحصیلی',
  315. placeholder: ' ',
  316. col: 'col-md-3 col-12'
  317. },
  318. { type: 'input', name: 'last_academic_degree_field', placeholder: ' ', label: 'رشته تحصیلی', responseKey: 'last_academic_degree_field', col: 'col-md-3 col-12' },
  319. { type: 'input', name: 'last_academy_name', placeholder: ' ', label: 'نام دانشگاه یا حوزه تحصیلی', responseKey: 'last_academy_name', col: 'col-md-3 col-12' },
  320. {
  321. type: 'select',
  322. name: 'educational_status',
  323. responseKey: 'educational_status',
  324. options: Enums.educationalStatus,
  325. value: null,
  326. label: 'وضعیت تحصیلی',
  327. placeholder: ' ',
  328. col: 'col-md-3 col-12'
  329. },
  330. { type: 'checkbox', name: 'is_abroad_birth_address', placeholder: ' ', label: 'محل تولد خارج از کشور است؟', responseKey: 'is_abroad_birth_address', className: 'require', col: 'col-12' },
  331. { type: 'input', name: 'birth_country', placeholder: ' ', label: 'کشور محل تولد', responseKey: 'birth_country', col: 'col-md-4 col-12' },
  332. {
  333. type: 'select',
  334. name: 'birth_province',
  335. options: Provinces,
  336. optionLabel: 'name',
  337. optionValue: 'name',
  338. createNewValue: true,
  339. newValueMode: 'add-unique',
  340. placeholder: ' ',
  341. label: 'استان محل تولد',
  342. responseKey: 'birth_province',
  343. col: 'col-md-4 col-12'
  344. },
  345. {
  346. type: 'select',
  347. name: 'birth_city',
  348. options: Cities,
  349. optionLabel: 'name',
  350. optionValue: 'name',
  351. createNewValue: true,
  352. newValueMode: 'add-unique',
  353. placeholder: ' ',
  354. label: 'شهر محل تولد',
  355. responseKey: 'birth_city',
  356. col: 'col-md-4 col-12'
  357. },
  358. { type: 'checkbox', name: 'is_abroad_living_address', placeholder: ' ', label: 'محل زندگی فعلی خارج از کشور است؟', responseKey: 'is_abroad_living_address', className: 'require', col: 'col-12' },
  359. { type: 'input', name: 'living_country', placeholder: ' ', label: 'کشور محل زندگی فعلی', responseKey: 'living_country', col: 'col-md-4 col-12' },
  360. {
  361. type: 'select',
  362. name: 'living_province',
  363. options: Provinces,
  364. optionLabel: 'name',
  365. optionValue: 'name',
  366. createNewValue: true,
  367. newValueMode: 'add-unique',
  368. placeholder: ' ',
  369. label: 'استان محل زندگی فعلی',
  370. responseKey: 'living_province',
  371. col: 'col-md-4 col-12'
  372. },
  373. {
  374. type: 'select',
  375. name: 'living_city',
  376. options: Cities,
  377. optionLabel: 'name',
  378. optionValue: 'name',
  379. createNewValue: true,
  380. newValueMode: 'add-unique',
  381. placeholder: ' ',
  382. label: 'شهر محل زندگی فعلی',
  383. responseKey: 'living_city',
  384. col: 'col-md-4 col-12'
  385. },
  386. { type: 'input', name: 'living_postal_code', placeholder: ' ', label: 'کد پستی محل زندگی', responseKey: 'living_postal_code', col: 'col-md-3 col-12' },
  387. { type: 'input', name: 'living_address', placeholder: ' ', label: 'آدرس پستی محل زندگی', responseKey: 'living_address', col: 'col-md-6 col-12' },
  388. { type: 'hidden', name: 'id', responseKey: 'id', label: 'id', col: 'col-12' },
  389. { type: 'hidden', name: 'is_active', responseKey: 'is_active', label: 'is_active', col: 'col-12' }
  390. ],
  391. registrationsListInputs: [
  392. { type: 'hidden', name: 'owner', value: userId },
  393. { type: 'hidden', name: 'classroom__unit__category__type', value: 'TRAINING' }
  394. ],
  395. registrationsListApi: APIGateway.registration.APIAdresses.base,
  396. registrationsListTable: {
  397. columns: [
  398. {
  399. name: 'number',
  400. required: true,
  401. label: 'شماره',
  402. align: 'left',
  403. field: () => ''
  404. },
  405. {
  406. name: 'id',
  407. required: true,
  408. label: 'شناسه',
  409. align: 'left',
  410. field: row => row.id
  411. },
  412. {
  413. name: 'classroom_info.unit_info.title',
  414. required: true,
  415. label: 'عنوان',
  416. align: 'left',
  417. field: row => row.classroom_info.title
  418. },
  419. {
  420. name: 'classroom_info.holding_type_info.label',
  421. required: true,
  422. label: 'نوع برگزاری',
  423. align: 'left',
  424. field: row => (new Classroom(row.classroom_info)).holding_type_info.label
  425. },
  426. {
  427. name: 'classroom_info.professor_info',
  428. required: true,
  429. label: 'استاد',
  430. align: 'left',
  431. field: row => row.classroom_info.professor_info.firstname + ' ' + row.classroom_info.professor_info.lastname
  432. },
  433. {
  434. name: 'classroom_info.sessions_info.length',
  435. required: true,
  436. label: 'تعداد جلسات',
  437. align: 'left',
  438. field: row => row.classroom_info?.sessions_info?.length
  439. },
  440. {
  441. name: 'id',
  442. required: true,
  443. label: 'وضعیت',
  444. align: 'left',
  445. field: row => (new Registration(row)).status_info.label
  446. },
  447. {
  448. name: 'creation_time',
  449. required: true,
  450. label: 'زمان ثبت نام',
  451. align: 'left',
  452. field: row => Assist.miladiToShamsi(row.creation_time)
  453. },
  454. {
  455. name: 'id',
  456. required: true,
  457. label: 'وضعیت مالی',
  458. align: 'left',
  459. field: row => (new Invoice(row.invoice_info)).status_info.label
  460. },
  461. {
  462. name: 'action',
  463. required: true,
  464. label: 'جزییات',
  465. align: 'left',
  466. field: ''
  467. }
  468. ],
  469. data: []
  470. },
  471. registrationsListTableKeys: {
  472. data: 'results',
  473. total: 'count',
  474. currentPage: 'current',
  475. perPage: 'per_page',
  476. pageKey: 'page'
  477. },
  478. eventRegistrationsListInputs: [
  479. { type: 'hidden', name: 'owner', value: userId },
  480. { type: 'hidden', name: 'classroom__unit__category__type', value: 'EVENT' }
  481. ],
  482. eventRegistrationsListApi: APIGateway.registration.APIAdresses.base,
  483. eventRegistrationsListTable: {
  484. columns: [
  485. {
  486. name: 'number',
  487. required: true,
  488. label: 'شماره',
  489. align: 'left',
  490. field: () => ''
  491. },
  492. {
  493. name: 'id',
  494. required: true,
  495. label: 'شناسه',
  496. align: 'left',
  497. field: row => row.id
  498. },
  499. {
  500. name: 'classroom_info.unit_info.title',
  501. required: true,
  502. label: 'عنوان',
  503. align: 'left',
  504. field: row => row.classroom_info.title
  505. },
  506. {
  507. name: 'classroom_info.professor_info',
  508. required: true,
  509. label: 'استاد',
  510. align: 'left',
  511. field: row => row.classroom_info.professor_info.firstname + ' ' + row.classroom_info.professor_info.lastname
  512. },
  513. {
  514. name: 'classroom_info.sessions_info.length',
  515. required: true,
  516. label: 'تعداد جلسات',
  517. align: 'left',
  518. field: row => row.classroom_info?.sessions_info?.length
  519. },
  520. {
  521. name: 'id',
  522. required: true,
  523. label: 'وضعیت',
  524. align: 'left',
  525. field: row => (new Registration(row)).status_info.label
  526. },
  527. {
  528. name: 'creation_time',
  529. required: true,
  530. label: 'زمان ثبت نام',
  531. align: 'left',
  532. field: row => Assist.miladiToShamsi(row.creation_time)
  533. },
  534. {
  535. name: 'id',
  536. required: true,
  537. label: 'وضعیت مالی',
  538. align: 'left',
  539. field: row => (new Invoice(row.invoice_info)).status_info.label
  540. },
  541. {
  542. name: 'action',
  543. required: true,
  544. label: 'جزییات',
  545. align: 'left',
  546. field: ''
  547. }
  548. ],
  549. data: []
  550. },
  551. eventRegistrationsListTableKeys: {
  552. data: 'results',
  553. total: 'count',
  554. currentPage: 'current',
  555. perPage: 'per_page',
  556. pageKey: 'page'
  557. },
  558. registrationsActivitySheetListInputs: [
  559. { type: 'hidden', name: 'owner', value: userId }
  560. ],
  561. registrationsActivitySheetListApi: APIGateway.classroom.APIAdresses.activitySheet,
  562. registrationsActivitySheetListTable: {
  563. columns: [
  564. {
  565. name: 'number',
  566. required: true,
  567. label: 'شماره',
  568. align: 'left',
  569. field: () => ''
  570. },
  571. {
  572. name: 'id',
  573. required: true,
  574. label: 'شناسه',
  575. align: 'left',
  576. field: row => row.id
  577. },
  578. {
  579. name: 'classroom_info.item_type_info',
  580. required: true,
  581. label: 'نوع',
  582. align: 'left',
  583. field: row => (new Classroom(row.classroom_info)).item_type_info.label
  584. },
  585. {
  586. name: 'classroom_info.unit_info.title',
  587. required: true,
  588. label: 'نام درس',
  589. align: 'left',
  590. field: row => row.classroom_info?.unit_info?.title
  591. },
  592. {
  593. name: 'classroom_infoaudience_gender_type_info',
  594. required: true,
  595. label: 'جنسیت',
  596. align: 'left',
  597. field: row => (new Classroom(row.classroom_info)).audience_gender_type_info.label
  598. },
  599. {
  600. name: 'holding_time',
  601. required: true,
  602. label: 'تاریخ شروع',
  603. align: 'left',
  604. field: row => row.classroom_info?.holding_month + ' ' + row.classroom_info?.holding_year
  605. },
  606. {
  607. name: 'classroom_info.holding_type_info.label',
  608. required: true,
  609. label: 'نوع برگزاری',
  610. align: 'left',
  611. field: row => (new Classroom(row.classroom_info)).holding_type_info.label
  612. },
  613. {
  614. name: 'classroom_info.professor_info',
  615. required: true,
  616. label: 'استاد',
  617. align: 'left',
  618. field: row => row.classroom_info?.professor_info?.firstname + ' ' + row.classroom_info?.professor_info?.lastname
  619. },
  620. {
  621. name: 'classroom_info.sessions_info.length',
  622. required: true,
  623. label: 'تعداد جلسات',
  624. align: 'left',
  625. field: row => row.classroom_info?.sessions_info ? row.classroom_info.sessions_info.length : '-'
  626. },
  627. {
  628. name: 'id',
  629. required: true,
  630. label: 'وضعیت',
  631. align: 'left',
  632. field: row => (new Registration(row)).status_info.label
  633. },
  634. {
  635. name: 'creation_time',
  636. required: true,
  637. label: 'زمان ثبت نام',
  638. align: 'left',
  639. field: row => Assist.miladiToShamsi(row.creation_time)
  640. },
  641. {
  642. name: 'id',
  643. required: true,
  644. label: 'وضعیت مالی',
  645. align: 'left',
  646. field: row => (new Invoice(row.invoice_info)).status_info.label
  647. },
  648. {
  649. name: 'action',
  650. required: true,
  651. label: 'جزییات',
  652. align: 'left',
  653. field: ''
  654. }
  655. ],
  656. data: []
  657. },
  658. registrationsActivitySheetListTableKeys: {
  659. data: 'results',
  660. total: 'count',
  661. currentPage: 'current',
  662. perPage: 'per_page',
  663. pageKey: 'page'
  664. },
  665. invoiceListInputs: [
  666. { type: 'hidden', name: 'owner', value: userId }
  667. ],
  668. invoiceListApi: APIGateway.invoice.APIAdresses.base,
  669. invoiceListTable: {
  670. columns: [
  671. {
  672. name: 'number',
  673. required: true,
  674. label: 'شماره',
  675. align: 'left',
  676. field: () => ''
  677. },
  678. {
  679. name: 'id',
  680. required: true,
  681. label: 'شناسه',
  682. align: 'left',
  683. field: row => row.id
  684. },
  685. {
  686. name: 'id',
  687. required: true,
  688. label: 'سفارش دهنده',
  689. align: 'left',
  690. field: row => row.owner_info.firstname + ' ' + row.owner_info.lastname
  691. },
  692. {
  693. name: 'id',
  694. required: true,
  695. label: 'کدملی سفارش دهنده',
  696. align: 'left',
  697. field: row => row.owner_info.national_code
  698. },
  699. {
  700. name: 'id',
  701. required: true,
  702. label: 'عنوان',
  703. align: 'left',
  704. field: row => row.title
  705. },
  706. {
  707. name: 'amount',
  708. required: true,
  709. label: 'مبلغ تراکنش(ریال)',
  710. align: 'left',
  711. field: row => row.amount.toLocaleString('fa')
  712. },
  713. {
  714. name: 'id',
  715. required: true,
  716. label: 'وضعیت تراکنش',
  717. align: 'left',
  718. field: row => (new Invoice(row)).status_info.label
  719. },
  720. {
  721. name: 'creation_time',
  722. required: true,
  723. label: 'زمان ثبت',
  724. align: 'left',
  725. field: row => Assist.miladiToShamsi(row.creation_time)
  726. },
  727. {
  728. name: 'last_modification_time',
  729. required: true,
  730. label: 'زمان آخرین بروز رسانی',
  731. align: 'left',
  732. field: row => Assist.miladiToShamsi(row.last_modification_time)
  733. },
  734. {
  735. name: 'action',
  736. required: true,
  737. label: 'جزییات',
  738. align: 'left',
  739. field: row => ''
  740. }
  741. ]
  742. },
  743. invoiceListTableKeys: {
  744. data: 'results',
  745. total: 'count',
  746. currentPage: 'current',
  747. perPage: 'per_page',
  748. pageKey: 'page'
  749. },
  750. paymentListInputs: [
  751. { type: 'hidden', name: 'owner', value: userId }
  752. ],
  753. paymentListApi: APIGateway.payment.APIAdresses.base,
  754. paymentListTable: {
  755. columns: [
  756. {
  757. name: 'number',
  758. required: true,
  759. label: 'شماره',
  760. align: 'left',
  761. field: () => ''
  762. },
  763. {
  764. name: 'id',
  765. required: true,
  766. label: 'شناسه',
  767. align: 'left',
  768. field: row => row.id
  769. },
  770. {
  771. name: 'invoice_info.title',
  772. required: true,
  773. label: 'عنوان',
  774. align: 'left',
  775. field: row => row.invoice_info?.title
  776. },
  777. {
  778. name: 'type',
  779. required: true,
  780. label: 'نوع تراکنش',
  781. align: 'left',
  782. field: row => (new Payment(row)).type_info.label
  783. },
  784. {
  785. name: 'amount',
  786. required: true,
  787. label: 'مبلغ تراکنش (ریال)',
  788. align: 'left',
  789. field: row => row.amount.toLocaleString('fa')
  790. },
  791. {
  792. name: 'creation_time',
  793. required: true,
  794. label: 'زمان',
  795. align: 'left',
  796. field: row => Assist.miladiToShamsi(row.creation_time)
  797. },
  798. {
  799. name: 'action',
  800. required: true,
  801. label: 'جزییات',
  802. align: 'left',
  803. field: row => ''
  804. }
  805. ]
  806. },
  807. paymentListTableKeys: {
  808. data: 'results',
  809. total: 'count',
  810. currentPage: 'current',
  811. perPage: 'per_page',
  812. pageKey: 'page'
  813. },
  814. transactionListInputs: [
  815. { type: 'hidden', name: 'owner', value: userId }
  816. ],
  817. transactionListApi: APIGateway.transaction.APIAdresses.base,
  818. transactionListTable: {
  819. columns: [
  820. {
  821. name: 'number',
  822. required: true,
  823. label: 'شماره',
  824. align: 'left',
  825. field: () => ''
  826. },
  827. {
  828. name: 'id',
  829. required: true,
  830. label: 'شناسه',
  831. align: 'left',
  832. field: row => row.id
  833. },
  834. {
  835. name: 'amount',
  836. required: true,
  837. label: 'مبلغ تراکنش (ریال)',
  838. align: 'left',
  839. field: row => row.amount.toLocaleString('fa')
  840. },
  841. {
  842. name: 'description',
  843. required: true,
  844. label: 'توضیحات',
  845. align: 'left',
  846. field: row => row.description
  847. },
  848. {
  849. name: 'reference_code',
  850. required: true,
  851. label: 'کد مرجع',
  852. align: 'left',
  853. field: row => row.reference_code
  854. },
  855. {
  856. name: 'status',
  857. required: true,
  858. label: 'وضعیت',
  859. align: 'left',
  860. field: row => (new Transaction(row)).status_info.label
  861. },
  862. {
  863. name: 'creation_time',
  864. required: true,
  865. label: 'تاریخ ایجاد',
  866. align: 'left',
  867. field: row => Assist.miladiToShamsi(row.creation_time)
  868. },
  869. {
  870. name: 'action',
  871. required: true,
  872. label: 'جزییات',
  873. align: 'left',
  874. field: row => ''
  875. }
  876. ]
  877. },
  878. transactionListTableKeys: {
  879. data: 'results',
  880. total: 'count',
  881. currentPage: 'current',
  882. perPage: 'per_page',
  883. pageKey: 'page'
  884. }
  885. }
  886. },
  887. computed: {
  888. isAbroadBirthAddress () {
  889. return FormBuilderAssist.getInputsByName(this.inputs, 'is_abroad_birth_address').value
  890. },
  891. isAbroadLivingAddress () {
  892. return FormBuilderAssist.getInputsByName(this.inputs, 'is_abroad_living_address').value
  893. },
  894. selectedBirthProvince () {
  895. return FormBuilderAssist.getInputsByName(this.inputs, 'birth_province').value
  896. },
  897. selectedLivingProvince () {
  898. return FormBuilderAssist.getInputsByName(this.inputs, 'living_province').value
  899. }
  900. },
  901. watch: {
  902. isAbroadBirthAddress (newValue) {
  903. if (!newValue) {
  904. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'value', 'ایران')
  905. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'disable', true)
  906. if (this.inputDataLoaded) {
  907. // province
  908. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'type', 'select')
  909. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'disable', false)
  910. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'value', null)
  911. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'options', Provinces)
  912. // city
  913. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'select')
  914. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', true)
  915. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
  916. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'options', [])
  917. }
  918. } else {
  919. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'value', null)
  920. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'disable', false)
  921. if (this.inputDataLoaded) {
  922. // province
  923. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'type', 'input')
  924. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'disable', false)
  925. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'value', null)
  926. // city
  927. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'input')
  928. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
  929. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
  930. }
  931. }
  932. },
  933. isAbroadLivingAddress (newValue) {
  934. if (!newValue) {
  935. FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'value', 'ایران')
  936. FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'disable', true)
  937. if (this.inputDataLoaded) {
  938. // province
  939. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'type', 'select')
  940. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'disable', false)
  941. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'value', null)
  942. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'options', Provinces)
  943. // city
  944. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'select')
  945. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', true)
  946. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
  947. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'options', [])
  948. }
  949. } else {
  950. FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'value', null)
  951. FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'disable', false)
  952. if (this.inputDataLoaded) {
  953. // province
  954. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'type', 'input')
  955. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'disable', false)
  956. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'value', null)
  957. // city
  958. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'input')
  959. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
  960. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
  961. }
  962. }
  963. },
  964. selectedBirthProvince (newValue) {
  965. if (this.isAbroadBirthAddress) {
  966. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'input')
  967. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
  968. return
  969. }
  970. if (!newValue) {
  971. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', true)
  972. if (this.inputDataLoaded) {
  973. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
  974. }
  975. return
  976. }
  977. const filteredCities = getCitiesOfProvince(this.selectedBirthProvince)
  978. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'options', filteredCities)
  979. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
  980. if (this.inputDataLoaded) {
  981. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
  982. }
  983. },
  984. selectedLivingProvince (newValue) {
  985. if (this.isAbroadBirthAddress) {
  986. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'input')
  987. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
  988. return
  989. }
  990. if (!newValue) {
  991. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', true)
  992. if (this.inputDataLoaded) {
  993. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
  994. }
  995. return
  996. }
  997. const filteredCities = getCitiesOfProvince(this.selectedLivingProvince)
  998. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'options', filteredCities)
  999. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
  1000. if (this.inputDataLoaded) {
  1001. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
  1002. }
  1003. }
  1004. },
  1005. mounted () {
  1006. this.mounted = true
  1007. },
  1008. methods: {
  1009. afterLoadInputData (responseData, setNewInputData) {
  1010. // const roles = responseData.roles.map(role => {
  1011. // return {
  1012. // label: this.getRoleTitle(role),
  1013. // value: role
  1014. // }
  1015. // }).filter(role => role.value)
  1016. // console.log('roles', roles)
  1017. // this.setInputValue('roles', roles)
  1018. // setNewInputData(this.inputs)
  1019. this.$nextTick(() => {
  1020. this.inputDataLoaded = true
  1021. })
  1022. },
  1023. setInputValue (name, value) {
  1024. const inputIndex = this.inputs.findIndex(input => input.name === name)
  1025. this.inputs[inputIndex].value = value
  1026. },
  1027. getRoleTitle (roleName) {
  1028. const target = Enums.groups.find(item => item.value === roleName)
  1029. if (!target) {
  1030. return '-'
  1031. }
  1032. return target.label
  1033. },
  1034. editEntity () {
  1035. this.$refs.entityEdit.editEntity()
  1036. }
  1037. }
  1038. }
  1039. </script>
  1040. <style scoped>
  1041. </style>