Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

cards-advance.js 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. /**
  2. * Advanced Cards
  3. */
  4. 'use strict';
  5. document.addEventListener('DOMContentLoaded', function (e) {
  6. let cardColor, headingColor, legendColor, labelColor, fontFamily, currentTheme;
  7. cardColor = config.colors.cardColor;
  8. labelColor = config.colors.textMuted;
  9. legendColor = config.colors.bodyColor;
  10. headingColor = config.colors.headingColor;
  11. fontFamily = config.fontFamily;
  12. if (isDarkStyle) {
  13. currentTheme = 'dark';
  14. } else {
  15. currentTheme = 'light';
  16. }
  17. // Radial bar chart functions
  18. function radialBarChart(color, value, show) {
  19. const radialBarChartOpt = {
  20. chart: {
  21. height: show == 'true' ? 60 : 55,
  22. width: show == 'true' ? 58 : 45,
  23. type: 'radialBar'
  24. },
  25. plotOptions: {
  26. radialBar: {
  27. hollow: {
  28. size: show == 'true' ? '50%' : '25%'
  29. },
  30. dataLabels: {
  31. show: show == 'true' ? true : false,
  32. value: {
  33. offsetY: -10,
  34. fontSize: '15px',
  35. fontWeight: 500,
  36. fontFamily: fontFamily,
  37. color: headingColor
  38. }
  39. },
  40. track: {
  41. background: config.colors_label.secondary
  42. }
  43. }
  44. },
  45. stroke: {
  46. lineCap: 'round'
  47. },
  48. colors: [color],
  49. grid: {
  50. padding: {
  51. top: show == 'true' ? -12 : -15,
  52. bottom: show == 'true' ? -17 : -15,
  53. left: show == 'true' ? -17 : -5,
  54. right: -15
  55. }
  56. },
  57. series: [value],
  58. labels: show == 'true' ? [''] : ['Progress']
  59. };
  60. return radialBarChartOpt;
  61. }
  62. // Progress Chart
  63. // --------------------------------------------------------------------
  64. // All progress chart
  65. const chartProgressList = document.querySelectorAll('.chart-progress');
  66. if (chartProgressList) {
  67. chartProgressList.forEach(function (chartProgressEl) {
  68. const color = config.colors[chartProgressEl.dataset.color],
  69. series = chartProgressEl.dataset.series;
  70. const progress_variant = chartProgressEl.dataset.progress_variant
  71. ? chartProgressEl.dataset.progress_variant
  72. : 'false';
  73. const optionsBundle = radialBarChart(color, series, progress_variant);
  74. const chart = new ApexCharts(chartProgressEl, optionsBundle);
  75. chart.render();
  76. });
  77. }
  78. // Order Statistics Chart
  79. // --------------------------------------------------------------------
  80. const chartOrderStatistics = document.querySelector('#orderStatisticsChart'),
  81. orderChartConfig = {
  82. chart: {
  83. height: 165,
  84. width: 136,
  85. type: 'donut',
  86. offsetX: 15
  87. },
  88. labels: ['Electronic', 'Sports', 'Decor', 'Fashion'],
  89. series: [50, 85, 25, 40],
  90. colors: [config.colors.success, config.colors.primary, config.colors.secondary, config.colors.info],
  91. stroke: {
  92. width: 5,
  93. colors: [cardColor]
  94. },
  95. dataLabels: {
  96. enabled: false,
  97. formatter: function (val, opt) {
  98. return parseInt(val) + '%';
  99. }
  100. },
  101. legend: {
  102. show: false
  103. },
  104. grid: {
  105. padding: {
  106. top: 0,
  107. bottom: 0,
  108. right: 15
  109. }
  110. },
  111. tooltip: {
  112. theme: currentTheme
  113. },
  114. plotOptions: {
  115. pie: {
  116. donut: {
  117. size: '75%',
  118. labels: {
  119. show: true,
  120. value: {
  121. fontSize: '1.125rem',
  122. fontFamily: fontFamily,
  123. fontWeight: 500,
  124. color: headingColor,
  125. offsetY: -17,
  126. formatter: function (val) {
  127. return parseInt(val) + '%';
  128. }
  129. },
  130. name: {
  131. offsetY: 17,
  132. fontFamily: fontFamily
  133. },
  134. total: {
  135. show: true,
  136. fontSize: '13px',
  137. color: legendColor,
  138. label: 'Weekly',
  139. formatter: function (w) {
  140. return '38%';
  141. }
  142. }
  143. }
  144. }
  145. }
  146. },
  147. states: {
  148. active: {
  149. filter: {
  150. type: 'none'
  151. }
  152. }
  153. }
  154. };
  155. if (typeof chartOrderStatistics !== undefined && chartOrderStatistics !== null) {
  156. const statisticsChart = new ApexCharts(chartOrderStatistics, orderChartConfig);
  157. statisticsChart.render();
  158. }
  159. // Earning Reports Bar Chart
  160. // --------------------------------------------------------------------
  161. const reportBarChartEl = document.querySelector('#reportBarChart'),
  162. reportBarChartConfig = {
  163. chart: {
  164. height: 200,
  165. type: 'bar',
  166. toolbar: {
  167. show: false
  168. }
  169. },
  170. plotOptions: {
  171. bar: {
  172. barHeight: '60%',
  173. columnWidth: '60%',
  174. startingShape: 'rounded',
  175. endingShape: 'rounded',
  176. borderRadius: 4,
  177. distributed: true
  178. }
  179. },
  180. grid: {
  181. show: false,
  182. padding: {
  183. top: -20,
  184. bottom: 0,
  185. left: -10,
  186. right: -10
  187. }
  188. },
  189. colors: [
  190. config.colors_label.primary,
  191. config.colors_label.primary,
  192. config.colors_label.primary,
  193. config.colors_label.primary,
  194. config.colors.primary,
  195. config.colors_label.primary,
  196. config.colors_label.primary
  197. ],
  198. dataLabels: {
  199. enabled: false
  200. },
  201. series: [
  202. {
  203. data: [40, 95, 60, 45, 90, 50, 75]
  204. }
  205. ],
  206. legend: {
  207. show: false
  208. },
  209. xaxis: {
  210. categories: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
  211. axisBorder: {
  212. show: false
  213. },
  214. axisTicks: {
  215. show: false
  216. },
  217. labels: {
  218. style: {
  219. colors: labelColor,
  220. fontSize: '13px'
  221. }
  222. }
  223. },
  224. yaxis: {
  225. labels: {
  226. show: false
  227. }
  228. },
  229. states: {
  230. hover: {
  231. filter: {
  232. type: 'none'
  233. }
  234. },
  235. active: {
  236. filter: {
  237. type: 'none'
  238. }
  239. }
  240. }
  241. };
  242. if (typeof reportBarChartEl !== undefined && reportBarChartEl !== null) {
  243. const barChart = new ApexCharts(reportBarChartEl, reportBarChartConfig);
  244. barChart.render();
  245. }
  246. // Conversion rate Line Chart
  247. // --------------------------------------------------------------------
  248. const conversionLineChartEl = document.querySelector('#conversionRateChart'),
  249. conversionLineChartConfig = {
  250. chart: {
  251. height: 80,
  252. width: 140,
  253. type: 'line',
  254. toolbar: {
  255. show: false
  256. },
  257. dropShadow: {
  258. enabled: true,
  259. top: 10,
  260. left: 5,
  261. blur: 3,
  262. color: config.colors.primary,
  263. opacity: 0.15
  264. },
  265. sparkline: {
  266. enabled: true
  267. },
  268. offsetX: -5
  269. },
  270. markers: {
  271. size: 6,
  272. colors: 'transparent',
  273. strokeColors: 'transparent',
  274. strokeWidth: 4,
  275. discrete: [
  276. {
  277. fillColor: cardColor,
  278. seriesIndex: 0,
  279. dataPointIndex: 3,
  280. strokeColor: config.colors.primary,
  281. strokeWidth: 4,
  282. size: 5,
  283. radius: 2
  284. }
  285. ],
  286. hover: {
  287. size: 7
  288. }
  289. },
  290. grid: {
  291. show: false,
  292. padding: {
  293. right: 8
  294. }
  295. },
  296. colors: [config.colors.primary],
  297. dataLabels: {
  298. enabled: false
  299. },
  300. stroke: {
  301. width: 5,
  302. curve: 'smooth'
  303. },
  304. series: [
  305. {
  306. data: [137, 210, 160, 245]
  307. }
  308. ],
  309. xaxis: {
  310. show: false,
  311. lines: {
  312. show: false
  313. },
  314. labels: {
  315. show: false
  316. },
  317. axisBorder: {
  318. show: false
  319. }
  320. },
  321. yaxis: {
  322. show: false
  323. }
  324. };
  325. const conversionLineChart = new ApexCharts(conversionLineChartEl, conversionLineChartConfig);
  326. conversionLineChart.render();
  327. // Credit Card Validation
  328. // --------------------------------------------------------------------
  329. const creditCardPayment = document.querySelector('.credit-card-payment'),
  330. expiryDatePayment = document.querySelector('.expiry-date-payment'),
  331. cvvMaskList = document.querySelectorAll('.cvv-code-payment');
  332. // Credit Card Cleave Masking
  333. if (creditCardPayment) {
  334. creditCardPayment.addEventListener('input', event => {
  335. creditCardPayment.value = formatCreditCard(event.target.value);
  336. const cleanValue = event.target.value.replace(/\D/g, '');
  337. let type = getCreditCardType(cleanValue);
  338. if (type && type !== 'unknown' && type !== 'general') {
  339. document.querySelector('.card-payment-type').innerHTML =
  340. '<img src="' + assetsPath + 'img/icons/payments/' + type + '-cc.png" class="cc-icon-image" height="28"/>';
  341. } else {
  342. document.querySelector('.card-payment-type').innerHTML = '';
  343. }
  344. });
  345. registerCursorTracker({
  346. input: creditCardPayment,
  347. delimiter: ' '
  348. });
  349. }
  350. // Expiry Date Mask
  351. if (expiryDatePayment) {
  352. expiryDatePayment.addEventListener('input', event => {
  353. expiryDatePayment.value = formatDate(event.target.value, {
  354. delimiter: '/',
  355. datePattern: ['m', 'y']
  356. });
  357. });
  358. registerCursorTracker({
  359. input: expiryDatePayment,
  360. delimiter: '/'
  361. });
  362. }
  363. // All CVV field
  364. if (cvvMaskList) {
  365. cvvMaskList.forEach(function (cvvMaskEl) {
  366. cvvMaskEl.addEventListener('input', event => {
  367. const cleanValue = event.target.value.replace(/\D/g, '');
  368. cvvMaskEl.value = formatNumeral(cleanValue, {
  369. numeral: true,
  370. numeralPositiveOnly: true
  371. });
  372. });
  373. });
  374. }
  375. });