diff --git a/webapp/src/assets/css/style.css b/webapp/src/assets/css/style.css index afddf33..649f8a4 100644 --- a/webapp/src/assets/css/style.css +++ b/webapp/src/assets/css/style.css @@ -8,8 +8,11 @@ 01 - GENERAL 02 - HEADER 03 - DASHBOARD + 04 - BUG ADD + 05 - ARCHIVE 06 - API 07 - ABOUT + 80 - FORM 99 - LIGHT MODE */ @@ -67,7 +70,8 @@ h1 { line-height: 1.1; } -button { +button, +.button { border-radius: 8px; border: 1px solid var(--color-bg0); padding: 0.6em 1.2em; @@ -79,12 +83,15 @@ button { cursor: pointer; transition: all 0.3s; } -button:hover { +button:hover, +.button:hover { border-color: var(--color-bg1); background-color: var(--color-bg0); } button:focus, -button:focus-visible { +.button:focus, +button:focus-visible, +.button:focus-visible { outline: 4px auto -webkit-focus-ring-color; } @@ -205,6 +212,26 @@ button:focus-visible { #dashboard:has(.dragging) .draggable-item:not(.dragging) .report { opacity: 0.4; } + +/* ---------------------------------------------------- + 04 - BUG ADD + */ +#bug-add { + margin: 0 auto; + padding: 20px; +} +#bug-add .cols { + /* border: 1px red solid; */ + display: flex; + flex-direction: row; + justify-content: space-between; +} + +/* ---------------------------------------------------- + 05 - ARCHIVE + */ + + /* ---------------------------------------------------- 06 - API */ @@ -238,6 +265,34 @@ button:focus-visible { filter: brightness(1.2); } +/* ---------------------------------------------------- + 80 - FORM + */ +.form-group { + margin-bottom: 10px; +} +.form-group label { + display: block; + font-weight: bold; + margin-bottom: 5px; +} +.form-group input, +.form-group textarea { + width: 99%; + padding: 5px; + border: 1px solid #ccc; + border-radius: 3px; + background-color: var(--color-bg2); + color: var(--color-text0); +} +.form-actions { + margin-top: 10px; + text-align: right; +} +.form-actions button { + margin-left: 10px; +} + /* ---------------------------------------------------- 99 - LIGHT MODE */ diff --git a/webapp/src/backend.js b/webapp/src/backend.js new file mode 100644 index 0000000..2f3912d --- /dev/null +++ b/webapp/src/backend.js @@ -0,0 +1,76 @@ +export const backend = { + endpont: __IS_BUILD__ + ? window.location.origin + __SUBPATH__ + "api.php" + : "http://localhost/bugreport/api.php", + + /* ---------------------------------------------------- + * Vsebecne API volanie + */ + call(method, data, callback) { + var xhttp = new XMLHttpRequest(); + xhttp.withCredentials = true; + xhttp.onreadystatechange = function() { + if (this.readyState == 4) { + if (this.status == 200) { + if (callback != null) callback(JSON.parse(this.responseText)); + } else { + if (callback != null) callback({'status': 'ERROR', 'message': 'HTTP STATUS ' + this.status}); + } + } + } + var form_data = new FormData(); + Object.keys(data).forEach(key => { + form_data.append(key, data[key]); + }); + xhttp.open('POST', this.endpont + '?action=' + method); + //xhttp.setRequestHeader('content-type', 'application/x-www-form-urlencoded'); + xhttp.send(form_data); + }, + + callPromise(method, data) { + return new Promise((resolve, reject) => { + this.call(method, data, function(response) { + if (response.status == 'OK') { + resolve(response.data); + } else { + reject(response.msg); + } + }); + }) + }, + + /* ---------------------------------------------------- + * API akcie + */ + add(title, description, status, group, priority) { + return this.callPromise('add', { + title: title, + description: description, + status: status, + group: group, + priority: priority}); + }, + + update(id, title, description, status, group, priority) { + return this.callPromise('update', { + id: id, + title: title, + description: description, + status: status, + group: group, + priority: priority}); + }, + + delete(id) { + return this.callPromise('delete', {id: id}); + }, + + get(id) { + return this.callPromise('get', {id: id}); + }, + + getAll() { + return this.callPromise('getall', {}); + }, + +}; diff --git a/webapp/src/views/BugAdd.vue b/webapp/src/views/BugAdd.vue index 27196bb..6941e06 100644 --- a/webapp/src/views/BugAdd.vue +++ b/webapp/src/views/BugAdd.vue @@ -1,6 +1,193 @@ + + diff --git a/webapp/vite.config.js b/webapp/vite.config.js index 0e1e191..faa40db 100644 --- a/webapp/vite.config.js +++ b/webapp/vite.config.js @@ -21,6 +21,8 @@ export default defineConfig(({ command, mode }) => { __APP_VERSION__: JSON.stringify(pkg.version), __BUILD_DATE__: JSON.stringify(new Date().toISOString()), __SUBPATH__: JSON.stringify(isBuild ? subpath : "/"), + __IS_BUILD__: JSON.stringify(isBuild), + __IS_DEV__: JSON.stringify(isDev), }, }; });