| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <?php
- session_start();
- //Can't come in without logged in
- if (!isset($_SESSION['loggedin'])) {
- header('Location: pages-signin.html');
- exit;
- }
- ?>
- <!doctype html>
- <html class="fixed">
- <head>
- <?php include("bim-support-header.html"); ?>
- <script src="./script/js/global.js"></script>
- <script>
- var isFavorite = false;
- var revitVersion = "";
- var searchURL = window.location.search;
- searchURL = searchURL.substring(1, searchURL.length);
- var name = decodeURIComponent(searchURL.split("&")[0].split("=")[1]);
- var type = searchURL.split("&")[1].split("=")[1];
- var userName = '<?php echo $_SESSION['name']; ?>';
- var header = [];
- var value = [];
- pageHeader = "元件庫";
- </script>
- </head>
- <body>
- <canvas id="c"></canvas>
- <section class="body">
- <!-- start: header -->
- <header-menu></header-menu>
- <!-- end: header -->
- <div class="inner-wrapper">
- <!-- start: sidebar -->
- <side-bar></side-bar>
- <!-- end: sidebar -->
- <section role="main" class="content-body">
- <header class="page-header">
- <h2>{{pageHeader}}</h2>
- </header>
- <!-- start: page -->
- <section class="content-with-menu content-with-menu-has-toolbar media-gallery">
- <div class="content-with-menu-container">
- <inner-menu>
- <template v-slot:inner-upload>
- <upload-component></upload-component>
- <hr class="separator" />
- </template>
- <template v-slot:inner-equipment>
- <equipment-list></equipment-list>
- </template>
- </inner-menu>
- <div class="inner-body mg-main">
- <div class="inner-toolbar">
- <ul>
- <li class="right">
- <a href="#" onclick="window.history.go(-2); return false;"><i class="fa fa-undo"></i> 返回</a>
- </li>
- <li class="right">
- <a href="#" onclick="AddFavorite();"><i id="heart" class="fa fa-heart"></i><span id="favorite"> 加入清單</span></a>
- </li>
- </ul>
- </div>
- <div class="row">
- <div class="col-md-6" id="content" style="width:500px; position: relative; padding: 0 0 0;">
- </div>
- <div class="col-md-offset-1 col-md-6">
- <section class="panel">
- <div class="panel-body" style="padding: 0px;">
- <div class="table-responsive">
- <table class="table table-bordered mb-none">
- <tbody id="table">
- </tbody>
- </table>
- </div>
- </div>
- </section>
- </div>
- </div>
- </div>
- </div>
- </section>
- <!-- end: page -->
- </section>
- </div>
- </section>
- <script>
- /*Vue */
- vm.mount('.body');
- </script>
- <?php include("bim-support-body.html"); ?>
- <script>
- $(document).ready(function() {
- $.ajax({
- url: "./script/php/equipment_group_detail.php",
- type: "GET",
- data: {
- type: type,
- object: name,
- },
- contentType: "application/json",
- dataType: "json"
- }).done(function(data) {
- header = data.header;
- value = data.value;
- for (var i = 0; i < header.length; i++) {
- if (value[i] == null)
- value[i] = "";
- if (header[i] == "元件版本")
- revitVersion = value[i];
- $('#table').append("<tr><td>" + data.header[i] + "</td><td>" + data.value[i] + "</td></tr>");
- }
- }).error(function(error) {
- console.log(error.responseText);
- });
- $.ajax({
- url: "./script/php/addFavorite.php",
- type: "GET",
- data: {
- type: type,
- object: name,
- },
- contentType: "application/json",
- dataType: "json"
- }).done(function(data) {
- isFavorite = data;
- if (isFavorite) {
- $("#heart").css("color", "Tomato");
- $("#favorite").html('移出清單');
- } else {
- $("#heart").css("color", "white");
- $("#favorite").html('加入清單');
- }
- }).error(function(error) {
- console.log(error.responseText);
- });
- });
- function AddFavorite() {
- var stack_bar_top = {
- "dir1": "down",
- "dir2": "right",
- "push": "top",
- "spacing1": 0,
- "spacing2": 0
- };
- if (isFavorite) {
- $.ajax({
- url: "./script/php/addFavorite.php",
- type: "POST",
- data: {
- DelFavorite: type + "/" + name,
- username: userName
- }
- }).done(function(data) {
- var notice = new PNotify({
- title: '通知',
- text: '移出清單成功!',
- type: 'success',
- addclass: 'stack-bar-top',
- stack: stack_bar_top,
- width: "100%"
- });
- isFavorite = false;
- $("#heart").css("color", "white");
- $("#favorite").html('加入清單');
- }).error(function(error) {
- var notice = new PNotify({
- title: '通知',
- text: '移出清單失敗!',
- type: 'error',
- addclass: 'stack-bar-top',
- stack: stack_bar_top,
- width: "100%"
- });
- console.log(error);
- });
- } else {
- $.ajax({
- url: "./script/php/addFavorite.php",
- type: "POST",
- data: {
- AddFavorite: type + "/" + name,
- username: userName,
- revitVersion: revitVersion
- }
- }).done(function(data) {
- var notice = new PNotify({
- title: '通知',
- text: '加入清單成功!',
- type: 'success',
- addclass: 'stack-bar-top',
- stack: stack_bar_top,
- width: "100%"
- });
- isFavorite = true;
- $("#heart").css("color", "Tomato");
- $("#favorite").html('移出清單');
- }).error(function() {
- var notice = new PNotify({
- title: '通知',
- text: '加入清單失敗!',
- type: 'error',
- addclass: 'stack-bar-top',
- stack: stack_bar_top,
- width: "100%"
- });
- });
- }
- }
- </script>
- <!-- Vendor -->
- <script src="script/js/3Dpic-detail.js" type="module" async></script>
- </body>
- </html>
|