diff --git a/Views/Vehicle/Index.cshtml b/Views/Vehicle/Index.cshtml index 3a3e42a..0a71ebd 100644 --- a/Views/Vehicle/Index.cshtml +++ b/Views/Vehicle/Index.cshtml @@ -21,6 +21,7 @@ + }
- + @if (Model.Files.Any()) { diff --git a/Views/Vehicle/_GasModal.cshtml b/Views/Vehicle/_GasModal.cshtml index 8986375..759f90b 100644 --- a/Views/Vehicle/_GasModal.cshtml +++ b/Views/Vehicle/_GasModal.cshtml @@ -78,7 +78,7 @@ }
- + @if (Model.GasRecord.Files.Any()) { diff --git a/Views/Vehicle/_OdometerRecordModal.cshtml b/Views/Vehicle/_OdometerRecordModal.cshtml index f0d2a62..21c1b57 100644 --- a/Views/Vehicle/_OdometerRecordModal.cshtml +++ b/Views/Vehicle/_OdometerRecordModal.cshtml @@ -21,7 +21,7 @@
- + @if (Model.Files.Any()) { diff --git a/Views/Vehicle/_PlanRecordModal.cshtml b/Views/Vehicle/_PlanRecordModal.cshtml index fe3dab8..9b6a660 100644 --- a/Views/Vehicle/_PlanRecordModal.cshtml +++ b/Views/Vehicle/_PlanRecordModal.cshtml @@ -45,7 +45,7 @@ }
- + @if (Model.Files.Any()) { diff --git a/Views/Vehicle/_ReminderRecordModal.cshtml b/Views/Vehicle/_ReminderRecordModal.cshtml index a630939..fd24d61 100644 --- a/Views/Vehicle/_ReminderRecordModal.cshtml +++ b/Views/Vehicle/_ReminderRecordModal.cshtml @@ -39,7 +39,7 @@
- +
diff --git a/Views/Vehicle/_ServiceRecordModal.cshtml b/Views/Vehicle/_ServiceRecordModal.cshtml index 4983bf0..24662ad 100644 --- a/Views/Vehicle/_ServiceRecordModal.cshtml +++ b/Views/Vehicle/_ServiceRecordModal.cshtml @@ -29,7 +29,7 @@ }
- + @if (Model.Files.Any()) { diff --git a/Views/Vehicle/_SupplyRecordModal.cshtml b/Views/Vehicle/_SupplyRecordModal.cshtml index 5097f8d..0e35523 100644 --- a/Views/Vehicle/_SupplyRecordModal.cshtml +++ b/Views/Vehicle/_SupplyRecordModal.cshtml @@ -35,7 +35,7 @@
- + @if (Model.Files.Any()) { diff --git a/Views/Vehicle/_TaxRecordModal.cshtml b/Views/Vehicle/_TaxRecordModal.cshtml index 4f4881c..766ed7f 100644 --- a/Views/Vehicle/_TaxRecordModal.cshtml +++ b/Views/Vehicle/_TaxRecordModal.cshtml @@ -23,7 +23,7 @@
- +
diff --git a/Views/Vehicle/_UpgradeRecordModal.cshtml b/Views/Vehicle/_UpgradeRecordModal.cshtml index 097d200..73f9df7 100644 --- a/Views/Vehicle/_UpgradeRecordModal.cshtml +++ b/Views/Vehicle/_UpgradeRecordModal.cshtml @@ -29,7 +29,7 @@ }
- + @if (Model.Files.Any()) { diff --git a/wwwroot/js/vehicle.js b/wwwroot/js/vehicle.js index f406c33..084077e 100644 --- a/wwwroot/js/vehicle.js +++ b/wwwroot/js/vehicle.js @@ -414,4 +414,24 @@ function moveRecord(recordId, source, dest) { $("#workAroundInput").hide(); } }); +} +function showLinks(e) { + $("#workAroundInput").show(); + var textAreaName = $(e.parentElement).attr("for"); + var text = $(`#${textAreaName}`).val(); + if (text == undefined) { + $("#workAroundInput").hide(); + return; + } + if (text.length > 0) { + var formatted = markdown(text); + Swal.fire({ + html: formatted, + confirmButtonText: 'Close', + }).then(() => { + $("#workAroundInput").hide(); + }); + } else { + $("#workAroundInput").hide(); + } } \ No newline at end of file diff --git a/wwwroot/lib/drawdown/drawdown.js b/wwwroot/lib/drawdown/drawdown.js new file mode 100644 index 0000000..bb521f6 --- /dev/null +++ b/wwwroot/lib/drawdown/drawdown.js @@ -0,0 +1,129 @@ +/** + * drawdown.js + * (c) Adam Leggett + */ + + +;function markdown(src) { + + var rx_lt = //g; + var rx_space = /\t|\r|\uf8ff/g; + var rx_escape = /\\([\\\|`*_{}\[\]()#+\-~])/g; + var rx_hr = /^([*\-=_] *){3,}$/gm; + var rx_blockquote = /\n *> *([^]*?)(?=(\n|$){2})/g; + var rx_list = /\n( *)(?:[*\-+]|((\d+)|([a-z])|[A-Z])[.)]) +([^]*?)(?=(\n|$){2})/g; + var rx_listjoin = /<\/(ol|ul)>\n\n<\1>/g; + var rx_highlight = /(^|[^A-Za-z\d\\])(([*_])|(~)|(\^)|(--)|(\+\+)|`)(\2?)([^<]*?)\2\8(?!\2)(?=\W|_|$)/g; + var rx_code = /\n((```|~~~).*\n?([^]*?)\n?\2|(( .*?\n)+))/g; + var rx_link = /((!?)\[(.*?)\]\((.*?)( ".*")?\)|\\([\\`*_{}\[\]()#+\-.!~]))/g; + var rx_table = /\n(( *\|.*?\| *\n)+)/g; + var rx_thead = /^.*\n( *\|( *\:?-+\:?-+\:? *\|)* *\n|)/; + var rx_row = /.*\n/g; + var rx_cell = /\||(.*?[^\\])\|/g; + var rx_heading = /(?=^|>|\n)([>\s]*?)(#{1,6}) (.*?)( #*)? *(?=\n|$)/g; + var rx_para = /(?=^|>|\n)\s*\n+([^<]+?)\n+\s*(?=\n|<|$)/g; + var rx_stash = /-\d+\uf8ff/g; + + function replace(rex, fn) { + src = src.replace(rex, fn); + } + + function element(tag, content) { + return '<' + tag + '>' + content + ''; + } + + function blockquote(src) { + return src.replace(rx_blockquote, function(all, content) { + return element('blockquote', blockquote(highlight(content.replace(/^ *> */gm, '')))); + }); + } + + function list(src) { + return src.replace(rx_list, function(all, ind, ol, num, low, content) { + var entry = element('li', highlight(content.split( + RegExp('\n ?' + ind + '(?:(?:\\d+|[a-zA-Z])[.)]|[*\\-+]) +', 'g')).map(list).join('
  • '))); + + return '\n' + (ol + ? '
      ' + : parseInt(ol,36) - 9 + '" style="list-style-type:' + (low ? 'low' : 'upp') + 'er-alpha">') + entry + '
    ' + : element('ul', entry)); + }); + } + + function highlight(src) { + return src.replace(rx_highlight, function(all, _, p1, emp, sub, sup, small, big, p2, content) { + return _ + element( + emp ? (p2 ? 'strong' : 'em') + : sub ? (p2 ? 's' : 'sub') + : sup ? 'sup' + : small ? 'small' + : big ? 'big' + : 'code', + highlight(content)); + }); + } + + function unesc(str) { + return str.replace(rx_escape, '$1'); + } + + var stash = []; + var si = 0; + + src = '\n' + src + '\n'; + + replace(rx_lt, '<'); + replace(rx_gt, '>'); + replace(rx_space, ' '); + + // blockquote + src = blockquote(src); + + // horizontal rule + replace(rx_hr, '
    '); + + // list + src = list(src); + replace(rx_listjoin, ''); + + // code + replace(rx_code, function(all, p1, p2, p3, p4) { + stash[--si] = element('pre', element('code', p3||p4.replace(/^ /gm, ''))); + return si + '\uf8ff'; + }); + + // link or image + replace(rx_link, function(all, p1, p2, p3, p4, p5, p6) { + stash[--si] = p4 + ? p2 + ? '' + p3 + '' + : '' + unesc(highlight(p3)) + '' + : p6; + return si + '\uf8ff'; + }); + + // table + replace(rx_table, function(all, table) { + var sep = table.match(rx_thead)[1]; + return '\n' + element('table', + table.replace(rx_row, function(row, ri) { + return row == sep ? '' : element('tr', row.replace(rx_cell, function(all, cell, ci) { + return ci ? element(sep && !ri ? 'th' : 'td', unesc(highlight(cell || ''))) : '' + })) + }) + ) + }); + + // heading + replace(rx_heading, function(all, _, p1, p2) { return _ + element('h' + p1.length, unesc(highlight(p2))) }); + + // paragraph + replace(rx_para, function(all, content) { return element('p', unesc(highlight(content))) }); + + // stash + replace(rx_stash, function(all) { return stash[parseInt(all)] }); + + return src.trim(); +};