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sources":["webpack://landing/./src/components/EmptyPlaceholder/emptyPlaceholder.module.scss","webpack://landing/./src/components/EmptyPlaceholder/emptyPlaceholder.ts","webpack://landing/./src/views/Services/styles.module.scss","webpack://landing/./src/views/Services/services.ts","webpack://landing/./src/components/EmptyPlaceholder/emptyPlaceholder.html","webpack://landing/./src/views/Services/services.html"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"emptyPlaceholder\":\"q3q7kSpZgUfxA8BcsqMY\",\"imgPlaceholder\":\"SFPoQXrS5UsxAPxACf71\",\"img\":\"SDwrISfU5EYYukqmDBsl\",\"icon\":\"OghV45W12E2Hamkh3eUu\",\"primaryText\":\"p8hGpXQUKsY0RIpNxqd8\",\"secondaryText\":\"LgzTchq_9jcnCwOviT55\"};","import { Component, Prop, Vue } from 'vue-property-decorator';\r\nimport styles from './emptyPlaceholder.module.scss';\r\nimport WithRender from './emptyPlaceholder.html';\r\n\r\n@WithRender\r\n@Component({})\r\nexport default class EmptyPlaceholder extends Vue {\r\n public styles = styles;\r\n\r\n @Prop({ default: '' })\r\n public icon!:string;\r\n\r\n @Prop({ default: '' })\r\n public primaryText!:string;\r\n\r\n @Prop({ default: '' })\r\n public secondaryText!: string;\r\n\r\n @Prop({ default: false })\r\n public isLoading!: boolean;\r\n\r\n @Prop({ default: '' })\r\n public wrapperClass!: string;\r\n}\r\n","// extracted by mini-css-extract-plugin\nexport default {\"servicesWrapper\":\"n99RZR2tscj0EbuRtxSY\",\"filterWrapper\":\"XuIYrJ_tjlcqX2sSg09t\",\"sidebarBtn\":\"TOZofLIpPngGZMkPreKP\",\"navigationBanner\":\"nVKQU_0Ij_gwwBcWs_Hb\",\"arrowIcon\":\"lfgZMR3lNukBHXtLlNBs\",\"servicesSearchField\":\"sNsUHEZi38Qnbkfxzq3w\"};","import { Inject } from 'vue-di-container';\r\nimport { Component, Vue } from 'vue-property-decorator';\r\n//\r\nimport WithRender from './services.html';\r\nimport styles from './styles.module.scss';\r\n// Animations\r\nimport ScrollAnimation from '@/directives/scrollAnimation';\r\n\r\n// Components\r\nimport EmptyPlaceholder from '@/components/EmptyPlaceholder/emptyPlaceholder';\r\n// services\r\nimport ApiService from '@/services/service';\r\nimport TelemetryService from '@/services/TelemetryService';\r\n// utils\r\nimport { failedEvent, successfullEvent } from '@/utils/telemetry';\r\n// Models\r\nimport { ServiceCategory, ServiceModel } from '@/models/services';\r\nimport { testIds } from '@/services/testAutomation';\r\nimport { ServiceCardAction } from '@/models/components';\r\n\r\n@WithRender\r\n@Component({\r\n components: {\r\n EmptyPlaceholder,\r\n },\r\n directives: {\r\n ScrollAnimation,\r\n },\r\n diProvide: [\r\n ApiService,\r\n ],\r\n})\r\nexport default class Services extends Vue {\r\n @Inject(ApiService) public apiService!: ApiService;\r\n @Inject(TelemetryService) public telemetryService!: TelemetryService;\r\n\r\n public styles = styles;\r\n public testIds = testIds.eServices;\r\n public cardActionIdPrefix = testIds.eServices.cardAction;\r\n public filterBtnPrefix = testIds.eServices.filterBtn;\r\n public isLoading = true;\r\n\r\n public searchText = '';\r\n public selectedCategoryId = 0;\r\n public allCategoriesId = 0;\r\n\r\n public categories: ServiceCategory[] = [];\r\n\r\n public get services() {\r\n const { selectedCategoryId, allCategoriesId } = this;\r\n\r\n let sortedServices = this.sortServices(this.totalServices);\r\n\r\n if (selectedCategoryId !== allCategoriesId) {\r\n // ? check which Item is selected and get it's ID\r\n const selectedItem = this.categories[selectedCategoryId];\r\n sortedServices = this.sortServices(selectedItem.services);\r\n }\r\n\r\n return this.searchText ? this.filterServices(sortedServices) : sortedServices;\r\n }\r\n\r\n public get totalServices() {\r\n const { categories } = this;\r\n\r\n // ? slice(1) because we added the total object during the initialization phase\r\n return categories.slice(1).reduce((current, accumelator) => [...current, ...accumelator.services], [] as ServiceModel[]);\r\n }\r\n\r\n public get selectedCategory() {\r\n const { selectedCategoryId, allCategoriesId } = this;\r\n\r\n if (selectedCategoryId !== allCategoriesId) {\r\n // ? check which Item is selected and get it's ID\r\n return this.categories[selectedCategoryId];\r\n }\r\n\r\n return {} as ServiceCategory;\r\n }\r\n\r\n public async mounted() {\r\n document.title = 'بوابة ناجز | الخدمات الإلكترونية';\r\n\r\n try {\r\n const response = await this.apiService.getCategories();\r\n\r\n if (response) {\r\n this.categories = this.appendWithTotalCategory(response);\r\n\r\n const { query } = this.$route;\r\n\r\n const isVerificationServices = query.verificationServices === 'true';\r\n\r\n if (query.category || isVerificationServices) {\r\n const categoryId = this.categories.findIndex((category) => {\r\n if (isVerificationServices) {\r\n return Boolean(category.isVerificationServicesCategory);\r\n }\r\n\r\n return category.id === query.category;\r\n });\r\n\r\n this.selectedCategoryId = categoryId > -1 ? categoryId : this.allCategoriesId;\r\n }\r\n\r\n this.telemetryService.trackEvent({\r\n ...successfullEvent,\r\n serviceNameAr: this.$t('services.title') as string,\r\n serviceNameEn: 'Electronic Services',\r\n });\r\n }\r\n } catch (error) {\r\n this.telemetryService.trackEvent({\r\n ...failedEvent,\r\n serviceNameAr: this.$t('services.title') as string,\r\n serviceNameEn: 'Electronic Services',\r\n });\r\n }\r\n\r\n this.isLoading = false;\r\n }\r\n\r\n public getCategoryButtonName({ id, services }: ServiceCategory) {\r\n const isAllCategoriesBtn = id === String(this.allCategoriesId);\r\n\r\n return isAllCategoriesBtn ? '' : `( ${services.length} )`;\r\n }\r\n\r\n public appendWithTotalCategory(categories: ServiceCategory[]) {\r\n const enhancedCategories = categories.reduce((current, accumelator, index) => {\r\n const services = accumelator.services.map((service) => ({ ...service, categoryName: categories[index].name }));\r\n\r\n return [\r\n ...current,\r\n {\r\n ...categories[index],\r\n services,\r\n },\r\n ];\r\n }, [] as ServiceCategory[]);\r\n\r\n return categories.length ? [\r\n {\r\n id: String(this.allCategoriesId),\r\n name: this.$t('allServices') as string,\r\n iconClass: 'n-icon-element-3',\r\n } as ServiceCategory,\r\n ...enhancedCategories,\r\n ] : [];\r\n }\r\n\r\n public filterServices(services: ServiceModel[]) {\r\n return services.filter((service: ServiceModel) => service.name.includes(this.searchText));\r\n }\r\n\r\n public sortServices(services: ServiceModel[]) {\r\n return services.sort((service: ServiceModel) => (service.annotations.includes('mostViewed') ? -1 : 1));\r\n }\r\n\r\n public hasMostViewedAnnotation(service: ServiceModel) {\r\n return service.annotations.includes('mostViewed');\r\n }\r\n\r\n public hasModifiedAnnotation(service: ServiceModel) {\r\n return service.annotations.includes('modified');\r\n }\r\n\r\n public hasNewAnnotation(service: ServiceModel) {\r\n return service.annotations.includes('new');\r\n }\r\n\r\n public getCardAction(service: ServiceModel): ServiceCardAction {\r\n const { categoryName, name, description } = service;\r\n\r\n return {\r\n label: this.$t('serviceExplaination') as string,\r\n link: `/e-services/${service.id}`,\r\n ariaLabel: `${categoryName} ${name} ${description}`,\r\n };\r\n }\r\n\r\n public isActiveCategory(category: ServiceCategory) {\r\n const { categories, selectedCategoryId } = this;\r\n const currentCategoryId = categories[selectedCategoryId].id;\r\n\r\n return String(currentCategoryId || 0) === String(category.id);\r\n }\r\n\r\n public generateButtonClasses(category: ServiceCategory, index: number) {\r\n const { isActiveCategory, categories } = this;\r\n let classes = 'n-justify-start';\r\n const notLastButton = index < categories.length;\r\n\r\n if (notLastButton) {\r\n classes += ' n-mb-4';\r\n }\r\n\r\n if (isActiveCategory(category)) {\r\n classes += ` ${styles.sidebarBtn}`;\r\n } else {\r\n classes += ' n-color-font-primary n-font-normal';\r\n }\r\n\r\n return classes;\r\n }\r\n\r\n public onChangeSidebarFilter(selectedCategoryId: number) {\r\n this.onChangeCategory(selectedCategoryId);\r\n this.changeQueryString();\r\n }\r\n\r\n public onChangeCategory(selectedCategoryId: number) {\r\n if (selectedCategoryId) {\r\n this.selectedCategoryId = selectedCategoryId;\r\n return;\r\n }\r\n\r\n this.selectedCategoryId = this.allCategoriesId;\r\n }\r\n\r\n public changeQueryString(toggle: any = () => {}) {\r\n if (toggle && typeof toggle === 'function') {\r\n toggle();\r\n }\r\n\r\n this.searchText = '';\r\n\r\n const { category: currentCategory } = this.$route.query;\r\n const newCategory = this.categories[this.selectedCategoryId].id;\r\n\r\n if (newCategory !== currentCategory) {\r\n this.$router.replace({ query: { category: this.categories[this.selectedCategoryId].id } });\r\n }\r\n }\r\n}\r\n","
\r\n

