You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DemoComponent14.js 35KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. import React, { lazy } from 'react';
  2. import {
  3. CBadge,
  4. CButton,
  5. CButtonGroup,
  6. CCard,
  7. CCardBody,
  8. CCardFooter,
  9. CCardHeader,
  10. CCol,
  11. CProgress,
  12. CRow,
  13. CCallout
  14. } from '@coreui/react';
  15. import CIcon from '@coreui/icons-react';
  16. import {PDFEngine} from 'PDFEngine';
  17. import { CustomModel } from "./model";
  18. import MainChartExample from '../charts/MainChartExample.js';
  19. const WidgetsDropdown = lazy(() => import('../widgets/WidgetsDropdown.js'))
  20. const DemoComponent14 = () => {
  21. const exec = () => {
  22. const m = new CustomModel();
  23. const pdf = new PDFEngine();
  24. m.addObservables(pdf);
  25. m.addTransform();
  26. pdf.execute();
  27. // window.print();
  28. }
  29. // const apiCall = () => {
  30. // const url = encodeURIComponent("http://localhost:3000/#/DemoComponent2");
  31. // const dateNow = new Date();
  32. // fetch('https://localhost:7285/api/PDFGenerator/' + url)
  33. // .then(async res => ({
  34. // filename: "John Doe - " + dateNow +" - report.pdf",
  35. // blob: await res.blob()
  36. // }))
  37. // .then(resObj => {
  38. // // It is necessary to create a new blob object with mime-type explicitly set for all browsers except Chrome, but it works for Chrome too.
  39. // const newBlob = new Blob([resObj.blob], { type: 'application/pdf' });
  40. // //const bytes = new Uint8Array(newBlob);
  41. // //console.log(bytes);
  42. // //modifyPdf(bytes);
  43. // // MS Edge and IE don't allow using a blob object directly as link href, instead it is necessary to use msSaveOrOpenBlob
  44. // if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  45. // window.navigator.msSaveOrOpenBlob(newBlob);
  46. // } else {
  47. // // For other browsers: create a link pointing to the ObjectURL containing the blob.
  48. // const objUrl = window.URL.createObjectURL(newBlob);
  49. // let link = document.createElement('a');
  50. // link.href = objUrl;
  51. // link.download = resObj.filename;
  52. // link.click();
  53. // // For Firefox it is necessary to delay revoking the ObjectURL.
  54. // setTimeout(() => { window.URL.revokeObjectURL(objUrl); }, 250);
  55. // }
  56. // })
  57. // .catch((error) => {
  58. // console.log('DOWNLOAD ERROR', error);
  59. // });
  60. // }
  61. return (
  62. <>
  63. <div code="br-hide">
  64. <div style={{ display: 'flex', flexDirection: 'row', border: '1px solid #dedede', width: '50%', height: '200px', backgroundColor: 'white', padding: '5px', borderRadius: '10px' }}>
  65. <div style={{ backgroundColor: 'white', minHeight: '100%', width: '50%', padding: '2px', margin: '5px' }}>
  66. <div style={{ backgroundColor: 'white', width: '50%', padding: '2px', marginBottom: '20px' }}>
  67. <h4>PDFEngine</h4>
  68. </div>
  69. <div style={{ display: 'flex', flexDirection: 'row', marginLeft: '10px' }}>
  70. <button style={{ marginLeft: '5px' }} className=" btn btn-primary" onClick={exec}>Print view</button>
  71. </div>
  72. </div>
  73. <div style={{ backgroundColor: 'white', minHeight: '100%', width: '50%', padding: '5px' }}>
  74. </div>
  75. </div>
  76. </div>
  77. <br />
  78. <br />
  79. <br />
  80. <WidgetsDropdown />
  81. <CCard>
  82. <CCardBody>
  83. <CRow>
  84. <CCol sm="5">
  85. <h4 id="traffic" className="card-title mb-0">Traffic</h4>
  86. <div className="small text-muted">November 2017</div>
  87. </CCol>
  88. <CCol sm="7" className="d-none d-md-block">
  89. <CButton color="primary" className="float-right">
  90. <CIcon name="cil-cloud-download" />
  91. </CButton>
  92. <CButtonGroup className="float-right mr-3">
  93. {
  94. ['Day', 'Month', 'Year'].map(value => (
  95. <CButton
  96. color="outline-secondary"
  97. key={value}
  98. className="mx-0"
  99. active={value === 'Month'}
  100. >
  101. {value}
  102. </CButton>
  103. ))
  104. }
  105. </CButtonGroup>
  106. </CCol>
  107. </CRow>
  108. <MainChartExample style={{ height: '300px', marginTop: '40px' }} />
  109. </CCardBody>
  110. <CCardFooter>
  111. <CRow className="text-center">
  112. <CCol md sm="12" className="mb-sm-2 mb-0">
  113. <div className="text-muted">Visits</div>
  114. <strong>29.703 Users (40%)</strong>
  115. <CProgress
  116. className="progress-xs mt-2"
  117. precision={1}
  118. color="success"
  119. value={40}
  120. />
  121. </CCol>
  122. <CCol md sm="12" className="mb-sm-2 mb-0 d-md-down-none">
  123. <div className="text-muted">Unique</div>
  124. <strong>24.093 Users (20%)</strong>
  125. <CProgress
  126. className="progress-xs mt-2"
  127. precision={1}
  128. color="info"
  129. value={40}
  130. />
  131. </CCol>
  132. <CCol md sm="12" className="mb-sm-2 mb-0">
  133. <div className="text-muted">Pageviews</div>
  134. <strong>78.706 Views (60%)</strong>
  135. <CProgress
  136. className="progress-xs mt-2"
  137. precision={1}
  138. color="warning"
  139. value={40}
  140. />
  141. </CCol>
  142. <CCol md sm="12" className="mb-sm-2 mb-0">
  143. <div className="text-muted">New Users</div>
  144. <strong>22.123 Users (80%)</strong>
  145. <CProgress
  146. className="progress-xs mt-2"
  147. precision={1}
  148. color="danger"
  149. value={40}
  150. />
  151. </CCol>
  152. <CCol md sm="12" className="mb-sm-2 mb-0 d-md-down-none">
  153. <div className="text-muted">Bounce Rate</div>
  154. <strong>Average Rate (40.15%)</strong>
  155. <CProgress
  156. className="progress-xs mt-2"
  157. precision={1}
  158. value={40}
  159. />
  160. </CCol>
  161. </CRow>
  162. </CCardFooter>
  163. </CCard>
  164. <CRow>
  165. <CCol>
  166. <CCard>
  167. <CCardHeader>
  168. Traffic {' & '} Sales
  169. </CCardHeader>
  170. <CCardBody>
  171. <CRow>
  172. <CCol xs="12" md="6" xl="6">
  173. <CRow>
  174. <CCol sm="6">
  175. <CCallout color="info">
  176. <small className="text-muted">New Clients</small>
  177. <br />
  178. <strong className="h4">9,123</strong>
  179. </CCallout>
  180. </CCol>
  181. <CCol sm="6">
  182. <CCallout color="danger">
  183. <small className="text-muted">Recurring Clients</small>
  184. <br />
  185. <strong className="h4">22,643</strong>
  186. </CCallout>
  187. </CCol>
  188. </CRow>
  189. <hr className="mt-0" />
  190. <div className="progress-group mb-4">
  191. <div className="progress-group-prepend">
  192. <span className="progress-group-text">
  193. Monday
  194. </span>
  195. </div>
  196. <div className="progress-group-bars">
  197. <CProgress className="progress-xs" color="info" value="34" />
  198. <CProgress className="progress-xs" color="danger" value="78" />
  199. </div>
  200. </div>
  201. <div className="progress-group mb-4">
  202. <div className="progress-group-prepend">
  203. <span className="progress-group-text">
  204. Tuesday
  205. </span>
  206. </div>
  207. <div className="progress-group-bars">
  208. <CProgress className="progress-xs" color="info" value="56" />
  209. <CProgress className="progress-xs" color="danger" value="94" />
  210. </div>
  211. </div>
  212. <div className="progress-group mb-4">
  213. <div className="progress-group-prepend">
  214. <span className="progress-group-text">
  215. Wednesday
  216. </span>
  217. </div>
  218. <div className="progress-group-bars">
  219. <CProgress className="progress-xs" color="info" value="12" />
  220. <CProgress className="progress-xs" color="danger" value="67" />
  221. </div>
  222. </div>
  223. <div className="progress-group mb-4">
  224. <div className="progress-group-prepend">
  225. <span className="progress-group-text">
  226. Thursday
  227. </span>
  228. </div>
  229. <div className="progress-group-bars">
  230. <CProgress className="progress-xs" color="info" value="43" />
  231. <CProgress className="progress-xs" color="danger" value="91" />
  232. </div>
  233. </div>
  234. <div className="progress-group mb-4">
  235. <div className="progress-group-prepend">
  236. <span className="progress-group-text">
  237. Friday
  238. </span>
  239. </div>
  240. <div className="progress-group-bars">
  241. <CProgress className="progress-xs" color="info" value="22" />
  242. <CProgress className="progress-xs" color="danger" value="73" />
  243. </div>
  244. </div>
  245. <div className="progress-group mb-4">
  246. <div className="progress-group-prepend">
  247. <span className="progress-group-text">
  248. Saturday
  249. </span>
  250. </div>
  251. <div className="progress-group-bars">
  252. <CProgress className="progress-xs" color="info" value="53" />
  253. <CProgress className="progress-xs" color="danger" value="82" />
  254. </div>
  255. </div>
  256. <div className="progress-group mb-4">
  257. <div className="progress-group-prepend">
  258. <span className="progress-group-text">
  259. Sunday
  260. </span>
  261. </div>
  262. <div className="progress-group-bars">
  263. <CProgress className="progress-xs" color="info" value="9" />
  264. <CProgress className="progress-xs" color="danger" value="69" />
  265. </div>
  266. </div>
  267. <div className="legend text-center">
  268. <small>
  269. <sup className="px-1"><CBadge shape="pill" color="info">&nbsp;</CBadge></sup>
  270. New clients
  271. &nbsp;
  272. <sup className="px-1"><CBadge shape="pill" color="danger">&nbsp;</CBadge></sup>
  273. Recurring clients
  274. </small>
  275. </div>
  276. </CCol>
  277. <CCol xs="12" md="6" xl="6">
  278. <CRow>
  279. <CCol sm="6">
  280. <CCallout color="warning">
  281. <small className="text-muted">Pageviews</small>
  282. <br />
  283. <strong className="h4">78,623</strong>
  284. </CCallout>
  285. </CCol>
  286. <CCol sm="6">
  287. <CCallout color="success">
  288. <small className="text-muted">Organic</small>
  289. <br />
  290. <strong className="h4">49,123</strong>
  291. </CCallout>
  292. </CCol>
  293. </CRow>
  294. <hr className="mt-0" />
  295. <div className="progress-group mb-4">
  296. <div className="progress-group-header">
  297. <CIcon className="progress-group-icon" name="cil-user" />
  298. <span className="title">Male</span>
  299. <span className="ml-auto font-weight-bold">43%</span>
  300. </div>
  301. <div className="progress-group-bars">
  302. <CProgress className="progress-xs" color="warning" value="43" />
  303. </div>
  304. </div>
  305. <div className="progress-group mb-5">
  306. <div className="progress-group-header">
  307. <CIcon className="progress-group-icon" name="cil-user-female" />
  308. <span className="title">Female</span>
  309. <span className="ml-auto font-weight-bold">37%</span>
  310. </div>
  311. <div className="progress-group-bars">
  312. <CProgress className="progress-xs" color="warning" value="37" />
  313. </div>
  314. </div>
  315. <div className="progress-group">
  316. <div className="progress-group-header">
  317. <CIcon className="progress-group-icon" name="cil-globe-alt" />
  318. <span className="title">Organic Search</span>
  319. <span className="ml-auto font-weight-bold">191,235 <span className="text-muted small">(56%)</span></span>
  320. </div>
  321. <div className="progress-group-bars">
  322. <CProgress className="progress-xs" color="success" value="56" />
  323. </div>
  324. </div>
  325. <div className="divider text-center">
  326. <CButton color="link" size="sm" className="text-muted">
  327. <CIcon name="cil-options" />
  328. </CButton>
  329. </div>
  330. </CCol>
  331. </CRow>
  332. <div>
  333. <br />
  334. <table className="table table-hover table-outline mb-0 d-sm-table" >
  335. <thead className="thead-light">
  336. <tr>
  337. <th className="text-center"><CIcon name="cil-people" /></th>
  338. <th>User</th>
  339. <th className="text-center">Country</th>
  340. <th>Usage</th>
  341. <th className="text-center">Payment Method</th>
  342. <th>Activity</th>
  343. </tr>
  344. </thead>
  345. <tbody>
  346. <tr>
  347. <td className="text-center">
  348. <div className="c-avatar">
  349. <img src={'avatars/1.jpg'} className="c-avatar-img" alt="[email protected]" />
  350. <span className="c-avatar-status bg-success"></span>
  351. </div>
  352. </td>
  353. <td>
  354. <div>Yiorgos Avraamu</div>
  355. <div className="small text-muted">
  356. <span>New</span> | Registered: Jan 1, 2015
  357. </div>
  358. </td>
  359. <td className="text-center">
  360. <CIcon height={25} name="cif-us" title="us" id="us" />
  361. </td>
  362. <td>
  363. <div className="clearfix">
  364. <div className="float-left">
  365. <strong>50%</strong>
  366. </div>
  367. <div className="float-right">
  368. <small className="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
  369. </div>
  370. </div>
  371. <CProgress className="progress-xs" color="success" value="50" />
  372. </td>
  373. <td className="text-center">
  374. <CIcon height={25} name="cib-cc-mastercard" />
  375. </td>
  376. <td>
  377. <div className="small text-muted">Last login</div>
  378. <strong>10 sec ago</strong>
  379. </td>
  380. </tr>
  381. <tr>
  382. <td className="text-center">
  383. <div className="c-avatar">
  384. <img src={'avatars/2.jpg'} className="c-avatar-img" alt="[email protected]" />
  385. <span className="c-avatar-status bg-danger"></span>
  386. </div>
  387. </td>
  388. <td>
  389. <div>Avram Tarasios</div>
  390. <div className="small text-muted">
  391. <span>Recurring</span> | Registered: Jan 1, 2015
  392. </div>
  393. </td>
  394. <td className="text-center">
  395. <CIcon height={25} name="cif-br" title="br" id="br" />
  396. </td>
  397. <td>
  398. <div className="clearfix">
  399. <div className="float-left">
  400. <strong>10%</strong>
  401. </div>
  402. <div className="float-right">
  403. <small className="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
  404. </div>
  405. </div>
  406. <CProgress className="progress-xs" color="info" value="10" />
  407. </td>
  408. <td className="text-center">
  409. <CIcon height={25} name="cib-cc-visa" />
  410. </td>
  411. <td>
  412. <div className="small text-muted">Last login</div>
  413. <strong>5 minutes ago</strong>
  414. </td>
  415. </tr>
  416. <tr>
  417. <td className="text-center">
  418. <div className="c-avatar">
  419. <img src={'avatars/3.jpg'} className="c-avatar-img" alt="[email protected]" />
  420. <span className="c-avatar-status bg-warning"></span>
  421. </div>
  422. </td>
  423. <td>
  424. <div>Quintin Ed</div>
  425. <div className="small text-muted">
  426. <span>New</span> | Registered: Jan 1, 2015
  427. </div>
  428. </td>
  429. <td className="text-center">
  430. <CIcon height={25} name="cif-in" title="in" id="in" />
  431. </td>
  432. <td>
  433. <div className="clearfix">
  434. <div className="float-left">
  435. <strong>74%</strong>
  436. </div>
  437. <div className="float-right">
  438. <small className="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
  439. </div>
  440. </div>
  441. <CProgress className="progress-xs" color="warning" value="74" />
  442. </td>
  443. <td className="text-center">
  444. <CIcon height={25} name="cib-stripe" />
  445. </td>
  446. <td>
  447. <div className="small text-muted">Last login</div>
  448. <strong>1 hour ago</strong>
  449. </td>
  450. </tr>
  451. <tr>
  452. <td className="text-center">
  453. <div className="c-avatar">
  454. <img src={'avatars/4.jpg'} className="c-avatar-img" alt="[email protected]" />
  455. <span className="c-avatar-status bg-secondary"></span>
  456. </div>
  457. </td>
  458. <td>
  459. <div>Enéas Kwadwo</div>
  460. <div className="small text-muted">
  461. <span>New</span> | Registered: Jan 1, 2015
  462. </div>
  463. </td>
  464. <td className="text-center">
  465. <CIcon height={25} name="cif-fr" title="fr" id="fr" />
  466. </td>
  467. <td>
  468. <div className="clearfix">
  469. <div className="float-left">
  470. <strong>98%</strong>
  471. </div>
  472. <div className="float-right">
  473. <small className="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
  474. </div>
  475. </div>
  476. <CProgress className="progress-xs" color="danger" value="98" />
  477. </td>
  478. <td className="text-center">
  479. <CIcon height={25} name="cib-paypal" />
  480. </td>
  481. <td>
  482. <div className="small text-muted">Last login</div>
  483. <strong>Last month</strong>
  484. </td>
  485. </tr>
  486. <tr>
  487. <td className="text-center">
  488. <div className="c-avatar">
  489. <img src={'avatars/5.jpg'} className="c-avatar-img" alt="[email protected]" />
  490. <span className="c-avatar-status bg-success"></span>
  491. </div>
  492. </td>
  493. <td>
  494. <div>Agapetus Tadeáš</div>
  495. <div className="small text-muted">
  496. <span>New</span> | Registered: Jan 1, 2015
  497. </div>
  498. </td>
  499. <td className="text-center">
  500. <CIcon height={25} name="cif-es" title="es" id="es" />
  501. </td>
  502. <td>
  503. <div className="clearfix">
  504. <div className="float-left">
  505. <strong>22%</strong>
  506. </div>
  507. <div className="float-right">
  508. <small className="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
  509. </div>
  510. </div>
  511. <CProgress className="progress-xs" color="info" value="22" />
  512. </td>
  513. <td className="text-center">
  514. <CIcon height={25} name="cib-google-pay" />
  515. </td>
  516. <td>
  517. <div className="small text-muted">Last login</div>
  518. <strong>Last week</strong>
  519. </td>
  520. </tr>
  521. <tr>
  522. <td className="text-center">
  523. <div className="c-avatar">
  524. <img src={'avatars/6.jpg'} className="c-avatar-img" alt="[email protected]" />
  525. <span className="c-avatar-status bg-danger"></span>
  526. </div>
  527. </td>
  528. <td>
  529. <div>Friderik Dávid</div>
  530. <div className="small text-muted">
  531. <span>New</span> | Registered: Jan 1, 2015
  532. </div>
  533. </td>
  534. <td className="text-center">
  535. <CIcon height={25} name="cif-pl" title="pl" id="pl" />
  536. </td>
  537. <td>
  538. <div className="clearfix">
  539. <div className="float-left">
  540. <strong>43%</strong>
  541. </div>
  542. <div className="float-right">
  543. <small className="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
  544. </div>
  545. </div>
  546. <CProgress className="progress-xs" color="success" value="43" />
  547. </td>
  548. <td className="text-center">
  549. <CIcon height={25} name="cib-cc-amex" />
  550. </td>
  551. <td>
  552. <div className="small text-muted">Last login</div>
  553. <strong>Yesterday</strong>
  554. </td>
  555. </tr>
  556. </tbody>
  557. </table>
  558. </div>
  559. </CCardBody>
  560. </CCard>
  561. </CCol>
  562. </CRow>
  563. </>
  564. );
  565. }
  566. export default DemoComponent14;