feature: add select all/none attachments when submitting waranty/repair/insurance job

This commit is contained in:
Gary Sharp
2024-12-11 15:15:22 +11:00
parent 343f20980d
commit 25e3a8e1f1
15 changed files with 327 additions and 196 deletions
+27 -5
View File
@@ -108,20 +108,24 @@
<table>
<tr>
<td>
<p id="publishJobAttachmentsSelect">
Select <a href="#" class="all">All</a> | <a href="#" class="none">None</a>
</p>
<div id="publishJobAttachments">
@foreach (var ja in Model.Job.JobAttachments)
{
<a href="@Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))" data-attachmentid="@ja.Id" data-mimetype="@ja.MimeType">
<input type="checkbox" class="select" name="AttachmentIds" value="@ja.Id" @(Model.AttachmentIds.Contains(ja.Id) ? "checked" : null) />
<span class="icon" title="@ja.Filename">
<img alt="Attachment Thumbnail" src="@(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id)))" /></span>
<img alt="Attachment Thumbnail" src="@(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id)))" />
</span>
<span class="comments" title="@ja.Comments">
@{if (!string.IsNullOrEmpty(ja.DocumentTemplateId))
{ @ja.DocumentTemplate.Description}
else
{ @ja.Comments }}
{ @ja.DocumentTemplate.Description}
else
{ @ja.Comments }}
</span><span class="author">@ja.TechUser.ToStringFriendly()</span><span class="timestamp" data-livestamp="@(ja.Timestamp.ToUnixEpoc())" title="@ja.Timestamp.ToFullDateTime()">@ja.Timestamp.ToFullDateTime()</span>
</a>
</a>
}
</div>
</td>
@@ -181,5 +185,23 @@
} else {
$('#ProviderId').focus();
}
$('#publishJobAttachments').on('click', 'input', function (e) {
e.preventDefault();
setTimeout(function () {
var $i = $(e.currentTarget);
$i.prop('checked', !$i.prop('checked'));
}, 0);
return false;
});
$('#publishJobAttachmentsSelect').on('click', 'a', function (e) {
e.preventDefault();
var $i = $(e.currentTarget);
var $c = $i.hasClass('all');
setTimeout(function () {
$('#publishJobAttachments').find('input:not(:disabled)').prop('checked', $c).trigger('change');
}, 0);
return false;
});
});
</script>