{{$t('fetchingData')}}

\r\n \r\n
","
\r\n
\r\n \r\n

\r\n {{$t('services.title')}}\r\n

\r\n\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n changeQueryString(toggle)\"\r\n :class=\"styles.categoryWrapper\"\r\n :aria-label=\"category.name\"\r\n @keyup.enter=\"handleCategoryEnter\"\r\n >\r\n
\r\n {{ category.name }} {{ getCategoryButtonName(category) }}\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n"],"names":["EmptyPlaceholder","Vue","constructor","args","_defineProperty","styles","__decorate","Prop","default","WithRender","Component","Services","testIds","eServices","cardAction","filterBtn","services","selectedCategoryId","allCategoriesId","this","sortedServices","sortServices","totalServices","selectedItem","categories","searchText","filterServices","slice","reduce","current","accumelator","selectedCategory","mounted","document","title","response","apiService","getCategories","appendWithTotalCategory","query","$route","isVerificationServices","verificationServices","category","categoryId","findIndex","Boolean","isVerificationServicesCategory","id","telemetryService","trackEvent","successfullEvent","serviceNameAr","$t","serviceNameEn","error","failedEvent","isLoading","getCategoryButtonName","isAllCategoriesBtn","String","length","enhancedCategories","index","map","service","categoryName","name","iconClass","filter","includes","sort","annotations","hasMostViewedAnnotation","hasModifiedAnnotation","hasNewAnnotation","getCardAction","description","label","link","ariaLabel","isActiveCategory","currentCategoryId","generateButtonClasses","classes","notLastButton","sidebarBtn","onChangeSidebarFilter","onChangeCategory","changeQueryString","toggle","currentCategory","newCategory","$router","replace","Inject","ApiService","TelemetryService","components","directives","ScrollAnimation","diProvide"],"sourceRoot":""}