show.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077
  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: 'invoice_info.status',
  786. required: true,
  787. label: 'وضعیت',
  788. align: 'left',
  789. field: row => (new Invoice(row.invoice_info)).status_info.label
  790. },
  791. {
  792. name: 'amount',
  793. required: true,
  794. label: 'مبلغ تراکنش (ریال)',
  795. align: 'left',
  796. field: row => row.amount.toLocaleString('fa')
  797. },
  798. {
  799. name: 'creation_time',
  800. required: true,
  801. label: 'زمان',
  802. align: 'left',
  803. field: row => Assist.miladiToShamsi(row.creation_time)
  804. },
  805. {
  806. name: 'action',
  807. required: true,
  808. label: 'جزییات',
  809. align: 'left',
  810. field: row => ''
  811. }
  812. ]
  813. },
  814. paymentListTableKeys: {
  815. data: 'results',
  816. total: 'count',
  817. currentPage: 'current',
  818. perPage: 'per_page',
  819. pageKey: 'page'
  820. },
  821. transactionListInputs: [
  822. { type: 'hidden', name: 'owner', value: userId }
  823. ],
  824. transactionListApi: APIGateway.transaction.APIAdresses.base,
  825. transactionListTable: {
  826. columns: [
  827. {
  828. name: 'number',
  829. required: true,
  830. label: 'شماره',
  831. align: 'left',
  832. field: () => ''
  833. },
  834. {
  835. name: 'id',
  836. required: true,
  837. label: 'شناسه',
  838. align: 'left',
  839. field: row => row.id
  840. },
  841. {
  842. name: 'amount',
  843. required: true,
  844. label: 'مبلغ تراکنش (ریال)',
  845. align: 'left',
  846. field: row => row.amount.toLocaleString('fa')
  847. },
  848. {
  849. name: 'description',
  850. required: true,
  851. label: 'توضیحات',
  852. align: 'left',
  853. field: row => row.description
  854. },
  855. {
  856. name: 'reference_code',
  857. required: true,
  858. label: 'کد مرجع',
  859. align: 'left',
  860. field: row => row.reference_code
  861. },
  862. {
  863. name: 'status',
  864. required: true,
  865. label: 'وضعیت',
  866. align: 'left',
  867. field: row => (new Transaction(row)).status_info.label
  868. },
  869. {
  870. name: 'creation_time',
  871. required: true,
  872. label: 'تاریخ ایجاد',
  873. align: 'left',
  874. field: row => Assist.miladiToShamsi(row.creation_time)
  875. },
  876. {
  877. name: 'action',
  878. required: true,
  879. label: 'جزییات',
  880. align: 'left',
  881. field: row => ''
  882. }
  883. ]
  884. },
  885. transactionListTableKeys: {
  886. data: 'results',
  887. total: 'count',
  888. currentPage: 'current',
  889. perPage: 'per_page',
  890. pageKey: 'page'
  891. }
  892. }
  893. },
  894. computed: {
  895. isAbroadBirthAddress () {
  896. return FormBuilderAssist.getInputsByName(this.inputs, 'is_abroad_birth_address').value
  897. },
  898. isAbroadLivingAddress () {
  899. return FormBuilderAssist.getInputsByName(this.inputs, 'is_abroad_living_address').value
  900. },
  901. selectedBirthProvince () {
  902. return FormBuilderAssist.getInputsByName(this.inputs, 'birth_province').value
  903. },
  904. selectedLivingProvince () {
  905. return FormBuilderAssist.getInputsByName(this.inputs, 'living_province').value
  906. }
  907. },
  908. watch: {
  909. isAbroadBirthAddress (newValue) {
  910. if (!newValue) {
  911. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'value', 'ایران')
  912. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'disable', true)
  913. if (this.inputDataLoaded) {
  914. // province
  915. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'type', 'select')
  916. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'disable', false)
  917. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'value', null)
  918. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'options', Provinces)
  919. // city
  920. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'select')
  921. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', true)
  922. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
  923. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'options', [])
  924. }
  925. } else {
  926. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'value', null)
  927. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_country', 'disable', false)
  928. if (this.inputDataLoaded) {
  929. // province
  930. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'type', 'input')
  931. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'disable', false)
  932. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_province', 'value', null)
  933. // city
  934. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'input')
  935. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
  936. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
  937. }
  938. }
  939. },
  940. isAbroadLivingAddress (newValue) {
  941. if (!newValue) {
  942. FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'value', 'ایران')
  943. FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'disable', true)
  944. if (this.inputDataLoaded) {
  945. // province
  946. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'type', 'select')
  947. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'disable', false)
  948. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'value', null)
  949. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'options', Provinces)
  950. // city
  951. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'select')
  952. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', true)
  953. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
  954. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'options', [])
  955. }
  956. } else {
  957. FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'value', null)
  958. FormBuilderAssist.setAttributeByName(this.inputs, 'living_country', 'disable', false)
  959. if (this.inputDataLoaded) {
  960. // province
  961. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'type', 'input')
  962. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'disable', false)
  963. FormBuilderAssist.setAttributeByName(this.inputs, 'living_province', 'value', null)
  964. // city
  965. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'input')
  966. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
  967. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
  968. }
  969. }
  970. },
  971. selectedBirthProvince (newValue) {
  972. if (this.isAbroadBirthAddress) {
  973. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'type', 'input')
  974. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
  975. return
  976. }
  977. if (!newValue) {
  978. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', true)
  979. if (this.inputDataLoaded) {
  980. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
  981. }
  982. return
  983. }
  984. const filteredCities = getCitiesOfProvince(this.selectedBirthProvince)
  985. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'options', filteredCities)
  986. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'disable', false)
  987. if (this.inputDataLoaded) {
  988. FormBuilderAssist.setAttributeByName(this.inputs, 'birth_city', 'value', null)
  989. }
  990. },
  991. selectedLivingProvince (newValue) {
  992. if (this.isAbroadBirthAddress) {
  993. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'type', 'input')
  994. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
  995. return
  996. }
  997. if (!newValue) {
  998. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', true)
  999. if (this.inputDataLoaded) {
  1000. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
  1001. }
  1002. return
  1003. }
  1004. const filteredCities = getCitiesOfProvince(this.selectedLivingProvince)
  1005. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'options', filteredCities)
  1006. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'disable', false)
  1007. if (this.inputDataLoaded) {
  1008. FormBuilderAssist.setAttributeByName(this.inputs, 'living_city', 'value', null)
  1009. }
  1010. }
  1011. },
  1012. mounted () {
  1013. this.mounted = true
  1014. },
  1015. methods: {
  1016. afterLoadInputData (responseData, setNewInputData) {
  1017. // const roles = responseData.roles.map(role => {
  1018. // return {
  1019. // label: this.getRoleTitle(role),
  1020. // value: role
  1021. // }
  1022. // }).filter(role => role.value)
  1023. // console.log('roles', roles)
  1024. // this.setInputValue('roles', roles)
  1025. // setNewInputData(this.inputs)
  1026. this.$nextTick(() => {
  1027. this.inputDataLoaded = true
  1028. })
  1029. },
  1030. setInputValue (name, value) {
  1031. const inputIndex = this.inputs.findIndex(input => input.name === name)
  1032. this.inputs[inputIndex].value = value
  1033. },
  1034. getRoleTitle (roleName) {
  1035. const target = Enums.groups.find(item => item.value === roleName)
  1036. if (!target) {
  1037. return '-'
  1038. }
  1039. return target.label
  1040. },
  1041. editEntity () {
  1042. this.$refs.entityEdit.editEntity()
  1043. }
  1044. }
  1045. }
  1046. </script>
  1047. <style scoped>
  1048. </style>